@oveo/optimizer 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +5 -0
- package/index.js +213 -31
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -30,8 +30,13 @@ export interface OptimizerOptions {
|
|
|
30
30
|
globals?: GlobalsOptions
|
|
31
31
|
externs?: ExternsOptions
|
|
32
32
|
renameProperties?: RenamePropertiesOptions
|
|
33
|
+
url?: URLOptions
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface RenamePropertiesOptions {
|
|
36
37
|
pattern?: string
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
export interface UrlOptions {
|
|
41
|
+
baseURL: string
|
|
42
|
+
}
|
package/index.js
CHANGED
|
@@ -67,7 +67,7 @@ const isMuslFromChildProcess = () => {
|
|
|
67
67
|
function requireNative() {
|
|
68
68
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
69
69
|
try {
|
|
70
|
-
|
|
70
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
71
71
|
} catch (err) {
|
|
72
72
|
loadErrors.push(err)
|
|
73
73
|
}
|
|
@@ -79,7 +79,12 @@ function requireNative() {
|
|
|
79
79
|
loadErrors.push(e)
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
const binding = require('@oveo/optimizer-android-arm64')
|
|
83
|
+
const bindingPackageVersion = require('@oveo/optimizer-android-arm64/package.json').version
|
|
84
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
|
+
}
|
|
87
|
+
return binding
|
|
83
88
|
} catch (e) {
|
|
84
89
|
loadErrors.push(e)
|
|
85
90
|
}
|
|
@@ -90,7 +95,12 @@ function requireNative() {
|
|
|
90
95
|
loadErrors.push(e)
|
|
91
96
|
}
|
|
92
97
|
try {
|
|
93
|
-
|
|
98
|
+
const binding = require('@oveo/optimizer-android-arm-eabi')
|
|
99
|
+
const bindingPackageVersion = require('@oveo/optimizer-android-arm-eabi/package.json').version
|
|
100
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
|
+
}
|
|
103
|
+
return binding
|
|
94
104
|
} catch (e) {
|
|
95
105
|
loadErrors.push(e)
|
|
96
106
|
}
|
|
@@ -99,16 +109,39 @@ function requireNative() {
|
|
|
99
109
|
}
|
|
100
110
|
} else if (process.platform === 'win32') {
|
|
101
111
|
if (process.arch === 'x64') {
|
|
112
|
+
if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
|
|
113
|
+
try {
|
|
114
|
+
return require('./oveo-optimizer.win32-x64-gnu.node')
|
|
115
|
+
} catch (e) {
|
|
116
|
+
loadErrors.push(e)
|
|
117
|
+
}
|
|
102
118
|
try {
|
|
119
|
+
const binding = require('@oveo/optimizer-win32-x64-gnu')
|
|
120
|
+
const bindingPackageVersion = require('@oveo/optimizer-win32-x64-gnu/package.json').version
|
|
121
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
|
+
}
|
|
124
|
+
return binding
|
|
125
|
+
} catch (e) {
|
|
126
|
+
loadErrors.push(e)
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
try {
|
|
103
130
|
return require('./oveo-optimizer.win32-x64-msvc.node')
|
|
104
131
|
} catch (e) {
|
|
105
132
|
loadErrors.push(e)
|
|
106
133
|
}
|
|
107
134
|
try {
|
|
108
|
-
|
|
135
|
+
const binding = require('@oveo/optimizer-win32-x64-msvc')
|
|
136
|
+
const bindingPackageVersion = require('@oveo/optimizer-win32-x64-msvc/package.json').version
|
|
137
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
|
+
}
|
|
140
|
+
return binding
|
|
109
141
|
} catch (e) {
|
|
110
142
|
loadErrors.push(e)
|
|
111
143
|
}
|
|
144
|
+
}
|
|
112
145
|
} else if (process.arch === 'ia32') {
|
|
113
146
|
try {
|
|
114
147
|
return require('./oveo-optimizer.win32-ia32-msvc.node')
|
|
@@ -116,7 +149,12 @@ function requireNative() {
|
|
|
116
149
|
loadErrors.push(e)
|
|
117
150
|
}
|
|
118
151
|
try {
|
|
119
|
-
|
|
152
|
+
const binding = require('@oveo/optimizer-win32-ia32-msvc')
|
|
153
|
+
const bindingPackageVersion = require('@oveo/optimizer-win32-ia32-msvc/package.json').version
|
|
154
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
|
+
}
|
|
157
|
+
return binding
|
|
120
158
|
} catch (e) {
|
|
121
159
|
loadErrors.push(e)
|
|
122
160
|
}
|
|
@@ -127,7 +165,12 @@ function requireNative() {
|
|
|
127
165
|
loadErrors.push(e)
|
|
128
166
|
}
|
|
129
167
|
try {
|
|
130
|
-
|
|
168
|
+
const binding = require('@oveo/optimizer-win32-arm64-msvc')
|
|
169
|
+
const bindingPackageVersion = require('@oveo/optimizer-win32-arm64-msvc/package.json').version
|
|
170
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
|
+
}
|
|
173
|
+
return binding
|
|
131
174
|
} catch (e) {
|
|
132
175
|
loadErrors.push(e)
|
|
133
176
|
}
|
|
@@ -141,7 +184,12 @@ function requireNative() {
|
|
|
141
184
|
loadErrors.push(e)
|
|
142
185
|
}
|
|
143
186
|
try {
|
|
144
|
-
|
|
187
|
+
const binding = require('@oveo/optimizer-darwin-universal')
|
|
188
|
+
const bindingPackageVersion = require('@oveo/optimizer-darwin-universal/package.json').version
|
|
189
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
|
+
}
|
|
192
|
+
return binding
|
|
145
193
|
} catch (e) {
|
|
146
194
|
loadErrors.push(e)
|
|
147
195
|
}
|
|
@@ -152,7 +200,12 @@ function requireNative() {
|
|
|
152
200
|
loadErrors.push(e)
|
|
153
201
|
}
|
|
154
202
|
try {
|
|
155
|
-
|
|
203
|
+
const binding = require('@oveo/optimizer-darwin-x64')
|
|
204
|
+
const bindingPackageVersion = require('@oveo/optimizer-darwin-x64/package.json').version
|
|
205
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
|
+
}
|
|
208
|
+
return binding
|
|
156
209
|
} catch (e) {
|
|
157
210
|
loadErrors.push(e)
|
|
158
211
|
}
|
|
@@ -163,7 +216,12 @@ function requireNative() {
|
|
|
163
216
|
loadErrors.push(e)
|
|
164
217
|
}
|
|
165
218
|
try {
|
|
166
|
-
|
|
219
|
+
const binding = require('@oveo/optimizer-darwin-arm64')
|
|
220
|
+
const bindingPackageVersion = require('@oveo/optimizer-darwin-arm64/package.json').version
|
|
221
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
|
+
}
|
|
224
|
+
return binding
|
|
167
225
|
} catch (e) {
|
|
168
226
|
loadErrors.push(e)
|
|
169
227
|
}
|
|
@@ -178,7 +236,12 @@ function requireNative() {
|
|
|
178
236
|
loadErrors.push(e)
|
|
179
237
|
}
|
|
180
238
|
try {
|
|
181
|
-
|
|
239
|
+
const binding = require('@oveo/optimizer-freebsd-x64')
|
|
240
|
+
const bindingPackageVersion = require('@oveo/optimizer-freebsd-x64/package.json').version
|
|
241
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
|
+
}
|
|
244
|
+
return binding
|
|
182
245
|
} catch (e) {
|
|
183
246
|
loadErrors.push(e)
|
|
184
247
|
}
|
|
@@ -189,7 +252,12 @@ function requireNative() {
|
|
|
189
252
|
loadErrors.push(e)
|
|
190
253
|
}
|
|
191
254
|
try {
|
|
192
|
-
|
|
255
|
+
const binding = require('@oveo/optimizer-freebsd-arm64')
|
|
256
|
+
const bindingPackageVersion = require('@oveo/optimizer-freebsd-arm64/package.json').version
|
|
257
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
|
+
}
|
|
260
|
+
return binding
|
|
193
261
|
} catch (e) {
|
|
194
262
|
loadErrors.push(e)
|
|
195
263
|
}
|
|
@@ -205,7 +273,12 @@ function requireNative() {
|
|
|
205
273
|
loadErrors.push(e)
|
|
206
274
|
}
|
|
207
275
|
try {
|
|
208
|
-
|
|
276
|
+
const binding = require('@oveo/optimizer-linux-x64-musl')
|
|
277
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-x64-musl/package.json').version
|
|
278
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
|
+
}
|
|
281
|
+
return binding
|
|
209
282
|
} catch (e) {
|
|
210
283
|
loadErrors.push(e)
|
|
211
284
|
}
|
|
@@ -216,7 +289,12 @@ function requireNative() {
|
|
|
216
289
|
loadErrors.push(e)
|
|
217
290
|
}
|
|
218
291
|
try {
|
|
219
|
-
|
|
292
|
+
const binding = require('@oveo/optimizer-linux-x64-gnu')
|
|
293
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-x64-gnu/package.json').version
|
|
294
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
|
+
}
|
|
297
|
+
return binding
|
|
220
298
|
} catch (e) {
|
|
221
299
|
loadErrors.push(e)
|
|
222
300
|
}
|
|
@@ -229,7 +307,12 @@ function requireNative() {
|
|
|
229
307
|
loadErrors.push(e)
|
|
230
308
|
}
|
|
231
309
|
try {
|
|
232
|
-
|
|
310
|
+
const binding = require('@oveo/optimizer-linux-arm64-musl')
|
|
311
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-arm64-musl/package.json').version
|
|
312
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
|
+
}
|
|
315
|
+
return binding
|
|
233
316
|
} catch (e) {
|
|
234
317
|
loadErrors.push(e)
|
|
235
318
|
}
|
|
@@ -240,7 +323,12 @@ function requireNative() {
|
|
|
240
323
|
loadErrors.push(e)
|
|
241
324
|
}
|
|
242
325
|
try {
|
|
243
|
-
|
|
326
|
+
const binding = require('@oveo/optimizer-linux-arm64-gnu')
|
|
327
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-arm64-gnu/package.json').version
|
|
328
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
|
+
}
|
|
331
|
+
return binding
|
|
244
332
|
} catch (e) {
|
|
245
333
|
loadErrors.push(e)
|
|
246
334
|
}
|
|
@@ -253,7 +341,12 @@ function requireNative() {
|
|
|
253
341
|
loadErrors.push(e)
|
|
254
342
|
}
|
|
255
343
|
try {
|
|
256
|
-
|
|
344
|
+
const binding = require('@oveo/optimizer-linux-arm-musleabihf')
|
|
345
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-arm-musleabihf/package.json').version
|
|
346
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
|
+
}
|
|
349
|
+
return binding
|
|
257
350
|
} catch (e) {
|
|
258
351
|
loadErrors.push(e)
|
|
259
352
|
}
|
|
@@ -264,7 +357,46 @@ function requireNative() {
|
|
|
264
357
|
loadErrors.push(e)
|
|
265
358
|
}
|
|
266
359
|
try {
|
|
267
|
-
|
|
360
|
+
const binding = require('@oveo/optimizer-linux-arm-gnueabihf')
|
|
361
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-arm-gnueabihf/package.json').version
|
|
362
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
|
+
}
|
|
365
|
+
return binding
|
|
366
|
+
} catch (e) {
|
|
367
|
+
loadErrors.push(e)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
} else if (process.arch === 'loong64') {
|
|
371
|
+
if (isMusl()) {
|
|
372
|
+
try {
|
|
373
|
+
return require('./oveo-optimizer.linux-loong64-musl.node')
|
|
374
|
+
} catch (e) {
|
|
375
|
+
loadErrors.push(e)
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const binding = require('@oveo/optimizer-linux-loong64-musl')
|
|
379
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-loong64-musl/package.json').version
|
|
380
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
|
+
}
|
|
383
|
+
return binding
|
|
384
|
+
} catch (e) {
|
|
385
|
+
loadErrors.push(e)
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
try {
|
|
389
|
+
return require('./oveo-optimizer.linux-loong64-gnu.node')
|
|
390
|
+
} catch (e) {
|
|
391
|
+
loadErrors.push(e)
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
const binding = require('@oveo/optimizer-linux-loong64-gnu')
|
|
395
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-loong64-gnu/package.json').version
|
|
396
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
|
+
}
|
|
399
|
+
return binding
|
|
268
400
|
} catch (e) {
|
|
269
401
|
loadErrors.push(e)
|
|
270
402
|
}
|
|
@@ -277,7 +409,12 @@ function requireNative() {
|
|
|
277
409
|
loadErrors.push(e)
|
|
278
410
|
}
|
|
279
411
|
try {
|
|
280
|
-
|
|
412
|
+
const binding = require('@oveo/optimizer-linux-riscv64-musl')
|
|
413
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-riscv64-musl/package.json').version
|
|
414
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
|
+
}
|
|
417
|
+
return binding
|
|
281
418
|
} catch (e) {
|
|
282
419
|
loadErrors.push(e)
|
|
283
420
|
}
|
|
@@ -288,7 +425,12 @@ function requireNative() {
|
|
|
288
425
|
loadErrors.push(e)
|
|
289
426
|
}
|
|
290
427
|
try {
|
|
291
|
-
|
|
428
|
+
const binding = require('@oveo/optimizer-linux-riscv64-gnu')
|
|
429
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-riscv64-gnu/package.json').version
|
|
430
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
|
+
}
|
|
433
|
+
return binding
|
|
292
434
|
} catch (e) {
|
|
293
435
|
loadErrors.push(e)
|
|
294
436
|
}
|
|
@@ -300,7 +442,12 @@ function requireNative() {
|
|
|
300
442
|
loadErrors.push(e)
|
|
301
443
|
}
|
|
302
444
|
try {
|
|
303
|
-
|
|
445
|
+
const binding = require('@oveo/optimizer-linux-ppc64-gnu')
|
|
446
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-ppc64-gnu/package.json').version
|
|
447
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
|
+
}
|
|
450
|
+
return binding
|
|
304
451
|
} catch (e) {
|
|
305
452
|
loadErrors.push(e)
|
|
306
453
|
}
|
|
@@ -311,7 +458,12 @@ function requireNative() {
|
|
|
311
458
|
loadErrors.push(e)
|
|
312
459
|
}
|
|
313
460
|
try {
|
|
314
|
-
|
|
461
|
+
const binding = require('@oveo/optimizer-linux-s390x-gnu')
|
|
462
|
+
const bindingPackageVersion = require('@oveo/optimizer-linux-s390x-gnu/package.json').version
|
|
463
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
|
+
}
|
|
466
|
+
return binding
|
|
315
467
|
} catch (e) {
|
|
316
468
|
loadErrors.push(e)
|
|
317
469
|
}
|
|
@@ -321,34 +473,49 @@ function requireNative() {
|
|
|
321
473
|
} else if (process.platform === 'openharmony') {
|
|
322
474
|
if (process.arch === 'arm64') {
|
|
323
475
|
try {
|
|
324
|
-
return require('./oveo-optimizer.
|
|
476
|
+
return require('./oveo-optimizer.openharmony-arm64.node')
|
|
325
477
|
} catch (e) {
|
|
326
478
|
loadErrors.push(e)
|
|
327
479
|
}
|
|
328
480
|
try {
|
|
329
|
-
|
|
481
|
+
const binding = require('@oveo/optimizer-openharmony-arm64')
|
|
482
|
+
const bindingPackageVersion = require('@oveo/optimizer-openharmony-arm64/package.json').version
|
|
483
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
|
+
}
|
|
486
|
+
return binding
|
|
330
487
|
} catch (e) {
|
|
331
488
|
loadErrors.push(e)
|
|
332
489
|
}
|
|
333
490
|
} else if (process.arch === 'x64') {
|
|
334
491
|
try {
|
|
335
|
-
return require('./oveo-optimizer.
|
|
492
|
+
return require('./oveo-optimizer.openharmony-x64.node')
|
|
336
493
|
} catch (e) {
|
|
337
494
|
loadErrors.push(e)
|
|
338
495
|
}
|
|
339
496
|
try {
|
|
340
|
-
|
|
497
|
+
const binding = require('@oveo/optimizer-openharmony-x64')
|
|
498
|
+
const bindingPackageVersion = require('@oveo/optimizer-openharmony-x64/package.json').version
|
|
499
|
+
if (bindingPackageVersion !== '0.3.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
|
+
}
|
|
502
|
+
return binding
|
|
341
503
|
} catch (e) {
|
|
342
504
|
loadErrors.push(e)
|
|
343
505
|
}
|
|
344
506
|
} else if (process.arch === 'arm') {
|
|
345
507
|
try {
|
|
346
|
-
return require('./oveo-optimizer.
|
|
508
|
+
return require('./oveo-optimizer.openharmony-arm.node')
|
|
347
509
|
} catch (e) {
|
|
348
510
|
loadErrors.push(e)
|
|
349
511
|
}
|
|
350
512
|
try {
|
|
351
|
-
|
|
513
|
+
const binding = require('@oveo/optimizer-openharmony-arm')
|
|
514
|
+
const bindingPackageVersion = require('@oveo/optimizer-openharmony-arm/package.json').version
|
|
515
|
+
if (bindingPackageVersion !== '0.3.5' && 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.3.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
|
+
}
|
|
518
|
+
return binding
|
|
352
519
|
} catch (e) {
|
|
353
520
|
loadErrors.push(e)
|
|
354
521
|
}
|
|
@@ -363,22 +530,32 @@ function requireNative() {
|
|
|
363
530
|
nativeBinding = requireNative()
|
|
364
531
|
|
|
365
532
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
533
|
+
let wasiBinding = null
|
|
534
|
+
let wasiBindingError = null
|
|
366
535
|
try {
|
|
367
|
-
|
|
536
|
+
wasiBinding = require('./oveo-optimizer.wasi.cjs')
|
|
537
|
+
nativeBinding = wasiBinding
|
|
368
538
|
} catch (err) {
|
|
369
539
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
370
|
-
|
|
540
|
+
wasiBindingError = err
|
|
371
541
|
}
|
|
372
542
|
}
|
|
373
543
|
if (!nativeBinding) {
|
|
374
544
|
try {
|
|
375
|
-
|
|
545
|
+
wasiBinding = require('@oveo/optimizer-wasm32-wasi')
|
|
546
|
+
nativeBinding = wasiBinding
|
|
376
547
|
} catch (err) {
|
|
377
548
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
549
|
+
wasiBindingError.cause = err
|
|
378
550
|
loadErrors.push(err)
|
|
379
551
|
}
|
|
380
552
|
}
|
|
381
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
|
+
}
|
|
382
559
|
}
|
|
383
560
|
|
|
384
561
|
if (!nativeBinding) {
|
|
@@ -387,7 +564,12 @@ if (!nativeBinding) {
|
|
|
387
564
|
`Cannot find native binding. ` +
|
|
388
565
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
389
566
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
390
|
-
{
|
|
567
|
+
{
|
|
568
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
569
|
+
cur.cause = err
|
|
570
|
+
return cur
|
|
571
|
+
}),
|
|
572
|
+
},
|
|
391
573
|
)
|
|
392
574
|
}
|
|
393
575
|
throw new Error(`Failed to load native binding`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oveo/optimizer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"index.js"
|
|
12
12
|
],
|
|
13
13
|
"optionalDependencies": {
|
|
14
|
-
"@oveo/optimizer-darwin-arm64": "0.
|
|
15
|
-
"@oveo/optimizer-darwin-x64": "0.
|
|
16
|
-
"@oveo/optimizer-linux-arm64-gnu": "0.
|
|
17
|
-
"@oveo/optimizer-linux-x64-gnu": "0.
|
|
18
|
-
"@oveo/optimizer-win32-arm64-msvc": "0.
|
|
19
|
-
"@oveo/optimizer-win32-x64-msvc": "0.
|
|
14
|
+
"@oveo/optimizer-darwin-arm64": "0.3.6",
|
|
15
|
+
"@oveo/optimizer-darwin-x64": "0.3.6",
|
|
16
|
+
"@oveo/optimizer-linux-arm64-gnu": "0.3.6",
|
|
17
|
+
"@oveo/optimizer-linux-x64-gnu": "0.3.6",
|
|
18
|
+
"@oveo/optimizer-win32-arm64-msvc": "0.3.6",
|
|
19
|
+
"@oveo/optimizer-win32-x64-msvc": "0.3.6"
|
|
20
20
|
},
|
|
21
21
|
"napi": {
|
|
22
22
|
"binaryName": "oveo-optimizer",
|