@ecopages/core 0.2.0-alpha.7 → 0.2.0-alpha.8

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 (354) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +212 -92
  3. package/src/adapters/abstract/application-adapter.d.ts +168 -0
  4. package/src/adapters/abstract/application-adapter.js +109 -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 +60 -0
  12. package/src/adapters/bun/create-app.js +117 -0
  13. package/src/adapters/bun/hmr-manager.d.ts +143 -0
  14. package/src/adapters/bun/hmr-manager.js +334 -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 +373 -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/index.d.ts +6 -0
  22. package/src/adapters/index.js +14 -0
  23. package/src/adapters/node/bootstrap-dependency-resolver.d.ts +44 -0
  24. package/src/adapters/node/bootstrap-dependency-resolver.js +172 -0
  25. package/src/adapters/node/create-app.d.ts +21 -0
  26. package/src/adapters/node/create-app.js +143 -0
  27. package/src/adapters/node/index.d.ts +6 -0
  28. package/src/adapters/node/index.js +11 -0
  29. package/src/adapters/node/node-client-bridge.d.ts +26 -0
  30. package/src/adapters/node/node-client-bridge.js +66 -0
  31. package/src/adapters/node/node-hmr-manager.d.ts +133 -0
  32. package/src/adapters/node/node-hmr-manager.js +312 -0
  33. package/src/adapters/node/runtime-adapter.d.ts +46 -0
  34. package/src/adapters/node/runtime-adapter.js +306 -0
  35. package/src/adapters/node/server-adapter.d.ts +161 -0
  36. package/src/adapters/node/server-adapter.js +358 -0
  37. package/src/adapters/node/static-content-server.d.ts +60 -0
  38. package/src/adapters/node/static-content-server.js +194 -0
  39. package/src/adapters/node/write-runtime-manifest.d.ts +26 -0
  40. package/src/adapters/node/write-runtime-manifest.js +12 -0
  41. package/src/adapters/shared/api-response.d.ts +52 -0
  42. package/src/adapters/shared/api-response.js +96 -0
  43. package/src/adapters/shared/application-adapter.d.ts +18 -0
  44. package/src/adapters/shared/application-adapter.js +90 -0
  45. package/src/adapters/shared/define-api-handler.d.ts +25 -0
  46. package/src/adapters/shared/define-api-handler.js +15 -0
  47. package/src/adapters/shared/explicit-static-route-matcher.d.ts +38 -0
  48. package/src/adapters/shared/explicit-static-route-matcher.js +103 -0
  49. package/src/adapters/shared/file-route-middleware-pipeline.d.ts +65 -0
  50. package/src/adapters/shared/file-route-middleware-pipeline.js +99 -0
  51. package/src/adapters/shared/fs-server-response-factory.d.ts +19 -0
  52. package/src/adapters/shared/fs-server-response-factory.js +97 -0
  53. package/src/adapters/shared/fs-server-response-matcher.d.ts +75 -0
  54. package/src/adapters/shared/fs-server-response-matcher.js +160 -0
  55. package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +55 -0
  56. package/src/adapters/shared/hmr-entrypoint-registrar.js +87 -0
  57. package/src/adapters/shared/hmr-html-response.d.ts +22 -0
  58. package/src/adapters/shared/hmr-html-response.js +32 -0
  59. package/src/adapters/shared/render-context.d.ts +14 -0
  60. package/src/adapters/shared/render-context.js +70 -0
  61. package/src/adapters/shared/runtime-bootstrap.d.ts +38 -0
  62. package/src/adapters/shared/runtime-bootstrap.js +43 -0
  63. package/src/adapters/shared/server-adapter.d.ts +97 -0
  64. package/src/adapters/shared/server-adapter.js +386 -0
  65. package/src/adapters/shared/server-route-handler.d.ts +89 -0
  66. package/src/adapters/shared/server-route-handler.js +111 -0
  67. package/src/adapters/shared/server-static-builder.d.ts +70 -0
  68. package/src/adapters/shared/server-static-builder.js +99 -0
  69. package/src/build/build-adapter.d.ts +186 -0
  70. package/src/build/build-adapter.js +168 -0
  71. package/src/build/build-manifest.d.ts +27 -0
  72. package/src/build/build-manifest.js +30 -0
  73. package/src/build/build-types.d.ts +57 -0
  74. package/src/build/build-types.js +0 -0
  75. package/src/build/dev-build-coordinator.d.ts +74 -0
  76. package/src/build/dev-build-coordinator.js +161 -0
  77. package/src/build/esbuild-build-adapter.d.ts +72 -0
  78. package/src/build/esbuild-build-adapter.js +422 -0
  79. package/src/build/runtime-build-executor.d.ts +13 -0
  80. package/src/build/runtime-build-executor.js +20 -0
  81. package/src/build/runtime-specifier-alias-plugin.d.ts +15 -0
  82. package/src/build/runtime-specifier-alias-plugin.js +31 -0
  83. package/src/config/config-builder.d.ts +238 -0
  84. package/src/config/config-builder.js +565 -0
  85. package/src/constants.d.ts +45 -0
  86. package/src/constants.js +25 -0
  87. package/src/create-app.d.ts +17 -0
  88. package/src/create-app.js +66 -0
  89. package/src/dev/sc-server.d.ts +30 -0
  90. package/src/dev/sc-server.js +111 -0
  91. package/src/eco/component-render-context.d.ts +105 -0
  92. package/src/eco/component-render-context.js +87 -0
  93. package/src/eco/eco.d.ts +9 -0
  94. package/src/eco/eco.js +114 -0
  95. package/src/eco/eco.types.d.ts +178 -0
  96. package/src/eco/eco.types.js +0 -0
  97. package/src/eco/eco.utils.d.ts +40 -0
  98. package/src/eco/eco.utils.js +40 -0
  99. package/src/eco/global-injector-map.d.ts +16 -0
  100. package/src/eco/global-injector-map.js +80 -0
  101. package/src/eco/lazy-injector-map.d.ts +8 -0
  102. package/src/eco/lazy-injector-map.js +70 -0
  103. package/src/eco/module-dependencies.d.ts +18 -0
  104. package/src/eco/module-dependencies.js +49 -0
  105. package/src/errors/http-error.d.ts +31 -0
  106. package/src/errors/http-error.js +50 -0
  107. package/src/errors/index.d.ts +2 -0
  108. package/src/errors/index.js +4 -0
  109. package/src/errors/locals-access-error.d.ts +4 -0
  110. package/src/errors/locals-access-error.js +9 -0
  111. package/src/global/app-logger.d.ts +2 -0
  112. package/src/global/app-logger.js +6 -0
  113. package/src/hmr/client/hmr-runtime.d.ts +5 -0
  114. package/src/hmr/client/hmr-runtime.js +109 -0
  115. package/src/hmr/hmr-strategy.d.ts +159 -0
  116. package/src/hmr/hmr-strategy.js +29 -0
  117. package/src/hmr/hmr.postcss.test.e2e.d.ts +1 -0
  118. package/src/hmr/hmr.postcss.test.e2e.js +31 -0
  119. package/src/hmr/hmr.test.e2e.d.ts +1 -0
  120. package/src/hmr/hmr.test.e2e.js +43 -0
  121. package/src/hmr/strategies/default-hmr-strategy.d.ts +43 -0
  122. package/src/hmr/strategies/default-hmr-strategy.js +34 -0
  123. package/src/hmr/strategies/js-hmr-strategy.d.ts +139 -0
  124. package/src/hmr/strategies/js-hmr-strategy.js +178 -0
  125. package/src/index.browser.d.ts +3 -0
  126. package/src/index.browser.js +4 -0
  127. package/src/index.d.ts +5 -0
  128. package/src/index.js +10 -0
  129. package/src/integrations/ghtml/ghtml-renderer.d.ts +15 -0
  130. package/src/integrations/ghtml/ghtml-renderer.js +62 -0
  131. package/src/integrations/ghtml/ghtml.plugin.d.ts +20 -0
  132. package/src/integrations/ghtml/ghtml.plugin.js +21 -0
  133. package/src/internal-types.d.ts +221 -0
  134. package/src/internal-types.js +0 -0
  135. package/src/plugins/alias-resolver-plugin.d.ts +2 -0
  136. package/src/plugins/alias-resolver-plugin.js +53 -0
  137. package/src/plugins/eco-component-meta-plugin.d.ts +97 -0
  138. package/src/plugins/eco-component-meta-plugin.js +157 -0
  139. package/src/plugins/integration-plugin.d.ts +136 -0
  140. package/src/plugins/integration-plugin.js +133 -0
  141. package/src/plugins/processor.d.ts +95 -0
  142. package/src/plugins/processor.js +136 -0
  143. package/src/plugins/runtime-capability.d.ts +9 -0
  144. package/src/plugins/runtime-capability.js +0 -0
  145. package/src/public-types.d.ts +1149 -0
  146. package/src/public-types.js +0 -0
  147. package/src/route-renderer/component-graph/component-graph-executor.d.ts +32 -0
  148. package/src/route-renderer/component-graph/component-graph-executor.js +31 -0
  149. package/src/route-renderer/component-graph/component-graph.d.ts +42 -0
  150. package/src/route-renderer/component-graph/component-graph.js +72 -0
  151. package/src/route-renderer/component-graph/component-marker.d.ts +52 -0
  152. package/src/route-renderer/component-graph/component-marker.js +46 -0
  153. package/src/route-renderer/component-graph/component-reference.d.ts +10 -0
  154. package/src/route-renderer/component-graph/component-reference.js +19 -0
  155. package/src/route-renderer/component-graph/marker-graph-resolver.d.ts +77 -0
  156. package/src/route-renderer/component-graph/marker-graph-resolver.js +95 -0
  157. package/src/route-renderer/orchestration/integration-renderer.d.ts +372 -0
  158. package/src/route-renderer/orchestration/integration-renderer.js +589 -0
  159. package/src/route-renderer/orchestration/render-execution.service.d.ts +103 -0
  160. package/src/route-renderer/orchestration/render-execution.service.js +121 -0
  161. package/src/route-renderer/orchestration/render-preparation.service.d.ts +121 -0
  162. package/src/route-renderer/orchestration/render-preparation.service.js +332 -0
  163. package/src/route-renderer/page-loading/dependency-resolver.d.ts +35 -0
  164. package/src/route-renderer/page-loading/dependency-resolver.js +442 -0
  165. package/src/route-renderer/page-loading/page-module-loader.d.ts +87 -0
  166. package/src/route-renderer/page-loading/page-module-loader.js +124 -0
  167. package/src/route-renderer/route-renderer.d.ts +61 -0
  168. package/src/route-renderer/route-renderer.js +87 -0
  169. package/src/router/client/link-intent.js +34 -0
  170. package/src/router/client/link-intent.test.browser.d.ts +1 -0
  171. package/src/router/client/link-intent.test.browser.js +43 -0
  172. package/src/router/client/navigation-coordinator.d.ts +149 -0
  173. package/src/router/client/navigation-coordinator.js +215 -0
  174. package/src/router/server/fs-router-scanner.d.ts +41 -0
  175. package/src/router/server/fs-router-scanner.js +156 -0
  176. package/src/router/server/fs-router.d.ts +26 -0
  177. package/src/router/server/fs-router.js +100 -0
  178. package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +120 -0
  179. package/src/services/assets/asset-processing-service/asset-processing.service.js +331 -0
  180. package/src/services/assets/asset-processing-service/asset.factory.d.ts +17 -0
  181. package/src/services/assets/asset-processing-service/asset.factory.js +82 -0
  182. package/src/services/assets/asset-processing-service/assets.types.d.ts +89 -0
  183. package/src/services/assets/asset-processing-service/assets.types.js +0 -0
  184. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +55 -0
  185. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +48 -0
  186. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +20 -0
  187. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +41 -0
  188. package/src/services/assets/asset-processing-service/index.d.ts +5 -0
  189. package/src/services/assets/asset-processing-service/index.js +5 -0
  190. package/src/services/assets/asset-processing-service/processor.interface.d.ts +22 -0
  191. package/src/services/assets/asset-processing-service/processor.interface.js +6 -0
  192. package/src/services/assets/asset-processing-service/processor.registry.d.ts +8 -0
  193. package/src/services/assets/asset-processing-service/processor.registry.js +15 -0
  194. package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +24 -0
  195. package/src/services/assets/asset-processing-service/processors/base/base-processor.js +64 -0
  196. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +17 -0
  197. package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +72 -0
  198. package/src/services/assets/asset-processing-service/processors/index.d.ts +5 -0
  199. package/src/services/assets/asset-processing-service/processors/index.js +5 -0
  200. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +5 -0
  201. package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +57 -0
  202. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -0
  203. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +76 -0
  204. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +7 -0
  205. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +75 -0
  206. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +5 -0
  207. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +25 -0
  208. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +9 -0
  209. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +66 -0
  210. package/src/services/assets/browser-bundle.service.d.ts +32 -0
  211. package/src/services/assets/browser-bundle.service.js +33 -0
  212. package/src/services/cache/cache.types.d.ts +107 -0
  213. package/src/services/cache/cache.types.js +0 -0
  214. package/src/services/cache/index.d.ts +7 -0
  215. package/src/services/cache/index.js +7 -0
  216. package/src/services/cache/memory-cache-store.d.ts +42 -0
  217. package/src/services/cache/memory-cache-store.js +98 -0
  218. package/src/services/cache/page-cache-service.d.ts +70 -0
  219. package/src/services/cache/page-cache-service.js +152 -0
  220. package/src/services/cache/page-request-cache-coordinator.service.d.ts +75 -0
  221. package/src/services/cache/page-request-cache-coordinator.service.js +109 -0
  222. package/src/services/html/html-rewriter-provider.service.d.ts +37 -0
  223. package/src/services/html/html-rewriter-provider.service.js +65 -0
  224. package/src/services/html/html-transformer.service.d.ts +77 -0
  225. package/src/services/html/html-transformer.service.js +221 -0
  226. package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
  227. package/src/services/invalidation/development-invalidation.service.js +189 -0
  228. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +16 -0
  229. package/src/services/module-loading/app-server-module-transpiler.service.js +34 -0
  230. package/src/services/module-loading/page-module-import.service.d.ts +71 -0
  231. package/src/services/module-loading/page-module-import.service.js +132 -0
  232. package/src/services/module-loading/server-loader.service.d.ts +96 -0
  233. package/src/services/module-loading/server-loader.service.js +32 -0
  234. package/src/services/module-loading/server-module-transpiler.service.d.ts +69 -0
  235. package/src/services/module-loading/server-module-transpiler.service.js +61 -0
  236. package/src/services/runtime-manifest/node-runtime-manifest.service.d.ts +35 -0
  237. package/src/services/runtime-manifest/node-runtime-manifest.service.js +60 -0
  238. package/src/services/runtime-state/dev-graph.service.d.ts +118 -0
  239. package/src/services/runtime-state/dev-graph.service.js +162 -0
  240. package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +41 -0
  241. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +85 -0
  242. package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +69 -0
  243. package/src/services/runtime-state/runtime-specifier-registry.service.js +37 -0
  244. package/src/services/runtime-state/server-invalidation-state.service.d.ts +26 -0
  245. package/src/services/runtime-state/server-invalidation-state.service.js +35 -0
  246. package/src/services/validation/schema-validation-service.d.ts +122 -0
  247. package/src/services/validation/schema-validation-service.js +101 -0
  248. package/src/services/validation/standard-schema.types.d.ts +65 -0
  249. package/src/services/validation/standard-schema.types.js +0 -0
  250. package/src/static-site-generator/static-site-generator.d.ts +109 -0
  251. package/src/static-site-generator/static-site-generator.js +353 -0
  252. package/src/utils/css.d.ts +1 -0
  253. package/src/utils/css.js +7 -0
  254. package/src/utils/deep-merge.d.ts +14 -0
  255. package/src/utils/deep-merge.js +32 -0
  256. package/src/utils/hash.d.ts +1 -0
  257. package/src/utils/hash.js +7 -0
  258. package/src/utils/html.d.ts +1 -0
  259. package/src/utils/html.js +4 -0
  260. package/src/utils/invariant.d.ts +5 -0
  261. package/src/utils/invariant.js +11 -0
  262. package/src/utils/locals-utils.d.ts +15 -0
  263. package/src/utils/locals-utils.js +24 -0
  264. package/src/utils/parse-cli-args.d.ts +24 -0
  265. package/src/utils/parse-cli-args.js +47 -0
  266. package/src/utils/path-utils.module.d.ts +5 -0
  267. package/src/utils/path-utils.module.js +14 -0
  268. package/src/utils/resolve-work-dir.d.ts +11 -0
  269. package/src/utils/resolve-work-dir.js +31 -0
  270. package/src/utils/runtime.d.ts +11 -0
  271. package/src/utils/runtime.js +40 -0
  272. package/src/utils/server-utils.module.d.ts +19 -0
  273. package/src/utils/server-utils.module.js +56 -0
  274. package/src/watchers/project-watcher.d.ts +136 -0
  275. package/src/watchers/project-watcher.js +281 -0
  276. package/src/watchers/project-watcher.test-helpers.d.ts +4 -0
  277. package/src/watchers/project-watcher.test-helpers.js +52 -0
  278. package/src/adapters/bun/hmr-manager.test.ts +0 -267
  279. package/src/adapters/node/bootstrap-dependency-resolver.test.ts +0 -282
  280. package/src/adapters/node/node-client-bridge.test.ts +0 -198
  281. package/src/adapters/node/node-hmr-manager.test.ts +0 -322
  282. package/src/adapters/node/runtime-adapter.test.ts +0 -868
  283. package/src/adapters/node/static-content-server.test.ts +0 -60
  284. package/src/adapters/shared/api-response.test.ts +0 -97
  285. package/src/adapters/shared/explicit-static-route-matcher.test.ts +0 -381
  286. package/src/adapters/shared/file-route-middleware-pipeline.test.ts +0 -90
  287. package/src/adapters/shared/fs-server-response-factory.test.ts +0 -187
  288. package/src/adapters/shared/fs-server-response-matcher.test.ts +0 -286
  289. package/src/adapters/shared/hmr-manager.contract.test.ts +0 -196
  290. package/src/adapters/shared/hmr-manager.dispatch.test.ts +0 -220
  291. package/src/adapters/shared/render-context.test.ts +0 -146
  292. package/src/adapters/shared/server-adapter.test.ts +0 -77
  293. package/src/adapters/shared/server-route-handler.test.ts +0 -110
  294. package/src/adapters/shared/server-static-builder.test.ts +0 -316
  295. package/src/build/build-adapter-serialization.test.ts +0 -268
  296. package/src/build/build-adapter.test.ts +0 -815
  297. package/src/build/runtime-specifier-alias-plugin.test.ts +0 -43
  298. package/src/config/config-builder.test.ts +0 -410
  299. package/src/eco/eco.test.ts +0 -678
  300. package/src/eco/eco.utils.test.ts +0 -124
  301. package/src/eco/global-injector-map.test.ts +0 -42
  302. package/src/eco/lazy-injector-map.test.ts +0 -66
  303. package/src/eco/module-dependencies.test.ts +0 -30
  304. package/src/errors/http-error.test.ts +0 -134
  305. package/src/global/utils.test.ts +0 -12
  306. 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
  307. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-load-fixture-app-page-1.png +0 -0
  308. package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-WebSocket-Connection-should-connect-to-correct-HMR-endpoint-1.png +0 -0
  309. package/src/hmr/hmr-strategy.test.ts +0 -124
  310. package/src/hmr/strategies/js-hmr-strategy.test.ts +0 -335
  311. package/src/integrations/ghtml/ghtml-renderer.test.ts +0 -63
  312. package/src/plugins/alias-resolver-plugin.test.ts +0 -41
  313. package/src/plugins/eco-component-meta-plugin.test.ts +0 -380
  314. package/src/plugins/integration-plugin.test.ts +0 -111
  315. package/src/plugins/processor.test.ts +0 -148
  316. package/src/route-renderer/component-graph/component-graph-executor.test.ts +0 -41
  317. package/src/route-renderer/component-graph/component-graph.test.ts +0 -63
  318. package/src/route-renderer/component-graph/component-marker.test.ts +0 -73
  319. package/src/route-renderer/component-graph/marker-graph-resolver.test.ts +0 -135
  320. package/src/route-renderer/orchestration/integration-renderer.test.ts +0 -936
  321. package/src/route-renderer/orchestration/render-execution.service.test.ts +0 -97
  322. package/src/route-renderer/orchestration/render-preparation.service.test.ts +0 -235
  323. package/src/route-renderer/page-loading/dependency-resolver.test.ts +0 -345
  324. package/src/route-renderer/page-loading/page-module-loader.test.ts +0 -96
  325. package/src/router/client/navigation-coordinator.test.ts +0 -237
  326. package/src/router/server/fs-router-scanner.test.ts +0 -83
  327. package/src/router/server/fs-router.test.ts +0 -214
  328. package/src/services/assets/asset-processing-service/asset-processing.service.test.ts +0 -385
  329. package/src/services/assets/asset-processing-service/asset.factory.test.ts +0 -63
  330. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.test.ts +0 -72
  331. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.test.ts +0 -67
  332. package/src/services/assets/asset-processing-service/processors/base/base-processor.test.ts +0 -59
  333. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.test.ts +0 -286
  334. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.test.ts +0 -227
  335. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.test.ts +0 -199
  336. package/src/services/assets/browser-bundle.service.test.ts +0 -36
  337. package/src/services/cache/memory-cache-store.test.ts +0 -225
  338. package/src/services/cache/page-cache-service.test.ts +0 -175
  339. package/src/services/cache/page-request-cache-coordinator.service.test.ts +0 -79
  340. package/src/services/html/html-rewriter-provider.service.test.ts +0 -183
  341. package/src/services/html/html-transformer.service.test.ts +0 -378
  342. package/src/services/invalidation/development-invalidation.service.test.ts +0 -77
  343. package/src/services/module-loading/page-module-import.service.test.ts +0 -253
  344. package/src/services/module-loading/server-loader.service.test.ts +0 -161
  345. package/src/services/module-loading/server-module-transpiler.service.test.ts +0 -115
  346. package/src/services/runtime-manifest/node-runtime-manifest.service.test.ts +0 -95
  347. package/src/services/validation/schema-validation-service.test.ts +0 -223
  348. package/src/static-site-generator/static-site-generator.test.ts +0 -307
  349. package/src/utils/deep-merge.test.ts +0 -114
  350. package/src/utils/invariant.test.ts +0 -22
  351. package/src/utils/path-utils.test.ts +0 -15
  352. package/src/utils/server-utils.test.ts +0 -38
  353. package/src/watchers/project-watcher.integration.test.ts +0 -337
  354. package/src/watchers/project-watcher.test.ts +0 -678
@@ -0,0 +1,5 @@
1
+ export * from "./asset.factory";
2
+ export * from "./asset-processing.service";
3
+ export * from "./assets.types";
4
+ export * from "./browser-runtime-asset.factory";
5
+ export * from "./browser-runtime-entry.factory";
@@ -0,0 +1,22 @@
1
+ import type { IHmrManager } from '../../../internal-types';
2
+ import type { AssetDefinition, ProcessedAsset } from './assets.types';
3
+ /**
4
+ * Base interface for asset processors.
5
+ * Processors transform asset definitions into processed assets.
6
+ */
7
+ export interface AssetProcessor<T extends AssetDefinition = AssetDefinition> {
8
+ process(asset: T): Promise<ProcessedAsset>;
9
+ }
10
+ /**
11
+ * Interface for processors that support HMR (Hot Module Replacement).
12
+ * These processors can receive an HMR manager to enable hot reloading capabilities.
13
+ */
14
+ export interface HmrAwareProcessor extends AssetProcessor {
15
+ setHmrManager(hmrManager: IHmrManager): void;
16
+ }
17
+ /**
18
+ * Type guard to check if a processor supports HMR.
19
+ * @param processor - The processor to check
20
+ * @returns True if the processor implements HmrAwareProcessor
21
+ */
22
+ export declare function isHmrAware(processor: AssetProcessor): processor is HmrAwareProcessor;
@@ -0,0 +1,6 @@
1
+ function isHmrAware(processor) {
2
+ return "setHmrManager" in processor && typeof processor.setHmrManager === "function";
3
+ }
4
+ export {
5
+ isHmrAware
6
+ };
@@ -0,0 +1,8 @@
1
+ import type { AssetKind, AssetSource } from './assets.types';
2
+ import type { BaseProcessor } from './processors/base/base-processor';
3
+ export declare class ProcessorRegistry {
4
+ private processors;
5
+ register(kind: AssetKind, variant: AssetSource, processor: BaseProcessor<any>): void;
6
+ getProcessor(kind: AssetKind, variant: AssetSource): BaseProcessor<any> | undefined;
7
+ getAllProcessors(): Map<`${AssetKind}-${AssetSource}`, BaseProcessor<any>>;
8
+ }
@@ -0,0 +1,15 @@
1
+ class ProcessorRegistry {
2
+ processors = /* @__PURE__ */ new Map();
3
+ register(kind, variant, processor) {
4
+ this.processors.set(`${kind}-${variant}`, processor);
5
+ }
6
+ getProcessor(kind, variant) {
7
+ return this.processors.get(`${kind}-${variant}`);
8
+ }
9
+ getAllProcessors() {
10
+ return this.processors;
11
+ }
12
+ }
13
+ export {
14
+ ProcessorRegistry
15
+ };
@@ -0,0 +1,24 @@
1
+ import type { EcoPagesAppConfig } from '../../../../../internal-types.js';
2
+ import type { BaseAsset, ProcessedAsset } from '../../assets.types.js';
3
+ export declare abstract class BaseProcessor<T extends BaseAsset> {
4
+ protected appConfig: EcoPagesAppConfig;
5
+ /**
6
+ * Cache for processed assets to avoid reprocessing the same asset multiple times.
7
+ * The cache key is a combination of the asset name and its hash.
8
+ * The cache value is the processed asset.
9
+ */
10
+ protected cache: Map<string, ProcessedAsset>;
11
+ constructor({ appConfig }: {
12
+ appConfig: EcoPagesAppConfig;
13
+ });
14
+ get isDevelopment(): boolean;
15
+ get isProduction(): boolean;
16
+ abstract process(dep: T): Promise<ProcessedAsset>;
17
+ protected getAssetsDir(): string;
18
+ protected writeCacheFile(key: string, path: ProcessedAsset): void;
19
+ protected getCacheFile(key: string): ProcessedAsset | undefined;
20
+ protected hasCacheFile(key: string): boolean;
21
+ protected generateHash(content: string): string;
22
+ protected buildCacheKey(identifier: string, contentHash: string, dep: T): string;
23
+ protected getOrProcess(cacheKey: string, processFn: () => ProcessedAsset | Promise<ProcessedAsset>): Promise<ProcessedAsset>;
24
+ }
@@ -0,0 +1,64 @@
1
+ import path from "node:path";
2
+ import { RESOLVED_ASSETS_DIR } from "../../../../../constants.js";
3
+ import { rapidhash } from "../../../../../utils/hash.js";
4
+ import { isDevelopmentRuntime, isProductionRuntime } from "../../../../../utils/runtime.js";
5
+ import { fileSystem } from "@ecopages/file-system";
6
+ class BaseProcessor {
7
+ appConfig;
8
+ /**
9
+ * Cache for processed assets to avoid reprocessing the same asset multiple times.
10
+ * The cache key is a combination of the asset name and its hash.
11
+ * The cache value is the processed asset.
12
+ */
13
+ cache = /* @__PURE__ */ new Map();
14
+ constructor({ appConfig }) {
15
+ this.appConfig = appConfig;
16
+ }
17
+ get isDevelopment() {
18
+ return isDevelopmentRuntime();
19
+ }
20
+ get isProduction() {
21
+ return isProductionRuntime();
22
+ }
23
+ getAssetsDir() {
24
+ return path.join(this.appConfig.absolutePaths.distDir, RESOLVED_ASSETS_DIR);
25
+ }
26
+ writeCacheFile(key, path2) {
27
+ this.cache.set(key, path2);
28
+ }
29
+ getCacheFile(key) {
30
+ return this.cache.get(key);
31
+ }
32
+ hasCacheFile(key) {
33
+ return this.cache.has(key);
34
+ }
35
+ generateHash(content) {
36
+ return rapidhash(content).toString();
37
+ }
38
+ buildCacheKey(identifier, contentHash, dep) {
39
+ const attrsHash = dep.attributes ? this.generateHash(JSON.stringify(dep.attributes)) : "";
40
+ const position = dep.position ?? "";
41
+ return `${identifier}:${contentHash}:${position}:${attrsHash}`;
42
+ }
43
+ getOrProcess(cacheKey, processFn) {
44
+ if (this.hasCacheFile(cacheKey)) {
45
+ const cached = this.getCacheFile(cacheKey);
46
+ if (!cached.filepath || fileSystem.exists(cached.filepath)) {
47
+ return Promise.resolve(cached);
48
+ }
49
+ this.cache.delete(cacheKey);
50
+ }
51
+ const result = processFn();
52
+ if (result instanceof Promise) {
53
+ return result.then((asset) => {
54
+ this.writeCacheFile(cacheKey, asset);
55
+ return asset;
56
+ });
57
+ }
58
+ this.writeCacheFile(cacheKey, result);
59
+ return Promise.resolve(result);
60
+ }
61
+ }
62
+ export {
63
+ BaseProcessor
64
+ };
@@ -0,0 +1,17 @@
1
+ import type { EcoPagesAppConfig } from '../../../../../internal-types';
2
+ import type { EcoBuildPlugin } from '../../../../../build/build-types.js';
3
+ import type { ScriptAsset } from '../../assets.types';
4
+ import { BaseProcessor } from './base-processor';
5
+ export declare abstract class BaseScriptProcessor<T extends ScriptAsset> extends BaseProcessor<T> {
6
+ private readonly browserBundleService;
7
+ constructor({ appConfig }: {
8
+ appConfig: EcoPagesAppConfig;
9
+ });
10
+ protected shouldBundle(dep: T): boolean;
11
+ protected getBundlerOptions(dep: T): Record<string, any>;
12
+ protected collectBuildPlugins(): EcoBuildPlugin[];
13
+ protected bundleScript({ entrypoint, outdir, plugins: additionalPlugins, ...rest }: {
14
+ entrypoint: string;
15
+ outdir: string;
16
+ } & ScriptAsset['bundleOptions']): Promise<string>;
17
+ }
@@ -0,0 +1,72 @@
1
+ import { appLogger } from "../../../../../global/app-logger";
2
+ import { getAppBrowserBuildPlugins } from "../../../../../build/build-adapter.js";
3
+ import { fileSystem } from "@ecopages/file-system";
4
+ import path from "node:path";
5
+ import { BaseProcessor } from "./base-processor";
6
+ import { BrowserBundleService } from "../../../browser-bundle.service.js";
7
+ class BaseScriptProcessor extends BaseProcessor {
8
+ browserBundleService;
9
+ constructor({ appConfig }) {
10
+ super({ appConfig });
11
+ this.browserBundleService = new BrowserBundleService(appConfig);
12
+ }
13
+ shouldBundle(dep) {
14
+ return dep.bundle !== false;
15
+ }
16
+ getBundlerOptions(dep) {
17
+ return dep.bundleOptions || {};
18
+ }
19
+ collectBuildPlugins() {
20
+ return getAppBrowserBuildPlugins(this.appConfig);
21
+ }
22
+ async bundleScript({
23
+ entrypoint,
24
+ outdir,
25
+ plugins: additionalPlugins,
26
+ ...rest
27
+ }) {
28
+ const buildPlugins = this.collectBuildPlugins();
29
+ const allPlugins = additionalPlugins ? [...additionalPlugins, ...buildPlugins] : buildPlugins;
30
+ const buildResult = await this.browserBundleService.bundle({
31
+ profile: "browser-script",
32
+ entrypoints: [entrypoint],
33
+ outdir,
34
+ root: this.appConfig.rootDir,
35
+ splitting: true,
36
+ naming: "[name]-[hash].[ext]",
37
+ plugins: allPlugins,
38
+ ...rest
39
+ });
40
+ if (!buildResult.success) {
41
+ for (const log of buildResult.logs) {
42
+ appLogger.debug(log.message, log);
43
+ }
44
+ }
45
+ const entryBaseName = path.parse(entrypoint).name;
46
+ const entryOutput = buildResult.outputs.map((output) => output.path).find((outputPath) => path.basename(outputPath) === `${entryBaseName}.js`);
47
+ if (entryOutput) {
48
+ return entryOutput;
49
+ }
50
+ const nonVendorOutput = buildResult.outputs.map((output) => output.path).find((outputPath) => !path.basename(outputPath).startsWith("vendors"));
51
+ if (nonVendorOutput) {
52
+ return nonVendorOutput;
53
+ }
54
+ const primaryOutput = buildResult.outputs[0]?.path;
55
+ if (primaryOutput) {
56
+ return primaryOutput;
57
+ }
58
+ const namedFallbackOutput = path.join(outdir, `${entryBaseName}.js`);
59
+ if (fileSystem.exists(namedFallbackOutput)) {
60
+ return namedFallbackOutput;
61
+ }
62
+ const fallbackOutput = path.join(outdir, "entry_0.js");
63
+ if (fileSystem.exists(fallbackOutput)) {
64
+ return fallbackOutput;
65
+ }
66
+ const logMessage = buildResult.logs.map((log) => log.message).join(" | ");
67
+ throw new Error(`No build output generated for ${entrypoint}${logMessage ? `: ${logMessage}` : ""}`);
68
+ }
69
+ }
70
+ export {
71
+ BaseScriptProcessor
72
+ };
@@ -0,0 +1,5 @@
1
+ export * from './script/content-script.processor';
2
+ export * from './script/file-script.processor';
3
+ export * from './script/node-module-script.processor';
4
+ export * from './stylesheet/content-stylesheet.processor';
5
+ export * from './stylesheet/file-stylesheet.processor';
@@ -0,0 +1,5 @@
1
+ export * from "./script/content-script.processor";
2
+ export * from "./script/file-script.processor";
3
+ export * from "./script/node-module-script.processor";
4
+ export * from "./stylesheet/content-stylesheet.processor";
5
+ export * from "./stylesheet/file-stylesheet.processor";
@@ -0,0 +1,5 @@
1
+ import type { ContentScriptAsset, ProcessedAsset } from '../../assets.types';
2
+ import { BaseScriptProcessor } from '../base/base-script-processor';
3
+ export declare class ContentScriptProcessor extends BaseScriptProcessor<ContentScriptAsset> {
4
+ process(dep: ContentScriptAsset): Promise<ProcessedAsset>;
5
+ }
@@ -0,0 +1,57 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { BaseScriptProcessor } from "../base/base-script-processor";
4
+ class ContentScriptProcessor extends BaseScriptProcessor {
5
+ async process(dep) {
6
+ const hash = this.generateHash(dep.content);
7
+ const filename = dep.name ? `${dep.name}.js` : `script-${hash}.js`;
8
+ const shouldBundle = this.shouldBundle(dep);
9
+ const filepath = path.join(this.getAssetsDir(), "scripts", filename);
10
+ if (!shouldBundle) {
11
+ if (!dep.inline) fileSystem.write(filepath, dep.content);
12
+ const unbundledProcessedAsset = {
13
+ filepath,
14
+ content: dep.inline ? dep.content : void 0,
15
+ kind: "script",
16
+ position: dep.position,
17
+ attributes: dep.attributes,
18
+ inline: dep.inline,
19
+ excludeFromHtml: dep.excludeFromHtml
20
+ };
21
+ this.writeCacheFile(filename, unbundledProcessedAsset);
22
+ return unbundledProcessedAsset;
23
+ }
24
+ if (dep.content) {
25
+ const tempDir = this.appConfig.absolutePaths.distDir;
26
+ fileSystem.ensureDir(tempDir);
27
+ const tempFileName = path.join(
28
+ tempDir,
29
+ `${path.parse(filename).name}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp.js`
30
+ );
31
+ fileSystem.write(tempFileName, dep.content);
32
+ const bundledFilePath = await this.bundleScript({
33
+ entrypoint: tempFileName,
34
+ outdir: this.getAssetsDir(),
35
+ minify: this.isProduction,
36
+ naming: `${path.parse(filename).name}-[hash].[ext]`,
37
+ ...this.getBundlerOptions(dep)
38
+ });
39
+ const processedAsset = {
40
+ filepath: bundledFilePath,
41
+ content: dep.inline ? fileSystem.readFileSync(bundledFilePath).toString() : void 0,
42
+ kind: "script",
43
+ position: dep.position,
44
+ attributes: dep.attributes,
45
+ inline: dep.inline,
46
+ excludeFromHtml: dep.excludeFromHtml
47
+ };
48
+ fileSystem.remove(tempFileName);
49
+ this.writeCacheFile(filename, processedAsset);
50
+ return processedAsset;
51
+ }
52
+ throw new Error("No content found for script asset");
53
+ }
54
+ }
55
+ export {
56
+ ContentScriptProcessor
57
+ };
@@ -0,0 +1,8 @@
1
+ import type { IHmrManager } from '../../../../../internal-types';
2
+ import type { FileScriptAsset, ProcessedAsset } from '../../assets.types';
3
+ import { BaseScriptProcessor } from '../base/base-script-processor';
4
+ export declare class FileScriptProcessor extends BaseScriptProcessor<FileScriptAsset> {
5
+ private hmrManager?;
6
+ setHmrManager(hmrManager: IHmrManager): void;
7
+ process(dep: FileScriptAsset): Promise<ProcessedAsset>;
8
+ }
@@ -0,0 +1,76 @@
1
+ import path from "node:path";
2
+ import { RESOLVED_ASSETS_DIR } from "../../../../../constants";
3
+ import { fileSystem } from "@ecopages/file-system";
4
+ import { BaseScriptProcessor } from "../base/base-script-processor";
5
+ class FileScriptProcessor extends BaseScriptProcessor {
6
+ hmrManager;
7
+ setHmrManager(hmrManager) {
8
+ this.hmrManager = hmrManager;
9
+ }
10
+ async process(dep) {
11
+ if (this.hmrManager?.isEnabled() && !dep.inline) {
12
+ const outputUrl = await this.hmrManager.registerScriptEntrypoint(dep.filepath);
13
+ return {
14
+ filepath: dep.filepath,
15
+ srcUrl: outputUrl,
16
+ kind: "script",
17
+ position: dep.position,
18
+ attributes: dep.attributes,
19
+ inline: false,
20
+ excludeFromHtml: dep.excludeFromHtml
21
+ };
22
+ }
23
+ const content = fileSystem.readFileSync(dep.filepath);
24
+ const shouldBundle = this.shouldBundle(dep);
25
+ const configHash = this.generateHash(
26
+ JSON.stringify({
27
+ bundle: shouldBundle,
28
+ minify: shouldBundle && this.isProduction,
29
+ opts: dep.bundleOptions
30
+ })
31
+ );
32
+ const cachekey = `${this.buildCacheKey(dep.filepath, this.generateHash(content), dep)}:${configHash}`;
33
+ return this.getOrProcess(cachekey, async () => {
34
+ if (!shouldBundle) {
35
+ const outFilepath = path.relative(this.appConfig.absolutePaths.srcDir, dep.filepath);
36
+ let filepath;
37
+ if (!dep.inline) {
38
+ filepath = path.join(this.getAssetsDir(), outFilepath);
39
+ fileSystem.copyFile(dep.filepath, filepath);
40
+ }
41
+ return {
42
+ filepath,
43
+ content,
44
+ kind: "script",
45
+ position: dep.position,
46
+ attributes: dep.attributes,
47
+ inline: dep.inline,
48
+ excludeFromHtml: dep.excludeFromHtml
49
+ };
50
+ }
51
+ const relativeFilepath = path.relative(this.appConfig.absolutePaths.srcDir, dep.filepath);
52
+ const outdirPath = path.join(this.appConfig.absolutePaths.distDir, RESOLVED_ASSETS_DIR, relativeFilepath);
53
+ const outdirDirname = path.dirname(outdirPath);
54
+ const bundlerOptions = this.getBundlerOptions(dep);
55
+ const bundledFilePath = await this.bundleScript({
56
+ entrypoint: dep.filepath,
57
+ outdir: outdirDirname,
58
+ minify: this.isProduction,
59
+ ...bundlerOptions,
60
+ plugins: bundlerOptions.plugins
61
+ });
62
+ return {
63
+ filepath: bundledFilePath,
64
+ content: dep.inline ? fileSystem.readFileSync(bundledFilePath).toString() : void 0,
65
+ kind: "script",
66
+ position: dep.position,
67
+ attributes: dep.attributes,
68
+ inline: dep.inline,
69
+ excludeFromHtml: dep.excludeFromHtml
70
+ };
71
+ });
72
+ }
73
+ }
74
+ export {
75
+ FileScriptProcessor
76
+ };
@@ -0,0 +1,7 @@
1
+ import type { NodeModuleScriptAsset } from '../../assets.types';
2
+ import { BaseScriptProcessor } from '../base/base-script-processor';
3
+ export declare class NodeModuleScriptProcessor extends BaseScriptProcessor<NodeModuleScriptAsset> {
4
+ process(dep: NodeModuleScriptAsset): Promise<import("../../assets.types").ProcessedAsset>;
5
+ private resolveModulePath;
6
+ private resolveModulePathFallback;
7
+ }
@@ -0,0 +1,75 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { getAppBuildAdapter } from "../../../../../build/build-adapter.js";
4
+ import { BaseScriptProcessor } from "../base/base-script-processor";
5
+ class NodeModuleScriptProcessor extends BaseScriptProcessor {
6
+ async process(dep) {
7
+ const modulePath = this.resolveModulePath(dep.importPath, this.appConfig.rootDir);
8
+ const moduleName = path.basename(modulePath);
9
+ const filename = dep.name ?? `nm-${moduleName}`;
10
+ const configHash = this.generateHash(
11
+ JSON.stringify({ inline: dep.inline, minify: !dep.inline && this.isProduction, opts: dep.bundleOptions })
12
+ );
13
+ const cachekey = `${this.buildCacheKey(filename, this.generateHash(modulePath), dep)}:${configHash}`;
14
+ return this.getOrProcess(cachekey, async () => {
15
+ if (dep.inline) {
16
+ const content = fileSystem.readFileAsBuffer(modulePath).toString();
17
+ return {
18
+ content,
19
+ kind: dep.kind,
20
+ position: dep.position,
21
+ attributes: dep.attributes,
22
+ inline: true,
23
+ excludeFromHtml: dep.excludeFromHtml
24
+ };
25
+ }
26
+ const outdir = path.join(this.getAssetsDir(), "vendors");
27
+ const bundlerOptions = this.getBundlerOptions(dep);
28
+ const filePath = await this.bundleScript({
29
+ entrypoint: modulePath,
30
+ outdir,
31
+ minify: this.isProduction,
32
+ naming: bundlerOptions.naming ?? (dep.name ? `${dep.name}-[hash].[ext]` : "[name]-[hash].[ext]"),
33
+ ...bundlerOptions
34
+ });
35
+ return {
36
+ filepath: filePath,
37
+ kind: dep.kind,
38
+ position: dep.position,
39
+ attributes: dep.attributes,
40
+ inline: dep.inline,
41
+ excludeFromHtml: dep.excludeFromHtml
42
+ };
43
+ });
44
+ }
45
+ resolveModulePath(importPath, rootDir) {
46
+ if (path.isAbsolute(importPath) && fileSystem.exists(importPath)) {
47
+ return importPath;
48
+ }
49
+ try {
50
+ return getAppBuildAdapter(this.appConfig).resolve(importPath, rootDir);
51
+ } catch {
52
+ return this.resolveModulePathFallback(importPath, rootDir);
53
+ }
54
+ }
55
+ resolveModulePathFallback(importPath, rootDir, maxDepth = 5) {
56
+ let currentDir = rootDir;
57
+ let remainingDepth = maxDepth;
58
+ while (remainingDepth >= 0) {
59
+ const modulePath = path.join(currentDir, "node_modules", importPath);
60
+ if (fileSystem.exists(modulePath)) {
61
+ return modulePath;
62
+ }
63
+ const parentDir = path.dirname(currentDir);
64
+ if (parentDir === currentDir) {
65
+ break;
66
+ }
67
+ currentDir = parentDir;
68
+ remainingDepth -= 1;
69
+ }
70
+ throw new Error(`Could not resolve module '${importPath}' from '${rootDir}'`);
71
+ }
72
+ }
73
+ export {
74
+ NodeModuleScriptProcessor
75
+ };
@@ -0,0 +1,5 @@
1
+ import type { ContentStylesheetAsset, ProcessedAsset } from '../../assets.types';
2
+ import { BaseProcessor } from '../base/base-processor';
3
+ export declare class ContentStylesheetProcessor extends BaseProcessor<ContentStylesheetAsset> {
4
+ process(dep: ContentStylesheetAsset): Promise<ProcessedAsset>;
5
+ }
@@ -0,0 +1,25 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { BaseProcessor } from "../base/base-processor";
4
+ class ContentStylesheetProcessor extends BaseProcessor {
5
+ async process(dep) {
6
+ const hash = this.generateHash(dep.content);
7
+ const filename = `style-${hash}.css`;
8
+ const cachekey = this.buildCacheKey(filename, hash, dep);
9
+ return this.getOrProcess(cachekey, () => {
10
+ const filepath = path.join(this.getAssetsDir(), "styles", filename);
11
+ if (!dep.inline) fileSystem.write(filepath, dep.content);
12
+ return {
13
+ filepath: dep.inline ? void 0 : filepath,
14
+ content: dep.inline ? dep.content : void 0,
15
+ kind: "stylesheet",
16
+ position: dep.position,
17
+ attributes: dep.attributes,
18
+ inline: dep.inline
19
+ };
20
+ });
21
+ }
22
+ }
23
+ export {
24
+ ContentStylesheetProcessor
25
+ };
@@ -0,0 +1,9 @@
1
+ import type { FileStylesheetAsset, ProcessedAsset } from '../../assets.types';
2
+ import { BaseProcessor } from '../base/base-processor';
3
+ export declare class FileStylesheetProcessor extends BaseProcessor<FileStylesheetAsset> {
4
+ private static readonly PROCESSABLE_STYLESHEET_EXTENSIONS;
5
+ getStyleContent: (srcUrl: string) => Buffer;
6
+ private isProcessableStylesheet;
7
+ private applyStylesheetProcessors;
8
+ process(dep: FileStylesheetAsset): Promise<ProcessedAsset>;
9
+ }
@@ -0,0 +1,66 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { BaseProcessor } from "../base/base-processor";
4
+ class FileStylesheetProcessor extends BaseProcessor {
5
+ static PROCESSABLE_STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".scss", ".sass", ".less"]);
6
+ getStyleContent = (srcUrl) => {
7
+ return fileSystem.readFileAsBuffer(srcUrl);
8
+ };
9
+ isProcessableStylesheet(filepath) {
10
+ return FileStylesheetProcessor.PROCESSABLE_STYLESHEET_EXTENSIONS.has(path.extname(filepath));
11
+ }
12
+ async applyStylesheetProcessors(content, filepath) {
13
+ if (!this.isProcessableStylesheet(filepath)) {
14
+ return content;
15
+ }
16
+ let transformedContent = content;
17
+ for (const processor of this.appConfig.processors.values()) {
18
+ const hasCapabilities = processor.getAssetCapabilities().length > 0;
19
+ const canProcessStylesheet = processor.canProcessAsset("stylesheet", filepath);
20
+ if (!canProcessStylesheet && (hasCapabilities || !processor.getName().includes("postcss"))) {
21
+ continue;
22
+ }
23
+ if (!processor.matchesFileFilter(filepath)) {
24
+ continue;
25
+ }
26
+ const result = await processor.process(transformedContent, filepath);
27
+ if (typeof result === "string") {
28
+ transformedContent = result;
29
+ continue;
30
+ }
31
+ if (result instanceof Buffer) {
32
+ transformedContent = result.toString();
33
+ }
34
+ }
35
+ return transformedContent;
36
+ }
37
+ async process(dep) {
38
+ const buffer = this.getStyleContent(dep.filepath);
39
+ const rawContent = buffer.toString();
40
+ const processedContent = await this.applyStylesheetProcessors(rawContent, dep.filepath);
41
+ const hash = this.generateHash(processedContent);
42
+ const cachekey = this.buildCacheKey(dep.filepath, hash, dep);
43
+ return this.getOrProcess(cachekey, () => {
44
+ const filepath = path.join(
45
+ this.getAssetsDir(),
46
+ path.relative(this.appConfig.absolutePaths.srcDir, dep.filepath)
47
+ );
48
+ const outputBuffer = Buffer.from(processedContent);
49
+ if (!dep.inline) {
50
+ fileSystem.ensureDir(path.dirname(filepath));
51
+ fileSystem.write(filepath, outputBuffer);
52
+ }
53
+ return {
54
+ filepath,
55
+ content: dep.inline ? processedContent : void 0,
56
+ kind: "stylesheet",
57
+ position: dep.position,
58
+ attributes: dep.attributes,
59
+ inline: dep.inline
60
+ };
61
+ });
62
+ }
63
+ }
64
+ export {
65
+ FileStylesheetProcessor
66
+ };
@@ -0,0 +1,32 @@
1
+ import type { BuildOptions, BuildResult, BuildTranspileProfile } from '../../build/build-adapter.js';
2
+ import type { EcoPagesAppConfig } from '../../internal-types.js';
3
+ export type BrowserBundleOptions = Omit<BuildOptions, 'target' | 'format' | 'sourcemap'> & {
4
+ profile: BuildTranspileProfile;
5
+ };
6
+ export interface BrowserBundleExecutor {
7
+ bundle(options: BrowserBundleOptions): Promise<BuildResult>;
8
+ }
9
+ /**
10
+ * App-owned boundary for browser-oriented bundle work.
11
+ *
12
+ * @remarks
13
+ * This service owns the shared browser transpile defaults and ensures browser
14
+ * builds always run through the app-owned executor rather than direct backend
15
+ * calls scattered across HMR and asset processing paths.
16
+ */
17
+ export declare class BrowserBundleService implements BrowserBundleExecutor {
18
+ private readonly appConfig;
19
+ /**
20
+ * Creates the browser bundle boundary for one finalized app instance.
21
+ */
22
+ constructor(appConfig: EcoPagesAppConfig);
23
+ /**
24
+ * Runs one browser-targeted build through the app-owned executor.
25
+ *
26
+ * @remarks
27
+ * Browser defaults and app-owned browser build plugins are applied here so HMR
28
+ * and runtime asset generation do not have to recreate that policy at each call
29
+ * site.
30
+ */
31
+ bundle(options: BrowserBundleOptions): Promise<BuildResult>;
32
+ }