macroforge 0.1.75 → 0.1.76

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