@ecopages/core 0.2.0-alpha.53 → 0.2.0-alpha.55

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.
Files changed (58) hide show
  1. package/README.md +2 -3
  2. package/package.json +34 -14
  3. package/src/adapters/bun/server-adapter.d.ts +7 -0
  4. package/src/adapters/bun/server-adapter.js +8 -3
  5. package/src/adapters/node/server-adapter.d.ts +1 -1
  6. package/src/adapters/node/server-adapter.js +2 -4
  7. package/src/build/README.md +57 -73
  8. package/src/build/browser-runtime-plugin-helpers.d.ts +26 -0
  9. package/src/build/browser-runtime-plugin-helpers.js +14 -0
  10. package/src/build/browser-runtime-plugin.d.ts +78 -0
  11. package/src/build/{browser-runtime-import-rewrite-plugin.js → browser-runtime-plugin.js} +49 -42
  12. package/src/build/build-adapter.d.ts +350 -93
  13. package/src/build/build-adapter.js +61 -492
  14. package/src/build/build-manifest.js +3 -6
  15. package/src/build/build-types.d.ts +2 -2
  16. package/src/build/rolldown-build-adapter.d.ts +32 -0
  17. package/src/build/rolldown-build-adapter.js +260 -0
  18. package/src/build/rolldown-plugin-bridge.d.ts +50 -0
  19. package/src/build/rolldown-plugin-bridge.js +194 -0
  20. package/src/build/runtime-build-executor.d.ts +14 -7
  21. package/src/build/runtime-build-executor.js +8 -11
  22. package/src/build/runtime-build-output-normalizer.d.ts +3 -0
  23. package/src/build/runtime-build-output-normalizer.js +111 -0
  24. package/src/build/serialized-build-executor.d.ts +64 -0
  25. package/src/build/serialized-build-executor.js +63 -0
  26. package/src/build/server-side-css-shim-plugin.d.ts +41 -0
  27. package/src/build/server-side-css-shim-plugin.js +35 -0
  28. package/src/cache/index.d.ts +6 -0
  29. package/src/cache/index.js +6 -0
  30. package/src/cache/module-parse-cache.d.ts +65 -0
  31. package/src/cache/module-parse-cache.js +75 -0
  32. package/src/config/README.md +1 -1
  33. package/src/config/config-builder.d.ts +3 -3
  34. package/src/config/config-builder.js +5 -14
  35. package/src/eco/eco.types.d.ts +2 -5
  36. package/src/hmr/strategies/js-hmr-strategy.d.ts +2 -2
  37. package/src/hmr/strategies/js-hmr-strategy.js +2 -2
  38. package/src/plugins/alias-resolver-cache.d.ts +68 -0
  39. package/src/plugins/alias-resolver-cache.js +106 -0
  40. package/src/plugins/alias-resolver-plugin.d.ts +4 -1
  41. package/src/plugins/alias-resolver-plugin.js +9 -5
  42. package/src/plugins/eco-component-meta-plugin.js +2 -2
  43. package/src/plugins/foreign-jsx-override-plugin.d.ts +1 -1
  44. package/src/route-renderer/orchestration/render-output.utils.d.ts +1 -1
  45. package/src/services/assets/browser-bundle.service.d.ts +1 -1
  46. package/src/services/module-loading/app-module-loader.service.d.ts +1 -1
  47. package/src/services/module-loading/app-server-module-transpiler.service.js +8 -29
  48. package/src/services/module-loading/page-module-import.service.js +2 -0
  49. package/src/types/internal-types.d.ts +1 -1
  50. package/src/build/browser-runtime-import-rewrite-plugin.d.ts +0 -26
  51. package/src/build/dev-build-coordinator.d.ts +0 -72
  52. package/src/build/dev-build-coordinator.js +0 -154
  53. package/src/build/esbuild-build-adapter.d.ts +0 -79
  54. package/src/build/esbuild-build-adapter.js +0 -521
  55. package/src/build/runtime-specifier-alias-plugin.d.ts +0 -15
  56. package/src/build/runtime-specifier-alias-plugin.js +0 -31
  57. package/src/services/module-loading/node-bootstrap-plugin.d.ts +0 -38
  58. package/src/services/module-loading/node-bootstrap-plugin.js +0 -215
@@ -1,59 +1,179 @@
1
+ /**
2
+ * Build pipeline contracts and app-owned adapter wiring.
3
+ *
4
+ * @remarks
5
+ * The build layer exposes three concentric shapes:
6
+ *
7
+ * - `BuildAdapter` — the low-level backend contract. Two implementations
8
+ * exist: a bundler-backed adapter (the real backend) and
9
+ * {@link ViteHostBuildAdapter} (a host-owned boundary marker that throws
10
+ * on direct use, for host runtimes that own their own build pipeline).
11
+ * - `BuildExecutor` — the runtime-facing facade stored on
12
+ * `appConfig.runtime.buildExecutor`. It is intentionally narrower than
13
+ * `BuildAdapter` so callers that only need to issue builds do not depend
14
+ * on `resolve` / `getTranspileOptions`.
15
+ * - App-owned helpers (`getAppBuildAdapter`, `getAppBuildExecutor`, and
16
+ * the `set*` counterparts) — the supported way for runtime code to read
17
+ * and mutate the active adapter per `EcoPagesAppConfig`.
18
+ */
1
19
  import type { EcoBuildPlugin } from './build-types.js';
2
20
  import { type AppBuildManifest } from './build-manifest.js';
3
21
  import type { EcoPagesAppConfig } from '../types/internal-types.js';
4
22
  import type { IHmrManager } from '../types/public-types.js';
5
- export { EsbuildBuildAdapter } from './esbuild-build-adapter.js';
6
- export type BuildOwnership = 'bun-native' | 'vite-host';
23
+ /**
24
+ * Which backend owns the app's build pipeline.
25
+ *
26
+ * - `'rolldown'`: the default. Ecopages runs the build directly through
27
+ * its bundler-backed adapter.
28
+ * - `'vite-host'`: a host runtime owns the build. {@link ViteHostBuildAdapter}
29
+ * is exposed as a boundary marker; any direct call into it throws.
30
+ */
31
+ export type BuildOwnership = 'vite-host' | 'rolldown';
32
+ /**
33
+ * A single message emitted by the build backend.
34
+ *
35
+ * @remarks
36
+ * Today this only carries `message`. Severity and structured fields
37
+ * belong in a future schema bump; the current shape mirrors the
38
+ * bundler's log output 1:1.
39
+ */
7
40
  export interface BuildLog {
8
41
  message: string;
9
42
  }
43
+ /**
44
+ * A single artifact emitted by the build backend.
45
+ *
46
+ * @remarks
47
+ * `path` is the absolute on-disk path of the emitted file. For
48
+ * filename templates that include a content-hash token, the bundler
49
+ * returns the concrete resolved path (not the template), so callers
50
+ * can read the file directly.
51
+ */
10
52
  export interface BuildOutput {
11
53
  path: string;
12
54
  }
13
55
  /**
14
- * Dependency graph metadata produced by a build backend.
56
+ * Per-entrypoint dependency metadata surfaced alongside a build.
15
57
  *
16
58
  * @remarks
17
- * This structure is runtime-neutral at the type level, but current population
18
- * is Node/esbuild-only. Bun-backed builds may omit this metadata.
59
+ * Populated from the bundler's per-chunk module list and exposed as a
60
+ * normalized absolute-path map. Consumers (HMR invalidation, the build
61
+ * manifest) read this without needing to know which adapter produced
62
+ * it. The shape is preserved across adapters so historical callers
63
+ * continue to compile.
19
64
  */
20
65
  export interface BuildDependencyGraph {
21
66
  /**
22
- * Normalized absolute entrypoint path mapped to all normalized absolute
23
- * source inputs that contributed to that entrypoint output.
67
+ * Normalized absolute entrypoint path mapped to every normalized
68
+ * absolute source input that contributed to that entrypoint's
69
+ * output, including the entrypoint itself.
24
70
  */
25
71
  entrypoints: Record<string, string[]>;
26
72
  }
73
+ /**
74
+ * The full result of one `BuildAdapter.build` call.
75
+ *
76
+ * @remarks
77
+ * `success === false` means the build failed and `outputs` will be
78
+ * empty. Inspect `logs` for the error message; the original `Error` is
79
+ * already normalized into `BuildLog` shape.
80
+ */
27
81
  export interface BuildResult {
28
82
  success: boolean;
29
83
  logs: BuildLog[];
30
84
  outputs: BuildOutput[];
31
85
  /**
32
- * Optional build dependency metadata for selective invalidation.
33
- *
34
- * @remarks
35
- * This is currently filled by the Node/esbuild adapter. Other runtimes should
36
- * treat missing graph data as a valid state and fall back deterministically.
86
+ * Per-entrypoint dependency metadata, when the backend produced it.
87
+ * Some backends (notably the Vite-host boundary marker) leave this
88
+ * undefined; callers must treat that as a valid state and fall
89
+ * back deterministically.
37
90
  */
38
91
  dependencyGraph?: BuildDependencyGraph;
39
92
  }
93
+ /**
94
+ * Options accepted by every `BuildAdapter.build` call.
95
+ *
96
+ * @remarks
97
+ * Fields that the adapter can forward are honored; fields that cannot
98
+ * (currently `splitting`, `bundle`, and `outbase`) are accepted so
99
+ * call-sites compile, but the adapter ignores them. See each field's
100
+ * docstring for the current behavior.
101
+ */
40
102
  export interface BuildOptions {
41
- entrypoints: string[];
103
+ /**
104
+ * Absolute or context-root-relative source files that begin the build graph.
105
+ *
106
+ * Use a record (key → source path) when the caller needs to control chunk
107
+ * names. Keys become the `[name]` token in `naming`, which lets the caller
108
+ * embed path information that the bundler would otherwise strip.
109
+ */
110
+ entrypoints: string[] | Record<string, string>;
111
+ /** Output directory. Defaults to `dist/assets` when omitted. */
42
112
  outdir?: string;
113
+ /**
114
+ * Base directory for `[dir]` placeholders in `naming`. Currently
115
+ * the bundled adapter derives the base from `root` directly and
116
+ * ignores this field.
117
+ */
43
118
  outbase?: string;
119
+ /**
120
+ * Filename pattern for entrypoints. The bundled adapter honors
121
+ * `[name]`, `[hash]`, and `[ext]`. The `[dir]` token is stripped
122
+ * before forwarding to the bundler (rolldown does not implement it);
123
+ * callers that need directory structure preserved should use the
124
+ * record form of `entrypoints` so each key becomes its own chunk.
125
+ * When omitted, the bundler's default applies.
126
+ */
44
127
  naming?: string;
128
+ /**
129
+ * Package export conditions to honor during resolution
130
+ * (e.g. `['import', 'browser', 'default']`).
131
+ */
45
132
  conditions?: string[];
133
+ /**
134
+ * Global identifier replacements. Honored by the bundled adapter.
135
+ */
46
136
  define?: Record<string, string>;
137
+ /** Run the bundler's minifier. Off by default. */
47
138
  minify?: boolean;
139
+ /** Enable the bundler's tree-shaker. Defaults to `true`. */
48
140
  treeshaking?: boolean;
141
+ /**
142
+ * Output target family. Accepted values: `'browser'`, `'node'`,
143
+ * anything else falls through to a platform-neutral setup.
144
+ */
49
145
  target?: string;
146
+ /** Output module format. Accepted: `'esm'`, `'cjs'`, `'iife'`. */
50
147
  format?: string;
148
+ /**
149
+ * Source map mode. Accepted: `'none'`, `'inline'`, `'external'`,
150
+ * `'linked'`. Anything else maps to the bundler's default (linked).
151
+ */
51
152
  sourcemap?: string;
153
+ /**
154
+ * Historical code-splitting flag. Currently a no-op on the bundled
155
+ * adapter: the bundler splits by default and this flag is not
156
+ * forwarded. See the per-chunk naming convention in the adapter for
157
+ * the available control.
158
+ */
52
159
  splitting?: boolean;
160
+ /** Project root used to resolve relative paths and the tsconfig lookup. */
53
161
  root?: string;
162
+ /**
163
+ * Historical bundle flag. Currently a no-op on the bundled adapter:
164
+ * the bundler always bundles. Accepted so call-sites compile.
165
+ */
54
166
  bundle?: boolean;
167
+ /**
168
+ * Treat `node_modules` packages as external. Honored by the bundled
169
+ * adapter.
170
+ */
55
171
  externalPackages?: boolean;
172
+ /** Explicit list of module specifiers to leave as external imports. */
56
173
  external?: string[];
174
+ /**
175
+ * JSX runtime configuration. Mirrors the bundler's `jsx` option shape.
176
+ */
57
177
  jsx?: {
58
178
  development?: boolean;
59
179
  factory?: string;
@@ -62,151 +182,266 @@ export interface BuildOptions {
62
182
  runtime?: 'classic' | 'automatic';
63
183
  sideEffects?: boolean;
64
184
  };
185
+ /**
186
+ * Runtime-agnostic `EcoBuildPlugin[]` to attach to this build. The
187
+ * bundled adapter translates the array via the rolldown plugin
188
+ * bridge.
189
+ */
65
190
  plugins?: EcoBuildPlugin[];
191
+ /**
192
+ * Escape hatch for backends that need to forward unknown options
193
+ * to their underlying driver. Consumers should prefer the typed
194
+ * fields above.
195
+ */
66
196
  [key: string]: unknown;
67
197
  }
198
+ /** Stable profile identifiers for `BuildAdapter.getTranspileOptions`. */
68
199
  export type BuildTranspileProfile = 'browser-script' | 'hmr-runtime' | 'hmr-entrypoint';
200
+ /**
201
+ * Resolved transpile settings for a given profile.
202
+ *
203
+ * @remarks
204
+ * The three fields map 1:1 to the trio the HMR and browser-script
205
+ * code paths look at: target platform, output format, and source-map
206
+ * mode. Today the bundled adapter returns identical defaults for all
207
+ * three profiles; the type is kept open so per-profile tuning can
208
+ * land without breaking callers.
209
+ */
69
210
  export interface BuildTranspileOptions {
70
211
  target: string;
71
212
  format: string;
72
213
  sourcemap: string;
73
214
  }
215
+ /**
216
+ * Low-level build backend contract.
217
+ *
218
+ * @remarks
219
+ * One instance is owned by each `EcoPagesAppConfig` (see
220
+ * {@link getAppBuildAdapter}). Two implementations exist: the bundled
221
+ * adapter does the work; {@link ViteHostBuildAdapter} is a host-owned
222
+ * boundary marker that throws on direct use.
223
+ */
74
224
  export interface BuildAdapter {
225
+ /** Which backend owns this adapter. Used for routing decisions in app helpers. */
75
226
  readonly ownership?: BuildOwnership;
76
227
  /**
77
- * Executes one concrete backend build.
228
+ * Run one build.
78
229
  *
79
230
  * @remarks
80
- * `BuildAdapter` is the low-level backend contract. Bun-native execution owns
81
- * one adapter directly; Vite-hosted execution is represented as an explicit
82
- * host-owned compatibility path rather than an implicit esbuild default.
231
+ * Implementations are expected to be safe to call from any caller.
232
+ * Concurrent calls are not guaranteed to be serialized by the
233
+ * adapter itself; the dev-watch pipeline wraps the adapter in
234
+ * {@link SerializedBuildExecutor} when it needs FIFO ordering.
235
+ *
236
+ * Returns a `BuildResult` with `success: false` on failure; the
237
+ * thrown-error variant (`buildOrThrow`) is reserved for callers
238
+ * that need the original `Error` object.
83
239
  */
84
240
  build(options: BuildOptions): Promise<BuildResult>;
241
+ /**
242
+ * Resolve a module specifier against the project's `rootDir`.
243
+ *
244
+ * @remarks
245
+ * Used by the source-loading services when they need to know the
246
+ * absolute path of a specifier without performing a full build.
247
+ */
85
248
  resolve(importPath: string, rootDir: string): string;
249
+ /**
250
+ * Resolve transpile settings for a known profile.
251
+ *
252
+ * @remarks
253
+ * Today the bundled adapter returns identical defaults for all
254
+ * profiles. The profile argument is kept so per-profile tuning
255
+ * can land without breaking callers.
256
+ */
86
257
  getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
87
258
  }
88
259
  /**
89
- * Runtime-owned facade for issuing builds.
260
+ * Runtime-facing facade for issuing builds.
90
261
  *
91
262
  * @remarks
92
- * This is intentionally narrower than `BuildAdapter`. A build executor answers
93
- * only the question "how should this app execute a build right now?".
263
+ * Strictly narrower than {@link BuildAdapter}: it only exposes `build`.
264
+ * This is the shape stored on `appConfig.runtime.buildExecutor` and
265
+ * passed across the dev-watch and server-module-loading seams, so
266
+ * callers cannot accidentally depend on `resolve` or
267
+ * `getTranspileOptions`.
94
268
  *
95
- * In Bun-native production and non-watch flows the executor is usually the
96
- * adapter itself. In development watch flows the executor may be a
97
- * compatibility coordinator around the Bun-native adapter while the Vite host
98
- * path continues migrating toward host-owned execution.
269
+ * In production and non-watch flows the executor is the adapter
270
+ * itself. In development watch flows the executor is a
271
+ * {@link SerializedBuildExecutor} wrapping the adapter so dev-watch
272
+ * pipelines are FIFO-serialized.
99
273
  */
100
274
  export interface BuildExecutor {
101
275
  build(options: BuildOptions): Promise<BuildResult>;
102
276
  }
103
- export declare class BunBuildAdapter implements BuildAdapter {
104
- readonly ownership: "bun-native";
105
- private readonly fallbackAdapter;
106
- private getPluginsForBuild;
107
- private escapeRegExp;
108
- private resolvePluginPath;
109
- private inferLoaderFromPath;
110
- private normalizeBunLoader;
111
- private convertLoadResultToModuleSource;
112
- private convertPluginOnLoadResult;
113
- private createEcoPluginBridge;
114
- private toBuildLogs;
115
- private mapBunTarget;
116
- private mapBunFormat;
117
- private getOutputExtension;
118
- private resolveConcreteOutputPath;
119
- private normalizePathForMatch;
120
- private normalizeOutputPathForMatch;
121
- private extractTemplateHashTokens;
122
- private applyTemplateHashTokens;
123
- private resolveTemplatedOutputPath;
124
- private relocateOutputFile;
125
- private hasJavaScriptExtension;
126
- private rewriteBrowserRuntimeImportsInOutputs;
127
- private findOutputMatchForEntrypoint;
128
- private normalizeBunOutputs;
129
- build(options: BuildOptions): Promise<BuildResult>;
130
- resolve(importPath: string, rootDir: string): string;
131
- getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
132
- }
277
+ /**
278
+ * Wraps a {@link BuildExecutor} so each call to `build` receives the
279
+ * union of the caller's `options.plugins` and the plugins sourced
280
+ * from `getPlugins()`.
281
+ *
282
+ * @remarks
283
+ * The single point of plugin injection in the runtime path: the
284
+ * `ConfigBuilder` stores a raw adapter on
285
+ * `appConfig.runtime.buildAdapter` and the
286
+ * `installAppRuntimeBuildExecutor` step wraps that adapter with this
287
+ * helper. Callers that issue builds against
288
+ * `appConfig.runtime.buildExecutor` get the merged plugin set without
289
+ * further ceremony.
290
+ */
291
+ export declare function withBuildExecutorPlugins(executor: BuildExecutor, getPlugins: () => EcoBuildPlugin[]): BuildExecutor;
292
+ /**
293
+ * Boundary-marker adapter for Vite-host ownership.
294
+ *
295
+ * @remarks
296
+ * This is not a real backend. It exists so `appConfig.runtime.buildAdapter`
297
+ * can carry the `'vite-host'` ownership without falling back to a
298
+ * framework-owned bundler path. Every method throws a
299
+ * {@link createHostOwnedBuildError} so misrouted calls fail loudly
300
+ * with a clear message instead of silently executing under a
301
+ * different backend.
302
+ *
303
+ * The class stays in the public surface for host runtimes that own
304
+ * their build pipeline (e.g. Nitro) and for app code that wants to
305
+ * opt into host-owned ownership before its host wires up the build.
306
+ */
133
307
  export declare class ViteHostBuildAdapter implements BuildAdapter {
134
308
  readonly ownership: "vite-host";
135
309
  build(_options: BuildOptions): Promise<BuildResult>;
136
310
  resolve(_importPath: string, _rootDir: string): string;
137
311
  getTranspileOptions(_profile: BuildTranspileProfile): BuildTranspileOptions;
138
312
  }
139
- export declare function createBunBuildAdapter(): BuildAdapter;
313
+ /**
314
+ * Constructs a {@link ViteHostBuildAdapter}. Use only in code paths
315
+ * that explicitly opt into the host-owned boundary.
316
+ */
140
317
  export declare function createViteHostBuildAdapter(): BuildAdapter;
318
+ /**
319
+ * Constructs a build adapter for the given ownership.
320
+ *
321
+ * @param options - When `options.ownership` is omitted, the default is
322
+ * `'rolldown'`. The Vite-host path is opt-in.
323
+ */
141
324
  export declare function createBuildAdapter(options?: {
142
325
  ownership?: BuildOwnership;
143
326
  }): BuildAdapter;
144
- export declare const defaultBunBuildAdapter: BuildAdapter;
327
+ /** The shared default-bundler backend instance. Use {@link getAppBuildAdapter} in app-aware code. */
328
+ export declare const defaultRolldownBuildAdapter: BuildAdapter;
329
+ /** The shared Vite-host boundary instance. Use {@link getAppBuildAdapter} in app-aware code. */
145
330
  export declare const defaultViteHostBuildAdapter: BuildAdapter;
146
331
  /**
147
- * Bun-native fallback export for callsites that still resolve build state
148
- * globally.
332
+ * Global default build adapter.
149
333
  *
150
- * New app-aware code should prefer `getAppBuildAdapter()`.
334
+ * @remarks
335
+ * Resolves to the bundled default-bundler adapter. New app-aware
336
+ * code should prefer {@link getAppBuildAdapter}.
151
337
  */
152
338
  export declare const defaultBuildAdapter: BuildAdapter;
339
+ /**
340
+ * Resolves the default build adapter for an ownership value.
341
+ *
342
+ * @param ownership - Defaults to `'rolldown'`. Returns the
343
+ * {@link ViteHostBuildAdapter} only when the caller explicitly asks
344
+ * for `'vite-host'`.
345
+ */
153
346
  export declare function getDefaultBuildAdapter(ownership?: BuildOwnership): BuildAdapter;
347
+ /**
348
+ * Reads the {@link BuildOwnership} declared on a {@link BuildAdapter}.
349
+ *
350
+ * @param buildAdapter - When `undefined`, defaults to `'rolldown'`.
351
+ */
154
352
  export declare function getBuildAdapterOwnership(buildAdapter: BuildAdapter | undefined): BuildOwnership;
353
+ /**
354
+ * Resolves the build ownership of an app config.
355
+ *
356
+ * @remarks
357
+ * Resolution order: `appConfig.runtime.buildOwnership` (explicit), then
358
+ * the ownership declared on `appConfig.runtime.buildAdapter`, then the
359
+ * default `'rolldown'`.
360
+ */
155
361
  export declare function getAppBuildOwnership(appConfig: EcoPagesAppConfig): BuildOwnership;
362
+ /**
363
+ * Sets the explicit build ownership on an app config.
364
+ *
365
+ * @remarks
366
+ * The `ConfigBuilder` uses this when the caller calls
367
+ * `setBuildOwnership`. App code that needs a different ownership
368
+ * should call this directly with a new value; passing the same
369
+ * value is a no-op.
370
+ */
156
371
  export declare function setAppBuildOwnership(appConfig: EcoPagesAppConfig, buildOwnership: BuildOwnership): void;
157
372
  /**
158
373
  * Returns the adapter owned by an app/runtime instance.
159
374
  *
160
375
  * @remarks
161
- * The config builder installs an explicit adapter per app. The Bun-native
162
- * fallback remains only as compatibility scaffolding for helpers that do not
163
- * yet thread app runtime state explicitly.
376
+ * Falls back through `appConfig.runtime.buildAdapter`
377
+ * {@link getDefaultBuildAdapter} on the resolved ownership. Throws
378
+ * never; a missing adapter resolves to the global default.
164
379
  */
165
380
  export declare function getAppBuildAdapter(appConfig: EcoPagesAppConfig): BuildAdapter;
166
381
  /**
167
- * Installs the adapter that should serve future builds for one app instance.
382
+ * Installs the adapter that should serve future builds for one app
383
+ * instance, and aligns the ownership field to the new adapter's
384
+ * declared ownership.
168
385
  */
169
386
  export declare function setAppBuildAdapter(appConfig: EcoPagesAppConfig, buildAdapter: BuildAdapter): void;
170
387
  /**
171
388
  * Returns the build manifest owned by an app/runtime instance.
389
+ *
390
+ * @remarks
391
+ * Falls back to a fresh manifest seeded from the config's loaders when
392
+ * the app config has no manifest yet. This is the supported way to
393
+ * read the manifest across the source-loading and asset-processing
394
+ * services.
172
395
  */
173
396
  export declare function getAppBuildManifest(appConfig: EcoPagesAppConfig): AppBuildManifest;
174
- /**
175
- * Installs the build manifest that should be visible to one app instance.
176
- */
397
+ /** Installs the build manifest that should be visible to one app instance. */
177
398
  export declare function setAppBuildManifest(appConfig: EcoPagesAppConfig, buildManifest: AppBuildManifest): void;
178
399
  /**
179
- * Rebuilds an app-owned manifest from config-owned loaders plus explicit
180
- * runtime/browser contribution input.
400
+ * Builds a fresh app manifest from the config's loaders plus optional
401
+ * caller-supplied runtime/browser contributions.
181
402
  *
182
403
  * @remarks
183
- * This keeps loader ownership with config finalization while still letting a
184
- * caller supply the non-loader plugin buckets that were discovered elsewhere.
404
+ * Loader plugins are always taken from the config; runtime and
405
+ * browser-bundle plugins are passed through from the caller when
406
+ * supplied, otherwise left empty for later population by
407
+ * {@link collectConfiguredAppBuildManifestContributions}.
185
408
  */
186
409
  export declare function createConfiguredAppBuildManifest(appConfig: EcoPagesAppConfig, input?: Partial<AppBuildManifest>): AppBuildManifest;
187
410
  /**
188
- * Replaces the app-owned manifest using config-owned loaders and explicit
189
- * contribution input.
411
+ * Replaces the app-owned manifest using config-owned loaders and the
412
+ * caller-supplied contribution input.
190
413
  */
191
414
  export declare function updateAppBuildManifest(appConfig: EcoPagesAppConfig, input?: Partial<AppBuildManifest>): void;
192
415
  /**
193
- * Collects the build-facing processor and integration contributions that should
194
- * be sealed into the app manifest during config finalization.
416
+ * Collects the build-facing processor and integration contributions
417
+ * that should be sealed into the app manifest during config
418
+ * finalization.
195
419
  *
196
420
  * @remarks
197
- * This runs `prepareBuildContributions()` only. Runtime-only side effects such
198
- * as HMR registration, cache prewarming, and runtime-origin wiring belong to
199
- * the startup path and must not be triggered here.
421
+ * Runs `prepareBuildContributions()` on every processor and
422
+ * integration. Runtime-only side effects (HMR registration, cache
423
+ * prewarming, runtime-origin wiring) belong to the startup path and
424
+ * must not be triggered here; use {@link setupAppRuntimePlugins} for
425
+ * those.
426
+ *
427
+ * @returns The new manifest's runtime / browser / browser-runtime-manifest
428
+ * contribution buckets. Caller seals them into a manifest via
429
+ * {@link updateAppBuildManifest}.
200
430
  */
201
431
  export declare function collectConfiguredAppBuildManifestContributions(appConfig: EcoPagesAppConfig): Promise<Pick<AppBuildManifest, 'runtimePlugins' | 'browserBundlePlugins' | 'browserRuntimeManifest'>>;
202
432
  /**
203
- * Runs runtime-only processor and integration setup against an already sealed
204
- * app manifest.
433
+ * Runs runtime-only processor and integration setup against an already
434
+ * sealed app manifest.
205
435
  *
206
436
  * @remarks
207
- * Startup paths call this after config build has finalized manifest
208
- * contributions. The manifest is reused as-is; this helper only performs the
209
- * runtime side effects that still need live startup context.
437
+ * Startup paths call this after `ConfigBuilder.build` has finalized
438
+ * the manifest. The manifest is reused as-is; this helper only performs
439
+ * the runtime side effects that need live startup context (cache
440
+ * prewarming, runtime-origin wiring, HMR manager attachment).
441
+ *
442
+ * Loaders, processors, and integrations are visited in that order;
443
+ * each one's plugins are forwarded to the optional `onRuntimePlugin`
444
+ * callback so callers can attach to every plugin discovered.
210
445
  */
211
446
  export declare function setupAppRuntimePlugins(options: {
212
447
  appConfig: EcoPagesAppConfig;
@@ -214,34 +449,56 @@ export declare function setupAppRuntimePlugins(options: {
214
449
  hmrManager?: IHmrManager;
215
450
  onRuntimePlugin?: (plugin: EcoBuildPlugin) => void;
216
451
  }): Promise<void>;
452
+ /**
453
+ * Returns the server-bundle plugin list for one app/runtime instance.
454
+ *
455
+ * @remarks
456
+ * Reads from the app's sealed build manifest; the manifest itself is
457
+ * the source of truth for which plugins participate in the server
458
+ * bundle.
459
+ */
217
460
  export declare function getAppServerBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[];
461
+ /**
462
+ * Returns the browser-bundle plugin list for one app/runtime instance.
463
+ *
464
+ * @remarks
465
+ * Reads from the app's sealed build manifest. The browser-bundle
466
+ * manifest is the source of truth for which plugins participate in the
467
+ * browser bundle.
468
+ */
218
469
  export declare function getAppBrowserBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[];
219
470
  /**
220
471
  * Returns the executor owned by an app/runtime instance.
221
472
  *
222
473
  * @remarks
223
- * The config builder seeds this with the app-owned adapter. Runtime adapters
224
- * may replace it with a compatibility coordinator while keeping ownership tied
225
- * to the same Bun-native backend.
474
+ * Falls back to {@link getAppBuildAdapter} when no executor is set
475
+ * on the runtime yet. The dev-watch pipeline replaces this value with
476
+ * a {@link SerializedBuildExecutor} via
477
+ * {@link installAppRuntimeBuildExecutor}.
226
478
  */
227
479
  export declare function getAppBuildExecutor(appConfig: EcoPagesAppConfig): BuildExecutor;
228
- /**
229
- * Installs the executor that should serve future builds for one app instance.
230
- */
480
+ /** Installs the executor that should serve future builds for one app instance. */
231
481
  export declare function setAppBuildExecutor(appConfig: EcoPagesAppConfig, buildExecutor: BuildExecutor): void;
232
482
  /**
233
483
  * Runs a build through the active pipeline.
234
484
  *
235
485
  * @remarks
236
- * Callers can pass an explicit executor when builds should be routed through an
237
- * app-owned development coordinator. Without one, the Bun-native default
238
- * adapter is used directly.
486
+ * `executor` defaults to the default-bundler adapter for non-app-aware
487
+ * callsites. App-aware code should pass
488
+ * `getAppBuildExecutor(appConfig)` (or read it directly) to honor the
489
+ * per-app pipeline.
239
490
  */
240
491
  export declare function build(options: BuildOptions, executor?: BuildExecutor): Promise<BuildResult>;
241
492
  /**
242
- * Bun-native fallback helper for callsites without app runtime context.
493
+ * Default transpile-options helper for callsites without app runtime
494
+ * context.
243
495
  *
244
- * New app-aware code should prefer `getAppTranspileOptions()`.
496
+ * @remarks
497
+ * New app-aware code should prefer {@link getAppTranspileOptions}.
245
498
  */
246
499
  export declare function getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
500
+ /**
501
+ * Resolves transpile options for one app/runtime instance by asking
502
+ * the app's adapter.
503
+ */
247
504
  export declare function getAppTranspileOptions(appConfig: EcoPagesAppConfig, profile: BuildTranspileProfile): BuildTranspileOptions;