@ecopages/core 0.2.0-rc.1 → 0.2.0-rc.11

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 (278) hide show
  1. package/README.md +50 -41
  2. package/package.json +50 -145
  3. package/src/adapters/README.md +11 -3
  4. package/src/adapters/abstract/application-adapter.d.ts +32 -36
  5. package/src/adapters/abstract/application-adapter.js +61 -47
  6. package/src/adapters/abstract/segment-path-matcher.js +56 -38
  7. package/src/adapters/abstract/server-adapter.d.ts +14 -0
  8. package/src/adapters/abstract/server-adapter.js +10 -0
  9. package/src/adapters/abstract/ws-pattern-matcher.d.ts +0 -5
  10. package/src/adapters/abstract/ws-pattern-matcher.js +0 -9
  11. package/src/adapters/bun/create-app.d.ts +15 -15
  12. package/src/adapters/bun/create-app.js +52 -67
  13. package/src/adapters/bun/hmr-manager.d.ts +0 -1
  14. package/src/adapters/bun/hmr-manager.js +2 -4
  15. package/src/adapters/bun/server-adapter.d.ts +15 -21
  16. package/src/adapters/bun/server-adapter.js +33 -67
  17. package/src/adapters/bun/static-preview-host.d.ts +1 -0
  18. package/src/adapters/bun/static-preview-host.js +1 -1
  19. package/src/adapters/create-app.d.ts +63 -8
  20. package/src/adapters/create-app.js +62 -5
  21. package/src/adapters/node/create-app.d.ts +8 -12
  22. package/src/adapters/node/create-app.js +22 -14
  23. package/src/adapters/node/runtime-host.d.ts +10 -10
  24. package/src/adapters/node/runtime-host.js +13 -8
  25. package/src/adapters/node/server-adapter-dependencies.d.ts +2 -10
  26. package/src/adapters/node/server-adapter-dependencies.js +8 -13
  27. package/src/adapters/node/server-adapter.d.ts +30 -32
  28. package/src/adapters/node/server-adapter.js +59 -65
  29. package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +0 -4
  30. package/src/adapters/shared/hmr/shared-hmr-manager.js +0 -12
  31. package/src/adapters/shared/http/api-request-pipeline.d.ts +27 -1
  32. package/src/adapters/shared/http/api-request-pipeline.js +31 -16
  33. package/src/adapters/shared/http/explicit-static-route-matcher.js +5 -2
  34. package/src/adapters/shared/http/fs-server-response-factory.d.ts +2 -9
  35. package/src/adapters/shared/http/fs-server-response-factory.js +5 -33
  36. package/src/adapters/shared/http/fs-server-response-matcher.d.ts +24 -24
  37. package/src/adapters/shared/http/fs-server-response-matcher.js +59 -83
  38. package/src/adapters/shared/runtime/application-adapter.d.ts +1 -0
  39. package/src/adapters/shared/runtime/application-adapter.js +12 -0
  40. package/src/adapters/shared/runtime/bind-runtime-server.d.ts +17 -0
  41. package/src/adapters/shared/runtime/bind-runtime-server.js +50 -0
  42. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.d.ts +1 -3
  43. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.js +1 -4
  44. package/src/adapters/shared/runtime/port-manager-default-prompt.d.ts +6 -0
  45. package/src/adapters/shared/runtime/port-manager-default-prompt.js +41 -0
  46. package/src/adapters/shared/runtime/port-manager.d.ts +3 -3
  47. package/src/adapters/shared/runtime/port-manager.js +14 -45
  48. package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +0 -10
  49. package/src/adapters/shared/runtime/runtime-app-bootstrap.js +0 -7
  50. package/src/adapters/shared/runtime/runtime-host.d.ts +5 -2
  51. package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +1 -1
  52. package/src/adapters/shared/runtime/runtime-server-lifecycle.js +1 -1
  53. package/src/adapters/shared/runtime/server-adapter.d.ts +27 -5
  54. package/src/adapters/shared/runtime/server-adapter.js +44 -30
  55. package/src/adapters/shared/runtime/server-route-handler.js +11 -3
  56. package/src/adapters/shared/runtime/server-static-builder.d.ts +9 -3
  57. package/src/adapters/shared/runtime/server-static-builder.js +59 -37
  58. package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +9 -1
  59. package/src/adapters/shared/ws/node-http-websocket-upgrades.js +8 -2
  60. package/src/build/README.md +9 -6
  61. package/src/build/cache/cache-constants.d.ts +0 -2
  62. package/src/build/cache/cache-constants.js +0 -2
  63. package/src/build/cache/cache-keys.d.ts +0 -2
  64. package/src/build/cache/cache-keys.js +0 -2
  65. package/src/build/cache/output-imports.d.ts +27 -0
  66. package/src/build/cache/output-imports.js +80 -0
  67. package/src/build/cache/pages-unified-graph-build.d.ts +6 -1
  68. package/src/build/cache/pages-unified-graph-build.js +42 -17
  69. package/src/build/cache/production-build-cache.d.ts +2 -2
  70. package/src/build/cache/production-build-cache.js +2 -2
  71. package/src/build/cache/server-entry-build-cache.d.ts +25 -3
  72. package/src/build/cache/server-entry-build-cache.js +129 -13
  73. package/src/build/contracts/build-contracts.d.ts +1 -13
  74. package/src/build/contracts/content-virtual-modules.d.ts +3 -1
  75. package/src/build/contracts/content-virtual-modules.js +8 -0
  76. package/src/build/rolldown/rolldown-adapter-helpers.js +41 -25
  77. package/src/build/rolldown/rolldown-plugin-bridge.js +25 -21
  78. package/src/build/rolldown/runtime-build-output-normalizer.js +3 -6
  79. package/src/build/runtime/build-request-identity.d.ts +2 -6
  80. package/src/build/runtime/build-request-identity.js +2 -8
  81. package/src/build/runtime/build-request-policy.js +1 -1
  82. package/src/build/runtime/deduping-build-executor.d.ts +0 -1
  83. package/src/build/runtime/deduping-build-executor.js +0 -1
  84. package/src/build/server-bundle-publication.d.ts +14 -0
  85. package/src/build/server-bundle-publication.js +49 -0
  86. package/src/cache/index.d.ts +1 -1
  87. package/src/cache/index.js +1 -1
  88. package/src/cache/module-parse-cache.d.ts +2 -29
  89. package/src/cache/module-parse-cache.js +6 -39
  90. package/src/config/README.md +17 -2
  91. package/src/config/apply-user-config.d.ts +8 -0
  92. package/src/config/apply-user-config.js +68 -0
  93. package/src/config/config-builder.d.ts +11 -1
  94. package/src/config/config-builder.js +53 -12
  95. package/src/config/constants.d.ts +4 -4
  96. package/src/config/constants.js +4 -4
  97. package/src/config/define-config.d.ts +9 -0
  98. package/src/config/define-config.js +10 -0
  99. package/src/config/index.d.ts +5 -0
  100. package/src/config/index.js +4 -0
  101. package/src/config/is-finalized-app-config.d.ts +6 -0
  102. package/src/config/is-finalized-app-config.js +11 -0
  103. package/src/config/load-eco-config.d.ts +21 -0
  104. package/src/config/load-eco-config.js +107 -0
  105. package/src/config/resolve-eco-config-path.d.ts +32 -0
  106. package/src/config/resolve-eco-config-path.js +58 -0
  107. package/src/config/server-config-bundle.d.ts +25 -0
  108. package/src/config/server-config-bundle.js +148 -0
  109. package/src/config/user-config-types.d.ts +170 -0
  110. package/src/config/user-config-types.js +1 -0
  111. package/src/css-imports.d.ts +4 -0
  112. package/src/declarations.d.ts +11 -5
  113. package/src/dev/README.md +6 -0
  114. package/src/dev/development-restart-watch-paths.d.ts +13 -0
  115. package/src/dev/development-restart-watch-paths.js +37 -0
  116. package/src/dev/development-restart.d.ts +13 -0
  117. package/src/dev/development-restart.js +21 -0
  118. package/src/dev/host-runtime.d.ts +0 -1
  119. package/src/dev/host-runtime.js +0 -3
  120. package/src/dev/sc-server.d.ts +4 -1
  121. package/src/dev/sc-server.js +11 -20
  122. package/src/dev/transform-server/dev-transform-import-rewriter.js +2 -2
  123. package/src/dev/transform-server/dev-transform-server.d.ts +6 -0
  124. package/src/dev/transform-server/dev-transform-server.js +16 -5
  125. package/src/eco/README.md +73 -5
  126. package/src/eco/component-identity.d.ts +3 -2
  127. package/src/eco/component-identity.js +5 -2
  128. package/src/eco/discovered-dependencies.d.ts +45 -0
  129. package/src/eco/discovered-dependencies.js +87 -0
  130. package/src/eco/eco.js +6 -0
  131. package/src/eco/eco.types.d.ts +18 -2
  132. package/src/eco/lazy-injector-map.js +57 -41
  133. package/src/eco/page-dependency-contributions.d.ts +19 -0
  134. package/src/eco/page-dependency-contributions.js +52 -0
  135. package/src/errors/http-error-page-contract.d.ts +77 -0
  136. package/src/errors/http-error-page-contract.js +106 -0
  137. package/src/hmr/hmr-file-change-prep.d.ts +0 -1
  138. package/src/hmr/hmr-file-change-prep.js +2 -5
  139. package/src/hmr/hmr-strategy.d.ts +3 -8
  140. package/src/hmr/hmr-strategy.js +3 -8
  141. package/src/hmr/strategies/js-hmr-strategy.d.ts +2 -0
  142. package/src/hmr/strategies/js-hmr-strategy.js +24 -16
  143. package/src/index.browser.d.ts +2 -0
  144. package/src/index.browser.js +2 -0
  145. package/src/index.d.ts +5 -3
  146. package/src/index.js +5 -3
  147. package/src/islands/README.md +5 -1
  148. package/src/islands/island-host.d.ts +0 -9
  149. package/src/islands/island-host.js +1 -13
  150. package/src/plugins/README.md +8 -1
  151. package/src/plugins/component-import-discovery.d.ts +19 -0
  152. package/src/plugins/component-import-discovery.js +241 -0
  153. package/src/plugins/eco-component-meta-plugin.d.ts +3 -1
  154. package/src/plugins/eco-component-meta-plugin.js +120 -18
  155. package/src/plugins/integration-plugin.d.ts +0 -1
  156. package/src/plugins/integration-plugin.js +0 -4
  157. package/src/plugins/processor.d.ts +10 -2
  158. package/src/plugins/processor.js +4 -0
  159. package/src/plugins/tsconfig-import-resolver.d.ts +3 -1
  160. package/src/plugins/tsconfig-import-resolver.js +4 -2
  161. package/src/route-renderer/GRAPH.md +1 -1
  162. package/src/route-renderer/README.md +15 -2
  163. package/src/{adapters/shared/http/explicit-static-render-preparation.d.ts → route-renderer/explicit-view-render-preparation.d.ts} +3 -3
  164. package/src/route-renderer/orchestration/custom-element-scripts/README.md +9 -0
  165. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +16 -0
  166. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +34 -0
  167. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +80 -0
  168. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +190 -0
  169. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.d.ts +17 -0
  170. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +41 -0
  171. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +10 -0
  172. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +46 -0
  173. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +7 -2
  174. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +3 -4
  175. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +11 -2
  176. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +10 -2
  177. package/src/route-renderer/orchestration/integration-renderer.d.ts +9 -11
  178. package/src/route-renderer/orchestration/integration-renderer.js +43 -40
  179. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
  180. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +2 -5
  181. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +2 -68
  182. package/src/route-renderer/orchestration/ownership-graph/component-graph.js +55 -39
  183. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
  184. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
  185. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +6 -0
  186. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +59 -36
  187. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +8 -10
  188. package/src/route-renderer/orchestration/string-markup-renderer.d.ts +1 -1
  189. package/src/route-renderer/orchestration/string-markup-renderer.js +2 -1
  190. package/src/route-renderer/page-loading/component-dependency-collection.d.ts +6 -2
  191. package/src/route-renderer/page-loading/component-dependency-collection.js +113 -68
  192. package/src/route-renderer/page-loading/ecopages-virtual-imports.js +41 -28
  193. package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +10 -3
  194. package/src/route-renderer/page-loading/file-scoped-dependency-components.js +62 -25
  195. package/src/route-renderer/page-loading/page-dependency-bundling.js +14 -8
  196. package/src/route-renderer/page-loading/resolved-page-dependencies.d.ts +1 -2
  197. package/src/route-renderer/page-loading/resolved-page-dependencies.js +8 -7
  198. package/src/route-renderer/route-renderer.d.ts +9 -0
  199. package/src/route-renderer/route-renderer.js +18 -0
  200. package/src/router/README.md +7 -1
  201. package/src/router/server/route-registry.d.ts +13 -0
  202. package/src/router/server/route-registry.js +46 -32
  203. package/src/services/README.md +6 -1
  204. package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +36 -9
  205. package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.js +122 -37
  206. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +2 -0
  207. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +13 -2
  208. package/src/services/assets/asset-processing-service/page-package.js +42 -39
  209. package/src/services/assets/browser-bundle.service.d.ts +1 -6
  210. package/src/services/error-pages/README.md +9 -0
  211. package/src/services/error-pages/default-error-pages.d.ts +39 -0
  212. package/src/services/error-pages/default-error-pages.js +199 -0
  213. package/src/services/error-pages/error-page-renderer.d.ts +58 -0
  214. package/src/services/error-pages/error-page-renderer.js +146 -0
  215. package/src/services/error-pages/semantic-error-page-exporter.d.ts +23 -0
  216. package/src/services/error-pages/semantic-error-page-exporter.js +35 -0
  217. package/src/services/html/html-rewriter.d.ts +77 -0
  218. package/src/services/html/html-rewriter.js +751 -0
  219. package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
  220. package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
  221. package/src/services/html/html-transformer.service.d.ts +26 -39
  222. package/src/services/html/html-transformer.service.js +81 -153
  223. package/src/services/invalidation/development-invalidation.service.d.ts +9 -20
  224. package/src/services/invalidation/development-invalidation.service.js +35 -41
  225. package/src/services/module-loading/README.md +17 -14
  226. package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
  227. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
  228. package/src/services/module-loading/app-server-module-transpiler.service.js +2 -10
  229. package/src/services/module-loading/collection-server-module-build.service.d.ts +1 -1
  230. package/src/services/module-loading/collection-server-module-build.service.js +5 -5
  231. package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
  232. package/src/services/module-loading/host-module-loader-registry.js +0 -3
  233. package/src/services/module-loading/page-module-import.service.d.ts +8 -0
  234. package/src/services/module-loading/page-module-import.service.js +62 -28
  235. package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
  236. package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
  237. package/src/services/module-loading/route-module-build-cache.store.d.ts +3 -0
  238. package/src/services/module-loading/route-module-build-cache.store.js +18 -5
  239. package/src/services/module-loading/route-module-build-manifest.d.ts +6 -1
  240. package/src/services/module-loading/route-module-build-manifest.js +1 -2
  241. package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
  242. package/src/services/module-loading/route-module-dependency-hasher.js +13 -1
  243. package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
  244. package/src/services/module-loading/server-module-transpiler.service.js +0 -24
  245. package/src/services/module-loading/view-module-loader.d.ts +10 -0
  246. package/src/services/module-loading/view-module-loader.js +46 -0
  247. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
  248. package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
  249. package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
  250. package/src/services/validation/schema-validation-service.d.ts +1 -0
  251. package/src/services/validation/schema-validation-service.js +23 -36
  252. package/src/static-site-generator/README.md +6 -1
  253. package/src/static-site-generator/static-site-generator.d.ts +7 -2
  254. package/src/static-site-generator/static-site-generator.js +90 -49
  255. package/src/types/internal-types.d.ts +6 -39
  256. package/src/types/public-types.d.ts +29 -131
  257. package/src/utils/parse-cli-args.js +29 -22
  258. package/src/watchers/project-watcher.d.ts +14 -16
  259. package/src/watchers/project-watcher.js +86 -61
  260. package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
  261. package/src/watchers/project-watcher.test-helpers.js +12 -0
  262. package/src/adapters/abstract/router-adapter.d.ts +0 -26
  263. package/src/adapters/abstract/router-adapter.js +0 -13
  264. package/src/adapters/bun/index.d.ts +0 -2
  265. package/src/adapters/bun/index.js +0 -2
  266. package/src/adapters/index.d.ts +0 -2
  267. package/src/adapters/index.js +0 -2
  268. package/src/eco/eco.utils.d.ts +0 -1
  269. package/src/eco/eco.utils.js +0 -1
  270. package/src/services/cache/index.d.ts +0 -9
  271. package/src/services/cache/index.js +0 -8
  272. package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
  273. package/src/services/html/html-rewriter-provider.service.js +0 -68
  274. package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
  275. package/src/services/module-loading/route-module-build-cache.js +0 -3
  276. package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
  277. package/src/services/runtime-state/dev-graph.service.js +0 -170
  278. /package/src/{adapters/shared/http/explicit-static-render-preparation.js → route-renderer/explicit-view-render-preparation.js} +0 -0
@@ -298,14 +298,7 @@ export function toBuildLogs(error) {
298
298
  }
299
299
  return [{ message: 'Unknown build error' }];
300
300
  }
301
- /**
302
- * Translates a {@link BuildOptions} into Rolldown's `InputOptions` and
303
- * `OutputOptions`. Always sets `experimental.nativeMagicString: true`
304
- * and always consolidates eco plugins via the bridge.
305
- */
306
- export function resolveRolldownOptions(options, contextRoot, outdir, appRootRequireCache) {
307
- const rolldownPlatform = mapRolldownPlatform(options.target);
308
- const external = createExternalMatcher(options, appRootRequireCache);
301
+ function buildRolldownTransformOptions(options) {
309
302
  const transformOptions = {};
310
303
  if (options.define) {
311
304
  transformOptions.define = options.define;
@@ -316,21 +309,26 @@ export function resolveRolldownOptions(options, contextRoot, outdir, appRootRequ
316
309
  if (options.target && /^(?:es|chrome|edge|firefox|safari|hermes|deno|ios)/.test(options.target)) {
317
310
  transformOptions.target = options.target;
318
311
  }
312
+ return Object.keys(transformOptions).length > 0 ? transformOptions : undefined;
313
+ }
314
+ function buildRolldownInputPlugins(options, contextRoot, rolldownPlatform) {
319
315
  const bundlePlugins = options.plugins ?? [];
320
316
  const sourceTransforms = options.sourceTransforms ?? [];
321
317
  const appPlugins = createRolldownPluginBridge(bundlePlugins, contextRoot, sourceTransforms);
322
- const allPlugins = [
318
+ return [
323
319
  ...(rolldownPlatform === 'node' ? [createNodeBuiltinExternalPlugin()] : []),
324
320
  ...(rolldownPlatform === 'browser' ? [createBrowserNodeBuiltinGuardPlugin()] : []),
325
321
  ...(options.target !== 'browser' ? [createServerSideCssShimPlugin()] : []),
326
322
  ...appPlugins,
327
323
  ];
328
- const inputOptions = {
324
+ }
325
+ function buildRolldownInputOptions(options, contextRoot, external, rolldownPlatform) {
326
+ return {
329
327
  input: options.entrypoints,
330
328
  cwd: contextRoot,
331
329
  external,
332
- platform: mapRolldownPlatform(options.target),
333
- transform: Object.keys(transformOptions).length > 0 ? transformOptions : undefined,
330
+ platform: rolldownPlatform,
331
+ transform: buildRolldownTransformOptions(options),
334
332
  resolve: options.conditions ? { conditionNames: options.conditions } : undefined,
335
333
  treeshake: typeof options.treeshaking === 'boolean' ? options.treeshaking : true,
336
334
  ...(process.env.ECOPAGES_PROFILE_BUILD === '1'
@@ -343,32 +341,50 @@ export function resolveRolldownOptions(options, contextRoot, outdir, appRootRequ
343
341
  experimental: {
344
342
  nativeMagicString: true,
345
343
  },
346
- plugins: allPlugins,
344
+ plugins: buildRolldownInputPlugins(options, contextRoot, rolldownPlatform),
347
345
  };
346
+ }
347
+ function resolveRolldownEntryFileNames(options) {
348
348
  const entryFileNames = toEntryFileNamesPattern(options.naming);
349
349
  const jsExtension = getJavaScriptOutExtension(options, entryFileNames?.literal ?? false);
350
- const finalEntryFileNames = entryFileNames
351
- ? jsExtension
352
- ? `${entryFileNames.pattern}${jsExtension}`
353
- : entryFileNames.pattern
354
- : jsExtension
355
- ? `[name]${jsExtension}`
356
- : '[name]';
350
+ if (entryFileNames) {
351
+ return jsExtension ? `${entryFileNames.pattern}${jsExtension}` : entryFileNames.pattern;
352
+ }
353
+ return jsExtension ? `[name]${jsExtension}` : '[name]';
354
+ }
355
+ function shouldDisableRolldownCodeSplitting(options) {
356
+ if (options.splitting !== false) {
357
+ return false;
358
+ }
357
359
  const entrypointCount = Array.isArray(options.entrypoints)
358
360
  ? options.entrypoints.length
359
361
  : Object.keys(options.entrypoints).length;
360
- const disableCodeSplitting = options.splitting === false && entrypointCount === 1;
361
- const outputOptions = {
362
+ return entrypointCount === 1;
363
+ }
364
+ function buildRolldownOutputOptions(options, outdir) {
365
+ return {
362
366
  dir: outdir,
363
367
  format: mapRolldownFormat(options.format),
364
368
  minify: !!options.minify,
365
- entryFileNames: finalEntryFileNames,
369
+ entryFileNames: resolveRolldownEntryFileNames(options),
366
370
  chunkFileNames: '[name]-[hash].js',
367
371
  assetFileNames: '[name]-[hash][extname]',
368
372
  sourcemap: mapRolldownSourcemap(options.sourcemap),
369
- ...(disableCodeSplitting ? { codeSplitting: false } : {}),
373
+ ...(shouldDisableRolldownCodeSplitting(options) ? { codeSplitting: false } : {}),
374
+ };
375
+ }
376
+ /**
377
+ * Translates a {@link BuildOptions} into Rolldown's `InputOptions` and
378
+ * `OutputOptions`. Always sets `experimental.nativeMagicString: true`
379
+ * and always consolidates eco plugins via the bridge.
380
+ */
381
+ export function resolveRolldownOptions(options, contextRoot, outdir, appRootRequireCache) {
382
+ const rolldownPlatform = mapRolldownPlatform(options.target);
383
+ const external = createExternalMatcher(options, appRootRequireCache);
384
+ return {
385
+ inputOptions: buildRolldownInputOptions(options, contextRoot, external, rolldownPlatform),
386
+ outputOptions: buildRolldownOutputOptions(options, outdir),
370
387
  };
371
- return { inputOptions, outputOptions };
372
388
  }
373
389
  /**
374
390
  * Rewrites manifest-owned runtime specifiers in emitted JS output
@@ -73,29 +73,33 @@ function inferRolldownModuleTypeFromPath(filePath) {
73
73
  return 'js';
74
74
  }
75
75
  }
76
+ const DIRECT_ROLLDOWN_MODULE_LOADERS = new Set([
77
+ 'js',
78
+ 'jsx',
79
+ 'ts',
80
+ 'tsx',
81
+ 'json',
82
+ 'css',
83
+ 'text',
84
+ 'base64',
85
+ 'dataurl',
86
+ 'binary',
87
+ 'empty',
88
+ ]);
89
+ const ROLLDOWN_LOADER_ALIASES = {
90
+ 'global-css': 'css',
91
+ 'local-css': 'css',
92
+ file: 'asset',
93
+ copy: 'asset',
94
+ };
76
95
  function normalizeRolldownModuleType(loader) {
77
- switch (loader) {
78
- case 'js':
79
- case 'jsx':
80
- case 'ts':
81
- case 'tsx':
82
- case 'json':
83
- case 'css':
84
- case 'text':
85
- case 'base64':
86
- case 'dataurl':
87
- case 'binary':
88
- case 'empty':
89
- return loader;
90
- case 'global-css':
91
- case 'local-css':
92
- return 'css';
93
- case 'file':
94
- case 'copy':
95
- return 'asset';
96
- default:
97
- return undefined;
96
+ if (typeof loader === 'string' && DIRECT_ROLLDOWN_MODULE_LOADERS.has(loader)) {
97
+ return loader;
98
98
  }
99
+ if (typeof loader === 'string' && Object.prototype.hasOwnProperty.call(ROLLDOWN_LOADER_ALIASES, loader)) {
100
+ return ROLLDOWN_LOADER_ALIASES[loader];
101
+ }
102
+ return undefined;
99
103
  }
100
104
  function convertLoadResultToModuleSource(result) {
101
105
  if (result.loader === 'object' && result.exports && typeof result.exports === 'object') {
@@ -2,6 +2,7 @@ import { createRequire } from 'node:module';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { pathToFileURL } from 'node:url';
5
+ import { appLogger } from '../../global/app-logger.js';
5
6
  import { isBarePackageImportSpecifier } from '../../plugins/tsconfig-import-resolver.js';
6
7
  const corePackageRequire = createRequire(new URL('../../../package.json', import.meta.url));
7
8
  const appDeclaredPackageCache = new Map();
@@ -201,9 +202,7 @@ function rewriteRuntimeBuildOutputImports(code, rootDir) {
201
202
  });
202
203
  }
203
204
  export function normalizeNodeRuntimeBuildOutputFile(filePath, rootDir) {
204
- if (process.env.ECOPAGES_LOGGER_DEBUG === 'true') {
205
- console.log(`[normalizeNodeRuntimeBuildOutputFile] Checking ${filePath}`);
206
- }
205
+ appLogger.debug(`[normalizeNodeRuntimeBuildOutputFile] Checking ${filePath}`);
207
206
  if (!/\.(?:[cm]?js)$/u.test(filePath)) {
208
207
  return;
209
208
  }
@@ -214,9 +213,7 @@ export function normalizeNodeRuntimeBuildOutputFile(filePath, rootDir) {
214
213
  const code = fileSystem.readFileSync(filePath, 'utf-8');
215
214
  const rewritten = rewriteRuntimeBuildOutputImports(code, rootDir);
216
215
  if (rewritten !== code) {
217
- if (process.env.ECOPAGES_LOGGER_DEBUG === 'true') {
218
- console.log(`[normalizeNodeRuntimeBuildOutputFile] Rewriting ${filePath}`);
219
- }
216
+ appLogger.debug(`[normalizeNodeRuntimeBuildOutputFile] Rewriting ${filePath}`);
220
217
  fileSystem.writeFileSync(filePath, rewritten);
221
218
  }
222
219
  }
@@ -7,11 +7,7 @@ import type { BuildOptions } from '../contracts/build-contracts.js';
7
7
  * are sorted. Plugin, `conditions`, and source-transform order is preserved because
8
8
  * Rolldown hook and `conditionNames` precedence depend on it.
9
9
  *
10
- * Deprecated / ignored adapter fields (`splitting`, `bundle`, `outbase`) still
11
- * participate in the key so requests that differ only on those fields do not
12
- * coalesce. Empty `conditions` / `define` / `external` normalize to the same
13
- * sentinel as `undefined`.
10
+ * Empty `conditions` / `define` / `external` normalize to the same sentinel as
11
+ * `undefined`.
14
12
  */
15
13
  export declare function createBuildRequestIdentity(options: BuildOptions): string;
16
- /** @deprecated Use {@link createBuildRequestIdentity}. */
17
- export declare const createBuildOptionsDedupeKey: typeof createBuildRequestIdentity;
@@ -47,19 +47,15 @@ function normalizeDefine(define) {
47
47
  * are sorted. Plugin, `conditions`, and source-transform order is preserved because
48
48
  * Rolldown hook and `conditionNames` precedence depend on it.
49
49
  *
50
- * Deprecated / ignored adapter fields (`splitting`, `bundle`, `outbase`) still
51
- * participate in the key so requests that differ only on those fields do not
52
- * coalesce. Empty `conditions` / `define` / `external` normalize to the same
53
- * sentinel as `undefined`.
50
+ * Empty `conditions` / `define` / `external` normalize to the same sentinel as
51
+ * `undefined`.
54
52
  */
55
53
  export function createBuildRequestIdentity(options) {
56
54
  return [
57
55
  normalizeEntrypoints(options.entrypoints),
58
56
  options.root ? path.resolve(options.root) : 'root:default',
59
57
  options.outdir ? path.resolve(options.outdir) : 'outdir:default',
60
- options.outbase ? path.resolve(options.outbase) : 'outbase:default',
61
58
  options.splitting ?? 'splitting:default',
62
- options.bundle ?? 'bundle:default',
63
59
  options.externalPackages ?? 'externalPackages:default',
64
60
  options.target ?? 'target:default',
65
61
  options.format ?? 'format:default',
@@ -75,5 +71,3 @@ export function createBuildRequestIdentity(options) {
75
71
  createSourceTransformCacheKey(options.sourceTransforms),
76
72
  ].join('::');
77
73
  }
78
- /** @deprecated Use {@link createBuildRequestIdentity}. */
79
- export const createBuildOptionsDedupeKey = createBuildRequestIdentity;
@@ -48,7 +48,7 @@ export function createServerBuildRequest(appConfig, input) {
48
48
  ...overrides,
49
49
  entrypoints: input.entrypoints,
50
50
  ...(plugins.length > 0 ? { plugins } : {}),
51
- sourceTransforms: getAppSourceTransforms(appConfig),
51
+ sourceTransforms: [...getAppSourceTransforms(appConfig), ...(input.sourceTransforms ?? [])],
52
52
  };
53
53
  }
54
54
  /**
@@ -1,5 +1,4 @@
1
1
  import type { BuildExecutor, BuildOptions, BuildResult } from '../build-adapter.js';
2
- export { createBuildRequestIdentity, createBuildOptionsDedupeKey } from './build-request-identity.js';
3
2
  /**
4
3
  * In-flight build coalescing wrapper.
5
4
  *
@@ -1,5 +1,4 @@
1
1
  import { createBuildRequestIdentity } from './build-request-identity.js';
2
- export { createBuildRequestIdentity, createBuildOptionsDedupeKey } from './build-request-identity.js';
3
2
  /**
4
3
  * In-flight build coalescing wrapper.
5
4
  *
@@ -0,0 +1,14 @@
1
+ /** Creates a sibling staging directory so publication stays on one filesystem. */
2
+ export declare function createServerBundleStagingDirectory(serverOutdir: string): string;
3
+ /** Maps build outputs from the staging directory to their published locations. */
4
+ export declare function resolvePublishedServerBundlePaths(outputPaths: readonly string[], stagingDir: string, serverOutdir: string): string[];
5
+ /**
6
+ * Publishes a complete server bundle generation without exposing mixed artifacts.
7
+ *
8
+ * @remarks
9
+ * The previous directory is retained until the staged directory has been moved
10
+ * into place, allowing rollback if publication fails.
11
+ */
12
+ export declare function publishServerBundleDirectory(stagingDir: string, serverOutdir: string): void;
13
+ /** Removes an unpublished staging generation after a failed build. */
14
+ export declare function removeServerBundleStagingDirectory(stagingDir: string): void;
@@ -0,0 +1,49 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdtempSync, renameSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileSystem } from '@ecopages/file-system';
5
+ /** Creates a sibling staging directory so publication stays on one filesystem. */
6
+ export function createServerBundleStagingDirectory(serverOutdir) {
7
+ const parentDir = path.dirname(serverOutdir);
8
+ fileSystem.ensureDir(parentDir);
9
+ return mkdtempSync(path.join(parentDir, `.${path.basename(serverOutdir)}.staging-`));
10
+ }
11
+ /** Maps build outputs from the staging directory to their published locations. */
12
+ export function resolvePublishedServerBundlePaths(outputPaths, stagingDir, serverOutdir) {
13
+ return outputPaths.map((outputPath) => {
14
+ const relativePath = path.relative(stagingDir, outputPath);
15
+ if (!relativePath || relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
16
+ throw new Error(`Server bundle output escaped its staging directory: ${outputPath}`);
17
+ }
18
+ return path.join(serverOutdir, relativePath);
19
+ });
20
+ }
21
+ /**
22
+ * Publishes a complete server bundle generation without exposing mixed artifacts.
23
+ *
24
+ * @remarks
25
+ * The previous directory is retained until the staged directory has been moved
26
+ * into place, allowing rollback if publication fails.
27
+ */
28
+ export function publishServerBundleDirectory(stagingDir, serverOutdir) {
29
+ const backupDir = path.join(path.dirname(serverOutdir), `.${path.basename(serverOutdir)}.previous-${randomUUID()}`);
30
+ const hadPublishedBundle = fileSystem.exists(serverOutdir);
31
+ try {
32
+ if (hadPublishedBundle)
33
+ renameSync(serverOutdir, backupDir);
34
+ renameSync(stagingDir, serverOutdir);
35
+ }
36
+ catch (error) {
37
+ if (hadPublishedBundle && !fileSystem.exists(serverOutdir) && fileSystem.exists(backupDir)) {
38
+ renameSync(backupDir, serverOutdir);
39
+ }
40
+ throw error;
41
+ }
42
+ if (fileSystem.exists(backupDir))
43
+ fileSystem.remove(backupDir);
44
+ }
45
+ /** Removes an unpublished staging generation after a failed build. */
46
+ export function removeServerBundleStagingDirectory(stagingDir) {
47
+ if (fileSystem.exists(stagingDir))
48
+ fileSystem.remove(stagingDir);
49
+ }
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @module @ecopages/core/cache
5
5
  */
6
- export { ModuleParseCache, moduleParseCache, cachedParseSync, parseModuleSource, parserLanguageForFile, type ModuleParseOptions, type ParserLanguage, } from './module-parse-cache.js';
6
+ export { parseModuleSource, type ModuleParseOptions } from './module-parse-cache.js';
7
7
  export { recordModuleTransformProfile } from './module-transform-profiler.js';
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @module @ecopages/core/cache
5
5
  */
6
- export { ModuleParseCache, moduleParseCache, cachedParseSync, parseModuleSource, parserLanguageForFile, } from './module-parse-cache.js';
6
+ export { parseModuleSource } from './module-parse-cache.js';
7
7
  export { recordModuleTransformProfile } from './module-transform-profiler.js';
@@ -22,22 +22,17 @@ export type ModuleParseOptions = ParserOptions & {
22
22
  */
23
23
  lang?: ParserOptions['lang'];
24
24
  };
25
- export type ParserLanguage = 'js' | 'jsx' | 'ts' | 'tsx';
26
- /** Resolves the Oxc dialect for a source module from its file extension. */
27
- export declare function parserLanguageForFile(filePath: string): ParserLanguage;
28
25
  /** Parses an ECMAScript module with the shared, normalized cache contract. */
29
26
  export declare function parseModuleSource(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
30
27
  /**
31
28
  * LRU-bounded module parse cache.
32
29
  *
33
- * Single instance shared across the process. Constructed lazily; use
34
- * {@link moduleParseCache} for the default shared instance.
30
+ * One instance is shared across the process; call {@link parseModuleSource}
31
+ * to use it.
35
32
  */
36
33
  export declare class ModuleParseCache {
37
34
  private readonly entries;
38
35
  private readonly maxEntries;
39
- private hits;
40
- private misses;
41
36
  constructor(maxEntries?: number);
42
37
  /**
43
38
  * Parse `source` for `filePath`, memoizing by (filePath, source, options).
@@ -45,26 +40,4 @@ export declare class ModuleParseCache {
45
40
  * @returns the {@link ParseResult} from `oxc-parser.parseSync`.
46
41
  */
47
42
  getOrParse(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
48
- /** Clear all cached entries. Useful in tests and on full-rebuild signals. */
49
- clear(): void;
50
- /** Current cache size (for observability). */
51
- get size(): number;
52
- /** Cumulative hit/miss counters (for observability). */
53
- stats(): {
54
- hits: number;
55
- misses: number;
56
- size: number;
57
- hitRate: number;
58
- };
59
43
  }
60
- /**
61
- * Default shared cache. Use this from plugin code so the cache is
62
- * amortized across plugins and build invocations.
63
- */
64
- export declare const moduleParseCache: ModuleParseCache;
65
- /**
66
- * Drop-in replacement for `oxc-parser.parseSync` that uses the shared
67
- * {@link moduleParseCache}. Use everywhere we currently call `parseSync`
68
- * on user/source files during a build.
69
- */
70
- export declare function cachedParseSync(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
@@ -18,7 +18,7 @@ import { parseSync } from 'oxc-parser';
18
18
  import { rapidhash } from '../utils/hash.js';
19
19
  const DEFAULT_MAX_ENTRIES = 10_000;
20
20
  /** Resolves the Oxc dialect for a source module from its file extension. */
21
- export function parserLanguageForFile(filePath) {
21
+ function parserLanguageForFile(filePath) {
22
22
  const extension = extname(filePath).toLowerCase();
23
23
  if (extension === '.tsx')
24
24
  return 'tsx';
@@ -30,19 +30,17 @@ export function parserLanguageForFile(filePath) {
30
30
  }
31
31
  /** Parses an ECMAScript module with the shared, normalized cache contract. */
32
32
  export function parseModuleSource(filePath, source, options = {}) {
33
- return moduleParseCache.getOrParse(filePath, source, normalizeModuleParseOptions(filePath, options));
33
+ return moduleParseCache.getOrParse(filePath, source, options);
34
34
  }
35
35
  /**
36
36
  * LRU-bounded module parse cache.
37
37
  *
38
- * Single instance shared across the process. Constructed lazily; use
39
- * {@link moduleParseCache} for the default shared instance.
38
+ * One instance is shared across the process; call {@link parseModuleSource}
39
+ * to use it.
40
40
  */
41
41
  export class ModuleParseCache {
42
42
  entries = new Map();
43
43
  maxEntries;
44
- hits = 0;
45
- misses = 0;
46
44
  constructor(maxEntries = DEFAULT_MAX_ENTRIES) {
47
45
  if (maxEntries <= 0) {
48
46
  throw new Error(`ModuleParseCache: maxEntries must be > 0, got ${maxEntries}`);
@@ -60,13 +58,11 @@ export class ModuleParseCache {
60
58
  const key = makeKey(filePath, hash, normalizedOptions);
61
59
  const existing = this.entries.get(key);
62
60
  if (existing && existing.hash === hash) {
63
- this.hits += 1;
64
61
  // Refresh LRU position.
65
62
  this.entries.delete(key);
66
63
  this.entries.set(key, existing);
67
64
  return existing.result;
68
65
  }
69
- this.misses += 1;
70
66
  const result = parseSync(filePath, source, normalizedOptions);
71
67
  this.entries.set(key, { hash, result });
72
68
  if (this.entries.size > this.maxEntries) {
@@ -80,40 +76,11 @@ export class ModuleParseCache {
80
76
  }
81
77
  return result;
82
78
  }
83
- /** Clear all cached entries. Useful in tests and on full-rebuild signals. */
84
- clear() {
85
- this.entries.clear();
86
- this.hits = 0;
87
- this.misses = 0;
88
- }
89
- /** Current cache size (for observability). */
90
- get size() {
91
- return this.entries.size;
92
- }
93
- /** Cumulative hit/miss counters (for observability). */
94
- stats() {
95
- const total = this.hits + this.misses;
96
- return {
97
- hits: this.hits,
98
- misses: this.misses,
99
- size: this.entries.size,
100
- hitRate: total === 0 ? 0 : this.hits / total,
101
- };
102
- }
103
79
  }
104
80
  /**
105
- * Default shared cache. Use this from plugin code so the cache is
106
- * amortized across plugins and build invocations.
81
+ * Default shared cache, amortized across plugins and build invocations.
107
82
  */
108
- export const moduleParseCache = new ModuleParseCache();
109
- /**
110
- * Drop-in replacement for `oxc-parser.parseSync` that uses the shared
111
- * {@link moduleParseCache}. Use everywhere we currently call `parseSync`
112
- * on user/source files during a build.
113
- */
114
- export function cachedParseSync(filePath, source, options = {}) {
115
- return parseModuleSource(filePath, source, options);
116
- }
83
+ const moduleParseCache = new ModuleParseCache();
117
84
  function normalizeModuleParseOptions(filePath, options) {
118
85
  return {
119
86
  ...options,
@@ -18,14 +18,22 @@ It is responsible for:
18
18
 
19
19
  ## Main Files
20
20
 
21
- - `config-builder.ts`: the primary builder and config finalization boundary
22
- - `config-builder.test.ts`: coverage for validation, path resolution, and runtime capability checks
21
+ - `define-config.ts`: synchronous `defineConfig()` identity for `eco.config.ts` authoring
22
+ - `load-eco-config.ts`: resolves the config module path, loads user config, and finalizes through `ConfigBuilder` (omitted `rootDir` defaults to `cwd`; `baseUrl` defaults during `ConfigBuilder.build()`)
23
+ - `resolve-eco-config-path.ts`: `eco.config.ts` discovery (`configFile`, `ECOPAGES_CONFIG_FILE`, cwd default, and production `.server/eco.config.mjs`) and `resolveUserConfigRootDir()`
24
+ - `apply-user-config.ts`: maps declarative `EcoPagesUserConfig` fields onto `ConfigBuilder`
25
+ - `is-finalized-app-config.ts`: detects leftover `ConfigBuilder.build()` exports so `loadEcoPagesConfig()` can reuse them
26
+ - `user-config-types.ts`: TypeScript contracts for `EcoPagesUserConfig` and config loader options
27
+ - `config-builder.ts`: finalization boundary used by the loader and tests
28
+ - `server-config-bundle.ts`: emits `dist/.server/eco.config.mjs` for production server startup
29
+ - `config-builder.test.ts` / `load-eco-config.test.ts`: validation and loader coverage
23
30
 
24
31
  ## Ownership Rules
25
32
 
26
33
  - Integrations and processors declare contributions.
27
34
  - `ConfigBuilder.build()` decides ordering, validates compatibility, and seals build ownership for the finalized app config.
28
35
  - Runtime startup reuses finalized config/build state; it should not recompute manifest ownership.
36
+ - Production startup loads the emitted config artifact recorded by the server build, even when the source config is still present.
29
37
 
30
38
  App-owned is the default ownership path. Host-owned is explicit and should be selected during config construction when a host-driven compatibility flow must avoid silently falling back to app build execution.
31
39
 
@@ -34,3 +42,10 @@ App-owned is the default ownership path. Host-owned is explicit and should be se
34
42
  The result of this layer is a built `EcoPagesAppConfig` with resolved absolute paths and app-owned runtime services attached under `appConfig.runtime`.
35
43
 
36
44
  That built config is then consumed by server adapters, static generation, route rendering, and HMR.
45
+
46
+ ## Tests and fixtures
47
+
48
+ - Production apps call `createApp()` (loads `eco.config.ts`) or pass `appConfig`, `userConfig`, or `configFile` explicitly.
49
+ - In development (`--dev`), adding, changing, or removing the resolved `eco.config` module or a supported project `.env` file triggers a supervised process restart (not in-process reload). The CLI re-merges dotenv files on respawn.
50
+ - `@ecopages/testing` `createTestAppConfig()` finalizes each in-memory user config independently through `finalizeEcoPagesConfig`; only module-backed `loadEcoPagesConfig()` calls are cached (by config path, build ownership, and cwd).
51
+ - Core fixture helpers live in `packages/core/__fixtures__/app/test-app-config.ts` (`createFixtureAppConfig`, `createFixtureApp`).
@@ -0,0 +1,8 @@
1
+ import { ConfigBuilder } from './config-builder.js';
2
+ import type { EcoPagesUserConfig } from './user-config-types.js';
3
+ /**
4
+ * Applies author-owned config fields onto a {@link ConfigBuilder} instance.
5
+ */
6
+ export declare function applyUserConfigToBuilder(builder: ConfigBuilder, userConfig: EcoPagesUserConfig, options?: {
7
+ cwd?: string;
8
+ }): ConfigBuilder;
@@ -0,0 +1,68 @@
1
+ import { ConfigBuilder } from './config-builder.js';
2
+ import { resolveUserConfigRootDir } from './resolve-eco-config-path.js';
3
+ function applyUserDirectoryConfig(builder, userConfig) {
4
+ if (userConfig.srcDir)
5
+ builder.setSrcDir(userConfig.srcDir);
6
+ if (userConfig.pagesDir)
7
+ builder.setPagesDir(userConfig.pagesDir);
8
+ if (userConfig.includesDir)
9
+ builder.setIncludesDir(userConfig.includesDir);
10
+ if (userConfig.componentsDir)
11
+ builder.setComponentsDir(userConfig.componentsDir);
12
+ if (userConfig.layoutsDir)
13
+ builder.setLayoutsDir(userConfig.layoutsDir);
14
+ if (userConfig.publicDir)
15
+ builder.setPublicDir(userConfig.publicDir);
16
+ if (userConfig.distDir)
17
+ builder.setDistDir(userConfig.distDir);
18
+ if (userConfig.workDir)
19
+ builder.setWorkDir(userConfig.workDir);
20
+ }
21
+ function applyUserPipelineConfig(builder, userConfig) {
22
+ if (userConfig.integrations)
23
+ builder.setIntegrations(userConfig.integrations);
24
+ if (userConfig.processors)
25
+ builder.setProcessors(userConfig.processors);
26
+ if (userConfig.loaders)
27
+ builder.setLoaders(userConfig.loaders);
28
+ if (userConfig.sourceTransforms)
29
+ builder.setSourceTransforms(userConfig.sourceTransforms);
30
+ if (userConfig.cache)
31
+ builder.setCacheConfig(userConfig.cache);
32
+ if (userConfig.buildOwnership)
33
+ builder.setBuildOwnership(userConfig.buildOwnership);
34
+ }
35
+ function applyUserMetadataConfig(builder, userConfig) {
36
+ if (userConfig.baseUrl !== undefined)
37
+ builder.setBaseUrl(userConfig.baseUrl);
38
+ if (userConfig.robotsTxt)
39
+ builder.setRobotsTxt(userConfig.robotsTxt);
40
+ if (userConfig.sitemap)
41
+ builder.setSitemap(userConfig.sitemap);
42
+ if (userConfig.defaultMetadata)
43
+ builder.setDefaultMetadata(userConfig.defaultMetadata);
44
+ }
45
+ function applyUserRuntimeConfig(builder, userConfig) {
46
+ if (userConfig.devToolbar)
47
+ builder.setDevToolbar(userConfig.devToolbar);
48
+ if (userConfig.additionalWatchPaths)
49
+ builder.setAdditionalWatchPaths(userConfig.additionalWatchPaths);
50
+ if (userConfig.devPrewarmPaths)
51
+ builder.setDevPrewarmPaths(userConfig.devPrewarmPaths);
52
+ if (userConfig.devPrewarmBeforeReadyPaths) {
53
+ builder.setDevPrewarmBeforeReadyPaths(userConfig.devPrewarmBeforeReadyPaths);
54
+ }
55
+ if (userConfig.experimental)
56
+ builder.setExperimental(userConfig.experimental);
57
+ }
58
+ /**
59
+ * Applies author-owned config fields onto a {@link ConfigBuilder} instance.
60
+ */
61
+ export function applyUserConfigToBuilder(builder, userConfig, options = {}) {
62
+ builder.setRootDir(resolveUserConfigRootDir(userConfig.rootDir, options.cwd));
63
+ applyUserDirectoryConfig(builder, userConfig);
64
+ applyUserPipelineConfig(builder, userConfig);
65
+ applyUserMetadataConfig(builder, userConfig);
66
+ applyUserRuntimeConfig(builder, userConfig);
67
+ return builder;
68
+ }
@@ -16,7 +16,8 @@ export declare const CONFIG_BUILDER_ERRORS: {
16
16
  readonly MIXED_JSX_ENGINES: "Both kitajs and react integrations are enabled. Use per-file JSX import source/pragma consistently (e.g. `/** @jsxImportSource react */` for React files and `/** @jsxImportSource @kitajs/html */` for Kita files).";
17
17
  readonly duplicateProcessorName: (name: string) => string;
18
18
  readonly duplicateLoaderName: (name: string) => string;
19
- readonly duplicateSemanticTemplate: (kind: "html" | "404" | "500", matches: string[]) => string;
19
+ readonly duplicateSourceTransformName: (name: string) => string;
20
+ readonly duplicateSemanticTemplate: (kind: string, matches: string[]) => string;
20
21
  readonly incompatibleRuntimeCapability: (kind: "integration" | "processor", name: string, runtime: RuntimeKind, reason: string) => string;
21
22
  readonly unsupportedRuntimeVersion: (kind: "integration" | "processor", name: string, runtime: RuntimeKind, current: string, min: string) => string;
22
23
  readonly invalidRuntimeVersion: (kind: "integration" | "processor", name: string, version: string) => string;
@@ -45,6 +46,7 @@ type RuntimeKind = 'node' | 'bun';
45
46
  */
46
47
  export declare class ConfigBuilder {
47
48
  private buildOwnership;
49
+ private configModulePath?;
48
50
  config: EcoPagesAppConfig;
49
51
  /**
50
52
  * Sets the base URL for the application.
@@ -80,6 +82,14 @@ export declare class ConfigBuilder {
80
82
  * without an explicit ownership.
81
83
  */
82
84
  setBuildOwnership(buildOwnership: BuildOwnership): this;
85
+ /**
86
+ * Sets the canonical path of the Ecopages config module on disk.
87
+ *
88
+ * @remarks
89
+ * Used by the config loader so {@link EcoPagesAppConfig.absolutePaths.config}
90
+ * reflects `--config` overrides and production-emitted config modules.
91
+ */
92
+ setConfigModulePath(configModulePath: string): this;
83
93
  /**
84
94
  * Sets the source directory relative to the root directory.
85
95
  * This directory contains all the source files for the application.