@brust/core 2.0.0-alpha.12 → 2.0.0-alpha.14
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/native/index.js +54 -54
- package/package.json +9 -9
- package/src/build/build-eval.ts +3 -1
- package/src/build/bundle.ts +10 -3
- package/src/build/pkg-src.ts +90 -6
package/native/index.js
CHANGED
|
@@ -89,8 +89,8 @@ function requireNative() {
|
|
|
89
89
|
try {
|
|
90
90
|
const binding = require('@brust/native-android-arm64')
|
|
91
91
|
const bindingPackageVersion = require('@brust/native-android-arm64/package.json').version
|
|
92
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
93
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
92
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
93
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
94
94
|
}
|
|
95
95
|
return binding
|
|
96
96
|
} catch (e) {
|
|
@@ -105,8 +105,8 @@ function requireNative() {
|
|
|
105
105
|
try {
|
|
106
106
|
const binding = require('@brust/native-android-arm-eabi')
|
|
107
107
|
const bindingPackageVersion = require('@brust/native-android-arm-eabi/package.json').version
|
|
108
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
109
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
108
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
109
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
110
|
}
|
|
111
111
|
return binding
|
|
112
112
|
} catch (e) {
|
|
@@ -126,8 +126,8 @@ function requireNative() {
|
|
|
126
126
|
try {
|
|
127
127
|
const binding = require('@brust/native-win32-x64-gnu')
|
|
128
128
|
const bindingPackageVersion = require('@brust/native-win32-x64-gnu/package.json').version
|
|
129
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
130
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
129
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
130
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
131
|
}
|
|
132
132
|
return binding
|
|
133
133
|
} catch (e) {
|
|
@@ -142,8 +142,8 @@ function requireNative() {
|
|
|
142
142
|
try {
|
|
143
143
|
const binding = require('@brust/native-win32-x64-msvc')
|
|
144
144
|
const bindingPackageVersion = require('@brust/native-win32-x64-msvc/package.json').version
|
|
145
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
146
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
145
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
146
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
147
|
}
|
|
148
148
|
return binding
|
|
149
149
|
} catch (e) {
|
|
@@ -159,8 +159,8 @@ function requireNative() {
|
|
|
159
159
|
try {
|
|
160
160
|
const binding = require('@brust/native-win32-ia32-msvc')
|
|
161
161
|
const bindingPackageVersion = require('@brust/native-win32-ia32-msvc/package.json').version
|
|
162
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
162
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
164
164
|
}
|
|
165
165
|
return binding
|
|
166
166
|
} catch (e) {
|
|
@@ -175,8 +175,8 @@ function requireNative() {
|
|
|
175
175
|
try {
|
|
176
176
|
const binding = require('@brust/native-win32-arm64-msvc')
|
|
177
177
|
const bindingPackageVersion = require('@brust/native-win32-arm64-msvc/package.json').version
|
|
178
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
179
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
178
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
179
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
180
180
|
}
|
|
181
181
|
return binding
|
|
182
182
|
} catch (e) {
|
|
@@ -194,8 +194,8 @@ function requireNative() {
|
|
|
194
194
|
try {
|
|
195
195
|
const binding = require('@brust/native-darwin-universal')
|
|
196
196
|
const bindingPackageVersion = require('@brust/native-darwin-universal/package.json').version
|
|
197
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
198
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
197
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
198
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
199
199
|
}
|
|
200
200
|
return binding
|
|
201
201
|
} catch (e) {
|
|
@@ -210,8 +210,8 @@ function requireNative() {
|
|
|
210
210
|
try {
|
|
211
211
|
const binding = require('@brust/native-darwin-x64')
|
|
212
212
|
const bindingPackageVersion = require('@brust/native-darwin-x64/package.json').version
|
|
213
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
214
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
213
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
214
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
215
215
|
}
|
|
216
216
|
return binding
|
|
217
217
|
} catch (e) {
|
|
@@ -226,8 +226,8 @@ function requireNative() {
|
|
|
226
226
|
try {
|
|
227
227
|
const binding = require('@brust/native-darwin-arm64')
|
|
228
228
|
const bindingPackageVersion = require('@brust/native-darwin-arm64/package.json').version
|
|
229
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
230
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
229
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
230
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
231
231
|
}
|
|
232
232
|
return binding
|
|
233
233
|
} catch (e) {
|
|
@@ -246,8 +246,8 @@ function requireNative() {
|
|
|
246
246
|
try {
|
|
247
247
|
const binding = require('@brust/native-freebsd-x64')
|
|
248
248
|
const bindingPackageVersion = require('@brust/native-freebsd-x64/package.json').version
|
|
249
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
250
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
249
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
250
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
251
251
|
}
|
|
252
252
|
return binding
|
|
253
253
|
} catch (e) {
|
|
@@ -262,8 +262,8 @@ function requireNative() {
|
|
|
262
262
|
try {
|
|
263
263
|
const binding = require('@brust/native-freebsd-arm64')
|
|
264
264
|
const bindingPackageVersion = require('@brust/native-freebsd-arm64/package.json').version
|
|
265
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
265
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
267
267
|
}
|
|
268
268
|
return binding
|
|
269
269
|
} catch (e) {
|
|
@@ -283,8 +283,8 @@ function requireNative() {
|
|
|
283
283
|
try {
|
|
284
284
|
const binding = require('@brust/native-linux-x64-musl')
|
|
285
285
|
const bindingPackageVersion = require('@brust/native-linux-x64-musl/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
286
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
288
|
}
|
|
289
289
|
return binding
|
|
290
290
|
} catch (e) {
|
|
@@ -299,8 +299,8 @@ function requireNative() {
|
|
|
299
299
|
try {
|
|
300
300
|
const binding = require('@brust/native-linux-x64-gnu')
|
|
301
301
|
const bindingPackageVersion = require('@brust/native-linux-x64-gnu/package.json').version
|
|
302
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
303
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
302
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
303
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
304
304
|
}
|
|
305
305
|
return binding
|
|
306
306
|
} catch (e) {
|
|
@@ -317,8 +317,8 @@ function requireNative() {
|
|
|
317
317
|
try {
|
|
318
318
|
const binding = require('@brust/native-linux-arm64-musl')
|
|
319
319
|
const bindingPackageVersion = require('@brust/native-linux-arm64-musl/package.json').version
|
|
320
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
321
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
320
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
321
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
322
322
|
}
|
|
323
323
|
return binding
|
|
324
324
|
} catch (e) {
|
|
@@ -333,8 +333,8 @@ function requireNative() {
|
|
|
333
333
|
try {
|
|
334
334
|
const binding = require('@brust/native-linux-arm64-gnu')
|
|
335
335
|
const bindingPackageVersion = require('@brust/native-linux-arm64-gnu/package.json').version
|
|
336
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
337
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
336
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
337
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
338
338
|
}
|
|
339
339
|
return binding
|
|
340
340
|
} catch (e) {
|
|
@@ -351,8 +351,8 @@ function requireNative() {
|
|
|
351
351
|
try {
|
|
352
352
|
const binding = require('@brust/native-linux-arm-musleabihf')
|
|
353
353
|
const bindingPackageVersion = require('@brust/native-linux-arm-musleabihf/package.json').version
|
|
354
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
355
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
354
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
355
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
356
356
|
}
|
|
357
357
|
return binding
|
|
358
358
|
} catch (e) {
|
|
@@ -367,8 +367,8 @@ function requireNative() {
|
|
|
367
367
|
try {
|
|
368
368
|
const binding = require('@brust/native-linux-arm-gnueabihf')
|
|
369
369
|
const bindingPackageVersion = require('@brust/native-linux-arm-gnueabihf/package.json').version
|
|
370
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
371
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
370
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
371
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
372
372
|
}
|
|
373
373
|
return binding
|
|
374
374
|
} catch (e) {
|
|
@@ -385,8 +385,8 @@ function requireNative() {
|
|
|
385
385
|
try {
|
|
386
386
|
const binding = require('@brust/native-linux-loong64-musl')
|
|
387
387
|
const bindingPackageVersion = require('@brust/native-linux-loong64-musl/package.json').version
|
|
388
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
389
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
388
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
389
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
390
390
|
}
|
|
391
391
|
return binding
|
|
392
392
|
} catch (e) {
|
|
@@ -401,8 +401,8 @@ function requireNative() {
|
|
|
401
401
|
try {
|
|
402
402
|
const binding = require('@brust/native-linux-loong64-gnu')
|
|
403
403
|
const bindingPackageVersion = require('@brust/native-linux-loong64-gnu/package.json').version
|
|
404
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
405
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
404
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
405
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
406
406
|
}
|
|
407
407
|
return binding
|
|
408
408
|
} catch (e) {
|
|
@@ -419,8 +419,8 @@ function requireNative() {
|
|
|
419
419
|
try {
|
|
420
420
|
const binding = require('@brust/native-linux-riscv64-musl')
|
|
421
421
|
const bindingPackageVersion = require('@brust/native-linux-riscv64-musl/package.json').version
|
|
422
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
423
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
422
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
423
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
424
424
|
}
|
|
425
425
|
return binding
|
|
426
426
|
} catch (e) {
|
|
@@ -435,8 +435,8 @@ function requireNative() {
|
|
|
435
435
|
try {
|
|
436
436
|
const binding = require('@brust/native-linux-riscv64-gnu')
|
|
437
437
|
const bindingPackageVersion = require('@brust/native-linux-riscv64-gnu/package.json').version
|
|
438
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
439
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
438
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
439
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
440
440
|
}
|
|
441
441
|
return binding
|
|
442
442
|
} catch (e) {
|
|
@@ -452,8 +452,8 @@ function requireNative() {
|
|
|
452
452
|
try {
|
|
453
453
|
const binding = require('@brust/native-linux-ppc64-gnu')
|
|
454
454
|
const bindingPackageVersion = require('@brust/native-linux-ppc64-gnu/package.json').version
|
|
455
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
456
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
455
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
456
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
457
457
|
}
|
|
458
458
|
return binding
|
|
459
459
|
} catch (e) {
|
|
@@ -468,8 +468,8 @@ function requireNative() {
|
|
|
468
468
|
try {
|
|
469
469
|
const binding = require('@brust/native-linux-s390x-gnu')
|
|
470
470
|
const bindingPackageVersion = require('@brust/native-linux-s390x-gnu/package.json').version
|
|
471
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
472
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
471
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
472
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
473
473
|
}
|
|
474
474
|
return binding
|
|
475
475
|
} catch (e) {
|
|
@@ -488,8 +488,8 @@ function requireNative() {
|
|
|
488
488
|
try {
|
|
489
489
|
const binding = require('@brust/native-openharmony-arm64')
|
|
490
490
|
const bindingPackageVersion = require('@brust/native-openharmony-arm64/package.json').version
|
|
491
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
492
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
491
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
492
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
493
493
|
}
|
|
494
494
|
return binding
|
|
495
495
|
} catch (e) {
|
|
@@ -504,8 +504,8 @@ function requireNative() {
|
|
|
504
504
|
try {
|
|
505
505
|
const binding = require('@brust/native-openharmony-x64')
|
|
506
506
|
const bindingPackageVersion = require('@brust/native-openharmony-x64/package.json').version
|
|
507
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
508
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
507
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
508
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
509
509
|
}
|
|
510
510
|
return binding
|
|
511
511
|
} catch (e) {
|
|
@@ -520,8 +520,8 @@ function requireNative() {
|
|
|
520
520
|
try {
|
|
521
521
|
const binding = require('@brust/native-openharmony-arm')
|
|
522
522
|
const bindingPackageVersion = require('@brust/native-openharmony-arm/package.json').version
|
|
523
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
524
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
523
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
524
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
525
525
|
}
|
|
526
526
|
return binding
|
|
527
527
|
} catch (e) {
|
|
@@ -661,8 +661,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
661
661
|
if (!candidateFailed) {
|
|
662
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
663
663
|
const bindingPackageVersion = require('@brust/native-wasm32-wasi/package.json').version
|
|
664
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
665
|
-
throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.
|
|
664
|
+
if (bindingPackageVersion !== '2.0.0-alpha.14') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
wasiBinding = require('@brust/native-wasm32-wasi')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brust/core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"description": "brust v2 — React components compiled to Rust-rendered templates",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://brust.dev",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@brust/runtime-dom": "2.0.0-alpha.
|
|
58
|
+
"@brust/runtime-dom": "2.0.0-alpha.14"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"react": "^19.0.0",
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
95
|
"optionalDependencies": {
|
|
96
|
-
"@brust/native-darwin-x64": "2.0.0-alpha.
|
|
97
|
-
"@brust/native-darwin-arm64": "2.0.0-alpha.
|
|
98
|
-
"@brust/native-linux-x64-gnu": "2.0.0-alpha.
|
|
99
|
-
"@brust/native-linux-arm64-gnu": "2.0.0-alpha.
|
|
100
|
-
"@brust/native-linux-x64-musl": "2.0.0-alpha.
|
|
101
|
-
"@brust/native-linux-arm64-musl": "2.0.0-alpha.
|
|
102
|
-
"@brust/core-cf": "2.0.0-alpha.
|
|
96
|
+
"@brust/native-darwin-x64": "2.0.0-alpha.14",
|
|
97
|
+
"@brust/native-darwin-arm64": "2.0.0-alpha.14",
|
|
98
|
+
"@brust/native-linux-x64-gnu": "2.0.0-alpha.14",
|
|
99
|
+
"@brust/native-linux-arm64-gnu": "2.0.0-alpha.14",
|
|
100
|
+
"@brust/native-linux-x64-musl": "2.0.0-alpha.14",
|
|
101
|
+
"@brust/native-linux-arm64-musl": "2.0.0-alpha.14",
|
|
102
|
+
"@brust/core-cf": "2.0.0-alpha.14"
|
|
103
103
|
}
|
|
104
104
|
}
|
package/src/build/build-eval.ts
CHANGED
|
@@ -249,6 +249,7 @@ async function evaluateInstances(
|
|
|
249
249
|
const imports: string[] = []
|
|
250
250
|
/** Component id -> its staged job module; written once, with the stubs its own imports are served by. */
|
|
251
251
|
const staged = new Map<string, string>()
|
|
252
|
+
const jobFiles = new Set<string>() // the only importers of `brust-job:` (F186)
|
|
252
253
|
const stageJob = (c: Compiled, served: { source: string; code: string }[]) => {
|
|
253
254
|
if (staged.has(c.id)) return
|
|
254
255
|
const file = join(dist, '.stage', 'eval', `${c.id}.job.ts`)
|
|
@@ -266,6 +267,7 @@ async function evaluateInstances(
|
|
|
266
267
|
stubs.set(realpathSync(file), map)
|
|
267
268
|
}
|
|
268
269
|
staged.set(c.id, file)
|
|
270
|
+
jobFiles.add(file).add(realpathSync(file))
|
|
269
271
|
}
|
|
270
272
|
for (const c of compiled.values()) {
|
|
271
273
|
for (const inst of c.ir.build_eval_instances ?? []) {
|
|
@@ -296,7 +298,7 @@ async function evaluateInstances(
|
|
|
296
298
|
target: 'bun',
|
|
297
299
|
format: 'esm',
|
|
298
300
|
define: PRODUCTION,
|
|
299
|
-
plugins: [jobImportPlugin((id) => staged.get(id)), stubPlugin(stubs), sourceDirPlugin(sourceOf, appRoot)],
|
|
301
|
+
plugins: [jobImportPlugin((id) => staged.get(id), (importer) => jobFiles.has(importer)), stubPlugin(stubs), sourceDirPlugin(sourceOf, appRoot)],
|
|
300
302
|
})
|
|
301
303
|
if (!res.success) {
|
|
302
304
|
log(`warning build-eval the instance jobs could not be bundled for build evaluation, they stay per-request jobs: ${res.logs.map(String).join(' | ').split('\n')[0]}`)
|
package/src/build/bundle.ts
CHANGED
|
@@ -603,12 +603,14 @@ export async function buildCacheAdapter(dist: string, entry: string, cssMaps: Ma
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
/** R34.96: a parent's job calls the job of each child fused into it through `brust-job:<component id>`, resolved here to
|
|
606
|
-
* that child's staged job module (`fileOf`). Only a compiled component's id resolves
|
|
607
|
-
|
|
606
|
+
* that child's staged job module (`fileOf`). Only a compiled component's id resolves, and only for a staged job file
|
|
607
|
+
* (`isJobFile`, F186): any other importer (app or package source) fails the bundle, as does an unknown id. */
|
|
608
|
+
export function jobImportPlugin(fileOf: (id: string) => string | undefined, isJobFile: (importer: string) => boolean): BunPlugin {
|
|
608
609
|
return {
|
|
609
610
|
name: 'brust-job-import',
|
|
610
611
|
setup(b) {
|
|
611
612
|
b.onResolve({ filter: /^brust-job:/ }, (a) => {
|
|
613
|
+
if (!isJobFile(a.importer)) throw new BuildError('bundle', `${a.importer}: brust-job: is for generated job modules only`)
|
|
612
614
|
const id = a.path.slice('brust-job:'.length)
|
|
613
615
|
const file = /^[A-Za-z0-9_$-]+$/.test(id) ? fileOf(id) : undefined
|
|
614
616
|
if (file === undefined) throw new BuildError('bundle', `${a.importer}: no job module for ${JSON.stringify(id)}`)
|
|
@@ -649,6 +651,7 @@ export async function buildJobs(
|
|
|
649
651
|
imports.push(reviveSource(`{ ${revived.map((r, i) => `${JSON.stringify(r.id)}: N${i}`).join(', ')} }`))
|
|
650
652
|
}
|
|
651
653
|
const hosts = new Set(reviving.map((c) => c.id))
|
|
654
|
+
const jobFiles = new Set<string>() // the staged job modules: the only importers of `brust-job:` (F186)
|
|
652
655
|
let n = 0
|
|
653
656
|
for (const c of compiled.values()) {
|
|
654
657
|
const fns: string[] = []
|
|
@@ -657,6 +660,7 @@ export async function buildJobs(
|
|
|
657
660
|
const file = join(dist, 'jobs', `${c.id}.server.ts`)
|
|
658
661
|
write(file, c.serverTs)
|
|
659
662
|
stage(sourceOf, file, c)
|
|
663
|
+
jobFiles.add(file).add(realpathSync(file))
|
|
660
664
|
if (reached === undefined || reached.planned.has(c.id)) {
|
|
661
665
|
imports.push(`import * as j${n} from ${JSON.stringify(file)}`)
|
|
662
666
|
fns.push(`precompute: j${n}.precompute`)
|
|
@@ -680,7 +684,10 @@ export async function buildJobs(
|
|
|
680
684
|
define: PRODUCTION,
|
|
681
685
|
external: JOBS_EXTERNALS,
|
|
682
686
|
plugins: [
|
|
683
|
-
jobImportPlugin(
|
|
687
|
+
jobImportPlugin(
|
|
688
|
+
(id) => (compiled.get(id)?.serverTs !== undefined ? join(dist, 'jobs', `${id}.server.ts`) : undefined),
|
|
689
|
+
(importer) => jobFiles.has(importer),
|
|
690
|
+
),
|
|
684
691
|
serverOnlyEmptyPlugin(),
|
|
685
692
|
cssPlugin(cssMaps),
|
|
686
693
|
workerStorePlugin,
|
package/src/build/pkg-src.ts
CHANGED
|
@@ -209,11 +209,13 @@ const transpile = (code: string, loader: 'tsx' | 'ts' | 'js') =>
|
|
|
209
209
|
|
|
210
210
|
/** What of `sources` is not in `published`; empty = the sources are what the published file was built from. */
|
|
211
211
|
export function integrityGaps(sources: { path: string; text: string }[], published: string): string[] {
|
|
212
|
-
const
|
|
212
|
+
const pubJs = transpile(published, 'js')
|
|
213
|
+
const pub = skeleton(pubJs)
|
|
214
|
+
const pubPairs = exportPairs(pubJs)
|
|
213
215
|
const gaps: string[] = []
|
|
214
216
|
for (const s of sources) {
|
|
215
217
|
const loader = s.path.endsWith('.tsx') ? 'tsx' : 'ts'
|
|
216
|
-
const sk = skeleton(transpile(s.text, loader))
|
|
218
|
+
const sk = skeleton(withoutUnstableAliases(transpile(s.text, loader), pub.names, pubPairs))
|
|
217
219
|
// Import specifiers are module names, which bundling replaces; they are checked as imports instead.
|
|
218
220
|
for (const im of new Bun.Transpiler({ loader }).scanImports(s.text)) sk.strings.delete(im.path)
|
|
219
221
|
for (const v of sk.strings) if (!pub.strings.has(v)) gaps.push(`${s.path}: literal ${JSON.stringify(v.startsWith('#') ? v.slice(1) : v).slice(0, 60)}`)
|
|
@@ -222,6 +224,82 @@ export function integrityGaps(sources: { path: string; text: string }[], publish
|
|
|
222
224
|
return gaps
|
|
223
225
|
}
|
|
224
226
|
|
|
227
|
+
|
|
228
|
+
/** The `local as exported` pairs of the `export { … }` clauses of transpiled JS (`x` alone is `x as x`). */
|
|
229
|
+
function exportPairs(js: string): Set<string> {
|
|
230
|
+
const out = new Set<string>()
|
|
231
|
+
for (const m of js.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
232
|
+
for (const item of m[1]!.split(',')) {
|
|
233
|
+
const parts = item.trim().split(/\s+as\s+/)
|
|
234
|
+
if (parts[0] && /^[A-Za-z_$][\w$]*$/.test(parts[0])) out.add(`${parts[0]} as ${parts[1] ?? parts[0]}`)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return out
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** P2 (wave A step 0): a source export clause `export { Local as Alias }` whose alias the published file spells
|
|
241
|
+
* `unstable_Alias` (the Radix convention) names the same binding under another export name; an export name carries no
|
|
242
|
+
* behaviour. The alias is dropped from the source text before the name check ONLY when the published file exports the
|
|
243
|
+
* IDENTICAL local binding as EXACTLY `unstable_` + the alias. Any other alias that the published file does not have stays
|
|
244
|
+
* a name difference (a refusal). */
|
|
245
|
+
function withoutUnstableAliases(js: string, pubNames: Set<string>, pubPairs: Set<string>): string {
|
|
246
|
+
return js.replace(/\bexport\s*\{([^}]*)\}/g, (all, body: string) => {
|
|
247
|
+
const items = body.split(',').map((item) => {
|
|
248
|
+
const parts = item.trim().split(/\s+as\s+/)
|
|
249
|
+
const [local, alias] = [parts[0] ?? '', parts[1]]
|
|
250
|
+
if (alias === undefined || pubNames.has(alias)) return item.trim()
|
|
251
|
+
return pubPairs.has(`${local} as unstable_${alias}`) ? local : item.trim()
|
|
252
|
+
})
|
|
253
|
+
return `export { ${items.join(', ')} }`
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** P1 (wave A step 0): a published file bundled from SEVERAL sources, none of which is the entry (the `index.ts` is not in
|
|
258
|
+
* the ESM map). Provable only when the published file's one `export { a, b }` clause lists plain names (no alias, no
|
|
259
|
+
* `export *`, no default) and EACH of them is declared by `export function|const|let|class` in exactly one source and
|
|
260
|
+
* EVERY source declares at least one of them: the entry is then a barrel the build writes from those names (identifiers
|
|
261
|
+
* only), never one of the sources chosen by eye. Every source still goes through the integrity check. */
|
|
262
|
+
function barrelOf(files: { path: string; text: string }[], published: string): { path: string; text: string } | undefined {
|
|
263
|
+
let js: string
|
|
264
|
+
try {
|
|
265
|
+
js = transpile(published, 'js')
|
|
266
|
+
} catch {
|
|
267
|
+
return undefined
|
|
268
|
+
}
|
|
269
|
+
if (/\bexport\s+(?:(?:default|function|const|let|var|class)\b|\*)/.test(js)) return undefined
|
|
270
|
+
const clauses = [...js.matchAll(/\bexport\s*\{([^}]*)\}/g)]
|
|
271
|
+
if (clauses.length !== 1) return undefined
|
|
272
|
+
const names: string[] = []
|
|
273
|
+
for (const item of clauses[0]![1]!.split(',')) {
|
|
274
|
+
const n = item.trim()
|
|
275
|
+
if (n === '') continue
|
|
276
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(n)) return undefined // an alias (`a as b`) or anything else
|
|
277
|
+
names.push(n)
|
|
278
|
+
}
|
|
279
|
+
if (names.length === 0 || new Set(names).size !== names.length) return undefined
|
|
280
|
+
const owner = new Map<string, string>()
|
|
281
|
+
const used = new Set<string>()
|
|
282
|
+
for (const name of names) {
|
|
283
|
+
const owners = files.filter((f) => new RegExp(`^export\\s+(?:async\\s+)?(?:function\\*?|const|let|class)\\s+${name.replace(/\$/g, '\\$')}\\b`, 'm').test(f.text))
|
|
284
|
+
if (owners.length !== 1) return undefined
|
|
285
|
+
owner.set(name, owners[0]!.path)
|
|
286
|
+
used.add(owners[0]!.path)
|
|
287
|
+
}
|
|
288
|
+
if (files.some((f) => !used.has(f.path))) return undefined
|
|
289
|
+
// The barrel's specifiers are source-map paths (package-controlled text): only plain path characters, no `..` segment,
|
|
290
|
+
// never absolute; and each is printed as a JSON string, so nothing in it can end the string or the statement.
|
|
291
|
+
const plainPath = (p: string) => /^[A-Za-z0-9_@./-]+$/.test(p) && !p.startsWith('/') && !p.split('/').some((seg) => seg === '..' || seg === '')
|
|
292
|
+
if (files.some((f) => !plainPath(f.path))) return undefined
|
|
293
|
+
const dir = posix.dirname(files[0]!.path)
|
|
294
|
+
const path = posix.join(dir, 'index.ts')
|
|
295
|
+
if (files.some((f) => f.path === path)) return undefined
|
|
296
|
+
const lines = [...used].map((src) => {
|
|
297
|
+
const rel = posix.relative(dir, src).replace(/\.tsx?$/, '')
|
|
298
|
+
return `export { ${names.filter((n) => owner.get(n) === src).join(', ')} } from ${JSON.stringify(rel.startsWith('.') ? rel : `./${rel}`)}`
|
|
299
|
+
})
|
|
300
|
+
return { path, text: `${lines.join('\n')}\n` }
|
|
301
|
+
}
|
|
302
|
+
|
|
225
303
|
// ---------------------------------------------------------------------------------------------------------------
|
|
226
304
|
|
|
227
305
|
/** Reads one package (real directory `dir`), checks it, and writes its sources under `outRoot`. */
|
|
@@ -247,7 +325,11 @@ function writePackage(appRoot: string, dir: string, budget: { bytes: number }):
|
|
|
247
325
|
const text = contents[k]
|
|
248
326
|
if (typeof s !== 'string' || typeof text !== 'string') continue
|
|
249
327
|
const abs = posix.normalize(posix.join(relative(dir, dirname(mapFile)).split(sep).join('/'), s))
|
|
250
|
-
if (abs.startsWith('..') || posix.isAbsolute(abs) || /^[a-z]+:/i.test(s)) return { ok: false, reason: `the source ${s} lies outside the package` }
|
|
328
|
+
if (abs.startsWith('..') || posix.isAbsolute(abs) || posix.isAbsolute(s) || /^[a-z]+:/i.test(s)) return { ok: false, reason: `the source ${s} lies outside the package` }
|
|
329
|
+
// Map paths are package-controlled text and become file names, the entry path and import specifiers the compiler
|
|
330
|
+
// prints: only plain path characters, no `//`, no `..` segment left after normalizing (Mellow, wave A step 0).
|
|
331
|
+
if (!/^[A-Za-z0-9_@./-]+$/.test(s) || s.includes('//') || !/^[A-Za-z0-9_@][A-Za-z0-9_@./-]*$/.test(abs) || abs.split('/').includes('..'))
|
|
332
|
+
return { ok: false, reason: `the source path ${JSON.stringify(s).slice(0, 80)} has characters other than letters, digits and _ @ . / -` }
|
|
251
333
|
if (!/\.tsx?$/.test(abs)) continue
|
|
252
334
|
files.push({ path: abs, text })
|
|
253
335
|
}
|
|
@@ -284,7 +366,8 @@ function writePackage(appRoot: string, dir: string, budget: { bytes: number }):
|
|
|
284
366
|
const declared = typeof pj.source === 'string' ? posix.normalize(pj.source.replace(/^\.\//, '')) : null
|
|
285
367
|
const roots = files.filter((f) => !imported.has(f.path))
|
|
286
368
|
const entrySrc = files.find((f) => f.path === declared) ?? (roots.length === 1 ? roots[0] : undefined)
|
|
287
|
-
|
|
369
|
+
const barrel = entrySrc ? undefined : barrelOf(files, readFileSync(entry, 'utf8'))
|
|
370
|
+
if (!entrySrc && !barrel) return { ok: false, reason: `the source map has ${files.length} sources and none is the entry (no \`source\` field, ${roots.length} unimported)` }
|
|
288
371
|
// R34.62: the published file must be what these sources were built into.
|
|
289
372
|
let gaps: string[]
|
|
290
373
|
try {
|
|
@@ -300,7 +383,8 @@ function writePackage(appRoot: string, dir: string, budget: { bytes: number }):
|
|
|
300
383
|
const hash = createHash('sha256').update(relative(appRoot, dir).split(sep).join('/')).digest('hex').slice(0, 16)
|
|
301
384
|
const outRel = posix.join(PKG_SRC_DIR, `p-${hash}`)
|
|
302
385
|
const own = resolve(appRoot, PKG_SRC_DIR) + sep
|
|
303
|
-
const
|
|
386
|
+
const written = barrel ? [...files, barrel] : files
|
|
387
|
+
const targets = written.map((f) => ({ f, target: resolve(appRoot, outRel, f.path) }))
|
|
304
388
|
const escaped = targets.find((t) => !t.target.startsWith(own))
|
|
305
389
|
if (escaped) return { ok: false, reason: `the source ${escaped.f.path} would be written outside ${PKG_SRC_DIR}` }
|
|
306
390
|
for (const { f, target } of targets) {
|
|
@@ -311,7 +395,7 @@ function writePackage(appRoot: string, dir: string, budget: { bytes: number }):
|
|
|
311
395
|
writeFileSync(target, f.text)
|
|
312
396
|
}
|
|
313
397
|
budget.bytes += bytes
|
|
314
|
-
return { ok: true, dir: outRel, entry: posix.join(outRel, entrySrc
|
|
398
|
+
return { ok: true, dir: outRel, entry: posix.join(outRel, (entrySrc ?? barrel)!.path), imports: [...bare].sort() }
|
|
315
399
|
}
|
|
316
400
|
|
|
317
401
|
/**
|