@ecopages/core 0.2.0-rc.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/README.md +39 -38
  2. package/package.json +22 -152
  3. package/src/adapters/README.md +11 -3
  4. package/src/adapters/abstract/application-adapter.d.ts +32 -36
  5. package/src/adapters/abstract/application-adapter.js +61 -47
  6. package/src/adapters/abstract/server-adapter.d.ts +14 -0
  7. package/src/adapters/abstract/server-adapter.js +10 -0
  8. package/src/adapters/abstract/ws-pattern-matcher.d.ts +0 -5
  9. package/src/adapters/abstract/ws-pattern-matcher.js +0 -9
  10. package/src/adapters/bun/create-app.d.ts +12 -16
  11. package/src/adapters/bun/create-app.js +25 -55
  12. package/src/adapters/bun/hmr-manager.d.ts +0 -1
  13. package/src/adapters/bun/hmr-manager.js +2 -4
  14. package/src/adapters/bun/server-adapter.d.ts +15 -21
  15. package/src/adapters/bun/server-adapter.js +33 -67
  16. package/src/adapters/bun/static-preview-host.d.ts +1 -0
  17. package/src/adapters/bun/static-preview-host.js +1 -1
  18. package/src/adapters/create-app.d.ts +63 -8
  19. package/src/adapters/create-app.js +62 -5
  20. package/src/adapters/node/create-app.d.ts +8 -12
  21. package/src/adapters/node/create-app.js +22 -14
  22. package/src/adapters/node/runtime-host.d.ts +10 -10
  23. package/src/adapters/node/runtime-host.js +13 -8
  24. package/src/adapters/node/server-adapter-dependencies.d.ts +2 -10
  25. package/src/adapters/node/server-adapter-dependencies.js +8 -13
  26. package/src/adapters/node/server-adapter.d.ts +30 -32
  27. package/src/adapters/node/server-adapter.js +59 -65
  28. package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +0 -4
  29. package/src/adapters/shared/hmr/shared-hmr-manager.js +0 -12
  30. package/src/adapters/shared/http/api-request-pipeline.d.ts +27 -1
  31. package/src/adapters/shared/http/api-request-pipeline.js +31 -16
  32. package/src/adapters/shared/http/explicit-static-route-matcher.js +5 -2
  33. package/src/adapters/shared/http/fs-server-response-factory.d.ts +2 -9
  34. package/src/adapters/shared/http/fs-server-response-factory.js +5 -33
  35. package/src/adapters/shared/http/fs-server-response-matcher.d.ts +24 -24
  36. package/src/adapters/shared/http/fs-server-response-matcher.js +59 -83
  37. package/src/adapters/shared/runtime/application-adapter.d.ts +1 -0
  38. package/src/adapters/shared/runtime/application-adapter.js +12 -0
  39. package/src/adapters/shared/runtime/bind-runtime-server.d.ts +17 -0
  40. package/src/adapters/shared/runtime/bind-runtime-server.js +50 -0
  41. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.d.ts +1 -3
  42. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.js +1 -4
  43. package/src/adapters/shared/runtime/port-manager-default-prompt.d.ts +6 -0
  44. package/src/adapters/shared/runtime/port-manager-default-prompt.js +41 -0
  45. package/src/adapters/shared/runtime/port-manager.d.ts +3 -3
  46. package/src/adapters/shared/runtime/port-manager.js +14 -45
  47. package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +0 -10
  48. package/src/adapters/shared/runtime/runtime-app-bootstrap.js +0 -7
  49. package/src/adapters/shared/runtime/runtime-host.d.ts +5 -2
  50. package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +1 -1
  51. package/src/adapters/shared/runtime/runtime-server-lifecycle.js +1 -1
  52. package/src/adapters/shared/runtime/server-adapter.d.ts +26 -5
  53. package/src/adapters/shared/runtime/server-adapter.js +35 -8
  54. package/src/adapters/shared/runtime/server-route-handler.js +11 -3
  55. package/src/adapters/shared/runtime/server-static-builder.d.ts +9 -3
  56. package/src/adapters/shared/runtime/server-static-builder.js +59 -37
  57. package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +9 -1
  58. package/src/adapters/shared/ws/node-http-websocket-upgrades.js +8 -2
  59. package/src/build/README.md +12 -8
  60. package/src/build/cache/cache-constants.d.ts +0 -2
  61. package/src/build/cache/cache-constants.js +0 -2
  62. package/src/build/cache/cache-keys.d.ts +0 -2
  63. package/src/build/cache/cache-keys.js +0 -2
  64. package/src/build/cache/output-imports.d.ts +35 -0
  65. package/src/build/cache/output-imports.js +87 -0
  66. package/src/build/cache/pages-unified-graph-build.d.ts +15 -1
  67. package/src/build/cache/pages-unified-graph-build.js +73 -22
  68. package/src/build/cache/production-build-cache.d.ts +2 -2
  69. package/src/build/cache/production-build-cache.js +2 -2
  70. package/src/build/cache/server-entry-build-cache.d.ts +25 -3
  71. package/src/build/cache/server-entry-build-cache.js +129 -13
  72. package/src/build/contracts/build-contracts.d.ts +1 -13
  73. package/src/build/rolldown/runtime-build-output-normalizer.js +3 -6
  74. package/src/build/runtime/build-request-identity.d.ts +2 -6
  75. package/src/build/runtime/build-request-identity.js +2 -8
  76. package/src/build/runtime/build-request-policy.js +1 -1
  77. package/src/build/runtime/deduping-build-executor.d.ts +0 -1
  78. package/src/build/runtime/deduping-build-executor.js +0 -1
  79. package/src/build/server-bundle-publication.d.ts +14 -0
  80. package/src/build/server-bundle-publication.js +49 -0
  81. package/src/cache/index.d.ts +1 -1
  82. package/src/cache/index.js +1 -1
  83. package/src/cache/module-parse-cache.d.ts +2 -29
  84. package/src/cache/module-parse-cache.js +6 -39
  85. package/src/config/README.md +17 -2
  86. package/src/config/apply-user-config.d.ts +8 -0
  87. package/src/config/apply-user-config.js +68 -0
  88. package/src/config/config-builder.d.ts +11 -1
  89. package/src/config/config-builder.js +53 -12
  90. package/src/config/constants.d.ts +4 -4
  91. package/src/config/constants.js +4 -4
  92. package/src/config/define-config.d.ts +9 -0
  93. package/src/config/define-config.js +10 -0
  94. package/src/config/index.d.ts +5 -0
  95. package/src/config/index.js +4 -0
  96. package/src/config/is-finalized-app-config.d.ts +6 -0
  97. package/src/config/is-finalized-app-config.js +11 -0
  98. package/src/config/load-eco-config.d.ts +21 -0
  99. package/src/config/load-eco-config.js +107 -0
  100. package/src/config/resolve-eco-config-path.d.ts +32 -0
  101. package/src/config/resolve-eco-config-path.js +58 -0
  102. package/src/config/server-config-bundle.d.ts +25 -0
  103. package/src/config/server-config-bundle.js +148 -0
  104. package/src/config/user-config-types.d.ts +170 -0
  105. package/src/config/user-config-types.js +1 -0
  106. package/src/dev/README.md +4 -0
  107. package/src/dev/development-restart-watch-paths.d.ts +13 -0
  108. package/src/dev/development-restart-watch-paths.js +37 -0
  109. package/src/dev/development-restart.d.ts +13 -0
  110. package/src/dev/development-restart.js +21 -0
  111. package/src/dev/host-runtime.d.ts +0 -1
  112. package/src/dev/host-runtime.js +0 -3
  113. package/src/dev/sc-server.d.ts +4 -1
  114. package/src/dev/sc-server.js +11 -20
  115. package/src/dev/transform-server/dev-transform-import-rewriter.js +2 -2
  116. package/src/eco/eco.js +4 -0
  117. package/src/errors/http-error-page-contract.d.ts +77 -0
  118. package/src/errors/http-error-page-contract.js +106 -0
  119. package/src/hmr/hmr-file-change-prep.d.ts +0 -1
  120. package/src/hmr/hmr-file-change-prep.js +2 -5
  121. package/src/hmr/hmr-strategy.d.ts +3 -8
  122. package/src/hmr/hmr-strategy.js +3 -8
  123. package/src/index.browser.d.ts +1 -2
  124. package/src/index.browser.js +1 -2
  125. package/src/index.d.ts +5 -6
  126. package/src/index.js +5 -6
  127. package/src/islands/island-host.d.ts +0 -9
  128. package/src/islands/island-host.js +1 -13
  129. package/src/plugins/component-import-discovery.js +2 -2
  130. package/src/plugins/eco-component-meta-plugin.js +5 -5
  131. package/src/plugins/integration-plugin.d.ts +0 -1
  132. package/src/plugins/integration-plugin.js +0 -4
  133. package/src/plugins/processor.d.ts +6 -2
  134. package/src/route-renderer/README.md +4 -0
  135. package/src/{adapters/shared/http/explicit-static-render-preparation.d.ts → route-renderer/explicit-view-render-preparation.d.ts} +3 -3
  136. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +1 -4
  137. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +25 -24
  138. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +18 -20
  139. package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -7
  140. package/src/route-renderer/orchestration/integration-renderer.js +44 -33
  141. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
  142. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
  143. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
  144. package/src/route-renderer/route-renderer.d.ts +9 -0
  145. package/src/route-renderer/route-renderer.js +18 -0
  146. package/src/services/README.md +2 -1
  147. package/src/services/assets/browser-bundle.service.d.ts +1 -6
  148. package/src/services/error-pages/README.md +9 -0
  149. package/src/services/error-pages/default-error-pages.d.ts +39 -0
  150. package/src/services/error-pages/default-error-pages.js +199 -0
  151. package/src/services/error-pages/error-page-renderer.d.ts +58 -0
  152. package/src/services/error-pages/error-page-renderer.js +146 -0
  153. package/src/services/error-pages/semantic-error-page-exporter.d.ts +23 -0
  154. package/src/services/error-pages/semantic-error-page-exporter.js +35 -0
  155. package/src/services/html/html-rewriter.d.ts +77 -0
  156. package/src/services/html/html-rewriter.js +751 -0
  157. package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
  158. package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
  159. package/src/services/html/html-transformer.service.d.ts +29 -42
  160. package/src/services/html/html-transformer.service.js +85 -157
  161. package/src/services/invalidation/development-invalidation.service.d.ts +9 -20
  162. package/src/services/invalidation/development-invalidation.service.js +26 -39
  163. package/src/services/module-loading/README.md +20 -15
  164. package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
  165. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
  166. package/src/services/module-loading/app-server-module-transpiler.service.js +2 -10
  167. package/src/services/module-loading/collection-server-module-build.service.d.ts +0 -1
  168. package/src/services/module-loading/collection-server-module-build.service.js +0 -3
  169. package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
  170. package/src/services/module-loading/host-module-loader-registry.js +0 -3
  171. package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
  172. package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
  173. package/src/services/module-loading/route-module-build-cache.store.d.ts +8 -0
  174. package/src/services/module-loading/route-module-build-cache.store.js +25 -7
  175. package/src/services/module-loading/route-module-build-manifest.d.ts +12 -1
  176. package/src/services/module-loading/route-module-build-manifest.js +7 -3
  177. package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
  178. package/src/services/module-loading/route-module-dependency-hasher.js +13 -1
  179. package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
  180. package/src/services/module-loading/server-module-transpiler.service.js +0 -24
  181. package/src/services/module-loading/view-module-loader.d.ts +10 -0
  182. package/src/services/module-loading/view-module-loader.js +46 -0
  183. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
  184. package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
  185. package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
  186. package/src/static-site-generator/README.md +12 -8
  187. package/src/static-site-generator/static-site-generator.d.ts +3 -2
  188. package/src/static-site-generator/static-site-generator.js +17 -3
  189. package/src/types/internal-types.d.ts +1 -38
  190. package/src/types/public-types.d.ts +28 -130
  191. package/src/watchers/project-watcher.d.ts +9 -16
  192. package/src/watchers/project-watcher.js +35 -28
  193. package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
  194. package/src/watchers/project-watcher.test-helpers.js +12 -0
  195. package/src/adapters/abstract/router-adapter.d.ts +0 -26
  196. package/src/adapters/abstract/router-adapter.js +0 -13
  197. package/src/adapters/bun/index.d.ts +0 -2
  198. package/src/adapters/bun/index.js +0 -2
  199. package/src/adapters/index.d.ts +0 -2
  200. package/src/adapters/index.js +0 -2
  201. package/src/eco/eco.utils.d.ts +0 -1
  202. package/src/eco/eco.utils.js +0 -1
  203. package/src/services/cache/index.d.ts +0 -9
  204. package/src/services/cache/index.js +0 -8
  205. package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
  206. package/src/services/html/html-rewriter-provider.service.js +0 -68
  207. package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
  208. package/src/services/module-loading/route-module-build-cache.js +0 -3
  209. package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
  210. package/src/services/runtime-state/dev-graph.service.js +0 -170
  211. /package/src/{adapters/shared/http/explicit-static-render-preparation.js → route-renderer/explicit-view-render-preparation.js} +0 -0
@@ -11,6 +11,7 @@ It is responsible for:
11
11
  - enumerating renderable routes
12
12
  - rendering static outputs through the normal rendering pipeline
13
13
  - respecting route-level constraints such as cache policy and unsupported dynamic server-only paths
14
+ - emitting semantic 404/500 artifacts through the shared error-page renderer
14
15
 
15
16
  ## Design Rule
16
17
 
@@ -25,15 +26,18 @@ That means it should reuse:
25
26
 
26
27
  It should not invent a parallel rendering stack just for build mode.
27
28
 
29
+ Semantic error pages are excluded from ordinary page enumeration and emitted once by `services/error-pages/semantic-error-page-exporter.ts`, so runtime and static output share source precedence and rendering behavior.
30
+
28
31
  ## Files
29
32
 
30
- | File | Role |
31
- | ------------------------------ | ---------------------------------------------------------------------------- |
32
- | `static-site-generator.ts` | Route enumeration, HTML artifact writes, integration export hooks, sitemap |
33
- | `static-export-context.ts` | Hook context type for `beforeStaticExport` / `afterStaticExport` |
34
- | `sitemap.ts` | Pure sitemap.xml renderer |
35
- | `sitemap-routes.ts` | Sitemap location assembly (`exclude`, `extraUrls`, dedupe) |
36
- | `static-build-invalidation.ts` | `dist/` reset policy, production cache clearing, static-render cache context |
33
+ | File | Role |
34
+ | ------------------------------------------- | ---------------------------------------------------------------------------- |
35
+ | `static-site-generator.ts` | Route enumeration, HTML artifact writes, integration export hooks, sitemap |
36
+ | `static-export-context.ts` | Hook context type for `beforeStaticExport` / `afterStaticExport` |
37
+ | `sitemap.ts` | Pure sitemap.xml renderer |
38
+ | `sitemap-routes.ts` | Sitemap location assembly (`exclude`, `extraUrls`, dedupe) |
39
+ | `static-build-invalidation.ts` | `dist/` reset policy, production cache clearing, static-render cache context |
40
+ | `production-page-browser-graph-prebuild.ts` | Warms and prebuilds browser asset graphs before static export rendering |
37
41
 
38
42
  Build-input fingerprinting (`hashAppConfigFile`, `createBuildInputsFingerprint`) lives in `packages/core/src/build/cache/build-input-fingerprint.ts` and is shared with server-entry and unified-graph caches.
39
43
 
@@ -47,7 +51,7 @@ Build-input fingerprinting (`hashAppConfigFile`, `createBuildInputsFingerprint`)
47
51
 
48
52
  When `dist/` is preserved (`preserveExportDirectory: true`), `StaticSiteGenerator.run()` prunes HTML files no longer in the active route set.
49
53
 
50
- Rendered HTML reuse is tracked in `.eco/.server-modules/.build-cache.json` under each route module's `renderedOutputs`. `canReuseStaticRender()` skips re-rendering when the source file, dependency hashes, and output path are unchanged.
54
+ Rendered HTML reuse is tracked in `.eco/.server-modules/.build-cache.json` under each route module's `renderedOutputs`. `canReuseStaticRender()` skips re-rendering when the source file, dependency hashes, and output path are unchanged. Rebuilding a route module (`recordBuild()`) drops `renderedOutputs` so a layout or component edit cannot keep the previous HTML.
51
55
 
52
56
  `clearProductionBuildCaches()` runs on `force` builds and removes all persisted `.eco` build manifests (route modules, server entry, unified pages graph).
53
57
 
@@ -1,5 +1,5 @@
1
1
  import type { EcoPagesAppConfig } from '../types/internal-types.js';
2
- import type { SitemapConfig, StaticRoute } from '../types/public-types.js';
2
+ import type { SitemapConfig, StaticRoute, ErrorPageLoaders } from '../types/public-types.js';
3
3
  import type { PageRendererResolver, StaticGenerationRendererResolver } from '../route-renderer/route-renderer.js';
4
4
  import type { StaticGenerationRoute } from '../router/server/route-registry.js';
5
5
  import type { RouteModuleBuildCache } from '../services/module-loading/route-module-build-cache.store.js';
@@ -99,11 +99,12 @@ export declare class StaticSiteGenerator {
99
99
  /**
100
100
  * Executes the full static-generation workflow for one app run.
101
101
  */
102
- run({ router, baseUrl, routeRendererFactory, staticRoutes, force, preserveExportDirectory, }: {
102
+ run({ router, baseUrl, routeRendererFactory, staticRoutes, errorPageLoaders, force, preserveExportDirectory, }: {
103
103
  router: StaticGenerationRouteSource;
104
104
  baseUrl: string;
105
105
  routeRendererFactory?: StaticGenerationRendererFactory;
106
106
  staticRoutes?: StaticRoute[];
107
+ errorPageLoaders?: ErrorPageLoaders;
107
108
  force?: boolean;
108
109
  preserveExportDirectory?: boolean;
109
110
  }): Promise<void>;
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import { availableParallelism } from 'node:os';
3
3
  import { appLogger } from '../global/app-logger.js';
4
4
  import { fileSystem } from '@ecopages/file-system';
5
- import { prepareExplicitStaticRender } from '../adapters/shared/http/explicit-static-render-preparation.js';
5
+ import { prepareExplicitStaticRender } from '../route-renderer/explicit-view-render-preparation.js';
6
6
  import { createRouteModuleStaticRenderCacheContext } from './static-build-invalidation.js';
7
7
  import { getServerModuleBuildCacheOutdir, getSharedRouteModuleBuildCache, } from '../services/module-loading/route-module-build-cache-registry.js';
8
8
  import { ensurePagesUnifiedGraphBuilt, shouldBuildPagesUnifiedGraph, } from '../build/cache/pages-unified-graph-build.js';
@@ -12,6 +12,8 @@ import { renderSitemap } from './sitemap.js';
12
12
  import { resolveSitemapLocations } from './sitemap-routes.js';
13
13
  import { toEcopagesRouteInfo } from '../utils/ecopages-route-info.js';
14
14
  import { normalizePathname } from '../utils/path-pattern.js';
15
+ import { ErrorPageRenderer } from '../services/error-pages/error-page-renderer.js';
16
+ import { SemanticErrorPageExporter, SEMANTIC_ERROR_PAGE_PATHNAMES, } from '../services/error-pages/semantic-error-page-exporter.js';
15
17
  export const STATIC_SITE_GENERATOR_ERRORS = {
16
18
  ROUTE_RENDERER_FACTORY_REQUIRED: 'RouteRendererFactory is required for render strategy',
17
19
  unsupportedBodyType: (bodyType) => `Unsupported body type for static generation: ${bodyType}`,
@@ -349,13 +351,15 @@ export class StaticSiteGenerator {
349
351
  })), input.routeRendererFactory);
350
352
  }
351
353
  this.generateRobotsTxt();
354
+ const semanticErrorPathnames = new Set(SEMANTIC_ERROR_PAGE_PATHNAMES);
355
+ const pageRoutes = input.routes.filter((route) => !semanticErrorPathnames.has(route.pathname));
352
356
  await this.generateStaticPages({
353
357
  router: input.router,
354
358
  baseUrl: input.baseUrl,
355
359
  routeRendererFactory: input.routeRendererFactory,
356
360
  skipped: input.skippedDynamicPages,
357
361
  activeStaticPathnames: input.activeStaticPathnames,
358
- preloadedRoutes: input.routes,
362
+ preloadedRoutes: pageRoutes,
359
363
  sitemapEligiblePathnames: input.sitemapEligiblePathnames,
360
364
  });
361
365
  if (input.staticRoutes && input.staticRoutes.length > 0 && input.routeRendererFactory) {
@@ -367,6 +371,15 @@ export class StaticSiteGenerator {
367
371
  sitemapEligiblePathnames: input.sitemapEligiblePathnames,
368
372
  });
369
373
  }
374
+ const errorPageRenderer = new ErrorPageRenderer({
375
+ appConfig: this.appConfig,
376
+ routeRendererFactory: input.routeRendererFactory,
377
+ errorPageLoaders: input.errorPageLoaders,
378
+ });
379
+ await new SemanticErrorPageExporter({
380
+ errorPageRenderer,
381
+ writeArtifact: async (artifact) => await this.writeStaticPageArtifact(artifact),
382
+ }).export(input.activeStaticPathnames);
370
383
  if (input.preserveExportDirectory) {
371
384
  this.pruneStaleStaticOutputs(input.activeStaticPathnames);
372
385
  }
@@ -387,7 +400,7 @@ export class StaticSiteGenerator {
387
400
  /**
388
401
  * Executes the full static-generation workflow for one app run.
389
402
  */
390
- async run({ router, baseUrl, routeRendererFactory, staticRoutes, force = false, preserveExportDirectory = false, }) {
403
+ async run({ router, baseUrl, routeRendererFactory, staticRoutes, errorPageLoaders, force = false, preserveExportDirectory = false, }) {
391
404
  const skippedDynamicPages = [];
392
405
  const activeStaticPathnames = new Set();
393
406
  const sitemapEligiblePathnames = this.appConfig.sitemap?.enabled ? new Set() : undefined;
@@ -411,6 +424,7 @@ export class StaticSiteGenerator {
411
424
  baseUrl,
412
425
  routeRendererFactory,
413
426
  staticRoutes,
427
+ errorPageLoaders,
414
428
  preserveExportDirectory,
415
429
  routes,
416
430
  skippedDynamicPages,
@@ -10,9 +10,7 @@ import type { ComponentRenderInput, EcoComponent, PageMetadataProps, SitemapConf
10
10
  export type InternalComponentRenderInput = ComponentRenderInput & {
11
11
  foreignChildRoots?: ReadonlyArray<EcoComponent | Partial<EcoComponent>>;
12
12
  };
13
- import type { RouteRegistry } from '../router/server/route-registry.js';
14
13
  import type { CacheConfig } from '../services/cache/cache.types.js';
15
- import type { DevGraphService } from '../services/runtime-state/dev-graph.service.js';
16
14
  import type { AppModuleLoader } from '../services/module-loading/app-module-loader.service.js';
17
15
  import type { SourceModuleLoader } from '../services/module-loading/module-loading-types.js';
18
16
  import type { EntrypointDependencyGraph } from '../services/runtime-state/entrypoint-dependency-graph.service.js';
@@ -121,8 +119,6 @@ export type EcoPagesAppConfig = {
121
119
  defaultMetadata: PageMetadataProps;
122
120
  /** Integrations plugins */
123
121
  integrations: AnyIntegrationPlugin[];
124
- /** Integrations dependencies */
125
- integrationsDependencies: IntegrationDependencyConfig[];
126
122
  /** Derived Paths */
127
123
  absolutePaths: {
128
124
  config: string;
@@ -136,6 +132,7 @@ export type EcoPagesAppConfig = {
136
132
  publicDir: string;
137
133
  srcDir: string;
138
134
  htmlTemplatePath: string;
135
+ errorPageTemplatePaths?: Record<400 | 401 | 403 | 404 | 409 | 500, string>;
139
136
  error404TemplatePath: string;
140
137
  error500TemplatePath: string;
141
138
  };
@@ -169,7 +166,6 @@ export type EcoPagesAppConfig = {
169
166
  buildOwnership?: BuildOwnership;
170
167
  buildAdapter?: BuildAdapter;
171
168
  buildManifest?: AppBuildManifest;
172
- devGraphService?: DevGraphService;
173
169
  entrypointDependencyGraph?: EntrypointDependencyGraph;
174
170
  pageBrowserGraphSession?: SessionPageBrowserGraphCache;
175
171
  hostModuleLoader?: SourceModuleLoader;
@@ -222,15 +218,6 @@ export type EcoPagesAppConfig = {
222
218
  unsafe?: Record<string, unknown>;
223
219
  };
224
220
  };
225
- export type IntegrationDependencyConfig = {
226
- integration: string;
227
- kind: 'script' | 'stylesheet';
228
- position?: 'head' | 'body';
229
- srcUrl: string;
230
- filePath: string;
231
- /** @todo inline dependencies not implemented yet */
232
- inline?: boolean;
233
- };
234
221
  /**
235
222
  * The possible kinds of a route.
236
223
  */
@@ -248,18 +235,6 @@ export type MatchResult = {
248
235
  query: Record<string, string>;
249
236
  params: Record<string, string | string[]>;
250
237
  };
251
- /**
252
- * Represents a route in EcoPages.
253
- */
254
- export type Route = {
255
- kind: RouteKind;
256
- filePath: string;
257
- pathname: string;
258
- };
259
- /**
260
- * Represents the routes in EcoPages.
261
- */
262
- export type Routes = Record<string, Route>;
263
238
  /**
264
239
  * Represents the options for the file system server.
265
240
  */
@@ -267,16 +242,4 @@ export type FileSystemServerOptions = {
267
242
  watchMode: boolean;
268
243
  port?: number | string;
269
244
  };
270
- /**
271
- * Represents the file system server adapter.
272
- */
273
- export interface EcoPagesFileSystemServerAdapter<ServerInstanceOptions = unknown> {
274
- startServer(serverOptions: ServerInstanceOptions): {
275
- router: RouteRegistry;
276
- server: unknown;
277
- } | Promise<{
278
- router: RouteRegistry;
279
- server: unknown;
280
- }>;
281
- }
282
245
  export type { ClientBridgeEvent, DefaultHmrContext, HmrFileChangeOptions, IHmrManager, IClientBridge, } from './public-types.js';
@@ -367,10 +367,7 @@ export type EcoChildren = string | Promise<string> | number | bigint | boolean |
367
367
  strings: readonly string[];
368
368
  values?: readonly EcoChildren[];
369
369
  };
370
- /**
371
- * Represents the input configuration for EcoPages.
372
- */
373
- export type EcoPagesConfig = Omit<Partial<EcoPagesAppConfig>, 'baseUrl' | 'derivedPaths' | 'templatesExt' | 'integrationsDependencies'> & Pick<EcoPagesAppConfig, 'baseUrl' | 'rootDir'>;
370
+ export type { EcoPagesUserConfig } from '../config/user-config-types.js';
374
371
  export type EcoComponentConfig = {
375
372
  /** Canonical integration, module, and stable component attribution. */
376
373
  identity?: ComponentIdentity;
@@ -645,27 +642,22 @@ export type EcoLayoutComponent<T = EcoPagesElement> = EcoComponent<LayoutProps<T
645
642
  */
646
643
  export type EcoHtmlComponent<T = EcoPagesElement> = EcoComponent<HtmlTemplateProps, T>;
647
644
  /**
648
- * Props type for the semantic `404.*` page template.
649
- * @remarks Semantic error templates receive safe empty `pageLocals` rather than
650
- * request-scoped locals. The runtime does not currently pass `message` / `stack`
651
- * when rendering the custom 404 page.
652
- */
653
- export interface Error404TemplateProps extends Omit<HtmlTemplateProps, 'children'> {
654
- message: string;
655
- stack?: string;
656
- }
657
- /**
658
- * Props type for the semantic `500.*` page template.
659
- * @remarks In development, the page-pipeline passes `message` and `stack` from the
660
- * thrown error when rendering this page after a failure. In production those
661
- * fields are omitted so stacks are not serialized into HTML. Direct visits to
662
- * `/500` also omit them. Semantic error templates receive safe empty
645
+ * Props passed to semantic HTML error pages (`pages/{status}.*` and `app.*()` loaders).
646
+ *
647
+ * @remarks
648
+ * `status` is the HTTP status being rendered. `message` is the public `HttpError`
649
+ * text for 4xx page-pipeline failures; unmatched URLs omit it. `stack` is only
650
+ * passed for 5xx pages in development. Semantic error pages receive safe empty
663
651
  * `pageLocals` rather than request-scoped locals.
664
652
  */
665
- export interface Error500TemplateProps extends Omit<HtmlTemplateProps, 'children'> {
653
+ export interface ErrorPageTemplateProps extends Omit<HtmlTemplateProps, 'children'> {
654
+ status: number;
666
655
  message?: string;
667
656
  stack?: string;
668
657
  }
658
+ export type Error403TemplateProps = ErrorPageTemplateProps;
659
+ export type Error404TemplateProps = ErrorPageTemplateProps;
660
+ export type Error500TemplateProps = ErrorPageTemplateProps;
669
661
  /**
670
662
  * Represents the parameters for a page.
671
663
  * The keys are strings, and the values can be either a string or an array of strings.
@@ -764,23 +756,6 @@ export type EcoPageFile<T = unknown> = T & {
764
756
  getMetadata?: GetMetadata;
765
757
  cache?: CacheStrategy;
766
758
  };
767
- /**
768
- * Represents a CSS processor.
769
- */
770
- export interface CssProcessor {
771
- /**
772
- * Processes a CSS file at the specified path.
773
- * @param path - The path to the CSS file.
774
- * @returns A promise that resolves to the processed CSS as a string.
775
- */
776
- processPath: (path: string, options?: any) => Promise<string>;
777
- /**
778
- * Processes a CSS string or buffer.
779
- * @param contents - The CSS contents as a string or buffer.
780
- * @returns A promise that resolves to the processed CSS as a string.
781
- */
782
- processStringOrBuffer: (contents: string | Buffer, options?: any) => Promise<string>;
783
- }
784
759
  /**
785
760
  * The options for the route renderer.
786
761
  */
@@ -818,57 +793,6 @@ export type RouteRenderResult = {
818
793
  /** Source paths observed during render preparation for HTML cache invalidation. */
819
794
  sourceDependencyPaths?: readonly string[];
820
795
  };
821
- /**
822
- * Represents the dependencies required for an integration plugin.
823
- * It combines the base integration plugin dependencies with specific integration plugin dependencies.
824
- */
825
- export type IntegrationPluginDependencies = BaseIntegrationPluginDependencies & SpecificIntegrationPluginDependencies;
826
- type BaseIntegrationPluginDependencies = {
827
- inline?: boolean;
828
- };
829
- /**
830
- * Represents the dependencies required for a specific integration plugin.
831
- * It can be one of the following types:
832
- * {@link ScriptImportIntegrationPluginDependencies}
833
- * {@link ScriptContentIntegrationPluginDependencies}
834
- * {@link StylesheetImportIntegrationPluginDependencies}
835
- * {@link StylesheetContentIntegrationPluginDependencies}
836
- */
837
- type SpecificIntegrationPluginDependencies = ScriptImportIntegrationPluginDependencies | ScriptContentIntegrationPluginDependencies | StylesheetImportIntegrationPluginDependencies | StylesheetContentIntegrationPluginDependencies;
838
- /**
839
- * Script dependencies for an integration plugin with an import path.
840
- */
841
- type ScriptImportIntegrationPluginDependencies = {
842
- kind: 'script';
843
- importPath: string;
844
- position?: 'head' | 'body';
845
- /** @default true */
846
- minify?: boolean;
847
- };
848
- /**
849
- * Script dependencies for an integration plugin with content.
850
- */
851
- type ScriptContentIntegrationPluginDependencies = {
852
- kind: 'script';
853
- content: string;
854
- position?: 'head' | 'body';
855
- /** @default true */
856
- minify?: boolean;
857
- };
858
- /**
859
- * Stylesheet dependencies for an integration plugin with an import path.
860
- */
861
- type StylesheetImportIntegrationPluginDependencies = {
862
- kind: 'stylesheet';
863
- importPath: string;
864
- };
865
- /**
866
- * Stylesheet dependencies for an integration plugin with content.
867
- */
868
- type StylesheetContentIntegrationPluginDependencies = {
869
- kind: 'stylesheet';
870
- content: string;
871
- };
872
796
  /**
873
797
  * The options for the integration renderer.
874
798
  */
@@ -1021,18 +945,6 @@ export interface ComponentRenderResult {
1021
945
  rootAttributes?: Record<string, string>;
1022
946
  assets?: ProcessedAsset[];
1023
947
  }
1024
- /**
1025
- * Represents a deep required type for a given object
1026
- */
1027
- export type DeepRequired<T> = Required<{
1028
- [K in keyof T]: T[K] extends Required<T[K]> ? T[K] : DeepRequired<T[K]>;
1029
- }>;
1030
- /**
1031
- * The Prettify helper is a utility type that takes an object type and makes the hover overlay more readable.
1032
- */
1033
- export type Prettify<T> = {
1034
- [K in keyof T]: T[K];
1035
- } & {};
1036
948
  /**
1037
949
  * Services available to API handlers.
1038
950
  */
@@ -1436,35 +1348,6 @@ export interface RouteSchema {
1436
1348
  * Helper type to extract inferred types from a schema, with fallback to unknown.
1437
1349
  */
1438
1350
  export type InferSchemaOutput<T> = T extends StandardSchema ? InferOutput<T> : unknown;
1439
- /**
1440
- * Context with typed body/query/headers based on the provided schema.
1441
- */
1442
- export type TypedApiHandlerContext<TSchema extends RouteSchema, TRequest extends Request = Request, TServer = any> = Omit<ApiHandlerContext<TRequest, TServer>, 'body' | 'query' | 'headers'> & {
1443
- body: InferSchemaOutput<TSchema['body']>;
1444
- query: InferSchemaOutput<TSchema['query']>;
1445
- headers: InferSchemaOutput<TSchema['headers']>;
1446
- params: InferSchemaOutput<TSchema['params']>;
1447
- };
1448
- /**
1449
- * Options for the group method.
1450
- *
1451
- * @typeParam TContext - Extended context type that middleware provides to handlers
1452
- *
1453
- * @example Group with auth middleware extending context
1454
- * ```typescript
1455
- * type AuthContext = ApiHandlerContext<BunRequest<string>, Server> & { user: User };
1456
- *
1457
- * app.group<AuthContext>('/api', (r) => {
1458
- * r.get('/profile', (ctx) => {
1459
- * // ctx.user is properly typed!
1460
- * return ctx.json({ name: ctx.user.name });
1461
- * });
1462
- * }, { middleware: [authMiddleware] });
1463
- * ```
1464
- */
1465
- export interface GroupOptions<TRequest extends Request = Request, TServer = any, TContext extends ApiHandlerContext<TRequest, TServer> = ApiHandlerContext<TRequest, TServer>> {
1466
- middleware?: Middleware<TRequest, TServer, TContext>[];
1467
- }
1468
1351
  /**
1469
1352
  * Context type that combines schema-typed fields with an extended base context.
1470
1353
  * Used by RouteGroupBuilder to merge schema validation types with middleware-extended context.
@@ -1509,7 +1392,9 @@ export interface RouteGroupBuilder<TRequest extends Request = Request, TServer =
1509
1392
  }
1510
1393
  /**
1511
1394
  * A function that dynamically imports a view module.
1512
- * Used by app.static() to enable HMR in development.
1395
+ * Used by `app.static()` and the HTML error-page helpers (`app.notFound()`,
1396
+ * `app.forbidden()`, `app.serverError()`, `app.errorPage()`, …) to enable HMR
1397
+ * in development.
1513
1398
  */
1514
1399
  export type ViewLoader<P = any> = () => Promise<{
1515
1400
  default: EcoPageComponent<P>;
@@ -1522,3 +1407,16 @@ export interface StaticRoute<P = any> {
1522
1407
  path: string;
1523
1408
  loader: ViewLoader<P>;
1524
1409
  }
1410
+ /**
1411
+ * Lazy view loaders registered through `app.errorPage()` and the named
1412
+ * `app.badRequest()` / `app.unauthorized()` / `app.forbidden()` /
1413
+ * `app.notFound()` / `app.conflict()` / `app.serverError()` helpers.
1414
+ */
1415
+ export type ErrorPageLoaders = {
1416
+ badRequest?: ViewLoader<ErrorPageTemplateProps>;
1417
+ unauthorized?: ViewLoader<ErrorPageTemplateProps>;
1418
+ forbidden?: ViewLoader<ErrorPageTemplateProps>;
1419
+ notFound?: ViewLoader<ErrorPageTemplateProps>;
1420
+ conflict?: ViewLoader<ErrorPageTemplateProps>;
1421
+ serverError?: ViewLoader<ErrorPageTemplateProps>;
1422
+ };
@@ -17,6 +17,10 @@ export interface ProjectWatcherConfig {
17
17
  hostOwnsDevClient?: boolean;
18
18
  /** Delay before a change event is processed; 0 disables debouncing. */
19
19
  changeDebounceMs?: number;
20
+ /** Applies a config or dotenv change through the owning runtime lifecycle. */
21
+ onRestartRequest?: (filePath: string) => Promise<void>;
22
+ /** Whether an entry watcher already owns changes to the config module. */
23
+ entryWatcherOwnsConfig?: boolean;
20
24
  }
21
25
  /**
22
26
  * ProjectWatcher handles file system changes for hot module replacement (HMR).
@@ -49,11 +53,14 @@ export declare class ProjectWatcher {
49
53
  private readonly hostOwnsDevClient;
50
54
  private readonly invalidationService;
51
55
  private readonly changeDebounceMs;
56
+ private readonly onRestartRequest?;
57
+ private readonly entryWatcherOwnsConfig;
58
+ private restartRequestScheduled;
52
59
  private watcher;
53
60
  private closed;
54
61
  private pendingChangeEvents;
55
62
  private changeQueue;
56
- constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge, hostOwnsDevClient, changeDebounceMs, }: ProjectWatcherConfig);
63
+ constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge, hostOwnsDevClient, changeDebounceMs, onRestartRequest, entryWatcherOwnsConfig, }: ProjectWatcherConfig);
57
64
  /**
58
65
  * Uncaches modules in the source directory to ensure fresh imports.
59
66
  * This is necessary for hot module replacement to work correctly.
@@ -61,7 +68,6 @@ export declare class ProjectWatcher {
61
68
  */
62
69
  private uncacheModules;
63
70
  private isRouteSourceFile;
64
- private isIncludeSourceFile;
65
71
  private requestBrowserReload;
66
72
  /**
67
73
  * Handles public directory file changes by copying only the changed file.
@@ -97,6 +103,7 @@ export declare class ProjectWatcher {
97
103
  private shouldDeferProcessorNotifications;
98
104
  private handleDeferredHmrFileChange;
99
105
  private handleStandardHmrFileChange;
106
+ private handleRuntimeRestart;
100
107
  private processFileChange;
101
108
  /**
102
109
  * Re-imports server modules before HMR broadcast so reload/refetch does not
@@ -112,20 +119,6 @@ export declare class ProjectWatcher {
112
119
  */
113
120
  private notifyProcessors;
114
121
  private getProcessorHandler;
115
- /**
116
- * Checks if a file is in the public directory.
117
- */
118
- private isPublicDirFile;
119
- /**
120
- * Checks if file path matches any additionalWatchPaths patterns.
121
- */
122
- private matchesAdditionalWatchPaths;
123
- /**
124
- * Checks if a file is owned by a processor as an asset input.
125
- * Ownership requires declared asset capabilities; watch config only drives
126
- * {@link notifyProcessors} notifications.
127
- */
128
- private isHandledByProcessor;
129
122
  /**
130
123
  * Triggers router refresh for page directory changes.
131
124
  * This ensures the router is updated when pages are added or removed.
@@ -9,6 +9,7 @@ import { getAppPageBrowserGraphSession } from '../route-renderer/orchestration/p
9
9
  import { isRegisteredDevTransformEntrypoint } from '../hmr/hmr-entrypoint-output.js';
10
10
  import { resolveInternalExecutionDir } from '../utils/resolve-work-dir.js';
11
11
  import { createProjectWatcherIgnorePredicate } from './project-watcher-ignore.js';
12
+ import { resolveRuntimeRestartWatchPaths } from '../dev/development-restart-watch-paths.js';
12
13
  /**
13
14
  * ProjectWatcher handles file system changes for hot module replacement (HMR).
14
15
  * It uses chokidar to watch for file changes and triggers appropriate actions:
@@ -40,11 +41,14 @@ export class ProjectWatcher {
40
41
  hostOwnsDevClient;
41
42
  invalidationService;
42
43
  changeDebounceMs;
44
+ onRestartRequest;
45
+ entryWatcherOwnsConfig;
46
+ restartRequestScheduled = false;
43
47
  watcher = null;
44
48
  closed = false;
45
49
  pendingChangeEvents = new Map();
46
50
  changeQueue = Promise.resolve();
47
- constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge, hostOwnsDevClient, changeDebounceMs, }) {
51
+ constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge, hostOwnsDevClient, changeDebounceMs, onRestartRequest, entryWatcherOwnsConfig, }) {
48
52
  this.appConfig = config;
49
53
  this.refreshRouterRoutesCallback = refreshRouterRoutesCallback;
50
54
  this.hmrManager = hmrManager;
@@ -55,6 +59,8 @@ export class ProjectWatcher {
55
59
  changeDebounceMs ??
56
60
  (envDebounceMs !== undefined && envDebounceMs !== '' ? Number(envDebounceMs) : undefined) ??
57
61
  ProjectWatcher.duplicateChangeWindowMs;
62
+ this.onRestartRequest = onRestartRequest;
63
+ this.entryWatcherOwnsConfig = entryWatcherOwnsConfig === true;
58
64
  this.invalidationService = new DevelopmentInvalidationService(config);
59
65
  this.triggerRouterRefresh = this.triggerRouterRefresh.bind(this);
60
66
  this.handleError = this.handleError.bind(this);
@@ -80,9 +86,6 @@ export class ProjectWatcher {
80
86
  isRouteSourceFile(filePath) {
81
87
  return this.invalidationService.isRouteSourceFile(filePath);
82
88
  }
83
- isIncludeSourceFile(filePath) {
84
- return this.invalidationService.isIncludeSourceFile(filePath);
85
- }
86
89
  requestBrowserReload() {
87
90
  if (this.hostOwnsDevClient) {
88
91
  return;
@@ -196,9 +199,33 @@ export class ProjectWatcher {
196
199
  });
197
200
  }
198
201
  }
202
+ handleRuntimeRestart(filePath) {
203
+ const onRestartRequest = this.onRestartRequest;
204
+ if (!onRestartRequest) {
205
+ appLogger.warn(`Configuration or environment file changed (${filePath}). Restart the development server to apply it.`);
206
+ return;
207
+ }
208
+ if (this.restartRequestScheduled) {
209
+ return;
210
+ }
211
+ this.restartRequestScheduled = true;
212
+ void this.changeQueue
213
+ .then(() => onRestartRequest(filePath))
214
+ .catch((error) => this.handleError(error))
215
+ .finally(() => {
216
+ this.restartRequestScheduled = false;
217
+ });
218
+ }
199
219
  async processFileChange(filePath, event) {
200
220
  try {
201
221
  const plan = this.invalidationService.planFileChange(filePath);
222
+ if (plan.category === 'runtime-restart') {
223
+ if (this.entryWatcherOwnsConfig && this.invalidationService.isConfigModuleFile(filePath)) {
224
+ return;
225
+ }
226
+ this.handleRuntimeRestart(filePath);
227
+ return;
228
+ }
202
229
  if (plan.category === 'public-asset') {
203
230
  await this.handlePublicDirFileChange(filePath);
204
231
  return;
@@ -224,10 +251,7 @@ export class ProjectWatcher {
224
251
  await this.handleStandardHmrFileChange(filePath, event, plan, graphPreparation);
225
252
  }
226
253
  catch (error) {
227
- if (error instanceof Error) {
228
- this.bridge.error(error.message);
229
- this.handleError(error);
230
- }
254
+ this.handleError(error);
231
255
  }
232
256
  }
233
257
  /**
@@ -299,26 +323,6 @@ export class ProjectWatcher {
299
323
  return watchConfig.onDelete;
300
324
  }
301
325
  }
302
- /**
303
- * Checks if a file is in the public directory.
304
- */
305
- isPublicDirFile(filePath) {
306
- return this.invalidationService.isPublicDirFile(filePath);
307
- }
308
- /**
309
- * Checks if file path matches any additionalWatchPaths patterns.
310
- */
311
- matchesAdditionalWatchPaths(filePath) {
312
- return this.invalidationService.matchesAdditionalWatchPaths(filePath);
313
- }
314
- /**
315
- * Checks if a file is owned by a processor as an asset input.
316
- * Ownership requires declared asset capabilities; watch config only drives
317
- * {@link notifyProcessors} notifications.
318
- */
319
- isHandledByProcessor(filePath) {
320
- return this.invalidationService.isProcessorOwnedAsset(filePath);
321
- }
322
326
  /**
323
327
  * Triggers router refresh for page directory changes.
324
328
  * This ensures the router is updated when pages are added or removed.
@@ -384,6 +388,9 @@ export class ProjectWatcher {
384
388
  : path.resolve(this.appConfig.rootDir, watchPath);
385
389
  processorPaths.add(resolvedWatchPath);
386
390
  }
391
+ for (const restartPath of resolveRuntimeRestartWatchPaths(this.appConfig)) {
392
+ processorPaths.add(restartPath);
393
+ }
387
394
  const ignored = createProjectWatcherIgnorePredicate(this.appConfig.absolutePaths);
388
395
  this.watcher = chokidar.watch(Array.from(processorPaths), {
389
396
  ignoreInitial: true,
@@ -1,4 +1,13 @@
1
- import type { IHmrManager } from '../types/internal-types.js';
1
+ import type { EcoPagesAppConfig, IHmrManager } from '../types/internal-types.js';
2
2
  import type { ClientBridge } from '../adapters/bun/client-bridge.js';
3
3
  export declare const createMockHmrManager: () => IHmrManager;
4
4
  export declare const createMockBridge: () => ClientBridge;
5
+ /**
6
+ * Installs the in-memory entrypoint dependency graph that the HMR managers
7
+ * provide in dev.
8
+ *
9
+ * @remarks
10
+ * `ConfigBuilder.build()` already installs the invalidation counter and a
11
+ * no-op graph; this swaps in a graph that records dependencies.
12
+ */
13
+ export declare function installDevRuntimeState(appConfig: EcoPagesAppConfig): void;
@@ -1,4 +1,5 @@
1
1
  import { vi } from 'vitest';
2
+ import { InMemoryEntrypointDependencyGraph, setAppEntrypointDependencyGraph, } from '../services/runtime-state/entrypoint-dependency-graph.service.js';
2
3
  export const createMockHmrManager = () => ({
3
4
  handleFileChange: vi.fn(async () => { }),
4
5
  broadcast: vi.fn(() => { }),
@@ -45,3 +46,14 @@ export const createMockBridge = () => ({
45
46
  broadcast: vi.fn(() => { }),
46
47
  subscriberCount: 0,
47
48
  });
49
+ /**
50
+ * Installs the in-memory entrypoint dependency graph that the HMR managers
51
+ * provide in dev.
52
+ *
53
+ * @remarks
54
+ * `ConfigBuilder.build()` already installs the invalidation counter and a
55
+ * no-op graph; this swaps in a graph that records dependencies.
56
+ */
57
+ export function installDevRuntimeState(appConfig) {
58
+ setAppEntrypointDependencyGraph(appConfig, new InMemoryEntrypointDependencyGraph());
59
+ }