@ecopages/core 0.2.1 → 0.3.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 (892) hide show
  1. package/README.md +201 -72
  2. package/package.json +83 -254
  3. package/src/adapters/README.md +25 -6
  4. package/src/adapters/create-app.d.ts +56 -19
  5. package/src/adapters/create-app.js +48 -63
  6. package/src/adapters/node/create-app.d.ts +200 -15
  7. package/src/adapters/node/create-app.js +582 -146
  8. package/src/adapters/node/dev-session.d.ts +35 -0
  9. package/src/adapters/node/dev-session.js +117 -0
  10. package/src/adapters/node/http-request-bridge.d.ts +57 -0
  11. package/src/adapters/node/http-request-bridge.js +199 -0
  12. package/src/adapters/node/node-client-bridge.d.ts +2 -1
  13. package/src/adapters/node/node-client-bridge.js +62 -61
  14. package/src/adapters/node/runtime-host.d.ts +57 -0
  15. package/src/adapters/node/runtime-host.js +104 -0
  16. package/src/adapters/node/server-adapter.d.ts +120 -90
  17. package/src/adapters/node/server-adapter.js +409 -341
  18. package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.d.ts +16 -0
  19. package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +32 -0
  20. package/src/adapters/shared/hmr/hmr-html-response.d.ts +14 -0
  21. package/src/adapters/shared/hmr/hmr-html-response.js +25 -0
  22. package/src/adapters/shared/hmr/hmr-manager.d.ts +116 -0
  23. package/src/adapters/shared/hmr/hmr-manager.js +464 -0
  24. package/src/adapters/shared/hmr/hmr-manager.test-helpers.d.ts +28 -0
  25. package/src/adapters/shared/hmr/hmr-manager.test-helpers.js +53 -0
  26. package/src/adapters/shared/http/api-request-pipeline.d.ts +50 -0
  27. package/src/adapters/shared/http/api-request-pipeline.js +204 -0
  28. package/src/adapters/shared/{api-response.d.ts → http/api-response.d.ts} +3 -2
  29. package/src/adapters/shared/http/api-response.js +79 -0
  30. package/src/adapters/shared/http/create-body-response.d.ts +12 -0
  31. package/src/adapters/shared/http/create-body-response.js +26 -0
  32. package/src/adapters/shared/http/define-api-handler.d.ts +48 -0
  33. package/src/adapters/shared/http/define-api-handler.js +49 -0
  34. package/src/adapters/shared/{explicit-static-route-matcher.d.ts → http/explicit-static-route-matcher.d.ts} +9 -11
  35. package/src/adapters/shared/http/explicit-static-route-matcher.js +63 -0
  36. package/src/adapters/shared/{file-route-middleware-pipeline.d.ts → http/file-route-middleware-pipeline.d.ts} +8 -11
  37. package/src/adapters/shared/http/file-route-middleware-pipeline.js +84 -0
  38. package/src/adapters/shared/http/fs-server-response-factory.d.ts +9 -0
  39. package/src/adapters/shared/http/fs-server-response-factory.js +23 -0
  40. package/src/adapters/shared/http/fs-server-response-matcher.d.ts +98 -0
  41. package/src/adapters/shared/http/fs-server-response-matcher.js +244 -0
  42. package/src/adapters/shared/http/run-middleware-chain.d.ts +5 -0
  43. package/src/adapters/shared/http/run-middleware-chain.js +17 -0
  44. package/src/adapters/shared/runtime/bind-runtime-server.d.ts +17 -0
  45. package/src/adapters/shared/runtime/bind-runtime-server.js +50 -0
  46. package/src/adapters/shared/runtime/copy-runtime-public-dir.d.ts +8 -0
  47. package/src/adapters/shared/runtime/copy-runtime-public-dir.js +71 -0
  48. package/src/adapters/shared/runtime/dev-static-route-prewarm.d.ts +13 -0
  49. package/src/adapters/shared/runtime/dev-static-route-prewarm.js +56 -0
  50. package/src/adapters/shared/runtime/port-manager-default-prompt.d.ts +6 -0
  51. package/src/adapters/shared/runtime/port-manager-default-prompt.js +41 -0
  52. package/src/adapters/shared/runtime/port-manager.d.ts +116 -0
  53. package/src/adapters/shared/runtime/port-manager.js +195 -0
  54. package/src/adapters/shared/{render-context.d.ts → runtime/render-context.d.ts} +5 -4
  55. package/src/adapters/shared/runtime/render-context.js +94 -0
  56. package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +17 -0
  57. package/src/adapters/shared/runtime/runtime-app-bootstrap.js +34 -0
  58. package/src/adapters/shared/runtime/runtime-host.d.ts +15 -0
  59. package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +45 -0
  60. package/src/adapters/shared/runtime/runtime-server-lifecycle.js +93 -0
  61. package/src/adapters/shared/runtime/server-request-pipeline.d.ts +100 -0
  62. package/src/adapters/shared/runtime/server-request-pipeline.js +276 -0
  63. package/src/adapters/shared/{server-route-handler.d.ts → runtime/server-route-handler.d.ts} +10 -39
  64. package/src/adapters/shared/runtime/server-route-handler.js +95 -0
  65. package/src/adapters/shared/runtime/server-static-builder.d.ts +107 -0
  66. package/src/adapters/shared/runtime/server-static-builder.js +172 -0
  67. package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +20 -0
  68. package/src/adapters/shared/ws/node-http-websocket-upgrades.js +122 -0
  69. package/src/adapters/shared/ws/websocket-lifecycle.d.ts +24 -0
  70. package/src/adapters/shared/ws/websocket-lifecycle.js +62 -0
  71. package/src/adapters/shared/ws/ws-pattern-matcher.d.ts +7 -0
  72. package/src/adapters/shared/ws/ws-pattern-matcher.js +20 -0
  73. package/src/assets/README.md +35 -0
  74. package/src/assets/app-browser-client-build.d.ts +18 -0
  75. package/src/assets/app-browser-client-build.js +476 -0
  76. package/src/assets/app-browser-client-manifest.d.ts +69 -0
  77. package/src/assets/app-browser-client-manifest.js +332 -0
  78. package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +35 -0
  79. package/src/assets/asset-processing-service/app-browser-client-bundle.js +41 -0
  80. package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +16 -0
  81. package/src/assets/asset-processing-service/asset-dependency-keys.js +80 -0
  82. package/src/assets/asset-processing-service/asset-package-role.d.ts +2 -0
  83. package/src/assets/asset-processing-service/asset-package-role.js +3 -0
  84. package/src/assets/asset-processing-service/asset-processing-integration.d.ts +7 -0
  85. package/src/assets/asset-processing-service/asset-processing-integration.js +6 -0
  86. package/src/assets/asset-processing-service/asset-processing.service.d.ts +156 -0
  87. package/src/assets/asset-processing-service/asset-processing.service.js +555 -0
  88. package/src/assets/asset-processing-service/asset.factory.js +79 -0
  89. package/src/assets/asset-processing-service/assets.types.d.ts +1 -0
  90. package/src/{services/assets → assets}/asset-processing-service/browser-runtime-asset.factory.d.ts +4 -1
  91. package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +61 -0
  92. package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +79 -0
  93. package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +200 -0
  94. package/src/{services/assets → assets}/asset-processing-service/browser-runtime-entry.factory.d.ts +6 -2
  95. package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +67 -0
  96. package/src/assets/asset-processing-service/finalize-processed-asset.d.ts +3 -0
  97. package/src/assets/asset-processing-service/finalize-processed-asset.js +5 -0
  98. package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +11 -0
  99. package/src/assets/asset-processing-service/grouped-content-bundles.js +39 -0
  100. package/src/assets/asset-processing-service/index.d.ts +10 -0
  101. package/src/{services/assets/asset-processing-service/index.d.ts → assets/asset-processing-service/index.js} +4 -0
  102. package/src/assets/asset-processing-service/inline-content-script-body.d.ts +11 -0
  103. package/src/assets/asset-processing-service/inline-content-script-body.js +23 -0
  104. package/src/assets/asset-processing-service/materialize-content-script-asset.d.ts +9 -0
  105. package/src/assets/asset-processing-service/materialize-content-script-asset.js +22 -0
  106. package/src/assets/asset-processing-service/page-package.d.ts +6 -0
  107. package/src/assets/asset-processing-service/page-package.js +81 -0
  108. package/src/assets/asset-processing-service/processor.interface.d.ts +8 -0
  109. package/src/assets/asset-processing-service/processor.interface.js +1 -0
  110. package/src/assets/asset-processing-service/processors/base/base-processor.d.ts +13 -0
  111. package/src/assets/asset-processing-service/processors/base/base-processor.js +22 -0
  112. package/src/assets/asset-processing-service/processors/base/base-script-processor.d.ts +40 -0
  113. package/src/assets/asset-processing-service/processors/base/base-script-processor.js +136 -0
  114. package/src/assets/asset-processing-service/processors/index.js +5 -0
  115. package/src/assets/asset-processing-service/processors/script/classic-script-compiler.d.ts +26 -0
  116. package/src/assets/asset-processing-service/processors/script/classic-script-compiler.js +92 -0
  117. package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +21 -0
  118. package/src/assets/asset-processing-service/processors/script/content-script.processor.js +88 -0
  119. package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +43 -0
  120. package/src/assets/asset-processing-service/processors/script/file-script.processor.js +165 -0
  121. package/src/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +64 -0
  122. package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +135 -0
  123. package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +36 -0
  124. package/src/{services/assets → assets}/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
  125. package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +40 -0
  126. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
  127. package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +19 -0
  128. package/src/assets/browser-bundle.service.d.ts +45 -0
  129. package/src/assets/browser-bundle.service.js +50 -0
  130. package/src/assets/browser-runtime-asset-page-cache.d.ts +11 -0
  131. package/src/assets/browser-runtime-asset-page-cache.js +17 -0
  132. package/src/assets/hashed-browser-asset.d.ts +25 -0
  133. package/src/assets/hashed-browser-asset.js +99 -0
  134. package/src/assets/processed-asset-dedupe.d.ts +3 -0
  135. package/src/assets/processed-asset-dedupe.js +24 -0
  136. package/src/browser-env.d.ts +4 -0
  137. package/src/browser-env.js +11 -0
  138. package/src/build/README.md +259 -68
  139. package/src/build/app-build-manifest-runtime.d.ts +38 -0
  140. package/src/build/app-build-manifest-runtime.js +126 -0
  141. package/src/build/browser/browser-runtime-manifest.d.ts +35 -0
  142. package/src/build/browser/browser-runtime-manifest.js +65 -0
  143. package/src/build/browser/browser-runtime-plugin-helpers.d.ts +14 -0
  144. package/src/build/browser/browser-runtime-plugin-helpers.js +21 -0
  145. package/src/build/browser/browser-runtime-plugin.d.ts +54 -0
  146. package/src/build/browser/browser-runtime-plugin.js +76 -0
  147. package/src/build/browser/jsx-ownership-plugins.d.ts +24 -0
  148. package/src/build/browser/jsx-ownership-plugins.js +55 -0
  149. package/src/build/browser/lit-static-render-worker-context.d.ts +1 -0
  150. package/src/build/browser/lit-static-render-worker-context.js +5 -0
  151. package/src/build/build-adapter.d.ts +21 -221
  152. package/src/build/build-adapter.js +39 -569
  153. package/src/build/build-graph.d.ts +34 -0
  154. package/src/build/build-graph.js +162 -0
  155. package/src/build/build-log.d.ts +19 -0
  156. package/src/build/build-log.js +35 -0
  157. package/src/build/build-parallelism.d.ts +4 -0
  158. package/src/build/build-parallelism.js +7 -0
  159. package/src/build/cache/app-config-hash.d.ts +10 -0
  160. package/src/build/cache/app-config-hash.js +22 -0
  161. package/src/build/cache/build-input-dependency-index.d.ts +118 -0
  162. package/src/build/cache/build-input-dependency-index.js +249 -0
  163. package/src/build/cache/cache-keys.d.ts +9 -0
  164. package/src/build/cache/cache-keys.js +31 -0
  165. package/src/build/cache/pages-unified-graph-build.d.ts +54 -0
  166. package/src/build/cache/pages-unified-graph-build.js +197 -0
  167. package/src/build/contracts/build-contracts.d.ts +157 -0
  168. package/src/build/contracts/build-contracts.js +1 -0
  169. package/src/build/contracts/build-manifest.d.ts +29 -0
  170. package/src/build/contracts/build-manifest.js +52 -0
  171. package/src/build/contracts/build-types.d.ts +1 -0
  172. package/src/build/contracts/build-types.js +1 -0
  173. package/src/build/contracts/content-virtual-modules.d.ts +14 -0
  174. package/src/build/contracts/content-virtual-modules.js +37 -0
  175. package/src/build/contracts/server-only-specifier.d.ts +8 -0
  176. package/src/build/contracts/server-only-specifier.js +11 -0
  177. package/src/build/contracts.d.ts +4 -0
  178. package/src/build/contracts.js +2 -0
  179. package/src/build/mapped-source-transform.d.ts +22 -0
  180. package/src/build/mapped-source-transform.js +31 -0
  181. package/src/build/preserve-import-meta-transform.d.ts +32 -0
  182. package/src/build/preserve-import-meta-transform.js +138 -0
  183. package/src/build/rolldown/app-package-declarations.d.ts +8 -0
  184. package/src/build/rolldown/app-package-declarations.js +81 -0
  185. package/src/build/rolldown/entry-module-closures.d.ts +8 -0
  186. package/src/build/rolldown/entry-module-closures.js +39 -0
  187. package/src/build/rolldown/rolldown-adapter-helpers.d.ts +97 -0
  188. package/src/build/rolldown/rolldown-adapter-helpers.js +570 -0
  189. package/src/build/rolldown/rolldown-build-adapter.d.ts +27 -0
  190. package/src/build/rolldown/rolldown-build-adapter.js +86 -0
  191. package/src/build/rolldown/rolldown-build-invocation-metrics.d.ts +12 -0
  192. package/src/build/rolldown/rolldown-build-invocation-metrics.js +40 -0
  193. package/src/build/rolldown/rolldown-plugin-bridge.d.ts +76 -0
  194. package/src/build/rolldown/rolldown-plugin-bridge.js +450 -0
  195. package/src/build/rolldown/server-side-css-shim-plugin.d.ts +28 -0
  196. package/src/build/rolldown/server-side-css-shim-plugin.js +59 -0
  197. package/src/build/runtime/build-environment-options.d.ts +4 -0
  198. package/src/build/runtime/build-environment-options.js +20 -0
  199. package/src/build/runtime/build-queue.d.ts +63 -0
  200. package/src/build/runtime/build-queue.js +117 -0
  201. package/src/build/runtime/build-request-identity.d.ts +15 -0
  202. package/src/build/runtime/build-request-identity.js +52 -0
  203. package/src/build/runtime/build-request-policy.d.ts +80 -0
  204. package/src/build/runtime/build-request-policy.js +132 -0
  205. package/src/build/server/README.md +50 -0
  206. package/src/build/server/app-module-loader.service.d.ts +35 -0
  207. package/src/build/server/app-module-loader.service.js +36 -0
  208. package/src/build/server/page-module-import.service.d.ts +112 -0
  209. package/src/build/server/page-module-import.service.js +264 -0
  210. package/src/build/server/route-module-build-cache-registry.d.ts +20 -0
  211. package/src/build/server/route-module-build-cache-registry.js +41 -0
  212. package/src/build/server/route-module-build-cache.store.d.ts +49 -0
  213. package/src/build/server/route-module-build-cache.store.js +75 -0
  214. package/src/build/server/route-module-build-manifest.d.ts +56 -0
  215. package/src/build/server/route-module-build-manifest.js +49 -0
  216. package/src/build/server/route-module-dependency-hasher.d.ts +66 -0
  217. package/src/build/server/route-module-dependency-hasher.js +131 -0
  218. package/src/build/server/view-module-loader.d.ts +10 -0
  219. package/src/build/server/view-module-loader.js +46 -0
  220. package/src/build/server-bundle-deploy-manifest.d.ts +71 -0
  221. package/src/build/server-bundle-deploy-manifest.js +164 -0
  222. package/src/build/server-bundle-publication.d.ts +12 -0
  223. package/src/build/server-bundle-publication.js +39 -0
  224. package/src/build/server-module.d.ts +8 -0
  225. package/src/build/server-module.js +22 -0
  226. package/src/build/source-maps.d.ts +17 -0
  227. package/src/build/source-maps.js +29 -0
  228. package/src/build.d.ts +19 -0
  229. package/src/build.js +19 -0
  230. package/src/cache/README.md +5 -0
  231. package/src/cache/index.d.ts +7 -0
  232. package/src/cache/index.js +7 -0
  233. package/src/cache/module-parse-cache.d.ts +43 -0
  234. package/src/cache/module-parse-cache.js +97 -0
  235. package/src/cache/module-transform-profiler.d.ts +7 -0
  236. package/src/cache/module-transform-profiler.js +8 -0
  237. package/src/client/README.md +5 -0
  238. package/src/client/navigation-attributes.d.ts +2 -0
  239. package/src/client/navigation-attributes.js +2 -0
  240. package/src/client/navigation-scripts/activation.d.ts +36 -0
  241. package/src/client/navigation-scripts/activation.js +97 -0
  242. package/src/client/navigation-scripts/classification.d.ts +12 -0
  243. package/src/client/navigation-scripts/classification.js +49 -0
  244. package/src/client/navigation-scripts/identity.d.ts +19 -0
  245. package/src/client/navigation-scripts/identity.js +26 -0
  246. package/src/client/navigation-scripts/index.d.ts +4 -0
  247. package/src/client/navigation-scripts/index.js +4 -0
  248. package/src/client/navigation-scripts/navigation-scripts.test.browser.d.ts +1 -0
  249. package/src/client/navigation-scripts/navigation-scripts.test.browser.js +111 -0
  250. package/src/client/navigation-scripts/registry.d.ts +12 -0
  251. package/src/client/navigation-scripts/registry.js +17 -0
  252. package/src/client/navigation-scripts/rerun-queue.d.ts +30 -0
  253. package/src/client/navigation-scripts/rerun-queue.js +84 -0
  254. package/src/client/scroll.d.ts +17 -0
  255. package/src/client/scroll.js +33 -0
  256. package/src/client/scroll.test.browser.d.ts +1 -0
  257. package/src/client/scroll.test.browser.js +31 -0
  258. package/src/client/view-transitions.d.ts +28 -0
  259. package/src/client/view-transitions.js +121 -0
  260. package/src/client/view-transitions.test.browser.d.ts +1 -0
  261. package/src/client/view-transitions.test.browser.js +53 -0
  262. package/src/client.d.ts +15 -0
  263. package/src/client.js +15 -0
  264. package/src/config/README.md +34 -12
  265. package/src/config/assembly/app-runtime.d.ts +73 -0
  266. package/src/config/assembly/app-runtime.js +82 -0
  267. package/src/config/assembly/finalize-config.d.ts +26 -0
  268. package/src/config/assembly/finalize-config.js +243 -0
  269. package/src/config/config-module-files.d.ts +11 -0
  270. package/src/config/config-module-files.js +70 -0
  271. package/src/config/constants.d.ts +1 -45
  272. package/src/config/constants.js +1 -25
  273. package/src/config/define-config.d.ts +11 -0
  274. package/src/config/define-config.js +3 -0
  275. package/src/config/index.d.ts +6 -0
  276. package/src/config/index.js +5 -0
  277. package/src/config/internal-types.d.ts +187 -0
  278. package/src/config/internal-types.js +1 -0
  279. package/src/config/load-eco-config.d.ts +15 -0
  280. package/src/config/load-eco-config.js +72 -0
  281. package/src/config/resolve-eco-config-path.d.ts +38 -0
  282. package/src/config/resolve-eco-config-path.js +70 -0
  283. package/src/config/server-config-bundle.d.ts +14 -0
  284. package/src/config/server-config-bundle.js +36 -0
  285. package/src/config/user-config-types.d.ts +156 -0
  286. package/src/config/user-config-types.js +1 -0
  287. package/src/config/write-types.d.ts +1 -0
  288. package/src/config/write-types.js +18 -0
  289. package/src/constants.d.ts +46 -0
  290. package/src/constants.js +46 -0
  291. package/src/css-imports.d.ts +4 -0
  292. package/src/declarations.d.ts +13 -6
  293. package/src/dev/README.md +61 -0
  294. package/src/dev/development-restart-watch-paths.d.ts +13 -0
  295. package/src/dev/development-restart-watch-paths.js +44 -0
  296. package/src/dev/development-restart.d.ts +25 -0
  297. package/src/dev/development-restart.js +45 -0
  298. package/src/dev/invalidation/README.md +11 -0
  299. package/src/dev/invalidation/development-invalidation.service.d.ts +153 -0
  300. package/src/dev/invalidation/development-invalidation.service.js +338 -0
  301. package/src/dev/runtime-server-started-message.d.ts +10 -0
  302. package/src/dev/runtime-server-started-message.js +14 -0
  303. package/src/dev/transform-server/dev-transform-bundler.d.ts +26 -0
  304. package/src/dev/transform-server/dev-transform-bundler.js +77 -0
  305. package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +12 -0
  306. package/src/dev/transform-server/dev-transform-externalize-plugin.js +29 -0
  307. package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +17 -0
  308. package/src/dev/transform-server/dev-transform-import-rewriter.js +128 -0
  309. package/src/dev/transform-server/dev-transform-module-kind.d.ts +13 -0
  310. package/src/dev/transform-server/dev-transform-module-kind.js +17 -0
  311. package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +5 -0
  312. package/src/dev/transform-server/dev-transform-runtime-specifiers.js +16 -0
  313. package/src/dev/transform-server/dev-transform-server.d.ts +61 -0
  314. package/src/dev/transform-server/dev-transform-server.js +234 -0
  315. package/src/dev/transform-server/dev-transform-url.d.ts +18 -0
  316. package/src/dev/transform-server/dev-transform-url.js +88 -0
  317. package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +28 -0
  318. package/src/dev/transform-server/dev-transform-vendor-registry.js +148 -0
  319. package/src/dev/transform-server/index.d.ts +6 -0
  320. package/src/dev/transform-server/index.js +4 -0
  321. package/src/dev/transform-server/types.d.ts +1 -0
  322. package/src/dev/transform-server/types.js +1 -0
  323. package/src/dev-toolbar/README.md +66 -0
  324. package/src/dev-toolbar/build-error-contract.d.ts +12 -0
  325. package/src/dev-toolbar/build-error-contract.js +3 -0
  326. package/src/dev-toolbar/define-dev-tool.d.ts +21 -0
  327. package/src/dev-toolbar/define-dev-tool.js +9 -0
  328. package/src/dev-toolbar/dev-toolbar-config.d.ts +24 -0
  329. package/src/dev-toolbar/dev-toolbar-config.js +17 -0
  330. package/src/dev-toolbar/dev-toolbar-manifest-contract.d.ts +22 -0
  331. package/src/dev-toolbar/dev-toolbar-manifest-contract.js +2 -0
  332. package/src/dev-toolbar/dev-toolbar-manifest.d.ts +27 -0
  333. package/src/dev-toolbar/dev-toolbar-manifest.js +65 -0
  334. package/src/dev-toolbar/dev-toolbar-package.d.ts +34 -0
  335. package/src/dev-toolbar/dev-toolbar-package.js +78 -0
  336. package/src/dev-toolbar/dev-toolbar-runtime-paths.d.ts +8 -0
  337. package/src/dev-toolbar/dev-toolbar-runtime-paths.js +11 -0
  338. package/src/dev-toolbar/dev-toolbar-runtime.d.ts +10 -0
  339. package/src/dev-toolbar/dev-toolbar-runtime.js +26 -0
  340. package/src/diagnostics/README.md +11 -0
  341. package/src/diagnostics/request-pipeline-metrics.d.ts +48 -0
  342. package/src/diagnostics/request-pipeline-metrics.js +113 -0
  343. package/src/diagnostics/startup-trace.d.ts +71 -0
  344. package/src/diagnostics/startup-trace.js +247 -0
  345. package/src/eco/README.md +108 -22
  346. package/src/eco/component-identity.d.ts +17 -0
  347. package/src/eco/component-identity.js +25 -0
  348. package/src/eco/component-internal-state.d.ts +5 -0
  349. package/src/eco/component-internal-state.js +17 -0
  350. package/src/eco/component-render-context.d.ts +60 -0
  351. package/src/eco/component-render-context.js +140 -0
  352. package/src/{route-renderer/orchestration/render-output.utils.d.ts → eco/component-render-output.d.ts} +24 -16
  353. package/src/eco/component-render-output.js +123 -0
  354. package/src/eco/discovered-dependencies.d.ts +45 -0
  355. package/src/eco/discovered-dependencies.js +87 -0
  356. package/src/eco/eco-declared-component.d.ts +15 -0
  357. package/src/eco/eco-declared-component.js +23 -0
  358. package/src/eco/eco.browser.d.ts +1 -1
  359. package/src/eco/eco.browser.js +64 -66
  360. package/src/eco/eco.d.ts +1 -1
  361. package/src/eco/eco.js +173 -67
  362. package/src/eco/global-injector-map.d.ts +3 -3
  363. package/src/eco/global-injector-map.js +55 -41
  364. package/src/eco/module-dependencies.js +52 -44
  365. package/src/eco/page-dependency-contributions.d.ts +19 -0
  366. package/src/eco/page-dependency-contributions.js +52 -0
  367. package/src/eco/page-layout-normalization.d.ts +21 -0
  368. package/src/eco/page-layout-normalization.js +69 -0
  369. package/src/env.d.ts +31 -7
  370. package/src/env.js +38 -0
  371. package/src/errors/README.md +5 -0
  372. package/src/errors/http-error-page-contract.d.ts +77 -0
  373. package/src/errors/http-error-page-contract.js +106 -0
  374. package/src/errors/http-error.d.ts +8 -0
  375. package/src/errors/http-error.js +66 -49
  376. package/src/errors/index.d.ts +2 -0
  377. package/src/errors/index.js +3 -4
  378. package/src/errors/locals-access-error.js +5 -8
  379. package/src/errors/undeclared-component-dependency-error.d.ts +11 -0
  380. package/src/errors/undeclared-component-dependency-error.js +17 -0
  381. package/src/global/README.md +5 -0
  382. package/src/global/app-logger.js +4 -6
  383. package/src/hmr/README.md +38 -0
  384. package/src/hmr/client/build-error-overlay.d.ts +17 -0
  385. package/src/hmr/client/build-error-overlay.js +79 -0
  386. package/src/hmr/client/build-error-overlay.test.browser.d.ts +1 -0
  387. package/src/hmr/client/build-error-overlay.test.browser.js +48 -0
  388. package/src/hmr/client/build-error-presentation.d.ts +2 -0
  389. package/src/hmr/client/build-error-presentation.js +30 -0
  390. package/src/hmr/client/hmr-runtime.js +122 -101
  391. package/src/hmr/client/hmr-runtime.test.browser.d.ts +1 -0
  392. package/src/hmr/client/hmr-runtime.test.browser.js +32 -0
  393. package/src/hmr/client/module-update.d.ts +13 -0
  394. package/src/hmr/client/module-update.js +39 -0
  395. package/src/hmr/dev-client-runtime.d.ts +39 -0
  396. package/src/hmr/dev-client-runtime.js +78 -0
  397. package/src/hmr/entrypoint-dependency-graph.d.ts +12 -0
  398. package/src/hmr/entrypoint-dependency-graph.js +27 -0
  399. package/src/hmr/hmr-asset-paths.d.ts +14 -0
  400. package/src/hmr/hmr-asset-paths.js +22 -0
  401. package/src/hmr/hmr-entrypoint-output.d.ts +11 -0
  402. package/src/hmr/hmr-entrypoint-output.js +34 -0
  403. package/src/hmr/hmr-file-change-prep.d.ts +9 -0
  404. package/src/hmr/hmr-file-change-prep.js +11 -0
  405. package/src/hmr/hmr-registered-entrypoints-context.d.ts +7 -0
  406. package/src/hmr/hmr-registered-entrypoints-context.js +1 -0
  407. package/src/hmr/hmr-runtime-paths.d.ts +10 -0
  408. package/src/hmr/hmr-runtime-paths.js +13 -0
  409. package/src/hmr/hmr-strategy.d.ts +18 -22
  410. package/src/hmr/hmr-strategy.js +111 -42
  411. package/src/hmr/strategies/default-hmr-strategy.js +55 -33
  412. package/src/hmr/strategies/js-hmr-strategy.d.ts +16 -102
  413. package/src/hmr/strategies/js-hmr-strategy.js +113 -170
  414. package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
  415. package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +35 -0
  416. package/src/html/README.md +15 -0
  417. package/src/html/html-rewriter.d.ts +77 -0
  418. package/src/html/html-rewriter.js +590 -0
  419. package/src/html/html-source-parser.d.ts +59 -0
  420. package/src/html/html-source-parser.js +203 -0
  421. package/src/html/html-tokenizer.d.ts +69 -0
  422. package/src/html/html-tokenizer.js +193 -0
  423. package/src/html/html-transformer.service.d.ts +74 -0
  424. package/src/html/html-transformer.service.js +173 -0
  425. package/src/html-pages/README.md +104 -0
  426. package/src/html-pages/html-page-classic-script.d.ts +15 -0
  427. package/src/html-pages/html-page-classic-script.js +25 -0
  428. package/src/html-pages/html-page-document.d.ts +33 -0
  429. package/src/html-pages/html-page-document.js +100 -0
  430. package/src/html-pages/html-page-module-scripts.d.ts +86 -0
  431. package/src/html-pages/html-page-module-scripts.js +293 -0
  432. package/src/html-pages/html-page-module.d.ts +32 -0
  433. package/src/html-pages/html-page-module.js +113 -0
  434. package/src/html-pages/html-page-renderer.d.ts +69 -0
  435. package/src/html-pages/html-page-renderer.js +287 -0
  436. package/src/html-pages/html-page-template.d.ts +128 -0
  437. package/src/html-pages/html-page-template.js +495 -0
  438. package/src/html-pages/html-page-warning-state.d.ts +8 -0
  439. package/src/html-pages/html-page-warning-state.js +6 -0
  440. package/src/html-pages/html-pages.plugin.d.ts +23 -0
  441. package/src/html-pages/html-pages.plugin.js +32 -0
  442. package/src/index.browser.d.ts +4 -1
  443. package/src/index.browser.js +5 -4
  444. package/src/index.d.ts +8 -4
  445. package/src/index.js +9 -21
  446. package/src/integration.d.ts +25 -0
  447. package/src/integration.js +23 -0
  448. package/src/islands/README.md +44 -0
  449. package/src/islands/island-host.d.ts +43 -0
  450. package/src/islands/island-host.js +65 -0
  451. package/src/page-cache/README.md +17 -0
  452. package/src/page-cache/cache.types.d.ts +1 -0
  453. package/src/page-cache/cache.types.js +1 -0
  454. package/src/page-cache/html-page-cache-dependency-index.d.ts +15 -0
  455. package/src/page-cache/html-page-cache-dependency-index.js +27 -0
  456. package/src/{services/cache → page-cache}/memory-cache-store.d.ts +3 -3
  457. package/src/page-cache/memory-cache-store.js +118 -0
  458. package/src/{services/cache → page-cache}/page-cache-service.d.ts +29 -10
  459. package/src/page-cache/page-cache-service.js +374 -0
  460. package/src/{services/cache → page-cache}/page-request-cache-coordinator.service.d.ts +7 -2
  461. package/src/page-cache/page-request-cache-coordinator.service.js +139 -0
  462. package/src/plugins/README.md +29 -11
  463. package/src/plugins/alias-resolver-cache.d.ts +39 -0
  464. package/src/plugins/alias-resolver-cache.js +62 -0
  465. package/src/plugins/alias-resolver-plugin.d.ts +3 -2
  466. package/src/plugins/alias-resolver-plugin.js +34 -50
  467. package/src/plugins/component-import-discovery.d.ts +28 -0
  468. package/src/plugins/component-import-discovery.js +244 -0
  469. package/src/plugins/define-integration.d.ts +24 -0
  470. package/src/plugins/define-integration.js +20 -0
  471. package/src/plugins/eco-component-meta-plugin.d.ts +21 -93
  472. package/src/plugins/eco-component-meta-plugin.js +311 -161
  473. package/src/plugins/find-integration-for-file.d.ts +16 -0
  474. package/src/plugins/find-integration-for-file.js +34 -0
  475. package/src/plugins/foreign-jsx-override-plugin.d.ts +4 -2
  476. package/src/plugins/foreign-jsx-override-plugin.js +48 -31
  477. package/src/plugins/integration-plugin.d.ts +109 -104
  478. package/src/plugins/integration-plugin.js +150 -172
  479. package/src/plugins/jsx-import-source.utils.d.ts +7 -0
  480. package/src/plugins/jsx-import-source.utils.js +15 -0
  481. package/src/plugins/package-specifier.d.ts +8 -0
  482. package/src/plugins/package-specifier.js +24 -0
  483. package/src/plugins/processor.d.ts +85 -34
  484. package/src/plugins/processor.js +160 -126
  485. package/src/plugins/tsconfig-import-resolver.d.ts +46 -0
  486. package/src/plugins/tsconfig-import-resolver.js +268 -0
  487. package/src/processor.d.ts +4 -0
  488. package/src/processor.js +3 -0
  489. package/src/route-renderer/GRAPH.md +94 -305
  490. package/src/route-renderer/README.md +114 -70
  491. package/src/route-renderer/error-pages/README.md +11 -0
  492. package/src/route-renderer/error-pages/default-error-pages.d.ts +39 -0
  493. package/src/route-renderer/error-pages/default-error-pages.js +192 -0
  494. package/src/route-renderer/error-pages/error-page-renderer.d.ts +51 -0
  495. package/src/route-renderer/error-pages/error-page-renderer.js +130 -0
  496. package/src/route-renderer/error-pages/semantic-error-page-exporter.d.ts +22 -0
  497. package/src/route-renderer/error-pages/semantic-error-page-exporter.js +33 -0
  498. package/src/route-renderer/explicit-view-render-preparation.d.ts +44 -0
  499. package/src/route-renderer/explicit-view-render-preparation.js +49 -0
  500. package/src/route-renderer/orchestration/custom-element-scripts/README.md +15 -0
  501. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
  502. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +24 -0
  503. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +78 -0
  504. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +164 -0
  505. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.d.ts +17 -0
  506. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +34 -0
  507. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +15 -0
  508. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +65 -0
  509. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +114 -0
  510. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +161 -0
  511. package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.d.ts +32 -0
  512. package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.js +52 -0
  513. package/src/route-renderer/orchestration/foreign-child/foreign-child-output.utils.d.ts +4 -0
  514. package/src/route-renderer/orchestration/foreign-child/foreign-child-output.utils.js +27 -0
  515. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +127 -0
  516. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +319 -0
  517. package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.d.ts +18 -0
  518. package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.js +33 -0
  519. package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +27 -0
  520. package/src/route-renderer/orchestration/foreign-child/render-session.js +9 -0
  521. package/src/route-renderer/orchestration/integration-renderer.d.ts +339 -344
  522. package/src/route-renderer/orchestration/integration-renderer.js +1210 -942
  523. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.d.ts +39 -0
  524. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +94 -0
  525. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +15 -0
  526. package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +49 -0
  527. package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +70 -0
  528. package/src/route-renderer/orchestration/ownership-graph/component-graph.js +177 -0
  529. package/src/route-renderer/orchestration/ownership-graph/ownership-validation.service.d.ts +26 -0
  530. package/src/route-renderer/orchestration/ownership-graph/ownership-validation.service.js +74 -0
  531. package/src/route-renderer/orchestration/ownership-graph/page-client-browser-assets.d.ts +28 -0
  532. package/src/route-renderer/orchestration/ownership-graph/page-client-browser-assets.js +44 -0
  533. package/src/route-renderer/orchestration/ownership-graph/page-client-plan.d.ts +40 -0
  534. package/src/route-renderer/orchestration/ownership-graph/page-client-plan.js +175 -0
  535. package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.d.ts +7 -0
  536. package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +31 -0
  537. package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +33 -0
  538. package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +14 -0
  539. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.merge.d.ts +5 -0
  540. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.merge.js +30 -0
  541. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.d.ts +12 -0
  542. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.js +32 -0
  543. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +113 -0
  544. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +492 -0
  545. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +58 -0
  546. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +360 -0
  547. package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +26 -0
  548. package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +32 -0
  549. package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.d.ts +5 -0
  550. package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.js +11 -0
  551. package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.d.ts +15 -0
  552. package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.js +43 -0
  553. package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.d.ts +26 -0
  554. package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.js +43 -0
  555. package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.d.ts +26 -0
  556. package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.js +44 -0
  557. package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.d.ts +4 -0
  558. package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.js +30 -0
  559. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +131 -0
  560. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +350 -0
  561. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.test-fixtures.d.ts +35 -0
  562. package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.test-fixtures.js +69 -0
  563. package/src/route-renderer/orchestration/string-markup-renderer.d.ts +11 -0
  564. package/src/route-renderer/orchestration/string-markup-renderer.js +10 -0
  565. package/src/route-renderer/page-loading/component-dependency-collection.d.ts +50 -0
  566. package/src/route-renderer/page-loading/component-dependency-collection.js +197 -0
  567. package/src/route-renderer/page-loading/declared-asset-collection.d.ts +24 -0
  568. package/src/route-renderer/page-loading/declared-asset-collection.js +78 -0
  569. package/src/route-renderer/page-loading/dependency-resolver.d.ts +41 -6
  570. package/src/route-renderer/page-loading/dependency-resolver.js +232 -417
  571. package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +12 -0
  572. package/src/route-renderer/page-loading/ecopages-virtual-imports.js +100 -0
  573. package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +41 -0
  574. package/src/route-renderer/page-loading/file-scoped-dependency-components.js +120 -0
  575. package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +44 -0
  576. package/src/route-renderer/page-loading/lazy-entry-collection.js +74 -0
  577. package/src/route-renderer/page-loading/lazy-trigger-planning.d.ts +19 -0
  578. package/src/route-renderer/page-loading/lazy-trigger-planning.js +51 -0
  579. package/src/route-renderer/page-loading/module-declaration-aggregation.d.ts +5 -0
  580. package/src/route-renderer/page-loading/module-declaration-aggregation.js +44 -0
  581. package/src/route-renderer/page-loading/module-declaration-scripts.d.ts +3 -0
  582. package/src/route-renderer/page-loading/module-declaration-scripts.js +13 -0
  583. package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +12 -0
  584. package/src/route-renderer/page-loading/page-dependency-bundling.js +200 -0
  585. package/src/route-renderer/page-loading/page-module-loader.d.ts +9 -9
  586. package/src/route-renderer/page-loading/page-module-loader.js +136 -123
  587. package/src/route-renderer/page-loading/resolved-page-dependencies.d.ts +11 -0
  588. package/src/route-renderer/page-loading/resolved-page-dependencies.js +39 -0
  589. package/src/route-renderer/route-renderer.d.ts +38 -34
  590. package/src/route-renderer/route-renderer.js +50 -93
  591. package/src/router/README.md +85 -22
  592. package/src/router/client/link-intent.d.ts +11 -21
  593. package/src/router/client/link-intent.js +56 -30
  594. package/src/router/client/link-intent.test.browser.js +30 -40
  595. package/src/router/client/link-navigation-policy.d.ts +45 -0
  596. package/src/router/client/link-navigation-policy.js +102 -0
  597. package/src/router/client/link-navigation-policy.test.browser.d.ts +1 -0
  598. package/src/router/client/link-navigation-policy.test.browser.js +142 -0
  599. package/src/router/client/navigation-commit.d.ts +22 -0
  600. package/src/router/client/navigation-commit.js +57 -0
  601. package/src/router/client/navigation-commit.test.browser.d.ts +1 -0
  602. package/src/router/client/navigation-commit.test.browser.js +116 -0
  603. package/src/router/client/navigation-coordinator.d.ts +21 -20
  604. package/src/router/client/navigation-coordinator.js +194 -204
  605. package/src/router/client/navigation-document.d.ts +37 -0
  606. package/src/router/client/navigation-document.js +106 -0
  607. package/src/router/client/navigation-document.test.browser.d.ts +1 -0
  608. package/src/router/client/navigation-document.test.browser.js +77 -0
  609. package/src/router/client/navigation-head.d.ts +13 -0
  610. package/src/router/client/navigation-head.js +238 -0
  611. package/src/router/client/navigation-head.test.browser.d.ts +1 -0
  612. package/src/router/client/navigation-head.test.browser.js +101 -0
  613. package/src/router/client/navigation-lifecycle.d.ts +49 -0
  614. package/src/router/client/navigation-lifecycle.js +50 -0
  615. package/src/router/client/navigation-lifecycle.test.browser.d.ts +1 -0
  616. package/src/router/client/navigation-lifecycle.test.browser.js +97 -0
  617. package/src/router/client/navigation-pipeline.d.ts +8 -0
  618. package/src/router/client/navigation-pipeline.js +8 -0
  619. package/src/router/client/navigation-replay.d.ts +16 -0
  620. package/src/router/client/navigation-replay.js +17 -0
  621. package/src/router/client/navigation-view-transition.d.ts +9 -0
  622. package/src/router/client/navigation-view-transition.js +61 -0
  623. package/src/router/client/navigation-view-transition.test.browser.d.ts +1 -0
  624. package/src/router/client/navigation-view-transition.test.browser.js +189 -0
  625. package/src/router/client/staged-stylesheets.test-fixtures.d.ts +18 -0
  626. package/src/router/client/staged-stylesheets.test-fixtures.js +31 -0
  627. package/src/router/server/parse-search-params.d.ts +9 -0
  628. package/src/router/server/parse-search-params.js +16 -0
  629. package/src/router/server/route-registry.d.ts +103 -0
  630. package/src/router/server/route-registry.js +239 -0
  631. package/src/router/server/segment-path-matcher.d.ts +27 -0
  632. package/src/router/server/segment-path-matcher.js +149 -0
  633. package/src/static-site-generator/README.md +41 -0
  634. package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +36 -0
  635. package/src/static-site-generator/production-page-browser-graph-prebuild.js +196 -0
  636. package/src/static-site-generator/sitemap-routes.d.ts +14 -0
  637. package/src/static-site-generator/sitemap-routes.js +36 -0
  638. package/src/static-site-generator/sitemap.d.ts +15 -0
  639. package/src/static-site-generator/sitemap.js +42 -0
  640. package/src/static-site-generator/static-export-context.d.ts +33 -0
  641. package/src/static-site-generator/static-export-context.js +1 -0
  642. package/src/static-site-generator/static-site-generator.d.ts +52 -47
  643. package/src/static-site-generator/static-site-generator.js +555 -331
  644. package/src/static-site-generator/static-site-generator.test-utils.d.ts +2 -0
  645. package/src/static-site-generator/static-site-generator.test-utils.js +41 -0
  646. package/src/types/README.md +5 -0
  647. package/src/types/api-response.d.ts +9 -0
  648. package/src/types/api-response.js +1 -0
  649. package/src/{services/assets/asset-processing-service/assets.types.d.ts → types/asset-types.d.ts} +36 -4
  650. package/src/types/asset-types.js +1 -0
  651. package/src/types/build-types.d.ts +104 -0
  652. package/src/types/build-types.js +1 -0
  653. package/src/{services/cache/cache.types.d.ts → types/cache-types.d.ts} +20 -9
  654. package/src/types/cache-types.js +5 -0
  655. package/src/types/component-identity.d.ts +6 -0
  656. package/src/types/component-identity.js +1 -0
  657. package/src/types/contracts.d.ts +1523 -0
  658. package/src/types/contracts.js +1 -0
  659. package/src/types/dev-transform-types.d.ts +15 -0
  660. package/src/types/dev-transform-types.js +1 -0
  661. package/src/{eco/eco.types.d.ts → types/eco-api-types.d.ts} +79 -44
  662. package/src/types/eco-api-types.js +5 -0
  663. package/src/types/integration-types.d.ts +3 -0
  664. package/src/types/integration-types.js +1 -0
  665. package/src/types/public-types.d.ts +3 -1165
  666. package/src/types/public-types.js +1 -0
  667. package/src/types/standard-schema-types.d.ts +12 -0
  668. package/src/types/standard-schema-types.js +1 -0
  669. package/src/utils/README.md +7 -0
  670. package/src/utils/additional-watch-paths.d.ts +25 -0
  671. package/src/utils/additional-watch-paths.js +49 -0
  672. package/src/utils/app-runtime.d.ts +9 -0
  673. package/src/utils/app-runtime.js +13 -0
  674. package/src/utils/content-hash.d.ts +8 -0
  675. package/src/utils/content-hash.js +16 -0
  676. package/src/utils/deep-merge.js +39 -26
  677. package/src/utils/ecopages-route-info.d.ts +22 -0
  678. package/src/utils/ecopages-route-info.js +20 -0
  679. package/src/utils/html-entities.d.ts +10 -0
  680. package/src/utils/html-entities.js +34 -0
  681. package/src/utils/html-escaping.d.ts +14 -0
  682. package/src/utils/html-escaping.js +42 -5
  683. package/src/utils/invariant.js +11 -10
  684. package/src/utils/locals-utils.d.ts +1 -1
  685. package/src/utils/locals-utils.js +32 -22
  686. package/src/utils/parse-cli-args.d.ts +3 -6
  687. package/src/utils/parse-cli-args.js +55 -60
  688. package/src/utils/path-containment.d.ts +15 -0
  689. package/src/utils/path-containment.js +27 -0
  690. package/src/utils/path-pattern.d.ts +23 -0
  691. package/src/utils/path-pattern.js +42 -0
  692. package/src/utils/regex-escaping.d.ts +2 -0
  693. package/src/utils/regex-escaping.js +4 -0
  694. package/src/utils/resolve-entry-file.d.ts +72 -0
  695. package/src/utils/resolve-entry-file.js +74 -0
  696. package/src/utils/resolve-work-dir.js +23 -27
  697. package/src/utils/runtime.d.ts +12 -9
  698. package/src/utils/runtime.js +14 -39
  699. package/src/utils/server-utils.module.d.ts +13 -2
  700. package/src/utils/server-utils.module.js +74 -53
  701. package/src/utils/static-file-extensions.d.ts +12 -0
  702. package/src/utils/static-file-extensions.js +54 -0
  703. package/src/validation/README.md +9 -0
  704. package/src/validation/standard-schema.types.d.ts +1 -0
  705. package/src/validation/standard-schema.types.js +1 -0
  706. package/src/validation/validate-request.d.ts +36 -0
  707. package/src/validation/validate-request.js +56 -0
  708. package/src/validation/validate-standard-schema.d.ts +7 -0
  709. package/src/validation/validate-standard-schema.js +14 -0
  710. package/src/watchers/README.md +15 -0
  711. package/src/watchers/project-watcher-ignore.d.ts +13 -0
  712. package/src/watchers/project-watcher-ignore.js +27 -0
  713. package/src/watchers/project-watcher.d.ts +80 -84
  714. package/src/watchers/project-watcher.js +495 -264
  715. package/src/watchers/project-watcher.test-helpers.d.ts +59 -3
  716. package/src/watchers/project-watcher.test-helpers.js +106 -50
  717. package/src/watchers/workspace-package-watch-roots.d.ts +9 -0
  718. package/src/watchers/workspace-package-watch-roots.js +44 -0
  719. package/CHANGELOG.md +0 -38
  720. package/src/adapters/abstract/application-adapter.d.ts +0 -194
  721. package/src/adapters/abstract/application-adapter.js +0 -121
  722. package/src/adapters/abstract/router-adapter.d.ts +0 -26
  723. package/src/adapters/abstract/router-adapter.js +0 -5
  724. package/src/adapters/abstract/server-adapter.d.ts +0 -69
  725. package/src/adapters/abstract/server-adapter.js +0 -15
  726. package/src/adapters/bun/client-bridge.d.ts +0 -34
  727. package/src/adapters/bun/client-bridge.js +0 -48
  728. package/src/adapters/bun/create-app.d.ts +0 -52
  729. package/src/adapters/bun/create-app.js +0 -116
  730. package/src/adapters/bun/hmr-manager.d.ts +0 -143
  731. package/src/adapters/bun/hmr-manager.js +0 -334
  732. package/src/adapters/bun/index.d.ts +0 -2
  733. package/src/adapters/bun/index.js +0 -8
  734. package/src/adapters/bun/server-adapter.d.ts +0 -155
  735. package/src/adapters/bun/server-adapter.js +0 -374
  736. package/src/adapters/bun/server-lifecycle.d.ts +0 -63
  737. package/src/adapters/bun/server-lifecycle.js +0 -92
  738. package/src/adapters/index.d.ts +0 -2
  739. package/src/adapters/index.js +0 -8
  740. package/src/adapters/node/node-hmr-manager.d.ts +0 -133
  741. package/src/adapters/node/node-hmr-manager.js +0 -312
  742. package/src/adapters/node/static-content-server.d.ts +0 -60
  743. package/src/adapters/node/static-content-server.js +0 -194
  744. package/src/adapters/shared/api-response.js +0 -96
  745. package/src/adapters/shared/application-adapter.d.ts +0 -18
  746. package/src/adapters/shared/application-adapter.js +0 -90
  747. package/src/adapters/shared/define-api-handler.d.ts +0 -25
  748. package/src/adapters/shared/define-api-handler.js +0 -15
  749. package/src/adapters/shared/explicit-static-route-matcher.js +0 -103
  750. package/src/adapters/shared/file-route-middleware-pipeline.js +0 -99
  751. package/src/adapters/shared/fs-server-response-factory.d.ts +0 -19
  752. package/src/adapters/shared/fs-server-response-factory.js +0 -97
  753. package/src/adapters/shared/fs-server-response-matcher.d.ts +0 -75
  754. package/src/adapters/shared/fs-server-response-matcher.js +0 -160
  755. package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +0 -55
  756. package/src/adapters/shared/hmr-entrypoint-registrar.js +0 -87
  757. package/src/adapters/shared/hmr-html-response.d.ts +0 -22
  758. package/src/adapters/shared/hmr-html-response.js +0 -32
  759. package/src/adapters/shared/render-context.js +0 -72
  760. package/src/adapters/shared/runtime-bootstrap.d.ts +0 -38
  761. package/src/adapters/shared/runtime-bootstrap.js +0 -43
  762. package/src/adapters/shared/server-adapter.d.ts +0 -97
  763. package/src/adapters/shared/server-adapter.js +0 -390
  764. package/src/adapters/shared/server-route-handler.js +0 -111
  765. package/src/adapters/shared/server-static-builder.d.ts +0 -70
  766. package/src/adapters/shared/server-static-builder.js +0 -100
  767. package/src/build/build-manifest.d.ts +0 -27
  768. package/src/build/build-manifest.js +0 -30
  769. package/src/build/build-types.d.ts +0 -57
  770. package/src/build/build-types.js +0 -0
  771. package/src/build/dev-build-coordinator.d.ts +0 -72
  772. package/src/build/dev-build-coordinator.js +0 -154
  773. package/src/build/esbuild-build-adapter.d.ts +0 -78
  774. package/src/build/esbuild-build-adapter.js +0 -505
  775. package/src/build/runtime-build-executor.d.ts +0 -14
  776. package/src/build/runtime-build-executor.js +0 -22
  777. package/src/build/runtime-specifier-alias-plugin.d.ts +0 -15
  778. package/src/build/runtime-specifier-alias-plugin.js +0 -35
  779. package/src/build/runtime-specifier-aliases.d.ts +0 -5
  780. package/src/build/runtime-specifier-aliases.js +0 -95
  781. package/src/config/config-builder.d.ts +0 -261
  782. package/src/config/config-builder.js +0 -602
  783. package/src/dev/sc-server.d.ts +0 -30
  784. package/src/dev/sc-server.js +0 -111
  785. package/src/eco/eco.types.js +0 -0
  786. package/src/eco/eco.utils.d.ts +0 -1
  787. package/src/eco/eco.utils.js +0 -10
  788. package/src/eco/lazy-injector-map.d.ts +0 -8
  789. package/src/eco/lazy-injector-map.js +0 -70
  790. package/src/hmr/hmr.postcss.test.e2e.js +0 -31
  791. package/src/hmr/hmr.test.e2e.js +0 -43
  792. package/src/integrations/ghtml/ghtml-renderer.d.ts +0 -20
  793. package/src/integrations/ghtml/ghtml-renderer.js +0 -63
  794. package/src/integrations/ghtml/ghtml.plugin.d.ts +0 -20
  795. package/src/integrations/ghtml/ghtml.plugin.js +0 -21
  796. package/src/plugins/runtime-capability.d.ts +0 -9
  797. package/src/plugins/runtime-capability.js +0 -0
  798. package/src/plugins/source-transform.d.ts +0 -46
  799. package/src/plugins/source-transform.js +0 -71
  800. package/src/route-renderer/orchestration/component-render-context.d.ts +0 -83
  801. package/src/route-renderer/orchestration/component-render-context.js +0 -147
  802. package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +0 -93
  803. package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +0 -155
  804. package/src/route-renderer/orchestration/render-execution.service.d.ts +0 -43
  805. package/src/route-renderer/orchestration/render-execution.service.js +0 -106
  806. package/src/route-renderer/orchestration/render-output.utils.js +0 -65
  807. package/src/route-renderer/orchestration/render-preparation.service.d.ts +0 -115
  808. package/src/route-renderer/orchestration/render-preparation.service.js +0 -325
  809. package/src/route-renderer/orchestration/template-serialization.d.ts +0 -38
  810. package/src/route-renderer/orchestration/template-serialization.js +0 -45
  811. package/src/router/server/fs-router-scanner.d.ts +0 -41
  812. package/src/router/server/fs-router-scanner.js +0 -161
  813. package/src/router/server/fs-router.d.ts +0 -26
  814. package/src/router/server/fs-router.js +0 -100
  815. package/src/services/README.md +0 -29
  816. package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +0 -120
  817. package/src/services/assets/asset-processing-service/asset-processing.service.js +0 -331
  818. package/src/services/assets/asset-processing-service/asset.factory.js +0 -82
  819. package/src/services/assets/asset-processing-service/assets.types.js +0 -0
  820. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -48
  821. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -41
  822. package/src/services/assets/asset-processing-service/index.js +0 -5
  823. package/src/services/assets/asset-processing-service/processor.interface.d.ts +0 -22
  824. package/src/services/assets/asset-processing-service/processor.interface.js +0 -6
  825. package/src/services/assets/asset-processing-service/processor.registry.d.ts +0 -8
  826. package/src/services/assets/asset-processing-service/processor.registry.js +0 -15
  827. package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +0 -24
  828. package/src/services/assets/asset-processing-service/processors/base/base-processor.js +0 -64
  829. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -17
  830. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +0 -72
  831. package/src/services/assets/asset-processing-service/processors/index.js +0 -5
  832. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +0 -5
  833. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +0 -57
  834. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +0 -9
  835. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +0 -88
  836. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +0 -7
  837. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +0 -75
  838. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +0 -25
  839. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +0 -66
  840. package/src/services/assets/browser-bundle.service.d.ts +0 -32
  841. package/src/services/assets/browser-bundle.service.js +0 -33
  842. package/src/services/cache/cache.types.js +0 -0
  843. package/src/services/cache/index.d.ts +0 -7
  844. package/src/services/cache/index.js +0 -7
  845. package/src/services/cache/memory-cache-store.js +0 -98
  846. package/src/services/cache/page-cache-service.js +0 -152
  847. package/src/services/cache/page-request-cache-coordinator.service.js +0 -109
  848. package/src/services/html/html-rewriter-provider.service.d.ts +0 -37
  849. package/src/services/html/html-rewriter-provider.service.js +0 -68
  850. package/src/services/html/html-transformer.service.d.ts +0 -77
  851. package/src/services/html/html-transformer.service.js +0 -215
  852. package/src/services/invalidation/development-invalidation.service.d.ts +0 -74
  853. package/src/services/invalidation/development-invalidation.service.js +0 -190
  854. package/src/services/module-loading/app-module-loader.service.d.ts +0 -25
  855. package/src/services/module-loading/app-module-loader.service.js +0 -31
  856. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +0 -24
  857. package/src/services/module-loading/app-server-module-transpiler.service.js +0 -109
  858. package/src/services/module-loading/host-module-loader-registry.d.ts +0 -4
  859. package/src/services/module-loading/host-module-loader-registry.js +0 -15
  860. package/src/services/module-loading/module-loading-types.d.ts +0 -2
  861. package/src/services/module-loading/module-loading-types.js +0 -0
  862. package/src/services/module-loading/node-bootstrap-plugin.d.ts +0 -22
  863. package/src/services/module-loading/node-bootstrap-plugin.js +0 -192
  864. package/src/services/module-loading/page-module-import.service.d.ts +0 -75
  865. package/src/services/module-loading/page-module-import.service.js +0 -161
  866. package/src/services/module-loading/server-module-transpiler.service.d.ts +0 -72
  867. package/src/services/module-loading/server-module-transpiler.service.js +0 -64
  868. package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
  869. package/src/services/runtime-state/dev-graph.service.js +0 -162
  870. package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +0 -41
  871. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -85
  872. package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +0 -69
  873. package/src/services/runtime-state/runtime-specifier-registry.service.js +0 -37
  874. package/src/services/runtime-state/server-invalidation-state.service.d.ts +0 -26
  875. package/src/services/runtime-state/server-invalidation-state.service.js +0 -35
  876. package/src/services/validation/schema-validation-service.d.ts +0 -122
  877. package/src/services/validation/schema-validation-service.js +0 -101
  878. package/src/services/validation/standard-schema.types.d.ts +0 -65
  879. package/src/services/validation/standard-schema.types.js +0 -0
  880. package/src/types/internal-types.d.ts +0 -231
  881. package/src/types/internal-types.js +0 -0
  882. package/src/utils/hash.d.ts +0 -1
  883. package/src/utils/hash.js +0 -7
  884. package/src/utils/html.d.ts +0 -1
  885. package/src/utils/html.js +0 -4
  886. package/src/utils/path-utils.module.d.ts +0 -5
  887. package/src/utils/path-utils.module.js +0 -14
  888. /package/src/{hmr/hmr.postcss.test.e2e.d.ts → adapters/shared/runtime/runtime-host.js} +0 -0
  889. /package/src/{services/assets → assets}/asset-processing-service/asset.factory.d.ts +0 -0
  890. /package/src/{hmr/hmr.test.e2e.d.ts → assets/asset-processing-service/assets.types.js} +0 -0
  891. /package/src/{services/assets → assets}/asset-processing-service/processors/index.d.ts +0 -0
  892. /package/src/{services/assets → assets}/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -0
package/src/build.js ADDED
@@ -0,0 +1,19 @@
1
+ export { createBrowserRuntimeManifest, getBrowserRuntimeSpecifierMap, } from './build/browser/browser-runtime-manifest.js';
2
+ export { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME, getBrowserRuntimeManifestFromPlugin, } from './build/browser/browser-runtime-plugin.js';
3
+ export { getHostScopedJsxOwnershipPlugins } from './build/browser/jsx-ownership-plugins.js';
4
+ export { isLitStaticRenderWorkerThread } from './build/browser/lit-static-render-worker-context.js';
5
+ export { setupAppRuntimeIntegrations, setupAppRuntimePlugins, teardownAppRuntimeIntegrations, } from './build/build-adapter.js';
6
+ export { CONTENT_BROWSER_VIRTUAL_MODULE_PATTERN, CONTENT_SERVER_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PREFIX, isContentServerVirtualModule, parseCollectionSpecifier, } from './build/contracts/content-virtual-modules.js';
7
+ export { isServerOnlyModuleSpecifier } from './build/contracts/server-only-specifier.js';
8
+ export { BuildQueue, installBuildQueue } from './build/runtime/build-queue.js';
9
+ export { buildServerModule } from './build/server-module.js';
10
+ export { parseModuleSource, recordModuleTransformProfile } from './cache/index.js';
11
+ export { GENERATED_BASE_PATHS, RESOLVED_ASSETS_DIR } from './config/constants.js';
12
+ export { ECOPAGES_DEV_RESTART_EXIT_CODE, ECOPAGES_DEV_RESTART_REASON_ENV, ECOPAGES_ENTRY_WATCH_ENV, getDevEnvFileNames, resolveDevelopmentRecoveryWatch, } from './dev/development-restart.js';
13
+ export { createRequestPipelineMetricsState, recordCollectionBuild, recordMdxTransform, } from './diagnostics/request-pipeline-metrics.js';
14
+ export { toPackageRootSpecifier } from './plugins/package-specifier.js';
15
+ export { loadTsconfigPathPrefixes, matchesTsconfigPathPrefix } from './plugins/tsconfig-import-resolver.js';
16
+ export { contentHash } from './utils/content-hash.js';
17
+ export { isPathInside } from './utils/path-containment.js';
18
+ export { SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME } from './utils/resolve-entry-file.js';
19
+ export { getEcopagesEnv, isDevelopmentRuntime, isEcopagesEnvDisabled, isEcopagesEnvEnabled, isProductionRuntime, } from './env.js';
@@ -0,0 +1,5 @@
1
+ # Module Parse Cache
2
+
3
+ **Layer:** Build.
4
+
5
+ This directory holds reusable caches for parsed source modules. Build and plugin transforms share these caches to avoid parsing the same module repeatedly.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Public cache exports for the bundler plugin chain.
3
+ *
4
+ * @module @ecopages/core/build
5
+ */
6
+ export { parseModuleSource, type ModuleParseOptions } from './module-parse-cache.js';
7
+ export { recordModuleTransformProfile } from './module-transform-profiler.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Public cache exports for the bundler plugin chain.
3
+ *
4
+ * @module @ecopages/core/build
5
+ */
6
+ export { parseModuleSource } from './module-parse-cache.js';
7
+ export { recordModuleTransformProfile } from './module-transform-profiler.js';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Process-wide parse cache for `oxc-parser.parseSync`.
3
+ *
4
+ * @remarks
5
+ * Several build plugins (eco-component-meta, client-graph-boundary,
6
+ * browser-runtime) each call `parseSync` on the same source file with
7
+ * overlapping options. This cache memoizes the parse result keyed by
8
+ * `(absolute path, source, options)`. When the source is unchanged,
9
+ * subsequent calls return the cached result without re-parsing.
10
+ *
11
+ * The cache is LRU-bounded (10 000 entries) and key-stable across a
12
+ * single HMR session. It is **content-hashed** rather than
13
+ * mtime-hashed so that `touch`/`utimes` does not invalidate a
14
+ * still-valid parse.
15
+ */
16
+ import { type ParseResult, type ParserOptions } from 'oxc-parser';
17
+ export type ModuleParseOptions = ParserOptions & {
18
+ /**
19
+ * Optional parser language override. If omitted, derived from the file
20
+ * extension at lookup time. Set this explicitly if your caller already
21
+ * computed the language (avoids re-deriving inside the cache).
22
+ */
23
+ lang?: ParserOptions['lang'];
24
+ };
25
+ /** Parses an ECMAScript module with the shared, normalized cache contract. */
26
+ export declare function parseModuleSource(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
27
+ /**
28
+ * LRU-bounded module parse cache.
29
+ *
30
+ * One instance is shared across the process; call {@link parseModuleSource}
31
+ * to use it.
32
+ */
33
+ export declare class ModuleParseCache {
34
+ private readonly entries;
35
+ private readonly maxEntries;
36
+ constructor(maxEntries?: number);
37
+ /**
38
+ * Parse `source` for `filePath`, memoizing by (filePath, source, options).
39
+ *
40
+ * @returns the {@link ParseResult} from `oxc-parser.parseSync`.
41
+ */
42
+ getOrParse(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
43
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Process-wide parse cache for `oxc-parser.parseSync`.
3
+ *
4
+ * @remarks
5
+ * Several build plugins (eco-component-meta, client-graph-boundary,
6
+ * browser-runtime) each call `parseSync` on the same source file with
7
+ * overlapping options. This cache memoizes the parse result keyed by
8
+ * `(absolute path, source, options)`. When the source is unchanged,
9
+ * subsequent calls return the cached result without re-parsing.
10
+ *
11
+ * The cache is LRU-bounded (10 000 entries) and key-stable across a
12
+ * single HMR session. It is **content-hashed** rather than
13
+ * mtime-hashed so that `touch`/`utimes` does not invalidate a
14
+ * still-valid parse.
15
+ */
16
+ import { extname } from 'node:path';
17
+ import { parseSync } from 'oxc-parser';
18
+ import { contentHash } from '../utils/content-hash.js';
19
+ const DEFAULT_MAX_ENTRIES = 10_000;
20
+ /** Resolves the Oxc dialect for a source module from its file extension. */
21
+ function parserLanguageForFile(filePath) {
22
+ const extension = extname(filePath).toLowerCase();
23
+ if (extension === '.tsx')
24
+ return 'tsx';
25
+ if (extension === '.ts' || extension === '.mts' || extension === '.cts')
26
+ return 'ts';
27
+ if (extension === '.jsx')
28
+ return 'jsx';
29
+ return 'js';
30
+ }
31
+ /** Parses an ECMAScript module with the shared, normalized cache contract. */
32
+ export function parseModuleSource(filePath, source, options = {}) {
33
+ return moduleParseCache.getOrParse(filePath, source, options);
34
+ }
35
+ /**
36
+ * LRU-bounded module parse cache.
37
+ *
38
+ * One instance is shared across the process; call {@link parseModuleSource}
39
+ * to use it.
40
+ */
41
+ export class ModuleParseCache {
42
+ entries = new Map();
43
+ maxEntries;
44
+ constructor(maxEntries = DEFAULT_MAX_ENTRIES) {
45
+ if (maxEntries <= 0) {
46
+ throw new Error(`ModuleParseCache: maxEntries must be > 0, got ${maxEntries}`);
47
+ }
48
+ this.maxEntries = maxEntries;
49
+ }
50
+ /**
51
+ * Parse `source` for `filePath`, memoizing by (filePath, source, options).
52
+ *
53
+ * @returns the {@link ParseResult} from `oxc-parser.parseSync`.
54
+ */
55
+ getOrParse(filePath, source, options = {}) {
56
+ const normalizedOptions = normalizeModuleParseOptions(filePath, options);
57
+ const hash = contentHash(source, 16);
58
+ const key = makeKey(filePath, hash, normalizedOptions);
59
+ const existing = this.entries.get(key);
60
+ if (existing && existing.hash === hash) {
61
+ // Refresh LRU position.
62
+ this.entries.delete(key);
63
+ this.entries.set(key, existing);
64
+ return existing.result;
65
+ }
66
+ const result = parseSync(filePath, source, normalizedOptions);
67
+ this.entries.set(key, { hash, result });
68
+ if (this.entries.size > this.maxEntries) {
69
+ // Map iteration order is insertion order; the first key is the
70
+ // least recently used (we delete-then-set on hits, so the
71
+ // oldest still-present entry is the LRU one).
72
+ const oldestKey = this.entries.keys().next().value;
73
+ if (oldestKey !== undefined) {
74
+ this.entries.delete(oldestKey);
75
+ }
76
+ }
77
+ return result;
78
+ }
79
+ }
80
+ /**
81
+ * Default shared cache, amortized across plugins and build invocations.
82
+ */
83
+ const moduleParseCache = new ModuleParseCache();
84
+ function normalizeModuleParseOptions(filePath, options) {
85
+ return {
86
+ ...options,
87
+ lang: options.lang ?? parserLanguageForFile(filePath),
88
+ sourceType: options.sourceType ?? 'module',
89
+ };
90
+ }
91
+ function makeKey(filePath, sourceHash, options) {
92
+ // Stringify only the option keys we actually use; `parseSync` does
93
+ // not deeply equal-check options so any extra keys would be noise.
94
+ const lang = options.lang ?? '';
95
+ const sourceType = options.sourceType ?? '';
96
+ return `${filePath} ${sourceHash} ${lang} ${sourceType}`;
97
+ }
@@ -0,0 +1,7 @@
1
+ type ProfileRecord = {
2
+ category: string;
3
+ phase: string;
4
+ ms: number;
5
+ };
6
+ export declare function recordModuleTransformProfile(record: ProfileRecord): void;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ export function recordModuleTransformProfile(record) {
2
+ if (process.env.ECO_AST_PROFILE !== '1')
3
+ return;
4
+ console.info(`[ecopages:ast-profile] ${JSON.stringify({
5
+ ...record,
6
+ ms: Number(record.ms.toFixed(3)),
7
+ })}`);
8
+ }
@@ -0,0 +1,5 @@
1
+ # Browser Runtime Primitives
2
+
3
+ **Layer:** Foundation.
4
+
5
+ This directory contains browser-side helpers used by the router and generated browser entries. Keep these modules independent of route rendering, development services, and runtime adapters.
@@ -0,0 +1,2 @@
1
+ /** Shared attribute used to keep DOM elements across page navigations. */
2
+ export declare const ECO_PERSIST_ATTRIBUTE = "data-eco-persist";
@@ -0,0 +1,2 @@
1
+ /** Shared attribute used to keep DOM elements across page navigations. */
2
+ export const ECO_PERSIST_ATTRIBUTE = 'data-eco-persist';
@@ -0,0 +1,36 @@
1
+ export type ScriptActivation = {
2
+ attributes: Iterable<readonly [string, string]>;
3
+ textContent: string;
4
+ insert(script: HTMLScriptElement): void;
5
+ /** Skips the activation when its target left the document while it waited. */
6
+ isDetached?(): boolean;
7
+ };
8
+ /**
9
+ * Inserts fresh copies of `activations` in document order.
10
+ *
11
+ * @remarks
12
+ * Parser-blocking classic scripts wait for load before the sequence advances.
13
+ * Other external scripts keep insertion order, and a newer navigation stops a
14
+ * sequence that is waiting on an earlier script.
15
+ */
16
+ export declare function activateScriptsInOrder(activations: readonly ScriptActivation[], isStale?: () => boolean): Promise<void>;
17
+ /**
18
+ * Starts the shared head, rerun, and optional body script queue.
19
+ *
20
+ * @remarks
21
+ * A later call supersedes a queue still waiting on a script load. The calling
22
+ * navigation's own transaction is not consulted because it completes while the
23
+ * queue is still waiting.
24
+ */
25
+ export declare function activateNavigationScripts(activations: readonly ScriptActivation[], options?: {
26
+ persistAttribute?: string;
27
+ includeBodyScripts?: boolean;
28
+ }): void;
29
+ /**
30
+ * Returns activations for executable scripts in the live body.
31
+ *
32
+ * @remarks
33
+ * Persisted subtrees stay untouched, while ordinary body scripts run again
34
+ * because each committed body represents a new page visit.
35
+ */
36
+ export declare function collectBodyScripts(persistAttribute?: string): ScriptActivation[];
@@ -0,0 +1,97 @@
1
+ import { ECO_PERSIST_ATTRIBUTE } from '../navigation-attributes.js';
2
+ import { isNonExecutableHeadScript, isRerunScript } from './classification.js';
3
+ let navigationScriptGeneration = 0;
4
+ function isActivatableScript(script) {
5
+ return !isNonExecutableHeadScript(script) && !isRerunScript(script);
6
+ }
7
+ function isModuleScript(script) {
8
+ return (script.getAttribute('type') ?? '').trim().toLowerCase() === 'module';
9
+ }
10
+ /**
11
+ * Returns whether page parsing would stop at `script` until it loads and runs.
12
+ *
13
+ * @remarks
14
+ * Async, deferred, non-JavaScript, and `nomodule` scripts cannot block parsing
15
+ * in the current browser and must not hold later activations.
16
+ */
17
+ function isParserBlocking(script) {
18
+ return (script.hasAttribute('src') &&
19
+ !isNonExecutableHeadScript(script) &&
20
+ !isModuleScript(script) &&
21
+ !script.hasAttribute('async') &&
22
+ !script.hasAttribute('defer') &&
23
+ !script.hasAttribute('nomodule'));
24
+ }
25
+ function whenLoaded(script) {
26
+ return new Promise((resolve) => {
27
+ script.addEventListener('load', () => resolve(), { once: true });
28
+ script.addEventListener('error', () => resolve(), { once: true });
29
+ });
30
+ }
31
+ /**
32
+ * Inserts fresh copies of `activations` in document order.
33
+ *
34
+ * @remarks
35
+ * Parser-blocking classic scripts wait for load before the sequence advances.
36
+ * Other external scripts keep insertion order, and a newer navigation stops a
37
+ * sequence that is waiting on an earlier script.
38
+ */
39
+ export async function activateScriptsInOrder(activations, isStale = () => false) {
40
+ let blockingLoads = [];
41
+ for (const activation of activations) {
42
+ const script = document.createElement('script');
43
+ for (const [name, value] of activation.attributes) {
44
+ script.setAttribute(name, value);
45
+ }
46
+ script.textContent = activation.textContent;
47
+ if (blockingLoads.length > 0) {
48
+ await Promise.all(blockingLoads);
49
+ blockingLoads = [];
50
+ if (isStale())
51
+ return;
52
+ }
53
+ if (activation.isDetached?.())
54
+ continue;
55
+ if (script.hasAttribute('src') && !script.hasAttribute('async')) {
56
+ script.async = false;
57
+ }
58
+ activation.insert(script);
59
+ if (script.isConnected && isParserBlocking(script)) {
60
+ blockingLoads.push(whenLoaded(script));
61
+ }
62
+ }
63
+ }
64
+ /**
65
+ * Starts the shared head, rerun, and optional body script queue.
66
+ *
67
+ * @remarks
68
+ * A later call supersedes a queue still waiting on a script load. The calling
69
+ * navigation's own transaction is not consulted because it completes while the
70
+ * queue is still waiting.
71
+ */
72
+ export function activateNavigationScripts(activations, options = {}) {
73
+ const generation = ++navigationScriptGeneration;
74
+ const bodyActivations = options.includeBodyScripts ? collectBodyScripts(options.persistAttribute) : [];
75
+ void activateScriptsInOrder([...activations, ...bodyActivations], () => generation !== navigationScriptGeneration);
76
+ }
77
+ /**
78
+ * Returns activations for executable scripts in the live body.
79
+ *
80
+ * @remarks
81
+ * Persisted subtrees stay untouched, while ordinary body scripts run again
82
+ * because each committed body represents a new page visit.
83
+ */
84
+ export function collectBodyScripts(persistAttribute = ECO_PERSIST_ATTRIBUTE) {
85
+ const persistedSelector = `[${persistAttribute}], [${ECO_PERSIST_ATTRIBUTE}]`;
86
+ return Array.from(document.body.querySelectorAll('script'))
87
+ .filter((script) => isActivatableScript(script) && !script.closest(persistedSelector))
88
+ .map((script) => ({
89
+ attributes: Array.from(script.attributes, (attribute) => [
90
+ attribute.name,
91
+ attribute.value,
92
+ ]),
93
+ textContent: script.textContent ?? '',
94
+ insert: (replacement) => script.replaceWith(replacement),
95
+ isDetached: () => !script.isConnected,
96
+ }));
97
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns whether a script tag carries non-executable data (for example JSON-LD).
3
+ */
4
+ export declare function isNonExecutableHeadScript(element: Element): boolean;
5
+ /**
6
+ * Returns whether an identified inline head script should survive head diffing.
7
+ */
8
+ export declare function shouldPersistExecutableInlineHeadScript(element: Element): boolean;
9
+ /**
10
+ * Returns whether a script is queued for rerun after navigation commit.
11
+ */
12
+ export declare function isRerunScript(element: Element): element is HTMLScriptElement;
@@ -0,0 +1,49 @@
1
+ import { getNavigationScriptIdentity } from './identity.js';
2
+ /**
3
+ * Classifies head scripts for navigation-time persistence and execution.
4
+ * @module
5
+ */
6
+ const EXECUTABLE_SCRIPT_TYPES = new Set([
7
+ 'application/javascript',
8
+ 'application/ecmascript',
9
+ 'module',
10
+ 'text/ecmascript',
11
+ 'text/javascript',
12
+ ]);
13
+ /**
14
+ * Returns whether a script tag carries non-executable data (for example JSON-LD).
15
+ */
16
+ export function isNonExecutableHeadScript(element) {
17
+ if (element.tagName !== 'SCRIPT') {
18
+ return false;
19
+ }
20
+ const type = (element.getAttribute('type') ?? '').trim().toLowerCase();
21
+ if (!type) {
22
+ return false;
23
+ }
24
+ return !EXECUTABLE_SCRIPT_TYPES.has(type);
25
+ }
26
+ /**
27
+ * Returns whether an identified inline head script should survive head diffing.
28
+ */
29
+ export function shouldPersistExecutableInlineHeadScript(element) {
30
+ if (element.tagName !== 'SCRIPT') {
31
+ return false;
32
+ }
33
+ if (!getNavigationScriptIdentity(element).scriptId) {
34
+ return false;
35
+ }
36
+ if (element.hasAttribute('data-eco-rerun')) {
37
+ return false;
38
+ }
39
+ if (element.src) {
40
+ return false;
41
+ }
42
+ return !isNonExecutableHeadScript(element);
43
+ }
44
+ /**
45
+ * Returns whether a script is queued for rerun after navigation commit.
46
+ */
47
+ export function isRerunScript(element) {
48
+ return element.tagName === 'SCRIPT' && element.hasAttribute('data-eco-rerun');
49
+ }
@@ -0,0 +1,19 @@
1
+ export type NavigationScriptIdentitySource = Element | {
2
+ scriptId: string | null;
3
+ src: string | null;
4
+ textContent: string;
5
+ };
6
+ export type NavigationScriptIdentity = {
7
+ scriptId: string | null;
8
+ src: string | null;
9
+ textContent: string;
10
+ key: string | null;
11
+ };
12
+ /**
13
+ * Reads the stable identity used to match a navigation script across pages.
14
+ *
15
+ * @remarks
16
+ * Explicit `data-eco-script-id` and `id` take priority, followed by the
17
+ * original script URL and trimmed inline contents.
18
+ */
19
+ export declare function getNavigationScriptIdentity(source: NavigationScriptIdentitySource): NavigationScriptIdentity;
@@ -0,0 +1,26 @@
1
+ import { RERUN_SRC_ATTR } from './registry.js';
2
+ /**
3
+ * Reads the stable identity used to match a navigation script across pages.
4
+ *
5
+ * @remarks
6
+ * Explicit `data-eco-script-id` and `id` take priority, followed by the
7
+ * original script URL and trimmed inline contents.
8
+ */
9
+ export function getNavigationScriptIdentity(source) {
10
+ const isElement = source instanceof Element;
11
+ const scriptId = isElement
12
+ ? source.getAttribute('data-eco-script-id') || source.getAttribute('id')
13
+ : source.scriptId;
14
+ const src = isElement ? source.getAttribute(RERUN_SRC_ATTR) || source.getAttribute('src') : source.src;
15
+ const textContent = isElement ? (source.textContent ?? '') : source.textContent;
16
+ const inlineContent = textContent.trim();
17
+ const resolvedSrc = src ? new URL(src, isElement ? source.ownerDocument.baseURI : document.baseURI).href : null;
18
+ const key = scriptId
19
+ ? `id:${scriptId}`
20
+ : resolvedSrc
21
+ ? `src:${resolvedSrc}`
22
+ : inlineContent
23
+ ? `inline:${inlineContent}`
24
+ : null;
25
+ return { scriptId, src: resolvedSrc, textContent, key };
26
+ }
@@ -0,0 +1,4 @@
1
+ export { isNonExecutableHeadScript, isRerunScript, shouldPersistExecutableInlineHeadScript } from './classification.js';
2
+ export { getNavigationScriptIdentity, type NavigationScriptIdentity } from './identity.js';
3
+ export { RERUN_SRC_ATTR, type RerunScriptCallback } from './registry.js';
4
+ export { collectRerunScripts, toRerunScriptActivation, type PendingRerunScript } from './rerun-queue.js';
@@ -0,0 +1,4 @@
1
+ export { isNonExecutableHeadScript, isRerunScript, shouldPersistExecutableInlineHeadScript } from './classification.js';
2
+ export { getNavigationScriptIdentity } from './identity.js';
3
+ export { RERUN_SRC_ATTR } from './registry.js';
4
+ export { collectRerunScripts, toRerunScriptActivation } from './rerun-queue.js';
@@ -0,0 +1,111 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest';
2
+ import { isNonExecutableHeadScript } from './classification.js';
3
+ import { activateScriptsInOrder } from './activation.js';
4
+ import { collectRerunScripts, toRerunScriptActivation } from './rerun-queue.js';
5
+ import { RERUN_SRC_ATTR } from './registry.js';
6
+ describe('isNonExecutableHeadScript', () => {
7
+ it('treats JSON-LD scripts as non-executable', () => {
8
+ const script = document.createElement('script');
9
+ script.type = 'application/ld+json';
10
+ expect(isNonExecutableHeadScript(script)).toBe(true);
11
+ });
12
+ it('treats untyped scripts as executable', () => {
13
+ const script = document.createElement('script');
14
+ expect(isNonExecutableHeadScript(script)).toBe(false);
15
+ });
16
+ });
17
+ describe('collectRerunScripts and script activations', () => {
18
+ afterEach(() => {
19
+ document.head.replaceChildren();
20
+ document.body.replaceChildren();
21
+ });
22
+ it('replays registered rerun callbacks without duplicating script tags', async () => {
23
+ const callback = vi.fn();
24
+ window.__ECO_PAGES__ = {
25
+ rerunScripts: { 'eco-test': callback },
26
+ };
27
+ try {
28
+ const incoming = new DOMParser().parseFromString('<html><head><script data-eco-rerun data-eco-script-id="eco-test"></script></head><body></body></html>', 'text/html');
29
+ await activateScriptsInOrder(collectRerunScripts(incoming).map(toRerunScriptActivation));
30
+ expect(callback).toHaveBeenCalledOnce();
31
+ expect(document.head.querySelector('script[data-eco-script-id="eco-test"]')).toBeNull();
32
+ }
33
+ finally {
34
+ delete window.__ECO_PAGES__;
35
+ }
36
+ });
37
+ it('cache-busts external module rerun scripts', async () => {
38
+ const html = '<html><head><script data-eco-rerun src="/app.js" type="module"></script></head></html>';
39
+ const parsed = new DOMParser().parseFromString(html, 'text/html');
40
+ const scripts = collectRerunScripts(parsed);
41
+ await activateScriptsInOrder(scripts.map(toRerunScriptActivation));
42
+ const inserted = document.head.querySelector(`script[${RERUN_SRC_ATTR}]`);
43
+ expect(inserted?.getAttribute('src')).not.toBe('/app.js');
44
+ expect(inserted?.getAttribute('src')).toMatch(/__eco_rerun=\d+/);
45
+ expect(inserted?.getAttribute(RERUN_SRC_ATTR)).toBe('/app.js');
46
+ });
47
+ describe('an external module rerun script visited twice', () => {
48
+ const html = '<html><head><script type="module" src="/assets/counter.js" data-eco-rerun data-eco-script-id="counter"></script></head></html>';
49
+ const activateVisit = async () => {
50
+ const incoming = new DOMParser().parseFromString(html, 'text/html');
51
+ await activateScriptsInOrder(collectRerunScripts(incoming).map(toRerunScriptActivation));
52
+ };
53
+ const counterScripts = () => document.head.querySelectorAll('script[src*="/assets/counter.js"]');
54
+ it('runs the registered callback each visit and keeps the first script element as it was', async () => {
55
+ const callback = vi.fn();
56
+ window.__ECO_PAGES__ = {
57
+ rerunScripts: { counter: callback },
58
+ };
59
+ try {
60
+ await activateVisit();
61
+ const firstSrc = counterScripts()[0]?.getAttribute('src');
62
+ await activateVisit();
63
+ expect(callback).toHaveBeenCalledTimes(2);
64
+ expect(counterScripts()).toHaveLength(1);
65
+ expect(counterScripts()[0]?.getAttribute('src')).toBe(firstSrc);
66
+ expect(firstSrc).toBe('/assets/counter.js');
67
+ }
68
+ finally {
69
+ delete window.__ECO_PAGES__;
70
+ }
71
+ });
72
+ it('replaces the script with a fresh URL each visit when no callback is registered for its id', async () => {
73
+ await activateVisit();
74
+ const firstSrc = counterScripts()[0]?.getAttribute('src');
75
+ await activateVisit();
76
+ expect(firstSrc).toMatch(/__eco_rerun=\d+/);
77
+ expect(counterScripts()).toHaveLength(1);
78
+ expect(counterScripts()[0]?.getAttribute('src')).toMatch(/__eco_rerun=\d+/);
79
+ expect(counterScripts()[0]?.getAttribute('src')).not.toBe(firstSrc);
80
+ });
81
+ });
82
+ it('appends a unique nonce on each module rerun url', () => {
83
+ const incoming = new DOMParser().parseFromString('<html><head><script data-eco-rerun src="/app.js" type="module"></script></head></html>', 'text/html');
84
+ const [script] = collectRerunScripts(incoming);
85
+ const first = toRerunScriptActivation(script).attributes;
86
+ const second = toRerunScriptActivation(script).attributes;
87
+ expect(Array.from(first).find(([name]) => name === 'src')?.[1]).not.toBe(Array.from(second).find(([name]) => name === 'src')?.[1]);
88
+ });
89
+ it('replaces rerun scripts by their original relative src across different base urls', () => {
90
+ const liveBase = document.createElement('base');
91
+ liveBase.href = 'https://example.test/static/';
92
+ document.head.appendChild(liveBase);
93
+ const existing = document.createElement('script');
94
+ existing.setAttribute('data-eco-rerun', '');
95
+ existing.setAttribute(RERUN_SRC_ATTR, 'app.js');
96
+ existing.setAttribute('src', 'https://example.test/static/app.js?__eco_rerun=old');
97
+ existing.type = 'module';
98
+ document.head.appendChild(existing);
99
+ const incoming = new DOMParser().parseFromString('<html><head><base href="https://example.test/docs/guide/"><script data-eco-rerun src="app.js" type="module"></script></head></html>', 'text/html');
100
+ const [script] = collectRerunScripts(incoming);
101
+ const activation = toRerunScriptActivation(script);
102
+ const replacement = document.createElement('script');
103
+ for (const [name, value] of activation.attributes)
104
+ replacement.setAttribute(name, value);
105
+ activation.insert(replacement);
106
+ expect(existing.isConnected).toBe(false);
107
+ expect(document.head.querySelectorAll('script[data-eco-rerun]')).toHaveLength(1);
108
+ expect(replacement.getAttribute(RERUN_SRC_ATTR)).toBe('app.js');
109
+ expect(replacement.getAttribute('src')).toMatch(/^https:\/\/example\.test\/docs\/guide\/app\.js\?__eco_rerun=\d+$/);
110
+ });
111
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `__ECO_PAGES__.rerunScripts` registry access for navigation reruns.
3
+ * @module
4
+ */
5
+ export type RerunScriptCallback = () => void;
6
+ /** Attribute storing the original module `src` after cache-busting. */
7
+ export declare const RERUN_SRC_ATTR = "data-eco-rerun-src";
8
+ /**
9
+ * Returns a registered in-memory rerun callback for the given script id.
10
+ */
11
+ declare function getRegisteredRerunScript(scriptId: string | null): RerunScriptCallback | null;
12
+ export { getRegisteredRerunScript };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `__ECO_PAGES__.rerunScripts` registry access for navigation reruns.
3
+ * @module
4
+ */
5
+ /** Attribute storing the original module `src` after cache-busting. */
6
+ export const RERUN_SRC_ATTR = 'data-eco-rerun-src';
7
+ /**
8
+ * Returns a registered in-memory rerun callback for the given script id.
9
+ */
10
+ function getRegisteredRerunScript(scriptId) {
11
+ if (!scriptId) {
12
+ return null;
13
+ }
14
+ const runtimeWindow = window;
15
+ return runtimeWindow.__ECO_PAGES__?.rerunScripts?.[scriptId] ?? null;
16
+ }
17
+ export { getRegisteredRerunScript };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Queueing and replay of `data-eco-rerun` scripts after navigation.
3
+ * @module
4
+ */
5
+ export type PendingRerunScript = {
6
+ parent: 'head' | 'body';
7
+ attributes: Array<[string, string]>;
8
+ textContent: string;
9
+ src: string | null;
10
+ resolvedSrc: string | null;
11
+ scriptId: string | null;
12
+ };
13
+ /**
14
+ * Collects rerun scripts from an incoming document.
15
+ */
16
+ export declare function collectRerunScripts(document: Document, filter?: (script: HTMLScriptElement) => boolean): PendingRerunScript[];
17
+ /**
18
+ * Returns the attributes and text of a fresh element that replays `script`, and how to insert it.
19
+ *
20
+ * @remarks
21
+ * A script with a registered callback runs that callback instead; its element is inserted only
22
+ * when an external module needs one in the document. An external module without a callback gets
23
+ * a fresh URL, so the browser runs it again. Inserted elements keep `data-eco-rerun` so head
24
+ * cleanup does not treat them as persistable inline scripts on the next navigation.
25
+ */
26
+ export declare function toRerunScriptActivation(script: PendingRerunScript): {
27
+ attributes: Array<[string, string]>;
28
+ textContent: string;
29
+ insert(replacement: HTMLScriptElement): void;
30
+ };