@ecopages/core 0.2.0-rc.8 → 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 (216) 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/custom-element-scripts/README.md +2 -2
  137. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +14 -2
  138. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +12 -5
  139. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.d.ts +8 -0
  140. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +19 -0
  141. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +1 -4
  142. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +25 -24
  143. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +18 -20
  144. package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -7
  145. package/src/route-renderer/orchestration/integration-renderer.js +44 -33
  146. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
  147. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
  148. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
  149. package/src/route-renderer/route-renderer.d.ts +9 -0
  150. package/src/route-renderer/route-renderer.js +18 -0
  151. package/src/services/README.md +2 -1
  152. package/src/services/assets/browser-bundle.service.d.ts +1 -6
  153. package/src/services/error-pages/README.md +9 -0
  154. package/src/services/error-pages/default-error-pages.d.ts +39 -0
  155. package/src/services/error-pages/default-error-pages.js +199 -0
  156. package/src/services/error-pages/error-page-renderer.d.ts +58 -0
  157. package/src/services/error-pages/error-page-renderer.js +146 -0
  158. package/src/services/error-pages/semantic-error-page-exporter.d.ts +23 -0
  159. package/src/services/error-pages/semantic-error-page-exporter.js +35 -0
  160. package/src/services/html/html-rewriter.d.ts +77 -0
  161. package/src/services/html/html-rewriter.js +751 -0
  162. package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
  163. package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
  164. package/src/services/html/html-transformer.service.d.ts +29 -42
  165. package/src/services/html/html-transformer.service.js +85 -157
  166. package/src/services/invalidation/development-invalidation.service.d.ts +9 -20
  167. package/src/services/invalidation/development-invalidation.service.js +26 -39
  168. package/src/services/module-loading/README.md +20 -15
  169. package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
  170. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
  171. package/src/services/module-loading/app-server-module-transpiler.service.js +2 -10
  172. package/src/services/module-loading/collection-server-module-build.service.d.ts +0 -1
  173. package/src/services/module-loading/collection-server-module-build.service.js +0 -3
  174. package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
  175. package/src/services/module-loading/host-module-loader-registry.js +0 -3
  176. package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
  177. package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
  178. package/src/services/module-loading/route-module-build-cache.store.d.ts +8 -0
  179. package/src/services/module-loading/route-module-build-cache.store.js +25 -7
  180. package/src/services/module-loading/route-module-build-manifest.d.ts +12 -1
  181. package/src/services/module-loading/route-module-build-manifest.js +7 -3
  182. package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
  183. package/src/services/module-loading/route-module-dependency-hasher.js +13 -1
  184. package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
  185. package/src/services/module-loading/server-module-transpiler.service.js +0 -24
  186. package/src/services/module-loading/view-module-loader.d.ts +10 -0
  187. package/src/services/module-loading/view-module-loader.js +46 -0
  188. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
  189. package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
  190. package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
  191. package/src/static-site-generator/README.md +12 -8
  192. package/src/static-site-generator/static-site-generator.d.ts +3 -2
  193. package/src/static-site-generator/static-site-generator.js +17 -3
  194. package/src/types/internal-types.d.ts +1 -38
  195. package/src/types/public-types.d.ts +28 -130
  196. package/src/watchers/project-watcher.d.ts +9 -16
  197. package/src/watchers/project-watcher.js +35 -28
  198. package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
  199. package/src/watchers/project-watcher.test-helpers.js +12 -0
  200. package/src/adapters/abstract/router-adapter.d.ts +0 -26
  201. package/src/adapters/abstract/router-adapter.js +0 -13
  202. package/src/adapters/bun/index.d.ts +0 -2
  203. package/src/adapters/bun/index.js +0 -2
  204. package/src/adapters/index.d.ts +0 -2
  205. package/src/adapters/index.js +0 -2
  206. package/src/eco/eco.utils.d.ts +0 -1
  207. package/src/eco/eco.utils.js +0 -1
  208. package/src/services/cache/index.d.ts +0 -9
  209. package/src/services/cache/index.js +0 -8
  210. package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
  211. package/src/services/html/html-rewriter-provider.service.js +0 -68
  212. package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
  213. package/src/services/module-loading/route-module-build-cache.js +0 -3
  214. package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
  215. package/src/services/runtime-state/dev-graph.service.js +0 -170
  216. /package/src/{adapters/shared/http/explicit-static-render-preparation.js → route-renderer/explicit-view-render-preparation.js} +0 -0
@@ -20,18 +20,18 @@ Call site (route scan, renderer, SSG, API)
20
20
 
21
21
  ## Host vs app ownership
22
22
 
23
- | Path | When |
24
- | ----------------------- | -------------------------------------------------------------------------------------------- |
25
- | Host loader | `appConfig.runtime.hostModuleLoader` set (Vite host) and file supports direct source loading |
26
- | Ecopages build pipeline | Framework-owned template files under `pages/`, `includes/`, etc. |
23
+ | Path | When |
24
+ | ----------------------- | ----------------------------------------------------------------------------------------------- |
25
+ | Host loader | `appConfig.runtime.hostModuleLoader` set (Vite host) and file supports direct source loading |
26
+ | Ecopages build pipeline | Framework-owned template files under `pages/`, `includes/`, `layouts/`, `components/`, `views/` |
27
27
 
28
28
  `shouldAppUseHostModuleLoader()` encodes the directory + extension rules. Bun always uses the build pipeline today.
29
29
 
30
30
  ## Caching layers
31
31
 
32
32
  1. **In-memory promise cache** (`PageModuleImportService.importCache`) — keyed by runtime, file path, content-derived reuse identity (`createRouteModuleReuseIdentity`), and source hash. Cleared by `invalidateDevelopmentGraph()`.
33
- 2. **Disk transpile cache** (`.eco/.server-modules/.build-cache.json`) — production and stable development graphs when dependency hashes match. Manifest field `corePackageVersion` invalidates entries when the framework package changes.
34
- 3. **Unified graph manifest** — production static export fast path only; see build layer docs.
33
+ 2. **Disk transpile cache** (`.eco/.server-modules/.build-cache.json`) — production and stable development graphs when dependency hashes match. Manifest field `corePackageVersion` invalidates entries when the framework package changes. An entry is also reused only while every local file its compiled output imports still exists. Rebuilding a route module (`recordBuild()`) drops `renderedOutputs` so incremental static generation re-renders HTML instead of serving stale output after dependency or template edits.
34
+ 3. **Unified graph manifest** — production static export fast path only; see build layer docs. Reuse also requires matching source-file hashes and an exact match against the active template route set, so a deleted or edited layout or component cannot keep serving its compiled chunk.
35
35
 
36
36
  Development import URLs use `sourceHash` plus a per-service import generation counter. Node uses that value in its `?update=` query. Bun also receives a generation-specific compiled output filename because it retains a previously imported file when only its query changes. Both paths advance after `invalidateDevelopmentGraph()` without a process-wide invalidation version in reuse keys.
37
37
 
@@ -39,15 +39,20 @@ Compiled collection server modules also include the app-owned server invalidatio
39
39
 
40
40
  ## Files
41
41
 
42
- | File | Role |
43
- | ----------------------------------------- | --------------------------------------------------------- |
44
- | `page-module-import.service.ts` | Core import/cache/build orchestration |
45
- | `route-module-build-manifest.ts` | Content-derived reuse identity and disk cache manifest |
46
- | `app-module-loader.service.ts` | App-facing loader interface |
47
- | `app-server-module-transpiler.service.ts` | Factory for app-scoped loader + transpiler |
48
- | `server-module-transpiler.service.ts` | Injectable transpiler boundary for tests and bootstrap |
49
- | `host-module-loader-registry.ts` | Process-global host loader fallback for embedded runtimes |
50
- | `source-module-support.ts` | Extension allowlist for host direct loading |
42
+ | File | Role |
43
+ | ------------------------------------------- | ---------------------------------------------------------------- |
44
+ | `page-module-import.service.ts` | Core import/cache/build orchestration |
45
+ | `route-module-build-manifest.ts` | Content-derived reuse identity and disk cache manifest |
46
+ | `route-module-build-cache.store.ts` | Persisted route-module transpile and static-render cache store |
47
+ | `route-module-build-cache-registry.ts` | Shared cache instance registry per `(appConfig, outdir)` pair |
48
+ | `route-module-dependency-hasher.ts` | Dependency graph source file hashing and staleness validation |
49
+ | `collection-server-module-build.service.ts` | Compiles collection server modules with invalidation stamping |
50
+ | `app-module-loader.service.ts` | App-facing loader interface |
51
+ | `app-server-module-transpiler.service.ts` | Factory for app-scoped loader + transpiler |
52
+ | `server-module-transpiler.service.ts` | Injectable transpiler boundary for tests and bootstrap |
53
+ | `view-module-loader.ts` | Normalizes string/URL view registrations into transpiler loaders |
54
+ | `host-module-loader-registry.ts` | Process-global host loader fallback for embedded runtimes |
55
+ | `source-module-support.ts` | Extension allowlist for host direct loading |
51
56
 
52
57
  ## Development invalidation
53
58
 
@@ -1,7 +1,5 @@
1
1
  import type { PageModuleBuildImportOptions } from './page-module-import.service.js';
2
- export type AppModuleLoaderOwner = 'app' | 'host';
3
2
  export interface AppModuleLoader {
4
- readonly owner: AppModuleLoaderOwner;
5
3
  importModule<T = unknown>(options: PageModuleBuildImportOptions): Promise<T>;
6
4
  invalidateDevelopmentGraph(): void;
7
5
  }
@@ -1,5 +1,5 @@
1
1
  import type { EcoPagesAppConfig } from '../../types/internal-types.js';
2
- import { type AppModuleLoader } from './app-module-loader.service.js';
2
+ import type { AppModuleLoader } from './app-module-loader.service.js';
3
3
  import type { SourceModuleLoader } from './module-loading-types.js';
4
4
  import { ServerModuleTranspiler } from './server-module-transpiler.service.js';
5
5
  export declare function shouldAppUseHostModuleLoader(appConfig: EcoPagesAppConfig, filePath: string): boolean;
@@ -1,7 +1,5 @@
1
1
  import { requireBuildRuntime } from '../../build/runtime/build-runtime.js';
2
2
  import path from 'node:path';
3
- import { DevelopmentInvalidationService } from '../invalidation/development-invalidation.service.js';
4
- import {} from './app-module-loader.service.js';
5
3
  import { PageModuleImportService } from './page-module-import.service.js';
6
4
  import { supportsSourceModuleLoading } from './source-module-support.js';
7
5
  import { ServerModuleTranspiler } from './server-module-transpiler.service.js';
@@ -10,11 +8,13 @@ export function shouldAppUseHostModuleLoader(appConfig, filePath) {
10
8
  return supportsSourceModuleLoading(filePath);
11
9
  }
12
10
  const normalizedFilePath = path.normalize(filePath);
11
+ const viewsDir = path.join(appConfig.absolutePaths.srcDir, 'views');
13
12
  const frameworkOwnedDirectories = [
14
13
  appConfig.absolutePaths.pagesDir,
15
14
  appConfig.absolutePaths.includesDir,
16
15
  appConfig.absolutePaths.layoutsDir,
17
16
  appConfig.absolutePaths.componentsDir,
17
+ viewsDir,
18
18
  ].map((directoryPath) => path.normalize(directoryPath));
19
19
  const isFrameworkOwnedModule = frameworkOwnedDirectories.some((directoryPath) => {
20
20
  return normalizedFilePath === directoryPath || normalizedFilePath.startsWith(`${directoryPath}${path.sep}`);
@@ -25,9 +25,6 @@ export function shouldAppUseHostModuleLoader(appConfig, filePath) {
25
25
  export function getAppHostModuleLoader(appConfig) {
26
26
  return appConfig.runtime?.hostModuleLoader;
27
27
  }
28
- function getAppModuleLoaderOwner(appConfig) {
29
- return getAppHostModuleLoader(appConfig) ? 'host' : 'app';
30
- }
31
28
  export function setAppHostModuleLoader(appConfig, hostModuleLoader) {
32
29
  appConfig.runtime = {
33
30
  ...(appConfig.runtime ?? {}),
@@ -48,9 +45,6 @@ export function createAppModuleLoader(appConfig) {
48
45
  getHostModuleLoader: () => getAppHostModuleLoader(appConfig),
49
46
  });
50
47
  const appModuleLoader = {
51
- get owner() {
52
- return getAppModuleLoaderOwner(appConfig);
53
- },
54
48
  pageModuleImportService,
55
49
  async importModule(options) {
56
50
  return await pageModuleImportService.importModule({
@@ -84,10 +78,8 @@ export function setAppModuleLoader(appConfig, appModuleLoader) {
84
78
  * instance.
85
79
  */
86
80
  export function createAppServerModuleTranspiler(appConfig) {
87
- const invalidationService = new DevelopmentInvalidationService(appConfig);
88
81
  return new ServerModuleTranspiler({
89
82
  rootDir: appConfig.rootDir,
90
- invalidateModules: (changedFiles) => invalidationService.invalidateServerModules(changedFiles),
91
83
  pageModuleImportService: getAppModuleLoader(appConfig),
92
84
  });
93
85
  }
@@ -7,7 +7,6 @@ export type CollectionServerBuildArtifact = {
7
7
  buildIdentity: string;
8
8
  invalidationVersion: number;
9
9
  };
10
- export declare function getCollectionServerBuildArtifact(appConfig: EcoPagesAppConfig, collectionName: string): CollectionServerBuildArtifact | undefined;
11
10
  export declare function clearCollectionServerBuildArtifacts(appConfig: EcoPagesAppConfig): void;
12
11
  /**
13
12
  * Builds one generated collection server module as an independent server unit.
@@ -17,9 +17,6 @@ function getArtifactMap(appConfig) {
17
17
  }
18
18
  return artifacts;
19
19
  }
20
- export function getCollectionServerBuildArtifact(appConfig, collectionName) {
21
- return getArtifactMap(appConfig).get(collectionName);
22
- }
23
20
  export function clearCollectionServerBuildArtifacts(appConfig) {
24
21
  getArtifactMap(appConfig).clear();
25
22
  }
@@ -1,4 +1,3 @@
1
1
  import type { SourceModuleLoader } from './module-loading-types.js';
2
2
  export declare function setHostModuleLoader(loader: SourceModuleLoader): void;
3
3
  export declare function getHostModuleLoader(): SourceModuleLoader | undefined;
4
- export declare function clearHostModuleLoader(): void;
@@ -5,6 +5,3 @@ export function setHostModuleLoader(loader) {
5
5
  export function getHostModuleLoader() {
6
6
  return hostModuleLoader;
7
7
  }
8
- export function clearHostModuleLoader() {
9
- hostModuleLoader = undefined;
10
- }
@@ -10,10 +10,6 @@ import { RouteModuleBuildCache } from './route-module-build-cache.store.js';
10
10
  * scanning.
11
11
  */
12
12
  export declare function getServerModuleBuildCacheOutdir(appConfig: EcoPagesAppConfig): string;
13
- /**
14
- * @deprecated Use {@link getServerModuleBuildCacheOutdir}.
15
- */
16
- export declare const getRouteModuleBuildCacheOutdir: typeof getServerModuleBuildCacheOutdir;
17
13
  /**
18
14
  * Returns the shared production build cache for one server-module outdir.
19
15
  *
@@ -13,10 +13,6 @@ import { RouteModuleBuildCache } from './route-module-build-cache.store.js';
13
13
  export function getServerModuleBuildCacheOutdir(appConfig) {
14
14
  return path.join(resolveInternalExecutionDir(appConfig), '.server-modules');
15
15
  }
16
- /**
17
- * @deprecated Use {@link getServerModuleBuildCacheOutdir}.
18
- */
19
- export const getRouteModuleBuildCacheOutdir = getServerModuleBuildCacheOutdir;
20
16
  function getRouteModuleBuildCacheMap(appConfig) {
21
17
  const existing = appConfig.runtime?.routeModuleBuildCaches;
22
18
  if (existing) {
@@ -6,6 +6,7 @@ type RouteModuleBuildCacheDependencies = {
6
6
  readManifest: (manifestPath: string) => RouteModuleBuildCacheManifest | undefined;
7
7
  writeManifest: (manifestPath: string, manifest: RouteModuleBuildCacheManifest) => void;
8
8
  exists: (filePath: string) => boolean;
9
+ readFile: (filePath: string) => string;
9
10
  getCorePackageVersion: () => string;
10
11
  createDependencyHasher: () => RouteModuleDependencyHasher;
11
12
  };
@@ -22,10 +23,17 @@ export declare class RouteModuleBuildCache {
22
23
  lookup(options: PageModuleBuildImportOptions & {
23
24
  fileHash: string;
24
25
  }): RouteModuleBuildCacheLookup | undefined;
26
+ /**
27
+ * @remarks
28
+ * Replaces the transpile entry and drops `renderedOutputs`. Rebuilt modules
29
+ * must re-render HTML; otherwise a layout edit can keep the previous page.
30
+ */
25
31
  recordBuild(options: PageModuleBuildImportOptions & {
26
32
  fileHash: string;
27
33
  outputPath: string;
28
34
  dependencyModulePaths?: readonly string[];
35
+ /** Local imports of the output when the caller already collected them. */
36
+ outputImports?: string[];
29
37
  }): void;
30
38
  isIncrementalStaticGenerationAvailable(context: RouteModuleStaticRenderCacheContext): boolean;
31
39
  ensureIncrementalStaticGenerationContext(context: RouteModuleStaticRenderCacheContext): void;
@@ -1,7 +1,9 @@
1
1
  import path from 'node:path';
2
2
  import { fileSystem } from '@ecopages/file-system';
3
+ import { collectReachableLocalImports } from '../../build/cache/output-imports.js';
3
4
  import { RouteModuleDependencyHasher } from './route-module-dependency-hasher.js';
4
- import { ROUTE_MODULE_BUILD_CACHE_FILENAME, createEmptyRouteModuleBuildCacheManifest, createPersistedRouteModuleBuildKey, getCorePackageVersion, normalizeRouteModuleCachePath, readRouteModuleBuildCacheManifest, shouldPersistRouteModuleBuildCache, writeRouteModuleBuildCacheManifest, } from './route-module-build-manifest.js';
5
+ import { ROUTE_MODULE_BUILD_CACHE_FILENAME, createEmptyRouteModuleBuildCacheManifest, createPersistedRouteModuleBuildKey, normalizeRouteModuleCachePath, readRouteModuleBuildCacheManifest, shouldPersistRouteModuleBuildCache, writeRouteModuleBuildCacheManifest, } from './route-module-build-manifest.js';
6
+ import { getCorePackageVersion } from '../../build/cache/cache-keys.js';
5
7
  import { isProductionCacheManifestCurrent, matchesProductionCacheFingerprint, } from '../../build/cache/production-build-cache.js';
6
8
  /**
7
9
  * Persists route-module transpile and static-render metadata under one server outdir.
@@ -18,6 +20,7 @@ export class RouteModuleBuildCache {
18
20
  readManifest: dependencies?.readManifest ?? readRouteModuleBuildCacheManifest,
19
21
  writeManifest: dependencies?.writeManifest ?? writeRouteModuleBuildCacheManifest,
20
22
  exists: dependencies?.exists ?? ((filePath) => fileSystem.exists(filePath)),
23
+ readFile: dependencies?.readFile ?? ((filePath) => fileSystem.readFileSync(filePath)),
21
24
  getCorePackageVersion: dependencies?.getCorePackageVersion ?? getCorePackageVersion,
22
25
  createDependencyHasher: dependencies?.createDependencyHasher ?? (() => new RouteModuleDependencyHasher()),
23
26
  };
@@ -40,14 +43,20 @@ export class RouteModuleBuildCache {
40
43
  if (!this.dependencyHasher.matchesStoredHashes(entry.dependencyHashes, cacheFilePath, options.fileHash)) {
41
44
  return undefined;
42
45
  }
43
- const outputPath = path.isAbsolute(entry.outputPath)
44
- ? entry.outputPath
45
- : path.join(options.outdir, entry.outputPath);
46
+ const outputPath = resolveOutputPath(entry.outputPath, options.outdir);
46
47
  if (!this.dependencies.exists(outputPath)) {
47
48
  return undefined;
48
49
  }
50
+ if (!entry.outputImports.every((importPath) => this.dependencies.exists(importPath))) {
51
+ return undefined;
52
+ }
49
53
  return { outputPath, entry };
50
54
  }
55
+ /**
56
+ * @remarks
57
+ * Replaces the transpile entry and drops `renderedOutputs`. Rebuilt modules
58
+ * must re-render HTML; otherwise a layout edit can keep the previous page.
59
+ */
51
60
  recordBuild(options) {
52
61
  if (!shouldPersistRouteModuleBuildCache(options)) {
53
62
  return;
@@ -58,8 +67,8 @@ export class RouteModuleBuildCache {
58
67
  : [cacheFilePath];
59
68
  const dependencyHashes = this.dependencyHasher.createDependencyHashes(dependencyModulePaths);
60
69
  dependencyHashes[cacheFilePath] = options.fileHash;
70
+ const outputPath = resolveOutputPath(options.outputPath, options.outdir);
61
71
  const manifest = this.loadManifest();
62
- const existingEntry = manifest.entries[cacheFilePath];
63
72
  manifest.corePackageVersion = this.dependencies.getCorePackageVersion();
64
73
  manifest.entries[cacheFilePath] = {
65
74
  sourceHash: options.fileHash,
@@ -67,7 +76,13 @@ export class RouteModuleBuildCache {
67
76
  builtAt: Date.now(),
68
77
  buildKey: createPersistedRouteModuleBuildKey(options, options.sourceTransforms),
69
78
  dependencyHashes,
70
- renderedOutputs: existingEntry?.renderedOutputs,
79
+ outputImports: options.outputImports ??
80
+ collectReachableLocalImports(outputPath, {
81
+ fileAccess: {
82
+ exists: (filePath) => this.dependencies.exists(filePath),
83
+ readFile: (filePath) => this.dependencies.readFile(filePath),
84
+ },
85
+ }),
71
86
  };
72
87
  this.persistManifest(manifest);
73
88
  }
@@ -144,11 +159,11 @@ export class RouteModuleBuildCache {
144
159
  manifest.configHash = options.context.configHash;
145
160
  manifest.buildInputsFingerprint = options.context.buildInputsFingerprint;
146
161
  manifest.entries[cacheFilePath] = {
162
+ ...existingEntry,
147
163
  sourceHash: options.sourceHash,
148
164
  outputPath: existingEntry?.outputPath ?? '',
149
165
  builtAt: existingEntry?.builtAt ?? Date.now(),
150
166
  buildKey: existingEntry?.buildKey ?? '',
151
- dependencyHashes: existingEntry?.dependencyHashes,
152
167
  renderedOutputs: {
153
168
  ...(existingEntry?.renderedOutputs ?? {}),
154
169
  [options.pathname]: {
@@ -218,3 +233,6 @@ export class RouteModuleBuildCache {
218
233
  this.dependencies.writeManifest(this.manifestPath, manifest);
219
234
  }
220
235
  }
236
+ function resolveOutputPath(outputPath, outdir) {
237
+ return path.isAbsolute(outputPath) ? outputPath : path.join(outdir, outputPath);
238
+ }
@@ -1,7 +1,6 @@
1
1
  import type { BuildOptions } from '../../build/contracts/build-contracts.js';
2
2
  import type { PageModuleBuildImportOptions } from './page-module-import.service.js';
3
3
  import type { RouteModuleDependencyHashes } from './route-module-dependency-hasher.js';
4
- export { createJsxCacheKey, createPluginCacheKey, getCorePackageVersion, hashPluginSetup, } from '../../build/cache/cache-keys.js';
5
4
  export { ROUTE_MODULE_BUILD_CACHE_FILENAME } from '../../build/cache/cache-constants.js';
6
5
  /** One persisted route-module build entry in {@link ROUTE_MODULE_BUILD_CACHE_FILENAME}. */
7
6
  export interface RouteModuleBuildCacheEntry {
@@ -10,6 +9,12 @@ export interface RouteModuleBuildCacheEntry {
10
9
  builtAt: number;
11
10
  buildKey: string;
12
11
  dependencyHashes?: RouteModuleDependencyHashes;
12
+ /**
13
+ * Local files reachable from the compiled output through local imports,
14
+ * including shared chunks and collection modules. The entry is reused only
15
+ * while all of them exist.
16
+ */
17
+ outputImports: string[];
13
18
  renderedOutputs?: Record<string, RouteModuleStaticRenderCacheEntry>;
14
19
  }
15
20
  /** Metadata for one rendered static HTML artifact derived from a route module. */
@@ -20,6 +25,7 @@ export interface RouteModuleStaticRenderCacheEntry {
20
25
  }
21
26
  /** On-disk manifest describing all cached route-module builds for one server outdir. */
22
27
  export interface RouteModuleBuildCacheManifest {
28
+ /** `getCorePackageVersion()` of the build that wrote the manifest. */
23
29
  corePackageVersion: string;
24
30
  configHash?: string;
25
31
  buildInputsFingerprint?: string;
@@ -53,5 +59,10 @@ export declare function resolvePageModuleOutputFileName(options: {
53
59
  /** Builds the cache key for persisted production route-module builds. */
54
60
  export declare function createPersistedRouteModuleBuildKey(options: PageModuleBuildImportOptions, sourceTransforms?: BuildOptions['sourceTransforms']): string;
55
61
  export declare function createEmptyRouteModuleBuildCacheManifest(): RouteModuleBuildCacheManifest;
62
+ /**
63
+ * @remarks
64
+ * Entries without `outputImports` predate import validation and cannot show that
65
+ * their chunks still exist, so they are dropped and rebuild on the next lookup.
66
+ */
56
67
  export declare function readRouteModuleBuildCacheManifest(manifestPath: string): RouteModuleBuildCacheManifest | undefined;
57
68
  export declare function writeRouteModuleBuildCacheManifest(manifestPath: string, manifest: RouteModuleBuildCacheManifest): void;
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { readProductionCacheManifest, writeProductionCacheManifest } from '../../build/cache/production-build-cache.js';
3
3
  import { createJsxCacheKey, createPluginCacheKey, createSourceTransformCacheKey, getCorePackageVersion, } from '../../build/cache/cache-keys.js';
4
- export { createJsxCacheKey, createPluginCacheKey, getCorePackageVersion, hashPluginSetup, } from '../../build/cache/cache-keys.js';
5
4
  export { ROUTE_MODULE_BUILD_CACHE_FILENAME } from '../../build/cache/cache-constants.js';
6
5
  /** Normalizes filesystem paths used as manifest keys and build-key inputs. */
7
6
  export function normalizeRouteModuleCachePath(filePath) {
@@ -43,16 +42,21 @@ export function createEmptyRouteModuleBuildCacheManifest() {
43
42
  entries: {},
44
43
  };
45
44
  }
45
+ /**
46
+ * @remarks
47
+ * Entries without `outputImports` predate import validation and cannot show that
48
+ * their chunks still exist, so they are dropped and rebuild on the next lookup.
49
+ */
46
50
  export function readRouteModuleBuildCacheManifest(manifestPath) {
47
51
  const parsed = readProductionCacheManifest(manifestPath);
48
52
  if (!parsed || typeof parsed.entries !== 'object') {
49
53
  return undefined;
50
54
  }
51
55
  return {
52
- corePackageVersion: parsed.corePackageVersion ?? parsed.invalidationVersion ?? '',
56
+ corePackageVersion: parsed.corePackageVersion ?? '',
53
57
  configHash: parsed.configHash,
54
58
  buildInputsFingerprint: parsed.buildInputsFingerprint,
55
- entries: parsed.entries,
59
+ entries: Object.fromEntries(Object.entries(parsed.entries).filter(([, entry]) => Array.isArray(entry.outputImports))),
56
60
  };
57
61
  }
58
62
  export function writeRouteModuleBuildCacheManifest(manifestPath, manifest) {
@@ -5,8 +5,9 @@ import type { BuildResult } from '../../build/build-adapter.js';
5
5
  * @remarks
6
6
  * Keys are normalized absolute filesystem paths. Values are opaque content hashes
7
7
  * produced by the active {@link FileSystem} implementation. Only app-owned source
8
- * files are tracked; `node:` builtins and `node_modules` paths are excluded
9
- * because they are covered by the core package {@link getCorePackageVersion | invalidation version}.
8
+ * files are tracked; `node:` builtins and `node_modules` paths are excluded.
9
+ * Installed packages stay external to route modules, and framework code changes
10
+ * with a release, which the core package version covers.
10
11
  */
11
12
  export type RouteModuleDependencyHashes = Record<string, string>;
12
13
  type HashFileFn = (filePath: string) => string;
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
  import { fileSystem } from '@ecopages/file-system';
3
4
  /**
@@ -129,10 +130,21 @@ export function resolveRouteModuleDependencyPaths(buildResult, entrypointPath, r
129
130
  const normalizedEntrypoint = path.isAbsolute(entrypointPath)
130
131
  ? path.normalize(entrypointPath)
131
132
  : path.normalize(path.resolve(rootDir, entrypointPath));
133
+ let realEntrypoint;
134
+ try {
135
+ realEntrypoint = fileSystem.exists(normalizedEntrypoint) ? fs.realpathSync(normalizedEntrypoint) : undefined;
136
+ }
137
+ catch {
138
+ // fall back
139
+ }
132
140
  const graphEntrypoints = buildResult.dependencyGraph?.entrypoints ?? {};
133
141
  const dependencyPaths = graphEntrypoints[normalizedEntrypoint] ??
142
+ (realEntrypoint ? graphEntrypoints[realEntrypoint] : undefined) ??
134
143
  graphEntrypoints[entrypointPath] ??
135
- Object.entries(graphEntrypoints).find(([candidate]) => path.normalize(candidate) === normalizedEntrypoint)?.[1];
144
+ Object.entries(graphEntrypoints).find(([candidate]) => {
145
+ const norm = path.normalize(candidate);
146
+ return norm === normalizedEntrypoint || (realEntrypoint !== undefined && norm === realEntrypoint);
147
+ })?.[1];
136
148
  if (!dependencyPaths || dependencyPaths.length === 0) {
137
149
  return [normalizedEntrypoint];
138
150
  }
@@ -4,7 +4,7 @@ import type { AppModuleLoader } from './app-module-loader.service.js';
4
4
  import { type PageModuleBuildImportOptions } from './page-module-import.service.js';
5
5
  import type { SourceModuleLoaderFactory } from './module-loading-types.js';
6
6
  export type ServerModuleTranspilerOptions = Omit<PageModuleBuildImportOptions, 'rootDir' | 'buildExecutor'>;
7
- export type ServerModuleImportDependency = Pick<AppModuleLoader, 'importModule' | 'invalidateDevelopmentGraph'>;
7
+ export type ServerModuleImportDependency = Pick<AppModuleLoader, 'importModule'>;
8
8
  /**
9
9
  * Immutable execution context for one server-transpiler instance.
10
10
  *
@@ -18,7 +18,6 @@ export type ServerModuleTranspilerBootstrapArgs = {
18
18
  getBuildExecutor?: () => BuildExecutor | undefined;
19
19
  canLoadSourceModuleFromHost?: (filePath: string) => boolean;
20
20
  getHostModuleLoader?: SourceModuleLoaderFactory;
21
- invalidateModules?: (changedFiles?: string[]) => void;
22
21
  pageModuleImportService?: ServerModuleImportDependency;
23
22
  /** Factory evaluated on each importModule call to produce plugins applied to every load. */
24
23
  getDefaultPlugins?: () => EcoBuildPlugin[];
@@ -34,7 +33,6 @@ export declare class ServerModuleTranspiler {
34
33
  private readonly pageModuleImportService;
35
34
  private readonly getRootDir;
36
35
  private readonly getBuildExecutor;
37
- private readonly invalidateModules;
38
36
  private readonly getDefaultPlugins;
39
37
  /**
40
38
  * Creates one explicit server-transpiler boundary for a given execution
@@ -46,16 +44,4 @@ export declare class ServerModuleTranspiler {
46
44
  * context.
47
45
  */
48
46
  importModule<T = unknown>(options: ServerModuleTranspilerOptions): Promise<T>;
49
- /**
50
- * Invalidates cached module state for development reloads.
51
- */
52
- invalidate(changedFiles?: string[]): void;
53
- /**
54
- * Releases transpiler-owned resources.
55
- *
56
- * @remarks
57
- * The current implementation delegates cache ownership to lower-level module
58
- * loading services, so disposal is intentionally a no-op for now.
59
- */
60
- dispose(): Promise<void>;
61
47
  }
@@ -10,7 +10,6 @@ export class ServerModuleTranspiler {
10
10
  pageModuleImportService;
11
11
  getRootDir;
12
12
  getBuildExecutor;
13
- invalidateModules;
14
13
  getDefaultPlugins;
15
14
  /**
16
15
  * Creates one explicit server-transpiler boundary for a given execution
@@ -26,13 +25,6 @@ export class ServerModuleTranspiler {
26
25
  this.getRootDir = () => args.rootDir;
27
26
  this.getBuildExecutor = args.getBuildExecutor ?? (() => undefined);
28
27
  this.getDefaultPlugins = args.getDefaultPlugins ?? (() => []);
29
- this.invalidateModules = (changedFiles) => {
30
- if (args.invalidateModules) {
31
- args.invalidateModules(changedFiles);
32
- return;
33
- }
34
- this.pageModuleImportService.invalidateDevelopmentGraph();
35
- };
36
28
  }
37
29
  /**
38
30
  * Loads a server-side source module through the caller-owned transpile
@@ -48,20 +40,4 @@ export class ServerModuleTranspiler {
48
40
  buildExecutor: this.getBuildExecutor(),
49
41
  });
50
42
  }
51
- /**
52
- * Invalidates cached module state for development reloads.
53
- */
54
- invalidate(changedFiles) {
55
- this.invalidateModules(changedFiles);
56
- }
57
- /**
58
- * Releases transpiler-owned resources.
59
- *
60
- * @remarks
61
- * The current implementation delegates cache ownership to lower-level module
62
- * loading services, so disposal is intentionally a no-op for now.
63
- */
64
- async dispose() {
65
- return;
66
- }
67
43
  }
@@ -0,0 +1,10 @@
1
+ import type { EcoPagesAppConfig } from '../../types/internal-types.js';
2
+ import type { ViewLoader } from '../../types/public-types.js';
3
+ /**
4
+ * Creates a view loader that imports through the app server-module transpiler.
5
+ *
6
+ * @remarks
7
+ * Use this for `app.static()` and HTML error-page registrations instead of
8
+ * raw dynamic `import()` so Node applies Ecopages build transforms (component identity).
9
+ */
10
+ export declare function createViewModuleLoader<P = Record<string, unknown>>(appConfig: EcoPagesAppConfig, modulePath: string | URL): ViewLoader<P>;
@@ -0,0 +1,46 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { fileSystem } from '@ecopages/file-system';
4
+ import { resolveInternalExecutionDir } from '../../utils/resolve-work-dir.js';
5
+ import { getAppServerModuleTranspiler } from './app-server-module-transpiler.service.js';
6
+ function resolveViewModuleOnDisk(filePath, templatesExt) {
7
+ if (fileSystem.exists(filePath)) {
8
+ return filePath;
9
+ }
10
+ for (const extension of templatesExt) {
11
+ const withExtension = `${filePath}${extension}`;
12
+ if (fileSystem.exists(withExtension)) {
13
+ return withExtension;
14
+ }
15
+ }
16
+ const pathWithoutTerminalExtension = filePath.replace(/\.[^./]+$/, '');
17
+ for (const extension of templatesExt) {
18
+ const candidate = `${pathWithoutTerminalExtension}${extension}`;
19
+ if (fileSystem.exists(candidate)) {
20
+ return candidate;
21
+ }
22
+ }
23
+ return filePath;
24
+ }
25
+ function resolveViewModuleFilePath(appConfig, modulePath) {
26
+ const filePath = modulePath instanceof URL ? fileURLToPath(modulePath) : modulePath;
27
+ const rootedPath = path.isAbsolute(filePath)
28
+ ? filePath
29
+ : path.join(appConfig.rootDir, filePath.replace(/^\.\//, ''));
30
+ return resolveViewModuleOnDisk(rootedPath, appConfig.templatesExt);
31
+ }
32
+ /**
33
+ * Creates a view loader that imports through the app server-module transpiler.
34
+ *
35
+ * @remarks
36
+ * Use this for `app.static()` and HTML error-page registrations instead of
37
+ * raw dynamic `import()` so Node applies Ecopages build transforms (component identity).
38
+ */
39
+ export function createViewModuleLoader(appConfig, modulePath) {
40
+ const filePath = resolveViewModuleFilePath(appConfig, modulePath);
41
+ return async () => await getAppServerModuleTranspiler(appConfig).importModule({
42
+ filePath,
43
+ outdir: path.join(resolveInternalExecutionDir(appConfig), '.server-modules'),
44
+ externalPackages: true,
45
+ });
46
+ }
@@ -62,15 +62,6 @@ export class InMemoryEntrypointDependencyGraph {
62
62
  this.entrypointDependencies.clear();
63
63
  }
64
64
  }
65
- function isLegacyEntrypointDependencyGraph(value) {
66
- return (Boolean(value) &&
67
- typeof value === 'object' &&
68
- typeof value.supportsSelectiveInvalidation === 'function' &&
69
- typeof value.getDependencyEntrypoints === 'function' &&
70
- typeof value.setEntrypointDependencies === 'function' &&
71
- typeof value.clearEntrypointDependencies === 'function' &&
72
- typeof value.reset === 'function');
73
- }
74
65
  /**
75
66
  * Returns the app-owned entrypoint dependency graph.
76
67
  */
@@ -78,9 +69,6 @@ export function getAppEntrypointDependencyGraph(appConfig) {
78
69
  if (appConfig.runtime?.entrypointDependencyGraph) {
79
70
  return appConfig.runtime.entrypointDependencyGraph;
80
71
  }
81
- if (isLegacyEntrypointDependencyGraph(appConfig.runtime?.devGraphService)) {
82
- return appConfig.runtime.devGraphService;
83
- }
84
72
  return new NoopEntrypointDependencyGraph();
85
73
  }
86
74
  /**
@@ -5,7 +5,6 @@ import type { EcoPagesAppConfig } from '../../types/internal-types.js';
5
5
  export interface ServerInvalidationState {
6
6
  getServerInvalidationVersion(): number;
7
7
  invalidateServerModules(changedFiles?: string[]): void;
8
- reset(): void;
9
8
  }
10
9
  /**
11
10
  * Minimal app-local invalidation state backed by a single generation counter.
@@ -14,10 +13,13 @@ export declare class CounterServerInvalidationState implements ServerInvalidatio
14
13
  private serverInvalidationVersion;
15
14
  getServerInvalidationVersion(): number;
16
15
  invalidateServerModules(_changedFiles?: string[]): void;
17
- reset(): void;
18
16
  }
19
17
  /**
20
18
  * Returns the app-owned server invalidation state.
19
+ *
20
+ * @remarks
21
+ * When nothing is installed yet, a counter is installed on first read so later
22
+ * reads share its version instead of each starting from zero.
21
23
  */
22
24
  export declare function getAppServerInvalidationState(appConfig: EcoPagesAppConfig): ServerInvalidationState;
23
25
  /**
@@ -9,28 +9,21 @@ export class CounterServerInvalidationState {
9
9
  invalidateServerModules(_changedFiles) {
10
10
  this.serverInvalidationVersion += 1;
11
11
  }
12
- reset() {
13
- this.serverInvalidationVersion += 1;
14
- }
15
- }
16
- function isLegacyServerInvalidationState(value) {
17
- return (Boolean(value) &&
18
- typeof value === 'object' &&
19
- typeof value.getServerInvalidationVersion === 'function' &&
20
- typeof value.invalidateServerModules === 'function' &&
21
- typeof value.reset === 'function');
22
12
  }
23
13
  /**
24
14
  * Returns the app-owned server invalidation state.
15
+ *
16
+ * @remarks
17
+ * When nothing is installed yet, a counter is installed on first read so later
18
+ * reads share its version instead of each starting from zero.
25
19
  */
26
20
  export function getAppServerInvalidationState(appConfig) {
27
21
  if (appConfig.runtime?.serverInvalidationState) {
28
22
  return appConfig.runtime.serverInvalidationState;
29
23
  }
30
- if (isLegacyServerInvalidationState(appConfig.runtime?.devGraphService)) {
31
- return appConfig.runtime.devGraphService;
32
- }
33
- return new CounterServerInvalidationState();
24
+ const serverInvalidationState = new CounterServerInvalidationState();
25
+ setAppServerInvalidationState(appConfig, serverInvalidationState);
26
+ return serverInvalidationState;
34
27
  }
35
28
  /**
36
29
  * Installs the invalidation state used by one app instance.