@brust/core 2.0.0-alpha.15 → 2.0.0-alpha.17

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
@@ -43,6 +43,12 @@ 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
+ /** A module a chunk imports by name, shared with other chunks (`<name>.js` beside it, R34.124). */
47
+ export interface ClientModule {
48
+ name: string
49
+ code: string
50
+ }
51
+
46
52
  export interface CompiledComponent {
47
53
  id: string
48
54
  source: string
@@ -53,6 +59,8 @@ export interface CompiledComponent {
53
59
  /** Build-time evaluation module (L2): one thunk per `ir.build_eval` slot. */
54
60
  evalTs?: string
55
61
  clientJs?: string
62
+ /** Modules the chunk imports that other chunks share (specialised clones with an equal factory, R34.124). */
63
+ clientModules: Array<ClientModule>
56
64
  diagnostics: Array<NapiDiagnostic>
57
65
  }
58
66
 
@@ -65,8 +73,9 @@ export interface CompiledTree {
65
73
  * Compiles `path` (relative to `root`) and every child it reaches through lowering. `css_modules` (L20): the class
66
74
  * map of each `*.module.css`, keyed by its path relative to `root`; `styles.x` folds to the literal class.
67
75
  * `packages` (F153c): the JSON resolution map of the package sources the build wrote (`pkg-src.ts`).
76
+ * `source_roots` (F256): the directories besides the app that a relative import may reach.
68
77
  */
69
- export declare function compileTree(path: string, root: string, runtimeImport: string, serverOnly: Array<string>, slotValues?: string | undefined | null, cssModules?: Record<string, Record<string, string>> | undefined | null, iconSvgs?: string | undefined | null, routeRoots?: Array<string> | undefined | null, pathAliases?: string | undefined | null, packages?: string | undefined | null): CompiledTree
78
+ export declare function compileTree(path: string, root: string, runtimeImport: string, serverOnly: Array<string>, slotValues?: string | undefined | null, cssModules?: Record<string, Record<string, string>> | undefined | null, iconSvgs?: string | undefined | null, routeRoots?: Array<string> | undefined | null, pathAliases?: string | undefined | null, packages?: string | undefined | null, sourceRoots?: Array<string> | undefined | null, loadWrites?: string | undefined | null): CompiledTree
70
79
 
71
80
  /** The bound address as `host:port` (port 0 resolves here). */
72
81
  export declare function localAddr(): string
@@ -167,6 +176,14 @@ export declare function putFetchReply(slot: number, body: Uint8Array): boolean
167
176
  */
168
177
  export declare function registerWorker(buf: Uint8Array, slots: number, f: (arg0: string, arg1: string, arg2: number) => Promise<number>): number
169
178
 
179
+ /**
180
+ * F230: scans the app modules the build loads (`modules`, relative to `root`) for writes into another app module's
181
+ * exports; the JSON result goes to every `compile_tree` of the build as `loadWrites`. `path_aliases` as for
182
+ * `compile_tree`; a bad one is ignored (the compile reports it). `source_roots` (F256, F276): the directories besides
183
+ * the app that a relative import may reach, so a module there can be scanned and an import into it resolves.
184
+ */
185
+ export declare function scanLoadWrites(root: string, modules: Array<string>, pathAliases?: string | undefined | null, sourceRoots?: Array<string> | undefined | null): string
186
+
170
187
  export interface StartOptions {
171
188
  host: string
172
189
  port: number
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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15' && 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.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '2.0.0-alpha.17' && 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.17 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.15') {
665
- throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '2.0.0-alpha.17') {
665
+ throw new Error(`WASI binding package version mismatch, expected 2.0.0-alpha.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
666
  }
667
667
  }
668
668
  wasiBinding = require('@brust/native-wasm32-wasi')
@@ -791,6 +791,7 @@ module.exports.planJobs = nativeBinding.planJobs
791
791
  module.exports.planJobsBuf = nativeBinding.planJobsBuf
792
792
  module.exports.putFetchReply = nativeBinding.putFetchReply
793
793
  module.exports.registerWorker = nativeBinding.registerWorker
794
+ module.exports.scanLoadWrites = nativeBinding.scanLoadWrites
794
795
  module.exports.startServer = nativeBinding.startServer
795
796
  module.exports.takeFetchBody = nativeBinding.takeFetchBody
796
797
  module.exports.untilReady = nativeBinding.untilReady
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brust/core",
3
- "version": "2.0.0-alpha.15",
3
+ "version": "2.0.0-alpha.17",
4
4
  "description": "brust v2 — React components compiled to Rust-rendered templates",
5
5
  "license": "MIT",
6
6
  "homepage": "https://brust.dev",
@@ -55,7 +55,8 @@
55
55
  ]
56
56
  },
57
57
  "dependencies": {
58
- "@brust/runtime-dom": "2.0.0-alpha.15"
58
+ "@brust/runtime-dom": "2.0.0-alpha.17",
59
+ "tsconfig-paths": "4.2.0"
59
60
  },
60
61
  "peerDependencies": {
61
62
  "react": "^19.0.0",
@@ -74,6 +75,8 @@
74
75
  "devDependencies": {
75
76
  "@elysia/eden": "2.0.0-beta.6",
76
77
  "@napi-rs/cli": "^3.0.0",
78
+ "@radix-ui/react-collection": "1.2.0",
79
+ "@radix-ui/react-slot": "1.5.0",
77
80
  "@types/bun": "^1.4.0",
78
81
  "@types/react": "^19.2.0",
79
82
  "elysia": "2.0.0-beta.30",
@@ -93,12 +96,12 @@
93
96
  "access": "public"
94
97
  },
95
98
  "optionalDependencies": {
96
- "@brust/native-darwin-x64": "2.0.0-alpha.15",
97
- "@brust/native-darwin-arm64": "2.0.0-alpha.15",
98
- "@brust/native-linux-x64-gnu": "2.0.0-alpha.15",
99
- "@brust/native-linux-arm64-gnu": "2.0.0-alpha.15",
100
- "@brust/native-linux-x64-musl": "2.0.0-alpha.15",
101
- "@brust/native-linux-arm64-musl": "2.0.0-alpha.15",
102
- "@brust/core-cf": "2.0.0-alpha.15"
99
+ "@brust/native-darwin-x64": "2.0.0-alpha.17",
100
+ "@brust/native-darwin-arm64": "2.0.0-alpha.17",
101
+ "@brust/native-linux-x64-gnu": "2.0.0-alpha.17",
102
+ "@brust/native-linux-arm64-gnu": "2.0.0-alpha.17",
103
+ "@brust/native-linux-x64-musl": "2.0.0-alpha.17",
104
+ "@brust/native-linux-arm64-musl": "2.0.0-alpha.17",
105
+ "@brust/core-cf": "2.0.0-alpha.17"
103
106
  }
104
107
  }
@@ -16,7 +16,7 @@ import { cssPlugin } from './css'
16
16
  import { BuildError } from './errors'
17
17
  import { isServerOnlyMarker, serverOnlyEmptyPlugin } from './server-only'
18
18
  import { RUNTIME_FEATURES } from './features'
19
- import { type ResolveTarget, resolveNative } from './esm-resolve'
19
+ import { RELATIVE_SPEC, type ResolveTarget, resolveNative } from './esm-resolve'
20
20
  import { packageDirOf } from './pkg-src'
21
21
 
22
22
  const REACT_EXTERNALS = ['react', 'react/*', 'react-dom', 'react-dom/*']
@@ -68,22 +68,25 @@ function visibleFrom(spec: string, from: string): boolean {
68
68
  * packages) resolve from `appRoot`, never from wherever `dist/` sits (an `--out-dir` outside the
69
69
  * app has no `node_modules` above it). `external` specifiers are left to Bun so they stay
70
70
  * external. `target`: the bundler target a package's own imports resolve for (F189). */
71
- export function sourceDirPlugin(sourceOf: SourceOf, appRoot: string, external: string[] = [], target: ResolveTarget = 'bun'): BunPlugin {
71
+ export function sourceDirPlugin(sourceOf: SourceOf, appRoot: string, external: string[] = [], target: ResolveTarget = 'bun', conditions?: string[]): BunPlugin {
72
+ // What the probe must share with the build it stands in for: target, define, conditions (F223); it runs from the app root (F221).
73
+ const probe = { appRoot, conditions }
72
74
  return {
73
75
  name: 'brust-source-dir',
74
76
  setup(b) {
75
- b.onResolve({ filter: /^\.\.?\// }, (a) => {
77
+ // `.` and `..` name a directory like `./x` does (F218): one filter, so none of them reaches a package branch.
78
+ b.onResolve({ filter: RELATIVE_SPEC }, (a) => {
76
79
  const src = sourceOf.get(a.importer)
77
80
  return src === undefined ? undefined : { path: Bun.resolveSync(a.path, dirname(src)) }
78
81
  })
79
82
  b.onResolve({ filter: /^[^./]/ }, (a) => {
80
83
  // A package source imported as itself (a React component revived from it): its bare imports are the package's.
81
84
  const own = sourceOf.has(a.importer) ? undefined : packageDirOf(a.importer)
82
- if (own !== undefined && !matchesExternal(a.path, external)) return { path: resolveNative(a.path, own, target, PRODUCTION) }
85
+ if (own !== undefined && !matchesExternal(a.path, external)) return { path: resolveNative(a.path, own, target, PRODUCTION, probe) }
83
86
  if (!sourceOf.has(a.importer) || matchesExternal(a.path, external)) return undefined
84
87
  // F153c: an artifact compiled from a package's source imports what that package sees.
85
88
  const pkg = packageDirOf(sourceOf.get(a.importer)!)
86
- if (pkg !== undefined) return { path: resolveNative(a.path, pkg, target, PRODUCTION) }
89
+ if (pkg !== undefined) return { path: resolveNative(a.path, pkg, target, PRODUCTION, probe) }
87
90
  // A package the staged file can see from where it sits resolves natively: the bundler then picks the package's ESM
88
91
  // entry (`module` / `exports.import`) and tree-shakes it. `Bun.resolveSync` answers with the CJS `main`, which
89
92
  // bundles the whole package (recharts: +85 KB gzip on the chart page). Packages only the app root sees (a staged
@@ -322,10 +325,22 @@ export async function buildRuntime(dist: string, ctx: BrowserCtx): Promise<Runti
322
325
  * printed (external: one runtime for every chunk). */
323
326
  export async function buildClientChunks(dist: string, compiled: Map<string, Compiled>, ctx: BrowserCtx, runtimeUrl: RuntimeUrls): Promise<Map<string, string>> {
324
327
  const entrypoints: string[] = []
328
+ const shared = new Map<string, string>()
325
329
  for (const c of compiled.values()) {
326
330
  if (c.clientJs === undefined) continue
327
331
  const file = join(dist, '.stage', 'client', `${c.id}.js`)
328
332
  write(file, c.clientJs)
333
+ // R34.124: a module several chunks import (a specialised clone's factory) is written once under its content name.
334
+ for (const m of c.clientModules ?? []) {
335
+ const mf = join(dist, '.stage', 'client', `${m.name}.js`)
336
+ const seen = shared.get(m.name)
337
+ if (seen !== undefined && seen !== m.code) throw new BuildError('client-module-collision', `two different client modules are named ${m.name}`)
338
+ if (seen === undefined) {
339
+ shared.set(m.name, m.code)
340
+ write(mf, m.code)
341
+ stage(ctx.sourceOf, mf, c)
342
+ }
343
+ }
329
344
  stage(ctx.sourceOf, file, c)
330
345
  entrypoints.push(file)
331
346
  }
@@ -334,10 +349,18 @@ export async function buildClientChunks(dist: string, compiled: Map<string, Comp
334
349
  entrypoints,
335
350
  splitting: true,
336
351
  external: ['/_brust/*'],
337
- plugins: [runtimeAliasPlugin(runtimeUrl), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser')],
352
+ plugins: [runtimeAliasPlugin(runtimeUrl), specModulePlugin(join(dist, '.stage', 'client')), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, [], 'browser')],
338
353
  })
339
354
  }
340
355
 
356
+ /** R34.124: `brust-spec:<name>` is a module several chunks share (a specialised clone's factory), written beside the chunks. */
357
+ function specModulePlugin(dir: string): BunPlugin {
358
+ return {
359
+ name: 'brust-spec-modules',
360
+ setup: (b) => void b.onResolve({ filter: /^brust-spec:/ }, (a) => ({ path: join(dir, `${a.path.slice('brust-spec:'.length)}.js`) })),
361
+ }
362
+ }
363
+
341
364
  /** Registers a written artifact (by its path and its real path: the importer Bun reports). */
342
365
  export function stage(sourceOf: SourceOf, file: string, c: Compiled): void {
343
366
  sourceOf.set(file, c.file)
@@ -502,7 +525,9 @@ export function exposePlugin(compiled: Map<string, Compiled>): BunPlugin {
502
525
  /** The island entry of a react-tier component: registers `(host, props) => …` under its id. A
503
526
  * `client_only` component was never server-rendered (its host is empty), so it mounts with
504
527
  * `createRoot`; hydrating it would fail (React #418). Everything else hydrates the SSR markup. */
505
- export function islandShim(c: Compiled, compiled?: Map<string, Compiled>, routeRoots?: ReadonlySet<string>): string {
528
+ /** `writers` (F230): app modules that write another module's exports when they load; imported first, so the island
529
+ * hydrates from what the app's React render saw. */
530
+ export function islandShim(c: Compiled, compiled?: Map<string, Compiled>, routeRoots?: ReadonlySet<string>, writers: string[] = []): string {
506
531
  const clientOnly = c.ir.tier?.React?.client_only === true
507
532
  const nested = compiled && nestedOf(compiled, c.id, routeRoots)
508
533
  const element = nested ? `__mk(Comp, props, ${JSON.stringify(xOf(compiled!, c.id))}, ${JSON.stringify(holesOf(compiled!, c.id))})` : 'createElement(Comp, props)'
@@ -518,12 +543,18 @@ export function islandShim(c: Compiled, compiled?: Map<string, Compiled>, routeR
518
543
  reviveSource(`{ ${comps.map((n, i) => `${JSON.stringify(n.id)}: N${i}`).join(', ')} }`)
519
544
  }
520
545
  return (
546
+ writerImports(writers) +
521
547
  `import { ${api} } from 'react-dom/client'\nimport { createElement } from 'react'\n${componentImport(c, 'Comp')}\n${head}` +
522
548
  `;((globalThis as any).__brustIslands ||= []).push([${JSON.stringify(c.id)}, (host: Element, props: any) => { ${mount} }])\n` +
523
549
  `;(globalThis as any).__brustIslandReady?.()\n`
524
550
  )
525
551
  }
526
552
 
553
+ /** F230: side-effect imports of the load-time writer modules (absolute paths), in a stable order. */
554
+ function writerImports(writers: string[]): string {
555
+ return [...new Set(writers)].map((w) => `import ${JSON.stringify(w)}\n`).join('')
556
+ }
557
+
527
558
  /** One island chunk per react-tier component (`react-<id>-<hex>.js`, contract 3), React split
528
559
  * into a shared chunk the island chunks import relatively. */
529
560
  /** The react-tier components that get an island entry: all of them, except a package export (S1.4: every member of a
@@ -541,11 +572,22 @@ export function islandEntries(compiled: Map<string, Compiled>): Compiled[] {
541
572
  return [...compiled.values()].filter((c) => isReact(c) && (!c.ir.external || placed.has(c.id)))
542
573
  }
543
574
 
544
- export async function buildReactChunks(dist: string, compiled: Map<string, Compiled>, ctx: BrowserCtx, runtimeUrl: RuntimeUrls, routeRoots?: ReadonlySet<string>): Promise<Map<string, string>> {
575
+ /** `writersFor` (F230): the load-time writer modules an island's chunk must import first, from the app files the
576
+ * island's code is (its component, and the components it revives); none when absent. */
577
+ export async function buildReactChunks(
578
+ dist: string,
579
+ compiled: Map<string, Compiled>,
580
+ ctx: BrowserCtx,
581
+ runtimeUrl: RuntimeUrls,
582
+ routeRoots?: ReadonlySet<string>,
583
+ writersFor?: (c: Compiled, files: string[]) => string[],
584
+ ): Promise<Map<string, string>> {
545
585
  const entrypoints: string[] = []
546
586
  for (const c of islandEntries(compiled)) {
547
587
  const file = join(dist, '.stage', 'react', `react-${c.id}.tsx`)
548
- write(file, islandShim(c, compiled, routeRoots))
588
+ const own = [c, ...(nestedOf(compiled, c.id, routeRoots) ?? []).flatMap((id) => compiled.get(id) ?? [])]
589
+ const files = own.filter((n) => !(n.ir.external ?? n.ir.dist)).map((n) => n.file)
590
+ write(file, islandShim(c, compiled, routeRoots, writersFor?.(c, files) ?? []))
549
591
  stage(ctx.sourceOf, file, c)
550
592
  entrypoints.push(file)
551
593
  }
@@ -635,8 +677,10 @@ export async function buildJobs(
635
677
  routeRoots?: ReadonlySet<string>,
636
678
  /** F183 (`reachedJobs`): only these entries are written; every one when absent. */
637
679
  reached?: { planned: ReadonlySet<string>; ssr: ReadonlySet<string> },
680
+ /** F230: app modules that write another module's exports when they load: imported first (see `islandShim`). */
681
+ writers: string[] = [],
638
682
  ): Promise<void> {
639
- const imports: string[] = ["import { createElement } from 'react'", "import { renderToString } from 'react-dom/server'"]
683
+ const imports: string[] = [writerImports(writers).trimEnd(), "import { createElement } from 'react'", "import { renderToString } from 'react-dom/server'"].filter((l) => l !== '')
640
684
  const entries: string[] = []
641
685
  const storePaths = [...new Set(stores)].sort()
642
686
  for (const [i, p] of storePaths.entries()) {
@@ -90,6 +90,9 @@ export interface CfBuildCtx {
90
90
  log: (s: string) => void
91
91
  }
92
92
 
93
+ /** The resolution conditions of the Worker bundle; the package-resolver probe (`sourceDirPlugin`) must carry the same (F223). */
94
+ export const CF_CONDITIONS = ['workerd', 'worker', 'browser']
95
+
93
96
  const CORE_SRC = join(import.meta.dir, '..')
94
97
  const BUILTINS = new Set(builtinModules.filter((m) => !m.startsWith('_')))
95
98
 
@@ -272,11 +275,11 @@ export async function buildCloudflare(out: string, ctx: CfBuildCtx, p: CfPrepare
272
275
  entrypoints: [entryPath],
273
276
  target: 'browser',
274
277
  format: 'esm',
275
- conditions: ['workerd', 'worker', 'browser'],
278
+ conditions: CF_CONDITIONS,
276
279
  define: PRODUCTION,
277
280
  minify: false,
278
281
  external: ['node:*', 'cloudflare:*', glueSpec],
279
- plugins: [serverOnlyEmptyPlugin(), cssPlugin(ctx.cssMaps ?? new Map()), cfGuard(ctx.appRoot, violations), cfAlias(p.cfg.alias, ctx.sourceOf), cfNativeStub(Bun.resolveSync('@brust/core/server-handlers', ctx.appRoot)), cfStorePlugin(ctx.appRoot), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, ['node:*', 'cloudflare:*']), exposePlugin(ctx.compiled)],
282
+ plugins: [serverOnlyEmptyPlugin(), cssPlugin(ctx.cssMaps ?? new Map()), cfGuard(ctx.appRoot, violations), cfAlias(p.cfg.alias, ctx.sourceOf), cfNativeStub(Bun.resolveSync('@brust/core/server-handlers', ctx.appRoot)), cfStorePlugin(ctx.appRoot), sourceDirPlugin(ctx.sourceOf, ctx.appRoot, ['node:*', 'cloudflare:*'], 'browser', CF_CONDITIONS), exposePlugin(ctx.compiled)],
280
283
  })
281
284
  if (violations.length > 0) throw new BuildError('cf-unsupported', `${[...new Set(violations)].join('\n')}\nthese modules do not exist on Cloudflare Workers; swap them with [cloudflare] alias`)
282
285
  if (!res.success) throw new BuildError('bundle', `cloudflare: ${res.logs.map(String).join('\n')}`)