jazz-napi 2.0.0-alpha.13 → 2.0.0-alpha.14
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/index.d.ts +24 -7
- package/index.js +688 -231
- package/package.json +13 -16
package/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
1
|
/* auto-generated by NAPI-RS */
|
|
5
|
-
|
|
6
|
-
export declare function generateId(): string;
|
|
7
|
-
export declare function currentTimestamp(): number;
|
|
8
|
-
export declare function parseSchema(json: string): any;
|
|
2
|
+
/* eslint-disable */
|
|
9
3
|
export declare class NapiRuntime {
|
|
10
4
|
/** Create a new NapiRuntime with SurrealKV-backed persistent storage. */
|
|
11
5
|
constructor(
|
|
@@ -16,6 +10,14 @@ export declare class NapiRuntime {
|
|
|
16
10
|
dataPath: string,
|
|
17
11
|
tier?: string | undefined | null,
|
|
18
12
|
);
|
|
13
|
+
/** Create a new NapiRuntime with in-memory storage (no local persistence). */
|
|
14
|
+
static inMemory(
|
|
15
|
+
schemaJson: string,
|
|
16
|
+
appId: string,
|
|
17
|
+
jazzEnv: string,
|
|
18
|
+
userBranch: string,
|
|
19
|
+
tier?: string | undefined | null,
|
|
20
|
+
): NapiRuntime;
|
|
19
21
|
insert(table: string, values: any): string;
|
|
20
22
|
update(objectId: string, values: any): void;
|
|
21
23
|
delete(objectId: string): void;
|
|
@@ -33,6 +35,15 @@ export declare class NapiRuntime {
|
|
|
33
35
|
optionsJson?: string | undefined | null,
|
|
34
36
|
): number;
|
|
35
37
|
unsubscribe(handle: number): void;
|
|
38
|
+
/** Phase 1 of 2-phase subscribe: allocate a handle and store query params. */
|
|
39
|
+
createSubscription(
|
|
40
|
+
queryJson: string,
|
|
41
|
+
sessionJson?: string | undefined | null,
|
|
42
|
+
tier?: string | undefined | null,
|
|
43
|
+
optionsJson?: string | undefined | null,
|
|
44
|
+
): number;
|
|
45
|
+
/** Phase 2 of 2-phase subscribe: compile, register, sync, attach callback, tick. */
|
|
46
|
+
executeSubscription(handle: number, onUpdate: (...args: any[]) => any): void;
|
|
36
47
|
insertDurable(table: string, values: any, tier: string): Promise<string>;
|
|
37
48
|
updateDurable(objectId: string, values: any, tier: string): Promise<void>;
|
|
38
49
|
deleteDurable(objectId: string, tier: string): Promise<void>;
|
|
@@ -51,3 +62,9 @@ export declare class NapiRuntime {
|
|
|
51
62
|
/** Flush and close the underlying storage, releasing filesystem locks. */
|
|
52
63
|
close(): void;
|
|
53
64
|
}
|
|
65
|
+
|
|
66
|
+
export declare function currentTimestamp(): number;
|
|
67
|
+
|
|
68
|
+
export declare function generateId(): string;
|
|
69
|
+
|
|
70
|
+
export declare function parseSchema(json: string): any;
|
package/index.js
CHANGED
|
@@ -1,292 +1,749 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// @ts-nocheck
|
|
5
4
|
/* auto-generated by NAPI-RS */
|
|
6
5
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
6
|
+
const { readFileSync } = require('node:fs')
|
|
7
|
+
let nativeBinding = null;
|
|
8
|
+
const loadErrors = [];
|
|
9
|
+
|
|
10
|
+
const isMusl = () => {
|
|
11
|
+
let musl = false;
|
|
12
|
+
if (process.platform === "linux") {
|
|
13
|
+
musl = isMuslFromFilesystem();
|
|
14
|
+
if (musl === null) {
|
|
15
|
+
musl = isMuslFromReport();
|
|
16
|
+
}
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromChildProcess();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return musl;
|
|
22
|
+
};
|
|
9
23
|
|
|
10
|
-
const
|
|
24
|
+
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
const isMuslFromFilesystem = () => {
|
|
27
|
+
try {
|
|
28
|
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
15
33
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
const isMuslFromReport = () => {
|
|
35
|
+
let report = null;
|
|
36
|
+
if (typeof process.report?.getReport === "function") {
|
|
37
|
+
process.report.excludeNetwork = true;
|
|
38
|
+
report = process.report.getReport();
|
|
39
|
+
}
|
|
40
|
+
if (!report) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
47
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
23
48
|
return true;
|
|
24
49
|
}
|
|
25
|
-
} else {
|
|
26
|
-
const { glibcVersionRuntime } = process.report.getReport().header;
|
|
27
|
-
return !glibcVersionRuntime;
|
|
28
50
|
}
|
|
29
|
-
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
30
53
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
const isMuslFromChildProcess = () => {
|
|
55
|
+
try {
|
|
56
|
+
return require("child_process")
|
|
57
|
+
.execSync("ldd --version", { encoding: "utf8" })
|
|
58
|
+
.includes("musl");
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function requireNative() {
|
|
66
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
67
|
+
try {
|
|
68
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
loadErrors.push(err);
|
|
71
|
+
}
|
|
72
|
+
} else if (process.platform === "android") {
|
|
73
|
+
if (process.arch === "arm64") {
|
|
74
|
+
try {
|
|
75
|
+
return require("./jazz-napi.android-arm64.node");
|
|
76
|
+
} catch (e) {
|
|
77
|
+
loadErrors.push(e);
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const binding = require("jazz-napi-android-arm64");
|
|
81
|
+
const bindingPackageVersion = require("jazz-napi-android-arm64/package.json").version;
|
|
82
|
+
if (
|
|
83
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
84
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
85
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
86
|
+
) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return binding;
|
|
92
|
+
} catch (e) {
|
|
93
|
+
loadErrors.push(e);
|
|
94
|
+
}
|
|
95
|
+
} else if (process.arch === "arm") {
|
|
96
|
+
try {
|
|
97
|
+
return require("./jazz-napi.android-arm-eabi.node");
|
|
98
|
+
} catch (e) {
|
|
99
|
+
loadErrors.push(e);
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const binding = require("jazz-napi-android-arm-eabi");
|
|
103
|
+
const bindingPackageVersion = require("jazz-napi-android-arm-eabi/package.json").version;
|
|
104
|
+
if (
|
|
105
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
106
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
107
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
108
|
+
) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return binding;
|
|
114
|
+
} catch (e) {
|
|
115
|
+
loadErrors.push(e);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
119
|
+
}
|
|
120
|
+
} else if (process.platform === "win32") {
|
|
121
|
+
if (process.arch === "x64") {
|
|
122
|
+
if (
|
|
123
|
+
process.config?.variables?.shlib_suffix === "dll.a" ||
|
|
124
|
+
process.config?.variables?.node_target_type === "shared_library"
|
|
125
|
+
) {
|
|
36
126
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
127
|
+
return require("./jazz-napi.win32-x64-gnu.node");
|
|
128
|
+
} catch (e) {
|
|
129
|
+
loadErrors.push(e);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const binding = require("jazz-napi-win32-x64-gnu");
|
|
133
|
+
const bindingPackageVersion = require("jazz-napi-win32-x64-gnu/package.json").version;
|
|
134
|
+
if (
|
|
135
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
136
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
137
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
138
|
+
) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
141
|
+
);
|
|
41
142
|
}
|
|
143
|
+
return binding;
|
|
42
144
|
} catch (e) {
|
|
43
|
-
|
|
145
|
+
loadErrors.push(e);
|
|
44
146
|
}
|
|
45
|
-
|
|
46
|
-
case "arm":
|
|
47
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.android-arm-eabi.node"));
|
|
147
|
+
} else {
|
|
48
148
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
149
|
+
return require("./jazz-napi.win32-x64-msvc.node");
|
|
150
|
+
} catch (e) {
|
|
151
|
+
loadErrors.push(e);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const binding = require("jazz-napi-win32-x64-msvc");
|
|
155
|
+
const bindingPackageVersion = require("jazz-napi-win32-x64-msvc/package.json").version;
|
|
156
|
+
if (
|
|
157
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
158
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
159
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
160
|
+
) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
163
|
+
);
|
|
53
164
|
}
|
|
165
|
+
return binding;
|
|
54
166
|
} catch (e) {
|
|
55
|
-
|
|
167
|
+
loadErrors.push(e);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} else if (process.arch === "ia32") {
|
|
171
|
+
try {
|
|
172
|
+
return require("./jazz-napi.win32-ia32-msvc.node");
|
|
173
|
+
} catch (e) {
|
|
174
|
+
loadErrors.push(e);
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const binding = require("jazz-napi-win32-ia32-msvc");
|
|
178
|
+
const bindingPackageVersion = require("jazz-napi-win32-ia32-msvc/package.json").version;
|
|
179
|
+
if (
|
|
180
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
181
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
182
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
183
|
+
) {
|
|
184
|
+
throw new Error(
|
|
185
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return binding;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
loadErrors.push(e);
|
|
191
|
+
}
|
|
192
|
+
} else if (process.arch === "arm64") {
|
|
193
|
+
try {
|
|
194
|
+
return require("./jazz-napi.win32-arm64-msvc.node");
|
|
195
|
+
} catch (e) {
|
|
196
|
+
loadErrors.push(e);
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const binding = require("jazz-napi-win32-arm64-msvc");
|
|
200
|
+
const bindingPackageVersion = require("jazz-napi-win32-arm64-msvc/package.json").version;
|
|
201
|
+
if (
|
|
202
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
203
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
204
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
205
|
+
) {
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
208
|
+
);
|
|
56
209
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
210
|
+
return binding;
|
|
211
|
+
} catch (e) {
|
|
212
|
+
loadErrors.push(e);
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
216
|
+
}
|
|
217
|
+
} else if (process.platform === "darwin") {
|
|
218
|
+
try {
|
|
219
|
+
return require("./jazz-napi.darwin-universal.node");
|
|
220
|
+
} catch (e) {
|
|
221
|
+
loadErrors.push(e);
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const binding = require("jazz-napi-darwin-universal");
|
|
225
|
+
const bindingPackageVersion = require("jazz-napi-darwin-universal/package.json").version;
|
|
226
|
+
if (
|
|
227
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
228
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
229
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
230
|
+
) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return binding;
|
|
236
|
+
} catch (e) {
|
|
237
|
+
loadErrors.push(e);
|
|
238
|
+
}
|
|
239
|
+
if (process.arch === "x64") {
|
|
240
|
+
try {
|
|
241
|
+
return require("./jazz-napi.darwin-x64.node");
|
|
242
|
+
} catch (e) {
|
|
243
|
+
loadErrors.push(e);
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
const binding = require("jazz-napi-darwin-x64");
|
|
247
|
+
const bindingPackageVersion = require("jazz-napi-darwin-x64/package.json").version;
|
|
248
|
+
if (
|
|
249
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
250
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
251
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
252
|
+
) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
return binding;
|
|
258
|
+
} catch (e) {
|
|
259
|
+
loadErrors.push(e);
|
|
260
|
+
}
|
|
261
|
+
} else if (process.arch === "arm64") {
|
|
262
|
+
try {
|
|
263
|
+
return require("./jazz-napi.darwin-arm64.node");
|
|
264
|
+
} catch (e) {
|
|
265
|
+
loadErrors.push(e);
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
const binding = require("jazz-napi-darwin-arm64");
|
|
269
|
+
const bindingPackageVersion = require("jazz-napi-darwin-arm64/package.json").version;
|
|
270
|
+
if (
|
|
271
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
272
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
273
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
274
|
+
) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
return binding;
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
60
285
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
286
|
+
} else if (process.platform === "freebsd") {
|
|
287
|
+
if (process.arch === "x64") {
|
|
288
|
+
try {
|
|
289
|
+
return require("./jazz-napi.freebsd-x64.node");
|
|
290
|
+
} catch (e) {
|
|
291
|
+
loadErrors.push(e);
|
|
292
|
+
}
|
|
293
|
+
try {
|
|
294
|
+
const binding = require("jazz-napi-freebsd-x64");
|
|
295
|
+
const bindingPackageVersion = require("jazz-napi-freebsd-x64/package.json").version;
|
|
296
|
+
if (
|
|
297
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
298
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
299
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
300
|
+
) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return binding;
|
|
306
|
+
} catch (e) {
|
|
307
|
+
loadErrors.push(e);
|
|
308
|
+
}
|
|
309
|
+
} else if (process.arch === "arm64") {
|
|
310
|
+
try {
|
|
311
|
+
return require("./jazz-napi.freebsd-arm64.node");
|
|
312
|
+
} catch (e) {
|
|
313
|
+
loadErrors.push(e);
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
const binding = require("jazz-napi-freebsd-arm64");
|
|
317
|
+
const bindingPackageVersion = require("jazz-napi-freebsd-arm64/package.json").version;
|
|
318
|
+
if (
|
|
319
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
320
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
321
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
322
|
+
) {
|
|
323
|
+
throw new Error(
|
|
324
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return binding;
|
|
328
|
+
} catch (e) {
|
|
329
|
+
loadErrors.push(e);
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
333
|
+
}
|
|
334
|
+
} else if (process.platform === "linux") {
|
|
335
|
+
if (process.arch === "x64") {
|
|
336
|
+
if (isMusl()) {
|
|
66
337
|
try {
|
|
67
|
-
|
|
68
|
-
nativeBinding = require("./jazz-napi.win32-x64-msvc.node");
|
|
69
|
-
} else {
|
|
70
|
-
nativeBinding = require("jazz-napi-win32-x64-msvc");
|
|
71
|
-
}
|
|
338
|
+
return require("./jazz-napi.linux-x64-musl.node");
|
|
72
339
|
} catch (e) {
|
|
73
|
-
|
|
340
|
+
loadErrors.push(e);
|
|
74
341
|
}
|
|
75
|
-
break;
|
|
76
|
-
case "ia32":
|
|
77
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.win32-ia32-msvc.node"));
|
|
78
342
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
343
|
+
const binding = require("jazz-napi-linux-x64-musl");
|
|
344
|
+
const bindingPackageVersion = require("jazz-napi-linux-x64-musl/package.json").version;
|
|
345
|
+
if (
|
|
346
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
347
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
348
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
349
|
+
) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
352
|
+
);
|
|
83
353
|
}
|
|
354
|
+
return binding;
|
|
355
|
+
} catch (e) {
|
|
356
|
+
loadErrors.push(e);
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
try {
|
|
360
|
+
return require("./jazz-napi.linux-x64-gnu.node");
|
|
84
361
|
} catch (e) {
|
|
85
|
-
|
|
362
|
+
loadErrors.push(e);
|
|
86
363
|
}
|
|
87
|
-
break;
|
|
88
|
-
case "arm64":
|
|
89
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.win32-arm64-msvc.node"));
|
|
90
364
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
365
|
+
const binding = require("jazz-napi-linux-x64-gnu");
|
|
366
|
+
const bindingPackageVersion = require("jazz-napi-linux-x64-gnu/package.json").version;
|
|
367
|
+
if (
|
|
368
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
369
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
370
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
371
|
+
) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
374
|
+
);
|
|
95
375
|
}
|
|
376
|
+
return binding;
|
|
96
377
|
} catch (e) {
|
|
97
|
-
|
|
378
|
+
loadErrors.push(e);
|
|
98
379
|
}
|
|
99
|
-
break;
|
|
100
|
-
default:
|
|
101
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`);
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
case "darwin":
|
|
105
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.darwin-universal.node"));
|
|
106
|
-
try {
|
|
107
|
-
if (localFileExisted) {
|
|
108
|
-
nativeBinding = require("./jazz-napi.darwin-universal.node");
|
|
109
|
-
} else {
|
|
110
|
-
nativeBinding = require("jazz-napi-darwin-universal");
|
|
111
380
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
switch (arch) {
|
|
115
|
-
case "x64":
|
|
116
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.darwin-x64.node"));
|
|
381
|
+
} else if (process.arch === "arm64") {
|
|
382
|
+
if (isMusl()) {
|
|
117
383
|
try {
|
|
118
|
-
|
|
119
|
-
nativeBinding = require("./jazz-napi.darwin-x64.node");
|
|
120
|
-
} else {
|
|
121
|
-
nativeBinding = require("jazz-napi-darwin-x64");
|
|
122
|
-
}
|
|
384
|
+
return require("./jazz-napi.linux-arm64-musl.node");
|
|
123
385
|
} catch (e) {
|
|
124
|
-
|
|
386
|
+
loadErrors.push(e);
|
|
125
387
|
}
|
|
126
|
-
break;
|
|
127
|
-
case "arm64":
|
|
128
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.darwin-arm64.node"));
|
|
129
388
|
try {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
389
|
+
const binding = require("jazz-napi-linux-arm64-musl");
|
|
390
|
+
const bindingPackageVersion = require("jazz-napi-linux-arm64-musl/package.json").version;
|
|
391
|
+
if (
|
|
392
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
393
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
394
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
395
|
+
) {
|
|
396
|
+
throw new Error(
|
|
397
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
398
|
+
);
|
|
134
399
|
}
|
|
400
|
+
return binding;
|
|
135
401
|
} catch (e) {
|
|
136
|
-
|
|
402
|
+
loadErrors.push(e);
|
|
137
403
|
}
|
|
138
|
-
break;
|
|
139
|
-
default:
|
|
140
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case "freebsd":
|
|
144
|
-
if (arch !== "x64") {
|
|
145
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
|
|
146
|
-
}
|
|
147
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.freebsd-x64.node"));
|
|
148
|
-
try {
|
|
149
|
-
if (localFileExisted) {
|
|
150
|
-
nativeBinding = require("./jazz-napi.freebsd-x64.node");
|
|
151
404
|
} else {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
case "linux":
|
|
159
|
-
switch (arch) {
|
|
160
|
-
case "x64":
|
|
161
|
-
if (isMusl()) {
|
|
162
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.linux-x64-musl.node"));
|
|
163
|
-
try {
|
|
164
|
-
if (localFileExisted) {
|
|
165
|
-
nativeBinding = require("./jazz-napi.linux-x64-musl.node");
|
|
166
|
-
} else {
|
|
167
|
-
nativeBinding = require("jazz-napi-linux-x64-musl");
|
|
168
|
-
}
|
|
169
|
-
} catch (e) {
|
|
170
|
-
loadError = e;
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.linux-x64-gnu.node"));
|
|
174
|
-
try {
|
|
175
|
-
if (localFileExisted) {
|
|
176
|
-
nativeBinding = require("./jazz-napi.linux-x64-gnu.node");
|
|
177
|
-
} else {
|
|
178
|
-
nativeBinding = require("jazz-napi-linux-x64-gnu");
|
|
179
|
-
}
|
|
180
|
-
} catch (e) {
|
|
181
|
-
loadError = e;
|
|
182
|
-
}
|
|
405
|
+
try {
|
|
406
|
+
return require("./jazz-napi.linux-arm64-gnu.node");
|
|
407
|
+
} catch (e) {
|
|
408
|
+
loadErrors.push(e);
|
|
183
409
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
loadError = e;
|
|
410
|
+
try {
|
|
411
|
+
const binding = require("jazz-napi-linux-arm64-gnu");
|
|
412
|
+
const bindingPackageVersion = require("jazz-napi-linux-arm64-gnu/package.json").version;
|
|
413
|
+
if (
|
|
414
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
415
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
416
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
417
|
+
) {
|
|
418
|
+
throw new Error(
|
|
419
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
420
|
+
);
|
|
196
421
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
422
|
+
return binding;
|
|
423
|
+
} catch (e) {
|
|
424
|
+
loadErrors.push(e);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
} else if (process.arch === "arm") {
|
|
428
|
+
if (isMusl()) {
|
|
429
|
+
try {
|
|
430
|
+
return require("./jazz-napi.linux-arm-musleabihf.node");
|
|
431
|
+
} catch (e) {
|
|
432
|
+
loadErrors.push(e);
|
|
433
|
+
}
|
|
434
|
+
try {
|
|
435
|
+
const binding = require("jazz-napi-linux-arm-musleabihf");
|
|
436
|
+
const bindingPackageVersion =
|
|
437
|
+
require("jazz-napi-linux-arm-musleabihf/package.json").version;
|
|
438
|
+
if (
|
|
439
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
440
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
441
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
442
|
+
) {
|
|
443
|
+
throw new Error(
|
|
444
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
445
|
+
);
|
|
207
446
|
}
|
|
447
|
+
return binding;
|
|
448
|
+
} catch (e) {
|
|
449
|
+
loadErrors.push(e);
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
try {
|
|
453
|
+
return require("./jazz-napi.linux-arm-gnueabihf.node");
|
|
454
|
+
} catch (e) {
|
|
455
|
+
loadErrors.push(e);
|
|
208
456
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
457
|
+
try {
|
|
458
|
+
const binding = require("jazz-napi-linux-arm-gnueabihf");
|
|
459
|
+
const bindingPackageVersion =
|
|
460
|
+
require("jazz-napi-linux-arm-gnueabihf/package.json").version;
|
|
461
|
+
if (
|
|
462
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
463
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
464
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
465
|
+
) {
|
|
466
|
+
throw new Error(
|
|
467
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
468
|
+
);
|
|
221
469
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
470
|
+
return binding;
|
|
471
|
+
} catch (e) {
|
|
472
|
+
loadErrors.push(e);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
} else if (process.arch === "loong64") {
|
|
476
|
+
if (isMusl()) {
|
|
477
|
+
try {
|
|
478
|
+
return require("./jazz-napi.linux-loong64-musl.node");
|
|
479
|
+
} catch (e) {
|
|
480
|
+
loadErrors.push(e);
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
const binding = require("jazz-napi-linux-loong64-musl");
|
|
484
|
+
const bindingPackageVersion =
|
|
485
|
+
require("jazz-napi-linux-loong64-musl/package.json").version;
|
|
486
|
+
if (
|
|
487
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
488
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
489
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
490
|
+
) {
|
|
491
|
+
throw new Error(
|
|
492
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
493
|
+
);
|
|
232
494
|
}
|
|
495
|
+
return binding;
|
|
496
|
+
} catch (e) {
|
|
497
|
+
loadErrors.push(e);
|
|
233
498
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
499
|
+
} else {
|
|
500
|
+
try {
|
|
501
|
+
return require("./jazz-napi.linux-loong64-gnu.node");
|
|
502
|
+
} catch (e) {
|
|
503
|
+
loadErrors.push(e);
|
|
504
|
+
}
|
|
505
|
+
try {
|
|
506
|
+
const binding = require("jazz-napi-linux-loong64-gnu");
|
|
507
|
+
const bindingPackageVersion = require("jazz-napi-linux-loong64-gnu/package.json").version;
|
|
508
|
+
if (
|
|
509
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
510
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
511
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
512
|
+
) {
|
|
513
|
+
throw new Error(
|
|
514
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
515
|
+
);
|
|
246
516
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
517
|
+
return binding;
|
|
518
|
+
} catch (e) {
|
|
519
|
+
loadErrors.push(e);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
} else if (process.arch === "riscv64") {
|
|
523
|
+
if (isMusl()) {
|
|
524
|
+
try {
|
|
525
|
+
return require("./jazz-napi.linux-riscv64-musl.node");
|
|
526
|
+
} catch (e) {
|
|
527
|
+
loadErrors.push(e);
|
|
528
|
+
}
|
|
529
|
+
try {
|
|
530
|
+
const binding = require("jazz-napi-linux-riscv64-musl");
|
|
531
|
+
const bindingPackageVersion =
|
|
532
|
+
require("jazz-napi-linux-riscv64-musl/package.json").version;
|
|
533
|
+
if (
|
|
534
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
535
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
536
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
537
|
+
) {
|
|
538
|
+
throw new Error(
|
|
539
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
540
|
+
);
|
|
257
541
|
}
|
|
542
|
+
return binding;
|
|
543
|
+
} catch (e) {
|
|
544
|
+
loadErrors.push(e);
|
|
545
|
+
}
|
|
546
|
+
} else {
|
|
547
|
+
try {
|
|
548
|
+
return require("./jazz-napi.linux-riscv64-gnu.node");
|
|
549
|
+
} catch (e) {
|
|
550
|
+
loadErrors.push(e);
|
|
258
551
|
}
|
|
259
|
-
break;
|
|
260
|
-
case "s390x":
|
|
261
|
-
localFileExisted = existsSync(join(__dirname, "jazz-napi.linux-s390x-gnu.node"));
|
|
262
552
|
try {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
553
|
+
const binding = require("jazz-napi-linux-riscv64-gnu");
|
|
554
|
+
const bindingPackageVersion = require("jazz-napi-linux-riscv64-gnu/package.json").version;
|
|
555
|
+
if (
|
|
556
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
557
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
558
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
559
|
+
) {
|
|
560
|
+
throw new Error(
|
|
561
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
562
|
+
);
|
|
267
563
|
}
|
|
564
|
+
return binding;
|
|
268
565
|
} catch (e) {
|
|
269
|
-
|
|
566
|
+
loadErrors.push(e);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
} else if (process.arch === "ppc64") {
|
|
570
|
+
try {
|
|
571
|
+
return require("./jazz-napi.linux-ppc64-gnu.node");
|
|
572
|
+
} catch (e) {
|
|
573
|
+
loadErrors.push(e);
|
|
574
|
+
}
|
|
575
|
+
try {
|
|
576
|
+
const binding = require("jazz-napi-linux-ppc64-gnu");
|
|
577
|
+
const bindingPackageVersion = require("jazz-napi-linux-ppc64-gnu/package.json").version;
|
|
578
|
+
if (
|
|
579
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
580
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
581
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
582
|
+
) {
|
|
583
|
+
throw new Error(
|
|
584
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
return binding;
|
|
588
|
+
} catch (e) {
|
|
589
|
+
loadErrors.push(e);
|
|
590
|
+
}
|
|
591
|
+
} else if (process.arch === "s390x") {
|
|
592
|
+
try {
|
|
593
|
+
return require("./jazz-napi.linux-s390x-gnu.node");
|
|
594
|
+
} catch (e) {
|
|
595
|
+
loadErrors.push(e);
|
|
596
|
+
}
|
|
597
|
+
try {
|
|
598
|
+
const binding = require("jazz-napi-linux-s390x-gnu");
|
|
599
|
+
const bindingPackageVersion = require("jazz-napi-linux-s390x-gnu/package.json").version;
|
|
600
|
+
if (
|
|
601
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
602
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
603
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
604
|
+
) {
|
|
605
|
+
throw new Error(
|
|
606
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
return binding;
|
|
610
|
+
} catch (e) {
|
|
611
|
+
loadErrors.push(e);
|
|
612
|
+
}
|
|
613
|
+
} else {
|
|
614
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
615
|
+
}
|
|
616
|
+
} else if (process.platform === "openharmony") {
|
|
617
|
+
if (process.arch === "arm64") {
|
|
618
|
+
try {
|
|
619
|
+
return require("./jazz-napi.openharmony-arm64.node");
|
|
620
|
+
} catch (e) {
|
|
621
|
+
loadErrors.push(e);
|
|
622
|
+
}
|
|
623
|
+
try {
|
|
624
|
+
const binding = require("jazz-napi-openharmony-arm64");
|
|
625
|
+
const bindingPackageVersion = require("jazz-napi-openharmony-arm64/package.json").version;
|
|
626
|
+
if (
|
|
627
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
628
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
629
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
630
|
+
) {
|
|
631
|
+
throw new Error(
|
|
632
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
return binding;
|
|
636
|
+
} catch (e) {
|
|
637
|
+
loadErrors.push(e);
|
|
638
|
+
}
|
|
639
|
+
} else if (process.arch === "x64") {
|
|
640
|
+
try {
|
|
641
|
+
return require("./jazz-napi.openharmony-x64.node");
|
|
642
|
+
} catch (e) {
|
|
643
|
+
loadErrors.push(e);
|
|
644
|
+
}
|
|
645
|
+
try {
|
|
646
|
+
const binding = require("jazz-napi-openharmony-x64");
|
|
647
|
+
const bindingPackageVersion = require("jazz-napi-openharmony-x64/package.json").version;
|
|
648
|
+
if (
|
|
649
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
650
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
651
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
652
|
+
) {
|
|
653
|
+
throw new Error(
|
|
654
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
655
|
+
);
|
|
270
656
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
657
|
+
return binding;
|
|
658
|
+
} catch (e) {
|
|
659
|
+
loadErrors.push(e);
|
|
660
|
+
}
|
|
661
|
+
} else if (process.arch === "arm") {
|
|
662
|
+
try {
|
|
663
|
+
return require("./jazz-napi.openharmony-arm.node");
|
|
664
|
+
} catch (e) {
|
|
665
|
+
loadErrors.push(e);
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
const binding = require("jazz-napi-openharmony-arm");
|
|
669
|
+
const bindingPackageVersion = require("jazz-napi-openharmony-arm/package.json").version;
|
|
670
|
+
if (
|
|
671
|
+
bindingPackageVersion !== "2.0.0-alpha.13" &&
|
|
672
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
673
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
674
|
+
) {
|
|
675
|
+
throw new Error(
|
|
676
|
+
`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
return binding;
|
|
680
|
+
} catch (e) {
|
|
681
|
+
loadErrors.push(e);
|
|
682
|
+
}
|
|
683
|
+
} else {
|
|
684
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
274
685
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
686
|
+
} else {
|
|
687
|
+
loadErrors.push(
|
|
688
|
+
new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`),
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
nativeBinding = requireNative();
|
|
694
|
+
|
|
695
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
696
|
+
let wasiBinding = null;
|
|
697
|
+
let wasiBindingError = null;
|
|
698
|
+
try {
|
|
699
|
+
wasiBinding = require("./jazz-napi.wasi.cjs");
|
|
700
|
+
nativeBinding = wasiBinding;
|
|
701
|
+
} catch (err) {
|
|
702
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
703
|
+
wasiBindingError = err;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
707
|
+
try {
|
|
708
|
+
wasiBinding = require("jazz-napi-wasm32-wasi");
|
|
709
|
+
nativeBinding = wasiBinding;
|
|
710
|
+
} catch (err) {
|
|
711
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
712
|
+
if (!wasiBindingError) {
|
|
713
|
+
wasiBindingError = err;
|
|
714
|
+
} else {
|
|
715
|
+
wasiBindingError.cause = err;
|
|
716
|
+
}
|
|
717
|
+
loadErrors.push(err);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
|
722
|
+
const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
723
|
+
error.cause = wasiBindingError;
|
|
724
|
+
throw error;
|
|
725
|
+
}
|
|
278
726
|
}
|
|
279
727
|
|
|
280
728
|
if (!nativeBinding) {
|
|
281
|
-
if (
|
|
282
|
-
throw
|
|
729
|
+
if (loadErrors.length > 0) {
|
|
730
|
+
throw new Error(
|
|
731
|
+
`Cannot find native binding. ` +
|
|
732
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
733
|
+
"Please try `npm i` again after removing both package-lock.json and node_modules directory.",
|
|
734
|
+
{
|
|
735
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
736
|
+
cur.cause = err;
|
|
737
|
+
return cur;
|
|
738
|
+
}),
|
|
739
|
+
},
|
|
740
|
+
);
|
|
283
741
|
}
|
|
284
742
|
throw new Error(`Failed to load native binding`);
|
|
285
743
|
}
|
|
286
744
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
module.exports.
|
|
290
|
-
module.exports.generateId = generateId;
|
|
291
|
-
module.exports.
|
|
292
|
-
module.exports.parseSchema = parseSchema;
|
|
745
|
+
module.exports = nativeBinding;
|
|
746
|
+
module.exports.NapiRuntime = nativeBinding.NapiRuntime;
|
|
747
|
+
module.exports.currentTimestamp = nativeBinding.currentTimestamp;
|
|
748
|
+
module.exports.generateId = nativeBinding.generateId;
|
|
749
|
+
module.exports.parseSchema = nativeBinding.parseSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jazz-napi",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"description": "Native Node.js bindings for Jazz runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,25 +18,22 @@
|
|
|
18
18
|
"tag": "alpha"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@napi-rs/cli": "^
|
|
21
|
+
"@napi-rs/cli": "^3"
|
|
22
22
|
},
|
|
23
23
|
"napi": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"aarch64-apple-darwin"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
24
|
+
"binaryName": "jazz-napi",
|
|
25
|
+
"targets": [
|
|
26
|
+
"x86_64-unknown-linux-gnu",
|
|
27
|
+
"x86_64-pc-windows-msvc",
|
|
28
|
+
"x86_64-apple-darwin",
|
|
29
|
+
"aarch64-apple-darwin"
|
|
30
|
+
]
|
|
34
31
|
},
|
|
35
32
|
"optionalDependencies": {
|
|
36
|
-
"@garden-co/jazz-napi-darwin-arm64": "2.0.0-alpha.
|
|
37
|
-
"@garden-co/jazz-napi-darwin-x64": "2.0.0-alpha.
|
|
38
|
-
"@garden-co/jazz-napi-linux-x64-gnu": "2.0.0-alpha.
|
|
39
|
-
"@garden-co/jazz-napi-win32-x64-msvc": "2.0.0-alpha.
|
|
33
|
+
"@garden-co/jazz-napi-darwin-arm64": "2.0.0-alpha.14",
|
|
34
|
+
"@garden-co/jazz-napi-darwin-x64": "2.0.0-alpha.14",
|
|
35
|
+
"@garden-co/jazz-napi-linux-x64-gnu": "2.0.0-alpha.14",
|
|
36
|
+
"@garden-co/jazz-napi-win32-x64-msvc": "2.0.0-alpha.14"
|
|
40
37
|
},
|
|
41
38
|
"scripts": {
|
|
42
39
|
"build": "node scripts/build.js",
|