@ecopages/core 0.2.0-alpha.54 → 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 (594) hide show
  1. package/package.json +196 -91
  2. package/src/adapters/abstract/application-adapter.d.ts +194 -0
  3. package/src/adapters/abstract/application-adapter.js +121 -0
  4. package/src/adapters/abstract/router-adapter.d.ts +26 -0
  5. package/src/adapters/abstract/router-adapter.js +5 -0
  6. package/src/adapters/abstract/server-adapter.d.ts +69 -0
  7. package/src/adapters/abstract/server-adapter.js +15 -0
  8. package/src/adapters/bun/client-bridge.d.ts +34 -0
  9. package/src/adapters/bun/client-bridge.js +48 -0
  10. package/src/adapters/bun/create-app.d.ts +60 -0
  11. package/src/adapters/bun/create-app.js +140 -0
  12. package/src/adapters/bun/hmr-manager.d.ts +47 -0
  13. package/src/adapters/bun/hmr-manager.js +58 -0
  14. package/src/adapters/bun/index.d.ts +2 -0
  15. package/src/adapters/bun/index.js +8 -0
  16. package/src/adapters/bun/runtime-host.d.ts +52 -0
  17. package/src/adapters/bun/runtime-host.js +56 -0
  18. package/src/adapters/bun/server-adapter.d.ts +223 -0
  19. package/src/adapters/bun/server-adapter.js +450 -0
  20. package/src/adapters/bun/static-preview-host.d.ts +28 -0
  21. package/src/adapters/bun/static-preview-host.js +45 -0
  22. package/src/adapters/create-app.d.ts +20 -0
  23. package/src/adapters/create-app.js +66 -0
  24. package/src/adapters/index.d.ts +2 -0
  25. package/src/adapters/index.js +8 -0
  26. package/src/adapters/node/create-app.d.ts +24 -0
  27. package/src/adapters/node/create-app.js +92 -0
  28. package/src/adapters/node/http-request-bridge.d.ts +57 -0
  29. package/src/adapters/node/http-request-bridge.js +118 -0
  30. package/src/adapters/node/node-client-bridge.d.ts +26 -0
  31. package/src/adapters/node/node-client-bridge.js +66 -0
  32. package/src/adapters/node/node-hmr-manager.d.ts +52 -0
  33. package/src/adapters/node/node-hmr-manager.js +49 -0
  34. package/src/adapters/node/runtime-host.d.ts +57 -0
  35. package/src/adapters/node/runtime-host.js +92 -0
  36. package/src/adapters/node/server-adapter-dependencies.d.ts +19 -0
  37. package/src/adapters/node/server-adapter-dependencies.js +18 -0
  38. package/src/adapters/node/server-adapter.d.ts +138 -0
  39. package/src/adapters/node/server-adapter.js +313 -0
  40. package/src/adapters/node/static-content-server.d.ts +60 -0
  41. package/src/adapters/node/static-content-server.js +194 -0
  42. package/src/adapters/node/static-preview-host.d.ts +55 -0
  43. package/src/adapters/node/static-preview-host.js +68 -0
  44. package/src/adapters/shared/api-response.d.ts +52 -0
  45. package/src/adapters/shared/api-response.js +96 -0
  46. package/src/adapters/shared/application-adapter.d.ts +18 -0
  47. package/src/adapters/shared/application-adapter.js +90 -0
  48. package/src/adapters/shared/define-api-handler.d.ts +25 -0
  49. package/src/adapters/shared/define-api-handler.js +15 -0
  50. package/src/adapters/shared/explicit-static-render-preparation.d.ts +25 -0
  51. package/src/adapters/shared/explicit-static-render-preparation.js +26 -0
  52. package/src/adapters/shared/explicit-static-route-matcher.d.ts +41 -0
  53. package/src/adapters/shared/explicit-static-route-matcher.js +101 -0
  54. package/src/adapters/shared/file-route-middleware-pipeline.d.ts +62 -0
  55. package/src/adapters/shared/file-route-middleware-pipeline.js +90 -0
  56. package/src/adapters/shared/fs-server-response-factory.d.ts +23 -0
  57. package/src/adapters/shared/fs-server-response-factory.js +81 -0
  58. package/src/adapters/shared/fs-server-response-matcher.d.ts +75 -0
  59. package/src/adapters/shared/fs-server-response-matcher.js +186 -0
  60. package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +55 -0
  61. package/src/adapters/shared/hmr-entrypoint-registrar.js +87 -0
  62. package/src/adapters/shared/hmr-html-response.d.ts +22 -0
  63. package/src/adapters/shared/hmr-html-response.js +33 -0
  64. package/src/adapters/shared/render-context.d.ts +16 -0
  65. package/src/adapters/shared/render-context.js +93 -0
  66. package/src/adapters/shared/runtime-app-bootstrap.d.ts +26 -0
  67. package/src/adapters/shared/runtime-app-bootstrap.js +46 -0
  68. package/src/adapters/shared/runtime-host.d.ts +12 -0
  69. package/src/adapters/shared/runtime-host.js +0 -0
  70. package/src/adapters/shared/server-adapter.d.ts +108 -0
  71. package/src/adapters/shared/server-adapter.js +436 -0
  72. package/src/adapters/shared/server-route-handler.d.ts +89 -0
  73. package/src/adapters/shared/server-route-handler.js +111 -0
  74. package/src/adapters/shared/server-static-builder.d.ts +71 -0
  75. package/src/adapters/shared/server-static-builder.js +100 -0
  76. package/src/adapters/shared/shared-hmr-manager.d.ts +59 -0
  77. package/src/adapters/shared/shared-hmr-manager.js +241 -0
  78. package/src/adapters/shared/static-preview-host.d.ts +10 -0
  79. package/src/adapters/shared/static-preview-host.js +0 -0
  80. package/src/build/browser-runtime-manifest.d.ts +31 -0
  81. package/src/build/browser-runtime-manifest.js +61 -0
  82. package/src/build/{browser-runtime-plugin-helpers.ts → browser-runtime-plugin-helpers.d.ts} +2 -13
  83. package/src/build/browser-runtime-plugin-helpers.js +14 -0
  84. package/src/build/browser-runtime-plugin.d.ts +78 -0
  85. package/src/build/browser-runtime-plugin.js +172 -0
  86. package/src/build/build-adapter.d.ts +504 -0
  87. package/src/build/build-adapter.js +240 -0
  88. package/src/build/build-manifest.d.ts +33 -0
  89. package/src/build/build-manifest.js +49 -0
  90. package/src/build/build-types.d.ts +57 -0
  91. package/src/build/build-types.js +0 -0
  92. package/src/build/rolldown-build-adapter.d.ts +32 -0
  93. package/src/build/rolldown-build-adapter.js +260 -0
  94. package/src/build/rolldown-plugin-bridge.d.ts +50 -0
  95. package/src/build/rolldown-plugin-bridge.js +194 -0
  96. package/src/build/{runtime-build-executor.ts → runtime-build-executor.d.ts} +3 -19
  97. package/src/build/runtime-build-executor.js +19 -0
  98. package/src/build/runtime-build-output-normalizer.d.ts +3 -0
  99. package/src/build/runtime-build-output-normalizer.js +111 -0
  100. package/src/build/serialized-build-executor.d.ts +64 -0
  101. package/src/build/serialized-build-executor.js +63 -0
  102. package/src/build/server-side-css-shim-plugin.d.ts +41 -0
  103. package/src/build/server-side-css-shim-plugin.js +35 -0
  104. package/src/cache/{index.ts → index.d.ts} +1 -1
  105. package/src/cache/index.js +6 -0
  106. package/src/cache/module-parse-cache.d.ts +65 -0
  107. package/src/cache/module-parse-cache.js +75 -0
  108. package/src/config/config-builder.d.ts +252 -0
  109. package/src/config/config-builder.js +589 -0
  110. package/src/config/{constants.ts → constants.d.ts} +13 -22
  111. package/src/config/constants.js +25 -0
  112. package/src/dev/host-runtime.d.ts +10 -0
  113. package/src/dev/host-runtime.js +24 -0
  114. package/src/dev/sc-server.d.ts +30 -0
  115. package/src/dev/sc-server.js +111 -0
  116. package/src/eco/eco.browser.d.ts +2 -0
  117. package/src/eco/eco.browser.js +88 -0
  118. package/src/eco/eco.d.ts +9 -0
  119. package/src/eco/eco.js +119 -0
  120. package/src/eco/eco.types.d.ts +230 -0
  121. package/src/eco/eco.types.js +0 -0
  122. package/src/eco/eco.utils.d.ts +1 -0
  123. package/src/eco/eco.utils.js +10 -0
  124. package/src/eco/global-injector-map.d.ts +16 -0
  125. package/src/eco/global-injector-map.js +80 -0
  126. package/src/eco/lazy-injector-map.d.ts +8 -0
  127. package/src/eco/lazy-injector-map.js +70 -0
  128. package/src/eco/module-dependencies.d.ts +18 -0
  129. package/src/eco/module-dependencies.js +49 -0
  130. package/src/errors/http-error.d.ts +31 -0
  131. package/src/errors/http-error.js +50 -0
  132. package/src/errors/index.d.ts +3 -0
  133. package/src/errors/index.js +6 -0
  134. package/src/errors/locals-access-error.d.ts +4 -0
  135. package/src/errors/locals-access-error.js +9 -0
  136. package/src/global/app-logger.d.ts +2 -0
  137. package/src/global/app-logger.js +6 -0
  138. package/src/hmr/client/hmr-runtime.d.ts +5 -0
  139. package/src/hmr/client/hmr-runtime.js +117 -0
  140. package/src/hmr/hmr-strategy.d.ts +162 -0
  141. package/src/hmr/hmr-strategy.js +44 -0
  142. package/src/hmr/hmr.postcss.test.e2e.d.ts +1 -0
  143. package/src/hmr/hmr.postcss.test.e2e.js +31 -0
  144. package/src/hmr/hmr.test.e2e.d.ts +1 -0
  145. package/src/hmr/hmr.test.e2e.js +43 -0
  146. package/src/hmr/strategies/default-hmr-strategy.d.ts +43 -0
  147. package/src/hmr/strategies/default-hmr-strategy.js +34 -0
  148. package/src/hmr/strategies/js-hmr-strategy.d.ts +134 -0
  149. package/src/hmr/strategies/js-hmr-strategy.js +173 -0
  150. package/src/index.browser.d.ts +3 -0
  151. package/src/index.browser.js +4 -0
  152. package/src/index.d.ts +6 -0
  153. package/src/index.js +21 -0
  154. package/src/integrations/ghtml/ghtml-renderer.d.ts +16 -0
  155. package/src/integrations/ghtml/ghtml-renderer.js +57 -0
  156. package/src/integrations/ghtml/ghtml.constants.d.ts +1 -0
  157. package/src/integrations/ghtml/ghtml.constants.js +4 -0
  158. package/src/integrations/ghtml/ghtml.plugin.d.ts +16 -0
  159. package/src/integrations/ghtml/ghtml.plugin.js +20 -0
  160. package/src/plugins/alias-resolver-cache.d.ts +68 -0
  161. package/src/plugins/alias-resolver-cache.js +106 -0
  162. package/src/plugins/alias-resolver-plugin.d.ts +6 -0
  163. package/src/plugins/alias-resolver-plugin.js +65 -0
  164. package/src/plugins/eco-component-meta-plugin.d.ts +108 -0
  165. package/src/plugins/eco-component-meta-plugin.js +175 -0
  166. package/src/plugins/foreign-jsx-override-plugin.d.ts +33 -0
  167. package/src/plugins/foreign-jsx-override-plugin.js +41 -0
  168. package/src/plugins/integration-plugin.d.ts +230 -0
  169. package/src/plugins/integration-plugin.js +201 -0
  170. package/src/plugins/processor.d.ts +97 -0
  171. package/src/plugins/processor.js +141 -0
  172. package/src/plugins/{runtime-capability.ts → runtime-capability.d.ts} +3 -8
  173. package/src/plugins/runtime-capability.js +0 -0
  174. package/src/plugins/source-transform.d.ts +46 -0
  175. package/src/plugins/source-transform.js +71 -0
  176. package/src/route-renderer/orchestration/component-render-context.d.ts +97 -0
  177. package/src/route-renderer/orchestration/component-render-context.js +147 -0
  178. package/src/route-renderer/orchestration/declared-ownership-graph.d.ts +18 -0
  179. package/src/route-renderer/orchestration/declared-ownership-graph.js +34 -0
  180. package/src/route-renderer/orchestration/foreign-subtree-execution.service.d.ts +110 -0
  181. package/src/route-renderer/orchestration/foreign-subtree-execution.service.js +233 -0
  182. package/src/route-renderer/orchestration/integration-renderer.d.ts +534 -0
  183. package/src/route-renderer/orchestration/integration-renderer.js +991 -0
  184. package/src/route-renderer/orchestration/ownership-planning.service.d.ts +24 -0
  185. package/src/route-renderer/orchestration/ownership-planning.service.js +63 -0
  186. package/src/route-renderer/orchestration/ownership-validation.service.d.ts +29 -0
  187. package/src/route-renderer/orchestration/ownership-validation.service.js +53 -0
  188. package/src/route-renderer/orchestration/processed-asset-dedupe.d.ts +3 -0
  189. package/src/route-renderer/orchestration/processed-asset-dedupe.js +27 -0
  190. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.d.ts +91 -0
  191. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.js +170 -0
  192. package/src/route-renderer/orchestration/render-output.utils.d.ts +66 -0
  193. package/src/route-renderer/orchestration/render-output.utils.js +171 -0
  194. package/src/route-renderer/orchestration/route-render-orchestrator.d.ts +156 -0
  195. package/src/route-renderer/orchestration/route-render-orchestrator.js +577 -0
  196. package/src/route-renderer/orchestration/template-serialization.d.ts +38 -0
  197. package/src/route-renderer/orchestration/template-serialization.js +45 -0
  198. package/src/route-renderer/page-loading/component-dependency-collection.d.ts +37 -0
  199. package/src/route-renderer/page-loading/component-dependency-collection.js +132 -0
  200. package/src/route-renderer/page-loading/declared-asset-collection.d.ts +24 -0
  201. package/src/route-renderer/page-loading/declared-asset-collection.js +106 -0
  202. package/src/route-renderer/page-loading/dependency-resolver.d.ts +35 -0
  203. package/src/route-renderer/page-loading/dependency-resolver.js +115 -0
  204. package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +11 -0
  205. package/src/route-renderer/page-loading/ecopages-virtual-imports.js +57 -0
  206. package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +45 -0
  207. package/src/route-renderer/page-loading/lazy-entry-collection.js +105 -0
  208. package/src/route-renderer/page-loading/lazy-trigger-planning.d.ts +19 -0
  209. package/src/route-renderer/page-loading/lazy-trigger-planning.js +40 -0
  210. package/src/route-renderer/page-loading/module-declaration-aggregation.d.ts +5 -0
  211. package/src/route-renderer/page-loading/module-declaration-aggregation.js +33 -0
  212. package/src/route-renderer/page-loading/module-declaration-scripts.d.ts +3 -0
  213. package/src/route-renderer/page-loading/module-declaration-scripts.js +18 -0
  214. package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +13 -0
  215. package/src/route-renderer/page-loading/page-dependency-bundling.js +137 -0
  216. package/src/route-renderer/page-loading/page-module-loader.d.ts +90 -0
  217. package/src/route-renderer/page-loading/page-module-loader.js +127 -0
  218. package/src/route-renderer/route-renderer.d.ts +69 -0
  219. package/src/route-renderer/route-renderer.js +80 -0
  220. package/src/router/client/link-intent.js +34 -0
  221. package/src/router/client/link-intent.test.browser.d.ts +1 -0
  222. package/src/router/client/link-intent.test.browser.js +43 -0
  223. package/src/router/client/navigation-coordinator.d.ts +169 -0
  224. package/src/router/client/navigation-coordinator.js +215 -0
  225. package/src/router/server/route-registry.d.ts +78 -0
  226. package/src/router/server/route-registry.js +262 -0
  227. package/src/services/assets/asset-processing-service/asset-dependency-keys.d.ts +3 -0
  228. package/src/services/assets/asset-processing-service/asset-dependency-keys.js +56 -0
  229. package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +103 -0
  230. package/src/services/assets/asset-processing-service/asset-processing.service.js +285 -0
  231. package/src/services/assets/asset-processing-service/asset.factory.d.ts +17 -0
  232. package/src/services/assets/asset-processing-service/asset.factory.js +82 -0
  233. package/src/services/assets/asset-processing-service/assets.types.d.ts +103 -0
  234. package/src/services/assets/asset-processing-service/assets.types.js +0 -0
  235. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +57 -0
  236. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +49 -0
  237. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +20 -0
  238. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +41 -0
  239. package/src/services/assets/asset-processing-service/grouped-content-bundles.d.ts +30 -0
  240. package/src/services/assets/asset-processing-service/grouped-content-bundles.js +65 -0
  241. package/src/services/assets/asset-processing-service/index.d.ts +6 -0
  242. package/src/services/assets/asset-processing-service/index.js +6 -0
  243. package/src/services/assets/asset-processing-service/page-package.d.ts +6 -0
  244. package/src/services/assets/asset-processing-service/page-package.js +80 -0
  245. package/src/services/assets/asset-processing-service/{processor.interface.ts → processor.interface.d.ts} +5 -10
  246. package/src/services/assets/asset-processing-service/processor.interface.js +6 -0
  247. package/src/services/assets/asset-processing-service/processor.registry.d.ts +8 -0
  248. package/src/services/assets/asset-processing-service/processor.registry.js +15 -0
  249. package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +24 -0
  250. package/src/services/assets/asset-processing-service/processors/base/base-processor.js +65 -0
  251. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +22 -0
  252. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +136 -0
  253. package/src/services/assets/asset-processing-service/processors/index.d.ts +5 -0
  254. package/src/services/assets/asset-processing-service/processors/index.js +5 -0
  255. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +6 -0
  256. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +120 -0
  257. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +9 -0
  258. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +97 -0
  259. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +42 -0
  260. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +126 -0
  261. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +8 -0
  262. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +59 -0
  263. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +9 -0
  264. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +69 -0
  265. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.d.ts +18 -0
  266. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.js +45 -0
  267. package/src/services/assets/browser-bundle.service.d.ts +73 -0
  268. package/src/services/assets/browser-bundle.service.js +41 -0
  269. package/src/services/cache/cache.types.d.ts +107 -0
  270. package/src/services/cache/cache.types.js +0 -0
  271. package/src/services/cache/index.d.ts +7 -0
  272. package/src/services/cache/index.js +7 -0
  273. package/src/services/cache/memory-cache-store.d.ts +42 -0
  274. package/src/services/cache/memory-cache-store.js +98 -0
  275. package/src/services/cache/page-cache-service.d.ts +70 -0
  276. package/src/services/cache/page-cache-service.js +152 -0
  277. package/src/services/cache/page-request-cache-coordinator.service.d.ts +75 -0
  278. package/src/services/cache/page-request-cache-coordinator.service.js +109 -0
  279. package/src/services/html/html-rewriter-provider.service.d.ts +40 -0
  280. package/src/services/html/html-rewriter-provider.service.js +68 -0
  281. package/src/services/html/html-transformer.service.d.ts +96 -0
  282. package/src/services/html/html-transformer.service.js +287 -0
  283. package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
  284. package/src/services/invalidation/development-invalidation.service.js +190 -0
  285. package/src/services/module-loading/app-module-loader.service.d.ts +7 -0
  286. package/src/services/module-loading/app-module-loader.service.js +0 -0
  287. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +24 -0
  288. package/src/services/module-loading/app-server-module-transpiler.service.js +130 -0
  289. package/src/services/module-loading/host-module-loader-registry.d.ts +4 -0
  290. package/src/services/module-loading/host-module-loader-registry.js +15 -0
  291. package/src/services/module-loading/{module-loading-types.ts → module-loading-types.d.ts} +0 -1
  292. package/src/services/module-loading/module-loading-types.js +0 -0
  293. package/src/services/module-loading/page-module-import.service.d.ts +95 -0
  294. package/src/services/module-loading/page-module-import.service.js +193 -0
  295. package/src/services/module-loading/server-module-transpiler.service.d.ts +63 -0
  296. package/src/services/module-loading/server-module-transpiler.service.js +64 -0
  297. package/src/services/module-loading/source-module-support.d.ts +5 -0
  298. package/src/services/module-loading/source-module-support.js +8 -0
  299. package/src/services/runtime-state/dev-graph.service.d.ts +118 -0
  300. package/src/services/runtime-state/dev-graph.service.js +162 -0
  301. package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +41 -0
  302. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +85 -0
  303. package/src/services/runtime-state/server-invalidation-state.service.d.ts +26 -0
  304. package/src/services/runtime-state/server-invalidation-state.service.js +35 -0
  305. package/src/services/validation/schema-validation-service.d.ts +122 -0
  306. package/src/services/validation/schema-validation-service.js +101 -0
  307. package/src/services/validation/{standard-schema.types.ts → standard-schema.types.d.ts} +17 -20
  308. package/src/services/validation/standard-schema.types.js +0 -0
  309. package/src/static-site-generator/static-site-generator.d.ts +104 -0
  310. package/src/static-site-generator/static-site-generator.js +316 -0
  311. package/src/types/internal-types.d.ts +232 -0
  312. package/src/types/internal-types.js +0 -0
  313. package/src/types/public-types.d.ts +1307 -0
  314. package/src/types/public-types.js +0 -0
  315. package/src/utils/deep-merge.d.ts +14 -0
  316. package/src/utils/deep-merge.js +32 -0
  317. package/src/utils/hash.d.ts +1 -0
  318. package/src/utils/hash.js +7 -0
  319. package/src/utils/html-escaping.d.ts +7 -0
  320. package/src/utils/html-escaping.js +6 -0
  321. package/src/utils/html.js +4 -0
  322. package/src/utils/invariant.d.ts +5 -0
  323. package/src/utils/invariant.js +11 -0
  324. package/src/utils/locals-utils.d.ts +15 -0
  325. package/src/utils/locals-utils.js +24 -0
  326. package/src/utils/parse-cli-args.d.ts +27 -0
  327. package/src/utils/parse-cli-args.js +62 -0
  328. package/src/utils/path-utils.module.d.ts +5 -0
  329. package/src/utils/path-utils.module.js +14 -0
  330. package/src/utils/resolve-work-dir.d.ts +11 -0
  331. package/src/utils/resolve-work-dir.js +31 -0
  332. package/src/utils/runtime.d.ts +11 -0
  333. package/src/utils/runtime.js +40 -0
  334. package/src/utils/server-utils.module.d.ts +19 -0
  335. package/src/utils/server-utils.module.js +56 -0
  336. package/src/watchers/project-watcher.d.ts +136 -0
  337. package/src/watchers/project-watcher.js +275 -0
  338. package/src/watchers/project-watcher.test-helpers.d.ts +4 -0
  339. package/src/watchers/project-watcher.test-helpers.js +52 -0
  340. package/src/adapters/abstract/application-adapter.test.ts +0 -218
  341. package/src/adapters/abstract/application-adapter.ts +0 -379
  342. package/src/adapters/abstract/router-adapter.ts +0 -30
  343. package/src/adapters/abstract/server-adapter.ts +0 -79
  344. package/src/adapters/bun/client-bridge.ts +0 -62
  345. package/src/adapters/bun/create-app.ts +0 -214
  346. package/src/adapters/bun/hmr-manager.test.ts +0 -265
  347. package/src/adapters/bun/hmr-manager.ts +0 -88
  348. package/src/adapters/bun/index.ts +0 -2
  349. package/src/adapters/bun/runtime-host.ts +0 -76
  350. package/src/adapters/bun/server-adapter.ts +0 -605
  351. package/src/adapters/bun/static-preview-host.ts +0 -70
  352. package/src/adapters/create-app.test.ts +0 -10
  353. package/src/adapters/create-app.ts +0 -91
  354. package/src/adapters/index.ts +0 -2
  355. package/src/adapters/node/create-app.test.ts +0 -76
  356. package/src/adapters/node/create-app.ts +0 -116
  357. package/src/adapters/node/http-request-bridge.test.ts +0 -146
  358. package/src/adapters/node/http-request-bridge.ts +0 -176
  359. package/src/adapters/node/node-client-bridge.test.ts +0 -198
  360. package/src/adapters/node/node-client-bridge.ts +0 -79
  361. package/src/adapters/node/node-hmr-manager.test.ts +0 -374
  362. package/src/adapters/node/node-hmr-manager.ts +0 -72
  363. package/src/adapters/node/runtime-host.test.ts +0 -49
  364. package/src/adapters/node/runtime-host.ts +0 -113
  365. package/src/adapters/node/server-adapter-dependencies.ts +0 -28
  366. package/src/adapters/node/server-adapter.test.ts +0 -84
  367. package/src/adapters/node/server-adapter.ts +0 -423
  368. package/src/adapters/node/static-content-server.test.ts +0 -60
  369. package/src/adapters/node/static-content-server.ts +0 -239
  370. package/src/adapters/node/static-preview-host.test.ts +0 -89
  371. package/src/adapters/node/static-preview-host.ts +0 -101
  372. package/src/adapters/shared/api-response.test.ts +0 -97
  373. package/src/adapters/shared/api-response.ts +0 -104
  374. package/src/adapters/shared/application-adapter.ts +0 -199
  375. package/src/adapters/shared/define-api-handler.ts +0 -66
  376. package/src/adapters/shared/explicit-static-render-preparation.ts +0 -58
  377. package/src/adapters/shared/explicit-static-route-matcher.test.ts +0 -381
  378. package/src/adapters/shared/explicit-static-route-matcher.ts +0 -131
  379. package/src/adapters/shared/file-route-middleware-pipeline.test.ts +0 -85
  380. package/src/adapters/shared/file-route-middleware-pipeline.ts +0 -118
  381. package/src/adapters/shared/fs-server-response-factory.test.ts +0 -176
  382. package/src/adapters/shared/fs-server-response-factory.ts +0 -96
  383. package/src/adapters/shared/fs-server-response-matcher.test.ts +0 -311
  384. package/src/adapters/shared/fs-server-response-matcher.ts +0 -240
  385. package/src/adapters/shared/hmr-entrypoint-registrar.ts +0 -149
  386. package/src/adapters/shared/hmr-html-response.ts +0 -54
  387. package/src/adapters/shared/hmr-manager.contract.test.ts +0 -228
  388. package/src/adapters/shared/hmr-manager.dispatch.test.ts +0 -229
  389. package/src/adapters/shared/render-context.test.ts +0 -244
  390. package/src/adapters/shared/render-context.ts +0 -161
  391. package/src/adapters/shared/runtime-app-bootstrap.test.ts +0 -96
  392. package/src/adapters/shared/runtime-app-bootstrap.ts +0 -72
  393. package/src/adapters/shared/runtime-host.ts +0 -11
  394. package/src/adapters/shared/server-adapter.test.ts +0 -130
  395. package/src/adapters/shared/server-adapter.ts +0 -571
  396. package/src/adapters/shared/server-route-handler.test.ts +0 -112
  397. package/src/adapters/shared/server-route-handler.ts +0 -153
  398. package/src/adapters/shared/server-static-builder.test.ts +0 -338
  399. package/src/adapters/shared/server-static-builder.ts +0 -170
  400. package/src/adapters/shared/shared-hmr-manager.ts +0 -298
  401. package/src/adapters/shared/static-preview-host.ts +0 -12
  402. package/src/build/browser-runtime-manifest.test.ts +0 -121
  403. package/src/build/browser-runtime-manifest.ts +0 -105
  404. package/src/build/browser-runtime-plugin-helpers.test.ts +0 -49
  405. package/src/build/browser-runtime-plugin.test.ts +0 -256
  406. package/src/build/browser-runtime-plugin.ts +0 -306
  407. package/src/build/build-adapter.test.ts +0 -463
  408. package/src/build/build-adapter.ts +0 -788
  409. package/src/build/build-manifest.ts +0 -79
  410. package/src/build/build-types.ts +0 -83
  411. package/src/build/rolldown-build-adapter.test.ts +0 -352
  412. package/src/build/rolldown-build-adapter.ts +0 -363
  413. package/src/build/rolldown-plugin-bridge.test.ts +0 -256
  414. package/src/build/rolldown-plugin-bridge.ts +0 -309
  415. package/src/build/runtime-build-executor.test.ts +0 -130
  416. package/src/build/runtime-build-output-normalizer.ts +0 -137
  417. package/src/build/serialized-build-executor.test.ts +0 -96
  418. package/src/build/serialized-build-executor.ts +0 -90
  419. package/src/build/server-side-css-shim-plugin.ts +0 -77
  420. package/src/cache/module-parse-cache.test.ts +0 -73
  421. package/src/cache/module-parse-cache.ts +0 -137
  422. package/src/config/config-builder.test.ts +0 -456
  423. package/src/config/config-builder.ts +0 -728
  424. package/src/config/config-builder.typecheck.test.ts +0 -96
  425. package/src/dev/host-runtime.ts +0 -34
  426. package/src/dev/sc-server.ts +0 -143
  427. package/src/eco/eco.browser.test.ts +0 -43
  428. package/src/eco/eco.browser.ts +0 -137
  429. package/src/eco/eco.test.ts +0 -781
  430. package/src/eco/eco.ts +0 -262
  431. package/src/eco/eco.types.ts +0 -293
  432. package/src/eco/eco.utils.test.ts +0 -219
  433. package/src/eco/eco.utils.ts +0 -5
  434. package/src/eco/global-injector-map.test.ts +0 -42
  435. package/src/eco/global-injector-map.ts +0 -112
  436. package/src/eco/lazy-injector-map.test.ts +0 -66
  437. package/src/eco/lazy-injector-map.ts +0 -120
  438. package/src/eco/module-dependencies.test.ts +0 -30
  439. package/src/eco/module-dependencies.ts +0 -75
  440. package/src/errors/http-error.test.ts +0 -134
  441. package/src/errors/http-error.ts +0 -72
  442. package/src/errors/index.ts +0 -3
  443. package/src/errors/locals-access-error.ts +0 -7
  444. package/src/global/app-logger.ts +0 -4
  445. package/src/global/utils.test.ts +0 -12
  446. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-have-HMR-script-injected-in-page-1.png +0 -0
  447. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-load-fixture-app-page-1.png +0 -0
  448. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-WebSocket-Connection-should-connect-to-correct-HMR-endpoint-1.png +0 -0
  449. package/src/hmr/client/hmr-runtime.ts +0 -162
  450. package/src/hmr/hmr-strategy.test.ts +0 -124
  451. package/src/hmr/hmr-strategy.ts +0 -177
  452. package/src/hmr/hmr.postcss.test.e2e.ts +0 -41
  453. package/src/hmr/hmr.test.e2e.ts +0 -66
  454. package/src/hmr/strategies/default-hmr-strategy.ts +0 -60
  455. package/src/hmr/strategies/js-hmr-strategy.test.ts +0 -344
  456. package/src/hmr/strategies/js-hmr-strategy.ts +0 -307
  457. package/src/index.browser.ts +0 -3
  458. package/src/index.ts +0 -15
  459. package/src/integrations/ghtml/ghtml-renderer.test.ts +0 -253
  460. package/src/integrations/ghtml/ghtml-renderer.ts +0 -87
  461. package/src/integrations/ghtml/ghtml.constants.ts +0 -1
  462. package/src/integrations/ghtml/ghtml.plugin.ts +0 -28
  463. package/src/plugins/alias-resolver-cache.test.ts +0 -110
  464. package/src/plugins/alias-resolver-cache.ts +0 -145
  465. package/src/plugins/alias-resolver-plugin.test.ts +0 -41
  466. package/src/plugins/alias-resolver-plugin.ts +0 -75
  467. package/src/plugins/eco-component-meta-plugin.test.ts +0 -421
  468. package/src/plugins/eco-component-meta-plugin.ts +0 -518
  469. package/src/plugins/foreign-jsx-override-plugin.test.ts +0 -65
  470. package/src/plugins/foreign-jsx-override-plugin.ts +0 -76
  471. package/src/plugins/integration-plugin.test.ts +0 -151
  472. package/src/plugins/integration-plugin.ts +0 -344
  473. package/src/plugins/processor.test.ts +0 -148
  474. package/src/plugins/processor.ts +0 -257
  475. package/src/plugins/source-transform.test.ts +0 -82
  476. package/src/plugins/source-transform.ts +0 -123
  477. package/src/route-renderer/orchestration/component-render-context.ts +0 -338
  478. package/src/route-renderer/orchestration/declared-ownership-graph.ts +0 -62
  479. package/src/route-renderer/orchestration/foreign-subtree-execution.service.ts +0 -431
  480. package/src/route-renderer/orchestration/integration-renderer.test.ts +0 -2251
  481. package/src/route-renderer/orchestration/integration-renderer.ts +0 -1384
  482. package/src/route-renderer/orchestration/ownership-planning.service.ts +0 -97
  483. package/src/route-renderer/orchestration/ownership-validation.service.ts +0 -76
  484. package/src/route-renderer/orchestration/processed-asset-dedupe.ts +0 -29
  485. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.test.ts +0 -435
  486. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.ts +0 -310
  487. package/src/route-renderer/orchestration/render-output.utils.ts +0 -310
  488. package/src/route-renderer/orchestration/route-render-orchestrator.prepare-render-options.test.ts +0 -1365
  489. package/src/route-renderer/orchestration/route-render-orchestrator.test.ts +0 -267
  490. package/src/route-renderer/orchestration/route-render-orchestrator.ts +0 -879
  491. package/src/route-renderer/orchestration/template-serialization.test.ts +0 -110
  492. package/src/route-renderer/orchestration/template-serialization.ts +0 -117
  493. package/src/route-renderer/page-loading/component-dependency-collection.ts +0 -202
  494. package/src/route-renderer/page-loading/declared-asset-collection.ts +0 -153
  495. package/src/route-renderer/page-loading/dependency-resolver.test.ts +0 -761
  496. package/src/route-renderer/page-loading/dependency-resolver.ts +0 -144
  497. package/src/route-renderer/page-loading/ecopages-virtual-imports.ts +0 -75
  498. package/src/route-renderer/page-loading/lazy-entry-collection.ts +0 -167
  499. package/src/route-renderer/page-loading/lazy-trigger-planning.ts +0 -74
  500. package/src/route-renderer/page-loading/module-declaration-aggregation.ts +0 -60
  501. package/src/route-renderer/page-loading/module-declaration-scripts.ts +0 -16
  502. package/src/route-renderer/page-loading/page-dependency-bundling.ts +0 -244
  503. package/src/route-renderer/page-loading/page-module-loader.test.ts +0 -183
  504. package/src/route-renderer/page-loading/page-module-loader.ts +0 -184
  505. package/src/route-renderer/route-renderer.ts +0 -133
  506. package/src/router/client/link-intent.test.browser.ts +0 -51
  507. package/src/router/client/link-intent.ts +0 -92
  508. package/src/router/client/navigation-coordinator.test.ts +0 -237
  509. package/src/router/client/navigation-coordinator.ts +0 -453
  510. package/src/router/server/route-registry.test.ts +0 -176
  511. package/src/router/server/route-registry.ts +0 -382
  512. package/src/services/assets/asset-processing-service/asset-dependency-keys.ts +0 -66
  513. package/src/services/assets/asset-processing-service/asset-processing.service.test.ts +0 -473
  514. package/src/services/assets/asset-processing-service/asset-processing.service.ts +0 -344
  515. package/src/services/assets/asset-processing-service/asset.factory.test.ts +0 -63
  516. package/src/services/assets/asset-processing-service/asset.factory.ts +0 -105
  517. package/src/services/assets/asset-processing-service/assets.types.ts +0 -128
  518. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.test.ts +0 -74
  519. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.ts +0 -98
  520. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.test.ts +0 -67
  521. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.ts +0 -78
  522. package/src/services/assets/asset-processing-service/grouped-content-bundles.ts +0 -104
  523. package/src/services/assets/asset-processing-service/index.ts +0 -6
  524. package/src/services/assets/asset-processing-service/page-package.test.ts +0 -135
  525. package/src/services/assets/asset-processing-service/page-package.ts +0 -103
  526. package/src/services/assets/asset-processing-service/processor.registry.ts +0 -18
  527. package/src/services/assets/asset-processing-service/processors/base/base-processor.test.ts +0 -59
  528. package/src/services/assets/asset-processing-service/processors/base/base-processor.ts +0 -83
  529. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.ts +0 -173
  530. package/src/services/assets/asset-processing-service/processors/index.ts +0 -5
  531. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.test.ts +0 -188
  532. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.ts +0 -138
  533. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.test.ts +0 -326
  534. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.ts +0 -116
  535. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.test.ts +0 -270
  536. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.ts +0 -145
  537. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.test.ts +0 -261
  538. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.ts +0 -72
  539. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.ts +0 -83
  540. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.ts +0 -65
  541. package/src/services/assets/browser-bundle.service.test.ts +0 -66
  542. package/src/services/assets/browser-bundle.service.ts +0 -109
  543. package/src/services/cache/cache.types.ts +0 -126
  544. package/src/services/cache/index.ts +0 -18
  545. package/src/services/cache/memory-cache-store.test.ts +0 -225
  546. package/src/services/cache/memory-cache-store.ts +0 -130
  547. package/src/services/cache/page-cache-service.test.ts +0 -175
  548. package/src/services/cache/page-cache-service.ts +0 -202
  549. package/src/services/cache/page-request-cache-coordinator.service.test.ts +0 -79
  550. package/src/services/cache/page-request-cache-coordinator.service.ts +0 -131
  551. package/src/services/html/html-rewriter-provider.service.test.ts +0 -183
  552. package/src/services/html/html-rewriter-provider.service.ts +0 -105
  553. package/src/services/html/html-transformer.service.test.ts +0 -544
  554. package/src/services/html/html-transformer.service.ts +0 -369
  555. package/src/services/invalidation/development-invalidation.service.test.ts +0 -87
  556. package/src/services/invalidation/development-invalidation.service.ts +0 -262
  557. package/src/services/module-loading/app-module-loader.service.ts +0 -9
  558. package/src/services/module-loading/app-server-module-transpiler.service.test.ts +0 -297
  559. package/src/services/module-loading/app-server-module-transpiler.service.ts +0 -168
  560. package/src/services/module-loading/host-module-loader-registry.ts +0 -15
  561. package/src/services/module-loading/page-module-import.service.test.ts +0 -652
  562. package/src/services/module-loading/page-module-import.service.ts +0 -302
  563. package/src/services/module-loading/server-module-transpiler.service.test.ts +0 -242
  564. package/src/services/module-loading/server-module-transpiler.service.ts +0 -104
  565. package/src/services/module-loading/source-module-support.ts +0 -19
  566. package/src/services/runtime-state/dev-graph.service.ts +0 -217
  567. package/src/services/runtime-state/entrypoint-dependency-graph.service.ts +0 -136
  568. package/src/services/runtime-state/server-invalidation-state.service.ts +0 -68
  569. package/src/services/validation/schema-validation-service.test.ts +0 -223
  570. package/src/services/validation/schema-validation-service.ts +0 -204
  571. package/src/static-site-generator/static-site-generator.test.ts +0 -408
  572. package/src/static-site-generator/static-site-generator.ts +0 -445
  573. package/src/types/internal-types.ts +0 -243
  574. package/src/types/public-types.ts +0 -1508
  575. package/src/utils/deep-merge.test.ts +0 -114
  576. package/src/utils/deep-merge.ts +0 -47
  577. package/src/utils/hash.ts +0 -5
  578. package/src/utils/html-escaping.ts +0 -9
  579. package/src/utils/invariant.test.ts +0 -22
  580. package/src/utils/invariant.ts +0 -15
  581. package/src/utils/locals-utils.ts +0 -37
  582. package/src/utils/parse-cli-args.test.ts +0 -69
  583. package/src/utils/parse-cli-args.ts +0 -105
  584. package/src/utils/path-utils.module.ts +0 -14
  585. package/src/utils/path-utils.test.ts +0 -15
  586. package/src/utils/resolve-work-dir.ts +0 -45
  587. package/src/utils/runtime.ts +0 -44
  588. package/src/utils/server-utils.module.ts +0 -67
  589. package/src/utils/server-utils.test.ts +0 -38
  590. package/src/watchers/project-watcher.integration.test.ts +0 -337
  591. package/src/watchers/project-watcher.test-helpers.ts +0 -42
  592. package/src/watchers/project-watcher.test.ts +0 -768
  593. package/src/watchers/project-watcher.ts +0 -357
  594. /package/src/utils/{html.ts → html.d.ts} +0 -0
@@ -1,788 +0,0 @@
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
- */
19
-
20
- import type { EcoBuildPlugin } from './build-types.ts';
21
- import { mergeBrowserRuntimeManifests } from './browser-runtime-manifest.ts';
22
- import { normalizeNodeRuntimeBuildOutputs } from './runtime-build-output-normalizer.ts';
23
- import { createForeignJsxOverridePlugin } from '../plugins/foreign-jsx-override-plugin.ts';
24
- import {
25
- createAppBuildManifest,
26
- getBrowserBuildPlugins,
27
- getServerBuildPlugins,
28
- type AppBuildManifest,
29
- } from './build-manifest.ts';
30
- import { createRolldownBuildAdapter } from './rolldown-build-adapter.ts';
31
- import type { EcoPagesAppConfig } from '../types/internal-types.ts';
32
- import type { IHmrManager } from '../types/public-types.ts';
33
-
34
- /**
35
- * Which backend owns the app's build pipeline.
36
- *
37
- * - `'rolldown'`: the default. Ecopages runs the build directly through
38
- * its bundler-backed adapter.
39
- * - `'vite-host'`: a host runtime owns the build. {@link ViteHostBuildAdapter}
40
- * is exposed as a boundary marker; any direct call into it throws.
41
- */
42
- export type BuildOwnership = 'vite-host' | 'rolldown';
43
-
44
- /**
45
- * A single message emitted by the build backend.
46
- *
47
- * @remarks
48
- * Today this only carries `message`. Severity and structured fields
49
- * belong in a future schema bump; the current shape mirrors the
50
- * bundler's log output 1:1.
51
- */
52
- export interface BuildLog {
53
- message: string;
54
- }
55
-
56
- /**
57
- * A single artifact emitted by the build backend.
58
- *
59
- * @remarks
60
- * `path` is the absolute on-disk path of the emitted file. For
61
- * filename templates that include a content-hash token, the bundler
62
- * returns the concrete resolved path (not the template), so callers
63
- * can read the file directly.
64
- */
65
- export interface BuildOutput {
66
- path: string;
67
- }
68
-
69
- /**
70
- * Per-entrypoint dependency metadata surfaced alongside a build.
71
- *
72
- * @remarks
73
- * Populated from the bundler's per-chunk module list and exposed as a
74
- * normalized absolute-path map. Consumers (HMR invalidation, the build
75
- * manifest) read this without needing to know which adapter produced
76
- * it. The shape is preserved across adapters so historical callers
77
- * continue to compile.
78
- */
79
- export interface BuildDependencyGraph {
80
- /**
81
- * Normalized absolute entrypoint path mapped to every normalized
82
- * absolute source input that contributed to that entrypoint's
83
- * output, including the entrypoint itself.
84
- */
85
- entrypoints: Record<string, string[]>;
86
- }
87
-
88
- /**
89
- * The full result of one `BuildAdapter.build` call.
90
- *
91
- * @remarks
92
- * `success === false` means the build failed and `outputs` will be
93
- * empty. Inspect `logs` for the error message; the original `Error` is
94
- * already normalized into `BuildLog` shape.
95
- */
96
- export interface BuildResult {
97
- success: boolean;
98
- logs: BuildLog[];
99
- outputs: BuildOutput[];
100
- /**
101
- * Per-entrypoint dependency metadata, when the backend produced it.
102
- * Some backends (notably the Vite-host boundary marker) leave this
103
- * undefined; callers must treat that as a valid state and fall
104
- * back deterministically.
105
- */
106
- dependencyGraph?: BuildDependencyGraph;
107
- }
108
-
109
- /**
110
- * Options accepted by every `BuildAdapter.build` call.
111
- *
112
- * @remarks
113
- * Fields that the adapter can forward are honored; fields that cannot
114
- * (currently `splitting`, `bundle`, and `outbase`) are accepted so
115
- * call-sites compile, but the adapter ignores them. See each field's
116
- * docstring for the current behavior.
117
- */
118
- export interface BuildOptions {
119
- /**
120
- * Absolute or context-root-relative source files that begin the build graph.
121
- *
122
- * Use a record (key → source path) when the caller needs to control chunk
123
- * names. Keys become the `[name]` token in `naming`, which lets the caller
124
- * embed path information that the bundler would otherwise strip.
125
- */
126
- entrypoints: string[] | Record<string, string>;
127
- /** Output directory. Defaults to `dist/assets` when omitted. */
128
- outdir?: string;
129
- /**
130
- * Base directory for `[dir]` placeholders in `naming`. Currently
131
- * the bundled adapter derives the base from `root` directly and
132
- * ignores this field.
133
- */
134
- outbase?: string;
135
- /**
136
- * Filename pattern for entrypoints. The bundled adapter honors
137
- * `[name]`, `[hash]`, and `[ext]`. The `[dir]` token is stripped
138
- * before forwarding to the bundler (rolldown does not implement it);
139
- * callers that need directory structure preserved should use the
140
- * record form of `entrypoints` so each key becomes its own chunk.
141
- * When omitted, the bundler's default applies.
142
- */
143
- naming?: string;
144
- /**
145
- * Package export conditions to honor during resolution
146
- * (e.g. `['import', 'browser', 'default']`).
147
- */
148
- conditions?: string[];
149
- /**
150
- * Global identifier replacements. Honored by the bundled adapter.
151
- */
152
- define?: Record<string, string>;
153
- /** Run the bundler's minifier. Off by default. */
154
- minify?: boolean;
155
- /** Enable the bundler's tree-shaker. Defaults to `true`. */
156
- treeshaking?: boolean;
157
- /**
158
- * Output target family. Accepted values: `'browser'`, `'node'`,
159
- * anything else falls through to a platform-neutral setup.
160
- */
161
- target?: string;
162
- /** Output module format. Accepted: `'esm'`, `'cjs'`, `'iife'`. */
163
- format?: string;
164
- /**
165
- * Source map mode. Accepted: `'none'`, `'inline'`, `'external'`,
166
- * `'linked'`. Anything else maps to the bundler's default (linked).
167
- */
168
- sourcemap?: string;
169
- /**
170
- * Historical code-splitting flag. Currently a no-op on the bundled
171
- * adapter: the bundler splits by default and this flag is not
172
- * forwarded. See the per-chunk naming convention in the adapter for
173
- * the available control.
174
- */
175
- splitting?: boolean;
176
- /** Project root used to resolve relative paths and the tsconfig lookup. */
177
- root?: string;
178
- /**
179
- * Historical bundle flag. Currently a no-op on the bundled adapter:
180
- * the bundler always bundles. Accepted so call-sites compile.
181
- */
182
- bundle?: boolean;
183
- /**
184
- * Treat `node_modules` packages as external. Honored by the bundled
185
- * adapter.
186
- */
187
- externalPackages?: boolean;
188
- /** Explicit list of module specifiers to leave as external imports. */
189
- external?: string[];
190
- /**
191
- * JSX runtime configuration. Mirrors the bundler's `jsx` option shape.
192
- */
193
- jsx?: {
194
- development?: boolean;
195
- factory?: string;
196
- fragment?: string;
197
- importSource?: string;
198
- runtime?: 'classic' | 'automatic';
199
- sideEffects?: boolean;
200
- };
201
- /**
202
- * Runtime-agnostic `EcoBuildPlugin[]` to attach to this build. The
203
- * bundled adapter translates the array via the rolldown plugin
204
- * bridge.
205
- */
206
- plugins?: EcoBuildPlugin[];
207
- /**
208
- * Escape hatch for backends that need to forward unknown options
209
- * to their underlying driver. Consumers should prefer the typed
210
- * fields above.
211
- */
212
- [key: string]: unknown;
213
- }
214
-
215
- /** Stable profile identifiers for `BuildAdapter.getTranspileOptions`. */
216
- export type BuildTranspileProfile = 'browser-script' | 'hmr-runtime' | 'hmr-entrypoint';
217
-
218
- /**
219
- * Resolved transpile settings for a given profile.
220
- *
221
- * @remarks
222
- * The three fields map 1:1 to the trio the HMR and browser-script
223
- * code paths look at: target platform, output format, and source-map
224
- * mode. Today the bundled adapter returns identical defaults for all
225
- * three profiles; the type is kept open so per-profile tuning can
226
- * land without breaking callers.
227
- */
228
- export interface BuildTranspileOptions {
229
- target: string;
230
- format: string;
231
- sourcemap: string;
232
- }
233
-
234
- /**
235
- * Low-level build backend contract.
236
- *
237
- * @remarks
238
- * One instance is owned by each `EcoPagesAppConfig` (see
239
- * {@link getAppBuildAdapter}). Two implementations exist: the bundled
240
- * adapter does the work; {@link ViteHostBuildAdapter} is a host-owned
241
- * boundary marker that throws on direct use.
242
- */
243
- export interface BuildAdapter {
244
- /** Which backend owns this adapter. Used for routing decisions in app helpers. */
245
- readonly ownership?: BuildOwnership;
246
- /**
247
- * Run one build.
248
- *
249
- * @remarks
250
- * Implementations are expected to be safe to call from any caller.
251
- * Concurrent calls are not guaranteed to be serialized by the
252
- * adapter itself; the dev-watch pipeline wraps the adapter in
253
- * {@link SerializedBuildExecutor} when it needs FIFO ordering.
254
- *
255
- * Returns a `BuildResult` with `success: false` on failure; the
256
- * thrown-error variant (`buildOrThrow`) is reserved for callers
257
- * that need the original `Error` object.
258
- */
259
- build(options: BuildOptions): Promise<BuildResult>;
260
- /**
261
- * Resolve a module specifier against the project's `rootDir`.
262
- *
263
- * @remarks
264
- * Used by the source-loading services when they need to know the
265
- * absolute path of a specifier without performing a full build.
266
- */
267
- resolve(importPath: string, rootDir: string): string;
268
- /**
269
- * Resolve transpile settings for a known profile.
270
- *
271
- * @remarks
272
- * Today the bundled adapter returns identical defaults for all
273
- * profiles. The profile argument is kept so per-profile tuning
274
- * can land without breaking callers.
275
- */
276
- getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
277
- }
278
-
279
- /**
280
- * Runtime-facing facade for issuing builds.
281
- *
282
- * @remarks
283
- * Strictly narrower than {@link BuildAdapter}: it only exposes `build`.
284
- * This is the shape stored on `appConfig.runtime.buildExecutor` and
285
- * passed across the dev-watch and server-module-loading seams, so
286
- * callers cannot accidentally depend on `resolve` or
287
- * `getTranspileOptions`.
288
- *
289
- * In production and non-watch flows the executor is the adapter
290
- * itself. In development watch flows the executor is a
291
- * {@link SerializedBuildExecutor} wrapping the adapter so dev-watch
292
- * pipelines are FIFO-serialized.
293
- */
294
- export interface BuildExecutor {
295
- build(options: BuildOptions): Promise<BuildResult>;
296
- }
297
-
298
- /**
299
- * Merges `appPlugins` into an existing `plugins` array, deduping by
300
- * `plugin.name` so the app-owned manifest always wins on collision.
301
- *
302
- * @remarks
303
- * The last write wins because the function intentionally lets the
304
- * caller-supplied list override a manifest entry. Tests that exercise
305
- * this behavior live in `build-adapter.test.ts`.
306
- */
307
- function mergeBuildExecutorPlugins(
308
- existing: EcoBuildPlugin[] | undefined,
309
- appPlugins: EcoBuildPlugin[],
310
- ): EcoBuildPlugin[] {
311
- if (!existing || existing.length === 0) {
312
- return appPlugins;
313
- }
314
- const byName = new Map<string, EcoBuildPlugin>();
315
- for (const plugin of existing) {
316
- byName.set(plugin.name, plugin);
317
- }
318
- for (const plugin of appPlugins) {
319
- byName.set(plugin.name, plugin);
320
- }
321
- return Array.from(byName.values());
322
- }
323
-
324
- /**
325
- * Wraps a {@link BuildExecutor} so each call to `build` receives the
326
- * union of the caller's `options.plugins` and the plugins sourced
327
- * from `getPlugins()`.
328
- *
329
- * @remarks
330
- * The single point of plugin injection in the runtime path: the
331
- * `ConfigBuilder` stores a raw adapter on
332
- * `appConfig.runtime.buildAdapter` and the
333
- * `installAppRuntimeBuildExecutor` step wraps that adapter with this
334
- * helper. Callers that issue builds against
335
- * `appConfig.runtime.buildExecutor` get the merged plugin set without
336
- * further ceremony.
337
- */
338
- export function withBuildExecutorPlugins(executor: BuildExecutor, getPlugins: () => EcoBuildPlugin[]): BuildExecutor {
339
- return {
340
- async build(options: BuildOptions): Promise<BuildResult> {
341
- const appPlugins = getPlugins();
342
- if (appPlugins.length === 0) {
343
- return executor.build(options);
344
- }
345
- return executor.build({
346
- ...options,
347
- plugins: mergeBuildExecutorPlugins(options.plugins, appPlugins),
348
- });
349
- },
350
- };
351
- }
352
-
353
- function createHostOwnedBuildError(methodName: string): Error {
354
- return new Error(
355
- `Vite-hosted builds are owned by the host runtime. Core cannot ${methodName} through the host-owned compatibility adapter.`,
356
- );
357
- }
358
-
359
- /**
360
- * Boundary-marker adapter for Vite-host ownership.
361
- *
362
- * @remarks
363
- * This is not a real backend. It exists so `appConfig.runtime.buildAdapter`
364
- * can carry the `'vite-host'` ownership without falling back to a
365
- * framework-owned bundler path. Every method throws a
366
- * {@link createHostOwnedBuildError} so misrouted calls fail loudly
367
- * with a clear message instead of silently executing under a
368
- * different backend.
369
- *
370
- * The class stays in the public surface for host runtimes that own
371
- * their build pipeline (e.g. Nitro) and for app code that wants to
372
- * opt into host-owned ownership before its host wires up the build.
373
- */
374
- export class ViteHostBuildAdapter implements BuildAdapter {
375
- readonly ownership = 'vite-host' as const;
376
-
377
- async build(_options: BuildOptions): Promise<BuildResult> {
378
- throw createHostOwnedBuildError('build');
379
- }
380
-
381
- resolve(_importPath: string, _rootDir: string): string {
382
- throw createHostOwnedBuildError('resolve imports');
383
- }
384
-
385
- getTranspileOptions(_profile: BuildTranspileProfile): BuildTranspileOptions {
386
- throw createHostOwnedBuildError('derive transpile options');
387
- }
388
- }
389
-
390
- /**
391
- * Constructs a {@link ViteHostBuildAdapter}. Use only in code paths
392
- * that explicitly opt into the host-owned boundary.
393
- */
394
- export function createViteHostBuildAdapter(): BuildAdapter {
395
- return new ViteHostBuildAdapter();
396
- }
397
-
398
- /**
399
- * Constructs a build adapter for the given ownership.
400
- *
401
- * @param options - When `options.ownership` is omitted, the default is
402
- * `'rolldown'`. The Vite-host path is opt-in.
403
- */
404
- export function createBuildAdapter(options?: { ownership?: BuildOwnership }): BuildAdapter {
405
- switch (options?.ownership ?? 'rolldown') {
406
- case 'vite-host':
407
- return createViteHostBuildAdapter();
408
- case 'rolldown':
409
- default:
410
- return createRolldownBuildAdapter();
411
- }
412
- }
413
-
414
- /** The shared default-bundler backend instance. Use {@link getAppBuildAdapter} in app-aware code. */
415
- export const defaultRolldownBuildAdapter: BuildAdapter = createBuildAdapter({ ownership: 'rolldown' });
416
-
417
- /** The shared Vite-host boundary instance. Use {@link getAppBuildAdapter} in app-aware code. */
418
- export const defaultViteHostBuildAdapter: BuildAdapter = createBuildAdapter({ ownership: 'vite-host' });
419
-
420
- /**
421
- * Global default build adapter.
422
- *
423
- * @remarks
424
- * Resolves to the bundled default-bundler adapter. New app-aware
425
- * code should prefer {@link getAppBuildAdapter}.
426
- */
427
- export const defaultBuildAdapter: BuildAdapter = defaultRolldownBuildAdapter;
428
-
429
- /**
430
- * Resolves the default build adapter for an ownership value.
431
- *
432
- * @param ownership - Defaults to `'rolldown'`. Returns the
433
- * {@link ViteHostBuildAdapter} only when the caller explicitly asks
434
- * for `'vite-host'`.
435
- */
436
- export function getDefaultBuildAdapter(ownership: BuildOwnership = 'rolldown'): BuildAdapter {
437
- return ownership === 'vite-host' ? defaultViteHostBuildAdapter : defaultRolldownBuildAdapter;
438
- }
439
-
440
- /**
441
- * Reads the {@link BuildOwnership} declared on a {@link BuildAdapter}.
442
- *
443
- * @param buildAdapter - When `undefined`, defaults to `'rolldown'`.
444
- */
445
- export function getBuildAdapterOwnership(buildAdapter: BuildAdapter | undefined): BuildOwnership {
446
- return buildAdapter?.ownership ?? 'rolldown';
447
- }
448
-
449
- /**
450
- * Resolves the build ownership of an app config.
451
- *
452
- * @remarks
453
- * Resolution order: `appConfig.runtime.buildOwnership` (explicit), then
454
- * the ownership declared on `appConfig.runtime.buildAdapter`, then the
455
- * default `'rolldown'`.
456
- */
457
- export function getAppBuildOwnership(appConfig: EcoPagesAppConfig): BuildOwnership {
458
- return appConfig.runtime?.buildOwnership ?? getBuildAdapterOwnership(appConfig.runtime?.buildAdapter);
459
- }
460
-
461
- /**
462
- * Sets the explicit build ownership on an app config.
463
- *
464
- * @remarks
465
- * The `ConfigBuilder` uses this when the caller calls
466
- * `setBuildOwnership`. App code that needs a different ownership
467
- * should call this directly with a new value; passing the same
468
- * value is a no-op.
469
- */
470
- export function setAppBuildOwnership(appConfig: EcoPagesAppConfig, buildOwnership: BuildOwnership): void {
471
- appConfig.runtime = {
472
- ...(appConfig.runtime ?? {}),
473
- buildOwnership,
474
- };
475
- }
476
-
477
- /**
478
- * Returns the adapter owned by an app/runtime instance.
479
- *
480
- * @remarks
481
- * Falls back through `appConfig.runtime.buildAdapter` →
482
- * {@link getDefaultBuildAdapter} on the resolved ownership. Throws
483
- * never; a missing adapter resolves to the global default.
484
- */
485
- export function getAppBuildAdapter(appConfig: EcoPagesAppConfig): BuildAdapter {
486
- return appConfig.runtime?.buildAdapter ?? getDefaultBuildAdapter(getAppBuildOwnership(appConfig));
487
- }
488
-
489
- /**
490
- * Installs the adapter that should serve future builds for one app
491
- * instance, and aligns the ownership field to the new adapter's
492
- * declared ownership.
493
- */
494
- export function setAppBuildAdapter(appConfig: EcoPagesAppConfig, buildAdapter: BuildAdapter): void {
495
- appConfig.runtime = {
496
- ...(appConfig.runtime ?? {}),
497
- buildOwnership: getBuildAdapterOwnership(buildAdapter),
498
- buildAdapter,
499
- };
500
- }
501
-
502
- /**
503
- * Returns the build manifest owned by an app/runtime instance.
504
- *
505
- * @remarks
506
- * Falls back to a fresh manifest seeded from the config's loaders when
507
- * the app config has no manifest yet. This is the supported way to
508
- * read the manifest across the source-loading and asset-processing
509
- * services.
510
- */
511
- export function getAppBuildManifest(appConfig: EcoPagesAppConfig): AppBuildManifest {
512
- return (
513
- appConfig.runtime?.buildManifest ??
514
- createAppBuildManifest({
515
- loaderPlugins: Array.from(appConfig.loaders.values()),
516
- })
517
- );
518
- }
519
-
520
- /** Installs the build manifest that should be visible to one app instance. */
521
- export function setAppBuildManifest(appConfig: EcoPagesAppConfig, buildManifest: AppBuildManifest): void {
522
- appConfig.runtime = {
523
- ...(appConfig.runtime ?? {}),
524
- buildManifest,
525
- };
526
- }
527
-
528
- /**
529
- * Builds a fresh app manifest from the config's loaders plus optional
530
- * caller-supplied runtime/browser contributions.
531
- *
532
- * @remarks
533
- * Loader plugins are always taken from the config; runtime and
534
- * browser-bundle plugins are passed through from the caller when
535
- * supplied, otherwise left empty for later population by
536
- * {@link collectConfiguredAppBuildManifestContributions}.
537
- */
538
- export function createConfiguredAppBuildManifest(
539
- appConfig: EcoPagesAppConfig,
540
- input?: Partial<AppBuildManifest>,
541
- ): AppBuildManifest {
542
- return createAppBuildManifest({
543
- loaderPlugins: input?.loaderPlugins ?? Array.from(appConfig.loaders.values()),
544
- runtimePlugins: input?.runtimePlugins,
545
- browserBundlePlugins: input?.browserBundlePlugins,
546
- browserRuntimeManifest: input?.browserRuntimeManifest,
547
- });
548
- }
549
-
550
- /**
551
- * Replaces the app-owned manifest using config-owned loaders and the
552
- * caller-supplied contribution input.
553
- */
554
- export function updateAppBuildManifest(appConfig: EcoPagesAppConfig, input?: Partial<AppBuildManifest>): void {
555
- setAppBuildManifest(appConfig, createConfiguredAppBuildManifest(appConfig, input));
556
- }
557
-
558
- /**
559
- * Collects the build-facing processor and integration contributions
560
- * that should be sealed into the app manifest during config
561
- * finalization.
562
- *
563
- * @remarks
564
- * Runs `prepareBuildContributions()` on every processor and
565
- * integration. Runtime-only side effects (HMR registration, cache
566
- * prewarming, runtime-origin wiring) belong to the startup path and
567
- * must not be triggered here; use {@link setupAppRuntimePlugins} for
568
- * those.
569
- *
570
- * @returns The new manifest's runtime / browser / browser-runtime-manifest
571
- * contribution buckets. Caller seals them into a manifest via
572
- * {@link updateAppBuildManifest}.
573
- */
574
- export async function collectConfiguredAppBuildManifestContributions(
575
- appConfig: EcoPagesAppConfig,
576
- ): Promise<Pick<AppBuildManifest, 'runtimePlugins' | 'browserBundlePlugins' | 'browserRuntimeManifest'>> {
577
- const runtimePlugins: EcoBuildPlugin[] = [];
578
- const browserBundlePlugins: EcoBuildPlugin[] = [];
579
- const browserRuntimeManifests = [];
580
-
581
- for (const processor of appConfig.processors.values()) {
582
- await processor.prepareBuildContributions();
583
-
584
- if (processor.plugins) {
585
- runtimePlugins.push(...processor.plugins);
586
- }
587
-
588
- if (processor.buildPlugins) {
589
- browserBundlePlugins.push(...processor.buildPlugins);
590
- }
591
- }
592
-
593
- for (const integration of appConfig.integrations) {
594
- integration.setConfig(appConfig);
595
- await integration.prepareBuildContributions();
596
- runtimePlugins.push(...(integration.plugins ?? []));
597
- browserBundlePlugins.push(...(integration.browserBuildPlugins ?? []));
598
- browserRuntimeManifests.push(integration.browserRuntimeManifest);
599
- }
600
-
601
- return {
602
- runtimePlugins,
603
- browserBundlePlugins,
604
- browserRuntimeManifest: mergeBrowserRuntimeManifests(...browserRuntimeManifests),
605
- };
606
- }
607
-
608
- /**
609
- * Runs runtime-only processor and integration setup against an already
610
- * sealed app manifest.
611
- *
612
- * @remarks
613
- * Startup paths call this after `ConfigBuilder.build` has finalized
614
- * the manifest. The manifest is reused as-is; this helper only performs
615
- * the runtime side effects that need live startup context (cache
616
- * prewarming, runtime-origin wiring, HMR manager attachment).
617
- *
618
- * Loaders, processors, and integrations are visited in that order;
619
- * each one's plugins are forwarded to the optional `onRuntimePlugin`
620
- * callback so callers can attach to every plugin discovered.
621
- */
622
- export async function setupAppRuntimePlugins(options: {
623
- appConfig: EcoPagesAppConfig;
624
- runtimeOrigin: string;
625
- hmrManager?: IHmrManager;
626
- onRuntimePlugin?: (plugin: EcoBuildPlugin) => void;
627
- }): Promise<void> {
628
- for (const loader of options.appConfig.loaders.values()) {
629
- options.onRuntimePlugin?.(loader);
630
- }
631
-
632
- for (const processor of options.appConfig.processors.values()) {
633
- await processor.setup();
634
-
635
- if (processor.plugins) {
636
- for (const plugin of processor.plugins) {
637
- options.onRuntimePlugin?.(plugin);
638
- }
639
- }
640
- }
641
-
642
- for (const integration of options.appConfig.integrations) {
643
- integration.setConfig(options.appConfig);
644
- integration.setRuntimeOrigin(options.runtimeOrigin);
645
- if (options.hmrManager) {
646
- integration.setHmrManager(options.hmrManager);
647
- }
648
-
649
- await integration.setup();
650
-
651
- for (const plugin of integration.plugins) {
652
- options.onRuntimePlugin?.(plugin);
653
- }
654
- }
655
- }
656
-
657
- /**
658
- * Returns the server-bundle plugin list for one app/runtime instance.
659
- *
660
- * @remarks
661
- * Reads from the app's sealed build manifest; the manifest itself is
662
- * the source of truth for which plugins participate in the server
663
- * bundle.
664
- */
665
- export function getAppServerBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[] {
666
- return getServerBuildPlugins(getAppBuildManifest(appConfig));
667
- }
668
-
669
- /**
670
- * Returns the browser-bundle plugin list for one app/runtime instance.
671
- *
672
- * @remarks
673
- * Reads from the app's sealed build manifest. The browser-bundle
674
- * manifest is the source of truth for which plugins participate in the
675
- * browser bundle.
676
- */
677
- export function getAppBrowserBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[] {
678
- const manifest = getAppBuildManifest(appConfig);
679
- const jsxOwnershipPlugins = collectJsxOwnershipPlugins(appConfig);
680
- return [...getBrowserBuildPlugins(manifest), ...jsxOwnershipPlugins];
681
- }
682
-
683
- /**
684
- * Builds one {@link createForeignJsxOverridePlugin} instance per JSX
685
- * extension per integration declared in the app config.
686
- *
687
- * The plugin rewrites every file matching a JSX extension with a
688
- * `@jsxImportSource` pragma that names the owning integration. The
689
- * pragma wins over both the bundler default and any tsconfig setting,
690
- * so JSX files in multi-integration graphs always compile against the
691
- * right runtime.
692
- *
693
- * @param appConfig - The app config whose integrations should be
694
- * enumerated. Integrations without a `jsxImportSource` are skipped.
695
- * @returns A flat list of plugins, one per (integration, extension)
696
- * pair, sorted by extension length so more specific suffixes take
697
- * priority.
698
- */
699
- function collectJsxOwnershipPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[] {
700
- const jsxExtensions = (appConfig.integrations ?? [])
701
- .filter((integration) => integration.jsxImportSource)
702
- .flatMap((integration) =>
703
- integration.extensions
704
- .filter((extension) => extension.endsWith('.tsx') || extension.endsWith('.jsx'))
705
- .map((extension) => ({ integration, extension })),
706
- )
707
- .sort((left, right) => right.extension.length - left.extension.length);
708
-
709
- return jsxExtensions.map(({ integration, extension }) =>
710
- createForeignJsxOverridePlugin({
711
- hostJsxImportSource: integration.jsxImportSource!,
712
- foreignExtensions: [extension],
713
- excludeExtensions: jsxExtensions
714
- .filter((candidate) => candidate.extension.length > extension.length)
715
- .filter((candidate) => candidate.extension.endsWith(extension))
716
- .map((candidate) => candidate.extension),
717
- name: `ecopages-jsx-ownership-${integration.name}-${extension.replace(/[^a-zA-Z0-9]+/g, '-')}`,
718
- }),
719
- );
720
- }
721
-
722
- /**
723
- * Returns the executor owned by an app/runtime instance.
724
- *
725
- * @remarks
726
- * Falls back to {@link getAppBuildAdapter} when no executor is set
727
- * on the runtime yet. The dev-watch pipeline replaces this value with
728
- * a {@link SerializedBuildExecutor} via
729
- * {@link installAppRuntimeBuildExecutor}.
730
- */
731
- export function getAppBuildExecutor(appConfig: EcoPagesAppConfig): BuildExecutor {
732
- return appConfig.runtime?.buildExecutor ?? getAppBuildAdapter(appConfig);
733
- }
734
-
735
- /** Installs the executor that should serve future builds for one app instance. */
736
- export function setAppBuildExecutor(appConfig: EcoPagesAppConfig, buildExecutor: BuildExecutor): void {
737
- appConfig.runtime = {
738
- ...(appConfig.runtime ?? {}),
739
- buildExecutor,
740
- };
741
- }
742
-
743
- /**
744
- * Runs a build through the active pipeline.
745
- *
746
- * @remarks
747
- * `executor` defaults to the default-bundler adapter for non-app-aware
748
- * callsites. App-aware code should pass
749
- * `getAppBuildExecutor(appConfig)` (or read it directly) to honor the
750
- * per-app pipeline.
751
- */
752
- export function build(
753
- options: BuildOptions,
754
- executor: BuildExecutor = defaultRolldownBuildAdapter,
755
- ): Promise<BuildResult> {
756
- return executor.build(options).then((result) => {
757
- if (result.success) {
758
- normalizeNodeRuntimeBuildOutputs(
759
- result.outputs.map((output) => output.path),
760
- options.root ?? process.cwd(),
761
- );
762
- }
763
-
764
- return result;
765
- });
766
- }
767
-
768
- /**
769
- * Default transpile-options helper for callsites without app runtime
770
- * context.
771
- *
772
- * @remarks
773
- * New app-aware code should prefer {@link getAppTranspileOptions}.
774
- */
775
- export function getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions {
776
- return defaultRolldownBuildAdapter.getTranspileOptions(profile);
777
- }
778
-
779
- /**
780
- * Resolves transpile options for one app/runtime instance by asking
781
- * the app's adapter.
782
- */
783
- export function getAppTranspileOptions(
784
- appConfig: EcoPagesAppConfig,
785
- profile: BuildTranspileProfile,
786
- ): BuildTranspileOptions {
787
- return getAppBuildAdapter(appConfig).getTranspileOptions(profile);
788
- }