@brust/core 2.0.0-alpha.25 → 2.0.0-alpha.27

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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25' && 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.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '2.0.0-alpha.27' && 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.27 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.25') {
665
- throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.25 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '2.0.0-alpha.27') {
665
+ throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.27 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.25",
3
+ "version": "2.0.0-alpha.27",
4
4
  "description": "brust v2 — React components compiled to Rust-rendered templates",
5
5
  "license": "MIT",
6
6
  "homepage": "https://brust.dev",
@@ -31,6 +31,7 @@
31
31
  "./cache-adapter/conformance": "./src/cache-adapter/conformance.ts",
32
32
  "./store": "./src/store/index.ts",
33
33
  "./store/react": "./src/store/react.ts",
34
+ "./navigation": "./src/navigation.ts",
34
35
  "./elysia": "./src/actions/elysia.ts",
35
36
  "./client": "./src/actions/client.ts",
36
37
  "./native": "./native/index.js"
@@ -55,7 +56,7 @@
55
56
  ]
56
57
  },
57
58
  "dependencies": {
58
- "@brust/runtime-dom": "2.0.0-alpha.25",
59
+ "@brust/runtime-dom": "2.0.0-alpha.27",
59
60
  "tsconfig-paths": "4.2.0"
60
61
  },
61
62
  "peerDependencies": {
@@ -99,12 +100,12 @@
99
100
  "access": "public"
100
101
  },
101
102
  "optionalDependencies": {
102
- "@brust/native-darwin-x64": "2.0.0-alpha.25",
103
- "@brust/native-darwin-arm64": "2.0.0-alpha.25",
104
- "@brust/native-linux-x64-gnu": "2.0.0-alpha.25",
105
- "@brust/native-linux-arm64-gnu": "2.0.0-alpha.25",
106
- "@brust/native-linux-x64-musl": "2.0.0-alpha.25",
107
- "@brust/native-linux-arm64-musl": "2.0.0-alpha.25",
108
- "@brust/core-cf": "2.0.0-alpha.25"
103
+ "@brust/native-darwin-x64": "2.0.0-alpha.27",
104
+ "@brust/native-darwin-arm64": "2.0.0-alpha.27",
105
+ "@brust/native-linux-x64-gnu": "2.0.0-alpha.27",
106
+ "@brust/native-linux-arm64-gnu": "2.0.0-alpha.27",
107
+ "@brust/native-linux-x64-musl": "2.0.0-alpha.27",
108
+ "@brust/native-linux-arm64-musl": "2.0.0-alpha.27",
109
+ "@brust/core-cf": "2.0.0-alpha.27"
109
110
  }
110
111
  }
@@ -2,6 +2,7 @@
2
2
  // elysia is type-only here. Differences from 0.1.x runtime/treaty.ts: docs/actions.md "The client".
3
3
  import { type Treaty, treaty } from '@elysia/eden/treaty2'
4
4
  import type { AnyElysia } from 'elysia'
5
+ import { clearNavigationCache } from '../navigate-browser'
5
6
  import { type ActionCredentials, DEFAULT_ACTION_PREFIX } from './prefix'
6
7
 
7
8
  export { DEFAULT_ACTION_PREFIX }
@@ -62,10 +63,16 @@ export function client<const App extends AnyElysia, Head extends Record<string,
62
63
  // The root prefix (an actions-only deployment) adds nothing to the base: `https://api.example.com/team`, not `//team`.
63
64
  const base = resolveBaseUrl(opts)
64
65
  const prefix = resolvePrefix(opts)
66
+ // SPA navigation design §10.1: a mutation clears the page cache, so no page read after it is served from before it
67
+ const send = (async (url: RequestInfo | URL, req?: RequestInit) => {
68
+ const res = await (fetcher ?? fetch)(url, req)
69
+ if (!/^(GET|HEAD)$/i.test(req?.method ?? 'GET')) clearNavigationCache()
70
+ return res
71
+ }) as typeof fetch
65
72
  return treaty<App, Head>(base !== '' && prefix === '/' ? base : base + prefix, {
66
73
  ...rest,
67
74
  keepDomain: true,
68
- ...(fetcher ? { fetcher } : {}),
75
+ fetcher: send,
69
76
  ...(init || defaults ? { fetch: typeof init === 'function' ? init : { ...defaults, ...init } } : {}),
70
77
  })
71
78
  }
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 { clearNavigationCache, 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 {
@@ -18,6 +18,7 @@ import { isServerOnlyMarker, serverOnlyEmptyPlugin } from './server-only'
18
18
  import { RUNTIME_FEATURES } from './features'
19
19
  import { RELATIVE_SPEC, type ResolveTarget, resolveNative } from './esm-resolve'
20
20
  import { packageDirOf } from './pkg-src'
21
+ import { BUILTIN_STORE_MODULES } from '../store/builtin'
21
22
 
22
23
  const REACT_EXTERNALS = ['react', 'react/*', 'react-dom', 'react-dom/*']
23
24
  /** Production React (and the production JSX transform: `react/jsx-runtime`, never `jsxDEV`). `brust dev` builds set
@@ -282,6 +283,8 @@ export interface RuntimeAssets {
282
283
  store: string
283
284
  /** Feature module name → file; every module is built, a route links the ones its components need. */
284
285
  features: Record<string, string>
286
+ /** F453: the standalone SPA-navigation module (`nav-<hex>.js`); imports nothing from the core, so a page that loads no runtime still has it. */
287
+ nav: string
285
288
  }
286
289
 
287
290
  /** `dist/client/runtime-<hex>.js` (the core; client chunks import `signal`, `defineBehavior`, … from this URL), then
@@ -306,8 +309,11 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
306
309
  write(file, `import ${JSON.stringify(join(dir, 'features', n))}\nexport * from ${JSON.stringify(join(dir, 'features', n))}\n`)
307
310
  return file
308
311
  })
312
+ // F453: `nav` is its own entry (it imports nothing from the core), named `nav-<hex>.js`.
313
+ const navEntry = join(dist, '.stage', 'nav.ts')
314
+ write(navEntry, `import ${JSON.stringify(join(dir, 'nav', 'index.ts'))}\n`)
309
315
  const built = await browserBuild(dist, 'runtime features', ctx, {
310
- entrypoints: entries,
316
+ entrypoints: [...entries, navEntry],
311
317
  plugins: [
312
318
  {
313
319
  name: 'brust-runtime-core-external',
@@ -318,7 +324,7 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
318
324
  })
319
325
  const features: Record<string, string> = {}
320
326
  for (const n of RUNTIME_FEATURES) features[n] = built.get(`rt-${n}`)!
321
- return { core, store: built.get('rt-store')!, features }
327
+ return { core, store: built.get('rt-store')!, features, nav: built.get('nav')! }
322
328
  }
323
329
 
324
330
  /** One entry chunk per component with client JS (`<id>-<hex>.js`), split: a module two chunks
@@ -574,7 +580,7 @@ export function exposePlugin(compiled: Map<string, Compiled>): BunPlugin {
574
580
  }
575
581
  }
576
582
 
577
- /** The island entry of a react-tier component: registers `(host, props) => …` under its id. A
583
+ /** 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
584
  * `client_only` component was never server-rendered (its host is empty), so it mounts with
579
585
  * `createRoot`; hydrating it would fail (React #418). Everything else hydrates the SSR markup. */
580
586
  /** `writers` (F230): app modules that write another module's exports when they load; imported first, so the island
@@ -584,8 +590,8 @@ export function islandShim(c: Compiled, compiled?: Map<string, Compiled>, routeR
584
590
  const nested = compiled && nestedOf(compiled, c.id, routeRoots)
585
591
  const element = nested ? `__mk(Comp, props, ${JSON.stringify(xOf(compiled!, c.id))}, ${JSON.stringify(holesOf(compiled!, c.id))})` : 'createElement(Comp, props)'
586
592
  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)} })`]
593
+ ? ['createRoot', `const root = createRoot(host, { identifierPrefix: ${JSON.stringify(c.id)} }); root.render(${element}); return () => root.unmount()`]
594
+ : ['hydrateRoot', `const root = hydrateRoot(host, ${element}, { identifierPrefix: ${JSON.stringify(c.id)} }); return () => root.unmount()`]
589
595
  let head = ''
590
596
  if (nested && compiled) {
591
597
  const comps = nested.map((id) => compiled.get(id)).filter((n): n is Compiled => n !== undefined)
@@ -736,6 +742,10 @@ export async function buildJobs(
736
742
  const entries: string[] = []
737
743
  const storePaths = [...new Set(stores)].sort()
738
744
  for (const [i, p] of storePaths.entries()) {
745
+ if (BUILTIN_STORE_MODULES.includes(p)) {
746
+ imports.push(`import * as S${i} from ${JSON.stringify(p)}`) // a package module, external in jobs.js
747
+ continue
748
+ }
739
749
  if (isAbsolute(p) || p.split('/').includes('..') || !isFile(resolve(appRoot, p))) {
740
750
  throw new BuildError('store-module', `store module ${p} is not a file inside the app (${appRoot})`)
741
751
  }
@@ -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. */
@@ -95,10 +102,24 @@ export interface ManifestJson {
95
102
 
96
103
  /** F165 (R40.1): whether any request can call a worker. Workers answer four kinds of call
97
104
  * (worker.ts): `loader`, `jobs` (precompute and SSR), `fetch` (the local actions app) and `cache`
98
- * (the adapter). Only the jobs a request can plan count (`reachedJobs`, F183). */
105
+ * (the adapter). Only the jobs a request can plan count (`reachedJobs`, F183); a store read counts too (`readsStores`). */
99
106
  export function needsWorkers(m: Pick<ManifestJson, 'routes' | 'components' | 'actions' | 'cache'>): boolean {
100
107
  const planned = [...reachedJobs(m).planned].some((id) => (m.components[id]?.jobs.length ?? 0) > 0)
101
- return planned || m.routes.some((r) => r.loaders.length > 0) || m.actions !== null || m.cache !== undefined
108
+ return planned || m.routes.some((r) => r.loaders.length > 0) || readsStores(m) || m.actions !== null || m.cache !== undefined
109
+ }
110
+
111
+ /** A route whose chain reads a store (its components, their children and job targets, transitively) gets a loader call
112
+ * from brust-core even with no loader of its own: the worker builds the `__store` snapshot (pipeline.rs `reads_store`).
113
+ * Without a pool that call answers 503. */
114
+ function readsStores(m: Pick<ManifestJson, 'routes' | 'components'>): boolean {
115
+ const seen = new Set<string>()
116
+ const reads = (id: string): boolean => {
117
+ if (seen.has(id)) return false
118
+ seen.add(id)
119
+ const c = m.components[id]
120
+ return !!c && (c.stores.length > 0 || c.children.some((k) => reads(k.id)) || c.jobs.some((j) => j.target !== undefined && reads(j.target)))
121
+ }
122
+ return m.routes.some((r) => r.chain.some(reads))
102
123
  }
103
124
 
104
125
  /** F183: the jobs a request can call, as brust-core plans them (`collect_jobs`, pipeline.rs): every job of each
@@ -316,7 +337,7 @@ export function writeManifest(opts: {
316
337
  routeComponent: Map<string, string>
317
338
  compiled: Map<string, Compiled>
318
339
  /** The runtime files `buildRuntime` wrote: the core and the feature modules. */
319
- runtime: { core: string; features: Record<string, string> }
340
+ runtime: { core: string; features: Record<string, string>; nav?: string }
320
341
  /** component id → `client/<file>` (client chunk or react island chunk). */
321
342
  chunks: Map<string, string>
322
343
  actions?: ActionsRecord | null
@@ -360,7 +381,7 @@ export function writeManifest(opts: {
360
381
  }
361
382
  })
362
383
  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 }
384
+ 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
385
  }
365
386
 
366
387
  /** S6 amendment (F66): the server's asset injection walks only each chain component's direct
@@ -1,4 +1,4 @@
1
- // The cache adapter contract (docs/design/2026-10-12-cache-adapter-design.md §3.1): a shared second
1
+ // The cache adapter contract (cache adapter design §3.1): a shared second
2
2
  // tier behind brust's in-process cache. An adapter has two optional capabilities — a `store` of
3
3
  // rendered pages and a `broadcast` of invalidations (push `subscribe` or pull `since`) — so a store
4
4
  // without a channel (KV) can be composed with another adapter's broadcast (DO).
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/handlers.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  // `worker.ts` re-exports everything here, so existing importers are unchanged.
4
4
  import { installServerResolver, type StoreSnapshot } from './store/core-adapter'
5
5
  import { collectSnapshot, getServerInstance, runInStoreContext, touchStores } from './store/server-context'
6
+ import { NAVIGATION_MODULE } from './store/builtin'
6
7
  import { type FlatRoute, isHttpErrorTrigger, isVerdict, type LoaderReq, type Route, type Verdict } from './routes'
7
8
 
8
9
  installServerResolver(getServerInstance)
@@ -236,7 +237,11 @@ export function makeHandlers(opts: {
236
237
  const merged: Record<string, unknown> = Object.create(null)
237
238
  try {
238
239
  const touch = storeIdx.get(req.routeId)
239
- if (touch) touchStores(touch, storeTable)
240
+ if (touch) {
241
+ touchStores(touch, storeTable)
242
+ // The built-in `navigation` store (design §11) paints the request's path + search on first paint.
243
+ if (touch.includes(NAVIGATION_MODULE)) (storeTable[NAVIGATION_MODULE] as { navigation?: { hydrate(s: object): void } } | undefined)?.navigation?.hydrate({ url: req.req.url })
244
+ }
240
245
  for (const node of leaf.chain) {
241
246
  if (!node.loader) continue
242
247
  let r: unknown
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 { clearNavigationCache, 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,19 @@
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>; clearCache(): void }
6
+ const bridge = () => (globalThis as { [k: symbol]: Bridge | undefined })[Symbol.for('brust.nav')]
7
+
8
+ export function navigate(url: string, opts?: NavigateOptions): Promise<void> {
9
+ const b = bridge()
10
+ if (b) return b.navigate(url, opts)
11
+ if (opts?.replace) location.replace(url)
12
+ else location.assign(url)
13
+ return Promise.resolve()
14
+ }
15
+
16
+ /** Drop every page the SPA navigation cache holds (design §10.1), e.g. after a mutation made outside `client()`. */
17
+ export function clearNavigationCache(): void {
18
+ bridge()?.clearCache()
19
+ }
@@ -0,0 +1,19 @@
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
+ }
17
+
18
+ /** The page cache lives in the browser: nothing to clear on the server. */
19
+ export function clearNavigationCache(): void {}
@@ -0,0 +1,91 @@
1
+ // The built-in `navigation` store (SPA navigation design §11): the `brust:nav:*` events as
2
+ // signals, so a component reads navigation state through `useStore(navigation)` like any other store. Browser-safe and
3
+ // React-free, like `@brust/core/store`. The name is reserved (the compiler refuses a user `defineStore('navigation')`).
4
+ //
5
+ // Server: the factory paints `idle` and the loader seeds `url` with the request's path + search (handlers.ts), so the first
6
+ // paint is right and hydration matches. Browser: this module listens to the four events once and `batch`-sets the signals.
7
+ import { batch, defineStore, signal } from '@brust/runtime-dom/store'
8
+
9
+ export type NavigationTrigger = 'link' | 'navigate' | 'popstate'
10
+
11
+ const at = (): string => (typeof location === 'undefined' ? '/' : location.pathname + location.search)
12
+
13
+ /** `new URL(href).pathname + search`, the way the store spells a page; `href` itself when it does not parse. */
14
+ const path = (href: unknown): string => {
15
+ try {
16
+ const u = new URL(String(href), typeof location === 'undefined' ? 'http://x' : location.href)
17
+ return u.pathname + u.search
18
+ } catch {
19
+ return String(href)
20
+ }
21
+ }
22
+
23
+ declare const __BRUST_DEV__: boolean | undefined
24
+
25
+ // Instances this module's factory made: a record under the name that is not one belongs to someone else's defineStore.
26
+ const made = new WeakSet<object>()
27
+
28
+ export const navigation = defineStore('navigation', () => {
29
+ const store = {
30
+ /** `'loading'` from `brust:nav:load` until `success` / `error`. */
31
+ state: signal<'idle' | 'loading'>('idle'),
32
+ /** Path + search of the page on screen: updated at `success`, and at `error` when the page was swapped in. */
33
+ url: signal<string>(at()),
34
+ /** Path + search being loaded, else `null`. */
35
+ to: signal<string | null>(null),
36
+ /** Of the current or last navigation. */
37
+ trigger: signal<NavigationTrigger | null>(null),
38
+ /** HTTP status of the last navigation. */
39
+ status: signal<number | null>(null),
40
+ /** Message of the last failed navigation; cleared at the next `load`. */
41
+ error: signal<string | null>(null),
42
+ /** The last navigation id (0 before any). */
43
+ id: signal<number>(0),
44
+ }
45
+ made.add(store)
46
+ return store
47
+ })
48
+
49
+ // One subscription per tab, whichever chunk evaluates this module first (the store registry is shared the same way).
50
+ const BOUND = Symbol.for('brust.navigation')
51
+ if (typeof document !== 'undefined' && !(globalThis as { [BOUND]?: true })[BOUND]) {
52
+ ;(globalThis as { [BOUND]?: true })[BOUND] = true
53
+ // A user `defineStore('navigation', …)` outside a component is not seen by the compiler (`store-name-reserved`); it
54
+ // would share this record by name, so say so in dev.
55
+ if (typeof __BRUST_DEV__ !== 'undefined' && __BRUST_DEV__ && !made.has(navigation()))
56
+ console.warn("[brust] the store name 'navigation' is reserved for @brust/core/navigation, but another defineStore('navigation') made the record in use; rename yours")
57
+ const on = (name: string, apply: (d: Record<string, unknown>) => void) =>
58
+ document.addEventListener(`brust:nav:${name}`, (e) => apply((e as CustomEvent).detail ?? {}))
59
+ on('load', (d) =>
60
+ batch(() => {
61
+ navigation.state.set('loading')
62
+ navigation.to.set(path(d.url))
63
+ navigation.trigger.set(d.trigger as NavigationTrigger)
64
+ navigation.error.set(null)
65
+ navigation.id.set(d.id as number)
66
+ }),
67
+ )
68
+ on('success', (d) =>
69
+ batch(() => {
70
+ navigation.state.set('idle')
71
+ navigation.url.set(path(d.url))
72
+ navigation.to.set(null)
73
+ navigation.trigger.set(d.trigger as NavigationTrigger)
74
+ navigation.status.set(d.status as number)
75
+ navigation.error.set(null)
76
+ navigation.id.set(d.id as number)
77
+ }),
78
+ )
79
+ on('error', (d) =>
80
+ batch(() => {
81
+ navigation.state.set('idle')
82
+ // A swapped error page (404, 500) is on screen; a failed swap leaves the old page where it was.
83
+ if (d.swapped) navigation.url.set(path(d.url))
84
+ navigation.to.set(null)
85
+ navigation.trigger.set(d.trigger as NavigationTrigger)
86
+ navigation.status.set((d.status as number | undefined) || null) // 0: no response
87
+ navigation.error.set(d.error instanceof Error ? d.error.message : d.error != null ? String(d.error) : `HTTP ${d.status}`)
88
+ navigation.id.set(d.id as number)
89
+ }),
90
+ )
91
+ }
@@ -16,7 +16,7 @@ export const SHADCN_VERSION = '4.21.4'
16
16
 
17
17
  /**
18
18
  * The packages the components import (R41.5), each pinned to the exact version the transcript ran
19
- * (`docs/transcripts/shadcn-init-guide.md`, F181). They move together with `SHADCN_VERSION`: a release that moves one
19
+ * (`website/test/fixtures/shadcn-transcripts/shadcn-init-guide.md`, F181). They move together with `SHADCN_VERSION`: a release that moves one
20
20
  * re-runs the transcript. A package the project already depends on, at any version, is left alone.
21
21
  */
22
22
  export const SHADCN_DEP_PINS = {
@@ -0,0 +1,4 @@
1
+ // Store modules brust ships. The compiler names them by package specifier (`StoreRef.module`) instead of an app-relative
2
+ // path, so the manifest's `stores`, the `jobs.js` stores table and the loader's `touchStores` all use this spelling.
3
+ export const NAVIGATION_MODULE = '@brust/core/navigation'
4
+ export const BUILTIN_STORE_MODULES: readonly string[] = [NAVIGATION_MODULE]