@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,40 @@
1
+ import { createHash } from "node:crypto";
2
+ const RUNTIME_ERRORS = {
3
+ BUN_RUNTIME_REQUIRED: "Bun runtime is required"
4
+ };
5
+ function getBunRuntime() {
6
+ return globalThis.Bun;
7
+ }
8
+ function getRequiredBunRuntime() {
9
+ const bun = getBunRuntime();
10
+ if (!bun) {
11
+ throw new Error(RUNTIME_ERRORS.BUN_RUNTIME_REQUIRED);
12
+ }
13
+ return bun;
14
+ }
15
+ function getRuntimeArgv() {
16
+ return process.argv;
17
+ }
18
+ function isDevelopmentRuntime() {
19
+ return process.env.NODE_ENV === "development";
20
+ }
21
+ function isProductionRuntime() {
22
+ return process.env.NODE_ENV === "production";
23
+ }
24
+ function runtimeHash(content) {
25
+ const bun = getBunRuntime();
26
+ if (bun) {
27
+ return bun.hash(content);
28
+ }
29
+ const hex = createHash("sha256").update(content).digest("hex").slice(0, 16);
30
+ return BigInt(`0x${hex}`);
31
+ }
32
+ export {
33
+ RUNTIME_ERRORS,
34
+ getBunRuntime,
35
+ getRequiredBunRuntime,
36
+ getRuntimeArgv,
37
+ isDevelopmentRuntime,
38
+ isProductionRuntime,
39
+ runtimeHash
40
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Get the content type of a file based on its extension.
3
+ * @param file - The file name.
4
+ * @returns The content type.
5
+ */
6
+ export declare const getContentType: (file: string) => string;
7
+ /**
8
+ * Check if a file path has a known static file extension.
9
+ * @param file - The file name or path.
10
+ * @returns true if the extension is recognized.
11
+ */
12
+ export declare const hasKnownExtension: (file: string) => boolean;
13
+ /**
14
+ * A module for server utilities.
15
+ */
16
+ export declare const ServerUtils: {
17
+ getContentType: (file: string) => string;
18
+ hasKnownExtension: (file: string) => boolean;
19
+ };
@@ -0,0 +1,56 @@
1
+ const ContentTypeMap = /* @__PURE__ */ new Map([
2
+ ["jpg", "image/jpeg"],
3
+ ["jpeg", "image/jpeg"],
4
+ ["png", "image/png"],
5
+ ["gif", "image/gif"],
6
+ ["bmp", "image/bmp"],
7
+ ["svg", "image/svg+xml"],
8
+ ["tiff", "image/tiff"],
9
+ ["webp", "image/webp"],
10
+ ["avif", "image/avif"],
11
+ ["ico", "image/x-icon"],
12
+ ["mp3", "audio/mpeg"],
13
+ ["ogg", "audio/ogg"],
14
+ ["wav", "audio/wav"],
15
+ ["mp4", "video/mp4"],
16
+ ["webm", "video/webm"],
17
+ ["ogv", "video/ogg"],
18
+ ["mov", "video/quicktime"],
19
+ ["txt", "text/plain"],
20
+ ["html", "text/html"],
21
+ ["css", "text/css"],
22
+ ["js", "text/javascript"],
23
+ ["mjs", "text/javascript"],
24
+ ["json", "application/json"],
25
+ ["map", "application/json"],
26
+ ["xml", "application/xml"],
27
+ ["webmanifest", "application/manifest+json"],
28
+ ["wasm", "application/wasm"],
29
+ ["csv", "text/csv"],
30
+ ["ttf", "font/ttf"],
31
+ ["woff", "font/woff"],
32
+ ["woff2", "font/woff2"],
33
+ ["otf", "font/otf"],
34
+ ["eot", "application/vnd.ms-fontobject"],
35
+ ["gz", "application/x-gzip"],
36
+ ["zip", "application/zip"],
37
+ ["pdf", "application/pdf"],
38
+ ["doc", "application/msword"]
39
+ ]);
40
+ const getContentType = (file) => {
41
+ const extension = file.split(".").pop() || "txt";
42
+ return ContentTypeMap.get(extension) || "text/plain";
43
+ };
44
+ const hasKnownExtension = (file) => {
45
+ const extension = file.split(".").pop();
46
+ return extension !== void 0 && ContentTypeMap.has(extension);
47
+ };
48
+ const ServerUtils = {
49
+ getContentType,
50
+ hasKnownExtension
51
+ };
52
+ export {
53
+ ServerUtils,
54
+ getContentType,
55
+ hasKnownExtension
56
+ };
@@ -0,0 +1,136 @@
1
+ import { type FSWatcher } from 'chokidar';
2
+ import type { EcoPagesAppConfig, IHmrManager, IClientBridge } from '../internal-types.js';
3
+ /**
4
+ * Configuration options for the ProjectWatcher
5
+ * @interface ProjectWatcherConfig
6
+ * @property {EcoPagesAppConfig} config - The application configuration
7
+ * @property {() => void} refreshRouterRoutesCallback - Callback to refresh router routes
8
+ * @property {IHmrManager} hmrManager - The HMR manager instance
9
+ * @property {ClientBridge} bridge - The client bridge instance
10
+ */
11
+ export interface ProjectWatcherConfig {
12
+ config: EcoPagesAppConfig;
13
+ refreshRouterRoutesCallback: () => void;
14
+ hmrManager: IHmrManager;
15
+ bridge: IClientBridge;
16
+ }
17
+ /**
18
+ * ProjectWatcher handles file system changes for hot module replacement (HMR).
19
+ * It uses chokidar to watch for file changes and triggers appropriate actions:
20
+ * - Uncaches modules when files change
21
+ * - Refreshes router routes for page files
22
+ * - Triggers HMR server reload
23
+ * - Handles processor-specific file changes
24
+ *
25
+ * The watcher uses chokidar's built-in debouncing through `awaitWriteFinish`
26
+ * to handle rapid file changes efficiently:
27
+ * - stabilityThreshold: 50ms - Time to wait for writes to stabilize
28
+ * - pollInterval: 50ms - Interval to poll for file changes
29
+ *
30
+ * @class ProjectWatcher
31
+ */
32
+ export declare class ProjectWatcher {
33
+ /**
34
+ * Duplicate identical watcher events within this window are ignored.
35
+ *
36
+ * Some editors or save pipelines emit two near-identical filesystem change
37
+ * notifications for the same file. Ecopages should treat those as one logical
38
+ * update so HMR and route refresh work are not repeated unnecessarily.
39
+ */
40
+ private static readonly duplicateChangeWindowMs;
41
+ private appConfig;
42
+ private refreshRouterRoutesCallback;
43
+ private hmrManager;
44
+ private bridge;
45
+ private readonly invalidationService;
46
+ private watcher;
47
+ private lastHandledChange;
48
+ private changeQueue;
49
+ constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge }: ProjectWatcherConfig);
50
+ /**
51
+ * Uncaches modules in the source directory to ensure fresh imports.
52
+ * This is necessary for hot module replacement to work correctly.
53
+ * @private
54
+ */
55
+ private uncacheModules;
56
+ private isRouteSourceFile;
57
+ private isIncludeSourceFile;
58
+ /**
59
+ * Handles public directory file changes by copying only the changed file.
60
+ * @param filePath - Absolute path of the changed file
61
+ */
62
+ private handlePublicDirFileChange;
63
+ /**
64
+ * Serializes file change handling so that concurrent chokidar events are
65
+ * processed one at a time, preventing overlapping builds and race conditions.
66
+ */
67
+ private enqueueChange;
68
+ /**
69
+ * Handles file changes by uncaching modules, refreshing routes, and delegating appropriately.
70
+ * Follows 5-rule priority:
71
+ * 0. Public directory match? -> copy file and reload
72
+ * 1. additionalWatchPaths match? -> reload
73
+ * 2. Include template source? -> reload after processor notifications
74
+ * 3. Processor-owned asset? -> processor already handled it via notification, skip HMR
75
+ * 4. Otherwise -> HMR strategies
76
+ *
77
+ * Processors that watch a file extension as a dependency (e.g. PostCSS watching
78
+ * .tsx for Tailwind class scanning) are always notified first, but do not
79
+ * prevent the file from flowing through the normal HMR strategy pipeline.
80
+ *
81
+ * Duplicate identical watcher events for the same file are coalesced within a
82
+ * short window before any of the priority rules run.
83
+ * @param rawPath - Path of the changed file
84
+ * @param event - The type of file system event
85
+ */
86
+ private handleFileChange;
87
+ /**
88
+ * Notifies all processors whose watch config matches the given file extension.
89
+ * This is called before checking processor ownership so that dependency-only
90
+ * processors (e.g. PostCSS watching .tsx for class scanning) receive their
91
+ * notifications regardless of whether they own the file.
92
+ */
93
+ private notifyProcessors;
94
+ private getProcessorHandler;
95
+ /**
96
+ * Checks if a file is in the public directory.
97
+ */
98
+ private isPublicDirFile;
99
+ /**
100
+ * Checks if file path matches any additionalWatchPaths patterns.
101
+ */
102
+ private matchesAdditionalWatchPaths;
103
+ /**
104
+ * Checks if a file is handled by a processor.
105
+ * Processors that declare asset capabilities own those file types.
106
+ * Processors without capabilities fall back to checking watch extensions.
107
+ */
108
+ private isHandledByProcessor;
109
+ /**
110
+ * Triggers router refresh for page directory changes.
111
+ * This ensures the router is updated when pages are added or removed.
112
+ *
113
+ * @param {string} path - Path of the changed directory
114
+ */
115
+ triggerRouterRefresh(changedPath: string): void;
116
+ /**
117
+ * Handles and logs errors that occur during file watching.
118
+ *
119
+ * @param {unknown} error - The error to handle
120
+ */
121
+ handleError(error: unknown): void;
122
+ /**
123
+ * Creates and configures the file system watcher.
124
+ * This sets up:
125
+ * 1. Page file watching
126
+ * 2. Directory watching
127
+ * 3. Error handling
128
+ *
129
+ * Processor notifications are dispatched inside handleFileChange, ensuring
130
+ * a single unified event pipeline with no parallel chokidar bindings.
131
+ *
132
+ * Uses chokidar's built-in debouncing through `awaitWriteFinish` to handle
133
+ * rapid file changes efficiently.
134
+ */
135
+ createWatcherSubscription(): Promise<FSWatcher>;
136
+ }
@@ -0,0 +1,281 @@
1
+ import path from "node:path";
2
+ import chokidar, {} from "chokidar";
3
+ import { fileSystem } from "@ecopages/file-system";
4
+ import { appLogger } from "../global/app-logger.js";
5
+ import { DevelopmentInvalidationService } from "../services/invalidation/development-invalidation.service.js";
6
+ class ProjectWatcher {
7
+ /**
8
+ * Duplicate identical watcher events within this window are ignored.
9
+ *
10
+ * Some editors or save pipelines emit two near-identical filesystem change
11
+ * notifications for the same file. Ecopages should treat those as one logical
12
+ * update so HMR and route refresh work are not repeated unnecessarily.
13
+ */
14
+ static duplicateChangeWindowMs = 150;
15
+ appConfig;
16
+ refreshRouterRoutesCallback;
17
+ hmrManager;
18
+ bridge;
19
+ invalidationService;
20
+ watcher = null;
21
+ lastHandledChange = /* @__PURE__ */ new Map();
22
+ changeQueue = Promise.resolve();
23
+ constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge }) {
24
+ this.appConfig = config;
25
+ this.refreshRouterRoutesCallback = refreshRouterRoutesCallback;
26
+ this.hmrManager = hmrManager;
27
+ this.bridge = bridge;
28
+ this.invalidationService = new DevelopmentInvalidationService(config);
29
+ this.triggerRouterRefresh = this.triggerRouterRefresh.bind(this);
30
+ this.handleError = this.handleError.bind(this);
31
+ this.handleFileChange = this.handleFileChange.bind(this);
32
+ }
33
+ /**
34
+ * Uncaches modules in the source directory to ensure fresh imports.
35
+ * This is necessary for hot module replacement to work correctly.
36
+ * @private
37
+ */
38
+ uncacheModules() {
39
+ if (typeof require === "undefined") return;
40
+ const { srcDir, rootDir } = this.appConfig;
41
+ const regex = new RegExp(`${rootDir}/${srcDir}/.*`);
42
+ for (const key in require.cache) {
43
+ if (regex.test(key)) {
44
+ delete require.cache[key];
45
+ }
46
+ }
47
+ }
48
+ isRouteSourceFile(filePath) {
49
+ return this.invalidationService.isRouteSourceFile(filePath);
50
+ }
51
+ isIncludeSourceFile(filePath) {
52
+ return this.invalidationService.isIncludeSourceFile(filePath);
53
+ }
54
+ /**
55
+ * Handles public directory file changes by copying only the changed file.
56
+ * @param filePath - Absolute path of the changed file
57
+ */
58
+ async handlePublicDirFileChange(filePath) {
59
+ try {
60
+ const relativePath = path.relative(this.appConfig.absolutePaths.publicDir, filePath);
61
+ const destPath = path.join(this.appConfig.absolutePaths.distDir, relativePath);
62
+ if (fileSystem.exists(filePath)) {
63
+ const destDir = path.dirname(destPath);
64
+ fileSystem.ensureDir(destDir);
65
+ await fileSystem.copyFileAsync(filePath, destPath);
66
+ }
67
+ this.bridge.reload();
68
+ } catch (error) {
69
+ appLogger.error(`Failed to copy public file: ${error instanceof Error ? error.message : String(error)}`);
70
+ this.bridge.reload();
71
+ }
72
+ }
73
+ /**
74
+ * Serializes file change handling so that concurrent chokidar events are
75
+ * processed one at a time, preventing overlapping builds and race conditions.
76
+ */
77
+ enqueueChange(task) {
78
+ const queuedTask = this.changeQueue.then(task, task);
79
+ this.changeQueue = queuedTask.catch(() => void 0);
80
+ }
81
+ /**
82
+ * Handles file changes by uncaching modules, refreshing routes, and delegating appropriately.
83
+ * Follows 5-rule priority:
84
+ * 0. Public directory match? -> copy file and reload
85
+ * 1. additionalWatchPaths match? -> reload
86
+ * 2. Include template source? -> reload after processor notifications
87
+ * 3. Processor-owned asset? -> processor already handled it via notification, skip HMR
88
+ * 4. Otherwise -> HMR strategies
89
+ *
90
+ * Processors that watch a file extension as a dependency (e.g. PostCSS watching
91
+ * .tsx for Tailwind class scanning) are always notified first, but do not
92
+ * prevent the file from flowing through the normal HMR strategy pipeline.
93
+ *
94
+ * Duplicate identical watcher events for the same file are coalesced within a
95
+ * short window before any of the priority rules run.
96
+ * @param rawPath - Path of the changed file
97
+ * @param event - The type of file system event
98
+ */
99
+ async handleFileChange(rawPath, event = "change") {
100
+ const filePath = path.resolve(rawPath);
101
+ const now = Date.now();
102
+ const lastHandledAt = this.lastHandledChange.get(filePath);
103
+ if (lastHandledAt !== void 0 && now - lastHandledAt < ProjectWatcher.duplicateChangeWindowMs) {
104
+ return;
105
+ }
106
+ this.lastHandledChange.set(filePath, now);
107
+ try {
108
+ const plan = this.invalidationService.planFileChange(filePath);
109
+ if (plan.category === "public-asset") {
110
+ await this.handlePublicDirFileChange(filePath);
111
+ return;
112
+ }
113
+ this.uncacheModules();
114
+ if (plan.invalidateServerModules) {
115
+ this.invalidationService.invalidateServerModules([filePath]);
116
+ }
117
+ if (plan.refreshRoutes) {
118
+ this.refreshRouterRoutesCallback();
119
+ }
120
+ if (plan.category === "additional-watch") {
121
+ this.bridge.reload();
122
+ return;
123
+ }
124
+ await this.notifyProcessors(filePath, event);
125
+ if (plan.category === "include-source") {
126
+ this.bridge.reload();
127
+ return;
128
+ }
129
+ if (plan.processorHandledAsset) {
130
+ return;
131
+ }
132
+ if (plan.delegateToHmr) {
133
+ await this.hmrManager.handleFileChange(filePath);
134
+ }
135
+ } catch (error) {
136
+ if (error instanceof Error) {
137
+ this.bridge.error(error.message);
138
+ this.handleError(error);
139
+ }
140
+ }
141
+ }
142
+ /**
143
+ * Notifies all processors whose watch config matches the given file extension.
144
+ * This is called before checking processor ownership so that dependency-only
145
+ * processors (e.g. PostCSS watching .tsx for class scanning) receive their
146
+ * notifications regardless of whether they own the file.
147
+ */
148
+ async notifyProcessors(filePath, event) {
149
+ const ctx = { path: filePath, bridge: this.bridge };
150
+ for (const processor of this.appConfig.processors.values()) {
151
+ const watchConfig = processor.getWatchConfig();
152
+ if (!watchConfig) continue;
153
+ const { extensions = [] } = watchConfig;
154
+ if (extensions.length && !extensions.some((ext) => filePath.endsWith(ext))) {
155
+ continue;
156
+ }
157
+ const handler = this.getProcessorHandler(watchConfig, event);
158
+ if (handler) {
159
+ await handler(ctx);
160
+ }
161
+ }
162
+ }
163
+ getProcessorHandler(watchConfig, event) {
164
+ switch (event) {
165
+ case "change":
166
+ return watchConfig.onChange;
167
+ case "add":
168
+ return watchConfig.onCreate;
169
+ case "unlink":
170
+ return watchConfig.onDelete;
171
+ }
172
+ }
173
+ /**
174
+ * Checks if a file is in the public directory.
175
+ */
176
+ isPublicDirFile(filePath) {
177
+ return this.invalidationService.isPublicDirFile(filePath);
178
+ }
179
+ /**
180
+ * Checks if file path matches any additionalWatchPaths patterns.
181
+ */
182
+ matchesAdditionalWatchPaths(filePath) {
183
+ return this.invalidationService.matchesAdditionalWatchPaths(filePath);
184
+ }
185
+ /**
186
+ * Checks if a file is handled by a processor.
187
+ * Processors that declare asset capabilities own those file types.
188
+ * Processors without capabilities fall back to checking watch extensions.
189
+ */
190
+ isHandledByProcessor(filePath) {
191
+ return this.invalidationService.isProcessorOwnedAsset(filePath);
192
+ }
193
+ /**
194
+ * Triggers router refresh for page directory changes.
195
+ * This ensures the router is updated when pages are added or removed.
196
+ *
197
+ * @param {string} path - Path of the changed directory
198
+ */
199
+ triggerRouterRefresh(changedPath) {
200
+ const resolvedPath = path.resolve(changedPath);
201
+ const isPageDir = resolvedPath.startsWith(this.appConfig.absolutePaths.pagesDir) && path.extname(resolvedPath) === "";
202
+ if (isPageDir || this.isRouteSourceFile(resolvedPath)) {
203
+ this.refreshRouterRoutesCallback();
204
+ }
205
+ }
206
+ /**
207
+ * Handles and logs errors that occur during file watching.
208
+ *
209
+ * @param {unknown} error - The error to handle
210
+ */
211
+ handleError(error) {
212
+ if (error instanceof Error) {
213
+ this.hmrManager.broadcast({ type: "error", message: error.message });
214
+ }
215
+ appLogger.error(`Watcher error: ${error}`);
216
+ }
217
+ /**
218
+ * Creates and configures the file system watcher.
219
+ * This sets up:
220
+ * 1. Page file watching
221
+ * 2. Directory watching
222
+ * 3. Error handling
223
+ *
224
+ * Processor notifications are dispatched inside handleFileChange, ensuring
225
+ * a single unified event pipeline with no parallel chokidar bindings.
226
+ *
227
+ * Uses chokidar's built-in debouncing through `awaitWriteFinish` to handle
228
+ * rapid file changes efficiently.
229
+ */
230
+ async createWatcherSubscription() {
231
+ if (!this.watcher) {
232
+ const processorPaths = [];
233
+ for (const processor of this.appConfig.processors.values()) {
234
+ const watchConfig = processor.getWatchConfig();
235
+ if (!watchConfig) continue;
236
+ processorPaths.push(...watchConfig.paths);
237
+ }
238
+ if (fileSystem.exists(this.appConfig.absolutePaths.includesDir)) {
239
+ processorPaths.push(this.appConfig.absolutePaths.includesDir);
240
+ }
241
+ if (fileSystem.exists(this.appConfig.absolutePaths.srcDir)) {
242
+ processorPaths.push(this.appConfig.absolutePaths.srcDir);
243
+ }
244
+ if (fileSystem.exists(this.appConfig.absolutePaths.pagesDir)) {
245
+ processorPaths.push(this.appConfig.absolutePaths.pagesDir);
246
+ }
247
+ if (fileSystem.exists(this.appConfig.absolutePaths.publicDir)) {
248
+ processorPaths.push(this.appConfig.absolutePaths.publicDir);
249
+ }
250
+ if (this.appConfig.additionalWatchPaths.length) {
251
+ processorPaths.push(...this.appConfig.additionalWatchPaths);
252
+ }
253
+ this.watcher = chokidar.watch(processorPaths, {
254
+ ignoreInitial: true,
255
+ ignorePermissionErrors: true,
256
+ awaitWriteFinish: {
257
+ stabilityThreshold: 50,
258
+ pollInterval: 50
259
+ }
260
+ });
261
+ }
262
+ this.watcher.add(this.appConfig.absolutePaths.srcDir);
263
+ this.watcher.on("change", (p) => this.enqueueChange(() => this.handleFileChange(p, "change"))).on("add", (p) => {
264
+ this.enqueueChange(() => this.handleFileChange(p, "add"));
265
+ this.triggerRouterRefresh(p);
266
+ }).on("addDir", (p) => this.triggerRouterRefresh(p)).on("unlink", (p) => {
267
+ this.enqueueChange(() => this.handleFileChange(p, "unlink"));
268
+ this.triggerRouterRefresh(p);
269
+ }).on("unlinkDir", (p) => this.triggerRouterRefresh(p)).on("error", (error) => this.handleError(error));
270
+ for (const processor of this.appConfig.processors.values()) {
271
+ const watchConfig = processor.getWatchConfig();
272
+ if (watchConfig?.onError) {
273
+ this.watcher.on("error", watchConfig.onError);
274
+ }
275
+ }
276
+ return this.watcher;
277
+ }
278
+ }
279
+ export {
280
+ ProjectWatcher
281
+ };
@@ -0,0 +1,4 @@
1
+ import type { IHmrManager } from '../internal-types';
2
+ import type { ClientBridge } from '../adapters/bun/client-bridge';
3
+ export declare const createMockHmrManager: () => IHmrManager;
4
+ export declare const createMockBridge: () => ClientBridge;
@@ -0,0 +1,52 @@
1
+ import { vi } from "vitest";
2
+ const createMockHmrManager = () => ({
3
+ handleFileChange: vi.fn(async () => {
4
+ }),
5
+ broadcast: vi.fn(() => {
6
+ }),
7
+ setEnabled: vi.fn(() => {
8
+ }),
9
+ setPlugins: vi.fn(() => {
10
+ }),
11
+ registerEntrypoint: vi.fn(async () => ""),
12
+ registerScriptEntrypoint: vi.fn(async () => ""),
13
+ registerSpecifierMap: vi.fn(() => {
14
+ }),
15
+ registerStrategy: vi.fn(() => {
16
+ }),
17
+ isEnabled: vi.fn(() => true),
18
+ getOutputUrl: vi.fn(() => void 0),
19
+ getWatchedFiles: vi.fn(() => /* @__PURE__ */ new Map()),
20
+ getSpecifierMap: vi.fn(() => /* @__PURE__ */ new Map()),
21
+ getDistDir: vi.fn(() => ""),
22
+ getPlugins: vi.fn(() => []),
23
+ getDefaultContext: vi.fn(() => ({
24
+ getWatchedFiles: () => /* @__PURE__ */ new Map(),
25
+ getSpecifierMap: () => /* @__PURE__ */ new Map(),
26
+ getDistDir: () => "",
27
+ getPlugins: () => [],
28
+ getSrcDir: () => "",
29
+ getLayoutsDir: () => ""
30
+ }))
31
+ });
32
+ const createMockBridge = () => ({
33
+ reload: vi.fn(() => {
34
+ }),
35
+ error: vi.fn(() => {
36
+ }),
37
+ cssUpdate: vi.fn(() => {
38
+ }),
39
+ update: vi.fn(() => {
40
+ }),
41
+ subscribe: vi.fn(() => {
42
+ }),
43
+ unsubscribe: vi.fn(() => {
44
+ }),
45
+ broadcast: vi.fn(() => {
46
+ }),
47
+ subscriberCount: 0
48
+ });
49
+ export {
50
+ createMockBridge,
51
+ createMockHmrManager
52
+ };