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