@brust/core 2.0.0-alpha.6 → 2.0.0-alpha.7
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/bundle.ts +24 -3
- package/src/build/cloudflare.ts +2 -1
- package/src/build/compile.ts +2 -0
- package/src/build/manifest.ts +7 -3
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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7' && 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.7 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.7') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.7 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.7",
|
|
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.7"
|
|
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.7",
|
|
97
|
+
"@brust/native-darwin-arm64": "2.0.0-alpha.7",
|
|
98
|
+
"@brust/native-linux-x64-gnu": "2.0.0-alpha.7",
|
|
99
|
+
"@brust/native-linux-arm64-gnu": "2.0.0-alpha.7",
|
|
100
|
+
"@brust/native-linux-x64-musl": "2.0.0-alpha.7",
|
|
101
|
+
"@brust/native-linux-arm64-musl": "2.0.0-alpha.7",
|
|
102
|
+
"@brust/core-cf": "2.0.0-alpha.7"
|
|
103
103
|
}
|
|
104
104
|
}
|
package/src/build/bundle.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { createHash } from 'node:crypto'
|
|
10
10
|
import { existsSync, mkdirSync, realpathSync, statSync, writeFileSync } from 'node:fs'
|
|
11
11
|
import { builtinModules } from 'node:module'
|
|
12
|
-
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path'
|
|
12
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
|
|
13
13
|
import type { BunPlugin } from 'bun'
|
|
14
14
|
import type { Compiled } from './compile'
|
|
15
15
|
import { cssPlugin } from './css'
|
|
@@ -47,6 +47,19 @@ export interface BrowserCtx {
|
|
|
47
47
|
cssMaps?: Map<string, Record<string, string>>
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** `file` sits under `root`. */
|
|
51
|
+
const inside = (root: string, file: string): boolean => file === root || file.startsWith(root.endsWith(sep) ? root : root + sep)
|
|
52
|
+
|
|
53
|
+
/** The package a bare specifier names is installed in a `node_modules` above `from` (node's own lookup). */
|
|
54
|
+
function visibleFrom(spec: string, from: string): boolean {
|
|
55
|
+
const parts = spec.split('/')
|
|
56
|
+
const name = spec.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]!
|
|
57
|
+
for (let d = from; ; d = dirname(d)) {
|
|
58
|
+
if (existsSync(join(d, 'node_modules', name, 'package.json'))) return true
|
|
59
|
+
if (dirname(d) === d) return false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
50
63
|
/** Resolution for staged artifacts (`importer` = a staged file registered in `sourceOf`): relative
|
|
51
64
|
* imports mean the component's SOURCE directory; bare imports (`react`, `react-dom/client`, npm
|
|
52
65
|
* packages) resolve from `appRoot`, never from wherever `dist/` sits (an `--out-dir` outside the
|
|
@@ -62,6 +75,11 @@ export function sourceDirPlugin(sourceOf: SourceOf, appRoot: string, external: s
|
|
|
62
75
|
})
|
|
63
76
|
b.onResolve({ filter: /^[^./]/ }, (a) => {
|
|
64
77
|
if (!sourceOf.has(a.importer) || matchesExternal(a.path, external)) return undefined
|
|
78
|
+
// A package the staged file can see from where it sits resolves natively: the bundler then picks the package's ESM
|
|
79
|
+
// entry (`module` / `exports.import`) and tree-shakes it. `Bun.resolveSync` answers with the CJS `main`, which
|
|
80
|
+
// bundles the whole package (recharts: +85 KB gzip on the chart page). Packages only the app root sees (a staged
|
|
81
|
+
// file under `dist/`, an `--out-dir` outside the app) keep the pinned resolution, so one copy of each package.
|
|
82
|
+
if (inside(appRoot, a.importer) && visibleFrom(a.path, dirname(a.importer))) return undefined
|
|
65
83
|
return { path: Bun.resolveSync(a.path, appRoot) }
|
|
66
84
|
})
|
|
67
85
|
},
|
|
@@ -369,15 +387,18 @@ export const reviveSource = (reg: string): string =>
|
|
|
369
387
|
// The tree is compiler output, but props travel in page markup: read it as untrusted. A tag must be a plain element
|
|
370
388
|
// name, a component must be in this island's registry (own keys only), and the raw-HTML prop is never revived.
|
|
371
389
|
`const __props = (p: any): any => { const o: any = {}; if (p && typeof p === 'object') for (const k of Object.keys(p)) if (k !== '__proto__' && k !== 'dangerouslySetInnerHTML' && k !== 'children' && k !== 'ref' && k !== 'key') o[k] = p[k]; return o }\n` +
|
|
390
|
+
// `x` (on a component node) and `$x` (on the island's props) are the compiler's list of props that hold an element
|
|
391
|
+
// tree. Only those names are revived, and only when the prop is an own key of the copy; data is never revived.
|
|
392
|
+
`const __xs = (o: any, x: any): any => { if (Array.isArray(x)) for (const k of x) if (typeof k === 'string' && k.charAt(0) !== '$' && __own.call(o, k)) o[k] = __rv(o[k]); return o }\n` +
|
|
372
393
|
`const __rv = (n: any): any => {\n` +
|
|
373
394
|
` if (n === null || typeof n !== 'object') return n\n` +
|
|
374
395
|
` const kids = Array.isArray(n.c) ? n.c.map(__rv) : []\n` +
|
|
375
396
|
` if (n.$brust === 'fr') return createElement(Fragment, null, ...kids)\n` +
|
|
376
397
|
` if (n.$brust === 'el') { if (typeof n.t !== 'string' || !/^[a-zA-Z][a-zA-Z0-9-]*$/.test(n.t)) throw new Error('brust: island children hold an invalid element name'); return createElement(n.t, __props(n.p), ...kids) }\n` +
|
|
377
|
-
` if (n.$brust === 'cmp') { if (typeof n.id !== 'string' || !__own.call(__reg, n.id)) throw new Error('brust: island children name the component ' + String(n.id) + ', which this island does not import'); return createElement(__reg[n.id], __props(n.p), ...kids) }\n` +
|
|
398
|
+
` if (n.$brust === 'cmp') { if (typeof n.id !== 'string' || !__own.call(__reg, n.id)) throw new Error('brust: island children name the component ' + String(n.id) + ', which this island does not import'); return createElement(__reg[n.id], __xs(__props(n.p), n.x), ...kids) }\n` +
|
|
378
399
|
` throw new Error('brust: island children hold an unknown node')\n` +
|
|
379
400
|
`}\n` +
|
|
380
|
-
`const __mk = (C: any, props: any) => { const { children, ...rest } = props; return createElement(C, rest, ...(children === undefined ? [] : Array.isArray(children) ? children : [children]).map(__rv)) }\n`
|
|
401
|
+
`const __mk = (C: any, props: any) => { const { children, $x, ...rest } = props; __xs(rest, $x); return createElement(C, rest, ...(children === undefined ? [] : Array.isArray(children) ? children : [children]).map(__rv)) }\n`
|
|
381
402
|
|
|
382
403
|
/** A helper component its module does not export (`ir.unexported`: `function SheetOverlay() {…}` rendered by an exported
|
|
383
404
|
* `SheetContent`) that still renders as an island has nothing to import: the module is loaded with `export { Name }`
|
package/src/build/cloudflare.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { type CfConfigJson, cfEntrySource } from './cf-entry'
|
|
|
12
12
|
import { type CoreCf, resolveCoreCf } from './cf-core'
|
|
13
13
|
import { type CacheNeed, mergeWrangler, readUserWrangler, renderWrangler, type UserWrangler, verifyCacheBindings } from './cf-wrangler'
|
|
14
14
|
import { type CloudflareBuildConfig, CF_MIN_COMPAT_DATE } from './config'
|
|
15
|
+
import { MANIFEST_VERSION } from './manifest'
|
|
15
16
|
import { exposePlugin, PRODUCTION, type SourceOf, sourceDirPlugin } from './bundle'
|
|
16
17
|
import type { Compiled } from './compile'
|
|
17
18
|
import { cssPlugin } from './css'
|
|
@@ -196,7 +197,7 @@ plugin({
|
|
|
196
197
|
const m = await import(${JSON.stringify(app)})
|
|
197
198
|
const bad = []
|
|
198
199
|
for (const k of ['loader', 'jobs', 'action', 'install']) if (typeof m[k] !== 'function') bad.push(k + ' is not a function')
|
|
199
|
-
if (typeof m.MANIFEST !== 'string' || JSON.parse(m.MANIFEST).version !==
|
|
200
|
+
if (typeof m.MANIFEST !== 'string' || JSON.parse(m.MANIFEST).version !== ${MANIFEST_VERSION}) bad.push('MANIFEST.version !== ${MANIFEST_VERSION}')
|
|
200
201
|
if (typeof m.CONFIG !== 'string' || JSON.parse(m.CONFIG).abi !== 1) bad.push('CONFIG.abi !== 1')
|
|
201
202
|
if (typeof m.TEMPLATES !== 'object' || m.TEMPLATES === null) bad.push('TEMPLATES is not an object')
|
|
202
203
|
const r = await m.loader('{}')
|
package/src/build/compile.ts
CHANGED
|
@@ -25,6 +25,8 @@ export type ComponentIR = Record<string, any> & {
|
|
|
25
25
|
props: Record<string, string | null>
|
|
26
26
|
literals?: Record<string, unknown>
|
|
27
27
|
exprs?: Record<string, string>
|
|
28
|
+
/** F142 R34.43: the rows of a constant enclosing list (`loops` is then `[null]`). */
|
|
29
|
+
rows_literal?: unknown[]
|
|
28
30
|
}[]
|
|
29
31
|
use_id_slots: number
|
|
30
32
|
uses_outlet: boolean
|
package/src/build/manifest.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface ChildRecord {
|
|
|
34
34
|
literals?: Record<string, unknown>
|
|
35
35
|
/** F105: jinja over `__props` (and `__row`/`__idx` per row) the server evaluates. */
|
|
36
36
|
exprs?: Record<string, string>
|
|
37
|
+
/** F142 R34.43: the list of a `per-row-literal` instance (a constant the compiler read). */
|
|
38
|
+
rows?: unknown[]
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export interface ComponentRecord {
|
|
@@ -70,7 +72,7 @@ export interface ActionsRecord {
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
/** The manifest format the Rust loader accepts (`MANIFEST_VERSION` in brust-core `manifest.rs`): the one place TS names it. */
|
|
73
|
-
export const MANIFEST_VERSION =
|
|
75
|
+
export const MANIFEST_VERSION = 3 as const
|
|
74
76
|
|
|
75
77
|
export interface ManifestJson {
|
|
76
78
|
version: typeof MANIFEST_VERSION
|
|
@@ -243,7 +245,8 @@ export function childRecords(c: Compiled, clientOnly: string[] = []): ChildRecor
|
|
|
243
245
|
if (inst.loops.length > 1)
|
|
244
246
|
throw new BuildError('nested-instance', `${ir.id}: child ${inst.child_id} sits in nested lists (M3)`)
|
|
245
247
|
const list = inst.loops[0]
|
|
246
|
-
|
|
248
|
+
const literal = list === null && Array.isArray(inst.rows_literal)
|
|
249
|
+
if (list === null && !literal)
|
|
247
250
|
throw new BuildError('instance-list-path', `${ir.id}: child ${inst.child_id} sits in a list that is not a props path`)
|
|
248
251
|
const props: Record<string, string> = {}
|
|
249
252
|
for (const [name, path] of Object.entries(inst.props)) {
|
|
@@ -254,9 +257,10 @@ export function childRecords(c: Compiled, clientOnly: string[] = []): ChildRecor
|
|
|
254
257
|
)
|
|
255
258
|
props[name] = path
|
|
256
259
|
}
|
|
257
|
-
const rec: ChildRecord = { id: inst.child_id, instances: list === undefined ? 'static' : `per-row:${list}`, props }
|
|
260
|
+
const rec: ChildRecord = { id: inst.child_id, instances: literal ? 'per-row-literal' : list === undefined ? 'static' : `per-row:${list}`, props }
|
|
258
261
|
if (inst.literals && Object.keys(inst.literals).length > 0) rec.literals = { ...inst.literals }
|
|
259
262
|
if (inst.exprs && Object.keys(inst.exprs).length > 0) rec.exprs = { ...inst.exprs }
|
|
263
|
+
if (literal) rec.rows = inst.rows_literal
|
|
260
264
|
return rec
|
|
261
265
|
})
|
|
262
266
|
for (const id of clientOnly) out.push({ id, instances: 'static', props: {} })
|