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

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,353 @@
1
+ import path from "node:path";
2
+ import { DEFAULT_ECOPAGES_WORK_DIR } from "../constants.js";
3
+ import { appLogger } from "../global/app-logger.js";
4
+ import { fileSystem } from "@ecopages/file-system";
5
+ import { PathUtils } from "../utils/path-utils.module.js";
6
+ import { getAppServerModuleTranspiler } from "../services/module-loading/app-server-module-transpiler.service.js";
7
+ const STATIC_SITE_GENERATOR_ERRORS = {
8
+ ROUTE_RENDERER_FACTORY_REQUIRED: "RouteRendererFactory is required for render strategy",
9
+ unsupportedBodyType: (bodyType) => `Unsupported body type for static generation: ${bodyType}`,
10
+ missingIntegration: (routePath) => `View at ${routePath} is missing __eco.integration. Ensure it's defined with eco.page().`,
11
+ noRendererForIntegration: (integrationName) => `No renderer found for integration: ${integrationName}`,
12
+ dynamicRouteRequiresStaticPaths: (routePath) => `Dynamic route ${routePath} requires staticPaths to be defined on the view.`
13
+ };
14
+ class StaticSiteGenerator {
15
+ appConfig;
16
+ serverModuleTranspiler;
17
+ /**
18
+ * Creates the static-site generator for one app config.
19
+ */
20
+ constructor({ appConfig }) {
21
+ this.appConfig = appConfig;
22
+ this.serverModuleTranspiler = getAppServerModuleTranspiler(appConfig);
23
+ }
24
+ /**
25
+ * Returns the transpiler output directory used for static page-module probes.
26
+ */
27
+ getStaticPageModuleOutdir() {
28
+ const workDir = this.appConfig.absolutePaths?.workDir ?? path.join(this.appConfig.rootDir, this.appConfig.workDir ?? DEFAULT_ECOPAGES_WORK_DIR);
29
+ return path.join(workDir, ".server-static-page-modules");
30
+ }
31
+ getExportDir() {
32
+ return this.appConfig.absolutePaths?.distDir ?? path.join(this.appConfig.rootDir, this.appConfig.distDir);
33
+ }
34
+ /**
35
+ * Logs the standardized warning emitted when a dynamic-cache page is skipped.
36
+ */
37
+ warnDynamicPageSkipped(filePath) {
38
+ appLogger.warn(
39
+ "Pages with cache: 'dynamic' are not supported in static generation or preview, so they will be skipped\n",
40
+ `\u27A4 ${filePath}`
41
+ );
42
+ }
43
+ /**
44
+ * Determines whether one filesystem-discovered page should be excluded from
45
+ * static generation.
46
+ */
47
+ async shouldSkipStaticPageFile(filePath) {
48
+ const module = await this.serverModuleTranspiler.importModule({
49
+ filePath,
50
+ outdir: this.getStaticPageModuleOutdir(),
51
+ externalPackages: false,
52
+ transpileErrorMessage: (details) => `Error transpiling static page module: ${details}`,
53
+ noOutputMessage: (targetFilePath) => `No transpiled output generated for static page module: ${targetFilePath}`
54
+ });
55
+ if (module.default?.cache !== "dynamic") {
56
+ return false;
57
+ }
58
+ this.warnDynamicPageSkipped(filePath);
59
+ return true;
60
+ }
61
+ /**
62
+ * Determines whether one explicit static route view should be excluded from
63
+ * static generation.
64
+ */
65
+ shouldSkipStaticView(routePath, view) {
66
+ if (view.cache !== "dynamic") {
67
+ return false;
68
+ }
69
+ this.warnDynamicPageSkipped(routePath);
70
+ return true;
71
+ }
72
+ /**
73
+ * Writes the robots.txt file declared by the app config.
74
+ */
75
+ generateRobotsTxt() {
76
+ let data = "";
77
+ const preferences = this.appConfig.robotsTxt.preferences;
78
+ for (const userAgent in preferences) {
79
+ data += `user-agent: ${userAgent}
80
+ `;
81
+ for (const path2 of preferences[userAgent]) {
82
+ data += `disallow: ${path2}
83
+ `;
84
+ }
85
+ data += "\n";
86
+ }
87
+ fileSystem.ensureDir(this.getExportDir());
88
+ fileSystem.write(path.join(this.getExportDir(), "robots.txt"), data);
89
+ }
90
+ /**
91
+ * Returns whether the input path points at the root directory.
92
+ */
93
+ isRootDir(path2) {
94
+ const slashes = path2.match(/\//g);
95
+ return slashes && slashes.length === 1;
96
+ }
97
+ /**
98
+ * Collects parent directories that must exist for the generated route set.
99
+ */
100
+ getDirectories(routes) {
101
+ const directories = /* @__PURE__ */ new Set();
102
+ for (const route of routes) {
103
+ const path2 = route.startsWith("http") ? new URL(route).pathname : route;
104
+ const segments = path2.split("/");
105
+ if (segments.length > 2) {
106
+ directories.add(segments.slice(0, segments.length - 1).join("/"));
107
+ }
108
+ }
109
+ return Array.from(directories);
110
+ }
111
+ /**
112
+ * Extracts dynamic parameters from the actual path based on the template path.
113
+ *
114
+ * @param templatePath - The template path (e.g., "/blog/[slug]")
115
+ * @param actualPath - The actual path (e.g., "/blog/my-post")
116
+ * @returns A record of extracted parameters (e.g., { slug: "my-post" })
117
+ */
118
+ extractParams(templatePath, actualPath) {
119
+ const templateSegments = templateSegmentsFromPath(templatePath);
120
+ const actualSegments = templateSegmentsFromPath(actualPath);
121
+ const params = {};
122
+ for (let i = 0; i < templateSegments.length; i++) {
123
+ const segment = templateSegments[i];
124
+ if (segment.startsWith("[") && segment.endsWith("]")) {
125
+ const paramName = segment.slice(1, -1).replace("...", "");
126
+ params[paramName] = actualSegments[i];
127
+ }
128
+ }
129
+ return params;
130
+ }
131
+ /**
132
+ * Generates static output for all filesystem-discovered routes.
133
+ *
134
+ * @remarks
135
+ * Routes whose integrations opt into fetch-based static builds are rendered by
136
+ * issuing a request against the running server origin. Render-strategy routes
137
+ * go through the normal route renderer directly.
138
+ */
139
+ async generateStaticPages(router, baseUrl, routeRendererFactory) {
140
+ const routes = Object.keys(router.routes).filter((route) => !route.includes("["));
141
+ appLogger.debug("Static Pages", routes);
142
+ const directories = this.getDirectories(routes);
143
+ for (const directory of directories) {
144
+ fileSystem.ensureDir(path.join(this.getExportDir(), directory));
145
+ }
146
+ for (const route of routes) {
147
+ try {
148
+ const { filePath, pathname: routePathname } = router.routes[route];
149
+ if (await this.shouldSkipStaticPageFile(filePath)) {
150
+ continue;
151
+ }
152
+ const ext = PathUtils.getEcoTemplateExtension(filePath);
153
+ const integration = this.appConfig.integrations.find((plugin) => plugin.extensions.includes(ext));
154
+ const strategy = integration?.staticBuildStep || "render";
155
+ let contents;
156
+ if (strategy === "fetch") {
157
+ const fetchUrl = route.startsWith("http") ? route : `${baseUrl}${route}`;
158
+ const response = await fetch(fetchUrl);
159
+ if (!response.ok) {
160
+ appLogger.error(`Failed to fetch ${fetchUrl}. Status: ${response.status}`);
161
+ continue;
162
+ }
163
+ contents = await response.text();
164
+ } else {
165
+ if (!routeRendererFactory) {
166
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.ROUTE_RENDERER_FACTORY_REQUIRED);
167
+ }
168
+ let pathname2 = routePathname;
169
+ const pathnameSegments2 = pathname2.split("/").filter(Boolean);
170
+ if (pathname2 === "/") {
171
+ pathname2 = "/index.html";
172
+ } else if (pathnameSegments2.join("/").includes("[")) {
173
+ pathname2 = `${route.replace(router.origin, "")}.html`;
174
+ } else if (pathnameSegments2.length >= 1 && directories.includes(`/${pathnameSegments2.join("/")}`)) {
175
+ pathname2 = `${pathname2.endsWith("/") ? pathname2 : `${pathname2}/`}index.html`;
176
+ } else {
177
+ pathname2 += ".html";
178
+ }
179
+ const renderer = routeRendererFactory.createRenderer(filePath);
180
+ const params = this.extractParams(routePathname, pathname2.replace(".html", ""));
181
+ const result = await renderer.createRoute({
182
+ file: filePath,
183
+ params
184
+ });
185
+ const body = result.body;
186
+ if (typeof body === "string" || Buffer.isBuffer(body)) {
187
+ contents = body;
188
+ } else if (body instanceof ReadableStream) {
189
+ contents = await new Response(body).text();
190
+ } else {
191
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.unsupportedBodyType(typeof body));
192
+ }
193
+ }
194
+ let pathname = routePathname;
195
+ const pathnameSegments = pathname.split("/").filter(Boolean);
196
+ if (pathname === "/") {
197
+ pathname = "/index.html";
198
+ } else if (pathnameSegments.join("/").includes("[")) {
199
+ pathname = `${route.replace(router.origin, "")}.html`;
200
+ } else if (pathnameSegments.length >= 1 && directories.includes(`/${pathnameSegments.join("/")}`)) {
201
+ pathname = `${pathname.endsWith("/") ? pathname : `${pathname}/`}index.html`;
202
+ } else {
203
+ pathname += ".html";
204
+ }
205
+ const outputPath = path.join(this.getExportDir(), pathname);
206
+ fileSystem.write(outputPath, contents);
207
+ } catch (error) {
208
+ appLogger.error(
209
+ `Error generating static page for ${route}:`,
210
+ error instanceof Error ? error : String(error)
211
+ );
212
+ }
213
+ }
214
+ }
215
+ /**
216
+ * Executes the full static-generation workflow for one app run.
217
+ */
218
+ async run({
219
+ router,
220
+ baseUrl,
221
+ routeRendererFactory,
222
+ staticRoutes
223
+ }) {
224
+ this.generateRobotsTxt();
225
+ await this.generateStaticPages(router, baseUrl, routeRendererFactory);
226
+ if (staticRoutes && staticRoutes.length > 0 && routeRendererFactory) {
227
+ await this.generateExplicitStaticPages(staticRoutes, routeRendererFactory);
228
+ }
229
+ }
230
+ /**
231
+ * Generates static pages from explicit static routes registered via app.static().
232
+ * These routes use eco.page views via loader functions for HMR support.
233
+ */
234
+ async generateExplicitStaticPages(staticRoutes, routeRendererFactory) {
235
+ appLogger.debug(
236
+ "Generating explicit static routes",
237
+ staticRoutes.map((r) => r.path)
238
+ );
239
+ for (const route of staticRoutes) {
240
+ try {
241
+ const mod = await route.loader();
242
+ const view = mod.default;
243
+ if (this.shouldSkipStaticView(route.path, view)) {
244
+ continue;
245
+ }
246
+ const isDynamic = route.path.includes(":") || route.path.includes("[");
247
+ if (isDynamic) {
248
+ await this.generateDynamicStaticRoute(route.path, view, routeRendererFactory);
249
+ } else {
250
+ await this.generateSingleStaticRoute(route.path, view, routeRendererFactory);
251
+ }
252
+ } catch (error) {
253
+ appLogger.error(
254
+ `Error generating explicit static page for ${route.path}:`,
255
+ error instanceof Error ? error : String(error)
256
+ );
257
+ }
258
+ }
259
+ }
260
+ /**
261
+ * Generate a single static page for a non-dynamic route.
262
+ */
263
+ async generateSingleStaticRoute(routePath, view, routeRendererFactory) {
264
+ const integrationName = view.config?.__eco?.integration;
265
+ if (!integrationName) {
266
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.missingIntegration(routePath));
267
+ }
268
+ const renderer = routeRendererFactory.getRendererByIntegration(integrationName);
269
+ if (!renderer) {
270
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.noRendererForIntegration(integrationName));
271
+ }
272
+ const props = view.staticProps ? (await view.staticProps({
273
+ pathname: { params: {} },
274
+ appConfig: this.appConfig,
275
+ runtimeOrigin: this.appConfig.baseUrl
276
+ })).props : {};
277
+ const response = await renderer.renderToResponse(view, props, {});
278
+ const contents = await response.text();
279
+ const outputPath = this.getOutputPath(routePath);
280
+ fileSystem.ensureDir(path.dirname(outputPath));
281
+ fileSystem.write(outputPath, contents);
282
+ appLogger.debug(`Generated static page: ${routePath} -> ${outputPath}`);
283
+ }
284
+ /**
285
+ * Generate static pages for a dynamic route using staticPaths.
286
+ */
287
+ async generateDynamicStaticRoute(routePath, view, routeRendererFactory) {
288
+ if (!view.staticPaths) {
289
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.dynamicRouteRequiresStaticPaths(routePath));
290
+ }
291
+ const integrationName = view.config?.__eco?.integration;
292
+ if (!integrationName) {
293
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.missingIntegration(routePath));
294
+ }
295
+ const renderer = routeRendererFactory.getRendererByIntegration(integrationName);
296
+ if (!renderer) {
297
+ throw new Error(STATIC_SITE_GENERATOR_ERRORS.noRendererForIntegration(integrationName));
298
+ }
299
+ const { paths } = await view.staticPaths({
300
+ appConfig: this.appConfig,
301
+ runtimeOrigin: this.appConfig.baseUrl
302
+ });
303
+ for (const { params } of paths) {
304
+ const resolvedPath = this.resolveRoutePath(routePath, params);
305
+ const props = view.staticProps ? (await view.staticProps({
306
+ pathname: { params },
307
+ appConfig: this.appConfig,
308
+ runtimeOrigin: this.appConfig.baseUrl
309
+ })).props : {};
310
+ const response = await renderer.renderToResponse(view, props, {});
311
+ const contents = await response.text();
312
+ const outputPath = this.getOutputPath(resolvedPath);
313
+ fileSystem.ensureDir(path.dirname(outputPath));
314
+ fileSystem.write(outputPath, contents);
315
+ appLogger.debug(`Generated static page: ${resolvedPath} -> ${outputPath}`);
316
+ }
317
+ }
318
+ /**
319
+ * Resolve a route path template with actual params.
320
+ * Supports both :param and [param] syntax.
321
+ */
322
+ resolveRoutePath(routePath, params) {
323
+ let resolved = routePath;
324
+ for (const [key, value] of Object.entries(params)) {
325
+ const paramValue = Array.isArray(value) ? value.join("/") : value;
326
+ resolved = resolved.replace(`:${key}`, paramValue);
327
+ resolved = resolved.replace(`[${key}]`, paramValue);
328
+ resolved = resolved.replace(`[...${key}]`, paramValue);
329
+ }
330
+ return resolved;
331
+ }
332
+ /**
333
+ * Get the output file path for a given route.
334
+ */
335
+ getOutputPath(routePath) {
336
+ let outputName;
337
+ if (routePath === "/") {
338
+ outputName = "index.html";
339
+ } else if (routePath.endsWith("/")) {
340
+ outputName = `${routePath}index.html`;
341
+ } else {
342
+ outputName = `${routePath}.html`;
343
+ }
344
+ return path.join(this.getExportDir(), outputName);
345
+ }
346
+ }
347
+ function templateSegmentsFromPath(path2) {
348
+ return path2.split("/").filter(Boolean);
349
+ }
350
+ export {
351
+ STATIC_SITE_GENERATOR_ERRORS,
352
+ StaticSiteGenerator
353
+ };
@@ -0,0 +1 @@
1
+ export declare const css: (strings: TemplateStringsArray, ...values: any[]) => Promise<string>;
@@ -0,0 +1,7 @@
1
+ const css = async (strings, ...values) => {
2
+ const css2 = strings.reduce((acc, str, i) => acc + str + (values[i] || ""), "");
3
+ return css2;
4
+ };
5
+ export {
6
+ css
7
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This module contains a simple utility function to merge two objects deeply
3
+ * @module
4
+ */
5
+ /**
6
+ * Deeply merges two objects or arrays
7
+ * @function deepMerge
8
+ * @template T - Type of target object
9
+ * @template U - Type of source object
10
+ * @param target - The target object to merge into
11
+ * @param source - The source object to merge from
12
+ * @returns A new object with merged properties
13
+ */
14
+ export declare function deepMerge<T, U>(target: T, source: U): T & U;
@@ -0,0 +1,32 @@
1
+ function isObject(item) {
2
+ return item && typeof item === "object" && !Array.isArray(item);
3
+ }
4
+ function isArray(item) {
5
+ return Array.isArray(item);
6
+ }
7
+ function deepMerge(target, source) {
8
+ if (isArray(target) && isArray(source)) {
9
+ return [...target, ...source];
10
+ }
11
+ if (!isObject(target) || !isObject(source)) {
12
+ return source;
13
+ }
14
+ const output = Object.assign({}, target);
15
+ for (const key in source) {
16
+ if (isObject(source[key])) {
17
+ if (!target[key]) {
18
+ Object.assign(output, { [key]: source[key] });
19
+ } else {
20
+ output[key] = deepMerge(target[key], source[key]);
21
+ }
22
+ } else if (isArray(source[key])) {
23
+ output[key] = [...target[key] || [], ...source[key]];
24
+ } else if (source[key] !== void 0) {
25
+ Object.assign(output, { [key]: source[key] });
26
+ }
27
+ }
28
+ return output;
29
+ }
30
+ export {
31
+ deepMerge
32
+ };
@@ -0,0 +1 @@
1
+ export declare const rapidhash: (content: string | Buffer<ArrayBufferLike>) => number | bigint;
@@ -0,0 +1,7 @@
1
+ import { runtimeHash } from "./runtime.js";
2
+ const rapidhash = (content) => {
3
+ return runtimeHash(content);
4
+ };
5
+ export {
6
+ rapidhash
7
+ };
@@ -0,0 +1 @@
1
+ export { html } from 'ghtml';
@@ -0,0 +1,4 @@
1
+ import { html } from "ghtml";
2
+ export {
3
+ html
4
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This module contains a simple utility invariant function that throws an error if the condition is not met
3
+ * @module
4
+ */
5
+ export declare function invariant(condition: boolean, message?: string): asserts condition;
@@ -0,0 +1,11 @@
1
+ const prefix = "[ecopages]";
2
+ function invariant(condition, message) {
3
+ if (condition) {
4
+ return;
5
+ }
6
+ const value = message ? `${prefix} ${message}` : `${prefix} An error occurred`;
7
+ throw new Error(value);
8
+ }
9
+ export {
10
+ invariant
11
+ };
@@ -0,0 +1,15 @@
1
+ import type { ApiHandlerContext } from '../public-types.js';
2
+ /**
3
+ * Creates a require function for validating and retrieving request locals.
4
+ * Supports both single key access and multiple keys with type safety.
5
+ *
6
+ * @param getLocals - Function that returns the current locals object
7
+ * @returns A require function that throws the onMissing response if keys are not found
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const require = createRequire(() => context.locals);
12
+ * const userId = require('userId', () => new Response('Unauthorized', { status: 401 }));
13
+ * ```
14
+ */
15
+ export declare function createRequire(getLocals: () => Record<string, unknown>): ApiHandlerContext['require'];
@@ -0,0 +1,24 @@
1
+ function createRequire(getLocals) {
2
+ return (keyOrKeys, onMissing) => {
3
+ const locals = getLocals();
4
+ if (Array.isArray(keyOrKeys)) {
5
+ const result = {};
6
+ for (const key of keyOrKeys) {
7
+ const value2 = locals[key];
8
+ if (value2 === void 0 || value2 === null) {
9
+ throw onMissing();
10
+ }
11
+ result[key] = value2;
12
+ }
13
+ return result;
14
+ }
15
+ const value = locals[keyOrKeys];
16
+ if (value === void 0 || value === null) {
17
+ throw onMissing();
18
+ }
19
+ return value;
20
+ };
21
+ }
22
+ export {
23
+ createRequire
24
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Parsed command line arguments for the Ecopages server.
3
+ * @property preview - Whether to run in preview mode
4
+ * @property build - Whether to run a static build
5
+ * @property start - Whether to start the server
6
+ * @property dev - Whether to run in development mode
7
+ * @property port - Optional port number
8
+ * @property hostname - Optional hostname
9
+ * @property reactFastRefresh - Whether React Fast Refresh is enabled
10
+ */
11
+ export type ReturnParseCliArgs = {
12
+ preview: boolean;
13
+ build: boolean;
14
+ start: boolean;
15
+ dev: boolean;
16
+ port?: number;
17
+ hostname?: string;
18
+ reactFastRefresh?: boolean;
19
+ };
20
+ /**
21
+ * Parses command line arguments for the server.
22
+ * It returns {@link ReturnParseCliArgs}
23
+ */
24
+ export declare function parseCliArgs(): ReturnParseCliArgs;
@@ -0,0 +1,47 @@
1
+ import { parseArgs } from "node:util";
2
+ import { getRuntimeArgv } from "./runtime.js";
3
+ const ECOPAGES_BIN_FILES = ["ecopages.ts", "ecopages.js", "cli.js"];
4
+ const ECOPAGES_AVAILABLE_COMMANDS = ["dev", "build", "start", "preview"];
5
+ function parseCliArgs() {
6
+ const runtimeArgv = getRuntimeArgv();
7
+ const { values } = parseArgs({
8
+ args: runtimeArgv,
9
+ options: {
10
+ dev: { type: "boolean" },
11
+ preview: { type: "boolean" },
12
+ build: { type: "boolean" },
13
+ port: { type: "string" },
14
+ hostname: { type: "string" },
15
+ "react-fast-refresh": { type: "boolean" }
16
+ },
17
+ allowPositionals: true
18
+ });
19
+ let command = "";
20
+ const ecopagesIndex = runtimeArgv.findIndex((arg) => ECOPAGES_BIN_FILES.some((filename) => arg.endsWith(filename)));
21
+ const isAvailableCommand = ecopagesIndex !== -1;
22
+ if (isAvailableCommand) {
23
+ command = ecopagesIndex < runtimeArgv.length - 1 && ECOPAGES_AVAILABLE_COMMANDS.some((cmd) => {
24
+ return runtimeArgv[ecopagesIndex + 1] === cmd;
25
+ }) ? runtimeArgv[ecopagesIndex + 1] : "start";
26
+ }
27
+ const isStartCommand = command === "start" || !values.dev && !values.build && !values.preview;
28
+ const isDevCommand = command === "dev" || !!values.dev;
29
+ const isBuildCommand = command === "build" || !!values.build;
30
+ const isPreviewCommand = command === "preview" || !!values.preview;
31
+ const parsedCommandOptions = {
32
+ preview: isPreviewCommand,
33
+ build: isBuildCommand,
34
+ start: isStartCommand,
35
+ dev: isDevCommand,
36
+ port: values.port ? Number(values.port) : void 0,
37
+ hostname: values.hostname,
38
+ reactFastRefresh: values["react-fast-refresh"]
39
+ };
40
+ if (!process.env.NODE_ENV) {
41
+ process.env.NODE_ENV = isDevCommand ? "development" : "production";
42
+ }
43
+ return parsedCommandOptions;
44
+ }
45
+ export {
46
+ parseCliArgs
47
+ };
@@ -0,0 +1,5 @@
1
+ declare function getEcoTemplateExtension(filePath: string): string;
2
+ export declare const PathUtils: {
3
+ getEcoTemplateExtension: typeof getEcoTemplateExtension;
4
+ };
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import path from "node:path";
2
+ function getEcoTemplateExtension(filePath) {
3
+ const { name, ext } = path.parse(filePath);
4
+ const nameParts = name.split(".");
5
+ const descriptor = nameParts.length > 1 ? nameParts.pop() : void 0;
6
+ const templateExtension = descriptor ? `.${descriptor}${ext}` : ext;
7
+ return templateExtension;
8
+ }
9
+ const PathUtils = {
10
+ getEcoTemplateExtension
11
+ };
12
+ export {
13
+ PathUtils
14
+ };
@@ -0,0 +1,11 @@
1
+ type InternalPathConfig = {
2
+ rootDir?: string;
3
+ workDir?: string;
4
+ absolutePaths?: {
5
+ workDir?: string;
6
+ distDir?: string;
7
+ };
8
+ };
9
+ export declare function resolveInternalWorkDir(appConfig: InternalPathConfig): string;
10
+ export declare function resolveInternalExecutionDir(appConfig: InternalPathConfig): string;
11
+ export {};
@@ -0,0 +1,31 @@
1
+ import path from "node:path";
2
+ import { DEFAULT_ECOPAGES_WORK_DIR } from "../constants.js";
3
+ function isInsideNodeModules(directory) {
4
+ return path.normalize(directory).split(path.sep).includes("node_modules");
5
+ }
6
+ function resolveInternalWorkDir(appConfig) {
7
+ if (appConfig.absolutePaths?.workDir) {
8
+ return appConfig.absolutePaths.workDir;
9
+ }
10
+ if (appConfig.rootDir) {
11
+ return path.join(appConfig.rootDir, appConfig.workDir ?? DEFAULT_ECOPAGES_WORK_DIR);
12
+ }
13
+ if (appConfig.workDir) {
14
+ return appConfig.workDir;
15
+ }
16
+ return DEFAULT_ECOPAGES_WORK_DIR;
17
+ }
18
+ function resolveInternalExecutionDir(appConfig) {
19
+ const workDir = resolveInternalWorkDir(appConfig);
20
+ if (!isInsideNodeModules(workDir)) {
21
+ return workDir;
22
+ }
23
+ if (appConfig.rootDir) {
24
+ return path.join(appConfig.rootDir, DEFAULT_ECOPAGES_WORK_DIR);
25
+ }
26
+ return DEFAULT_ECOPAGES_WORK_DIR;
27
+ }
28
+ export {
29
+ resolveInternalExecutionDir,
30
+ resolveInternalWorkDir
31
+ };
@@ -0,0 +1,11 @@
1
+ export declare const RUNTIME_ERRORS: {
2
+ readonly BUN_RUNTIME_REQUIRED: "Bun runtime is required";
3
+ };
4
+ type RuntimeBun = typeof Bun;
5
+ export declare function getBunRuntime(): RuntimeBun | undefined;
6
+ export declare function getRequiredBunRuntime(): RuntimeBun;
7
+ export declare function getRuntimeArgv(): string[];
8
+ export declare function isDevelopmentRuntime(): boolean;
9
+ export declare function isProductionRuntime(): boolean;
10
+ export declare function runtimeHash(content: string | Buffer<ArrayBufferLike>): number | bigint;
11
+ export {};