brustjs 0.1.42-alpha → 0.1.44-alpha
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/package.json +7 -7
- package/runtime/index.js +52 -52
- package/runtime/md/render.ts +3 -8
- package/runtime/md/routes.ts +16 -1
- package/runtime/md/slug.ts +16 -0
- package/runtime/navigation/active-nav.ts +16 -3
- package/runtime/navigation/store.ts +20 -4
- package/runtime/routes.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brustjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44-alpha",
|
|
4
4
|
"description": "Bun + Rust SSR framework — React on the server, Rust everywhere else (napi cdylib + per-worker SharedArrayBuffer).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"typescript": "^6.0.3"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
|
-
"brustjs-darwin-x64": "0.1.
|
|
45
|
-
"brustjs-darwin-arm64": "0.1.
|
|
46
|
-
"brustjs-linux-x64-gnu": "0.1.
|
|
47
|
-
"brustjs-linux-arm64-gnu": "0.1.
|
|
48
|
-
"brustjs-linux-x64-musl": "0.1.
|
|
49
|
-
"brustjs-linux-arm64-musl": "0.1.
|
|
44
|
+
"brustjs-darwin-x64": "0.1.44-alpha",
|
|
45
|
+
"brustjs-darwin-arm64": "0.1.44-alpha",
|
|
46
|
+
"brustjs-linux-x64-gnu": "0.1.44-alpha",
|
|
47
|
+
"brustjs-linux-arm64-gnu": "0.1.44-alpha",
|
|
48
|
+
"brustjs-linux-x64-musl": "0.1.44-alpha",
|
|
49
|
+
"brustjs-linux-arm64-musl": "0.1.44-alpha"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^19.2.6",
|
package/runtime/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('brustjs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('brustjs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('brustjs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('brustjs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('brustjs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('brustjs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('brustjs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('brustjs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('brustjs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('brustjs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('brustjs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('brustjs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('brustjs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('brustjs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('brustjs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('brustjs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('brustjs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('brustjs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('brustjs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('brustjs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('brustjs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('brustjs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('brustjs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('brustjs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('brustjs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('brustjs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('brustjs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('brustjs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('brustjs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('brustjs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('brustjs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('brustjs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('brustjs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('brustjs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('brustjs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('brustjs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('brustjs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('brustjs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('brustjs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('brustjs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('brustjs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('brustjs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('brustjs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('brustjs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('brustjs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('brustjs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('brustjs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('brustjs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('brustjs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('brustjs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('brustjs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('brustjs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.44-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.44-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/runtime/md/render.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Marked, type Tokens } from 'marked'
|
|
2
|
+
// Heading slugger shared with the public `brustjs/routes` export so a consumer's
|
|
3
|
+
// anchors can't drift from the ids we stamp here (FRAMEWORK-GAPS G1).
|
|
4
|
+
import { slugifyHeading as slugify } from './slug.ts'
|
|
2
5
|
|
|
3
6
|
// ---------------------------------------------------------------------------
|
|
4
7
|
// Types
|
|
@@ -397,14 +400,6 @@ function scanBalancedBraces(text: string, start: number): number {
|
|
|
397
400
|
// Markdown → HTML (marked, GFM, heading ids, shiki fences)
|
|
398
401
|
// ---------------------------------------------------------------------------
|
|
399
402
|
|
|
400
|
-
function slugify(text: string): string {
|
|
401
|
-
return text
|
|
402
|
-
.toLowerCase()
|
|
403
|
-
.trim()
|
|
404
|
-
.replace(/\s+/g, '-')
|
|
405
|
-
.replace(/[^\w-]/g, '')
|
|
406
|
-
}
|
|
407
|
-
|
|
408
403
|
async function renderMarkdown(source: string): Promise<string> {
|
|
409
404
|
// Fresh instance per page: heading-id dedupe state is page-local.
|
|
410
405
|
const slugCounts = new Map<string, number>()
|
package/runtime/md/routes.ts
CHANGED
|
@@ -60,6 +60,13 @@ export interface MdRoutesOptions {
|
|
|
60
60
|
layout?: ComponentType<any>
|
|
61
61
|
/** Component-tag registry for `<Name />` tags inside the md body. */
|
|
62
62
|
components?: Record<string, ComponentType<any>>
|
|
63
|
+
/** Loader for the LAYOUT parent route — runs before each md leaf renders and
|
|
64
|
+
* its data merges into the leaf's context top-down (so it feeds the layout
|
|
65
|
+
* chrome: sidebar, pager, …). Only applies when `layout` is set. Return keys
|
|
66
|
+
* that DON'T collide with the leaf's `__md` head metadata, which must win.
|
|
67
|
+
* Without this, the layout loader had to be attached by mutating the returned
|
|
68
|
+
* route node (`tree.loader = …`) — undocumented surface (was FRAMEWORK-GAPS G2). */
|
|
69
|
+
loader?: Route['loader']
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
/** One frozen-manifest entry (everything route construction needs per page).
|
|
@@ -270,7 +277,15 @@ export function mdRoutes(contentDir: string, opts: MdRoutesOptions = {}): Route[
|
|
|
270
277
|
})
|
|
271
278
|
|
|
272
279
|
if (opts.layout === undefined) return leaves
|
|
273
|
-
|
|
280
|
+
const layoutRoute: Route = {
|
|
281
|
+
path: basePath,
|
|
282
|
+
native: true,
|
|
283
|
+
Component: opts.layout,
|
|
284
|
+
children: leaves,
|
|
285
|
+
}
|
|
286
|
+
// First-class layout loader (was a post-hoc `tree.loader = …` mutation).
|
|
287
|
+
if (opts.loader !== undefined) layoutRoute.loader = opts.loader
|
|
288
|
+
return [layoutRoute]
|
|
274
289
|
}
|
|
275
290
|
|
|
276
291
|
/** Strip the mount base off a full url path (index page → `''`, which
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Heading-anchor slugger — the SINGLE source of truth for the ids brust stamps
|
|
2
|
+
// on markdown `<h2>/<h3>`. render.ts uses it when emitting heading ids, and it
|
|
3
|
+
// is re-exported on `brustjs/routes` so a consumer (e.g. a search-index
|
|
4
|
+
// generator) can compute the SAME anchors without copying this logic — which
|
|
5
|
+
// is exactly the parity that used to drift (FRAMEWORK-GAPS G1).
|
|
6
|
+
//
|
|
7
|
+
// `\w` is ASCII-only: non-ascii heading text strips to nothing (matches marked
|
|
8
|
+
// GFM's behavior as wired here). Per-page duplicate-id disambiguation
|
|
9
|
+
// (`-2`, `-3`, …) is the caller's concern — render.ts keeps a page-local count.
|
|
10
|
+
export function slugifyHeading(text: string): string {
|
|
11
|
+
return text
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.trim()
|
|
14
|
+
.replace(/\s+/g, '-')
|
|
15
|
+
.replace(/[^\w-]/g, '')
|
|
16
|
+
}
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
import { effect } from '../store/signal.ts'
|
|
9
9
|
import { nav, type NavPhase } from './store.ts'
|
|
10
10
|
|
|
11
|
+
/** Drop a trailing slash (root '/' stays). Mirrors store.ts canonicalPath —
|
|
12
|
+
* kept local so this module stays a leaf with no extra import surface. */
|
|
13
|
+
function canonicalPath(p: string): string {
|
|
14
|
+
let out = p
|
|
15
|
+
while (out.length > 1 && out.endsWith('/')) out = out.slice(0, -1)
|
|
16
|
+
return out
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
// The install guard lives on globalThis (like __BRUST_NAV__), NOT as a module
|
|
12
20
|
// `let`: every Bun.build island chunk inlines its own copy of this module, so a
|
|
13
21
|
// module-local flag would not stop a second chunk from installing a duplicate
|
|
@@ -55,10 +63,15 @@ function reconcileActiveLinks(currentPath: string): void {
|
|
|
55
63
|
const prefix = el.dataset.brustActiveMatch === 'prefix'
|
|
56
64
|
const links = el.querySelectorAll<HTMLAnchorElement>('a[href]')
|
|
57
65
|
for (const a of Array.from(links)) {
|
|
58
|
-
|
|
66
|
+
// Canonicalize both sides (drop trailing '/', root stays '/') so a link
|
|
67
|
+
// href and a current path that differ only by a trailing slash — e.g. a
|
|
68
|
+
// full load served via a trailing-slash redirect — still match. nav.path
|
|
69
|
+
// is already canonical (store.ts), but the link href may not be.
|
|
70
|
+
const linkPath = canonicalPath(new URL(a.href, location.href).pathname)
|
|
71
|
+
const cur = canonicalPath(currentPath)
|
|
59
72
|
const isActive = prefix
|
|
60
|
-
?
|
|
61
|
-
:
|
|
73
|
+
? cur === linkPath || cur.startsWith(`${linkPath}/`)
|
|
74
|
+
: cur === linkPath
|
|
62
75
|
a.classList.toggle(activeClass, isActive)
|
|
63
76
|
if (isActive) a.setAttribute('aria-current', 'page')
|
|
64
77
|
else a.removeAttribute('aria-current')
|
|
@@ -73,6 +73,21 @@ function store(): NavInternal {
|
|
|
73
73
|
return G.__BRUST_NAV__
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/** Canonicalize a pathname to the form routes match on: no trailing slash
|
|
77
|
+
* (root stays '/'). A full document load served via a trailing-slash redirect
|
|
78
|
+
* (e.g. Cloudflare Pages 308 `/docs/x` → `/docs/x/`) hands the bootstrap a
|
|
79
|
+
* `location.pathname` ending in `/`, while link hrefs and the server-rendered
|
|
80
|
+
* active state use the bare path — so without this, the active-nav reconciler
|
|
81
|
+
* and NavLink behaviors would compare `/docs/x/` against `/docs/x` and treat
|
|
82
|
+
* the current page as inactive. Normalizing here keeps every consumer of
|
|
83
|
+
* `nav.path()` aligned with the canonical route. Search/hash never reach this
|
|
84
|
+
* (the setters take a pathname only). */
|
|
85
|
+
function canonicalPath(path: string): string {
|
|
86
|
+
let p = path
|
|
87
|
+
while (p.length > 1 && p.endsWith('/')) p = p.slice(0, -1)
|
|
88
|
+
return p
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
// Public reactive handle. A Proxy resolves the singleton on each property access
|
|
77
92
|
// so (a) every chunk's `nav` points at the one globalThis bag, and (b) tests that
|
|
78
93
|
// reset the singleton see the fresh signals.
|
|
@@ -145,7 +160,7 @@ export function onNavigateError(cb: ErrorCb): () => void {
|
|
|
145
160
|
export function __navInit(path: string, search: string): void {
|
|
146
161
|
const s = store()
|
|
147
162
|
batch(() => {
|
|
148
|
-
s.path.set(path)
|
|
163
|
+
s.path.set(canonicalPath(path))
|
|
149
164
|
s.search.set(search)
|
|
150
165
|
s.phase.set('idle')
|
|
151
166
|
s.from.set(null)
|
|
@@ -162,21 +177,22 @@ export function __navInit(path: string, search: string): void {
|
|
|
162
177
|
export function __navStart(toPath: string, _toSearch: string): void {
|
|
163
178
|
const s = store()
|
|
164
179
|
const from = s.path()
|
|
180
|
+
const to = canonicalPath(toPath)
|
|
165
181
|
batch(() => {
|
|
166
182
|
s.from.set(from)
|
|
167
|
-
s.to.set(
|
|
183
|
+
s.to.set(to)
|
|
168
184
|
s.error.set(null)
|
|
169
185
|
s.phase.set('loading')
|
|
170
186
|
})
|
|
171
187
|
bumpVersion(s)
|
|
172
|
-
for (const cb of [...s._before]) cb({ from, to
|
|
188
|
+
for (const cb of [...s._before]) cb({ from, to })
|
|
173
189
|
emit(s)
|
|
174
190
|
}
|
|
175
191
|
|
|
176
192
|
export function __navCommit(toPath: string, toSearch: string): void {
|
|
177
193
|
const s = store()
|
|
178
194
|
batch(() => {
|
|
179
|
-
s.path.set(toPath)
|
|
195
|
+
s.path.set(canonicalPath(toPath))
|
|
180
196
|
s.search.set(toSearch)
|
|
181
197
|
s.to.set(null)
|
|
182
198
|
s.error.set(null)
|
package/runtime/routes.ts
CHANGED
|
@@ -31,7 +31,7 @@ import { validate } from './standard-schema.ts'
|
|
|
31
31
|
// surface — apps spread `...mdRoutes('content/docs', …)` into defineRoutes and
|
|
32
32
|
// render sidebars from `mdNav(...)`. Re-exported here so user code never
|
|
33
33
|
// imports runtime-internal paths.
|
|
34
|
-
export { mdNav, mdRoutes } from './md/routes.ts'
|
|
34
|
+
export { mdNav, mdRoutes, mdUrlPath } from './md/routes.ts'
|
|
35
35
|
export type {
|
|
36
36
|
MdNavGroup,
|
|
37
37
|
MdNavItem,
|
|
@@ -39,6 +39,12 @@ export type {
|
|
|
39
39
|
MdRoutesOptions,
|
|
40
40
|
MdRouteSource,
|
|
41
41
|
} from './md/routes.ts'
|
|
42
|
+
// Lower-level md building blocks — the directory scanner and the heading
|
|
43
|
+
// slugger — so consumers (search indexers, sitemaps) build on the SAME
|
|
44
|
+
// scan/slug brust uses internally instead of copying it (FRAMEWORK-GAPS G1).
|
|
45
|
+
export { scanMdDir } from './md/scan.ts'
|
|
46
|
+
export type { MdFile } from './md/scan.ts'
|
|
47
|
+
export { slugifyHeading } from './md/slug.ts'
|
|
42
48
|
|
|
43
49
|
// S2 + B3 — unified per-request scope. The request scope (B3 cookies/context) is
|
|
44
50
|
// the OUTERMOST layer, then the request-scoped loader cache/dedupe (S2: one Map
|