@farhnkrnapratma/markers 1.0.0-alpha1 → 1.0.0-alpha2
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 -97
- package/index.d.ts +17 -10
- package/index.js +617 -380
- package/package.json +13 -12
package/index.js
CHANGED
|
@@ -2,575 +2,790 @@
|
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
/* auto-generated by NAPI-RS */
|
|
4
4
|
|
|
5
|
-
const { readFileSync } = require(
|
|
6
|
-
let nativeBinding = null
|
|
5
|
+
const { readFileSync } = require("fs");
|
|
6
|
+
let nativeBinding = null;
|
|
7
7
|
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
8
|
// the flavor it resolved; the late native retry below leaves it alone because
|
|
9
9
|
// it only runs while no WASI candidate has been loaded. The take-over check
|
|
10
10
|
// after the load-failure block can also set it.
|
|
11
|
-
let __napiLoadedBindingTarget =
|
|
11
|
+
let __napiLoadedBindingTarget = "native";
|
|
12
12
|
// What this loader's own `requireNative()` calls returned. The check after
|
|
13
13
|
// the load-failure block compares it with `nativeBinding` to tell a binding
|
|
14
14
|
// this loader loaded from one that code outside it put in its place.
|
|
15
|
-
let __napiRequiredNativeBinding = null
|
|
16
|
-
const loadErrors = []
|
|
15
|
+
let __napiRequiredNativeBinding = null;
|
|
16
|
+
const loadErrors = [];
|
|
17
17
|
|
|
18
18
|
const isMusl = () => {
|
|
19
|
-
let musl = false
|
|
20
|
-
if (process.platform ===
|
|
21
|
-
musl = isMuslFromFilesystem()
|
|
19
|
+
let musl = false;
|
|
20
|
+
if (process.platform === "linux") {
|
|
21
|
+
musl = isMuslFromFilesystem();
|
|
22
22
|
if (musl === null) {
|
|
23
|
-
musl = isMuslFromReport()
|
|
23
|
+
musl = isMuslFromReport();
|
|
24
24
|
}
|
|
25
25
|
if (musl === null) {
|
|
26
|
-
musl = isMuslFromChildProcess()
|
|
26
|
+
musl = isMuslFromChildProcess();
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
return musl
|
|
30
|
-
}
|
|
29
|
+
return musl;
|
|
30
|
+
};
|
|
31
31
|
|
|
32
|
-
const isFileMusl = (f) => f.includes(
|
|
32
|
+
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
33
33
|
|
|
34
34
|
const isMuslFromFilesystem = () => {
|
|
35
35
|
try {
|
|
36
|
-
return readFileSync(
|
|
36
|
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
37
37
|
} catch {
|
|
38
|
-
return null
|
|
38
|
+
return null;
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
const isMuslFromReport = () => {
|
|
43
|
-
let report = null
|
|
44
|
-
if (process.report && typeof process.report.getReport ===
|
|
45
|
-
process.report.excludeNetwork = true
|
|
46
|
-
report = process.report.getReport()
|
|
43
|
+
let report = null;
|
|
44
|
+
if (process.report && typeof process.report.getReport === "function") {
|
|
45
|
+
process.report.excludeNetwork = true;
|
|
46
|
+
report = process.report.getReport();
|
|
47
47
|
}
|
|
48
48
|
if (!report) {
|
|
49
|
-
return null
|
|
49
|
+
return null;
|
|
50
50
|
}
|
|
51
51
|
if (report.header && report.header.glibcVersionRuntime) {
|
|
52
|
-
return false
|
|
52
|
+
return false;
|
|
53
53
|
}
|
|
54
54
|
if (Array.isArray(report.sharedObjects)) {
|
|
55
55
|
if (report.sharedObjects.some(isFileMusl)) {
|
|
56
|
-
return true
|
|
56
|
+
return true;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return false
|
|
60
|
-
}
|
|
59
|
+
return false;
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
const isMuslFromChildProcess = () => {
|
|
63
63
|
try {
|
|
64
|
-
return require(
|
|
64
|
+
return require("child_process")
|
|
65
|
+
.execSync("ldd --version", { encoding: "utf8" })
|
|
66
|
+
.includes("musl");
|
|
65
67
|
} catch (e) {
|
|
66
68
|
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
67
|
-
return false
|
|
69
|
+
return false;
|
|
68
70
|
}
|
|
69
|
-
}
|
|
71
|
+
};
|
|
70
72
|
|
|
71
73
|
function requireNative() {
|
|
72
74
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
73
75
|
try {
|
|
74
|
-
const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
76
|
+
const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
75
77
|
// The override may be a generated WASI loader, which already reports its
|
|
76
78
|
// own flavor. Adopt it: `module.exports` aliases this object, so claiming
|
|
77
79
|
// 'native' would both misreport the artifact and overwrite the loader's
|
|
78
80
|
// marker through the alias.
|
|
79
81
|
__napiLoadedBindingTarget =
|
|
80
|
-
overrideBinding &&
|
|
82
|
+
overrideBinding &&
|
|
83
|
+
typeof overrideBinding.__napiBindingTarget === "string"
|
|
81
84
|
? overrideBinding.__napiBindingTarget
|
|
82
|
-
:
|
|
83
|
-
return overrideBinding
|
|
85
|
+
: "native";
|
|
86
|
+
return overrideBinding;
|
|
84
87
|
} catch (err) {
|
|
85
|
-
loadErrors.push(err)
|
|
88
|
+
loadErrors.push(err);
|
|
86
89
|
}
|
|
87
|
-
} else if (process.platform ===
|
|
88
|
-
if (process.arch ===
|
|
90
|
+
} else if (process.platform === "android") {
|
|
91
|
+
if (process.arch === "arm64") {
|
|
89
92
|
try {
|
|
90
|
-
return require(
|
|
93
|
+
return require("./markers.android-arm64.node");
|
|
91
94
|
} catch (e) {
|
|
92
|
-
loadErrors.push(e)
|
|
95
|
+
loadErrors.push(e);
|
|
93
96
|
}
|
|
94
97
|
try {
|
|
95
|
-
const binding = require(
|
|
96
|
-
const bindingPackageVersion =
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
const binding = require("@farhnkrnapratma/markers-android-arm64");
|
|
99
|
+
const bindingPackageVersion =
|
|
100
|
+
require("@farhnkrnapratma/markers-android-arm64/package.json").version;
|
|
101
|
+
if (
|
|
102
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
103
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
104
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
105
|
+
) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
108
|
+
);
|
|
99
109
|
}
|
|
100
|
-
return binding
|
|
110
|
+
return binding;
|
|
101
111
|
} catch (e) {
|
|
102
|
-
loadErrors.push(e)
|
|
112
|
+
loadErrors.push(e);
|
|
103
113
|
}
|
|
104
|
-
} else if (process.arch ===
|
|
114
|
+
} else if (process.arch === "arm") {
|
|
105
115
|
try {
|
|
106
|
-
return require(
|
|
116
|
+
return require("./markers.android-arm-eabi.node");
|
|
107
117
|
} catch (e) {
|
|
108
|
-
loadErrors.push(e)
|
|
118
|
+
loadErrors.push(e);
|
|
109
119
|
}
|
|
110
120
|
try {
|
|
111
|
-
const binding = require(
|
|
112
|
-
const bindingPackageVersion =
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
const binding = require("@farhnkrnapratma/markers-android-arm-eabi");
|
|
122
|
+
const bindingPackageVersion =
|
|
123
|
+
require("@farhnkrnapratma/markers-android-arm-eabi/package.json").version;
|
|
124
|
+
if (
|
|
125
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
126
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
127
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
128
|
+
) {
|
|
129
|
+
throw new Error(
|
|
130
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
131
|
+
);
|
|
115
132
|
}
|
|
116
|
-
return binding
|
|
133
|
+
return binding;
|
|
117
134
|
} catch (e) {
|
|
118
|
-
loadErrors.push(e)
|
|
135
|
+
loadErrors.push(e);
|
|
119
136
|
}
|
|
120
137
|
} else {
|
|
121
|
-
loadErrors.push(
|
|
138
|
+
loadErrors.push(
|
|
139
|
+
new Error(`Unsupported architecture on Android ${process.arch}`),
|
|
140
|
+
);
|
|
122
141
|
}
|
|
123
|
-
} else if (process.platform ===
|
|
124
|
-
if (process.arch ===
|
|
125
|
-
if (
|
|
142
|
+
} else if (process.platform === "win32") {
|
|
143
|
+
if (process.arch === "x64") {
|
|
144
|
+
if (
|
|
145
|
+
(process.config &&
|
|
146
|
+
process.config.variables &&
|
|
147
|
+
process.config.variables.shlib_suffix === "dll.a") ||
|
|
148
|
+
(process.config &&
|
|
149
|
+
process.config.variables &&
|
|
150
|
+
process.config.variables.node_target_type === "shared_library")
|
|
151
|
+
) {
|
|
126
152
|
try {
|
|
127
|
-
return require(
|
|
153
|
+
return require("./markers.win32-x64-gnu.node");
|
|
128
154
|
} catch (e) {
|
|
129
|
-
loadErrors.push(e)
|
|
155
|
+
loadErrors.push(e);
|
|
130
156
|
}
|
|
131
157
|
try {
|
|
132
|
-
const binding = require(
|
|
133
|
-
const bindingPackageVersion =
|
|
134
|
-
|
|
135
|
-
|
|
158
|
+
const binding = require("@farhnkrnapratma/markers-win32-x64-gnu");
|
|
159
|
+
const bindingPackageVersion =
|
|
160
|
+
require("@farhnkrnapratma/markers-win32-x64-gnu/package.json").version;
|
|
161
|
+
if (
|
|
162
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
163
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
164
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
165
|
+
) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
168
|
+
);
|
|
136
169
|
}
|
|
137
|
-
return binding
|
|
170
|
+
return binding;
|
|
138
171
|
} catch (e) {
|
|
139
|
-
loadErrors.push(e)
|
|
172
|
+
loadErrors.push(e);
|
|
140
173
|
}
|
|
141
174
|
} else {
|
|
142
175
|
try {
|
|
143
|
-
return require(
|
|
176
|
+
return require("./markers.win32-x64-msvc.node");
|
|
144
177
|
} catch (e) {
|
|
145
|
-
loadErrors.push(e)
|
|
178
|
+
loadErrors.push(e);
|
|
146
179
|
}
|
|
147
180
|
try {
|
|
148
|
-
const binding = require(
|
|
149
|
-
const bindingPackageVersion =
|
|
150
|
-
|
|
151
|
-
|
|
181
|
+
const binding = require("@farhnkrnapratma/markers-win32-x64-msvc");
|
|
182
|
+
const bindingPackageVersion =
|
|
183
|
+
require("@farhnkrnapratma/markers-win32-x64-msvc/package.json").version;
|
|
184
|
+
if (
|
|
185
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
186
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
187
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
188
|
+
) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
191
|
+
);
|
|
152
192
|
}
|
|
153
|
-
return binding
|
|
193
|
+
return binding;
|
|
154
194
|
} catch (e) {
|
|
155
|
-
loadErrors.push(e)
|
|
195
|
+
loadErrors.push(e);
|
|
156
196
|
}
|
|
157
197
|
}
|
|
158
|
-
} else if (process.arch ===
|
|
198
|
+
} else if (process.arch === "ia32") {
|
|
159
199
|
try {
|
|
160
|
-
return require(
|
|
200
|
+
return require("./markers.win32-ia32-msvc.node");
|
|
161
201
|
} catch (e) {
|
|
162
|
-
loadErrors.push(e)
|
|
202
|
+
loadErrors.push(e);
|
|
163
203
|
}
|
|
164
204
|
try {
|
|
165
|
-
const binding = require(
|
|
166
|
-
const bindingPackageVersion =
|
|
167
|
-
|
|
168
|
-
|
|
205
|
+
const binding = require("@farhnkrnapratma/markers-win32-ia32-msvc");
|
|
206
|
+
const bindingPackageVersion =
|
|
207
|
+
require("@farhnkrnapratma/markers-win32-ia32-msvc/package.json").version;
|
|
208
|
+
if (
|
|
209
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
210
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
211
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
212
|
+
) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
215
|
+
);
|
|
169
216
|
}
|
|
170
|
-
return binding
|
|
217
|
+
return binding;
|
|
171
218
|
} catch (e) {
|
|
172
|
-
loadErrors.push(e)
|
|
219
|
+
loadErrors.push(e);
|
|
173
220
|
}
|
|
174
|
-
} else if (process.arch ===
|
|
221
|
+
} else if (process.arch === "arm64") {
|
|
175
222
|
try {
|
|
176
|
-
return require(
|
|
223
|
+
return require("./markers.win32-arm64-msvc.node");
|
|
177
224
|
} catch (e) {
|
|
178
|
-
loadErrors.push(e)
|
|
225
|
+
loadErrors.push(e);
|
|
179
226
|
}
|
|
180
227
|
try {
|
|
181
|
-
const binding = require(
|
|
182
|
-
const bindingPackageVersion =
|
|
183
|
-
|
|
184
|
-
|
|
228
|
+
const binding = require("@farhnkrnapratma/markers-win32-arm64-msvc");
|
|
229
|
+
const bindingPackageVersion =
|
|
230
|
+
require("@farhnkrnapratma/markers-win32-arm64-msvc/package.json").version;
|
|
231
|
+
if (
|
|
232
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
233
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
234
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
235
|
+
) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
238
|
+
);
|
|
185
239
|
}
|
|
186
|
-
return binding
|
|
240
|
+
return binding;
|
|
187
241
|
} catch (e) {
|
|
188
|
-
loadErrors.push(e)
|
|
242
|
+
loadErrors.push(e);
|
|
189
243
|
}
|
|
190
244
|
} else {
|
|
191
|
-
loadErrors.push(
|
|
245
|
+
loadErrors.push(
|
|
246
|
+
new Error(`Unsupported architecture on Windows: ${process.arch}`),
|
|
247
|
+
);
|
|
192
248
|
}
|
|
193
|
-
} else if (process.platform ===
|
|
249
|
+
} else if (process.platform === "darwin") {
|
|
194
250
|
try {
|
|
195
|
-
return require(
|
|
251
|
+
return require("./markers.darwin-universal.node");
|
|
196
252
|
} catch (e) {
|
|
197
|
-
loadErrors.push(e)
|
|
253
|
+
loadErrors.push(e);
|
|
198
254
|
}
|
|
199
255
|
try {
|
|
200
|
-
const binding = require(
|
|
201
|
-
const bindingPackageVersion =
|
|
202
|
-
|
|
203
|
-
|
|
256
|
+
const binding = require("@farhnkrnapratma/markers-darwin-universal");
|
|
257
|
+
const bindingPackageVersion =
|
|
258
|
+
require("@farhnkrnapratma/markers-darwin-universal/package.json").version;
|
|
259
|
+
if (
|
|
260
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
261
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
262
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
263
|
+
) {
|
|
264
|
+
throw new Error(
|
|
265
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
266
|
+
);
|
|
204
267
|
}
|
|
205
|
-
return binding
|
|
268
|
+
return binding;
|
|
206
269
|
} catch (e) {
|
|
207
|
-
loadErrors.push(e)
|
|
270
|
+
loadErrors.push(e);
|
|
208
271
|
}
|
|
209
|
-
if (process.arch ===
|
|
272
|
+
if (process.arch === "x64") {
|
|
210
273
|
try {
|
|
211
|
-
return require(
|
|
274
|
+
return require("./markers.darwin-x64.node");
|
|
212
275
|
} catch (e) {
|
|
213
|
-
loadErrors.push(e)
|
|
276
|
+
loadErrors.push(e);
|
|
214
277
|
}
|
|
215
278
|
try {
|
|
216
|
-
const binding = require(
|
|
217
|
-
const bindingPackageVersion =
|
|
218
|
-
|
|
219
|
-
|
|
279
|
+
const binding = require("@farhnkrnapratma/markers-darwin-x64");
|
|
280
|
+
const bindingPackageVersion =
|
|
281
|
+
require("@farhnkrnapratma/markers-darwin-x64/package.json").version;
|
|
282
|
+
if (
|
|
283
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
284
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
285
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
286
|
+
) {
|
|
287
|
+
throw new Error(
|
|
288
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
289
|
+
);
|
|
220
290
|
}
|
|
221
|
-
return binding
|
|
291
|
+
return binding;
|
|
222
292
|
} catch (e) {
|
|
223
|
-
loadErrors.push(e)
|
|
293
|
+
loadErrors.push(e);
|
|
224
294
|
}
|
|
225
|
-
} else if (process.arch ===
|
|
295
|
+
} else if (process.arch === "arm64") {
|
|
226
296
|
try {
|
|
227
|
-
return require(
|
|
297
|
+
return require("./markers.darwin-arm64.node");
|
|
228
298
|
} catch (e) {
|
|
229
|
-
loadErrors.push(e)
|
|
299
|
+
loadErrors.push(e);
|
|
230
300
|
}
|
|
231
301
|
try {
|
|
232
|
-
const binding = require(
|
|
233
|
-
const bindingPackageVersion =
|
|
234
|
-
|
|
235
|
-
|
|
302
|
+
const binding = require("@farhnkrnapratma/markers-darwin-arm64");
|
|
303
|
+
const bindingPackageVersion =
|
|
304
|
+
require("@farhnkrnapratma/markers-darwin-arm64/package.json").version;
|
|
305
|
+
if (
|
|
306
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
307
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
308
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
309
|
+
) {
|
|
310
|
+
throw new Error(
|
|
311
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
312
|
+
);
|
|
236
313
|
}
|
|
237
|
-
return binding
|
|
314
|
+
return binding;
|
|
238
315
|
} catch (e) {
|
|
239
|
-
loadErrors.push(e)
|
|
316
|
+
loadErrors.push(e);
|
|
240
317
|
}
|
|
241
318
|
} else {
|
|
242
|
-
loadErrors.push(
|
|
319
|
+
loadErrors.push(
|
|
320
|
+
new Error(`Unsupported architecture on macOS: ${process.arch}`),
|
|
321
|
+
);
|
|
243
322
|
}
|
|
244
|
-
} else if (process.platform ===
|
|
245
|
-
if (process.arch ===
|
|
323
|
+
} else if (process.platform === "freebsd") {
|
|
324
|
+
if (process.arch === "x64") {
|
|
246
325
|
try {
|
|
247
|
-
return require(
|
|
326
|
+
return require("./markers.freebsd-x64.node");
|
|
248
327
|
} catch (e) {
|
|
249
|
-
loadErrors.push(e)
|
|
328
|
+
loadErrors.push(e);
|
|
250
329
|
}
|
|
251
330
|
try {
|
|
252
|
-
const binding = require(
|
|
253
|
-
const bindingPackageVersion =
|
|
254
|
-
|
|
255
|
-
|
|
331
|
+
const binding = require("@farhnkrnapratma/markers-freebsd-x64");
|
|
332
|
+
const bindingPackageVersion =
|
|
333
|
+
require("@farhnkrnapratma/markers-freebsd-x64/package.json").version;
|
|
334
|
+
if (
|
|
335
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
336
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
337
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
338
|
+
) {
|
|
339
|
+
throw new Error(
|
|
340
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
341
|
+
);
|
|
256
342
|
}
|
|
257
|
-
return binding
|
|
343
|
+
return binding;
|
|
258
344
|
} catch (e) {
|
|
259
|
-
loadErrors.push(e)
|
|
345
|
+
loadErrors.push(e);
|
|
260
346
|
}
|
|
261
|
-
} else if (process.arch ===
|
|
347
|
+
} else if (process.arch === "arm64") {
|
|
262
348
|
try {
|
|
263
|
-
return require(
|
|
349
|
+
return require("./markers.freebsd-arm64.node");
|
|
264
350
|
} catch (e) {
|
|
265
|
-
loadErrors.push(e)
|
|
351
|
+
loadErrors.push(e);
|
|
266
352
|
}
|
|
267
353
|
try {
|
|
268
|
-
const binding = require(
|
|
269
|
-
const bindingPackageVersion =
|
|
270
|
-
|
|
271
|
-
|
|
354
|
+
const binding = require("@farhnkrnapratma/markers-freebsd-arm64");
|
|
355
|
+
const bindingPackageVersion =
|
|
356
|
+
require("@farhnkrnapratma/markers-freebsd-arm64/package.json").version;
|
|
357
|
+
if (
|
|
358
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
359
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
360
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
361
|
+
) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
364
|
+
);
|
|
272
365
|
}
|
|
273
|
-
return binding
|
|
366
|
+
return binding;
|
|
274
367
|
} catch (e) {
|
|
275
|
-
loadErrors.push(e)
|
|
368
|
+
loadErrors.push(e);
|
|
276
369
|
}
|
|
277
|
-
} else if (process.arch ===
|
|
370
|
+
} else if (process.arch === "ppc64") {
|
|
278
371
|
try {
|
|
279
|
-
return require(
|
|
372
|
+
return require("./markers.freebsd-ppc64.node");
|
|
280
373
|
} catch (e) {
|
|
281
|
-
loadErrors.push(e)
|
|
374
|
+
loadErrors.push(e);
|
|
282
375
|
}
|
|
283
376
|
try {
|
|
284
|
-
const binding = require(
|
|
285
|
-
const bindingPackageVersion =
|
|
286
|
-
|
|
287
|
-
|
|
377
|
+
const binding = require("@farhnkrnapratma/markers-freebsd-ppc64");
|
|
378
|
+
const bindingPackageVersion =
|
|
379
|
+
require("@farhnkrnapratma/markers-freebsd-ppc64/package.json").version;
|
|
380
|
+
if (
|
|
381
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
382
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
383
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
384
|
+
) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
387
|
+
);
|
|
288
388
|
}
|
|
289
|
-
return binding
|
|
389
|
+
return binding;
|
|
290
390
|
} catch (e) {
|
|
291
|
-
loadErrors.push(e)
|
|
391
|
+
loadErrors.push(e);
|
|
292
392
|
}
|
|
293
393
|
} else {
|
|
294
|
-
loadErrors.push(
|
|
394
|
+
loadErrors.push(
|
|
395
|
+
new Error(`Unsupported architecture on FreeBSD: ${process.arch}`),
|
|
396
|
+
);
|
|
295
397
|
}
|
|
296
|
-
} else if (process.platform ===
|
|
297
|
-
if (process.arch ===
|
|
398
|
+
} else if (process.platform === "linux") {
|
|
399
|
+
if (process.arch === "x64") {
|
|
298
400
|
if (isMusl()) {
|
|
299
401
|
try {
|
|
300
|
-
return require(
|
|
402
|
+
return require("./markers.linux-x64-musl.node");
|
|
301
403
|
} catch (e) {
|
|
302
|
-
loadErrors.push(e)
|
|
404
|
+
loadErrors.push(e);
|
|
303
405
|
}
|
|
304
406
|
try {
|
|
305
|
-
const binding = require(
|
|
306
|
-
const bindingPackageVersion =
|
|
307
|
-
|
|
308
|
-
|
|
407
|
+
const binding = require("@farhnkrnapratma/markers-linux-x64-musl");
|
|
408
|
+
const bindingPackageVersion =
|
|
409
|
+
require("@farhnkrnapratma/markers-linux-x64-musl/package.json").version;
|
|
410
|
+
if (
|
|
411
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
412
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
413
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
414
|
+
) {
|
|
415
|
+
throw new Error(
|
|
416
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
417
|
+
);
|
|
309
418
|
}
|
|
310
|
-
return binding
|
|
419
|
+
return binding;
|
|
311
420
|
} catch (e) {
|
|
312
|
-
loadErrors.push(e)
|
|
421
|
+
loadErrors.push(e);
|
|
313
422
|
}
|
|
314
423
|
} else {
|
|
315
424
|
try {
|
|
316
|
-
return require(
|
|
425
|
+
return require("./markers.linux-x64-gnu.node");
|
|
317
426
|
} catch (e) {
|
|
318
|
-
loadErrors.push(e)
|
|
427
|
+
loadErrors.push(e);
|
|
319
428
|
}
|
|
320
429
|
try {
|
|
321
|
-
const binding = require(
|
|
322
|
-
const bindingPackageVersion =
|
|
323
|
-
|
|
324
|
-
|
|
430
|
+
const binding = require("@farhnkrnapratma/markers-linux-x64-gnu");
|
|
431
|
+
const bindingPackageVersion =
|
|
432
|
+
require("@farhnkrnapratma/markers-linux-x64-gnu/package.json").version;
|
|
433
|
+
if (
|
|
434
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
435
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
436
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
437
|
+
) {
|
|
438
|
+
throw new Error(
|
|
439
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
440
|
+
);
|
|
325
441
|
}
|
|
326
|
-
return binding
|
|
442
|
+
return binding;
|
|
327
443
|
} catch (e) {
|
|
328
|
-
loadErrors.push(e)
|
|
444
|
+
loadErrors.push(e);
|
|
329
445
|
}
|
|
330
446
|
}
|
|
331
|
-
} else if (process.arch ===
|
|
447
|
+
} else if (process.arch === "arm64") {
|
|
332
448
|
if (isMusl()) {
|
|
333
449
|
try {
|
|
334
|
-
return require(
|
|
450
|
+
return require("./markers.linux-arm64-musl.node");
|
|
335
451
|
} catch (e) {
|
|
336
|
-
loadErrors.push(e)
|
|
452
|
+
loadErrors.push(e);
|
|
337
453
|
}
|
|
338
454
|
try {
|
|
339
|
-
const binding = require(
|
|
340
|
-
const bindingPackageVersion =
|
|
341
|
-
|
|
342
|
-
|
|
455
|
+
const binding = require("@farhnkrnapratma/markers-linux-arm64-musl");
|
|
456
|
+
const bindingPackageVersion =
|
|
457
|
+
require("@farhnkrnapratma/markers-linux-arm64-musl/package.json").version;
|
|
458
|
+
if (
|
|
459
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
460
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
461
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
462
|
+
) {
|
|
463
|
+
throw new Error(
|
|
464
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
465
|
+
);
|
|
343
466
|
}
|
|
344
|
-
return binding
|
|
467
|
+
return binding;
|
|
345
468
|
} catch (e) {
|
|
346
|
-
loadErrors.push(e)
|
|
469
|
+
loadErrors.push(e);
|
|
347
470
|
}
|
|
348
471
|
} else {
|
|
349
472
|
try {
|
|
350
|
-
return require(
|
|
473
|
+
return require("./markers.linux-arm64-gnu.node");
|
|
351
474
|
} catch (e) {
|
|
352
|
-
loadErrors.push(e)
|
|
475
|
+
loadErrors.push(e);
|
|
353
476
|
}
|
|
354
477
|
try {
|
|
355
|
-
const binding = require(
|
|
356
|
-
const bindingPackageVersion =
|
|
357
|
-
|
|
358
|
-
|
|
478
|
+
const binding = require("@farhnkrnapratma/markers-linux-arm64-gnu");
|
|
479
|
+
const bindingPackageVersion =
|
|
480
|
+
require("@farhnkrnapratma/markers-linux-arm64-gnu/package.json").version;
|
|
481
|
+
if (
|
|
482
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
483
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
484
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
485
|
+
) {
|
|
486
|
+
throw new Error(
|
|
487
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
488
|
+
);
|
|
359
489
|
}
|
|
360
|
-
return binding
|
|
490
|
+
return binding;
|
|
361
491
|
} catch (e) {
|
|
362
|
-
loadErrors.push(e)
|
|
492
|
+
loadErrors.push(e);
|
|
363
493
|
}
|
|
364
494
|
}
|
|
365
|
-
} else if (process.arch ===
|
|
495
|
+
} else if (process.arch === "arm") {
|
|
366
496
|
if (isMusl()) {
|
|
367
497
|
try {
|
|
368
|
-
return require(
|
|
498
|
+
return require("./markers.linux-arm-musleabihf.node");
|
|
369
499
|
} catch (e) {
|
|
370
|
-
loadErrors.push(e)
|
|
500
|
+
loadErrors.push(e);
|
|
371
501
|
}
|
|
372
502
|
try {
|
|
373
|
-
const binding = require(
|
|
374
|
-
const bindingPackageVersion =
|
|
375
|
-
|
|
376
|
-
|
|
503
|
+
const binding = require("@farhnkrnapratma/markers-linux-arm-musleabihf");
|
|
504
|
+
const bindingPackageVersion =
|
|
505
|
+
require("@farhnkrnapratma/markers-linux-arm-musleabihf/package.json").version;
|
|
506
|
+
if (
|
|
507
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
508
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
509
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
510
|
+
) {
|
|
511
|
+
throw new Error(
|
|
512
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
513
|
+
);
|
|
377
514
|
}
|
|
378
|
-
return binding
|
|
515
|
+
return binding;
|
|
379
516
|
} catch (e) {
|
|
380
|
-
loadErrors.push(e)
|
|
517
|
+
loadErrors.push(e);
|
|
381
518
|
}
|
|
382
519
|
} else {
|
|
383
520
|
try {
|
|
384
|
-
return require(
|
|
521
|
+
return require("./markers.linux-arm-gnueabihf.node");
|
|
385
522
|
} catch (e) {
|
|
386
|
-
loadErrors.push(e)
|
|
523
|
+
loadErrors.push(e);
|
|
387
524
|
}
|
|
388
525
|
try {
|
|
389
|
-
const binding = require(
|
|
390
|
-
const bindingPackageVersion =
|
|
391
|
-
|
|
392
|
-
|
|
526
|
+
const binding = require("@farhnkrnapratma/markers-linux-arm-gnueabihf");
|
|
527
|
+
const bindingPackageVersion =
|
|
528
|
+
require("@farhnkrnapratma/markers-linux-arm-gnueabihf/package.json").version;
|
|
529
|
+
if (
|
|
530
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
531
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
532
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
533
|
+
) {
|
|
534
|
+
throw new Error(
|
|
535
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
536
|
+
);
|
|
393
537
|
}
|
|
394
|
-
return binding
|
|
538
|
+
return binding;
|
|
395
539
|
} catch (e) {
|
|
396
|
-
loadErrors.push(e)
|
|
540
|
+
loadErrors.push(e);
|
|
397
541
|
}
|
|
398
542
|
}
|
|
399
|
-
} else if (process.arch ===
|
|
543
|
+
} else if (process.arch === "loong64") {
|
|
400
544
|
if (isMusl()) {
|
|
401
545
|
try {
|
|
402
|
-
return require(
|
|
546
|
+
return require("./markers.linux-loong64-musl.node");
|
|
403
547
|
} catch (e) {
|
|
404
|
-
loadErrors.push(e)
|
|
548
|
+
loadErrors.push(e);
|
|
405
549
|
}
|
|
406
550
|
try {
|
|
407
|
-
const binding = require(
|
|
408
|
-
const bindingPackageVersion =
|
|
409
|
-
|
|
410
|
-
|
|
551
|
+
const binding = require("@farhnkrnapratma/markers-linux-loong64-musl");
|
|
552
|
+
const bindingPackageVersion =
|
|
553
|
+
require("@farhnkrnapratma/markers-linux-loong64-musl/package.json").version;
|
|
554
|
+
if (
|
|
555
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
556
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
557
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
558
|
+
) {
|
|
559
|
+
throw new Error(
|
|
560
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
561
|
+
);
|
|
411
562
|
}
|
|
412
|
-
return binding
|
|
563
|
+
return binding;
|
|
413
564
|
} catch (e) {
|
|
414
|
-
loadErrors.push(e)
|
|
565
|
+
loadErrors.push(e);
|
|
415
566
|
}
|
|
416
567
|
} else {
|
|
417
568
|
try {
|
|
418
|
-
return require(
|
|
569
|
+
return require("./markers.linux-loong64-gnu.node");
|
|
419
570
|
} catch (e) {
|
|
420
|
-
loadErrors.push(e)
|
|
571
|
+
loadErrors.push(e);
|
|
421
572
|
}
|
|
422
573
|
try {
|
|
423
|
-
const binding = require(
|
|
424
|
-
const bindingPackageVersion =
|
|
425
|
-
|
|
426
|
-
|
|
574
|
+
const binding = require("@farhnkrnapratma/markers-linux-loong64-gnu");
|
|
575
|
+
const bindingPackageVersion =
|
|
576
|
+
require("@farhnkrnapratma/markers-linux-loong64-gnu/package.json").version;
|
|
577
|
+
if (
|
|
578
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
579
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
580
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
581
|
+
) {
|
|
582
|
+
throw new Error(
|
|
583
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
584
|
+
);
|
|
427
585
|
}
|
|
428
|
-
return binding
|
|
586
|
+
return binding;
|
|
429
587
|
} catch (e) {
|
|
430
|
-
loadErrors.push(e)
|
|
588
|
+
loadErrors.push(e);
|
|
431
589
|
}
|
|
432
590
|
}
|
|
433
|
-
} else if (process.arch ===
|
|
591
|
+
} else if (process.arch === "riscv64") {
|
|
434
592
|
if (isMusl()) {
|
|
435
593
|
try {
|
|
436
|
-
return require(
|
|
594
|
+
return require("./markers.linux-riscv64-musl.node");
|
|
437
595
|
} catch (e) {
|
|
438
|
-
loadErrors.push(e)
|
|
596
|
+
loadErrors.push(e);
|
|
439
597
|
}
|
|
440
598
|
try {
|
|
441
|
-
const binding = require(
|
|
442
|
-
const bindingPackageVersion =
|
|
443
|
-
|
|
444
|
-
|
|
599
|
+
const binding = require("@farhnkrnapratma/markers-linux-riscv64-musl");
|
|
600
|
+
const bindingPackageVersion =
|
|
601
|
+
require("@farhnkrnapratma/markers-linux-riscv64-musl/package.json").version;
|
|
602
|
+
if (
|
|
603
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
604
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
605
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
606
|
+
) {
|
|
607
|
+
throw new Error(
|
|
608
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
609
|
+
);
|
|
445
610
|
}
|
|
446
|
-
return binding
|
|
611
|
+
return binding;
|
|
447
612
|
} catch (e) {
|
|
448
|
-
loadErrors.push(e)
|
|
613
|
+
loadErrors.push(e);
|
|
449
614
|
}
|
|
450
615
|
} else {
|
|
451
616
|
try {
|
|
452
|
-
return require(
|
|
617
|
+
return require("./markers.linux-riscv64-gnu.node");
|
|
453
618
|
} catch (e) {
|
|
454
|
-
loadErrors.push(e)
|
|
619
|
+
loadErrors.push(e);
|
|
455
620
|
}
|
|
456
621
|
try {
|
|
457
|
-
const binding = require(
|
|
458
|
-
const bindingPackageVersion =
|
|
459
|
-
|
|
460
|
-
|
|
622
|
+
const binding = require("@farhnkrnapratma/markers-linux-riscv64-gnu");
|
|
623
|
+
const bindingPackageVersion =
|
|
624
|
+
require("@farhnkrnapratma/markers-linux-riscv64-gnu/package.json").version;
|
|
625
|
+
if (
|
|
626
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
627
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
628
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
629
|
+
) {
|
|
630
|
+
throw new Error(
|
|
631
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
632
|
+
);
|
|
461
633
|
}
|
|
462
|
-
return binding
|
|
634
|
+
return binding;
|
|
463
635
|
} catch (e) {
|
|
464
|
-
loadErrors.push(e)
|
|
636
|
+
loadErrors.push(e);
|
|
465
637
|
}
|
|
466
638
|
}
|
|
467
|
-
} else if (process.arch ===
|
|
639
|
+
} else if (process.arch === "ppc64") {
|
|
468
640
|
try {
|
|
469
|
-
return require(
|
|
641
|
+
return require("./markers.linux-ppc64-gnu.node");
|
|
470
642
|
} catch (e) {
|
|
471
|
-
loadErrors.push(e)
|
|
643
|
+
loadErrors.push(e);
|
|
472
644
|
}
|
|
473
645
|
try {
|
|
474
|
-
const binding = require(
|
|
475
|
-
const bindingPackageVersion =
|
|
476
|
-
|
|
477
|
-
|
|
646
|
+
const binding = require("@farhnkrnapratma/markers-linux-ppc64-gnu");
|
|
647
|
+
const bindingPackageVersion =
|
|
648
|
+
require("@farhnkrnapratma/markers-linux-ppc64-gnu/package.json").version;
|
|
649
|
+
if (
|
|
650
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
651
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
652
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
653
|
+
) {
|
|
654
|
+
throw new Error(
|
|
655
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
656
|
+
);
|
|
478
657
|
}
|
|
479
|
-
return binding
|
|
658
|
+
return binding;
|
|
480
659
|
} catch (e) {
|
|
481
|
-
loadErrors.push(e)
|
|
660
|
+
loadErrors.push(e);
|
|
482
661
|
}
|
|
483
|
-
} else if (process.arch ===
|
|
662
|
+
} else if (process.arch === "s390x") {
|
|
484
663
|
try {
|
|
485
|
-
return require(
|
|
664
|
+
return require("./markers.linux-s390x-gnu.node");
|
|
486
665
|
} catch (e) {
|
|
487
|
-
loadErrors.push(e)
|
|
666
|
+
loadErrors.push(e);
|
|
488
667
|
}
|
|
489
668
|
try {
|
|
490
|
-
const binding = require(
|
|
491
|
-
const bindingPackageVersion =
|
|
492
|
-
|
|
493
|
-
|
|
669
|
+
const binding = require("@farhnkrnapratma/markers-linux-s390x-gnu");
|
|
670
|
+
const bindingPackageVersion =
|
|
671
|
+
require("@farhnkrnapratma/markers-linux-s390x-gnu/package.json").version;
|
|
672
|
+
if (
|
|
673
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
674
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
675
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
676
|
+
) {
|
|
677
|
+
throw new Error(
|
|
678
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
679
|
+
);
|
|
494
680
|
}
|
|
495
|
-
return binding
|
|
681
|
+
return binding;
|
|
496
682
|
} catch (e) {
|
|
497
|
-
loadErrors.push(e)
|
|
683
|
+
loadErrors.push(e);
|
|
498
684
|
}
|
|
499
685
|
} else {
|
|
500
|
-
loadErrors.push(
|
|
686
|
+
loadErrors.push(
|
|
687
|
+
new Error(`Unsupported architecture on Linux: ${process.arch}`),
|
|
688
|
+
);
|
|
501
689
|
}
|
|
502
|
-
} else if (process.platform ===
|
|
503
|
-
if (process.arch ===
|
|
690
|
+
} else if (process.platform === "openharmony") {
|
|
691
|
+
if (process.arch === "arm64") {
|
|
504
692
|
try {
|
|
505
|
-
return require(
|
|
693
|
+
return require("./markers.openharmony-arm64.node");
|
|
506
694
|
} catch (e) {
|
|
507
|
-
loadErrors.push(e)
|
|
695
|
+
loadErrors.push(e);
|
|
508
696
|
}
|
|
509
697
|
try {
|
|
510
|
-
const binding = require(
|
|
511
|
-
const bindingPackageVersion =
|
|
512
|
-
|
|
513
|
-
|
|
698
|
+
const binding = require("@farhnkrnapratma/markers-openharmony-arm64");
|
|
699
|
+
const bindingPackageVersion =
|
|
700
|
+
require("@farhnkrnapratma/markers-openharmony-arm64/package.json").version;
|
|
701
|
+
if (
|
|
702
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
703
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
704
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
705
|
+
) {
|
|
706
|
+
throw new Error(
|
|
707
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
708
|
+
);
|
|
514
709
|
}
|
|
515
|
-
return binding
|
|
710
|
+
return binding;
|
|
516
711
|
} catch (e) {
|
|
517
|
-
loadErrors.push(e)
|
|
712
|
+
loadErrors.push(e);
|
|
518
713
|
}
|
|
519
|
-
} else if (process.arch ===
|
|
714
|
+
} else if (process.arch === "x64") {
|
|
520
715
|
try {
|
|
521
|
-
return require(
|
|
716
|
+
return require("./markers.openharmony-x64.node");
|
|
522
717
|
} catch (e) {
|
|
523
|
-
loadErrors.push(e)
|
|
718
|
+
loadErrors.push(e);
|
|
524
719
|
}
|
|
525
720
|
try {
|
|
526
|
-
const binding = require(
|
|
527
|
-
const bindingPackageVersion =
|
|
528
|
-
|
|
529
|
-
|
|
721
|
+
const binding = require("@farhnkrnapratma/markers-openharmony-x64");
|
|
722
|
+
const bindingPackageVersion =
|
|
723
|
+
require("@farhnkrnapratma/markers-openharmony-x64/package.json").version;
|
|
724
|
+
if (
|
|
725
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
726
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
727
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
728
|
+
) {
|
|
729
|
+
throw new Error(
|
|
730
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
731
|
+
);
|
|
530
732
|
}
|
|
531
|
-
return binding
|
|
733
|
+
return binding;
|
|
532
734
|
} catch (e) {
|
|
533
|
-
loadErrors.push(e)
|
|
735
|
+
loadErrors.push(e);
|
|
534
736
|
}
|
|
535
|
-
} else if (process.arch ===
|
|
737
|
+
} else if (process.arch === "arm") {
|
|
536
738
|
try {
|
|
537
|
-
return require(
|
|
739
|
+
return require("./markers.openharmony-arm.node");
|
|
538
740
|
} catch (e) {
|
|
539
|
-
loadErrors.push(e)
|
|
741
|
+
loadErrors.push(e);
|
|
540
742
|
}
|
|
541
743
|
try {
|
|
542
|
-
const binding = require(
|
|
543
|
-
const bindingPackageVersion =
|
|
544
|
-
|
|
545
|
-
|
|
744
|
+
const binding = require("@farhnkrnapratma/markers-openharmony-arm");
|
|
745
|
+
const bindingPackageVersion =
|
|
746
|
+
require("@farhnkrnapratma/markers-openharmony-arm/package.json").version;
|
|
747
|
+
if (
|
|
748
|
+
bindingPackageVersion !== "1.0.0-alpha2" &&
|
|
749
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
750
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
751
|
+
) {
|
|
752
|
+
throw new Error(
|
|
753
|
+
`Native binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
754
|
+
);
|
|
546
755
|
}
|
|
547
|
-
return binding
|
|
756
|
+
return binding;
|
|
548
757
|
} catch (e) {
|
|
549
|
-
loadErrors.push(e)
|
|
758
|
+
loadErrors.push(e);
|
|
550
759
|
}
|
|
551
760
|
} else {
|
|
552
|
-
loadErrors.push(
|
|
761
|
+
loadErrors.push(
|
|
762
|
+
new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`),
|
|
763
|
+
);
|
|
553
764
|
}
|
|
554
765
|
} else {
|
|
555
|
-
loadErrors.push(
|
|
766
|
+
loadErrors.push(
|
|
767
|
+
new Error(
|
|
768
|
+
`Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
|
|
769
|
+
),
|
|
770
|
+
);
|
|
556
771
|
}
|
|
557
772
|
}
|
|
558
773
|
|
|
559
774
|
function createLoadErrorChain(errors) {
|
|
560
775
|
return errors.reduce((previous, current) => {
|
|
561
|
-
let message
|
|
776
|
+
let message;
|
|
562
777
|
try {
|
|
563
778
|
message =
|
|
564
|
-
current && typeof current.message ===
|
|
779
|
+
current && typeof current.message === "string"
|
|
565
780
|
? current.message
|
|
566
|
-
: String(current)
|
|
781
|
+
: String(current);
|
|
567
782
|
} catch {
|
|
568
|
-
message =
|
|
783
|
+
message = "Unknown error";
|
|
569
784
|
}
|
|
570
|
-
const error = new Error(message)
|
|
571
|
-
error.cause = previous
|
|
572
|
-
return error
|
|
573
|
-
}, null)
|
|
785
|
+
const error = new Error(message);
|
|
786
|
+
error.cause = previous;
|
|
787
|
+
return error;
|
|
788
|
+
}, null);
|
|
574
789
|
}
|
|
575
790
|
|
|
576
791
|
// NAPI_RS_FORCE_WASI is a tri-state flag:
|
|
@@ -583,10 +798,10 @@ function createLoadErrorChain(errors) {
|
|
|
583
798
|
//
|
|
584
799
|
// NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
|
|
585
800
|
// WASI loading. It never crosses into another flavor or falls back to native.
|
|
586
|
-
const __napiWasiFlavors = [
|
|
587
|
-
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
|
|
801
|
+
const __napiWasiFlavors = ["wasm32-wasi"];
|
|
802
|
+
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
|
|
588
803
|
const __napiWasiFlavorRequested =
|
|
589
|
-
typeof __napiWasiFlavor ===
|
|
804
|
+
typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
|
|
590
805
|
if (
|
|
591
806
|
__napiWasiFlavorRequested &&
|
|
592
807
|
__napiWasiFlavors.indexOf(__napiWasiFlavor) === -1
|
|
@@ -595,110 +810,129 @@ if (
|
|
|
595
810
|
'Unsupported WASI flavor "' +
|
|
596
811
|
__napiWasiFlavor +
|
|
597
812
|
'". Available flavors: ' +
|
|
598
|
-
__napiWasiFlavors.join(
|
|
599
|
-
)
|
|
813
|
+
__napiWasiFlavors.join(", "),
|
|
814
|
+
);
|
|
600
815
|
}
|
|
601
|
-
const forceWasiError = process.env.NAPI_RS_FORCE_WASI ===
|
|
816
|
+
const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
|
|
602
817
|
const forceWasi =
|
|
603
|
-
process.env.NAPI_RS_FORCE_WASI ===
|
|
818
|
+
process.env.NAPI_RS_FORCE_WASI === "true" ||
|
|
604
819
|
forceWasiError ||
|
|
605
|
-
__napiWasiFlavorRequested
|
|
820
|
+
__napiWasiFlavorRequested;
|
|
606
821
|
|
|
607
822
|
if (!forceWasi) {
|
|
608
|
-
nativeBinding = requireNative()
|
|
609
|
-
__napiRequiredNativeBinding = nativeBinding
|
|
823
|
+
nativeBinding = requireNative();
|
|
824
|
+
__napiRequiredNativeBinding = nativeBinding;
|
|
610
825
|
}
|
|
611
826
|
|
|
612
827
|
if (!nativeBinding || forceWasi) {
|
|
613
|
-
let wasiBinding = null
|
|
614
|
-
let wasiBindingLoaded = false
|
|
615
|
-
const wasiBindingErrors = []
|
|
828
|
+
let wasiBinding = null;
|
|
829
|
+
let wasiBindingLoaded = false;
|
|
830
|
+
const wasiBindingErrors = [];
|
|
616
831
|
const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
|
|
617
832
|
try {
|
|
618
|
-
require.resolve(specifier)
|
|
833
|
+
require.resolve(specifier);
|
|
619
834
|
} catch (resolveError) {
|
|
620
|
-
if (!resolveError || resolveError.code !==
|
|
621
|
-
throw resolveError
|
|
835
|
+
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") {
|
|
836
|
+
throw resolveError;
|
|
622
837
|
}
|
|
623
838
|
if (isPackage) {
|
|
624
839
|
try {
|
|
625
|
-
require.resolve(specifier +
|
|
840
|
+
require.resolve(specifier + "/package.json");
|
|
626
841
|
} catch (packageError) {
|
|
627
|
-
if (packageError && packageError.code ===
|
|
628
|
-
return resolveError
|
|
842
|
+
if (packageError && packageError.code === "MODULE_NOT_FOUND") {
|
|
843
|
+
return resolveError;
|
|
629
844
|
}
|
|
630
845
|
// An exports restriction proves the package exists even when its
|
|
631
846
|
// package.json is not public. Preserve the root resolution failure.
|
|
632
|
-
throw resolveError
|
|
847
|
+
throw resolveError;
|
|
633
848
|
}
|
|
634
849
|
// The package exists but its main/export target is broken.
|
|
635
|
-
throw resolveError
|
|
850
|
+
throw resolveError;
|
|
636
851
|
}
|
|
637
|
-
return resolveError
|
|
852
|
+
return resolveError;
|
|
638
853
|
}
|
|
639
854
|
if (localArtifacts) {
|
|
640
|
-
let artifactError = null
|
|
855
|
+
let artifactError = null;
|
|
641
856
|
for (let i = 0; i < localArtifacts.length; i++) {
|
|
642
857
|
try {
|
|
643
|
-
require.resolve(localArtifacts[i])
|
|
644
|
-
return null
|
|
858
|
+
require.resolve(localArtifacts[i]);
|
|
859
|
+
return null;
|
|
645
860
|
} catch (resolveError) {
|
|
646
|
-
if (!resolveError || resolveError.code !==
|
|
647
|
-
throw resolveError
|
|
861
|
+
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") {
|
|
862
|
+
throw resolveError;
|
|
648
863
|
}
|
|
649
|
-
artifactError = resolveError
|
|
864
|
+
artifactError = resolveError;
|
|
650
865
|
}
|
|
651
866
|
}
|
|
652
|
-
return artifactError
|
|
867
|
+
return artifactError;
|
|
653
868
|
}
|
|
654
|
-
return null
|
|
655
|
-
}
|
|
656
|
-
if (
|
|
657
|
-
|
|
658
|
-
|
|
869
|
+
return null;
|
|
870
|
+
};
|
|
871
|
+
if (
|
|
872
|
+
!wasiBindingLoaded &&
|
|
873
|
+
(!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")
|
|
874
|
+
) {
|
|
875
|
+
let candidateError = null;
|
|
876
|
+
let candidateFailed = false;
|
|
659
877
|
try {
|
|
660
|
-
candidateError = __napiWasiResolveCandidate(
|
|
661
|
-
|
|
878
|
+
candidateError = __napiWasiResolveCandidate("./markers.wasi.cjs", false, [
|
|
879
|
+
"./markers.wasm32-wasi.debug.wasm",
|
|
880
|
+
"./markers.wasm32-wasi.wasm",
|
|
881
|
+
]);
|
|
882
|
+
candidateFailed = candidateError !== null;
|
|
662
883
|
if (!candidateFailed) {
|
|
663
|
-
wasiBinding = require(
|
|
664
|
-
nativeBinding = wasiBinding
|
|
665
|
-
__napiLoadedBindingTarget =
|
|
666
|
-
wasiBindingLoaded = true
|
|
884
|
+
wasiBinding = require("./markers.wasi.cjs");
|
|
885
|
+
nativeBinding = wasiBinding;
|
|
886
|
+
__napiLoadedBindingTarget = "wasm32-wasi";
|
|
887
|
+
wasiBindingLoaded = true;
|
|
667
888
|
}
|
|
668
889
|
} catch (err) {
|
|
669
|
-
candidateError = err
|
|
670
|
-
candidateFailed = true
|
|
890
|
+
candidateError = err;
|
|
891
|
+
candidateFailed = true;
|
|
671
892
|
}
|
|
672
893
|
if (candidateFailed) {
|
|
673
|
-
wasiBindingErrors.push(candidateError)
|
|
674
|
-
loadErrors.push(candidateError)
|
|
894
|
+
wasiBindingErrors.push(candidateError);
|
|
895
|
+
loadErrors.push(candidateError);
|
|
675
896
|
}
|
|
676
897
|
}
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
|
|
898
|
+
if (
|
|
899
|
+
!wasiBindingLoaded &&
|
|
900
|
+
(!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")
|
|
901
|
+
) {
|
|
902
|
+
let candidateError = null;
|
|
903
|
+
let candidateFailed = false;
|
|
680
904
|
try {
|
|
681
|
-
candidateError = __napiWasiResolveCandidate(
|
|
682
|
-
|
|
905
|
+
candidateError = __napiWasiResolveCandidate(
|
|
906
|
+
"@farhnkrnapratma/markers-wasm32-wasi",
|
|
907
|
+
true,
|
|
908
|
+
undefined,
|
|
909
|
+
);
|
|
910
|
+
candidateFailed = candidateError !== null;
|
|
683
911
|
if (!candidateFailed) {
|
|
684
|
-
if (
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
912
|
+
if (
|
|
913
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
914
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
915
|
+
) {
|
|
916
|
+
const bindingPackageVersion =
|
|
917
|
+
require("@farhnkrnapratma/markers-wasm32-wasi/package.json").version;
|
|
918
|
+
if (bindingPackageVersion !== "1.0.0-alpha2") {
|
|
919
|
+
throw new Error(
|
|
920
|
+
`WASI binding package version mismatch, expected 1.0.0-alpha2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
921
|
+
);
|
|
688
922
|
}
|
|
689
923
|
}
|
|
690
|
-
wasiBinding = require(
|
|
691
|
-
nativeBinding = wasiBinding
|
|
692
|
-
__napiLoadedBindingTarget =
|
|
693
|
-
wasiBindingLoaded = true
|
|
924
|
+
wasiBinding = require("@farhnkrnapratma/markers-wasm32-wasi");
|
|
925
|
+
nativeBinding = wasiBinding;
|
|
926
|
+
__napiLoadedBindingTarget = "wasm32-wasi";
|
|
927
|
+
wasiBindingLoaded = true;
|
|
694
928
|
}
|
|
695
929
|
} catch (err) {
|
|
696
|
-
candidateError = err
|
|
697
|
-
candidateFailed = true
|
|
930
|
+
candidateError = err;
|
|
931
|
+
candidateFailed = true;
|
|
698
932
|
}
|
|
699
933
|
if (candidateFailed) {
|
|
700
|
-
wasiBindingErrors.push(candidateError)
|
|
701
|
-
loadErrors.push(candidateError)
|
|
934
|
+
wasiBindingErrors.push(candidateError);
|
|
935
|
+
loadErrors.push(candidateError);
|
|
702
936
|
}
|
|
703
937
|
}
|
|
704
938
|
if (
|
|
@@ -707,17 +941,17 @@ if (!nativeBinding || forceWasi) {
|
|
|
707
941
|
!forceWasiError &&
|
|
708
942
|
!__napiWasiFlavorRequested
|
|
709
943
|
) {
|
|
710
|
-
nativeBinding = requireNative()
|
|
711
|
-
__napiRequiredNativeBinding = nativeBinding
|
|
944
|
+
nativeBinding = requireNative();
|
|
945
|
+
__napiRequiredNativeBinding = nativeBinding;
|
|
712
946
|
}
|
|
713
947
|
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
|
|
714
948
|
const error = new Error(
|
|
715
949
|
__napiWasiFlavorRequested
|
|
716
950
|
? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found'
|
|
717
|
-
:
|
|
718
|
-
)
|
|
719
|
-
error.cause = createLoadErrorChain(wasiBindingErrors)
|
|
720
|
-
throw error
|
|
951
|
+
: "WASI binding not found and NAPI_RS_FORCE_WASI is set to error",
|
|
952
|
+
);
|
|
953
|
+
error.cause = createLoadErrorChain(wasiBindingErrors);
|
|
954
|
+
throw error;
|
|
721
955
|
}
|
|
722
956
|
}
|
|
723
957
|
|
|
@@ -726,14 +960,14 @@ if (!nativeBinding) {
|
|
|
726
960
|
const error = new Error(
|
|
727
961
|
`Cannot find native binding. ` +
|
|
728
962
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
729
|
-
|
|
730
|
-
)
|
|
963
|
+
"Please try `npm i` again after removing both package-lock.json and node_modules directory.",
|
|
964
|
+
);
|
|
731
965
|
// assign instead of the `new Error(message, { cause })` options form,
|
|
732
966
|
// which Node < 16.9 silently ignores
|
|
733
|
-
error.cause = createLoadErrorChain(loadErrors)
|
|
734
|
-
throw error
|
|
967
|
+
error.cause = createLoadErrorChain(loadErrors);
|
|
968
|
+
throw error;
|
|
735
969
|
}
|
|
736
|
-
throw new Error(`Failed to load native binding`)
|
|
970
|
+
throw new Error(`Failed to load native binding`);
|
|
737
971
|
}
|
|
738
972
|
|
|
739
973
|
// A package can patch its own fallback in front of the load-failure check
|
|
@@ -750,20 +984,20 @@ if (!nativeBinding) {
|
|
|
750
984
|
// chain can report ('wasm32-wasi' for a package without a WASI target).
|
|
751
985
|
// This is metadata and never fails a load: a throwing Proxy trap keeps 'native'.
|
|
752
986
|
if (
|
|
753
|
-
__napiLoadedBindingTarget ===
|
|
987
|
+
__napiLoadedBindingTarget === "native" &&
|
|
754
988
|
nativeBinding !== __napiRequiredNativeBinding
|
|
755
989
|
) {
|
|
756
990
|
try {
|
|
757
991
|
const __napiBindingTargetDescriptor = Object.getOwnPropertyDescriptor(
|
|
758
992
|
nativeBinding,
|
|
759
|
-
|
|
760
|
-
)
|
|
993
|
+
"__napiBindingTarget",
|
|
994
|
+
);
|
|
761
995
|
if (
|
|
762
996
|
__napiBindingTargetDescriptor &&
|
|
763
997
|
__napiWasiFlavors.indexOf(__napiBindingTargetDescriptor.value) !== -1 &&
|
|
764
998
|
nativeBinding.__napiBindingTarget === __napiBindingTargetDescriptor.value
|
|
765
999
|
) {
|
|
766
|
-
__napiLoadedBindingTarget = __napiBindingTargetDescriptor.value
|
|
1000
|
+
__napiLoadedBindingTarget = __napiBindingTargetDescriptor.value;
|
|
767
1001
|
}
|
|
768
1002
|
} catch {
|
|
769
1003
|
// keep 'native'
|
|
@@ -772,19 +1006,19 @@ if (
|
|
|
772
1006
|
|
|
773
1007
|
function __napiStampBindingTarget(exportsObject, target) {
|
|
774
1008
|
if (
|
|
775
|
-
Object.prototype.hasOwnProperty.call(exportsObject,
|
|
1009
|
+
Object.prototype.hasOwnProperty.call(exportsObject, "__napiBindingTarget")
|
|
776
1010
|
) {
|
|
777
1011
|
if (exportsObject.__napiBindingTarget === target) {
|
|
778
1012
|
// Already ours: the root entry aliases the object it loaded, so a WASI
|
|
779
1013
|
// fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
|
|
780
1014
|
// is a generated loader — arrives already stamped with this same value.
|
|
781
|
-
return target
|
|
1015
|
+
return target;
|
|
782
1016
|
}
|
|
783
1017
|
const error = new Error(
|
|
784
1018
|
'`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
|
|
785
|
-
)
|
|
786
|
-
error.code =
|
|
787
|
-
throw error
|
|
1019
|
+
);
|
|
1020
|
+
error.code = "ERR_NAPI_BINDING_TARGET_CONFLICT";
|
|
1021
|
+
throw error;
|
|
788
1022
|
}
|
|
789
1023
|
if (!Object.isExtensible(exportsObject)) {
|
|
790
1024
|
// A `#[napi(module_exports)]` hook may seal or freeze this object
|
|
@@ -794,19 +1028,19 @@ function __napiStampBindingTarget(exportsObject, target) {
|
|
|
794
1028
|
// browser and deferred loaders declare `__napiBindingTarget` at module
|
|
795
1029
|
// level and go on reporting it, while the CommonJS entries hand back this
|
|
796
1030
|
// very object as `module.exports`, so there the value is absent.
|
|
797
|
-
return target
|
|
1031
|
+
return target;
|
|
798
1032
|
}
|
|
799
1033
|
try {
|
|
800
1034
|
// [[Define]], not [[Set]]: an ordinary assignment walks the prototype
|
|
801
1035
|
// chain, so an inherited accessor could swallow the value or throw and
|
|
802
1036
|
// fail an otherwise successful load. The descriptor is what a successful
|
|
803
1037
|
// assignment would have produced.
|
|
804
|
-
Object.defineProperty(exportsObject,
|
|
1038
|
+
Object.defineProperty(exportsObject, "__napiBindingTarget", {
|
|
805
1039
|
configurable: true,
|
|
806
1040
|
enumerable: true,
|
|
807
1041
|
value: target,
|
|
808
1042
|
writable: true,
|
|
809
|
-
})
|
|
1043
|
+
});
|
|
810
1044
|
} catch {
|
|
811
1045
|
// Same rule as the non-extensible skip above: reporting the artifact is
|
|
812
1046
|
// metadata, never a reason to fail an otherwise successful load. An exotic
|
|
@@ -816,7 +1050,7 @@ function __napiStampBindingTarget(exportsObject, target) {
|
|
|
816
1050
|
// The CommonJS loaders assign this return value so `cjs-module-lexer` — and
|
|
817
1051
|
// therefore Node's CJS -> ESM named export detection — can see
|
|
818
1052
|
// `__napiBindingTarget` statically.
|
|
819
|
-
return target
|
|
1053
|
+
return target;
|
|
820
1054
|
}
|
|
821
1055
|
// Stamp before the alias, not after. The guard only reads `nativeBinding`
|
|
822
1056
|
// (`hasOwnProperty` plus a comparison), which is safe against any addon
|
|
@@ -833,7 +1067,10 @@ function __napiStampBindingTarget(exportsObject, target) {
|
|
|
833
1067
|
// discards the value it wrote. What a consumer reads is whatever the guard put
|
|
834
1068
|
// on `nativeBinding`, so on a frozen binding, where the guard skips, the
|
|
835
1069
|
// linked import resolves to `undefined`.
|
|
836
|
-
module.exports.__napiBindingTarget = __napiStampBindingTarget(
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
1070
|
+
module.exports.__napiBindingTarget = __napiStampBindingTarget(
|
|
1071
|
+
nativeBinding,
|
|
1072
|
+
__napiLoadedBindingTarget,
|
|
1073
|
+
);
|
|
1074
|
+
module.exports = nativeBinding;
|
|
1075
|
+
module.exports.convert = nativeBinding.convert;
|
|
1076
|
+
module.exports.convertAsync = nativeBinding.convertAsync;
|