@brust/core 2.0.0-alpha.24 → 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 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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24' && 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.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24') {
665
- throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.24 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
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.24",
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.24",
58
+ "@brust/runtime-dom": "2.0.0-alpha.26",
59
59
  "tsconfig-paths": "4.2.0"
60
60
  },
61
61
  "peerDependencies": {
@@ -76,6 +76,8 @@
76
76
  "@elysia/eden": "2.0.0-rc.0",
77
77
  "@napi-rs/cli": "^3.0.0",
78
78
  "@radix-ui/react-collection": "1.2.0",
79
+ "@radix-ui/react-id": "1.1.4",
80
+ "@radix-ui/react-use-layout-effect": "1.1.4",
79
81
  "@radix-ui/react-presence": "1.1.11",
80
82
  "@radix-ui/react-slot": "1.5.0",
81
83
  "@types/bun": "^1.4.0",
@@ -97,12 +99,12 @@
97
99
  "access": "public"
98
100
  },
99
101
  "optionalDependencies": {
100
- "@brust/native-darwin-x64": "2.0.0-alpha.24",
101
- "@brust/native-darwin-arm64": "2.0.0-alpha.24",
102
- "@brust/native-linux-x64-gnu": "2.0.0-alpha.24",
103
- "@brust/native-linux-arm64-gnu": "2.0.0-alpha.24",
104
- "@brust/native-linux-x64-musl": "2.0.0-alpha.24",
105
- "@brust/native-linux-arm64-musl": "2.0.0-alpha.24",
106
- "@brust/core-cf": "2.0.0-alpha.24"
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"
107
109
  }
108
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 {
@@ -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)
@@ -2,8 +2,8 @@
2
2
  // `compileTree` (analysis + lowering of its whole tree). `Err` = build error; fallback and
3
3
  // warning diagnostics are logged; `outlet-outside-layout` is raised here (contract 5).
4
4
  // A component several trees reach keeps one compile, chosen by role, not by route order (F75).
5
- import { realpathSync } from 'node:fs'
6
- import { relative, sep } from 'node:path'
5
+ import { readFileSync, realpathSync } from 'node:fs'
6
+ import { dirname, relative, sep } from 'node:path'
7
7
  import { type CompiledComponent, type CompiledTree, compileTree, scanLoadWrites } from '../../native/index.js'
8
8
  import type { FlatRoute, Route } from '../routes'
9
9
  import { BuildError } from './errors'
@@ -253,5 +253,152 @@ export function compileApp(opts: {
253
253
  `${route.Component!.name || rootId} renders <Outlet/> but route ${routeId} has no children`,
254
254
  )
255
255
  }
256
+ checkLayoutContexts(leaves, compiled, routeComponent)
256
257
  return { compiled, routeComponent }
257
258
  }
259
+
260
+ /** Script modules only (`.ts/.tsx/.js/.jsx/.mjs/.cjs/.mts/.cts`), judged on the RESOLVED file (a dotted basename like `./theme.context`
261
+ * resolves to theme.context.tsx; a stylesheet, JSON or asset resolves to itself): those never read a context. */
262
+ const SCRIPT = /\.[cm]?[jt]sx?$/
263
+
264
+ let importScanner: InstanceType<typeof Bun.Transpiler> | undefined
265
+ /** The module specifiers `file` imports or re-exports (`undefined`: unreadable or unparsable). */
266
+ function moduleSpecs(file: string): string[] | undefined {
267
+ try {
268
+ importScanner ??= new Bun.Transpiler({ loader: 'tsx' })
269
+ return importScanner.scanImports(readFileSync(file, 'utf8')).map((i) => i.path)
270
+ } catch {
271
+ return undefined
272
+ }
273
+ }
274
+
275
+ /**
276
+ * F437 (module-level rule): whether the island `file` imports ANY binding (a hook, the context, a helper) from a module that
277
+ * declares a context a layout above provides, directly or through re-exporting modules (followed transitively, each app file
278
+ * once). A relative specifier that cannot be resolved, or a barrel that cannot be read, is refused too.
279
+ */
280
+ function importsProvidedModule(
281
+ file: string,
282
+ provided: { file: string; layout: string; contexts: string[] }[],
283
+ ): { spec: string; via?: string; hit: { file: string; layout: string; contexts: string[] } } | undefined {
284
+ const real = (f: string) => {
285
+ try {
286
+ return realpathSync(f)
287
+ } catch {
288
+ return f
289
+ }
290
+ }
291
+ const resolve = (spec: string, from: string) => {
292
+ try {
293
+ return real(Bun.resolveSync(spec, dirname(from)))
294
+ } catch {
295
+ return undefined
296
+ }
297
+ }
298
+ const unfollowable = { file: '', layout: '(unresolved re-export)', contexts: ['?'] }
299
+ type Hit = { file: string; layout: string; contexts: string[] }
300
+ // The app modules `from` imports or re-exports, followed transitively (a barrel behind barrels) with a visited set.
301
+ const reach = (from: string, visited: Set<string>): { hit: Hit; via: string } | undefined => {
302
+ const specs = moduleSpecs(from)
303
+ if (specs === undefined) return { hit: unfollowable, via: from }
304
+ for (const spec of specs) {
305
+ const target = resolve(spec, from)
306
+ if (target === undefined) {
307
+ if (spec.startsWith('.')) return { hit: unfollowable, via: from }
308
+ continue
309
+ }
310
+ if (!SCRIPT.test(target)) continue
311
+ const hit = provided.find((p) => p.file === target)
312
+ if (hit) return { hit, via: from }
313
+ if (target.includes(`${sep}node_modules${sep}`) || visited.has(target)) continue
314
+ visited.add(target)
315
+ const deeper = reach(target, visited)
316
+ if (deeper) return deeper
317
+ }
318
+ return undefined
319
+ }
320
+ for (const spec of moduleSpecs(file) ?? []) {
321
+ const target = resolve(spec, file)
322
+ if (target === undefined) {
323
+ if (spec.startsWith('.')) return { spec, hit: unfollowable }
324
+ continue
325
+ }
326
+ if (!SCRIPT.test(target)) continue
327
+ const direct = provided.find((p) => p.file === target)
328
+ if (direct) return { spec, hit: direct }
329
+ if (target.includes(`${sep}node_modules${sep}`)) continue
330
+ const found = reach(target, new Set([file, target]))
331
+ if (found) return { spec, via: relative(dirname(file), target), hit: found.hit }
332
+ }
333
+ return undefined
334
+ }
335
+
336
+ /**
337
+ * F437: a component the compiler refused to lower because it reads a context imported from another module
338
+ * (`useContext(Ctx)`, `ir.foreign_ctx_reads`) ships as a React island, and an island's SSR and `hydrateRoot` render it
339
+ * alone, without the Providers a layout above its route renders: it would paint the `createContext` default where React
340
+ * paints the layout's value. Refused here, by name, conservatively: a Provider anywhere in the layout's compiled tree
341
+ * (`ir.provides` of the layout or of any component it renders) declared in a file counts as providing every context that
342
+ * file declares, so a read of ANY binding imported from that file is refused (an alias, `export { A as B }`, a re-export of
343
+ * the file's own context cannot slip by). A context nobody provides still reads its default, which is React's own answer.
344
+ * Native resolution of an imported context is F439.
345
+ */
346
+ function checkLayoutContexts(leaves: FlatRoute[], compiled: Map<string, Compiled>, routeComponent: Map<string, string>): void {
347
+ const real = (f: string) => {
348
+ try {
349
+ return realpathSync(f)
350
+ } catch {
351
+ return f
352
+ }
353
+ }
354
+ for (const leaf of leaves) {
355
+ const provided: { file: string; layout: string; contexts: string[] }[] = []
356
+ for (const id of leaf.chainIds) {
357
+ const rootId = routeComponent.get(id)
358
+ const root = rootId === undefined ? undefined : compiled.get(rootId)
359
+ if (!root) continue
360
+ // The tree of this route's component: the layouts above it provided `provided` so far.
361
+ if (provided.length > 0) {
362
+ const stack = [root.id]
363
+ const done = new Set<string>()
364
+ while (stack.length > 0) {
365
+ const c = compiled.get(stack.pop()!)
366
+ if (!c || done.has(c.id)) continue
367
+ done.add(c.id)
368
+ for (const [src, name] of (c.ir.foreign_ctx_reads ?? []) as [string, string][]) {
369
+ let from: string
370
+ try {
371
+ from = real(Bun.resolveSync(src, dirname(c.file)))
372
+ } catch {
373
+ continue
374
+ }
375
+ const hit = provided.find((p) => p.file === from)
376
+ if (hit)
377
+ throw new BuildError(
378
+ 'island-layout-context',
379
+ `${c.ir.source} reads the context \`${name}\` (useContext) that the layout ${hit.layout} provides, but this component renders as a React island, and an island does not see its layout's Provider (it would paint the createContext default). Workaround: pass the value to the page through its loader (a prop), or render the Provider inside this component's own tree. Native resolution of an imported context is F439.`,
380
+ )
381
+ }
382
+ const viaModule = c.ir.tier && typeof c.ir.tier === 'object' && 'React' in c.ir.tier ? importsProvidedModule(c.file, provided) : undefined
383
+ if (viaModule)
384
+ throw new BuildError(
385
+ 'island-layout-context',
386
+ `${c.ir.source} renders as a React island and imports ${viaModule.spec}${viaModule.via ? ` (through ${viaModule.via})` : ''}, a module that declares the context \`${viaModule.hit.contexts.join('`, `')}\` which the layout ${viaModule.hit.layout} provides: an island does not see its layout's Provider (it would paint the createContext default), and a hook or helper of that module may read it. Workaround: pass the value to the page through its loader (a prop), or render the Provider inside this component's own tree. Native resolution of an imported context is F439.`,
387
+ )
388
+ for (const ch of (c.ir.children ?? []) as { id: string | null }[]) if (ch.id) stack.push(ch.id)
389
+ }
390
+ }
391
+ // Every Provider the layout's compiled tree renders (the layout itself or a component it calls), by declaring file.
392
+ const stack = [root.id]
393
+ const done = new Set<string>()
394
+ while (stack.length > 0) {
395
+ const c = compiled.get(stack.pop()!)
396
+ if (!c || done.has(c.id)) continue
397
+ done.add(c.id)
398
+ if ((c.ir.provides ?? []).length > 0)
399
+ provided.push({ file: real(c.file), layout: root.ir.source, contexts: (c.ir.provides as { context: string }[]).map((p) => p.context.replace(/_m[0-9a-f]{8}$/, '')) })
400
+ for (const ch of (c.ir.children ?? []) as { id: string | null }[]) if (ch.id) stack.push(ch.id)
401
+ }
402
+ }
403
+ }
404
+ }
@@ -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')
@@ -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: { runtime: string; features: Record<string, string> }
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 {
@@ -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 its close), native `[x-data]`, island `brust-island`. */
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
- // A chain level: the nodes between `<!--brust:id-->` and its matching `<!--/brust-->`.
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 === `brust:${id}`) { open = n; depth = 1 } continue }
341
- if (v.startsWith('brust:')) depth++
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
+ }
@@ -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
+ }