@ecopages/core 0.2.0-alpha.24 → 0.2.0-alpha.26

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 (543) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/package.json +226 -93
  3. package/src/adapters/abstract/application-adapter.d.ts +194 -0
  4. package/src/adapters/abstract/application-adapter.js +121 -0
  5. package/src/adapters/abstract/router-adapter.d.ts +26 -0
  6. package/src/adapters/abstract/router-adapter.js +5 -0
  7. package/src/adapters/abstract/server-adapter.d.ts +69 -0
  8. package/src/adapters/abstract/server-adapter.js +15 -0
  9. package/src/adapters/bun/client-bridge.d.ts +34 -0
  10. package/src/adapters/bun/client-bridge.js +48 -0
  11. package/src/adapters/bun/create-app.d.ts +52 -0
  12. package/src/adapters/bun/create-app.js +116 -0
  13. package/src/adapters/bun/hmr-manager.d.ts +143 -0
  14. package/src/adapters/bun/hmr-manager.js +333 -0
  15. package/src/adapters/bun/index.d.ts +2 -0
  16. package/src/adapters/bun/index.js +8 -0
  17. package/src/adapters/bun/server-adapter.d.ts +155 -0
  18. package/src/adapters/bun/server-adapter.js +374 -0
  19. package/src/adapters/bun/server-lifecycle.d.ts +63 -0
  20. package/src/adapters/bun/server-lifecycle.js +92 -0
  21. package/src/adapters/create-app.d.ts +20 -0
  22. package/src/adapters/create-app.js +66 -0
  23. package/src/adapters/index.d.ts +2 -0
  24. package/src/adapters/index.js +8 -0
  25. package/src/adapters/node/create-app.d.ts +18 -0
  26. package/src/adapters/node/create-app.js +149 -0
  27. package/src/adapters/node/node-client-bridge.d.ts +26 -0
  28. package/src/adapters/node/node-client-bridge.js +66 -0
  29. package/src/adapters/node/node-hmr-manager.d.ts +133 -0
  30. package/src/adapters/node/node-hmr-manager.js +311 -0
  31. package/src/adapters/node/server-adapter.d.ts +162 -0
  32. package/src/adapters/node/server-adapter.js +368 -0
  33. package/src/adapters/node/static-content-server.d.ts +60 -0
  34. package/src/adapters/node/static-content-server.js +194 -0
  35. package/src/adapters/shared/api-response.d.ts +52 -0
  36. package/src/adapters/shared/api-response.js +96 -0
  37. package/src/adapters/shared/application-adapter.d.ts +18 -0
  38. package/src/adapters/shared/application-adapter.js +90 -0
  39. package/src/adapters/shared/define-api-handler.d.ts +25 -0
  40. package/src/adapters/shared/define-api-handler.js +15 -0
  41. package/src/adapters/shared/explicit-static-route-matcher.d.ts +38 -0
  42. package/src/adapters/shared/explicit-static-route-matcher.js +103 -0
  43. package/src/adapters/shared/file-route-middleware-pipeline.d.ts +65 -0
  44. package/src/adapters/shared/file-route-middleware-pipeline.js +99 -0
  45. package/src/adapters/shared/fs-server-response-factory.d.ts +19 -0
  46. package/src/adapters/shared/fs-server-response-factory.js +97 -0
  47. package/src/adapters/shared/fs-server-response-matcher.d.ts +67 -0
  48. package/src/adapters/shared/fs-server-response-matcher.js +147 -0
  49. package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +55 -0
  50. package/src/adapters/shared/hmr-entrypoint-registrar.js +87 -0
  51. package/src/adapters/shared/hmr-html-response.d.ts +22 -0
  52. package/src/adapters/shared/hmr-html-response.js +32 -0
  53. package/src/adapters/shared/render-context.d.ts +15 -0
  54. package/src/adapters/shared/render-context.js +72 -0
  55. package/src/adapters/shared/runtime-bootstrap.d.ts +38 -0
  56. package/src/adapters/shared/runtime-bootstrap.js +43 -0
  57. package/src/adapters/shared/server-adapter.d.ts +97 -0
  58. package/src/adapters/shared/server-adapter.js +390 -0
  59. package/src/adapters/shared/server-route-handler.d.ts +89 -0
  60. package/src/adapters/shared/server-route-handler.js +111 -0
  61. package/src/adapters/shared/server-static-builder.d.ts +71 -0
  62. package/src/adapters/shared/server-static-builder.js +100 -0
  63. package/src/build/build-adapter.d.ts +239 -0
  64. package/src/build/build-adapter.js +642 -0
  65. package/src/build/build-manifest.d.ts +27 -0
  66. package/src/build/build-manifest.js +30 -0
  67. package/src/build/build-types.d.ts +57 -0
  68. package/src/build/build-types.js +0 -0
  69. package/src/build/dev-build-coordinator.d.ts +72 -0
  70. package/src/build/dev-build-coordinator.js +154 -0
  71. package/src/build/esbuild-build-adapter.d.ts +78 -0
  72. package/src/build/esbuild-build-adapter.js +505 -0
  73. package/src/build/runtime-build-executor.d.ts +14 -0
  74. package/src/build/runtime-build-executor.js +22 -0
  75. package/src/build/runtime-specifier-alias-plugin.d.ts +15 -0
  76. package/src/build/runtime-specifier-alias-plugin.js +35 -0
  77. package/src/build/runtime-specifier-aliases.d.ts +5 -0
  78. package/src/build/runtime-specifier-aliases.js +95 -0
  79. package/src/config/config-builder.d.ts +252 -0
  80. package/src/config/config-builder.js +603 -0
  81. package/src/config/{constants.ts → constants.d.ts} +13 -22
  82. package/src/config/constants.js +25 -0
  83. package/src/dev/sc-server.d.ts +30 -0
  84. package/src/dev/sc-server.js +111 -0
  85. package/src/eco/eco.browser.d.ts +2 -0
  86. package/src/eco/eco.browser.js +83 -0
  87. package/src/eco/eco.d.ts +9 -0
  88. package/src/eco/eco.js +85 -0
  89. package/src/eco/eco.types.d.ts +178 -0
  90. package/src/eco/eco.types.js +0 -0
  91. package/src/eco/eco.utils.d.ts +1 -0
  92. package/src/eco/eco.utils.js +10 -0
  93. package/src/eco/global-injector-map.d.ts +16 -0
  94. package/src/eco/global-injector-map.js +80 -0
  95. package/src/eco/lazy-injector-map.d.ts +8 -0
  96. package/src/eco/lazy-injector-map.js +70 -0
  97. package/src/eco/module-dependencies.d.ts +18 -0
  98. package/src/eco/module-dependencies.js +49 -0
  99. package/src/errors/http-error.d.ts +31 -0
  100. package/src/errors/http-error.js +50 -0
  101. package/src/errors/{index.ts → index.d.ts} +2 -2
  102. package/src/errors/index.js +4 -0
  103. package/src/errors/locals-access-error.d.ts +4 -0
  104. package/src/errors/locals-access-error.js +9 -0
  105. package/src/global/app-logger.d.ts +2 -0
  106. package/src/global/app-logger.js +6 -0
  107. package/src/hmr/client/hmr-runtime.d.ts +5 -0
  108. package/src/hmr/client/hmr-runtime.js +117 -0
  109. package/src/hmr/hmr-strategy.d.ts +162 -0
  110. package/src/hmr/hmr-strategy.js +44 -0
  111. package/src/hmr/hmr.postcss.test.e2e.d.ts +1 -0
  112. package/src/hmr/hmr.postcss.test.e2e.js +31 -0
  113. package/src/hmr/hmr.test.e2e.d.ts +1 -0
  114. package/src/hmr/hmr.test.e2e.js +43 -0
  115. package/src/hmr/strategies/default-hmr-strategy.d.ts +43 -0
  116. package/src/hmr/strategies/default-hmr-strategy.js +34 -0
  117. package/src/hmr/strategies/js-hmr-strategy.d.ts +139 -0
  118. package/src/hmr/strategies/js-hmr-strategy.js +178 -0
  119. package/src/index.browser.d.ts +3 -0
  120. package/src/index.browser.js +4 -0
  121. package/src/index.d.ts +6 -0
  122. package/src/index.js +21 -0
  123. package/src/integrations/ghtml/ghtml-renderer.d.ts +20 -0
  124. package/src/integrations/ghtml/ghtml-renderer.js +63 -0
  125. package/src/integrations/ghtml/ghtml.constants.d.ts +1 -0
  126. package/src/integrations/ghtml/ghtml.constants.js +4 -0
  127. package/src/integrations/ghtml/ghtml.plugin.d.ts +16 -0
  128. package/src/integrations/ghtml/ghtml.plugin.js +20 -0
  129. package/src/plugins/alias-resolver-plugin.d.ts +2 -0
  130. package/src/plugins/alias-resolver-plugin.js +53 -0
  131. package/src/plugins/eco-component-meta-plugin.d.ts +108 -0
  132. package/src/plugins/eco-component-meta-plugin.js +163 -0
  133. package/src/plugins/foreign-jsx-override-plugin.d.ts +31 -0
  134. package/src/plugins/foreign-jsx-override-plugin.js +35 -0
  135. package/src/plugins/integration-plugin.d.ts +219 -0
  136. package/src/plugins/integration-plugin.js +196 -0
  137. package/src/plugins/processor.d.ts +95 -0
  138. package/src/plugins/processor.js +136 -0
  139. package/src/plugins/{runtime-capability.ts → runtime-capability.d.ts} +3 -8
  140. package/src/plugins/runtime-capability.js +0 -0
  141. package/src/plugins/source-transform.d.ts +46 -0
  142. package/src/plugins/source-transform.js +71 -0
  143. package/src/route-renderer/orchestration/boundary-planning.service.d.ts +25 -0
  144. package/src/route-renderer/orchestration/boundary-planning.service.js +97 -0
  145. package/src/route-renderer/orchestration/component-render-context.d.ts +83 -0
  146. package/src/route-renderer/orchestration/component-render-context.js +147 -0
  147. package/src/route-renderer/orchestration/integration-renderer.d.ts +556 -0
  148. package/src/route-renderer/orchestration/integration-renderer.js +932 -0
  149. package/src/route-renderer/orchestration/page-packaging.service.d.ts +16 -0
  150. package/src/route-renderer/orchestration/page-packaging.service.js +66 -0
  151. package/src/route-renderer/orchestration/processed-asset-dedupe.d.ts +2 -0
  152. package/src/route-renderer/orchestration/processed-asset-dedupe.js +23 -0
  153. package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +89 -0
  154. package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +155 -0
  155. package/src/route-renderer/orchestration/render-execution.service.d.ts +43 -0
  156. package/src/route-renderer/orchestration/render-execution.service.js +106 -0
  157. package/src/route-renderer/orchestration/render-output.utils.d.ts +66 -0
  158. package/src/route-renderer/orchestration/render-output.utils.js +171 -0
  159. package/src/route-renderer/orchestration/render-preparation.service.d.ts +120 -0
  160. package/src/route-renderer/orchestration/render-preparation.service.js +364 -0
  161. package/src/route-renderer/orchestration/route-shell-composer.service.d.ts +50 -0
  162. package/src/route-renderer/orchestration/route-shell-composer.service.js +81 -0
  163. package/src/route-renderer/orchestration/template-serialization.d.ts +38 -0
  164. package/src/route-renderer/orchestration/template-serialization.js +45 -0
  165. package/src/route-renderer/page-loading/component-dependency-collection.d.ts +37 -0
  166. package/src/route-renderer/page-loading/component-dependency-collection.js +125 -0
  167. package/src/route-renderer/page-loading/declared-asset-collection.d.ts +24 -0
  168. package/src/route-renderer/page-loading/declared-asset-collection.js +106 -0
  169. package/src/route-renderer/page-loading/dependency-resolver.d.ts +35 -0
  170. package/src/route-renderer/page-loading/dependency-resolver.js +117 -0
  171. package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +11 -0
  172. package/src/route-renderer/page-loading/ecopages-virtual-imports.js +57 -0
  173. package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +45 -0
  174. package/src/route-renderer/page-loading/lazy-entry-collection.js +105 -0
  175. package/src/route-renderer/page-loading/lazy-trigger-planning.d.ts +19 -0
  176. package/src/route-renderer/page-loading/lazy-trigger-planning.js +40 -0
  177. package/src/route-renderer/page-loading/module-declaration-aggregation.d.ts +5 -0
  178. package/src/route-renderer/page-loading/module-declaration-aggregation.js +33 -0
  179. package/src/route-renderer/page-loading/module-declaration-scripts.d.ts +3 -0
  180. package/src/route-renderer/page-loading/module-declaration-scripts.js +18 -0
  181. package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +13 -0
  182. package/src/route-renderer/page-loading/page-dependency-bundling.js +115 -0
  183. package/src/route-renderer/page-loading/page-module-loader.d.ts +90 -0
  184. package/src/route-renderer/page-loading/page-module-loader.js +127 -0
  185. package/src/route-renderer/route-renderer.d.ts +67 -0
  186. package/src/route-renderer/route-renderer.js +103 -0
  187. package/src/router/client/link-intent.js +34 -0
  188. package/src/router/client/link-intent.test.browser.d.ts +1 -0
  189. package/src/router/client/link-intent.test.browser.js +43 -0
  190. package/src/router/client/navigation-coordinator.d.ts +169 -0
  191. package/src/router/client/navigation-coordinator.js +215 -0
  192. package/src/router/server/fs-router-scanner.d.ts +41 -0
  193. package/src/router/server/fs-router-scanner.js +161 -0
  194. package/src/router/server/fs-router.d.ts +26 -0
  195. package/src/router/server/fs-router.js +100 -0
  196. package/src/services/assets/asset-processing-service/asset-dependency-keys.d.ts +3 -0
  197. package/src/services/assets/asset-processing-service/asset-dependency-keys.js +56 -0
  198. package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +103 -0
  199. package/src/services/assets/asset-processing-service/asset-processing.service.js +285 -0
  200. package/src/services/assets/asset-processing-service/asset.factory.d.ts +17 -0
  201. package/src/services/assets/asset-processing-service/asset.factory.js +82 -0
  202. package/src/services/assets/asset-processing-service/assets.types.d.ts +100 -0
  203. package/src/services/assets/asset-processing-service/assets.types.js +0 -0
  204. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +55 -0
  205. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +49 -0
  206. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +20 -0
  207. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +41 -0
  208. package/src/services/assets/asset-processing-service/grouped-content-bundles.d.ts +30 -0
  209. package/src/services/assets/asset-processing-service/grouped-content-bundles.js +65 -0
  210. package/src/services/assets/asset-processing-service/index.d.ts +5 -0
  211. package/src/services/assets/asset-processing-service/index.js +5 -0
  212. package/src/services/assets/asset-processing-service/{processor.interface.ts → processor.interface.d.ts} +5 -10
  213. package/src/services/assets/asset-processing-service/processor.interface.js +6 -0
  214. package/src/services/assets/asset-processing-service/processor.registry.d.ts +8 -0
  215. package/src/services/assets/asset-processing-service/processor.registry.js +15 -0
  216. package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +24 -0
  217. package/src/services/assets/asset-processing-service/processors/base/base-processor.js +65 -0
  218. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +22 -0
  219. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +136 -0
  220. package/src/services/assets/asset-processing-service/processors/index.d.ts +5 -0
  221. package/src/services/assets/asset-processing-service/processors/index.js +5 -0
  222. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +6 -0
  223. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +116 -0
  224. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +9 -0
  225. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +91 -0
  226. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +7 -0
  227. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +77 -0
  228. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +8 -0
  229. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +58 -0
  230. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +9 -0
  231. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +67 -0
  232. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.d.ts +18 -0
  233. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.js +45 -0
  234. package/src/services/assets/browser-bundle.service.d.ts +73 -0
  235. package/src/services/assets/browser-bundle.service.js +41 -0
  236. package/src/services/cache/cache.types.d.ts +107 -0
  237. package/src/services/cache/cache.types.js +0 -0
  238. package/src/services/cache/index.d.ts +7 -0
  239. package/src/services/cache/index.js +7 -0
  240. package/src/services/cache/memory-cache-store.d.ts +42 -0
  241. package/src/services/cache/memory-cache-store.js +98 -0
  242. package/src/services/cache/page-cache-service.d.ts +70 -0
  243. package/src/services/cache/page-cache-service.js +152 -0
  244. package/src/services/cache/page-request-cache-coordinator.service.d.ts +75 -0
  245. package/src/services/cache/page-request-cache-coordinator.service.js +109 -0
  246. package/src/services/html/html-rewriter-provider.service.d.ts +37 -0
  247. package/src/services/html/html-rewriter-provider.service.js +68 -0
  248. package/src/services/html/html-transformer.service.d.ts +87 -0
  249. package/src/services/html/html-transformer.service.js +216 -0
  250. package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
  251. package/src/services/invalidation/development-invalidation.service.js +190 -0
  252. package/src/services/module-loading/app-module-loader.service.d.ts +7 -0
  253. package/src/services/module-loading/app-module-loader.service.js +0 -0
  254. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +24 -0
  255. package/src/services/module-loading/app-server-module-transpiler.service.js +115 -0
  256. package/src/services/module-loading/host-module-loader-registry.d.ts +4 -0
  257. package/src/services/module-loading/host-module-loader-registry.js +15 -0
  258. package/src/services/module-loading/{module-loading-types.ts → module-loading-types.d.ts} +0 -1
  259. package/src/services/module-loading/module-loading-types.js +0 -0
  260. package/src/services/module-loading/node-bootstrap-plugin.d.ts +42 -0
  261. package/src/services/module-loading/node-bootstrap-plugin.js +204 -0
  262. package/src/services/module-loading/page-module-import.service.d.ts +76 -0
  263. package/src/services/module-loading/page-module-import.service.js +170 -0
  264. package/src/services/module-loading/server-module-transpiler.service.d.ts +63 -0
  265. package/src/services/module-loading/server-module-transpiler.service.js +64 -0
  266. package/src/services/module-loading/source-module-support.d.ts +5 -0
  267. package/src/services/module-loading/source-module-support.js +8 -0
  268. package/src/services/runtime-state/dev-graph.service.d.ts +118 -0
  269. package/src/services/runtime-state/dev-graph.service.js +162 -0
  270. package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +41 -0
  271. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +85 -0
  272. package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +69 -0
  273. package/src/services/runtime-state/runtime-specifier-registry.service.js +37 -0
  274. package/src/services/runtime-state/server-invalidation-state.service.d.ts +26 -0
  275. package/src/services/runtime-state/server-invalidation-state.service.js +35 -0
  276. package/src/services/validation/schema-validation-service.d.ts +122 -0
  277. package/src/services/validation/schema-validation-service.js +101 -0
  278. package/src/services/validation/{standard-schema.types.ts → standard-schema.types.d.ts} +17 -20
  279. package/src/services/validation/standard-schema.types.js +0 -0
  280. package/src/static-site-generator/static-site-generator.d.ts +105 -0
  281. package/src/static-site-generator/static-site-generator.js +349 -0
  282. package/src/types/internal-types.d.ts +231 -0
  283. package/src/types/internal-types.js +0 -0
  284. package/src/types/public-types.d.ts +1257 -0
  285. package/src/types/public-types.js +0 -0
  286. package/src/utils/deep-merge.d.ts +14 -0
  287. package/src/utils/deep-merge.js +32 -0
  288. package/src/utils/hash.d.ts +1 -0
  289. package/src/utils/hash.js +7 -0
  290. package/src/utils/html-escaping.d.ts +7 -0
  291. package/src/utils/html-escaping.js +6 -0
  292. package/src/utils/html.js +4 -0
  293. package/src/utils/invariant.d.ts +5 -0
  294. package/src/utils/invariant.js +11 -0
  295. package/src/utils/locals-utils.d.ts +15 -0
  296. package/src/utils/locals-utils.js +24 -0
  297. package/src/utils/parse-cli-args.d.ts +27 -0
  298. package/src/utils/parse-cli-args.js +62 -0
  299. package/src/utils/path-utils.module.d.ts +5 -0
  300. package/src/utils/path-utils.module.js +14 -0
  301. package/src/utils/resolve-work-dir.d.ts +11 -0
  302. package/src/utils/resolve-work-dir.js +31 -0
  303. package/src/utils/runtime.d.ts +11 -0
  304. package/src/utils/runtime.js +40 -0
  305. package/src/utils/server-utils.module.d.ts +19 -0
  306. package/src/utils/server-utils.module.js +56 -0
  307. package/src/watchers/project-watcher.d.ts +136 -0
  308. package/src/watchers/project-watcher.js +275 -0
  309. package/src/watchers/project-watcher.test-helpers.d.ts +4 -0
  310. package/src/watchers/project-watcher.test-helpers.js +52 -0
  311. package/src/adapters/abstract/application-adapter.test.ts +0 -172
  312. package/src/adapters/abstract/application-adapter.ts +0 -379
  313. package/src/adapters/abstract/router-adapter.ts +0 -30
  314. package/src/adapters/abstract/server-adapter.ts +0 -79
  315. package/src/adapters/bun/client-bridge.ts +0 -62
  316. package/src/adapters/bun/create-app.ts +0 -180
  317. package/src/adapters/bun/hmr-manager.test.ts +0 -267
  318. package/src/adapters/bun/hmr-manager.ts +0 -406
  319. package/src/adapters/bun/index.ts +0 -2
  320. package/src/adapters/bun/server-adapter.ts +0 -500
  321. package/src/adapters/bun/server-lifecycle.ts +0 -124
  322. package/src/adapters/create-app.test.ts +0 -10
  323. package/src/adapters/create-app.ts +0 -91
  324. package/src/adapters/index.ts +0 -2
  325. package/src/adapters/node/create-app.test.ts +0 -53
  326. package/src/adapters/node/create-app.ts +0 -183
  327. package/src/adapters/node/node-client-bridge.test.ts +0 -198
  328. package/src/adapters/node/node-client-bridge.ts +0 -79
  329. package/src/adapters/node/node-hmr-manager.test.ts +0 -322
  330. package/src/adapters/node/node-hmr-manager.ts +0 -378
  331. package/src/adapters/node/server-adapter.ts +0 -502
  332. package/src/adapters/node/static-content-server.test.ts +0 -60
  333. package/src/adapters/node/static-content-server.ts +0 -239
  334. package/src/adapters/shared/api-response.test.ts +0 -97
  335. package/src/adapters/shared/api-response.ts +0 -104
  336. package/src/adapters/shared/application-adapter.ts +0 -199
  337. package/src/adapters/shared/define-api-handler.ts +0 -66
  338. package/src/adapters/shared/explicit-static-route-matcher.test.ts +0 -381
  339. package/src/adapters/shared/explicit-static-route-matcher.ts +0 -140
  340. package/src/adapters/shared/file-route-middleware-pipeline.test.ts +0 -90
  341. package/src/adapters/shared/file-route-middleware-pipeline.ts +0 -127
  342. package/src/adapters/shared/fs-server-response-factory.test.ts +0 -187
  343. package/src/adapters/shared/fs-server-response-factory.ts +0 -118
  344. package/src/adapters/shared/fs-server-response-matcher.test.ts +0 -285
  345. package/src/adapters/shared/fs-server-response-matcher.ts +0 -189
  346. package/src/adapters/shared/hmr-entrypoint-registrar.ts +0 -149
  347. package/src/adapters/shared/hmr-html-response.ts +0 -52
  348. package/src/adapters/shared/hmr-manager.contract.test.ts +0 -232
  349. package/src/adapters/shared/hmr-manager.dispatch.test.ts +0 -220
  350. package/src/adapters/shared/render-context.test.ts +0 -150
  351. package/src/adapters/shared/render-context.ts +0 -123
  352. package/src/adapters/shared/runtime-bootstrap.ts +0 -79
  353. package/src/adapters/shared/server-adapter.test.ts +0 -77
  354. package/src/adapters/shared/server-adapter.ts +0 -493
  355. package/src/adapters/shared/server-route-handler.test.ts +0 -110
  356. package/src/adapters/shared/server-route-handler.ts +0 -153
  357. package/src/adapters/shared/server-static-builder.test.ts +0 -338
  358. package/src/adapters/shared/server-static-builder.ts +0 -170
  359. package/src/build/build-adapter-serialization.test.ts +0 -281
  360. package/src/build/build-adapter.test.ts +0 -1240
  361. package/src/build/build-adapter.ts +0 -1012
  362. package/src/build/build-manifest.ts +0 -54
  363. package/src/build/build-types.ts +0 -83
  364. package/src/build/dev-build-coordinator.ts +0 -220
  365. package/src/build/esbuild-build-adapter.ts +0 -660
  366. package/src/build/runtime-build-executor.test.ts +0 -81
  367. package/src/build/runtime-build-executor.ts +0 -40
  368. package/src/build/runtime-specifier-alias-plugin.test.ts +0 -67
  369. package/src/build/runtime-specifier-alias-plugin.ts +0 -62
  370. package/src/build/runtime-specifier-aliases.ts +0 -135
  371. package/src/config/config-builder.test.ts +0 -443
  372. package/src/config/config-builder.ts +0 -742
  373. package/src/config/config-builder.typecheck.test.ts +0 -96
  374. package/src/dev/sc-server.ts +0 -143
  375. package/src/eco/eco.browser.test.ts +0 -43
  376. package/src/eco/eco.browser.ts +0 -118
  377. package/src/eco/eco.test.ts +0 -654
  378. package/src/eco/eco.ts +0 -205
  379. package/src/eco/eco.types.ts +0 -221
  380. package/src/eco/eco.utils.test.ts +0 -219
  381. package/src/eco/eco.utils.ts +0 -5
  382. package/src/eco/global-injector-map.test.ts +0 -42
  383. package/src/eco/global-injector-map.ts +0 -112
  384. package/src/eco/lazy-injector-map.test.ts +0 -66
  385. package/src/eco/lazy-injector-map.ts +0 -120
  386. package/src/eco/module-dependencies.test.ts +0 -30
  387. package/src/eco/module-dependencies.ts +0 -75
  388. package/src/errors/http-error.test.ts +0 -134
  389. package/src/errors/http-error.ts +0 -72
  390. package/src/errors/locals-access-error.ts +0 -7
  391. package/src/global/app-logger.ts +0 -4
  392. package/src/global/utils.test.ts +0 -12
  393. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-have-HMR-script-injected-in-page-1.png +0 -0
  394. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-load-fixture-app-page-1.png +0 -0
  395. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-WebSocket-Connection-should-connect-to-correct-HMR-endpoint-1.png +0 -0
  396. package/src/hmr/client/hmr-runtime.ts +0 -160
  397. package/src/hmr/hmr-strategy.test.ts +0 -124
  398. package/src/hmr/hmr-strategy.ts +0 -177
  399. package/src/hmr/hmr.postcss.test.e2e.ts +0 -41
  400. package/src/hmr/hmr.test.e2e.ts +0 -66
  401. package/src/hmr/strategies/default-hmr-strategy.ts +0 -60
  402. package/src/hmr/strategies/js-hmr-strategy.test.ts +0 -335
  403. package/src/hmr/strategies/js-hmr-strategy.ts +0 -320
  404. package/src/index.browser.ts +0 -3
  405. package/src/index.ts +0 -15
  406. package/src/integrations/ghtml/ghtml-renderer.test.ts +0 -253
  407. package/src/integrations/ghtml/ghtml-renderer.ts +0 -97
  408. package/src/integrations/ghtml/ghtml.constants.ts +0 -1
  409. package/src/integrations/ghtml/ghtml.plugin.ts +0 -28
  410. package/src/plugins/alias-resolver-plugin.test.ts +0 -41
  411. package/src/plugins/alias-resolver-plugin.ts +0 -63
  412. package/src/plugins/eco-component-meta-plugin.test.ts +0 -406
  413. package/src/plugins/eco-component-meta-plugin.ts +0 -495
  414. package/src/plugins/foreign-jsx-override-plugin.test.ts +0 -65
  415. package/src/plugins/foreign-jsx-override-plugin.ts +0 -67
  416. package/src/plugins/integration-plugin.test.ts +0 -156
  417. package/src/plugins/integration-plugin.ts +0 -311
  418. package/src/plugins/processor.test.ts +0 -148
  419. package/src/plugins/processor.ts +0 -240
  420. package/src/plugins/source-transform.test.ts +0 -82
  421. package/src/plugins/source-transform.ts +0 -123
  422. package/src/route-renderer/orchestration/boundary-planning.service.ts +0 -146
  423. package/src/route-renderer/orchestration/component-render-context.ts +0 -318
  424. package/src/route-renderer/orchestration/integration-renderer.test.ts +0 -2088
  425. package/src/route-renderer/orchestration/integration-renderer.ts +0 -1285
  426. package/src/route-renderer/orchestration/page-packaging.service.test.ts +0 -76
  427. package/src/route-renderer/orchestration/page-packaging.service.ts +0 -85
  428. package/src/route-renderer/orchestration/processed-asset-dedupe.ts +0 -25
  429. package/src/route-renderer/orchestration/queued-boundary-runtime.service.test.ts +0 -319
  430. package/src/route-renderer/orchestration/queued-boundary-runtime.service.ts +0 -289
  431. package/src/route-renderer/orchestration/render-execution.service.test.ts +0 -196
  432. package/src/route-renderer/orchestration/render-execution.service.ts +0 -182
  433. package/src/route-renderer/orchestration/render-output.utils.ts +0 -302
  434. package/src/route-renderer/orchestration/render-preparation.service.test.ts +0 -569
  435. package/src/route-renderer/orchestration/render-preparation.service.ts +0 -508
  436. package/src/route-renderer/orchestration/route-shell-composer.service.ts +0 -162
  437. package/src/route-renderer/orchestration/template-serialization.test.ts +0 -110
  438. package/src/route-renderer/orchestration/template-serialization.ts +0 -117
  439. package/src/route-renderer/page-loading/component-dependency-collection.ts +0 -196
  440. package/src/route-renderer/page-loading/declared-asset-collection.ts +0 -156
  441. package/src/route-renderer/page-loading/dependency-resolver.test.ts +0 -665
  442. package/src/route-renderer/page-loading/dependency-resolver.ts +0 -150
  443. package/src/route-renderer/page-loading/ecopages-virtual-imports.ts +0 -75
  444. package/src/route-renderer/page-loading/lazy-entry-collection.ts +0 -167
  445. package/src/route-renderer/page-loading/lazy-trigger-planning.ts +0 -74
  446. package/src/route-renderer/page-loading/module-declaration-aggregation.ts +0 -60
  447. package/src/route-renderer/page-loading/module-declaration-scripts.ts +0 -16
  448. package/src/route-renderer/page-loading/page-dependency-bundling.ts +0 -205
  449. package/src/route-renderer/page-loading/page-module-loader.test.ts +0 -183
  450. package/src/route-renderer/page-loading/page-module-loader.ts +0 -184
  451. package/src/route-renderer/route-renderer.ts +0 -136
  452. package/src/router/client/link-intent.test.browser.ts +0 -51
  453. package/src/router/client/link-intent.ts +0 -92
  454. package/src/router/client/navigation-coordinator.test.ts +0 -237
  455. package/src/router/client/navigation-coordinator.ts +0 -453
  456. package/src/router/server/fs-router-scanner.test.ts +0 -83
  457. package/src/router/server/fs-router-scanner.ts +0 -224
  458. package/src/router/server/fs-router.test.ts +0 -214
  459. package/src/router/server/fs-router.ts +0 -122
  460. package/src/services/assets/asset-processing-service/asset-dependency-keys.ts +0 -66
  461. package/src/services/assets/asset-processing-service/asset-processing.service.test.ts +0 -476
  462. package/src/services/assets/asset-processing-service/asset-processing.service.ts +0 -345
  463. package/src/services/assets/asset-processing-service/asset.factory.test.ts +0 -63
  464. package/src/services/assets/asset-processing-service/asset.factory.ts +0 -105
  465. package/src/services/assets/asset-processing-service/assets.types.ts +0 -125
  466. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.test.ts +0 -74
  467. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.ts +0 -96
  468. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.test.ts +0 -67
  469. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.ts +0 -78
  470. package/src/services/assets/asset-processing-service/grouped-content-bundles.ts +0 -104
  471. package/src/services/assets/asset-processing-service/index.ts +0 -5
  472. package/src/services/assets/asset-processing-service/processor.registry.ts +0 -18
  473. package/src/services/assets/asset-processing-service/processors/base/base-processor.test.ts +0 -59
  474. package/src/services/assets/asset-processing-service/processors/base/base-processor.ts +0 -83
  475. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.ts +0 -174
  476. package/src/services/assets/asset-processing-service/processors/index.ts +0 -5
  477. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.test.ts +0 -192
  478. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.ts +0 -134
  479. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.test.ts +0 -326
  480. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.ts +0 -110
  481. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.test.ts +0 -227
  482. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.ts +0 -87
  483. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.test.ts +0 -261
  484. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.ts +0 -71
  485. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.ts +0 -81
  486. package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.ts +0 -65
  487. package/src/services/assets/browser-bundle.service.test.ts +0 -66
  488. package/src/services/assets/browser-bundle.service.ts +0 -109
  489. package/src/services/cache/cache.types.ts +0 -126
  490. package/src/services/cache/index.ts +0 -18
  491. package/src/services/cache/memory-cache-store.test.ts +0 -225
  492. package/src/services/cache/memory-cache-store.ts +0 -130
  493. package/src/services/cache/page-cache-service.test.ts +0 -175
  494. package/src/services/cache/page-cache-service.ts +0 -202
  495. package/src/services/cache/page-request-cache-coordinator.service.test.ts +0 -79
  496. package/src/services/cache/page-request-cache-coordinator.service.ts +0 -131
  497. package/src/services/html/html-rewriter-provider.service.test.ts +0 -183
  498. package/src/services/html/html-rewriter-provider.service.ts +0 -104
  499. package/src/services/html/html-transformer.service.test.ts +0 -479
  500. package/src/services/html/html-transformer.service.ts +0 -275
  501. package/src/services/invalidation/development-invalidation.service.test.ts +0 -87
  502. package/src/services/invalidation/development-invalidation.service.ts +0 -262
  503. package/src/services/module-loading/app-module-loader.service.ts +0 -9
  504. package/src/services/module-loading/app-server-module-transpiler.service.test.ts +0 -130
  505. package/src/services/module-loading/app-server-module-transpiler.service.ts +0 -143
  506. package/src/services/module-loading/host-module-loader-registry.ts +0 -15
  507. package/src/services/module-loading/node-bootstrap-plugin.test.ts +0 -335
  508. package/src/services/module-loading/node-bootstrap-plugin.ts +0 -297
  509. package/src/services/module-loading/page-module-import.service.test.ts +0 -504
  510. package/src/services/module-loading/page-module-import.service.ts +0 -252
  511. package/src/services/module-loading/server-module-transpiler.service.test.ts +0 -243
  512. package/src/services/module-loading/server-module-transpiler.service.ts +0 -104
  513. package/src/services/module-loading/source-module-support.ts +0 -19
  514. package/src/services/runtime-state/dev-graph.service.ts +0 -217
  515. package/src/services/runtime-state/entrypoint-dependency-graph.service.ts +0 -136
  516. package/src/services/runtime-state/runtime-specifier-registry.service.ts +0 -96
  517. package/src/services/runtime-state/server-invalidation-state.service.ts +0 -68
  518. package/src/services/validation/schema-validation-service.test.ts +0 -223
  519. package/src/services/validation/schema-validation-service.ts +0 -204
  520. package/src/static-site-generator/static-site-generator.test.ts +0 -316
  521. package/src/static-site-generator/static-site-generator.ts +0 -462
  522. package/src/types/internal-types.ts +0 -242
  523. package/src/types/public-types.ts +0 -1443
  524. package/src/utils/deep-merge.test.ts +0 -114
  525. package/src/utils/deep-merge.ts +0 -47
  526. package/src/utils/hash.ts +0 -5
  527. package/src/utils/html-escaping.ts +0 -9
  528. package/src/utils/invariant.test.ts +0 -22
  529. package/src/utils/invariant.ts +0 -15
  530. package/src/utils/locals-utils.ts +0 -37
  531. package/src/utils/parse-cli-args.test.ts +0 -69
  532. package/src/utils/parse-cli-args.ts +0 -105
  533. package/src/utils/path-utils.module.ts +0 -14
  534. package/src/utils/path-utils.test.ts +0 -15
  535. package/src/utils/resolve-work-dir.ts +0 -45
  536. package/src/utils/runtime.ts +0 -44
  537. package/src/utils/server-utils.module.ts +0 -67
  538. package/src/utils/server-utils.test.ts +0 -38
  539. package/src/watchers/project-watcher.integration.test.ts +0 -337
  540. package/src/watchers/project-watcher.test-helpers.ts +0 -41
  541. package/src/watchers/project-watcher.test.ts +0 -768
  542. package/src/watchers/project-watcher.ts +0 -357
  543. /package/src/utils/{html.ts → html.d.ts} +0 -0
@@ -0,0 +1,196 @@
1
+ import { AssetProcessingService } from "../services/assets/asset-processing-service/asset-processing.service.js";
2
+ const INTEGRATION_PLUGIN_ERRORS = {
3
+ NOT_INITIALIZED_WITH_APP_CONFIG: "Plugin not initialized with app config",
4
+ NOT_INITIALIZED_WITH_ASSET_SERVICE: "Plugin not initialized with asset dependency service"
5
+ };
6
+ class IntegrationPlugin {
7
+ name;
8
+ extensions;
9
+ staticBuildStep;
10
+ runtimeCapability;
11
+ jsxImportSource;
12
+ integrationDependencies;
13
+ resolvedIntegrationDependencies = [];
14
+ options;
15
+ appConfig;
16
+ assetProcessingService;
17
+ hmrManager;
18
+ get plugins() {
19
+ return [];
20
+ }
21
+ /**
22
+ * Returns build plugins that should only apply to browser-oriented bundles.
23
+ *
24
+ * @remarks
25
+ * Browser-only transforms such as runtime import aliasing belong here so they
26
+ * do not affect server bundles or static-page module generation.
27
+ */
28
+ get browserBuildPlugins() {
29
+ return [];
30
+ }
31
+ /**
32
+ * Creates the integration with static declaration-only configuration.
33
+ *
34
+ * @remarks
35
+ * Constructors are expected to stay side-effect free. Build-manifest
36
+ * contributions belong in `prepareBuildContributions()` and runtime-only setup
37
+ * belongs in `setup()`.
38
+ */
39
+ constructor(config) {
40
+ this.name = config.name;
41
+ this.extensions = config.extensions;
42
+ this.integrationDependencies = config.integrationDependencies || [];
43
+ this.staticBuildStep = config.staticBuildStep || "render";
44
+ this.runtimeCapability = config.runtimeCapability;
45
+ this.jsxImportSource = config.jsxImportSource;
46
+ }
47
+ /**
48
+ * Attaches the finalized app config to the integration.
49
+ *
50
+ * Core calls this during config finalization before runtime setup so the
51
+ * integration can resolve asset paths and other app-owned services later.
52
+ */
53
+ setConfig(appConfig) {
54
+ this.appConfig = appConfig;
55
+ this.initializeAssetDefinitionService();
56
+ }
57
+ /**
58
+ * Records the runtime origin used for page-module loading and renderer setup.
59
+ */
60
+ setRuntimeOrigin(runtimeOrigin) {
61
+ this.runtimeOrigin = runtimeOrigin;
62
+ }
63
+ /**
64
+ * Returns bare-specifier mappings that should be registered in the active
65
+ * runtime specifier registry.
66
+ *
67
+ * @remarks
68
+ * Integrations that own browser runtime bundles can override this to expose
69
+ * stable bare specifiers for client-side imports.
70
+ *
71
+ * Today these mappings are consumed by the development runtime and browser
72
+ * bundle aliasing path. They are intentionally generic enough to grow into a
73
+ * broader import-map-style facility later without moving framework-specific
74
+ * map contents into core.
75
+ */
76
+ getRuntimeSpecifierMap() {
77
+ return {};
78
+ }
79
+ /**
80
+ * Attaches the shared HMR manager and registers integration-owned development hooks.
81
+ *
82
+ * @remarks
83
+ * The default implementation registers both runtime bare-specifier mappings and
84
+ * the optional integration HMR strategy. Integrations should override this only
85
+ * when they need to extend that shared behavior rather than replace it.
86
+ */
87
+ setHmrManager(hmrManager) {
88
+ this.hmrManager = hmrManager;
89
+ hmrManager.registerSpecifierMap(this.getRuntimeSpecifierMap());
90
+ const strategy = this.getHmrStrategy?.();
91
+ if (strategy) {
92
+ hmrManager.registerStrategy(strategy);
93
+ }
94
+ if (this.assetProcessingService) {
95
+ this.assetProcessingService.setHmrManager(hmrManager);
96
+ }
97
+ }
98
+ /**
99
+ * Creates the asset-processing service used for global integration dependencies.
100
+ */
101
+ initializeAssetDefinitionService() {
102
+ if (!this.appConfig) throw new Error(INTEGRATION_PLUGIN_ERRORS.NOT_INITIALIZED_WITH_APP_CONFIG);
103
+ this.assetProcessingService = AssetProcessingService.createWithDefaultProcessors(this.appConfig);
104
+ if (this.hmrManager) {
105
+ this.assetProcessingService.setHmrManager(this.hmrManager);
106
+ }
107
+ }
108
+ /**
109
+ * Returns processed global assets resolved during `setup()`.
110
+ */
111
+ getResolvedIntegrationDependencies() {
112
+ return this.resolvedIntegrationDependencies;
113
+ }
114
+ /**
115
+ * Creates the shared renderer options owned by core lifecycle setup.
116
+ */
117
+ createRendererOptions(options) {
118
+ if (!this.appConfig) {
119
+ throw new Error(INTEGRATION_PLUGIN_ERRORS.NOT_INITIALIZED_WITH_APP_CONFIG);
120
+ }
121
+ const assetProcessingService = AssetProcessingService.createWithDefaultProcessors(this.appConfig);
122
+ if (this.hmrManager) {
123
+ assetProcessingService.setHmrManager(this.hmrManager);
124
+ }
125
+ return {
126
+ appConfig: this.appConfig,
127
+ assetProcessingService,
128
+ resolvedIntegrationDependencies: this.resolvedIntegrationDependencies,
129
+ rendererModules: options?.rendererModules,
130
+ runtimeOrigin: this.runtimeOrigin
131
+ };
132
+ }
133
+ /**
134
+ * Attaches runtime-only services after a renderer instance has been created.
135
+ */
136
+ attachRendererRuntimeServices(renderer) {
137
+ if (typeof renderer.name !== "string" || renderer.name.length === 0) {
138
+ renderer.name = this.name;
139
+ }
140
+ if (this.hmrManager) {
141
+ renderer.setHmrManager(this.hmrManager);
142
+ }
143
+ return renderer;
144
+ }
145
+ /**
146
+ * Instantiates the integration renderer with app-owned services.
147
+ *
148
+ * @remarks
149
+ * Renderers are cheap runtime objects. They receive the finalized app config,
150
+ * a fresh asset-processing service, integration-global processed assets, and
151
+ * any renderer module context supplied by the active runtime.
152
+ renderer.name ||= this.name;
153
+ */
154
+ initializeRenderer(options) {
155
+ const renderer = new this.renderer(this.createRendererOptions(options));
156
+ renderer.name ||= this.name;
157
+ return this.attachRendererRuntimeServices(renderer);
158
+ }
159
+ /**
160
+ * Prepares build-facing contributions before the app build manifest is sealed.
161
+ *
162
+ * @remarks
163
+ * Integrations can override this when runtime or build plugin declarations must
164
+ * be materialized ahead of runtime startup. Runtime-only side effects stay in
165
+ * `setup()`.
166
+ */
167
+ async prepareBuildContributions() {
168
+ }
169
+ /**
170
+ * Performs runtime-only integration setup after config build has already
171
+ * sealed manifest contributions.
172
+ */
173
+ async setup() {
174
+ if (this.integrationDependencies.length === 0) return;
175
+ if (!this.assetProcessingService) throw new Error(INTEGRATION_PLUGIN_ERRORS.NOT_INITIALIZED_WITH_ASSET_SERVICE);
176
+ this.resolvedIntegrationDependencies = await this.assetProcessingService.processDependencies(
177
+ this.integrationDependencies,
178
+ this.name
179
+ );
180
+ this.initializeRenderer();
181
+ }
182
+ /**
183
+ * Releases runtime resources owned by the integration.
184
+ *
185
+ * @remarks
186
+ * Most integrations do not need custom teardown. Override this only for
187
+ * explicit cleanup such as watchers, compiler handles, or runtime registries
188
+ * that outlive individual requests.
189
+ */
190
+ async teardown() {
191
+ }
192
+ }
193
+ export {
194
+ INTEGRATION_PLUGIN_ERRORS,
195
+ IntegrationPlugin
196
+ };
@@ -0,0 +1,95 @@
1
+ import type { EcoBuildPlugin } from '../build/build-types.js';
2
+ import type { EcoPagesAppConfig, IClientBridge } from '../types/internal-types.js';
3
+ import type { AssetDefinition } from '../services/assets/asset-processing-service/assets.types.js';
4
+ import type { RuntimeCapabilityDeclaration } from './runtime-capability.js';
5
+ export type { RuntimeCapabilityDeclaration, RuntimeCapabilityTag } from './runtime-capability.js';
6
+ export declare const PROCESSOR_ERRORS: {
7
+ readonly CACHE_DIRECTORY_NOT_SET: "Cache directory not set in context";
8
+ };
9
+ export interface ProcessorWatchContext {
10
+ path: string;
11
+ bridge: IClientBridge;
12
+ }
13
+ export interface ProcessorWatchConfig {
14
+ paths: string[];
15
+ extensions?: string[];
16
+ onCreate?: (ctx: ProcessorWatchContext) => Promise<void>;
17
+ onChange?: (ctx: ProcessorWatchContext) => Promise<void>;
18
+ onDelete?: (ctx: ProcessorWatchContext) => Promise<void>;
19
+ onError?: (error: Error) => void;
20
+ }
21
+ export type ProcessorAssetKind = 'script' | 'stylesheet' | 'image';
22
+ export type ProcessorExtensionPattern = string;
23
+ export interface ProcessorAssetCapability {
24
+ kind: ProcessorAssetKind;
25
+ /**
26
+ * Supported patterns:
27
+ * - `*` (all extensions)
28
+ * - `.css` or `css`
29
+ * - `*.css`
30
+ * - `*.{css,scss,sass}`
31
+ *
32
+ * Pattern matching is case-insensitive and trims surrounding spaces,
33
+ * including grouped values (e.g. `*.{ CSS, ScSs }`).
34
+ */
35
+ extensions?: ProcessorExtensionPattern[];
36
+ }
37
+ export interface ProcessorConfig<TOptions = Record<string, unknown>> {
38
+ name: string;
39
+ description?: string;
40
+ options?: TOptions;
41
+ watch?: ProcessorWatchConfig;
42
+ capabilities?: ProcessorAssetCapability[];
43
+ runtimeCapability?: RuntimeCapabilityDeclaration;
44
+ }
45
+ export interface ProcessorContext {
46
+ config: EcoPagesAppConfig;
47
+ rootDir: string;
48
+ srcDir: string;
49
+ distDir: string;
50
+ cache?: string;
51
+ }
52
+ /**
53
+ * Interface for processor build plugins
54
+ * This is used to pass plugins to the build process directly from the processor
55
+ * For instance it can become very handy when dealing with virtual modules that needs to be recognized by the bundler
56
+ * i.e. @ecopages/image-processor
57
+ */
58
+ export declare abstract class Processor<TOptions = Record<string, unknown>> {
59
+ readonly name: string;
60
+ protected dependencies: AssetDefinition[];
61
+ protected context?: ProcessorContext;
62
+ protected options?: TOptions;
63
+ protected watchConfig?: ProcessorWatchConfig;
64
+ protected capabilities: ProcessorAssetCapability[];
65
+ readonly runtimeCapability?: RuntimeCapabilityDeclaration;
66
+ /** Plugins that are only used during the build process */
67
+ abstract buildPlugins?: EcoBuildPlugin[];
68
+ /** Plugins that are used during runtime for file processing */
69
+ abstract plugins?: EcoBuildPlugin[];
70
+ constructor(config: ProcessorConfig<TOptions>);
71
+ setContext(appConfig: EcoPagesAppConfig): void;
72
+ /**
73
+ * Prepares build-facing processor contributions before config finalization.
74
+ *
75
+ * @remarks
76
+ * Override this when a processor must compute runtime/build plugins or other
77
+ * manifest-owned state before startup. Runtime-only work such as cache
78
+ * warming or watcher registration should stay in `setup()`.
79
+ */
80
+ prepareBuildContributions(): Promise<void>;
81
+ abstract setup(): Promise<void>;
82
+ abstract teardown(): Promise<void>;
83
+ abstract process(input: unknown, filePath?: string): Promise<unknown>;
84
+ protected getCachePath(key: string): string;
85
+ protected readCache<T>(key: string): Promise<T | null>;
86
+ protected writeCache<T>(key: string, data: T): Promise<void>;
87
+ getWatchConfig(): ProcessorWatchConfig | undefined;
88
+ getDependencies(): AssetDefinition[];
89
+ getName(): string;
90
+ getAssetCapabilities(): ProcessorAssetCapability[];
91
+ matchesFileFilter(_filepath: string): boolean;
92
+ canProcessAsset(kind: ProcessorAssetKind, filepath?: string): boolean;
93
+ private matchesCapabilityExtensions;
94
+ private normalizeExtensionPattern;
95
+ }
@@ -0,0 +1,136 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { DEFAULT_ECOPAGES_WORK_DIR } from "../config/constants.js";
4
+ import { GENERATED_BASE_PATHS } from "../config/constants.js";
5
+ const PROCESSOR_ERRORS = {
6
+ CACHE_DIRECTORY_NOT_SET: "Cache directory not set in context"
7
+ };
8
+ function resolveGeneratedPath(type, options) {
9
+ const { root, module, subPath } = options;
10
+ const parts = [root, GENERATED_BASE_PATHS[type], module, subPath].filter(Boolean);
11
+ return path.join(...parts);
12
+ }
13
+ class Processor {
14
+ name;
15
+ dependencies = [];
16
+ context;
17
+ options;
18
+ watchConfig;
19
+ capabilities = [];
20
+ runtimeCapability;
21
+ constructor(config) {
22
+ this.name = config.name;
23
+ this.options = config.options;
24
+ this.watchConfig = config.watch;
25
+ this.capabilities = config.capabilities ?? [];
26
+ this.runtimeCapability = config.runtimeCapability;
27
+ }
28
+ setContext(appConfig) {
29
+ const workDir = appConfig.absolutePaths.workDir ?? path.join(appConfig.rootDir, appConfig.workDir ?? DEFAULT_ECOPAGES_WORK_DIR);
30
+ const cachePath = resolveGeneratedPath("cache", {
31
+ root: workDir,
32
+ module: this.name
33
+ });
34
+ fileSystem.ensureDir(cachePath);
35
+ this.context = {
36
+ config: appConfig,
37
+ rootDir: appConfig.rootDir,
38
+ srcDir: appConfig.absolutePaths.srcDir,
39
+ distDir: appConfig.absolutePaths.distDir,
40
+ cache: cachePath
41
+ };
42
+ }
43
+ /**
44
+ * Prepares build-facing processor contributions before config finalization.
45
+ *
46
+ * @remarks
47
+ * Override this when a processor must compute runtime/build plugins or other
48
+ * manifest-owned state before startup. Runtime-only work such as cache
49
+ * warming or watcher registration should stay in `setup()`.
50
+ */
51
+ async prepareBuildContributions() {
52
+ }
53
+ getCachePath(key) {
54
+ return `${this.context?.cache}/${key}`;
55
+ }
56
+ async readCache(key) {
57
+ const cachePath = this.getCachePath(key);
58
+ try {
59
+ const data = await fileSystem.readFile(cachePath);
60
+ return JSON.parse(data);
61
+ } catch {
62
+ return null;
63
+ }
64
+ }
65
+ async writeCache(key, data) {
66
+ if (!this.context?.cache) {
67
+ throw new Error(PROCESSOR_ERRORS.CACHE_DIRECTORY_NOT_SET);
68
+ }
69
+ const cachePath = this.getCachePath(key);
70
+ fileSystem.write(cachePath, JSON.stringify(data, null, 2));
71
+ }
72
+ getWatchConfig() {
73
+ return this.watchConfig;
74
+ }
75
+ getDependencies() {
76
+ return this.dependencies;
77
+ }
78
+ getName() {
79
+ return this.name;
80
+ }
81
+ getAssetCapabilities() {
82
+ return this.capabilities;
83
+ }
84
+ matchesFileFilter(_filepath) {
85
+ return true;
86
+ }
87
+ canProcessAsset(kind, filepath) {
88
+ const capabilities = this.getAssetCapabilities();
89
+ if (capabilities.length === 0) {
90
+ return false;
91
+ }
92
+ const matchingKind = capabilities.filter((capability) => capability.kind === kind);
93
+ if (matchingKind.length === 0) {
94
+ return false;
95
+ }
96
+ if (!filepath) {
97
+ return true;
98
+ }
99
+ return matchingKind.some((capability) => this.matchesCapabilityExtensions(filepath, capability.extensions));
100
+ }
101
+ matchesCapabilityExtensions(filepath, extensions) {
102
+ if (!extensions || extensions.length === 0) {
103
+ return true;
104
+ }
105
+ const normalizedExt = path.extname(filepath).toLowerCase();
106
+ return extensions.some((rawPattern) => {
107
+ const pattern = this.normalizeExtensionPattern(rawPattern);
108
+ if (!pattern) {
109
+ return false;
110
+ }
111
+ if (pattern === "*") {
112
+ return true;
113
+ }
114
+ const groupedMatch = pattern.match(/^\*\.\{(.+)\}$/);
115
+ if (groupedMatch) {
116
+ const groupItems = groupedMatch[1].split(",").map((item) => this.normalizeExtensionPattern(item)).filter(Boolean);
117
+ return groupItems.some((item) => normalizedExt === item || normalizedExt === `.${item}`);
118
+ }
119
+ if (pattern.startsWith("*")) {
120
+ const suffix = pattern.slice(1);
121
+ return normalizedExt.endsWith(suffix);
122
+ }
123
+ if (pattern.startsWith(".")) {
124
+ return normalizedExt === pattern;
125
+ }
126
+ return normalizedExt === `.${pattern}`;
127
+ });
128
+ }
129
+ normalizeExtensionPattern(rawPattern) {
130
+ return rawPattern.trim().toLowerCase();
131
+ }
132
+ }
133
+ export {
134
+ PROCESSOR_ERRORS,
135
+ Processor
136
+ };
@@ -1,14 +1,9 @@
1
- export type RuntimeCapabilityTag =
2
- | 'bun-only'
3
- | 'node-compatible'
4
- | 'requires-native-bun-api'
5
- | 'requires-node-builtins';
6
-
1
+ export type RuntimeCapabilityTag = 'bun-only' | 'node-compatible' | 'requires-native-bun-api' | 'requires-node-builtins';
7
2
  /**
8
3
  * Declares the runtime assumptions a plugin makes so config finalization can
9
4
  * reject incompatible startup environments before bootstrapping the app.
10
5
  */
11
6
  export interface RuntimeCapabilityDeclaration {
12
- tags: RuntimeCapabilityTag[];
13
- minRuntimeVersion?: string;
7
+ tags: RuntimeCapabilityTag[];
8
+ minRuntimeVersion?: string;
14
9
  }
File without changes
@@ -0,0 +1,46 @@
1
+ import type { EcoBuildPlugin } from '../build/build-types.js';
2
+ import type { EcoPagesAppConfig } from '../types/internal-types.js';
3
+ export interface EcoSourceTransformResult {
4
+ code: string;
5
+ map?: unknown;
6
+ }
7
+ export interface EcoSourceTransform {
8
+ name: string;
9
+ filter: RegExp;
10
+ enforce?: 'pre' | 'post';
11
+ transform(code: string, id: string): EcoSourceTransformResult | string | undefined;
12
+ }
13
+ export interface EcoViteCompatiblePlugin {
14
+ name: string;
15
+ enforce?: 'pre' | 'post';
16
+ transform(code: string, id: string): EcoSourceTransformResult | string | undefined;
17
+ }
18
+ /**
19
+ * Normalizes bundler module ids so one transform can serve Ecopages loaders,
20
+ * Vite, and future bundler adapters.
21
+ */
22
+ export declare function normalizeTransformId(id: string): string;
23
+ /**
24
+ * Applies one source transform if the normalized id matches its filter.
25
+ */
26
+ export declare function applySourceTransform(transform: EcoSourceTransform, code: string, id: string): EcoSourceTransformResult | string | undefined;
27
+ /**
28
+ * Adapts a source transform into the existing Ecopages build-plugin contract.
29
+ */
30
+ export declare function createEcoBuildPluginFromSourceTransform(transform: EcoSourceTransform): EcoBuildPlugin;
31
+ /**
32
+ * Adapts a source transform into a Vite-compatible plugin object.
33
+ *
34
+ * @remarks
35
+ * This intentionally returns a plain object shape so core does not need a hard
36
+ * dependency on `vite` just to author transform primitives.
37
+ */
38
+ export declare function createVitePluginFromSourceTransform(transform: EcoSourceTransform): EcoViteCompatiblePlugin;
39
+ /**
40
+ * Returns the app-owned source transforms in stable registration order.
41
+ */
42
+ export declare function getAppSourceTransforms(appConfig: EcoPagesAppConfig): EcoSourceTransform[];
43
+ /**
44
+ * Adapts the app-owned source transforms into Vite-compatible plugin objects.
45
+ */
46
+ export declare function createVitePluginsFromAppSourceTransforms(appConfig: EcoPagesAppConfig): EcoViteCompatiblePlugin[];
@@ -0,0 +1,71 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ function normalizeTransformId(id) {
4
+ const queryIndex = id.indexOf("?");
5
+ const hashIndex = id.indexOf("#");
6
+ const endIndex = [queryIndex, hashIndex].filter((index) => index >= 0).sort((left, right) => left - right)[0];
7
+ return endIndex === void 0 ? id : id.slice(0, endIndex);
8
+ }
9
+ function applySourceTransform(transform, code, id) {
10
+ const normalizedId = normalizeTransformId(id);
11
+ if (!transform.filter.test(normalizedId)) {
12
+ return void 0;
13
+ }
14
+ return transform.transform(code, normalizedId);
15
+ }
16
+ function inferLoaderFromPath(filePath) {
17
+ const extension = path.extname(filePath).toLowerCase();
18
+ switch (extension) {
19
+ case ".ts":
20
+ return "ts";
21
+ case ".tsx":
22
+ return "tsx";
23
+ case ".jsx":
24
+ return "jsx";
25
+ default:
26
+ return "js";
27
+ }
28
+ }
29
+ function createEcoBuildPluginFromSourceTransform(transform) {
30
+ return {
31
+ name: transform.name,
32
+ setup(build) {
33
+ build.onLoad({ filter: transform.filter }, (args) => {
34
+ const filePath = normalizeTransformId(args.path);
35
+ const code = fileSystem.readFileSync(filePath);
36
+ const result = applySourceTransform(transform, code, filePath);
37
+ if (!result) {
38
+ return void 0;
39
+ }
40
+ return {
41
+ contents: typeof result === "string" ? result : result.code,
42
+ loader: inferLoaderFromPath(filePath),
43
+ resolveDir: path.dirname(filePath)
44
+ };
45
+ });
46
+ }
47
+ };
48
+ }
49
+ function createVitePluginFromSourceTransform(transform) {
50
+ return {
51
+ name: transform.name,
52
+ enforce: transform.enforce,
53
+ transform(code, id) {
54
+ return applySourceTransform(transform, code, id);
55
+ }
56
+ };
57
+ }
58
+ function getAppSourceTransforms(appConfig) {
59
+ return Array.from(appConfig.sourceTransforms.values());
60
+ }
61
+ function createVitePluginsFromAppSourceTransforms(appConfig) {
62
+ return getAppSourceTransforms(appConfig).map((transform) => createVitePluginFromSourceTransform(transform));
63
+ }
64
+ export {
65
+ applySourceTransform,
66
+ createEcoBuildPluginFromSourceTransform,
67
+ createVitePluginFromSourceTransform,
68
+ createVitePluginsFromAppSourceTransforms,
69
+ getAppSourceTransforms,
70
+ normalizeTransformId
71
+ };
@@ -0,0 +1,25 @@
1
+ import type { EcoPagesAppConfig } from '../../types/internal-types.js';
2
+ import type { BoundaryPlan, EcoComponent } from '../../types/public-types.js';
3
+ type BoundaryPlanBuildInput = {
4
+ routeFile: string;
5
+ currentIntegrationName: string;
6
+ HtmlTemplate: EcoComponent;
7
+ Layout?: EcoComponent;
8
+ Page: EcoComponent;
9
+ };
10
+ /**
11
+ * Builds a declared ownership plan from the component dependency graph.
12
+ *
13
+ * The plan is intentionally conservative: it reflects declared component
14
+ * dependencies available during render preparation and records diagnostics for
15
+ * foreign ownership edges that cannot be validated against registered
16
+ * integrations or stable component metadata.
17
+ */
18
+ export declare class BoundaryPlanningService {
19
+ private readonly appConfig;
20
+ private nextSyntheticId;
21
+ constructor(appConfig: EcoPagesAppConfig);
22
+ buildPlan(input: BoundaryPlanBuildInput): BoundaryPlan;
23
+ private isRegisteredIntegration;
24
+ }
25
+ export {};
@@ -0,0 +1,97 @@
1
+ class BoundaryPlanningService {
2
+ appConfig;
3
+ nextSyntheticId = 0;
4
+ constructor(appConfig) {
5
+ this.appConfig = appConfig;
6
+ }
7
+ buildPlan(input) {
8
+ this.nextSyntheticId = 0;
9
+ const validationErrors = [];
10
+ const rendererNames = /* @__PURE__ */ new Set([input.currentIntegrationName]);
11
+ let foreignEdgeCount = 0;
12
+ const buildNode = (component, source, parentIntegrationName, lineage) => {
13
+ const integrationName = component.config?.integration ?? component.config?.__eco?.integration ?? parentIntegrationName;
14
+ const componentMeta = component.config?.__eco;
15
+ const isForeignToParent = integrationName !== parentIntegrationName;
16
+ const componentId = componentMeta?.id ?? componentMeta?.file ?? `${source}:${this.nextSyntheticId += 1}`;
17
+ rendererNames.add(integrationName);
18
+ if (isForeignToParent) {
19
+ foreignEdgeCount += 1;
20
+ if (!componentMeta) {
21
+ validationErrors.push({
22
+ code: "MISSING_COMPONENT_METADATA",
23
+ message: `[ecopages] Foreign boundary "${componentId}" must provide stable __eco metadata so ownership diagnostics stay actionable. Declared dependencies must include all possible foreign children.`,
24
+ componentId,
25
+ integrationName
26
+ });
27
+ }
28
+ if (!this.isRegisteredIntegration(integrationName, input.currentIntegrationName)) {
29
+ validationErrors.push({
30
+ code: "UNKNOWN_INTEGRATION_OWNER",
31
+ message: `[ecopages] Foreign boundary "${componentId}" references unknown integration owner "${integrationName}". Declared dependencies must include all possible foreign children and those integrations must be registered.`,
32
+ componentId,
33
+ componentFile: componentMeta?.file,
34
+ integrationName
35
+ });
36
+ }
37
+ }
38
+ const nextLineage = new Set(lineage);
39
+ nextLineage.add(component);
40
+ const children = (component.config?.dependencies?.components ?? []).flatMap((child) => {
41
+ if (!child || nextLineage.has(child)) {
42
+ return [];
43
+ }
44
+ return [buildNode(child, "dependency", integrationName, nextLineage)];
45
+ });
46
+ return {
47
+ id: componentId,
48
+ source,
49
+ ownership: {
50
+ integrationName,
51
+ componentId,
52
+ componentFile: componentMeta?.file,
53
+ isPageEntry: source === "page",
54
+ isForeignToParent
55
+ },
56
+ children,
57
+ declaredDependenciesValid: true
58
+ };
59
+ };
60
+ const roots = [
61
+ { component: input.HtmlTemplate, source: "html-template" },
62
+ ...input.Layout ? [{ component: input.Layout, source: "layout" }] : [],
63
+ { component: input.Page, source: "page" }
64
+ ];
65
+ const root = {
66
+ id: `route:${input.routeFile}`,
67
+ source: "route",
68
+ ownership: {
69
+ integrationName: input.currentIntegrationName,
70
+ componentId: `route:${input.routeFile}`,
71
+ componentFile: input.routeFile,
72
+ isPageEntry: false,
73
+ isForeignToParent: false
74
+ },
75
+ children: roots.map(
76
+ ({ component, source }) => buildNode(component, source, input.currentIntegrationName, /* @__PURE__ */ new Set())
77
+ ),
78
+ declaredDependenciesValid: validationErrors.length === 0
79
+ };
80
+ return {
81
+ root,
82
+ rendererNames: Array.from(rendererNames),
83
+ foreignEdgeCount,
84
+ hasValidationErrors: validationErrors.length > 0,
85
+ validationErrors
86
+ };
87
+ }
88
+ isRegisteredIntegration(integrationName, currentIntegrationName) {
89
+ if (integrationName === currentIntegrationName) {
90
+ return true;
91
+ }
92
+ return this.appConfig.integrations.some((integration) => integration.name === integrationName);
93
+ }
94
+ }
95
+ export {
96
+ BoundaryPlanningService
97
+ };