Use node-api instead of NAN (#6452)
This commit is contained in:
parent
a1b3efe260
commit
18dcd27a9b
144
.github/workflows/osrm-backend.yml
vendored
144
.github/workflows/osrm-backend.yml
vendored
@ -20,7 +20,7 @@ env:
|
|||||||
ENABLE_NODE_BINDINGS: "ON"
|
ENABLE_NODE_BINDINGS: "ON"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows-release-node:
|
||||||
needs: format-taginfo-docs
|
needs: format-taginfo-docs
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -264,83 +264,7 @@ jobs:
|
|||||||
CXXCOMPILER: g++-8
|
CXXCOMPILER: g++-8
|
||||||
CXXFLAGS: -Wno-cast-function-type
|
CXXFLAGS: -Wno-cast-function-type
|
||||||
|
|
||||||
- name: conan-macos-x64-release-node-16
|
- name: conan-linux-release-node
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 16
|
|
||||||
runs-on: macos-11
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang
|
|
||||||
CXXCOMPILER: clang++
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
ENABLE_ASSERTIONS: ON
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
|
|
||||||
- name: conan-macos-arm64-release-node-16
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 16
|
|
||||||
runs-on: macos-11
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang
|
|
||||||
CXXCOMPILER: clang++
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
ENABLE_ASSERTIONS: ON
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
ENABLE_APPLE_SILICON: ON
|
|
||||||
|
|
||||||
- name: conan-macos-x64-release-node-18
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: macos-11
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang
|
|
||||||
CXXCOMPILER: clang++
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
ENABLE_ASSERTIONS: ON
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
|
|
||||||
- name: conan-macos-arm64-release-node-18
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 18
|
|
||||||
runs-on: macos-11
|
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang
|
|
||||||
CXXCOMPILER: clang++
|
|
||||||
CUCUMBER_TIMEOUT: 60000
|
|
||||||
ENABLE_ASSERTIONS: ON
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
ENABLE_APPLE_SILICON: ON
|
|
||||||
|
|
||||||
- name: node-16-conan-linux-release
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 16
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang-6.0
|
|
||||||
CXXCOMPILER: clang++-6.0
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
|
||||||
|
|
||||||
- name: node-16-conan-linux-debug
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: false
|
|
||||||
node: 16
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
BUILD_TYPE: Debug
|
|
||||||
CCOMPILER: clang-6.0
|
|
||||||
CXXCOMPILER: clang++-6.0
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
|
||||||
|
|
||||||
- name: node-18-conan-linux-release
|
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
@ -351,7 +275,7 @@ jobs:
|
|||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
- name: node-18-conan-linux-debug
|
- name: conan-linux-debug-node
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
@ -362,10 +286,10 @@ jobs:
|
|||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
- name: conan-macos-x64-release-node-latest
|
- name: conan-macos-x64-release-node
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
node: latest
|
node: 18
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang
|
CCOMPILER: clang
|
||||||
@ -374,10 +298,10 @@ jobs:
|
|||||||
ENABLE_ASSERTIONS: ON
|
ENABLE_ASSERTIONS: ON
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
- name: conan-macos-arm64-release-node-latest
|
- name: conan-macos-arm64-release-node
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
node: latest
|
node: 18
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang
|
CCOMPILER: clang
|
||||||
@ -387,28 +311,6 @@ jobs:
|
|||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
ENABLE_APPLE_SILICON: ON
|
ENABLE_APPLE_SILICON: ON
|
||||||
|
|
||||||
- name: node-latest-conan-linux-release
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: true
|
|
||||||
node: latest
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
CCOMPILER: clang-6.0
|
|
||||||
CXXCOMPILER: clang++-6.0
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
|
||||||
|
|
||||||
- name: node-latest-conan-linux-debug
|
|
||||||
build_node_package: true
|
|
||||||
continue-on-error: true
|
|
||||||
node: latest
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
BUILD_TYPE: Debug
|
|
||||||
CCOMPILER: clang-6.0
|
|
||||||
CXXCOMPILER: clang++-6.0
|
|
||||||
ENABLE_CONAN: ON
|
|
||||||
NODE_PACKAGE_TESTS_ONLY: ON
|
|
||||||
|
|
||||||
name: ${{ matrix.name}}
|
name: ${{ matrix.name}}
|
||||||
continue-on-error: ${{ matrix.continue-on-error }}
|
continue-on-error: ${{ matrix.continue-on-error }}
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
@ -627,10 +529,38 @@ jobs:
|
|||||||
./src/benchmarks/packedvector-bench
|
./src/benchmarks/packedvector-bench
|
||||||
./src/benchmarks/rtree-bench ../test/data/monaco.osrm.ramIndex ../test/data/monaco.osrm.fileIndex ../test/data/monaco.osrm.nbg_nodes
|
./src/benchmarks/rtree-bench ../test/data/monaco.osrm.ramIndex ../test/data/monaco.osrm.fileIndex ../test/data/monaco.osrm.nbg_nodes
|
||||||
popd
|
popd
|
||||||
- name: Run Node package tests only
|
|
||||||
|
- name: Use Node 16
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- name: Run Node package tests on Node 16
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
run: |
|
run: |
|
||||||
|
node --version
|
||||||
npm run nodejs-tests
|
npm run nodejs-tests
|
||||||
|
- name: Use Node 18
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
- name: Run Node package tests on Node 18
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
|
run: |
|
||||||
|
node --version
|
||||||
|
npm run nodejs-tests
|
||||||
|
- name: Use Node latest
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
- name: Run Node package tests on Node-latest
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||||
|
run: |
|
||||||
|
node --version
|
||||||
|
npm run nodejs-tests
|
||||||
|
|
||||||
- name: Upload test logs
|
- name: Upload test logs
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: failure()
|
if: failure()
|
||||||
@ -681,6 +611,6 @@ jobs:
|
|||||||
|
|
||||||
ci-complete:
|
ci-complete:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: [build-test-publish, docker-image, windows]
|
needs: [build-test-publish, docker-image, windows-release-node]
|
||||||
steps:
|
steps:
|
||||||
- run: echo "CI complete"
|
- run: echo "CI complete"
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -105,3 +105,4 @@ debug.lua
|
|||||||
|
|
||||||
# node-osrm artifacts
|
# node-osrm artifacts
|
||||||
lib/binding
|
lib/binding
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
|
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
|
||||||
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
|
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
|
||||||
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
|
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
|
||||||
|
- NodeJS:
|
||||||
|
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||||
- Misc:
|
- Misc:
|
||||||
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
|
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
|
||||||
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
|
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
#define OSRM_BINDINGS_NODE_JSON_V8_RENDERER_HPP
|
#define OSRM_BINDINGS_NODE_JSON_V8_RENDERER_HPP
|
||||||
|
|
||||||
#include "osrm/json_container.hpp"
|
#include "osrm/json_container.hpp"
|
||||||
|
#include <napi.h>
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
||||||
#include <nan.h>
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -15,52 +11,56 @@ namespace node_osrm
|
|||||||
|
|
||||||
struct V8Renderer
|
struct V8Renderer
|
||||||
{
|
{
|
||||||
explicit V8Renderer(v8::Local<v8::Value> &_out) : out(_out) {}
|
explicit V8Renderer(const Napi::Env &env, Napi::Value &out) : env(env), out(out) {}
|
||||||
|
|
||||||
void operator()(const osrm::json::String &string) const
|
void operator()(const osrm::json::String &string) const
|
||||||
{
|
{
|
||||||
out = Nan::New(std::cref(string.value)).ToLocalChecked();
|
out = Napi::String::New(env, string.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const osrm::json::Number &number) const { out = Nan::New(number.value); }
|
void operator()(const osrm::json::Number &number) const
|
||||||
|
{
|
||||||
|
out = Napi::Number::New(env, number.value);
|
||||||
|
}
|
||||||
|
|
||||||
void operator()(const osrm::json::Object &object) const
|
void operator()(const osrm::json::Object &object) const
|
||||||
{
|
{
|
||||||
v8::Local<v8::Object> obj = Nan::New<v8::Object>();
|
Napi::Object obj = Napi::Object::New(env);
|
||||||
for (const auto &keyValue : object.values)
|
for (const auto &keyValue : object.values)
|
||||||
{
|
{
|
||||||
v8::Local<v8::Value> child;
|
Napi::Value child;
|
||||||
mapbox::util::apply_visitor(V8Renderer(child), keyValue.second);
|
mapbox::util::apply_visitor(V8Renderer(env, child), keyValue.second);
|
||||||
Nan::Set(obj, Nan::New(keyValue.first).ToLocalChecked(), child);
|
obj.Set(keyValue.first, child);
|
||||||
}
|
}
|
||||||
out = obj;
|
out = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const osrm::json::Array &array) const
|
void operator()(const osrm::json::Array &array) const
|
||||||
{
|
{
|
||||||
v8::Local<v8::Array> a = Nan::New<v8::Array>(array.values.size());
|
Napi::Array a = Napi::Array::New(env, array.values.size());
|
||||||
for (auto i = 0u; i < array.values.size(); ++i)
|
for (auto i = 0u; i < array.values.size(); ++i)
|
||||||
{
|
{
|
||||||
v8::Local<v8::Value> child;
|
Napi::Value child;
|
||||||
mapbox::util::apply_visitor(V8Renderer(child), array.values[i]);
|
mapbox::util::apply_visitor(V8Renderer(env, child), array.values[i]);
|
||||||
Nan::Set(a, i, child);
|
a.Set(i, child);
|
||||||
}
|
}
|
||||||
out = a;
|
out = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const osrm::json::True &) const { out = Nan::New(true); }
|
void operator()(const osrm::json::True &) const { out = Napi::Boolean::New(env, true); }
|
||||||
|
|
||||||
void operator()(const osrm::json::False &) const { out = Nan::New(false); }
|
void operator()(const osrm::json::False &) const { out = Napi::Boolean::New(env, false); }
|
||||||
|
|
||||||
void operator()(const osrm::json::Null &) const { out = Nan::Null(); }
|
void operator()(const osrm::json::Null &) const { out = env.Null(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
v8::Local<v8::Value> &out;
|
const Napi::Env &env;
|
||||||
|
Napi::Value &out;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void renderToV8(v8::Local<v8::Value> &out, const osrm::json::Object &object)
|
inline void renderToV8(const Napi::Env &env, Napi::Value &out, const osrm::json::Object &object)
|
||||||
{
|
{
|
||||||
V8Renderer renderer(out);
|
V8Renderer renderer(env, out);
|
||||||
renderer(object);
|
renderer(object);
|
||||||
}
|
}
|
||||||
} // namespace node_osrm
|
} // namespace node_osrm
|
||||||
|
@ -3,45 +3,30 @@
|
|||||||
|
|
||||||
#include "osrm/osrm_fwd.hpp"
|
#include "osrm/osrm_fwd.hpp"
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#include <napi.h>
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
||||||
#include <nan.h>
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace node_osrm
|
namespace node_osrm
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Engine final : public Nan::ObjectWrap
|
class Engine final : public Napi::ObjectWrap<Engine>
|
||||||
{
|
{
|
||||||
using Base = Nan::ObjectWrap;
|
public:
|
||||||
|
static Napi::Object Init(Napi::Env env, Napi::Object exports);
|
||||||
|
Engine(const Napi::CallbackInfo &info);
|
||||||
|
|
||||||
static NAN_MODULE_INIT(Init);
|
|
||||||
|
|
||||||
static NAN_METHOD(New);
|
|
||||||
|
|
||||||
static NAN_METHOD(route);
|
|
||||||
static NAN_METHOD(nearest);
|
|
||||||
static NAN_METHOD(table);
|
|
||||||
static NAN_METHOD(tile);
|
|
||||||
static NAN_METHOD(match);
|
|
||||||
static NAN_METHOD(trip);
|
|
||||||
|
|
||||||
Engine(osrm::EngineConfig &config);
|
|
||||||
|
|
||||||
// Thread-safe singleton accessor
|
|
||||||
static Nan::Persistent<v8::Function> &constructor();
|
|
||||||
|
|
||||||
// Ref-counted OSRM alive even after shutdown until last callback is done
|
|
||||||
std::shared_ptr<osrm::OSRM> this_;
|
std::shared_ptr<osrm::OSRM> this_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Napi::Value route(const Napi::CallbackInfo &info);
|
||||||
|
Napi::Value nearest(const Napi::CallbackInfo &info);
|
||||||
|
Napi::Value table(const Napi::CallbackInfo &info);
|
||||||
|
Napi::Value tile(const Napi::CallbackInfo &info);
|
||||||
|
Napi::Value match(const Napi::CallbackInfo &info);
|
||||||
|
Napi::Value trip(const Napi::CallbackInfo &info);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace node_osrm
|
} // namespace node_osrm
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
||||||
NAN_MODULE_WORKER_ENABLED(osrm, node_osrm::Engine::Init)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
1
lib/binding_napi_v8
Symbolic link
1
lib/binding_napi_v8
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
binding
|
139
package-lock.json
generated
139
package-lock.json
generated
@ -36,7 +36,7 @@
|
|||||||
"faucet": "^0.0.1",
|
"faucet": "^0.0.1",
|
||||||
"jsonpath": "^1.1.1",
|
"jsonpath": "^1.1.1",
|
||||||
"mkdirp": "^0.5.6",
|
"mkdirp": "^0.5.6",
|
||||||
"nan": "^2.17.0",
|
"node-addon-api": "^5.0.0",
|
||||||
"node-cmake": "^2.5.1",
|
"node-cmake": "^2.5.1",
|
||||||
"node-timeout": "0.0.4",
|
"node-timeout": "0.0.4",
|
||||||
"polyline": "^0.2.0",
|
"polyline": "^0.2.0",
|
||||||
@ -5436,9 +5436,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/color-name": {
|
"node_modules/color-name": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/color-string": {
|
"node_modules/color-string": {
|
||||||
@ -6011,6 +6011,15 @@
|
|||||||
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
|
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/deep-extend": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
||||||
@ -9114,7 +9123,7 @@
|
|||||||
"node_modules/find-up": {
|
"node_modules/find-up": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
||||||
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
|
"integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-exists": "^2.0.0",
|
"path-exists": "^2.0.0",
|
||||||
@ -10038,13 +10047,10 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/graceful-fs": {
|
"node_modules/graceful-fs": {
|
||||||
"version": "4.1.11",
|
"version": "4.2.10",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
||||||
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
|
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"engines": {
|
|
||||||
"node": ">=0.4.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/gulp-sourcemaps": {
|
"node_modules/gulp-sourcemaps": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
@ -11854,7 +11860,7 @@
|
|||||||
"node_modules/load-json-file": {
|
"node_modules/load-json-file": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
"integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
@ -12711,6 +12717,12 @@
|
|||||||
"lower-case": "^1.1.1"
|
"lower-case": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-addon-api": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/node-cmake": {
|
"node_modules/node-cmake": {
|
||||||
"version": "2.5.1",
|
"version": "2.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-cmake/-/node-cmake-2.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-cmake/-/node-cmake-2.5.1.tgz",
|
||||||
@ -13481,7 +13493,7 @@
|
|||||||
"node_modules/path-type": {
|
"node_modules/path-type": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
||||||
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
|
"integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
@ -13536,7 +13548,7 @@
|
|||||||
"node_modules/pify": {
|
"node_modules/pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@ -14276,7 +14288,7 @@
|
|||||||
"node_modules/read-pkg": {
|
"node_modules/read-pkg": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
||||||
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
|
"integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"load-json-file": "^1.0.0",
|
"load-json-file": "^1.0.0",
|
||||||
@ -14290,7 +14302,7 @@
|
|||||||
"node_modules/read-pkg-up": {
|
"node_modules/read-pkg-up": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
||||||
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
|
"integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"find-up": "^1.0.0",
|
"find-up": "^1.0.0",
|
||||||
@ -15126,9 +15138,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/signal-exit": {
|
"node_modules/signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
||||||
},
|
},
|
||||||
"node_modules/simple-concat": {
|
"node_modules/simple-concat": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
@ -16644,15 +16656,6 @@
|
|||||||
"node": ">=4.0.0"
|
"node": ">=4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/table-layout/node_modules/deep-extend": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/table/node_modules/ansi-regex": {
|
"node_modules/table/node_modules/ansi-regex": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||||
@ -18846,9 +18849,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/yargs": {
|
"node_modules/yargs": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.2.tgz",
|
||||||
"integrity": "sha512-huO4Fr1f9PmiJJdll5kwoS2e4GqzGSsMT3PPMpOwoVkOK8ckqAewMTZyA6LXVQWflleb/Z8oPBEvNsMft0XE+g==",
|
"integrity": "sha512-ZEjj/dQYQy0Zx0lgLMLR8QuaqTihnxirir7EwUHp1Axq4e3+k8jXU5K0VLbNvedv1f4EWtBonDIZm0NUr+jCcA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": "^3.0.0",
|
"camelcase": "^3.0.0",
|
||||||
@ -18863,13 +18866,13 @@
|
|||||||
"string-width": "^1.0.2",
|
"string-width": "^1.0.2",
|
||||||
"which-module": "^1.0.0",
|
"which-module": "^1.0.0",
|
||||||
"y18n": "^3.2.1",
|
"y18n": "^3.2.1",
|
||||||
"yargs-parser": "5.0.0-security.0"
|
"yargs-parser": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/yargs-parser": {
|
"node_modules/yargs-parser": {
|
||||||
"version": "5.0.0-security.0",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.1.tgz",
|
||||||
"integrity": "sha512-T69y4Ps64LNesYxeYGYPvfoMTt/7y1XtfpIslUeK4um+9Hu7hlGoRtaDLvdXb7+/tfq4opVa2HRY5xGip022rQ==",
|
"integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": "^3.0.0",
|
"camelcase": "^3.0.0",
|
||||||
@ -23193,9 +23196,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"color-name": {
|
"color-name": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"color-string": {
|
"color-string": {
|
||||||
@ -23690,6 +23693,12 @@
|
|||||||
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
|
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"deep-extend": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"deep-is": {
|
"deep-is": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
||||||
@ -26233,7 +26242,7 @@
|
|||||||
"find-up": {
|
"find-up": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
||||||
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
|
"integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-exists": "^2.0.0",
|
"path-exists": "^2.0.0",
|
||||||
@ -26966,9 +26975,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "4.1.11",
|
"version": "4.2.10",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
||||||
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
|
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"gulp-sourcemaps": {
|
"gulp-sourcemaps": {
|
||||||
@ -28353,7 +28362,7 @@
|
|||||||
"load-json-file": {
|
"load-json-file": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
"integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
@ -29082,6 +29091,12 @@
|
|||||||
"lower-case": "^1.1.1"
|
"lower-case": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node-addon-api": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node-cmake": {
|
"node-cmake": {
|
||||||
"version": "2.5.1",
|
"version": "2.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-cmake/-/node-cmake-2.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-cmake/-/node-cmake-2.5.1.tgz",
|
||||||
@ -29696,7 +29711,7 @@
|
|||||||
"path-type": {
|
"path-type": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
||||||
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
|
"integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
@ -29739,7 +29754,7 @@
|
|||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"pinkie": {
|
"pinkie": {
|
||||||
@ -30383,7 +30398,7 @@
|
|||||||
"read-pkg": {
|
"read-pkg": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
||||||
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
|
"integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"load-json-file": "^1.0.0",
|
"load-json-file": "^1.0.0",
|
||||||
@ -30394,7 +30409,7 @@
|
|||||||
"read-pkg-up": {
|
"read-pkg-up": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
||||||
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
|
"integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"find-up": "^1.0.0",
|
"find-up": "^1.0.0",
|
||||||
@ -31099,9 +31114,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
||||||
},
|
},
|
||||||
"simple-concat": {
|
"simple-concat": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
@ -32325,14 +32340,6 @@
|
|||||||
"lodash.padend": "^4.6.1",
|
"lodash.padend": "^4.6.1",
|
||||||
"typical": "^2.6.1",
|
"typical": "^2.6.1",
|
||||||
"wordwrapjs": "^3.0.0"
|
"wordwrapjs": "^3.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"deep-extend": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tap-parser": {
|
"tap-parser": {
|
||||||
@ -34121,9 +34128,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.2.tgz",
|
||||||
"integrity": "sha512-huO4Fr1f9PmiJJdll5kwoS2e4GqzGSsMT3PPMpOwoVkOK8ckqAewMTZyA6LXVQWflleb/Z8oPBEvNsMft0XE+g==",
|
"integrity": "sha512-ZEjj/dQYQy0Zx0lgLMLR8QuaqTihnxirir7EwUHp1Axq4e3+k8jXU5K0VLbNvedv1f4EWtBonDIZm0NUr+jCcA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0",
|
"camelcase": "^3.0.0",
|
||||||
@ -34138,13 +34145,13 @@
|
|||||||
"string-width": "^1.0.2",
|
"string-width": "^1.0.2",
|
||||||
"which-module": "^1.0.0",
|
"which-module": "^1.0.0",
|
||||||
"y18n": "^3.2.1",
|
"y18n": "^3.2.1",
|
||||||
"yargs-parser": "5.0.0-security.0"
|
"yargs-parser": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs-parser": {
|
"yargs-parser": {
|
||||||
"version": "5.0.0-security.0",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.1.tgz",
|
||||||
"integrity": "sha512-T69y4Ps64LNesYxeYGYPvfoMTt/7y1XtfpIslUeK4um+9Hu7hlGoRtaDLvdXb7+/tfq4opVa2HRY5xGip022rQ==",
|
"integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0",
|
"camelcase": "^3.0.0",
|
||||||
|
15
package.json
15
package.json
@ -45,6 +45,7 @@
|
|||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
"browserify": "^17.0.0",
|
"browserify": "^17.0.0",
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
|
"cheap-ruler": "^3.0.2",
|
||||||
"command-line-args": "^5.2.1",
|
"command-line-args": "^5.2.1",
|
||||||
"command-line-usage": "^5.0.4",
|
"command-line-usage": "^5.0.4",
|
||||||
"csv-stringify": "^3.0.0",
|
"csv-stringify": "^3.0.0",
|
||||||
@ -55,26 +56,26 @@
|
|||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"faucet": "^0.0.1",
|
"faucet": "^0.0.1",
|
||||||
"jsonpath": "^1.1.1",
|
"jsonpath": "^1.1.1",
|
||||||
|
"mkdirp": "^0.5.6",
|
||||||
|
"node-addon-api": "^5.0.0",
|
||||||
"node-timeout": "0.0.4",
|
"node-timeout": "0.0.4",
|
||||||
"polyline": "^0.2.0",
|
"polyline": "^0.2.0",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
|
"rimraf": "^2.7.1",
|
||||||
"tape": "^4.16.0",
|
"tape": "^4.16.0",
|
||||||
"turf": "^3.0.14",
|
"turf": "^3.0.14",
|
||||||
"uglify-js": "^3.17.0",
|
"uglify-js": "^3.17.0",
|
||||||
"xmlbuilder": "^4.2.1",
|
"xmlbuilder": "^4.2.1",
|
||||||
"cheap-ruler": "^3.0.2",
|
"node-cmake": "^2.5.1"
|
||||||
"mkdirp": "^0.5.6",
|
|
||||||
"nan": "^2.17.0",
|
|
||||||
"node-cmake": "^2.5.1",
|
|
||||||
"rimraf": "^2.7.1"
|
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"binary": {
|
"binary": {
|
||||||
|
"napi_versions": [8],
|
||||||
"module_name": "node_osrm",
|
"module_name": "node_osrm",
|
||||||
"module_path": "./lib/binding/",
|
"module_path": "./lib/binding_napi_v{napi_build_version}/",
|
||||||
"host": "https://github.com",
|
"host": "https://github.com",
|
||||||
"remote_path": "./Project-OSRM/osrm-backend/releases/download/v{version}/",
|
"remote_path": "./Project-OSRM/osrm-backend/releases/download/v{version}/",
|
||||||
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}-{configuration}.tar.gz"
|
"package_name": "{module_name}-v{version}-{napi_build_version}-{platform}-{arch}-{configuration}.tar.gz"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -4,6 +4,9 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
|
|
||||||
message(STATUS "Building node_osrm")
|
message(STATUS "Building node_osrm")
|
||||||
|
|
||||||
|
set(NAPI_VERSION 8)
|
||||||
|
add_definitions(-DNAPI_VERSION=${NAPI_VERSION})
|
||||||
|
|
||||||
set(BINDING_DIR "${PROJECT_SOURCE_DIR}/lib/binding")
|
set(BINDING_DIR "${PROJECT_SOURCE_DIR}/lib/binding")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/node_modules/node-cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/node_modules/node-cmake")
|
||||||
@ -13,6 +16,7 @@ nodejs_init()
|
|||||||
|
|
||||||
message(STATUS "Configuring node_osrm bindings for NodeJs ${NODEJS_VERSION}")
|
message(STATUS "Configuring node_osrm bindings for NodeJs ${NODEJS_VERSION}")
|
||||||
|
|
||||||
|
|
||||||
add_nodejs_module(node_osrm node_osrm.cpp)
|
add_nodejs_module(node_osrm node_osrm.cpp)
|
||||||
set_target_properties(node_osrm PROPERTIES CXX_STANDARD 17)
|
set_target_properties(node_osrm PROPERTIES CXX_STANDARD 17)
|
||||||
# TODO: we disable clang-tidy for this target, because it causes errors in third-party NodeJs related headers
|
# TODO: we disable clang-tidy for this target, because it causes errors in third-party NodeJs related headers
|
||||||
@ -21,6 +25,14 @@ set_target_properties(node_osrm PROPERTIES CXX_CLANG_TIDY "")
|
|||||||
target_no_warning(node_osrm suggest-destructor-override)
|
target_no_warning(node_osrm suggest-destructor-override)
|
||||||
target_no_warning(node_osrm suggest-override)
|
target_no_warning(node_osrm suggest-override)
|
||||||
|
|
||||||
|
# https://github.com/cjntaylor/node-cmake/issues/53#issuecomment-842357457
|
||||||
|
execute_process(COMMAND node -p "require('node-addon-api').include" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_ADDON_API_DIR)
|
||||||
|
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
|
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
|
|
||||||
|
target_include_directories(node_osrm SYSTEM PRIVATE ${NODE_ADDON_API_DIR})
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(node_osrm osrm)
|
target_link_libraries(node_osrm osrm)
|
||||||
|
|
||||||
# node_osrm artifacts in ${BINDING_DIR} to depend targets on
|
# node_osrm artifacts in ${BINDING_DIR} to depend targets on
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "osrm/engine_config.hpp"
|
#include "osrm/engine_config.hpp"
|
||||||
#include "osrm/osrm.hpp"
|
#include "osrm/osrm.hpp"
|
||||||
|
|
||||||
@ -9,6 +11,7 @@
|
|||||||
#include "osrm/trip_parameters.hpp"
|
#include "osrm/trip_parameters.hpp"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <napi.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -21,35 +24,25 @@
|
|||||||
|
|
||||||
namespace node_osrm
|
namespace node_osrm
|
||||||
{
|
{
|
||||||
|
Napi::Object Engine::Init(Napi::Env env, Napi::Object exports)
|
||||||
Engine::Engine(osrm::EngineConfig &config) : Base(), this_(std::make_shared<osrm::OSRM>(config)) {}
|
|
||||||
|
|
||||||
Nan::Persistent<v8::Function> &Engine::constructor()
|
|
||||||
{
|
{
|
||||||
static Nan::Persistent<v8::Function> init;
|
Napi::Function func = DefineClass(env,
|
||||||
return init;
|
"OSRM",
|
||||||
}
|
|
||||||
|
|
||||||
NAN_MODULE_INIT(Engine::Init)
|
|
||||||
{
|
{
|
||||||
const auto whoami = Nan::New("OSRM").ToLocalChecked();
|
InstanceMethod("route", &Engine::route),
|
||||||
|
InstanceMethod("nearest", &Engine::nearest),
|
||||||
|
InstanceMethod("table", &Engine::table),
|
||||||
|
InstanceMethod("tile", &Engine::tile),
|
||||||
|
InstanceMethod("match", &Engine::match),
|
||||||
|
InstanceMethod("trip", &Engine::trip),
|
||||||
|
});
|
||||||
|
|
||||||
auto fnTp = Nan::New<v8::FunctionTemplate>(New);
|
Napi::FunctionReference *constructor = new Napi::FunctionReference();
|
||||||
fnTp->InstanceTemplate()->SetInternalFieldCount(1);
|
*constructor = Napi::Persistent(func);
|
||||||
fnTp->SetClassName(whoami);
|
env.SetInstanceData(constructor);
|
||||||
|
|
||||||
SetPrototypeMethod(fnTp, "route", route);
|
exports.Set("OSRM", func);
|
||||||
SetPrototypeMethod(fnTp, "nearest", nearest);
|
return exports;
|
||||||
SetPrototypeMethod(fnTp, "table", table);
|
|
||||||
SetPrototypeMethod(fnTp, "tile", tile);
|
|
||||||
SetPrototypeMethod(fnTp, "match", match);
|
|
||||||
SetPrototypeMethod(fnTp, "trip", trip);
|
|
||||||
|
|
||||||
const auto fn = Nan::GetFunction(fnTp).ToLocalChecked();
|
|
||||||
|
|
||||||
constructor().Reset(fn);
|
|
||||||
|
|
||||||
Nan::Set(target, whoami, fn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -93,35 +86,25 @@ NAN_MODULE_INIT(Engine::Init)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::New)
|
Engine::Engine(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Engine>(info)
|
||||||
{
|
|
||||||
if (info.IsConstructCall())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto config = argumentsToEngineConfig(info);
|
auto config = argumentsToEngineConfig(info);
|
||||||
if (!config)
|
if (!config)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto *const self = new Engine(*config);
|
this_ = std::make_shared<osrm::OSRM>(*config);
|
||||||
self->Wrap(info.This());
|
|
||||||
}
|
}
|
||||||
catch (const std::exception &ex)
|
catch (const std::exception &ex)
|
||||||
{
|
{
|
||||||
return Nan::ThrowTypeError(ex.what());
|
ThrowTypeError(info.Env(), ex.what());
|
||||||
}
|
|
||||||
|
|
||||||
info.GetReturnValue().Set(info.This());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Nan::ThrowTypeError(
|
|
||||||
"Cannot call constructor as function, you need to use 'new' keyword");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ParameterParser, typename ServiceMemFn>
|
template <typename ParameterParser, typename ServiceMemFn>
|
||||||
inline void async(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
inline void async(const Napi::CallbackInfo &info,
|
||||||
ParameterParser argsToParams,
|
ParameterParser argsToParams,
|
||||||
ServiceMemFn service,
|
ServiceMemFn service,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
@ -133,22 +116,21 @@ inline void async(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
|
|
||||||
BOOST_ASSERT(params->IsValid());
|
BOOST_ASSERT(params->IsValid());
|
||||||
|
|
||||||
if (!info[info.Length() - 1]->IsFunction())
|
if (!info[info.Length() - 1].IsFunction())
|
||||||
return Nan::ThrowTypeError("last argument must be a callback function");
|
return ThrowTypeError(info.Env(), "last argument must be a callback function");
|
||||||
|
|
||||||
auto *const self = Nan::ObjectWrap::Unwrap<Engine>(info.Holder());
|
auto *const self = Napi::ObjectWrap<Engine>::Unwrap(info.This().As<Napi::Object>());
|
||||||
using ParamPtr = decltype(params);
|
using ParamPtr = decltype(params);
|
||||||
|
|
||||||
struct Worker final : Nan::AsyncWorker
|
struct Worker final : Napi::AsyncWorker
|
||||||
{
|
{
|
||||||
Worker(std::shared_ptr<osrm::OSRM> osrm_,
|
Worker(std::shared_ptr<osrm::OSRM> osrm_,
|
||||||
ParamPtr params_,
|
ParamPtr params_,
|
||||||
ServiceMemFn service,
|
ServiceMemFn service,
|
||||||
Nan::Callback *callback,
|
Napi::Function callback,
|
||||||
PluginParameters pluginParams_)
|
PluginParameters pluginParams_)
|
||||||
: Nan::AsyncWorker(callback, "osrm:async"), osrm{std::move(osrm_)},
|
: Napi::AsyncWorker(callback), osrm{std::move(osrm_)}, service{std::move(service)},
|
||||||
service{std::move(service)}, params{std::move(params_)}, pluginParams{
|
params{std::move(params_)}, pluginParams{std::move(pluginParams_)}
|
||||||
std::move(pluginParams_)}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,17 +176,14 @@ inline void async(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
SetErrorMessage(e.what());
|
SetError(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleOKCallback() override
|
void OnOK() override
|
||||||
{
|
{
|
||||||
Nan::HandleScope scope;
|
Napi::HandleScope scope{Env()};
|
||||||
|
|
||||||
const constexpr auto argc = 2u;
|
Callback().Call({Env().Null(), render(Env(), result)});
|
||||||
v8::Local<v8::Value> argv[argc] = {Nan::Null(), render(result)};
|
|
||||||
|
|
||||||
callback->Call(argc, argv, async_resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeps the OSRM object alive even after shutdown until we're done with callback
|
// Keeps the OSRM object alive even after shutdown until we're done with callback
|
||||||
@ -216,13 +195,14 @@ inline void async(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
ObjectOrString result;
|
ObjectOrString result;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto *callback = new Nan::Callback{info[info.Length() - 1].As<v8::Function>()};
|
Napi::Function callback = info[info.Length() - 1].As<Napi::Function>();
|
||||||
Nan::AsyncQueueWorker(
|
auto worker =
|
||||||
new Worker{self->this_, std::move(params), service, callback, std::move(pluginParams)});
|
new Worker(self->this_, std::move(params), service, callback, std::move(pluginParams));
|
||||||
|
worker->Queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ParameterParser, typename ServiceMemFn>
|
template <typename ParameterParser, typename ServiceMemFn>
|
||||||
inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
inline void asyncForTiles(const Napi::CallbackInfo &info,
|
||||||
ParameterParser argsToParams,
|
ParameterParser argsToParams,
|
||||||
ServiceMemFn service,
|
ServiceMemFn service,
|
||||||
bool requires_multiple_coordinates)
|
bool requires_multiple_coordinates)
|
||||||
@ -235,22 +215,21 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
|
|
||||||
BOOST_ASSERT(params->IsValid());
|
BOOST_ASSERT(params->IsValid());
|
||||||
|
|
||||||
if (!info[info.Length() - 1]->IsFunction())
|
if (!info[info.Length() - 1].IsFunction())
|
||||||
return Nan::ThrowTypeError("last argument must be a callback function");
|
return ThrowTypeError(info.Env(), "last argument must be a callback function");
|
||||||
|
|
||||||
auto *const self = Nan::ObjectWrap::Unwrap<Engine>(info.Holder());
|
auto *const self = Napi::ObjectWrap<Engine>::Unwrap(info.This().As<Napi::Object>());
|
||||||
using ParamPtr = decltype(params);
|
using ParamPtr = decltype(params);
|
||||||
|
|
||||||
struct Worker final : Nan::AsyncWorker
|
struct Worker final : Napi::AsyncWorker
|
||||||
{
|
{
|
||||||
Worker(std::shared_ptr<osrm::OSRM> osrm_,
|
Worker(std::shared_ptr<osrm::OSRM> osrm_,
|
||||||
ParamPtr params_,
|
ParamPtr params_,
|
||||||
ServiceMemFn service,
|
ServiceMemFn service,
|
||||||
Nan::Callback *callback,
|
Napi::Function callback,
|
||||||
PluginParameters pluginParams_)
|
PluginParameters pluginParams_)
|
||||||
: Nan::AsyncWorker(callback, "osrm:asyncForTiles"), osrm{std::move(osrm_)},
|
: Napi::AsyncWorker(callback), osrm{std::move(osrm_)}, service{std::move(service)},
|
||||||
service{std::move(service)}, params{std::move(params_)}, pluginParams{
|
params{std::move(params_)}, pluginParams{std::move(pluginParams_)}
|
||||||
std::move(pluginParams_)}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,18 +243,14 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
SetErrorMessage(e.what());
|
SetError(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleOKCallback() override
|
void OnOK() override
|
||||||
{
|
{
|
||||||
Nan::HandleScope scope;
|
Napi::HandleScope scope{Env()};
|
||||||
|
|
||||||
const constexpr auto argc = 2u;
|
Callback().Call({Env().Null(), render(Env(), result.get<std::string>())});
|
||||||
auto str_result = result.get<std::string>();
|
|
||||||
v8::Local<v8::Value> argv[argc] = {Nan::Null(), render(str_result)};
|
|
||||||
|
|
||||||
callback->Call(argc, argv, async_resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeps the OSRM object alive even after shutdown until we're done with callback
|
// Keeps the OSRM object alive even after shutdown until we're done with callback
|
||||||
@ -287,9 +262,10 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
osrm::engine::api::ResultT result;
|
osrm::engine::api::ResultT result;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto *callback = new Nan::Callback{info[info.Length() - 1].As<v8::Function>()};
|
Napi::Function callback = info[info.Length() - 1].As<Napi::Function>();
|
||||||
Nan::AsyncQueueWorker(
|
auto worker =
|
||||||
new Worker{self->this_, std::move(params), service, callback, std::move(pluginParams)});
|
new Worker(self->this_, std::move(params), service, callback, std::move(pluginParams));
|
||||||
|
worker->Queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -333,12 +309,13 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::route) //
|
Napi::Value Engine::route(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*route_fn)(const osrm::RouteParameters ¶ms,
|
osrm::Status (osrm::OSRM::*route_fn)(const osrm::RouteParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Route;
|
&osrm::OSRM::Route;
|
||||||
async(info, &argumentsToRouteParameter, route_fn, true);
|
async(info, &argumentsToRouteParameter, route_fn, true);
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -379,12 +356,13 @@ NAN_METHOD(Engine::route) //
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::nearest) //
|
Napi::Value Engine::nearest(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*nearest_fn)(const osrm::NearestParameters ¶ms,
|
osrm::Status (osrm::OSRM::*nearest_fn)(const osrm::NearestParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Nearest;
|
&osrm::OSRM::Nearest;
|
||||||
async(info, &argumentsToNearestParameter, nearest_fn, false);
|
async(info, &argumentsToNearestParameter, nearest_fn, false);
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -410,7 +388,6 @@ NAN_METHOD(Engine::nearest) //
|
|||||||
* @param {Number} [options.scale_factor] Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
* @param {Number} [options.scale_factor] Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
||||||
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||||
* @param {Array} [options.annotations] Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default), `[distance']` (return the distance matrix), or `['duration', distance']` (return both the duration matrix and the distance matrix).
|
* @param {Array} [options.annotations] Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default), `[distance']` (return the distance matrix), or `['duration', distance']` (return both the duration matrix and the distance matrix).
|
||||||
|
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*
|
*
|
||||||
* @returns {Object} containing `durations`, `distances`, `sources`, and `destinations`.
|
* @returns {Object} containing `durations`, `distances`, `sources`, and `destinations`.
|
||||||
@ -439,12 +416,13 @@ NAN_METHOD(Engine::nearest) //
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::table) //
|
Napi::Value Engine::table(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*table_fn)(const osrm::TableParameters ¶ms,
|
osrm::Status (osrm::OSRM::*table_fn)(const osrm::TableParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Table;
|
&osrm::OSRM::Table;
|
||||||
async(info, &argumentsToTableParameter, table_fn, true);
|
async(info, &argumentsToTableParameter, table_fn, true);
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -473,12 +451,13 @@ NAN_METHOD(Engine::table) //
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::tile)
|
Napi::Value Engine::tile(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*tile_fn)(const osrm::TileParameters ¶ms,
|
osrm::Status (osrm::OSRM::*tile_fn)(const osrm::TileParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Tile;
|
&osrm::OSRM::Tile;
|
||||||
asyncForTiles(info, &argumentsToTileParameters, tile_fn, {/*unused*/});
|
asyncForTiles(info, &argumentsToTileParameters, tile_fn, {/*unused*/});
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -536,12 +515,13 @@ NAN_METHOD(Engine::tile)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::match) //
|
Napi::Value Engine::match(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*match_fn)(const osrm::MatchParameters ¶ms,
|
osrm::Status (osrm::OSRM::*match_fn)(const osrm::MatchParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Match;
|
&osrm::OSRM::Match;
|
||||||
async(info, &argumentsToMatchParameter, match_fn, true);
|
async(info, &argumentsToMatchParameter, match_fn, true);
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -611,12 +591,13 @@ NAN_METHOD(Engine::match) //
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
// clang-format on
|
// clang-format on
|
||||||
NAN_METHOD(Engine::trip) //
|
Napi::Value Engine::trip(const Napi::CallbackInfo &info)
|
||||||
{
|
{
|
||||||
osrm::Status (osrm::OSRM::*trip_fn)(const osrm::TripParameters ¶ms,
|
osrm::Status (osrm::OSRM::*trip_fn)(const osrm::TripParameters ¶ms,
|
||||||
osrm::engine::api::ResultT &result) const =
|
osrm::engine::api::ResultT &result) const =
|
||||||
&osrm::OSRM::Trip;
|
&osrm::OSRM::Trip;
|
||||||
async(info, &argumentsToTripParameter, trip_fn, true);
|
async(info, &argumentsToTripParameter, trip_fn, true);
|
||||||
|
return info.Env().Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -710,3 +691,10 @@ NAN_METHOD(Engine::trip) //
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
} // namespace node_osrm
|
} // namespace node_osrm
|
||||||
|
|
||||||
|
Napi::Object InitAll(Napi::Env env, Napi::Object exports)
|
||||||
|
{
|
||||||
|
return node_osrm::Engine::Init(env, exports);
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_API_MODULE(addon, InitAll)
|
||||||
|
51
test/nodejs/benchmark.js
Normal file
51
test/nodejs/benchmark.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
const OSRM = require('../../');
|
||||||
|
const {performance, createHistogram} = require('node:perf_hooks');
|
||||||
|
|
||||||
|
// usage: node test/nodejs/benchmark.js berlin-latest.osrm 13.388860,52.517037;13.385983,52.496891
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const path = args[0] || require('./constants').mld_data_path;
|
||||||
|
|
||||||
|
function parseWaypoints(waypoints) {
|
||||||
|
if (waypoints == undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return waypoints.split(';').map((waypoint) => {
|
||||||
|
const [lon, lat] = waypoint.split(',');
|
||||||
|
return [parseFloat(lon), parseFloat(lat)];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const waypoints = parseWaypoints(args[1]) || [[7.41337, 43.72956],[7.41546, 43.73077]];
|
||||||
|
const osrm = new OSRM({path, algorithm: 'MLD'});
|
||||||
|
|
||||||
|
async function route(coordinates) {
|
||||||
|
const promise = new Promise((resolve, reject) => {
|
||||||
|
osrm.route({coordinates, steps: true, overview: 'full'}, (err, result) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function benchmark() {
|
||||||
|
// warmup
|
||||||
|
await route(waypoints);
|
||||||
|
|
||||||
|
const performanceHistorgram = createHistogram();
|
||||||
|
|
||||||
|
for (let i = 0; i < 1000; i++) {
|
||||||
|
const start = performance.now();
|
||||||
|
await route(waypoints);
|
||||||
|
const end = performance.now();
|
||||||
|
// record result in microseconds
|
||||||
|
performanceHistorgram.record(Math.ceil((end - start) * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log(performanceHistorgram);
|
||||||
|
}
|
||||||
|
benchmark();
|
||||||
|
|
@ -8,7 +8,7 @@ var monaco_corech_path = require('./constants').corech_data_path;
|
|||||||
test('constructor: throws if new keyword is not used', function(assert) {
|
test('constructor: throws if new keyword is not used', function(assert) {
|
||||||
assert.plan(1);
|
assert.plan(1);
|
||||||
assert.throws(function() { OSRM(); },
|
assert.throws(function() { OSRM(); },
|
||||||
/Cannot call constructor as function, you need to use 'new' keyword/);
|
/Class constructors cannot be invoked without 'new'/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('constructor: uses defaults with no parameter', function(assert) {
|
test('constructor: uses defaults with no parameter', function(assert) {
|
||||||
|
Loading…
Reference in New Issue
Block a user