@crossbind/core-embind-napi 0.0.0-bootstrap.0 → 2.0.0-beta.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -3
- package/cpp/CMakeLists.txt +76 -0
- package/cpp/check-undefined.cmake +38 -0
- package/cpp/src/node_api_module.cpp +157 -0
- package/js/addonLocation.js +13 -0
- package/js/addonPlatform.js +19 -0
- package/js/loader.js +97 -0
- package/js/missingAddon.js +9 -0
- package/js/stopOnExit.js +15 -0
- package/js/unpackedPath.js +5 -0
- package/package.json +29 -6
- package/third_party/node-api-jsi/LICENSE +21 -0
- package/third_party/node-api-jsi/README.md +59 -0
- package/third_party/node-api-jsi/jsi/jsi/instrumentation.h +150 -0
- package/third_party/node-api-jsi/jsi/jsi/jsi-inl.h +425 -0
- package/third_party/node-api-jsi/jsi/jsi/jsi.cpp +990 -0
- package/third_party/node-api-jsi/jsi/jsi/jsi.h +2031 -0
- package/third_party/node-api-jsi/node-api/js_native_api.h +627 -0
- package/third_party/node-api-jsi/node-api/js_native_api_types.h +211 -0
- package/third_party/node-api-jsi/node-api/js_runtime_api.h +214 -0
- package/third_party/node-api-jsi/node-api/node_api.h +270 -0
- package/third_party/node-api-jsi/node-api/node_api_types.h +52 -0
- package/third_party/node-api-jsi/src/ApiLoaders/JSRuntimeApi.cpp +79 -0
- package/third_party/node-api-jsi/src/ApiLoaders/JSRuntimeApi.h +51 -0
- package/third_party/node-api-jsi/src/ApiLoaders/JSRuntimeApi.inc +50 -0
- package/third_party/node-api-jsi/src/ApiLoaders/NodeApi.cpp +41 -0
- package/third_party/node-api-jsi/src/ApiLoaders/NodeApi.h +127 -0
- package/third_party/node-api-jsi/src/ApiLoaders/NodeApi.inc +125 -0
- package/third_party/node-api-jsi/src/ApiLoaders/NodeApi_posix.cpp +16 -0
- package/third_party/node-api-jsi/src/ApiLoaders/NodeApi_win.cpp +23 -0
- package/third_party/node-api-jsi/src/NodeApiJsiRuntime.cpp +3872 -0
- package/third_party/node-api-jsi/src/NodeApiJsiRuntime.h +39 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
#ifndef NODEAPIJSIRUNTIME_H_
|
|
6
|
+
#define NODEAPIJSIRUNTIME_H_
|
|
7
|
+
|
|
8
|
+
#include <jsi/jsi.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <memory>
|
|
11
|
+
#include "ApiLoaders/JSRuntimeApi.h"
|
|
12
|
+
|
|
13
|
+
namespace Microsoft::NodeApiJsi {
|
|
14
|
+
|
|
15
|
+
std::unique_ptr<facebook::jsi::Runtime> makeNodeApiJsiRuntime(
|
|
16
|
+
napi_env env,
|
|
17
|
+
JSRuntimeApi *jsrApi,
|
|
18
|
+
std::function<void()> onDelete,
|
|
19
|
+
napi_value globalScope = nullptr) noexcept;
|
|
20
|
+
|
|
21
|
+
struct NodeApiEnvScope {
|
|
22
|
+
NodeApiEnvScope(napi_env env) : env_(env) {
|
|
23
|
+
JSRuntimeApi::current()->jsr_open_napi_env_scope(env, &scope_);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
NodeApiEnvScope(const NodeApiEnvScope &) = delete;
|
|
27
|
+
NodeApiEnvScope &operator=(const NodeApiEnvScope &) = delete;
|
|
28
|
+
|
|
29
|
+
~NodeApiEnvScope() {
|
|
30
|
+
JSRuntimeApi::current()->jsr_close_napi_env_scope(env_, scope_);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
napi_env env_{};
|
|
35
|
+
jsr_napi_env_scope scope_{};
|
|
36
|
+
};
|
|
37
|
+
} // namespace Microsoft::NodeApiJsi
|
|
38
|
+
|
|
39
|
+
#endif // !NODEAPIJSIRUNTIME_H_
|