@brust/core 2.0.0-alpha.25 → 2.0.0-alpha.26
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/browser.ts +2 -0
- package/src/build/bundle.ts +10 -5
- package/src/build/index.ts +4 -1
- package/src/build/manifest.ts +10 -3
- package/src/cf.ts +2 -0
- package/src/dev/devtools.ts +7 -6
- package/src/index.ts +2 -0
- package/src/navigate-browser.ts +13 -0
- package/src/navigate.ts +16 -0
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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26' && 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.26 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.26') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.26 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.26",
|
|
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.26",
|
|
59
59
|
"tsconfig-paths": "4.2.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
101
|
"optionalDependencies": {
|
|
102
|
-
"@brust/native-darwin-x64": "2.0.0-alpha.
|
|
103
|
-
"@brust/native-darwin-arm64": "2.0.0-alpha.
|
|
104
|
-
"@brust/native-linux-x64-gnu": "2.0.0-alpha.
|
|
105
|
-
"@brust/native-linux-arm64-gnu": "2.0.0-alpha.
|
|
106
|
-
"@brust/native-linux-x64-musl": "2.0.0-alpha.
|
|
107
|
-
"@brust/native-linux-arm64-musl": "2.0.0-alpha.
|
|
108
|
-
"@brust/core-cf": "2.0.0-alpha.
|
|
102
|
+
"@brust/native-darwin-x64": "2.0.0-alpha.26",
|
|
103
|
+
"@brust/native-darwin-arm64": "2.0.0-alpha.26",
|
|
104
|
+
"@brust/native-linux-x64-gnu": "2.0.0-alpha.26",
|
|
105
|
+
"@brust/native-linux-arm64-gnu": "2.0.0-alpha.26",
|
|
106
|
+
"@brust/native-linux-x64-musl": "2.0.0-alpha.26",
|
|
107
|
+
"@brust/native-linux-arm64-musl": "2.0.0-alpha.26",
|
|
108
|
+
"@brust/core-cf": "2.0.0-alpha.26"
|
|
109
109
|
}
|
|
110
110
|
}
|
package/src/browser.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// config, no napi addon — a react island may import `cache` from the package root.
|
|
6
6
|
import { cacheComponent } from './cache-core'
|
|
7
7
|
export { buildTime } from './build-time'
|
|
8
|
+
export { navigate } from './navigate-browser'
|
|
9
|
+
export type { NavErrorDetail, NavLoadDetail, NavigateOptions, NavSuccessDetail, NavTrigger } from './navigate'
|
|
8
10
|
import type { InvalidateArgs, InvalidateResult } from './native'
|
|
9
11
|
|
|
10
12
|
function invalidate(_args: InvalidateArgs): InvalidateResult {
|
package/src/build/bundle.ts
CHANGED
|
@@ -282,6 +282,8 @@ export interface RuntimeAssets {
|
|
|
282
282
|
store: string
|
|
283
283
|
/** Feature module name → file; every module is built, a route links the ones its components need. */
|
|
284
284
|
features: Record<string, string>
|
|
285
|
+
/** F453: the standalone SPA-navigation module (`nav-<hex>.js`); imports nothing from the core, so a page that loads no runtime still has it. */
|
|
286
|
+
nav: string
|
|
285
287
|
}
|
|
286
288
|
|
|
287
289
|
/** `dist/client/runtime-<hex>.js` (the core; client chunks import `signal`, `defineBehavior`, … from this URL), then
|
|
@@ -306,8 +308,11 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
|
|
|
306
308
|
write(file, `import ${JSON.stringify(join(dir, 'features', n))}\nexport * from ${JSON.stringify(join(dir, 'features', n))}\n`)
|
|
307
309
|
return file
|
|
308
310
|
})
|
|
311
|
+
// F453: `nav` is its own entry (it imports nothing from the core), named `nav-<hex>.js`.
|
|
312
|
+
const navEntry = join(dist, '.stage', 'nav.ts')
|
|
313
|
+
write(navEntry, `import ${JSON.stringify(join(dir, 'nav', 'index.ts'))}\n`)
|
|
309
314
|
const built = await browserBuild(dist, 'runtime features', ctx, {
|
|
310
|
-
entrypoints: entries,
|
|
315
|
+
entrypoints: [...entries, navEntry],
|
|
311
316
|
plugins: [
|
|
312
317
|
{
|
|
313
318
|
name: 'brust-runtime-core-external',
|
|
@@ -318,7 +323,7 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
|
|
|
318
323
|
})
|
|
319
324
|
const features: Record<string, string> = {}
|
|
320
325
|
for (const n of RUNTIME_FEATURES) features[n] = built.get(`rt-${n}`)!
|
|
321
|
-
return { core, store: built.get('rt-store')!, features }
|
|
326
|
+
return { core, store: built.get('rt-store')!, features, nav: built.get('nav')! }
|
|
322
327
|
}
|
|
323
328
|
|
|
324
329
|
/** One entry chunk per component with client JS (`<id>-<hex>.js`), split: a module two chunks
|
|
@@ -574,7 +579,7 @@ export function exposePlugin(compiled: Map<string, Compiled>): BunPlugin {
|
|
|
574
579
|
}
|
|
575
580
|
}
|
|
576
581
|
|
|
577
|
-
/** The island entry of a react-tier component: registers `(host, props) => …` under its id. A
|
|
582
|
+
/** The island entry of a react-tier component: registers `(host, props) => …` under its id; the hydrate fn returns the root's unmount, which the runtime calls when the host leaves the document (SPA navigation). A
|
|
578
583
|
* `client_only` component was never server-rendered (its host is empty), so it mounts with
|
|
579
584
|
* `createRoot`; hydrating it would fail (React #418). Everything else hydrates the SSR markup. */
|
|
580
585
|
/** `writers` (F230): app modules that write another module's exports when they load; imported first, so the island
|
|
@@ -584,8 +589,8 @@ export function islandShim(c: Compiled, compiled?: Map<string, Compiled>, routeR
|
|
|
584
589
|
const nested = compiled && nestedOf(compiled, c.id, routeRoots)
|
|
585
590
|
const element = nested ? `__mk(Comp, props, ${JSON.stringify(xOf(compiled!, c.id))}, ${JSON.stringify(holesOf(compiled!, c.id))})` : 'createElement(Comp, props)'
|
|
586
591
|
const [api, mount] = clientOnly
|
|
587
|
-
? ['createRoot', `createRoot(host, { identifierPrefix: ${JSON.stringify(c.id)} }).render(${element})`]
|
|
588
|
-
: ['hydrateRoot', `hydrateRoot(host, ${element}, { identifierPrefix: ${JSON.stringify(c.id)} })`]
|
|
592
|
+
? ['createRoot', `const root = createRoot(host, { identifierPrefix: ${JSON.stringify(c.id)} }); root.render(${element}); return () => root.unmount()`]
|
|
593
|
+
: ['hydrateRoot', `const root = hydrateRoot(host, ${element}, { identifierPrefix: ${JSON.stringify(c.id)} }); return () => root.unmount()`]
|
|
589
594
|
let head = ''
|
|
590
595
|
if (nested && compiled) {
|
|
591
596
|
const comps = nested.map((id) => compiled.get(id)).filter((n): n is Compiled => n !== undefined)
|
package/src/build/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// edited by hand. An out dir that could hold the app's own sources, or a non-empty one that is not
|
|
5
5
|
// a previous brust dist (no `manifest.json` / `.brust` marker; `--force` overrides), is refused
|
|
6
6
|
// before anything is written or removed.
|
|
7
|
+
import { createHash } from 'node:crypto'
|
|
7
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
8
9
|
import { homedir } from 'node:os'
|
|
9
10
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve } from 'node:path'
|
|
@@ -321,7 +322,7 @@ async function buildInto(
|
|
|
321
322
|
for (const c of compiled.values()) writeFileSync(join(out, 'jinja', `${c.id}.jinja`), c.jinja)
|
|
322
323
|
|
|
323
324
|
const chunks = new Map([...(await buildClientChunks(out, compiled, ctx, runtimeUrls)), ...(await buildReactChunks(out, compiled, ctx, runtimeUrls, routeRoots, writersFor))])
|
|
324
|
-
const manifest = writeManifest({ leaves, routeComponent, compiled, runtime: { core: runtime.core, features: { ...runtime.features, store: runtime.store } }, chunks })
|
|
325
|
+
const manifest = writeManifest({ leaves, routeComponent, compiled, runtime: { core: runtime.core, features: { ...runtime.features, store: runtime.store }, nav: runtime.nav }, chunks })
|
|
325
326
|
// L33: a component whose chunk imports the store module (directly or through a shared chunk) has the page preload it.
|
|
326
327
|
const readClient = (rel: string) => (existsSync(join(out, rel)) ? readFileSync(join(out, rel), 'utf8') : undefined)
|
|
327
328
|
for (const rec of Object.values(manifest.components)) if (rec.client && importsStore(readClient, rec.client, runtime.store)) rec.features.push('store')
|
|
@@ -337,6 +338,8 @@ async function buildInto(
|
|
|
337
338
|
if (o.actionsRemote !== null) manifest.actions_remote = { prefix: o.actionsRemote }
|
|
338
339
|
if (o.cache) manifest.cache = await cacheRecord(out, manifest, o.cache, o.cacheModule, css.maps)
|
|
339
340
|
manifest.needs_workers = needsWorkers(manifest)
|
|
341
|
+
// F453: the build id is a digest of the finished manifest (its content-hashed files and routes), so it is stable across identical builds.
|
|
342
|
+
manifest.assets.build = createHash('sha256').update(JSON.stringify(manifest)).digest('hex').slice(0, 16)
|
|
340
343
|
writeFileSync(join(out, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`)
|
|
341
344
|
if (o.dev) writeFileSync(join(out, 'dev.json'), `${JSON.stringify(devJson(appRoot, compiled), null, 2)}\n`)
|
|
342
345
|
writeFileSync(join(out, MARKER), 'generated by `brust build`: this directory is replaced on every build\n')
|
package/src/build/manifest.ts
CHANGED
|
@@ -79,7 +79,14 @@ export interface ManifestJson {
|
|
|
79
79
|
routes: RouteRecord[]
|
|
80
80
|
components: Record<string, ComponentRecord>
|
|
81
81
|
/** `runtime` is the core; `features` maps each feature module name to its file (L33). */
|
|
82
|
-
assets: {
|
|
82
|
+
assets: {
|
|
83
|
+
runtime: string
|
|
84
|
+
features: Record<string, string>
|
|
85
|
+
/** F453: the SPA-navigation module `client/nav-<hex>.js`; the `nav` tag is emitted only when it is set. */
|
|
86
|
+
nav?: string
|
|
87
|
+
/** F453: the build id (`data-brust-build`): a digest of the rest of the manifest, set last by `brust build`. */
|
|
88
|
+
build?: string
|
|
89
|
+
}
|
|
83
90
|
jobs_module: string
|
|
84
91
|
actions: ActionsRecord | null
|
|
85
92
|
/** L16 R16.3: an actions-only build (no routes, no templates); everything but the prefix is a 404 problem+json. */
|
|
@@ -316,7 +323,7 @@ export function writeManifest(opts: {
|
|
|
316
323
|
routeComponent: Map<string, string>
|
|
317
324
|
compiled: Map<string, Compiled>
|
|
318
325
|
/** The runtime files `buildRuntime` wrote: the core and the feature modules. */
|
|
319
|
-
runtime: { core: string; features: Record<string, string
|
|
326
|
+
runtime: { core: string; features: Record<string, string>; nav?: string }
|
|
320
327
|
/** component id → `client/<file>` (client chunk or react island chunk). */
|
|
321
328
|
chunks: Map<string, string>
|
|
322
329
|
actions?: ActionsRecord | null
|
|
@@ -360,7 +367,7 @@ export function writeManifest(opts: {
|
|
|
360
367
|
}
|
|
361
368
|
})
|
|
362
369
|
linkNativeChunks(routes, compiled, components)
|
|
363
|
-
return { version: MANIFEST_VERSION, routes, components, assets: { runtime: opts.runtime.core, features: opts.runtime.features }, jobs_module: 'jobs.js', actions: opts.actions ?? null }
|
|
370
|
+
return { version: MANIFEST_VERSION, routes, components, assets: { runtime: opts.runtime.core, features: opts.runtime.features, ...(opts.runtime.nav === undefined ? {} : { nav: opts.runtime.nav }) }, jobs_module: 'jobs.js', actions: opts.actions ?? null }
|
|
364
371
|
}
|
|
365
372
|
|
|
366
373
|
/** S6 amendment (F66): the server's asset injection walks only each chain component's direct
|
package/src/cf.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Same names as `index.ts` minus what needs a host process: no `run`, no `loadConfig`. `cache.invalidate` goes through
|
|
3
3
|
// the CF bundle's napi stub to the runtime the wasm glue installed at start (`server-handlers` `install`).
|
|
4
4
|
export { buildTime } from './build-time'
|
|
5
|
+
export { navigate } from './navigate'
|
|
6
|
+
export type { NavErrorDetail, NavLoadDetail, NavigateOptions, NavSuccessDetail, NavTrigger } from './navigate'
|
|
5
7
|
export { cache } from './cache'
|
|
6
8
|
export type { ComponentCacheOptions, InvalidateArgs, InvalidateResult } from './cache'
|
|
7
9
|
export {
|
package/src/dev/devtools.ts
CHANGED
|
@@ -239,7 +239,7 @@ class BrustDevtools extends HTMLElement {
|
|
|
239
239
|
return out
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
/** Highlight a component on the page: chain marker (Range between `<!--brust:id-->` and
|
|
242
|
+
/** Highlight a component on the page: chain marker (Range between `<!--brust-l:id:hash-->` and `<!--/brust-l:id-->`, the root is the whole document), native `[x-data]`, island `brust-island`. */
|
|
243
243
|
private highlight(id: string): void {
|
|
244
244
|
const rects = componentRects(id)
|
|
245
245
|
if (rects.length === 0) { this.hl.hidden = true; return }
|
|
@@ -331,15 +331,16 @@ export function componentRects(id: string): DOMRect[] {
|
|
|
331
331
|
// the island host is display:contents (no box of its own): its painted children carry the rects
|
|
332
332
|
for (const e of document.querySelectorAll('brust-island')) if (e.getAttribute('data-id') === id) rects.push(...[...e.children].map((c) => c.getBoundingClientRect()))
|
|
333
333
|
if (rects.length) return rects
|
|
334
|
-
//
|
|
334
|
+
// The root level carries no comment pair: its mark is on the nav tag, and it spans the document.
|
|
335
|
+
const root = document.querySelector('script[data-brust-nav]')?.getAttribute('data-brust-root')
|
|
336
|
+
if (root !== null && root !== undefined && root.slice(0, root.lastIndexOf(':')) === id) return [document.documentElement.getBoundingClientRect()]
|
|
337
|
+
// An inner chain level: the nodes between `<!--brust-l:id:hash-->` and its `<!--/brust-l:id-->` (F453 markers).
|
|
335
338
|
const w = document.createTreeWalker(document, NodeFilter.SHOW_COMMENT)
|
|
336
339
|
let open: Comment | null = null
|
|
337
|
-
let depth = 0
|
|
338
340
|
for (let n = w.nextNode() as Comment | null; n; n = w.nextNode() as Comment | null) {
|
|
339
341
|
const v = n.nodeValue ?? ''
|
|
340
|
-
if (!open) { if (v ===
|
|
341
|
-
if (v
|
|
342
|
-
else if (v === '/brust' && --depth === 0) {
|
|
342
|
+
if (!open) { if (v.startsWith('brust-l:') && v.slice(8, v.lastIndexOf(':')) === id) open = n; continue }
|
|
343
|
+
if (v === `/brust-l:${id}`) {
|
|
343
344
|
const r = document.createRange()
|
|
344
345
|
r.setStartAfter(open); r.setEndBefore(n)
|
|
345
346
|
const box = r.getBoundingClientRect()
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
/// <reference path="./assets.d.ts" />
|
|
3
3
|
// `@brust/core`: the app-facing API.
|
|
4
4
|
export { buildTime } from './build-time'
|
|
5
|
+
export { navigate } from './navigate'
|
|
6
|
+
export type { NavErrorDetail, NavLoadDetail, NavigateOptions, NavSuccessDetail, NavTrigger } from './navigate'
|
|
5
7
|
export { cache } from './cache'
|
|
6
8
|
export { type BrustConfig, BrustConfigError, loadConfig } from './config'
|
|
7
9
|
export { type RunOptions, run } from './run'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// `navigate()` in the browser: runs the SPA flow through the `nav` module (`Symbol.for('brust.nav')`, the same
|
|
2
|
+
// cross-chunk pattern as `brust.stores`) and resolves after `success` or `error`. Without `nav` it is a full load.
|
|
3
|
+
import type { NavigateOptions } from './navigate'
|
|
4
|
+
|
|
5
|
+
type Bridge = { navigate(url: string, opts?: NavigateOptions): Promise<void> }
|
|
6
|
+
|
|
7
|
+
export function navigate(url: string, opts?: NavigateOptions): Promise<void> {
|
|
8
|
+
const bridge = (globalThis as { [k: symbol]: Bridge | undefined })[Symbol.for('brust.nav')]
|
|
9
|
+
if (bridge) return bridge.navigate(url, opts)
|
|
10
|
+
if (opts?.replace) location.replace(url)
|
|
11
|
+
else location.assign(url)
|
|
12
|
+
return Promise.resolve()
|
|
13
|
+
}
|
package/src/navigate.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// `navigate()` (SPA navigation, design §5.3): the types shared by the browser and server entries, and the server stub.
|
|
2
|
+
export interface NavigateOptions {
|
|
3
|
+
/** Replace the current history entry instead of pushing a new one. */
|
|
4
|
+
replace?: boolean
|
|
5
|
+
}
|
|
6
|
+
export type NavTrigger = 'link' | 'navigate' | 'popstate'
|
|
7
|
+
/** `detail` of `brust:nav:load`. */
|
|
8
|
+
export interface NavLoadDetail { id: number; url: string; from: string; trigger: NavTrigger }
|
|
9
|
+
/** `detail` of `brust:nav:success`. */
|
|
10
|
+
export interface NavSuccessDetail extends NavLoadDetail { status: number }
|
|
11
|
+
/** `detail` of `brust:nav:error`: `swapped` tells whether a page (a 404, an error page) was swapped in anyway. */
|
|
12
|
+
export interface NavErrorDetail extends NavLoadDetail { status?: number; error?: unknown; swapped: boolean }
|
|
13
|
+
|
|
14
|
+
export function navigate(_url: string, _opts?: NavigateOptions): Promise<void> {
|
|
15
|
+
throw new Error('navigate is browser-only (call it from a component or island running in the browser)')
|
|
16
|
+
}
|