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