@brust/core 2.0.0-alpha.33 → 2.0.0-alpha.35

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.d.ts CHANGED
@@ -25,7 +25,7 @@ export declare function cacheClear(): number
25
25
  */
26
26
  export declare function cacheExprReads(src: string): Array<string>
27
27
 
28
- /** `cache.invalidate({ key?, tags?, path?, method? })` (spec §5). */
28
+ /** `cache.invalidate({ key?, tags?, path?, method?, prefix? })` (spec §5). */
29
29
  export declare function cacheInvalidate(args: NapiInvalidateArgs): NapiInvalidateResult
30
30
 
31
31
  /**
@@ -43,6 +43,8 @@ export declare function cacheReplay(args: NapiInvalidateArgs, seq?: number | und
43
43
  /** `/_brust/cache/stats` JSON (snake_case keys, as the server serialises it). */
44
44
  export declare function cacheStats(): string
45
45
 
46
+ export declare function checkRoutePatterns(patterns: Array<string>): RoutePatternConflict | null
47
+
46
48
  /** A module a chunk imports by name, shared with other chunks (`<name>.js` beside it, R34.124). */
47
49
  export interface ClientModule {
48
50
  name: string
@@ -140,6 +142,8 @@ export interface NapiInvalidateArgs {
140
142
  tags?: Array<string>
141
143
  path?: string
142
144
  method?: string
145
+ /** F493: narrow the page invalidation to this exact key prefix. */
146
+ prefix?: string
143
147
  }
144
148
 
145
149
  export interface NapiInvalidateResult {
@@ -201,6 +205,20 @@ export declare function putFetchReply(slot: number, body: Uint8Array): boolean
201
205
  */
202
206
  export declare function registerWorker(buf: Uint8Array, slots: number, f: (arg0: string, arg1: string, arg2: number) => Promise<number>): number
203
207
 
208
+ /**
209
+ * F496: the first route pattern the server's router refuses (a conflict such as `/{*rest}` next to `/{slug}`, or an
210
+ * invalid pattern), or `None`. `brust build` runs it over the flattened patterns (catch-all `*` routes left out, as
211
+ * the server does) so the failure shows at build, with the router's own message. Needs no running server.
212
+ */
213
+ export interface RoutePatternConflict {
214
+ /** Index into the `patterns` given of the pattern the router refused. */
215
+ index: number
216
+ /** Index of the earlier pattern it conflicts with, when there is one. */
217
+ withIndex?: number
218
+ /** The router's refusal, as `brust start` would print it. */
219
+ message: string
220
+ }
221
+
204
222
  /**
205
223
  * F230: scans the app modules the build loads (`modules`, relative to `root`) for writes into another app module's
206
224
  * exports; the JSON result goes to every `compile_tree` of the build as `loadWrites`. `path_aliases` as for
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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33' && 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.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '2.0.0-alpha.35' && 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.35 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.33') {
665
- throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.33 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '2.0.0-alpha.35') {
665
+ throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
666
  }
667
667
  }
668
668
  wasiBinding = require('@brust/native-wasm32-wasi')
@@ -785,6 +785,7 @@ module.exports.cacheInvalidate = nativeBinding.cacheInvalidate
785
785
  module.exports.cacheL2Count = nativeBinding.cacheL2Count
786
786
  module.exports.cacheReplay = nativeBinding.cacheReplay
787
787
  module.exports.cacheStats = nativeBinding.cacheStats
788
+ module.exports.checkRoutePatterns = nativeBinding.checkRoutePatterns
788
789
  module.exports.compileTree = nativeBinding.compileTree
789
790
  module.exports.localAddr = nativeBinding.localAddr
790
791
  module.exports.planJobs = nativeBinding.planJobs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brust/core",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
4
4
  "description": "brust v2 — React components compiled to Rust-rendered templates",
5
5
  "license": "MIT",
6
6
  "homepage": "https://brust.dev",
@@ -52,11 +52,12 @@
52
52
  "x86_64-unknown-linux-gnu",
53
53
  "aarch64-unknown-linux-gnu",
54
54
  "x86_64-unknown-linux-musl",
55
- "aarch64-unknown-linux-musl"
55
+ "aarch64-unknown-linux-musl",
56
+ "x86_64-pc-windows-msvc"
56
57
  ]
57
58
  },
58
59
  "dependencies": {
59
- "@brust/runtime-dom": "2.0.0-alpha.33",
60
+ "@brust/runtime-dom": "2.0.0-alpha.35",
60
61
  "tsconfig-paths": "4.2.0"
61
62
  },
62
63
  "peerDependencies": {
@@ -100,12 +101,13 @@
100
101
  "access": "public"
101
102
  },
102
103
  "optionalDependencies": {
103
- "@brust/native-darwin-x64": "2.0.0-alpha.33",
104
- "@brust/native-darwin-arm64": "2.0.0-alpha.33",
105
- "@brust/native-linux-x64-gnu": "2.0.0-alpha.33",
106
- "@brust/native-linux-arm64-gnu": "2.0.0-alpha.33",
107
- "@brust/native-linux-x64-musl": "2.0.0-alpha.33",
108
- "@brust/native-linux-arm64-musl": "2.0.0-alpha.33",
109
- "@brust/core-cf": "2.0.0-alpha.33"
104
+ "@brust/native-darwin-x64": "2.0.0-alpha.35",
105
+ "@brust/native-darwin-arm64": "2.0.0-alpha.35",
106
+ "@brust/native-linux-x64-gnu": "2.0.0-alpha.35",
107
+ "@brust/native-linux-arm64-gnu": "2.0.0-alpha.35",
108
+ "@brust/native-linux-x64-musl": "2.0.0-alpha.35",
109
+ "@brust/native-linux-arm64-musl": "2.0.0-alpha.35",
110
+ "@brust/native-win32-x64-msvc": "2.0.0-alpha.35",
111
+ "@brust/core-cf": "2.0.0-alpha.35"
110
112
  }
111
113
  }
@@ -46,10 +46,9 @@ const page = () => globalThis as PageGlobals
46
46
  export function resolvePrefix(opts?: { prefix?: string; baseUrl?: string }): string {
47
47
  if (opts?.prefix) return opts.prefix
48
48
  if (opts?.baseUrl !== undefined) return DEFAULT_ACTION_PREFIX
49
- return (
50
- (globalThis as { __BRUST_ACTION_PREFIX__?: string }).__BRUST_ACTION_PREFIX__ ??
51
- DEFAULT_ACTION_PREFIX
52
- )
49
+ // F495: an app under a base path serves the default prefix below it; the page says where (`__BRUST_BASE_PATH__`).
50
+ const g = globalThis as { __BRUST_ACTION_PREFIX__?: string; __BRUST_BASE_PATH__?: string }
51
+ return g.__BRUST_ACTION_PREFIX__ ?? `${g.__BRUST_BASE_PATH__ ?? ''}${DEFAULT_ACTION_PREFIX}`
53
52
  }
54
53
 
55
54
  /** 0.1.x runtime/treaty.ts:95-106; message names `client`. */
package/src/browser.ts CHANGED
@@ -5,6 +5,9 @@
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
+
9
+ /** F495 `[server] base_path` (see index.ts): the page's `__BRUST_BASE_PATH__` global, `''` at the root. */
10
+ export const basePath: string = (globalThis as { __BRUST_BASE_PATH__?: string }).__BRUST_BASE_PATH__ ?? ''
8
11
  export { clearNavigationCache, navigate } from './navigate-browser'
9
12
  export type { NavErrorDetail, NavLoadDetail, NavigateOptions, NavSuccessDetail, NavTrigger } from './navigate'
10
13
  import type { InvalidateArgs, InvalidateResult } from './native'
@@ -2,12 +2,14 @@
2
2
  // the same Rust admission (method gate, body caps, `Content-Encoding`, the cross-site guard, CORS), every other
3
3
  // path a 404 problem+json. With `--target cloudflare` it also writes `<out>/cf/`: a Worker serving only actions
4
4
  // (no Static Assets). The routes entry is neither read nor required.
5
- import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from 'node:fs'
5
+ import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
6
6
  import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path'
7
7
  import { buildActions } from './bundle'
8
8
  import { type CfPrepared, buildCloudflare, prepareCloudflare } from './cloudflare'
9
9
  import type { ActionsBuildConfig, BuildConfig } from './config'
10
10
  import { BuildError } from './errors'
11
+ import { escapes } from './posix'
12
+ import { swapDist } from './swap'
11
13
  import { MANIFEST_VERSION, type ManifestJson } from './manifest'
12
14
 
13
15
  const MARKER = '.brust'
@@ -28,7 +30,7 @@ export async function runActionsOnly(o: {
28
30
  if (o.target === 'static') throw new BuildError('actions-only', '--actions-only builds no pages: it cannot be combined with --target static')
29
31
  const entry = resolve(appRoot, actions.entry)
30
32
  const rel = relative(appRoot, entry)
31
- if (isAbsolute(actions.entry) || rel === '..' || rel.startsWith('../') || isAbsolute(rel) || !o.statOk(entry))
33
+ if (isAbsolute(actions.entry) || escapes(rel) || !o.statOk(entry))
32
34
  throw new BuildError('actions-entry', `actions.entry ${actions.entry} is not a file inside the app`)
33
35
  o.assertSafeOutDir(dist, appRoot, [entry])
34
36
  if (config.cache) o.log('[brust] actions-only: [cache] and route options do not apply (ignored)')
@@ -45,8 +47,9 @@ export async function runActionsOnly(o: {
45
47
  components: {},
46
48
  assets: { runtime: '', features: {} },
47
49
  jobs_module: 'jobs.js',
48
- actions: { entry: await buildActions(tmp, entry), prefix: actions.prefix, maxBodyBytes: actions.maxBodyBytes, maxResponseBytes: actions.maxResponseBytes, crossSite: actions.crossSite, ...actions.stream },
50
+ actions: { entry: await buildActions(tmp, entry, undefined, config.basePath), prefix: actions.prefix, maxBodyBytes: actions.maxBodyBytes, maxResponseBytes: actions.maxResponseBytes, crossSite: actions.crossSite, ...actions.stream },
49
51
  actions_only: true,
52
+ ...(config.basePath !== '' ? { base_path: config.basePath } : {}),
50
53
  }
51
54
  mkdirSync(join(tmp, 'jinja'), { recursive: true })
52
55
  writeFileSync(join(tmp, 'jobs.js'), '// generated by `brust build --actions-only`: no pages, so no jobs\nexport default {}\n')
@@ -72,13 +75,7 @@ export async function runActionsOnly(o: {
72
75
  for (const w of warnings) o.log(w)
73
76
  }
74
77
  rmSync(join(tmp, '.stage'), { recursive: true, force: true })
75
- if (existsSync(dist)) {
76
- const old = join(dirname(dist), `.${basename(dist)}.brust-old`)
77
- rmSync(old, { recursive: true, force: true })
78
- renameSync(dist, old)
79
- renameSync(tmp, dist)
80
- rmSync(old, { recursive: true, force: true })
81
- } else renameSync(tmp, dist)
78
+ swapDist(tmp, dist)
82
79
  } catch (e) {
83
80
  rmSync(tmp, { recursive: true, force: true })
84
81
  throw e
@@ -10,6 +10,7 @@ import { createHash } from 'node:crypto'
10
10
  import { existsSync, mkdirSync, realpathSync, statSync, writeFileSync } from 'node:fs'
11
11
  import { builtinModules } from 'node:module'
12
12
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
13
+ import { escapes, inServerOnlyPrefix, posixOf, relPosix } from './posix'
13
14
  import type { BunPlugin } from 'bun'
14
15
  import type { Compiled } from './compile'
15
16
  import { cssPlugin } from './css'
@@ -54,8 +55,13 @@ export interface BrowserCtx {
54
55
  /** F480: load-time writers shipped into an island chunk (F230), by real path: why each is there. A server-only import
55
56
  * reached through one names that chain in `server-only-in-client`. */
56
57
  loadWriters?: Map<string, string>
58
+ /** F495 `[server] base_path`: every `/_brust/…` URL a bundle names carries it (`/portal/_brust/…`); absent or `''` = the root. */
59
+ basePath?: string
57
60
  }
58
61
 
62
+ /** F495: brust's own URL prefix for a build, `/_brust` or `<base>/_brust`. */
63
+ export const brustRoot = (ctx: { basePath?: string }): string => `${ctx.basePath ?? ''}/_brust`
64
+
59
65
  /** `file` sits under `root`. */
60
66
  const inside = (root: string, file: string): boolean => file === root || file.startsWith(root.endsWith(sep) ? root : root + sep)
61
67
 
@@ -172,8 +178,7 @@ function isServerOnly(spec: string, importer: string, ctx: BrowserCtx): boolean
172
178
  try {
173
179
  if (ctx.serverFiles?.includes(realpathSync(file))) return true
174
180
  } catch {}
175
- const rel = relative(ctx.appRoot, file)
176
- return !rel.startsWith('..') && !isAbsolute(rel) && ctx.serverOnly.some((p) => rel.startsWith(p))
181
+ return inServerOnlyPrefix(relative(ctx.appRoot, file), ctx.serverOnly)
177
182
  }
178
183
 
179
184
  /** Fails a browser build that would include server-only code at any depth (a client chunk, an
@@ -211,13 +216,13 @@ function serverOnlyPlugin(ctx: BrowserCtx, violations: string[]): BunPlugin {
211
216
  name: 'brust-server-only',
212
217
  setup(b) {
213
218
  b.onResolve({ filter: /.*/ }, (a) => {
214
- if (!a.importer || a.path.startsWith('/_brust/')) return undefined
219
+ if (!a.importer || a.path.startsWith(`${brustRoot(ctx)}/`)) return undefined
215
220
  if (a.path === '@brust/core') return { path: BROWSER_ENTRY }
216
221
  if (!isServerOnly(a.path, a.importer, ctx)) {
217
222
  if (writers.size > 0) noteImport(a.path, a.importer)
218
223
  return undefined
219
224
  }
220
- const msg = `${relative(ctx.appRoot, ctx.sourceOf.get(a.importer) ?? a.importer)} imports ${a.path}${writerChain(a.importer)}`
225
+ const msg = `${relPosix(ctx.appRoot, ctx.sourceOf.get(a.importer) ?? a.importer)} imports ${a.path}${writerChain(a.importer)}`
221
226
  if (!violations.includes(msg)) violations.push(msg)
222
227
  return { path: a.path, namespace: SERVER_ONLY_NS }
223
228
  })
@@ -247,7 +252,7 @@ async function browserBuild(
247
252
  try {
248
253
  res = await Bun.build({
249
254
  ...config,
250
- plugins: [serverOnlyPlugin(ctx, violations), cssPlugin(ctx.cssMaps ?? new Map(), ctx.clientDir), ...(config.plugins ?? [])],
255
+ plugins: [serverOnlyPlugin(ctx, violations), cssPlugin(ctx.cssMaps ?? new Map(), ctx.clientDir, ctx.basePath), ...(config.plugins ?? [])],
251
256
  target: 'browser',
252
257
  format: 'esm',
253
258
  minify: true,
@@ -333,7 +338,7 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
333
338
  })
334
339
  ).get('runtime')!
335
340
  // Features import the core's API (`core-api`, and `core` for the store's re-exports) from the core file by URL.
336
- const coreUrl = `/_brust/${core}`
341
+ const coreUrl = `${brustRoot(ctx)}/${core}`
337
342
  const coreFiles = new Set(['core-api', 'core'].map((f) => join(dir, f)))
338
343
  const names = [...RUNTIME_FEATURES, 'store'] as const
339
344
  const entries = names.map((n) => {
@@ -391,7 +396,7 @@ export async function buildClientChunks(dist: string, compiled: Map<string, Comp
391
396
  return browserBuild(dist, 'client chunks', ctx, {
392
397
  entrypoints,
393
398
  splitting: true,
394
- external: ['/_brust/*'],
399
+ external: [`${brustRoot(ctx)}/*`],
395
400
  plugins: [runtimeAliasPlugin(runtimeUrl), specModulePlugin(join(dist, '.stage', 'client')), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser')],
396
401
  })
397
402
  }
@@ -429,11 +434,11 @@ export async function projectionFallbacks(dist: string, compiled: Map<string, Co
429
434
  const res = await Bun.build({
430
435
  entrypoints,
431
436
  splitting: true,
432
- external: ['/_brust/*'],
437
+ external: [`${brustRoot(ctx)}/*`],
433
438
  target: 'browser',
434
439
  format: 'esm',
435
440
  metafile: true,
436
- plugins: [serverOnlyPlugin(ctx, []), cssPlugin(ctx.cssMaps ?? new Map(), ctx.clientDir), runtimeAliasPlugin(runtimeUrl), specModulePlugin(probeDir), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser')],
441
+ plugins: [serverOnlyPlugin(ctx, []), cssPlugin(ctx.cssMaps ?? new Map(), ctx.clientDir, ctx.basePath), runtimeAliasPlugin(runtimeUrl), specModulePlugin(probeDir), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser')],
437
442
  })
438
443
  if (!res.success || !res.metafile) throw new BuildError('bundle', `client chunks (projection probe): ${res.logs.map(String).join('\n')}`)
439
444
  const loaded = new Set(Object.keys(res.metafile.inputs).map((k) => real(resolve(k))))
@@ -685,7 +690,7 @@ export async function buildReactChunks(
685
690
  const out = await browserBuild(dist, 'react islands', ctx, {
686
691
  entrypoints,
687
692
  splitting: true,
688
- external: ['/_brust/*'],
693
+ external: [`${brustRoot(ctx)}/*`],
689
694
  plugins: [runtimeAliasPlugin(runtimeUrl), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser'), exposePlugin(compiled)],
690
695
  })
691
696
  return new Map([...out].map(([stem, path]) => [stem.slice('react-'.length), path]))
@@ -721,8 +726,8 @@ const ACTIONS_EXTERNALS = [...JOBS_EXTERNALS, 'elysia', 'elysia/*', '@elysia/*']
721
726
 
722
727
  /** `dist/actions.js` (M3-F E1): the actions entry for the worker (`target: 'bun'`). No `define`: Elysia
723
728
  * and app code read NODE_ENV at runtime (run.ts sets production). */
724
- export async function buildActions(dist: string, entry: string, cssMaps: Map<string, Record<string, string>> = new Map()): Promise<string> {
725
- const res = await Bun.build({ entrypoints: [entry], target: 'bun', format: 'esm', external: ACTIONS_EXTERNALS, plugins: [serverOnlyEmptyPlugin(), cssPlugin(cssMaps, join(dist, 'client')), workerStorePlugin] })
729
+ export async function buildActions(dist: string, entry: string, cssMaps: Map<string, Record<string, string>> = new Map(), basePath = ''): Promise<string> {
730
+ const res = await Bun.build({ entrypoints: [entry], target: 'bun', format: 'esm', external: ACTIONS_EXTERNALS, plugins: [serverOnlyEmptyPlugin(), cssPlugin(cssMaps, join(dist, 'client'), basePath), workerStorePlugin] })
726
731
  if (!res.success) throw new BuildError('bundle', `actions: ${res.logs.map(String).join('\n')}`)
727
732
  write(join(dist, 'actions.js'), await res.outputs[0]!.text())
728
733
  return 'actions.js'
@@ -769,6 +774,8 @@ export async function buildJobs(
769
774
  reached?: { planned: ReadonlySet<string>; ssr: ReadonlySet<string> },
770
775
  /** F230: app modules that write another module's exports when they load: imported first (see `islandShim`). */
771
776
  writers: string[] = [],
777
+ /** F495: `[server] base_path`: an imported asset's URL carries it. */
778
+ basePath = '',
772
779
  ): Promise<void> {
773
780
  const imports: string[] = [writerImports(writers).trimEnd(), "import { createElement } from 'react'", "import { renderToString } from 'react-dom/server'"].filter((l) => l !== '')
774
781
  const entries: string[] = []
@@ -778,7 +785,7 @@ export async function buildJobs(
778
785
  imports.push(`import * as S${i} from ${JSON.stringify(p)}`) // a package module, external in jobs.js
779
786
  continue
780
787
  }
781
- if (isAbsolute(p) || p.split('/').includes('..') || !isFile(resolve(appRoot, p))) {
788
+ if (isAbsolute(p) || posixOf(p).split('/').includes('..') || escapes(relative(appRoot, resolve(appRoot, p))) || !isFile(resolve(appRoot, p))) {
782
789
  throw new BuildError('store-module', `store module ${p} is not a file inside the app (${appRoot})`)
783
790
  }
784
791
  imports.push(`import * as S${i} from ${JSON.stringify(resolve(appRoot, p))}`)
@@ -830,7 +837,7 @@ export async function buildJobs(
830
837
  (importer) => jobFiles.has(importer),
831
838
  ),
832
839
  serverOnlyEmptyPlugin(),
833
- cssPlugin(cssMaps, join(dist, 'client')),
840
+ cssPlugin(cssMaps, join(dist, 'client'), basePath),
834
841
  workerStorePlugin,
835
842
  sourceDirPlugin(sourceOf, appRoot, JOBS_EXTERNALS),
836
843
  exposePlugin(compiled),