@ecopages/core 0.6.1 → 0.7.0

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 (350) hide show
  1. package/README.md +8 -143
  2. package/package.json +16 -3
  3. package/src/adapters/node/dev-session.js +2 -1
  4. package/src/adapters/node/node-client-bridge.d.ts +5 -7
  5. package/src/adapters/node/node-client-bridge.js +4 -14
  6. package/src/adapters/node/server-adapter.d.ts +4 -2
  7. package/src/adapters/node/server-adapter.js +13 -12
  8. package/src/adapters/shared/hmr/client-bridge.d.ts +25 -0
  9. package/src/adapters/shared/hmr/client-bridge.js +35 -0
  10. package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +1 -1
  11. package/src/adapters/shared/hmr/hmr-manager.d.ts +9 -2
  12. package/src/adapters/shared/hmr/hmr-manager.js +36 -6
  13. package/src/adapters/shared/http/dist-file-handler.js +3 -7
  14. package/src/adapters/shared/http/response-headers.d.ts +29 -0
  15. package/src/adapters/shared/http/response-headers.js +89 -0
  16. package/src/adapters/shared/runtime/copy-runtime-public-dir.js +1 -1
  17. package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +3 -2
  18. package/src/adapters/shared/runtime/runtime-server-lifecycle.js +4 -3
  19. package/src/adapters/shared/runtime/server-request-pipeline.js +4 -4
  20. package/src/adapters/shared/runtime/server-static-builder.d.ts +19 -8
  21. package/src/adapters/shared/runtime/server-static-builder.js +23 -4
  22. package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +1 -1
  23. package/src/adapters/shared/ws/node-http-websocket-upgrades.js +23 -16
  24. package/src/assets/app-browser-client-build.d.ts +5 -12
  25. package/src/assets/app-browser-client-build.js +121 -336
  26. package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +4 -0
  27. package/src/assets/asset-processing-service/app-browser-client-bundle.js +6 -0
  28. package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +28 -8
  29. package/src/assets/asset-processing-service/asset-dependency-keys.js +104 -29
  30. package/src/assets/asset-processing-service/asset-processing.service.d.ts +60 -2
  31. package/src/assets/asset-processing-service/asset-processing.service.js +189 -58
  32. package/src/assets/asset-processing-service/bundleable-script.d.ts +3 -0
  33. package/src/assets/asset-processing-service/bundleable-script.js +4 -0
  34. package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -2
  35. package/src/assets/asset-processing-service/grouped-content-bundles.js +5 -10
  36. package/src/assets/asset-processing-service/index.d.ts +0 -3
  37. package/src/assets/asset-processing-service/index.js +0 -3
  38. package/src/assets/asset-processing-service/last-good-output.d.ts +21 -0
  39. package/src/assets/asset-processing-service/last-good-output.js +32 -0
  40. package/src/assets/asset-processing-service/page-package.js +1 -4
  41. package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +63 -0
  42. package/src/assets/asset-processing-service/processed-asset-ledger.js +101 -0
  43. package/src/assets/asset-processing-service/processors/base/base-processor.js +1 -1
  44. package/src/assets/asset-processing-service/processors/base/base-script-processor.js +1 -1
  45. package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +24 -0
  46. package/src/assets/asset-processing-service/processors/script/content-script.processor.js +59 -4
  47. package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -4
  48. package/src/assets/asset-processing-service/processors/script/file-script.processor.js +18 -6
  49. package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +2 -3
  50. package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.d.ts +34 -0
  51. package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.js +115 -0
  52. package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -2
  53. package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.d.ts +39 -0
  54. package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.js +150 -0
  55. package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.d.ts +84 -0
  56. package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.js +379 -0
  57. package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +16 -0
  58. package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +50 -24
  59. package/src/assets/asset-processing-service/processors/stylesheet/import-order.d.ts +33 -0
  60. package/src/assets/asset-processing-service/processors/stylesheet/import-order.js +67 -0
  61. package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.d.ts +44 -0
  62. package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.js +149 -0
  63. package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.d.ts +31 -0
  64. package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.js +59 -0
  65. package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.d.ts +20 -0
  66. package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.js +51 -0
  67. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.d.ts +2 -0
  68. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js +5 -0
  69. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.d.ts +37 -0
  70. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.js +48 -0
  71. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +25 -1
  72. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +56 -15
  73. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.d.ts +9 -0
  74. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.js +21 -0
  75. package/src/assets/browser-asset-output.js +1 -1
  76. package/src/assets/hashed-browser-asset.js +1 -1
  77. package/src/assets/{browser-runtime-asset-page-cache.d.ts → page-script-page-cache.d.ts} +3 -3
  78. package/src/assets/{browser-runtime-asset-page-cache.js → page-script-page-cache.js} +3 -3
  79. package/src/build/app-build-manifest-runtime.d.ts +23 -11
  80. package/src/build/app-build-manifest-runtime.js +52 -13
  81. package/src/build/browser/jsx-ownership-plugins.d.ts +4 -1
  82. package/src/build/browser/jsx-ownership-plugins.js +6 -0
  83. package/src/build/build-adapter.d.ts +1 -1
  84. package/src/build/build-adapter.js +1 -1
  85. package/src/build/build-graph.d.ts +4 -2
  86. package/src/build/build-graph.js +12 -46
  87. package/src/build/cache/build-input-dependency-index.d.ts +0 -19
  88. package/src/build/cache/build-input-dependency-index.js +1 -34
  89. package/src/build/cache/pages-unified-graph-build.js +7 -43
  90. package/src/build/cache/server-module-entries.d.ts +1 -1
  91. package/src/build/cache/server-module-entries.js +9 -9
  92. package/src/build/contracts/build-contracts.d.ts +59 -12
  93. package/src/build/contracts/build-manifest.d.ts +3 -6
  94. package/src/build/contracts/build-manifest.js +2 -12
  95. package/src/build/contracts/content-virtual-modules.js +1 -3
  96. package/src/build/copy-server-files.js +1 -1
  97. package/src/build/preserve-import-meta-transform.d.ts +3 -1
  98. package/src/build/preserve-import-meta-transform.js +7 -4
  99. package/src/build/production-asset-ledger.d.ts +36 -0
  100. package/src/build/production-asset-ledger.js +104 -0
  101. package/src/build/production-dist-complete.js +12 -13
  102. package/src/build/production-route-list.js +1 -1
  103. package/src/build/rolldown/app-package-declarations.js +1 -1
  104. package/src/build/rolldown/entry-module-closures.d.ts +5 -1
  105. package/src/build/rolldown/entry-module-closures.js +21 -8
  106. package/src/build/rolldown/rolldown-adapter-helpers.d.ts +19 -8
  107. package/src/build/rolldown/rolldown-adapter-helpers.js +82 -45
  108. package/src/build/rolldown/rolldown-build-adapter.js +10 -13
  109. package/src/build/rolldown/rolldown-module-id.d.ts +18 -0
  110. package/src/build/rolldown/rolldown-module-id.js +29 -0
  111. package/src/build/rolldown/rolldown-plugin-bridge.d.ts +24 -60
  112. package/src/build/rolldown/rolldown-plugin-bridge.js +201 -373
  113. package/src/build/rolldown/stylesheet-module-plugin.d.ts +34 -0
  114. package/src/build/rolldown/stylesheet-module-plugin.js +160 -0
  115. package/src/build/rolldown/worker-entries-plugin.d.ts +13 -0
  116. package/src/build/rolldown/worker-entries-plugin.js +57 -0
  117. package/src/build/runtime/build-environment-options.js +13 -3
  118. package/src/build/runtime/build-request-identity.js +1 -1
  119. package/src/build/runtime/build-request-policy.d.ts +7 -12
  120. package/src/build/runtime/build-request-policy.js +63 -17
  121. package/src/build/server/imported-view-plugin.d.ts +1 -0
  122. package/src/build/server/imported-view-plugin.js +6 -4
  123. package/src/build/server/page-module-import.service.d.ts +1 -2
  124. package/src/build/server/page-module-import.service.js +4 -6
  125. package/src/build/server/resolve-static-view.js +3 -2
  126. package/src/build/server/route-module-build-cache-registry.js +1 -1
  127. package/src/build/server/route-module-build-cache.store.js +1 -1
  128. package/src/build/server/route-module-build-manifest.js +1 -1
  129. package/src/build/server/route-module-dependency-hasher.d.ts +1 -1
  130. package/src/build/server/route-module-dependency-hasher.js +2 -2
  131. package/src/build/server/server-modules-manifest.d.ts +3 -5
  132. package/src/build/server/server-modules-manifest.js +6 -21
  133. package/src/build/server/view-module.d.ts +12 -0
  134. package/src/build/server/view-module.js +23 -0
  135. package/src/build/server/view-reference.d.ts +16 -5
  136. package/src/build/server/view-reference.js +25 -14
  137. package/src/build/server-bundle-deploy-manifest.d.ts +1 -1
  138. package/src/build/server-bundle-deploy-manifest.js +2 -2
  139. package/src/build/server-bundle-publication.d.ts +7 -1
  140. package/src/build/server-bundle-publication.js +11 -4
  141. package/src/build/server-module.js +1 -1
  142. package/src/build/worker-urls.d.ts +60 -0
  143. package/src/build/worker-urls.js +197 -0
  144. package/src/build.d.ts +7 -5
  145. package/src/build.js +7 -5
  146. package/src/cache/module-parse-cache.js +2 -2
  147. package/src/client/navigation-attributes.d.ts +8 -0
  148. package/src/client/navigation-attributes.js +8 -0
  149. package/src/client/navigation-scripts/global-scripts.d.ts +14 -0
  150. package/src/client/navigation-scripts/global-scripts.js +65 -0
  151. package/src/client/navigation-scripts/index.d.ts +1 -0
  152. package/src/client/navigation-scripts/index.js +1 -0
  153. package/src/client.d.ts +2 -2
  154. package/src/client.js +2 -2
  155. package/src/config/assembly/app-runtime.d.ts +45 -5
  156. package/src/config/assembly/app-runtime.js +11 -2
  157. package/src/config/assembly/finalize-config.js +13 -5
  158. package/src/config/config-module-files.js +10 -6
  159. package/src/config/index.d.ts +2 -1
  160. package/src/config/internal-types.d.ts +3 -0
  161. package/src/config/load-eco-config.js +8 -5
  162. package/src/config/resolve-eco-config-path.js +3 -3
  163. package/src/config/server-config-bundle.js +1 -1
  164. package/src/config/user-config-types.d.ts +54 -1
  165. package/src/config/write-types.js +4 -1
  166. package/src/css-imports.d.ts +12 -0
  167. package/src/declarations.d.ts +2 -0
  168. package/src/dev/development-restart-watch-paths.js +1 -1
  169. package/src/dev/development-restart.js +1 -1
  170. package/src/dev/invalidation/development-invalidation.service.d.ts +6 -1
  171. package/src/dev/invalidation/development-invalidation.service.js +18 -2
  172. package/src/dev/stylesheets/development-stylesheet.service.d.ts +149 -0
  173. package/src/dev/stylesheets/development-stylesheet.service.js +350 -0
  174. package/src/dev/transform-server/dev-transform-bundler.d.ts +12 -3
  175. package/src/dev/transform-server/dev-transform-bundler.js +32 -21
  176. package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +3 -5
  177. package/src/dev/transform-server/dev-transform-externalize-plugin.js +8 -9
  178. package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +15 -2
  179. package/src/dev/transform-server/dev-transform-import-rewriter.js +204 -35
  180. package/src/dev/transform-server/dev-transform-install-stamp.d.ts +17 -0
  181. package/src/dev/transform-server/dev-transform-install-stamp.js +79 -0
  182. package/src/dev/transform-server/dev-transform-server.d.ts +38 -2
  183. package/src/dev/transform-server/dev-transform-server.js +96 -33
  184. package/src/dev/transform-server/dev-transform-url.d.ts +4 -2
  185. package/src/dev/transform-server/dev-transform-url.js +13 -12
  186. package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +178 -21
  187. package/src/dev/transform-server/dev-transform-vendor-registry.js +675 -99
  188. package/src/dev/transform-server/index.d.ts +1 -1
  189. package/src/dev-toolbar/dev-toolbar-package.js +4 -4
  190. package/src/eco/component-render-output.d.ts +6 -1
  191. package/src/eco/component-render-output.js +32 -7
  192. package/src/eco/discovered-dependencies.d.ts +30 -11
  193. package/src/eco/discovered-dependencies.js +25 -13
  194. package/src/eco/discovered-dependency-paths.d.ts +36 -0
  195. package/src/eco/discovered-dependency-paths.js +58 -0
  196. package/src/eco/eco.browser.js +8 -12
  197. package/src/eco/eco.js +0 -30
  198. package/src/eco/mdx-page-metadata.d.ts +14 -0
  199. package/src/eco/mdx-page-metadata.js +15 -0
  200. package/src/eco/page-layout-normalization.d.ts +6 -2
  201. package/src/eco/page-layout-normalization.js +9 -6
  202. package/src/env.js +17 -0
  203. package/src/hmr/client/hmr-runtime.js +14 -13
  204. package/src/hmr/dev-client-runtime.d.ts +5 -2
  205. package/src/hmr/dev-client-runtime.js +14 -4
  206. package/src/hmr/hmr-entrypoint-output.js +1 -1
  207. package/src/hmr/hmr-strategy.d.ts +2 -2
  208. package/src/hmr/hmr-strategy.js +2 -2
  209. package/src/hmr/strategies/js-hmr-strategy.d.ts +4 -1
  210. package/src/hmr/strategies/js-hmr-strategy.js +7 -6
  211. package/src/hmr/strategies/template-source-hmr-strategy.d.ts +25 -0
  212. package/src/hmr/strategies/template-source-hmr-strategy.js +36 -0
  213. package/src/html-pages/html-page-module-scripts.d.ts +2 -1
  214. package/src/html-pages/html-page-module-scripts.js +37 -14
  215. package/src/html-pages/html-page-module.js +1 -1
  216. package/src/html-pages/html-page-renderer.js +7 -6
  217. package/src/html-pages/html-page-template.d.ts +0 -5
  218. package/src/html-pages/html-page-template.js +3 -15
  219. package/src/html-pages/html-pages.plugin.js +2 -2
  220. package/src/integration.d.ts +8 -6
  221. package/src/integration.js +5 -3
  222. package/src/page-cache/html-page-cache-dependency-index.js +1 -1
  223. package/src/page-cache/page-cache-service.js +1 -1
  224. package/src/plugins/alias-resolver-plugin.d.ts +7 -0
  225. package/src/plugins/alias-resolver-plugin.js +16 -6
  226. package/src/plugins/component-import-discovery.d.ts +178 -7
  227. package/src/plugins/component-import-discovery.js +696 -112
  228. package/src/plugins/eco-component-meta-plugin.d.ts +47 -6
  229. package/src/plugins/eco-component-meta-plugin.js +227 -59
  230. package/src/plugins/foreign-jsx-override-plugin.d.ts +14 -1
  231. package/src/plugins/foreign-jsx-override-plugin.js +18 -8
  232. package/src/plugins/integration-plugin.d.ts +47 -11
  233. package/src/plugins/integration-plugin.js +57 -8
  234. package/src/plugins/processor.d.ts +72 -7
  235. package/src/plugins/processor.js +44 -9
  236. package/src/plugins/stylesheet-kinds.d.ts +57 -0
  237. package/src/plugins/stylesheet-kinds.js +114 -0
  238. package/src/plugins/tsconfig-import-resolver.d.ts +49 -3
  239. package/src/plugins/tsconfig-import-resolver.js +120 -6
  240. package/src/processor-contract.d.ts +66 -0
  241. package/src/processor-contract.js +389 -0
  242. package/src/processor.d.ts +6 -1
  243. package/src/processor.js +6 -1
  244. package/src/route-renderer/error-pages/default-error-pages.d.ts +1 -0
  245. package/src/route-renderer/error-pages/default-error-pages.js +27 -7
  246. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
  247. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +12 -0
  248. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +77 -24
  249. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +97 -32
  250. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +1 -1
  251. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +9 -0
  252. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +16 -2
  253. package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.d.ts +35 -0
  254. package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js +53 -0
  255. package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +4 -8
  256. package/src/route-renderer/orchestration/foreign-child/render-session.js +2 -5
  257. package/src/route-renderer/orchestration/integration-renderer.d.ts +171 -64
  258. package/src/route-renderer/orchestration/integration-renderer.js +293 -332
  259. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +8 -5
  260. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +27 -25
  261. package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +0 -6
  262. package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +3 -3
  263. package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +12 -25
  264. package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +1 -14
  265. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +0 -16
  266. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -87
  267. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +8 -16
  268. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +25 -271
  269. package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +0 -24
  270. package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +0 -67
  271. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +28 -15
  272. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +63 -41
  273. package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -1
  274. package/src/route-renderer/page-loading/component-dependency-collection.js +51 -15
  275. package/src/route-renderer/page-loading/dependency-resolver.d.ts +10 -0
  276. package/src/route-renderer/page-loading/dependency-resolver.js +27 -6
  277. package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +4 -2
  278. package/src/route-renderer/page-loading/file-scoped-dependency-components.js +22 -17
  279. package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +5 -0
  280. package/src/route-renderer/page-loading/lazy-entry-collection.js +6 -4
  281. package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +5 -2
  282. package/src/route-renderer/page-loading/page-dependency-bundling.js +15 -31
  283. package/src/route-renderer/page-loading/page-module-loader.d.ts +13 -2
  284. package/src/route-renderer/page-loading/page-module-loader.js +23 -5
  285. package/src/route-renderer/route-renderer.d.ts +1 -1
  286. package/src/router/client/navigation-commit.d.ts +2 -0
  287. package/src/router/client/navigation-commit.js +4 -1
  288. package/src/router/client/navigation-coordinator.d.ts +18 -0
  289. package/src/router/client/navigation-coordinator.js +14 -0
  290. package/src/router/client/navigation-lifecycle.d.ts +8 -1
  291. package/src/router/client/navigation-lifecycle.js +6 -3
  292. package/src/router/client/navigation-pipeline.d.ts +1 -0
  293. package/src/router/client/navigation-pipeline.js +1 -0
  294. package/src/router/server/route-registry.d.ts +3 -2
  295. package/src/router/server/route-registry.js +6 -5
  296. package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +30 -18
  297. package/src/static-site-generator/production-page-browser-graph-prebuild.js +82 -143
  298. package/src/static-site-generator/static-site-generator.d.ts +37 -4
  299. package/src/static-site-generator/static-site-generator.js +99 -51
  300. package/src/types/asset-types.d.ts +19 -1
  301. package/src/types/build-types.d.ts +53 -35
  302. package/src/types/component-identity.d.ts +8 -0
  303. package/src/types/contracts.d.ts +69 -21
  304. package/src/types/dev-transform-types.d.ts +33 -6
  305. package/src/types/eco-api-types.d.ts +13 -18
  306. package/src/types/integration-types.d.ts +1 -1
  307. package/src/types/public-types.d.ts +1 -1
  308. package/src/utils/additional-watch-paths.js +3 -5
  309. package/src/utils/entry-command-flags.d.ts +23 -0
  310. package/src/utils/entry-command-flags.js +24 -0
  311. package/src/utils/package-path.d.ts +42 -0
  312. package/src/utils/package-path.js +114 -0
  313. package/src/utils/parse-cli-args.d.ts +18 -1
  314. package/src/utils/parse-cli-args.js +54 -37
  315. package/src/utils/path-containment.js +3 -10
  316. package/src/utils/resolve-work-dir.js +2 -2
  317. package/src/utils/root-relative-path.js +2 -2
  318. package/src/utils/server-bundle-context.d.ts +5 -0
  319. package/src/utils/server-bundle-context.js +7 -1
  320. package/src/utils/server-utils.module.js +1 -1
  321. package/src/watchers/project-watcher-ignore.js +3 -3
  322. package/src/watchers/project-watcher.d.ts +14 -2
  323. package/src/watchers/project-watcher.js +37 -6
  324. package/src/watchers/workspace-package-watch-roots.js +2 -2
  325. package/src/assets/app-browser-client-manifest.d.ts +0 -66
  326. package/src/assets/app-browser-client-manifest.js +0 -260
  327. package/src/assets/asset-processing-service/asset-package-role.d.ts +0 -2
  328. package/src/assets/asset-processing-service/asset-package-role.js +0 -3
  329. package/src/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +0 -58
  330. package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -61
  331. package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +0 -79
  332. package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +0 -200
  333. package/src/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +0 -24
  334. package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -67
  335. package/src/build/browser/browser-runtime-manifest.d.ts +0 -35
  336. package/src/build/browser/browser-runtime-manifest.js +0 -65
  337. package/src/build/browser/browser-runtime-plugin-helpers.d.ts +0 -14
  338. package/src/build/browser/browser-runtime-plugin-helpers.js +0 -21
  339. package/src/build/browser/browser-runtime-plugin.d.ts +0 -54
  340. package/src/build/browser/browser-runtime-plugin.js +0 -76
  341. package/src/build/rolldown/server-side-css-shim-plugin.d.ts +0 -28
  342. package/src/build/rolldown/server-side-css-shim-plugin.js +0 -59
  343. package/src/dev/transform-server/dev-transform-module-kind.d.ts +0 -13
  344. package/src/dev/transform-server/dev-transform-module-kind.js +0 -17
  345. package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +0 -5
  346. package/src/dev/transform-server/dev-transform-runtime-specifiers.js +0 -16
  347. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +0 -15
  348. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +0 -65
  349. package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +0 -21
  350. package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +0 -31
@@ -1,6 +1,9 @@
1
1
  import { fileSystem } from '@ecopages/file-system';
2
+ import { PLAIN_CSS_KINDS } from '../../plugins/stylesheet-kinds.js';
2
3
  import { AssetFactory } from '../../assets/asset-processing-service/index.js';
4
+ import { isExternalReference, listCssReferences, } from '../../assets/asset-processing-service/processors/stylesheet/css-scanner.js';
3
5
  import { contentHash } from '../../utils/content-hash.js';
6
+ import { toRootRelativePath } from '../../utils/root-relative-path.js';
4
7
  import { isProductionRuntime } from '../../utils/runtime.js';
5
8
  /**
6
9
  * Returns `true` when the asset attributes match the exact shape required for
@@ -14,37 +17,13 @@ function hasOnlyExpectedAttributes(attributes, expected) {
14
17
  }
15
18
  return expectedKeys.every((key) => attributes?.[key] === expected[key]);
16
19
  }
17
- function isSafeBundledStylesheetReference(reference) {
18
- return (reference.startsWith('/') ||
19
- reference.startsWith('data:') ||
20
- reference.startsWith('http://') ||
21
- reference.startsWith('https://') ||
22
- reference.startsWith('#'));
23
- }
24
- /**
25
- * Normalizes CSS URL tokens before safety checks so quoted and unquoted forms are treated equally.
26
- */
27
- function normalizeCssReferenceToken(token) {
28
- return token.trim().replace(/^['"]|['"]$/g, '');
29
- }
30
20
  /**
31
21
  * Rejects stylesheet content that contains relative references which would stop
32
22
  * working once multiple files are collapsed into one page-owned bundle.
33
23
  */
34
24
  function isSafeBundledStylesheetContent(content) {
35
- for (const match of content.matchAll(/@import\s+(?:url\()?['"]?([^'")\s]+)['"]?\)?/g)) {
36
- const reference = normalizeCssReferenceToken(match[1] ?? '');
37
- if (reference && !isSafeBundledStylesheetReference(reference)) {
38
- return false;
39
- }
40
- }
41
- for (const match of content.matchAll(/url\(([^)]+)\)/g)) {
42
- const reference = normalizeCssReferenceToken(match[1] ?? '');
43
- if (reference && !isSafeBundledStylesheetReference(reference)) {
44
- return false;
45
- }
46
- }
47
- return true;
25
+ const { references, imports } = listCssReferences(content);
26
+ return references.length === 0 && imports.every((statement) => isExternalReference(statement.specifier));
48
27
  }
49
28
  function isBundleableFileStylesheetAsset(dependency) {
50
29
  return dependency.kind === 'stylesheet' && dependency.source === 'file';
@@ -58,7 +37,7 @@ function isBundleableFileScriptAsset(dependency) {
58
37
  export function shouldBundlePageDependencies(bundlesPageDependencies) {
59
38
  return bundlesPageDependencies;
60
39
  }
61
- function createPageDependencyPackagingPlan(dependencies, integrationName) {
40
+ function createPageDependencyPackagingPlan(dependencies, integrationName, rootDir, stylesheets) {
62
41
  const shouldBundleDependencies = isProductionRuntime();
63
42
  const bundleableStyles = dependencies
64
43
  .filter((dependency) => {
@@ -74,6 +53,9 @@ function createPageDependencyPackagingPlan(dependencies, integrationName) {
74
53
  if (dependency.source === 'content') {
75
54
  return isSafeBundledStylesheetContent(dependency.content);
76
55
  }
56
+ if (dependency.fromPackage || stylesheets.isCssModule(dependency.filepath)) {
57
+ return false;
58
+ }
77
59
  if (!fileSystem.exists(dependency.filepath)) {
78
60
  return false;
79
61
  }
@@ -120,7 +102,7 @@ function createPageDependencyPackagingPlan(dependencies, integrationName) {
120
102
  for (const run of collectContiguousEligibleRuns(dependencies, isEligibleScript)) {
121
103
  const pageScriptImports = [...new Set(run.assets.map((dependency) => dependency.filepath))];
122
104
  const bundledScript = AssetFactory.createContentScript({
123
- name: `${integrationName}-page-${contentHash(pageScriptImports.join('|'), 16)}`,
105
+ name: `${integrationName}-page-${contentHash(pageScriptImports.map((filepath) => toRootRelativePath(rootDir, filepath)).join('|'), 16)}`,
124
106
  content: pageScriptImports.map((filepath) => `import ${JSON.stringify(filepath)};`).join('\n'),
125
107
  position: 'head',
126
108
  attributes: { type: 'module', defer: '' },
@@ -186,13 +168,15 @@ function applyPageDependencyPackagingPlan(dependencies, plan) {
186
168
  * Rewrites eligible flat dependency declarations into page-owned stylesheet and script bundles.
187
169
  *
188
170
  * Only consecutive assets with the default attribute shape and without explicit packaging roles are
189
- * collapsed so integration-specific, lazy, or custom-attribute assets keep their declared order.
171
+ * collapsed so integration-specific, lazy, or custom-attribute assets keep their declared order. A CSS Module is
172
+ * never collapsed: the bundle concatenates the stylesheet sources and processes the result as one plain stylesheet,
173
+ * which would leave its classes unscoped, so it stays a link of its own, scoped by the Processor.
190
174
  */
191
- export function packagePageDependencies(dependencies, integrationName, bundlesPageDependencies) {
175
+ export function packagePageDependencies(dependencies, integrationName, bundlesPageDependencies, rootDir, stylesheets = PLAIN_CSS_KINDS) {
192
176
  if (!shouldBundlePageDependencies(bundlesPageDependencies)) {
193
177
  return dependencies;
194
178
  }
195
- const plan = createPageDependencyPackagingPlan(dependencies, integrationName);
179
+ const plan = createPageDependencyPackagingPlan(dependencies, integrationName, rootDir, stylesheets);
196
180
  if (!plan) {
197
181
  return dependencies;
198
182
  }
@@ -52,8 +52,19 @@ export declare class PageModuleLoaderService {
52
52
  context: GetMetadataContext;
53
53
  }): Promise<PageMetadataProps>;
54
54
  /**
55
- * Loads a page module and normalizes integration-facing exports.
56
- * When both component static methods and module exports exist, component statics win.
55
+ * Fails when a page module still declares data through the removed module-level exports.
56
+ *
57
+ * @remarks
58
+ * Integrations that cannot call `eco.page(...)`, such as MDX, move their metadata export onto the
59
+ * Page in `normalizePageModule`, so only modules that declare the old exports reach this check.
60
+ */
61
+ assertNoLegacyPageExports(file: string, module: EcoPageFile): void;
62
+ /**
63
+ * Loads a page module and resolves the data hooks of its Page component.
64
+ *
65
+ * @remarks
66
+ * Throws through {@link PageModuleLoaderService.assertNoLegacyPageExports} when the module still
67
+ * has a legacy data export.
57
68
  */
58
69
  resolvePageModule(options: {
59
70
  file: string;
@@ -2,6 +2,7 @@ import { invariant } from '../../utils/invariant.js';
2
2
  import { requireAppRuntime } from '../../utils/app-runtime.js';
3
3
  import { resolveInternalExecutionDir } from '../../utils/resolve-work-dir.js';
4
4
  import { HttpError } from '../../errors/http-error.js';
5
+ const LEGACY_PAGE_EXPORT_NAMES = ['getStaticPaths', 'getStaticProps', 'getMetadata'];
5
6
  /**
6
7
  * Loads route page modules and normalizes their data hooks for rendering.
7
8
  *
@@ -91,19 +92,36 @@ export class PageModuleLoaderService {
91
92
  return metadata;
92
93
  }
93
94
  /**
94
- * Loads a page module and normalizes integration-facing exports.
95
- * When both component static methods and module exports exist, component statics win.
95
+ * Fails when a page module still declares data through the removed module-level exports.
96
+ *
97
+ * @remarks
98
+ * Integrations that cannot call `eco.page(...)`, such as MDX, move their metadata export onto the
99
+ * Page in `normalizePageModule`, so only modules that declare the old exports reach this check.
100
+ */
101
+ assertNoLegacyPageExports(file, module) {
102
+ const found = LEGACY_PAGE_EXPORT_NAMES.filter((name) => module[name] !== undefined);
103
+ if (found.length === 0)
104
+ return;
105
+ throw new Error(`[ecopages] ${file} exports ${found.join(', ')}. Pages declare data through the staticPaths, staticProps and metadata options of eco.page({ ... }); module-level exports are no longer read. Run the migrate-to-eco-page codemod from @ecopages/codemod to migrate this file.`);
106
+ }
107
+ /**
108
+ * Loads a page module and resolves the data hooks of its Page component.
109
+ *
110
+ * @remarks
111
+ * Throws through {@link PageModuleLoaderService.assertNoLegacyPageExports} when the module still
112
+ * has a legacy data export.
96
113
  */
97
114
  async resolvePageModule(options) {
98
115
  const module = options.pageModule ??
99
116
  (await (options.importPageFileFn ?? ((file) => this.importPageFile(file)))(options.file));
100
- const { default: Page, getStaticProps: moduleGetStaticProps, getMetadata: moduleGetMetadata, ...integrationSpecificProps } = module;
117
+ this.assertNoLegacyPageExports(options.file, module);
118
+ const { default: Page, ...integrationSpecificProps } = module;
101
119
  const pageComponent = Page;
102
120
  return {
103
121
  module,
104
122
  Page,
105
- getStaticProps: pageComponent.staticProps ?? moduleGetStaticProps,
106
- getMetadata: pageComponent.metadata ?? moduleGetMetadata,
123
+ getStaticProps: pageComponent.staticProps,
124
+ getMetadata: pageComponent.metadata,
107
125
  integrationSpecificProps,
108
126
  };
109
127
  }
@@ -9,7 +9,7 @@ import type { IntegrationRenderer } from './orchestration/integration-renderer.j
9
9
  * loading. Returning this narrowed shape avoids a dedicated wrapper class while
10
10
  * still keeping callers off the full integration renderer surface.
11
11
  */
12
- export type PageRouteRenderer = Pick<IntegrationRenderer<unknown>, 'execute' | 'loadPageModule'> & Partial<Pick<IntegrationRenderer<unknown>, 'clearPrebuiltRoutePreparation'>>;
12
+ export type PageRouteRenderer = Pick<IntegrationRenderer<unknown>, 'execute' | 'loadPageModule'>;
13
13
  /**
14
14
  * Narrow explicit-view render contract exposed to static route handling.
15
15
  *
@@ -6,6 +6,8 @@ export type NavigationCommitPipelineInput = {
6
6
  direction: EcoNavigationDirection;
7
7
  newDocument: Document;
8
8
  isStale: () => boolean;
9
+ /** Defaults to `isStale`; pass a predicate that stays false after completion to keep `eco:page-load` after `complete()`. */
10
+ isSuperseded?: () => boolean;
9
11
  viewTransitionsEnabled: boolean;
10
12
  persistAttribute?: string;
11
13
  includeBodyScripts?: boolean;
@@ -6,6 +6,9 @@ async function requestReload(input) {
6
6
  await input.onReloadRequested?.();
7
7
  return input.isStale() ? 'stale' : 'reload-requested';
8
8
  }
9
+ function resolveIsSuperseded(input) {
10
+ return input.isSuperseded ?? input.isStale;
11
+ }
9
12
  /** Runs shared document work around the router-specific page swap. */
10
13
  export async function commitNavigationPage(input) {
11
14
  let headUpdate = null;
@@ -61,7 +64,7 @@ export async function commitNavigationPage(input) {
61
64
  return input.isStale() ? 'stale' : 'reload-requested';
62
65
  if (input.isStale() || !committed)
63
66
  return 'stale';
64
- completeNavigationLifecycle(document, { url: input.url, direction: input.direction }, { isStale: input.isStale });
67
+ completeNavigationLifecycle(document, { url: input.url, direction: input.direction }, { isSuperseded: resolveIsSuperseded(input) });
65
68
  await input.afterLifecycle?.();
66
69
  return input.isStale() ? 'stale' : 'committed';
67
70
  }
@@ -72,6 +72,14 @@ export type EcoNavigationTransaction = {
72
72
  id: number;
73
73
  signal: AbortSignal;
74
74
  isCurrent: () => boolean;
75
+ /**
76
+ * Whether a newer navigation began or this one was cancelled.
77
+ *
78
+ * @remarks
79
+ * Unlike `!isCurrent()`, this stays false after `complete()`, so work scheduled for a committed
80
+ * navigation (such as `eco:page-load`) is skipped only when another navigation replaced it.
81
+ */
82
+ isSuperseded: () => boolean;
75
83
  cancel: () => void;
76
84
  complete: () => void;
77
85
  };
@@ -95,6 +103,14 @@ export type EcoNavigationRuntimeRegistration = {
95
103
  * not blank the current page before the incoming document is ready.
96
104
  */
97
105
  cleanupBeforeHandoff?: () => void | Promise<void>;
106
+ /**
107
+ * Starts keeping what the runtime needs to preserve page state on `reloadCurrentPage`.
108
+ *
109
+ * @remarks
110
+ * Development HMR turns this on through `enableReloadStatePreservation()`. A runtime that registers later
111
+ * is told on registration, so production navigation never pays for it.
112
+ */
113
+ enableReloadStatePreservation?: () => void;
98
114
  };
99
115
  /** Public browser-side navigation coordinator interface. */
100
116
  export interface EcoNavigationRuntime {
@@ -130,6 +146,8 @@ export interface EcoNavigationRuntime {
130
146
  reloadCurrentPage(request?: EcoReloadRequest): Promise<boolean>;
131
147
  /** Runs a target runtime's cleanup hook before handoff. */
132
148
  cleanupOwner(owner: EcoNavigationOwner): Promise<void>;
149
+ /** Asks every registered runtime, and each one that registers later, to preserve state on reloads. */
150
+ enableReloadStatePreservation(): void;
133
151
  }
134
152
  /**
135
153
  * Reads the explicit browser document owner marker from a rendered HTML document.
@@ -39,6 +39,7 @@ function getCandidateOwners(currentOwner, registrations, excludedOwner) {
39
39
  function createEcoNavigationRuntime() {
40
40
  const registrations = new Map();
41
41
  let owner = 'none';
42
+ let reloadStatePreservationEnabled = false;
42
43
  let navigationSequence = 0;
43
44
  let navigationAbortController = null;
44
45
  const cancelNavigationTransaction = (navigationId, abortController) => {
@@ -75,6 +76,7 @@ function createEcoNavigationRuntime() {
75
76
  id: navigationId,
76
77
  signal: abortController.signal,
77
78
  isCurrent: () => navigationSequence === navigationId && navigationAbortController === abortController,
79
+ isSuperseded: () => navigationSequence !== navigationId,
78
80
  cancel: () => {
79
81
  cancelNavigationTransaction(navigationId, abortController);
80
82
  },
@@ -108,6 +110,9 @@ function createEcoNavigationRuntime() {
108
110
  },
109
111
  register(registration) {
110
112
  registrations.set(registration.owner, registration);
113
+ if (reloadStatePreservationEnabled) {
114
+ registration.enableReloadStatePreservation?.();
115
+ }
111
116
  return () => {
112
117
  const currentRegistration = registrations.get(registration.owner);
113
118
  if (currentRegistration !== registration) {
@@ -160,6 +165,15 @@ function createEcoNavigationRuntime() {
160
165
  }
161
166
  return false;
162
167
  },
168
+ enableReloadStatePreservation() {
169
+ if (reloadStatePreservationEnabled) {
170
+ return;
171
+ }
172
+ reloadStatePreservationEnabled = true;
173
+ for (const registration of registrations.values()) {
174
+ registration.enableReloadStatePreservation?.();
175
+ }
176
+ },
163
177
  async cleanupOwner(targetOwner) {
164
178
  if (targetOwner === 'none') {
165
179
  return;
@@ -37,7 +37,7 @@ export type DispatchBeforeSwapResult = {
37
37
  requestedReload: boolean;
38
38
  };
39
39
  export type SchedulePageLoadOptions = {
40
- isStale?: () => boolean;
40
+ isSuperseded?: () => boolean;
41
41
  schedule?: (callback: FrameRequestCallback) => number;
42
42
  };
43
43
  /**
@@ -47,3 +47,10 @@ export declare function dispatchBeforeSwap(doc: Document, input: Omit<EcoBeforeS
47
47
  export type CompleteNavigationLifecycleOptions = SchedulePageLoadOptions;
48
48
  /** Dispatches `eco:after-swap` and schedules `eco:page-load`. */
49
49
  export declare function completeNavigationLifecycle(doc: Document, detail: EcoNavigationEvent, options?: CompleteNavigationLifecycleOptions): void;
50
+ /**
51
+ * Schedules `eco:page-load` on the next animation frame unless a newer navigation replaced this one.
52
+ *
53
+ * @remarks
54
+ * Supersession is not staleness: a navigation that completed normally still owes its page-load event.
55
+ */
56
+ export declare function schedulePageLoad(doc: Document, detail: EcoNavigationEvent, options?: SchedulePageLoadOptions): void;
@@ -37,12 +37,15 @@ export function completeNavigationLifecycle(doc, detail, options = {}) {
37
37
  schedulePageLoad(doc, detail, options);
38
38
  }
39
39
  /**
40
- * Schedules `eco:page-load` on the next animation frame unless navigation is stale.
40
+ * Schedules `eco:page-load` on the next animation frame unless a newer navigation replaced this one.
41
+ *
42
+ * @remarks
43
+ * Supersession is not staleness: a navigation that completed normally still owes its page-load event.
41
44
  */
42
- function schedulePageLoad(doc, detail, options = {}) {
45
+ export function schedulePageLoad(doc, detail, options = {}) {
43
46
  const schedule = options.schedule ?? ((callback) => requestAnimationFrame(callback));
44
47
  schedule(() => {
45
- if (options.isStale?.()) {
48
+ if (options.isSuperseded?.()) {
46
49
  return;
47
50
  }
48
51
  doc.dispatchEvent(new CustomEvent(ECO_NAVIGATION_LIFECYCLE_EVENTS.PAGE_LOAD, { detail }));
@@ -1,4 +1,5 @@
1
1
  export { ECO_PERSIST_ATTRIBUTE } from '../../client/navigation-attributes.js';
2
+ export { loadNavigationGlobalScripts } from '../../client/navigation-scripts/global-scripts.js';
2
3
  export { commitNavigationPage, type NavigationCommitPipelineInput, type NavigationCommitPipelineResult, } from './navigation-commit.js';
3
4
  export { runNavigationViewTransition, type NavigationViewTransitionOptions } from './navigation-view-transition.js';
4
5
  export { decideQueuedNavigationReplay, type DecideQueuedNavigationReplayInput, type QueueReplayDecision, } from './navigation-replay.js';
@@ -1,4 +1,5 @@
1
1
  export { ECO_PERSIST_ATTRIBUTE } from '../../client/navigation-attributes.js';
2
+ export { loadNavigationGlobalScripts } from '../../client/navigation-scripts/global-scripts.js';
2
3
  export { commitNavigationPage, } from './navigation-commit.js';
3
4
  export { runNavigationViewTransition } from './navigation-view-transition.js';
4
5
  export { decideQueuedNavigationReplay, } from './navigation-replay.js';
@@ -106,7 +106,7 @@ export declare class RouteRegistry {
106
106
  * @remarks
107
107
  * The return shape is {@link PathExpansion}, the same records `staticPaths` produces. They are
108
108
  * not Static Path Expansions: HTML still uses Request-Time Rendering. The build uses them so
109
- * each Params list's graph is in the browser client manifest.
109
+ * each Params list's graph scripts are in the production asset ledger.
110
110
  */
111
111
  listDynamicPagePathExpansions(input: {
112
112
  runtimeOrigin: string;
@@ -120,7 +120,8 @@ export declare class RouteRegistry {
120
120
  * Strips the longest template extension the file ends with, so `about.kita.tsx` keeps no
121
121
  * `.kita` part when `.tsx` is also registered, and `my.html-tips.html` keeps its name. An
122
122
  * endpoint strips its whole marker, so `users.api.tsx` is `/users` even when `.tsx` is a
123
- * template extension.
123
+ * template extension. `file` is relative to the pages directory and uses `/`, as `fileSystem.glob`
124
+ * returns it.
124
125
  */
125
126
  private getRoutePath;
126
127
  /**
@@ -1,4 +1,4 @@
1
- import path from 'node:path';
1
+ import { path } from '@ecopages/file-system/path';
2
2
  import { fileSystem } from '@ecopages/file-system';
3
3
  import { appLogger } from '../../global/app-logger.js';
4
4
  import { loadProductionTemplateRoutes } from '../../build/production-route-list.js';
@@ -131,8 +131,8 @@ export class RouteRegistry {
131
131
  }
132
132
  const staticPaths = pageModule.staticPaths;
133
133
  if (options.requireStaticHooks && this.buildMode) {
134
- invariant(staticPaths !== undefined, `[ecopages] Missing getStaticPaths in ${route.filePath}`);
135
- invariant(pageModule.staticProps !== undefined, `[ecopages] Missing getStaticProps in ${route.filePath}`);
134
+ invariant(staticPaths !== undefined, `[ecopages] Missing staticPaths in ${route.filePath}`);
135
+ invariant(pageModule.staticProps !== undefined, `[ecopages] Missing staticProps in ${route.filePath}`);
136
136
  }
137
137
  if (!staticPaths) {
138
138
  continue;
@@ -153,7 +153,7 @@ export class RouteRegistry {
153
153
  * @remarks
154
154
  * The return shape is {@link PathExpansion}, the same records `staticPaths` produces. They are
155
155
  * not Static Path Expansions: HTML still uses Request-Time Rendering. The build uses them so
156
- * each Params list's graph is in the browser client manifest.
156
+ * each Params list's graph scripts are in the production asset ledger.
157
157
  */
158
158
  async listDynamicPagePathExpansions(input) {
159
159
  return this.listPathExpansions(input, {
@@ -245,7 +245,8 @@ export class RouteRegistry {
245
245
  * Strips the longest template extension the file ends with, so `about.kita.tsx` keeps no
246
246
  * `.kita` part when `.tsx` is also registered, and `my.html-tips.html` keeps its name. An
247
247
  * endpoint strips its whole marker, so `users.api.tsx` is `/users` even when `.tsx` is a
248
- * template extension.
248
+ * template extension. `file` is relative to the pages directory and uses `/`, as `fileSystem.glob`
249
+ * returns it.
249
250
  */
250
251
  getRoutePath(file, endpointExtension) {
251
252
  const extension = endpointExtension ?? findLongestExtension(this.templatesExt, file) ?? '';
@@ -1,12 +1,7 @@
1
1
  import type { EcoPagesAppConfig } from '../config/internal-types.js';
2
- import type { PageParams } from '../types/contracts.js';
3
2
  import type { PageRendererResolver } from '../route-renderer/route-renderer.js';
4
- export type ProductionPageBrowserGraphRouteInstance = {
5
- routeFile: string;
6
- params?: PageParams;
7
- skipStaticProps?: boolean;
8
- isRouteTemplate?: boolean;
9
- };
3
+ import type { PlannedRoutePreparation } from '../route-renderer/orchestration/route-pipeline/route-render-orchestrator.js';
4
+ import type { PlannedRouteInstance } from '../route-renderer/orchestration/integration-renderer.js';
10
5
  /**
11
6
  * Returns whether production should reuse prebuilt Page Browser Graphs.
12
7
  *
@@ -19,24 +14,41 @@ export declare function shouldPrebuildProductionPageBrowserGraphs(): boolean;
19
14
  * Clears in-memory production Page Browser Graph session records.
20
15
  *
21
16
  * @remarks
22
- * Clears only the `'production'` policy so a failed or force export cannot
23
- * reuse staged graph output. Also sets `productionBrowserGraphsSealed` to false so a
24
- * retry of `ecopages build` can still emit graphs. Development session records are left intact.
17
+ * Clears only the `'production'` policy so a failed or force export cannot reuse staged graph output, forgets the
18
+ * app-wide browser build so a retry of `ecopages build` records only its own outputs, and removes the asset ledger
19
+ * file a previous build wrote. Development session records are left intact.
25
20
  */
26
21
  export declare function clearProductionPageBrowserGraphSession(appConfig: EcoPagesAppConfig): void;
22
+ /** Identifies one planned route instance: its file, Params and whether it is a template without static props. */
23
+ export declare function getPlannedRouteKey(instance: PlannedRouteInstance): string;
27
24
  /**
28
- * Warms production Page Browser Graphs for the supplied static route instances.
25
+ * Builds the production browser client for the supplied route instances and prepares each of them.
29
26
  *
30
27
  * @remarks
31
- * Deduplicates route file + params pairs, then calls each integration renderer's
32
- * `prebuildProductionPageBrowserGraph` sequentially (activates integration runtime,
33
- * then resolves into `page-browser-graph-session`). Does not persist a disk manifest.
28
+ * Deduplicates route file + params pairs and plans each renderer's routes, which collects the scripts they bundle
29
+ * without processing them. The app-wide browser build then records every planned script in the asset ledger, and
30
+ * each planned route processes its dependencies through it, so the ledger records everything `ecopages start`
31
+ * serves those routes with. The ledger is then written beside the server bundle, where the Lit static-render
32
+ * worker restores it during the export. A route that fails to plan is left out and reported to `onRouteFailure`.
33
+ * Each Integration's global scripts are resolved once, after that build, or on their own when no route is planned.
34
+ *
35
+ * Returns the preparation of every planned instance that runs its static props, by {@link getPlannedRouteKey}, so
36
+ * static export renders it without running its data hooks again. The caller owns the map for the build; no
37
+ * renderer keeps it.
34
38
  */
35
- export declare function prebuildProductionPageBrowserGraphs(appConfig: EcoPagesAppConfig, routeInstances: readonly ProductionPageBrowserGraphRouteInstance[], routeRendererFactory: PageRendererResolver): Promise<void>;
39
+ export declare function prebuildProductionPageBrowserGraphs(appConfig: EcoPagesAppConfig, routeInstances: readonly PlannedRouteInstance[], routeRendererFactory: PageRendererResolver, options?: {
40
+ onRouteFailure?: (routeInstance: PlannedRouteInstance, error: unknown) => void;
41
+ }): Promise<Map<string, PlannedRoutePreparation>>;
36
42
  /**
37
- * Reuses the browser outputs written by `ecopages build` while `ecopages start` prepares SSR routes.
43
+ * Restores the app-wide browser build `ecopages build` recorded in the asset ledger.
38
44
  *
39
45
  * @remarks
40
- * A successful restore sets `productionBrowserGraphsSealed` so a missing graph is an error.
46
+ * Rendering then resolves every script that build bundled through the ledger. With `seal`, as `ecopages start` from
47
+ * a complete `dist/` restores it, a missing ledger is an error. Every dependency then resolves through the ledger,
48
+ * one it does not record is an error, and start compiles and writes nothing. The Lit static-render worker restores without sealing: it renders
49
+ * during the build, which still processes what the ledger does not yet record. It resolves no Integration global
50
+ * scripts: the caller resolves them after it, whether or not a ledger was restored.
41
51
  */
42
- export declare function prebuildProductionPageBrowserGraphsFromManifest(appConfig: EcoPagesAppConfig, routeRendererFactory: PageRendererResolver): Promise<boolean>;
52
+ export declare function restoreProductionBrowserBuild(appConfig: EcoPagesAppConfig, options: {
53
+ seal: boolean;
54
+ }): Promise<boolean>;