@ecopages/core 0.2.0-rc.10 → 0.2.0-rc.13
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.
- package/README.md +0 -9
- package/package.json +3 -152
- package/src/adapters/README.md +8 -2
- package/src/adapters/abstract/application-adapter.d.ts +6 -32
- package/src/adapters/abstract/application-adapter.js +6 -45
- package/src/adapters/abstract/ws-pattern-matcher.d.ts +0 -5
- package/src/adapters/abstract/ws-pattern-matcher.js +0 -9
- package/src/adapters/bun/create-app.d.ts +8 -12
- package/src/adapters/bun/create-app.js +13 -55
- package/src/adapters/bun/hmr-manager.d.ts +0 -1
- package/src/adapters/bun/hmr-manager.js +2 -4
- package/src/adapters/bun/server-adapter.d.ts +9 -19
- package/src/adapters/bun/server-adapter.js +19 -66
- package/src/adapters/bun/static-preview-host.d.ts +1 -0
- package/src/adapters/bun/static-preview-host.js +1 -1
- package/src/adapters/create-app.d.ts +1 -1
- package/src/adapters/create-app.js +2 -1
- package/src/adapters/node/create-app.d.ts +4 -8
- package/src/adapters/node/create-app.js +7 -12
- package/src/adapters/node/runtime-host.d.ts +10 -10
- package/src/adapters/node/runtime-host.js +4 -4
- package/src/adapters/node/server-adapter-dependencies.d.ts +2 -10
- package/src/adapters/node/server-adapter-dependencies.js +8 -13
- package/src/adapters/node/server-adapter.d.ts +25 -31
- package/src/adapters/node/server-adapter.js +43 -64
- package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +0 -4
- package/src/adapters/shared/hmr/shared-hmr-manager.js +0 -12
- package/src/adapters/shared/http/api-request-pipeline.d.ts +27 -1
- package/src/adapters/shared/http/api-request-pipeline.js +31 -16
- package/src/adapters/shared/http/fs-server-response-factory.d.ts +0 -1
- package/src/adapters/shared/http/fs-server-response-factory.js +0 -3
- package/src/adapters/shared/runtime/collect-dev-prewarm-plan.d.ts +1 -3
- package/src/adapters/shared/runtime/collect-dev-prewarm-plan.js +1 -4
- package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +0 -10
- package/src/adapters/shared/runtime/runtime-app-bootstrap.js +0 -7
- package/src/adapters/shared/runtime/runtime-host.d.ts +5 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +1 -1
- package/src/adapters/shared/runtime/server-adapter.d.ts +13 -0
- package/src/adapters/shared/runtime/server-adapter.js +22 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +9 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +8 -2
- package/src/build/README.md +5 -6
- package/src/build/cache/cache-constants.d.ts +0 -2
- package/src/build/cache/cache-constants.js +0 -2
- package/src/build/cache/cache-keys.d.ts +0 -2
- package/src/build/cache/cache-keys.js +0 -2
- package/src/build/cache/output-imports.d.ts +35 -0
- package/src/build/cache/output-imports.js +87 -0
- package/src/build/cache/pages-unified-graph-build.d.ts +6 -1
- package/src/build/cache/pages-unified-graph-build.js +49 -18
- package/src/build/cache/production-build-cache.d.ts +2 -2
- package/src/build/cache/production-build-cache.js +2 -2
- package/src/build/cache/server-entry-build-cache.d.ts +1 -2
- package/src/build/cache/server-entry-build-cache.js +4 -5
- package/src/build/contracts/build-contracts.d.ts +1 -13
- package/src/build/rolldown/runtime-build-output-normalizer.js +3 -6
- package/src/build/runtime/build-request-identity.d.ts +2 -6
- package/src/build/runtime/build-request-identity.js +2 -8
- package/src/build/runtime/deduping-build-executor.d.ts +0 -1
- package/src/build/runtime/deduping-build-executor.js +0 -1
- package/src/cache/index.d.ts +1 -1
- package/src/cache/index.js +1 -1
- package/src/cache/module-parse-cache.d.ts +2 -29
- package/src/cache/module-parse-cache.js +6 -39
- package/src/config/README.md +3 -3
- package/src/config/apply-user-config.d.ts +3 -1
- package/src/config/apply-user-config.js +3 -2
- package/src/config/config-builder.d.ts +1 -0
- package/src/config/config-builder.js +2 -2
- package/src/config/constants.d.ts +0 -4
- package/src/config/constants.js +0 -4
- package/src/config/index.d.ts +1 -1
- package/src/config/index.js +1 -1
- package/src/config/load-eco-config.d.ts +1 -1
- package/src/config/load-eco-config.js +18 -11
- package/src/config/resolve-eco-config-path.d.ts +9 -0
- package/src/config/resolve-eco-config-path.js +11 -0
- package/src/config/server-config-bundle.js +2 -2
- package/src/config/user-config-types.d.ts +9 -3
- package/src/dev/host-runtime.d.ts +0 -1
- package/src/dev/host-runtime.js +0 -3
- package/src/dev/sc-server.d.ts +4 -1
- package/src/dev/sc-server.js +11 -20
- package/src/dev/transform-server/dev-transform-import-rewriter.js +2 -2
- package/src/hmr/hmr-file-change-prep.d.ts +0 -1
- package/src/hmr/hmr-file-change-prep.js +2 -5
- package/src/hmr/hmr-strategy.d.ts +3 -8
- package/src/hmr/hmr-strategy.js +3 -8
- package/src/index.browser.d.ts +1 -2
- package/src/index.browser.js +1 -2
- package/src/index.d.ts +5 -6
- package/src/index.js +5 -6
- package/src/islands/island-host.d.ts +0 -9
- package/src/islands/island-host.js +1 -13
- package/src/plugins/component-import-discovery.js +2 -2
- package/src/plugins/eco-component-meta-plugin.js +5 -5
- package/src/plugins/integration-plugin.d.ts +0 -1
- package/src/plugins/integration-plugin.js +0 -4
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +1 -4
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +25 -24
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +18 -20
- package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -7
- package/src/route-renderer/orchestration/integration-renderer.js +44 -33
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
- package/src/services/README.md +1 -1
- package/src/services/assets/browser-bundle.service.d.ts +1 -6
- package/src/services/error-pages/default-error-pages.d.ts +1 -6
- package/src/services/error-pages/default-error-pages.js +0 -8
- package/src/services/html/html-rewriter.d.ts +77 -0
- package/src/services/html/html-rewriter.js +751 -0
- package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
- package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
- package/src/services/html/html-transformer.service.d.ts +29 -42
- package/src/services/html/html-transformer.service.js +85 -157
- package/src/services/invalidation/development-invalidation.service.d.ts +2 -19
- package/src/services/invalidation/development-invalidation.service.js +1 -39
- package/src/services/module-loading/README.md +1 -1
- package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
- package/src/services/module-loading/app-server-module-transpiler.service.js +0 -10
- package/src/services/module-loading/collection-server-module-build.service.d.ts +0 -1
- package/src/services/module-loading/collection-server-module-build.service.js +0 -3
- package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
- package/src/services/module-loading/host-module-loader-registry.js +0 -3
- package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
- package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
- package/src/services/module-loading/route-module-build-cache.store.d.ts +3 -0
- package/src/services/module-loading/route-module-build-cache.store.js +20 -5
- package/src/services/module-loading/route-module-build-manifest.d.ts +12 -1
- package/src/services/module-loading/route-module-build-manifest.js +7 -3
- package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
- package/src/services/module-loading/server-module-transpiler.service.js +0 -24
- package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
- package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
- package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
- package/src/types/internal-types.d.ts +0 -38
- package/src/types/public-types.d.ts +0 -112
- package/src/watchers/project-watcher.d.ts +0 -15
- package/src/watchers/project-watcher.js +1 -27
- package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
- package/src/watchers/project-watcher.test-helpers.js +12 -0
- package/src/adapters/abstract/router-adapter.d.ts +0 -26
- package/src/adapters/abstract/router-adapter.js +0 -13
- package/src/adapters/bun/index.d.ts +0 -2
- package/src/adapters/bun/index.js +0 -2
- package/src/adapters/index.d.ts +0 -2
- package/src/adapters/index.js +0 -2
- package/src/eco/eco.utils.d.ts +0 -1
- package/src/eco/eco.utils.js +0 -1
- package/src/services/cache/index.d.ts +0 -9
- package/src/services/cache/index.js +0 -8
- package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
- package/src/services/html/html-rewriter-provider.service.js +0 -68
- package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
- package/src/services/module-loading/route-module-build-cache.js +0 -3
- package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
- package/src/services/runtime-state/dev-graph.service.js +0 -170
|
@@ -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';
|
|
@@ -27,9 +25,6 @@ export function shouldAppUseHostModuleLoader(appConfig, filePath) {
|
|
|
27
25
|
export function getAppHostModuleLoader(appConfig) {
|
|
28
26
|
return appConfig.runtime?.hostModuleLoader;
|
|
29
27
|
}
|
|
30
|
-
function getAppModuleLoaderOwner(appConfig) {
|
|
31
|
-
return getAppHostModuleLoader(appConfig) ? 'host' : 'app';
|
|
32
|
-
}
|
|
33
28
|
export function setAppHostModuleLoader(appConfig, hostModuleLoader) {
|
|
34
29
|
appConfig.runtime = {
|
|
35
30
|
...(appConfig.runtime ?? {}),
|
|
@@ -50,9 +45,6 @@ export function createAppModuleLoader(appConfig) {
|
|
|
50
45
|
getHostModuleLoader: () => getAppHostModuleLoader(appConfig),
|
|
51
46
|
});
|
|
52
47
|
const appModuleLoader = {
|
|
53
|
-
get owner() {
|
|
54
|
-
return getAppModuleLoaderOwner(appConfig);
|
|
55
|
-
},
|
|
56
48
|
pageModuleImportService,
|
|
57
49
|
async importModule(options) {
|
|
58
50
|
return await pageModuleImportService.importModule({
|
|
@@ -86,10 +78,8 @@ export function setAppModuleLoader(appConfig, appModuleLoader) {
|
|
|
86
78
|
* instance.
|
|
87
79
|
*/
|
|
88
80
|
export function createAppServerModuleTranspiler(appConfig) {
|
|
89
|
-
const invalidationService = new DevelopmentInvalidationService(appConfig);
|
|
90
81
|
return new ServerModuleTranspiler({
|
|
91
82
|
rootDir: appConfig.rootDir,
|
|
92
|
-
invalidateModules: (changedFiles) => invalidationService.invalidateServerModules(changedFiles),
|
|
93
83
|
pageModuleImportService: getAppModuleLoader(appConfig),
|
|
94
84
|
});
|
|
95
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;
|
|
@@ -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
|
};
|
|
@@ -26,6 +27,8 @@ export declare class RouteModuleBuildCache {
|
|
|
26
27
|
fileHash: string;
|
|
27
28
|
outputPath: string;
|
|
28
29
|
dependencyModulePaths?: readonly string[];
|
|
30
|
+
/** Local imports of the output when the caller already collected them. */
|
|
31
|
+
outputImports?: string[];
|
|
29
32
|
}): void;
|
|
30
33
|
isIncrementalStaticGenerationAvailable(context: RouteModuleStaticRenderCacheContext): boolean;
|
|
31
34
|
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,
|
|
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,12 +43,13 @@ export class RouteModuleBuildCache {
|
|
|
40
43
|
if (!this.dependencyHasher.matchesStoredHashes(entry.dependencyHashes, cacheFilePath, options.fileHash)) {
|
|
41
44
|
return undefined;
|
|
42
45
|
}
|
|
43
|
-
const 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
|
}
|
|
51
55
|
recordBuild(options) {
|
|
@@ -58,6 +62,7 @@ export class RouteModuleBuildCache {
|
|
|
58
62
|
: [cacheFilePath];
|
|
59
63
|
const dependencyHashes = this.dependencyHasher.createDependencyHashes(dependencyModulePaths);
|
|
60
64
|
dependencyHashes[cacheFilePath] = options.fileHash;
|
|
65
|
+
const outputPath = resolveOutputPath(options.outputPath, options.outdir);
|
|
61
66
|
const manifest = this.loadManifest();
|
|
62
67
|
const existingEntry = manifest.entries[cacheFilePath];
|
|
63
68
|
manifest.corePackageVersion = this.dependencies.getCorePackageVersion();
|
|
@@ -67,6 +72,13 @@ export class RouteModuleBuildCache {
|
|
|
67
72
|
builtAt: Date.now(),
|
|
68
73
|
buildKey: createPersistedRouteModuleBuildKey(options, options.sourceTransforms),
|
|
69
74
|
dependencyHashes,
|
|
75
|
+
outputImports: options.outputImports ??
|
|
76
|
+
collectReachableLocalImports(outputPath, {
|
|
77
|
+
fileAccess: {
|
|
78
|
+
exists: (filePath) => this.dependencies.exists(filePath),
|
|
79
|
+
readFile: (filePath) => this.dependencies.readFile(filePath),
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
70
82
|
renderedOutputs: existingEntry?.renderedOutputs,
|
|
71
83
|
};
|
|
72
84
|
this.persistManifest(manifest);
|
|
@@ -144,11 +156,11 @@ export class RouteModuleBuildCache {
|
|
|
144
156
|
manifest.configHash = options.context.configHash;
|
|
145
157
|
manifest.buildInputsFingerprint = options.context.buildInputsFingerprint;
|
|
146
158
|
manifest.entries[cacheFilePath] = {
|
|
159
|
+
...existingEntry,
|
|
147
160
|
sourceHash: options.sourceHash,
|
|
148
161
|
outputPath: existingEntry?.outputPath ?? '',
|
|
149
162
|
builtAt: existingEntry?.builtAt ?? Date.now(),
|
|
150
163
|
buildKey: existingEntry?.buildKey ?? '',
|
|
151
|
-
dependencyHashes: existingEntry?.dependencyHashes,
|
|
152
164
|
renderedOutputs: {
|
|
153
165
|
...(existingEntry?.renderedOutputs ?? {}),
|
|
154
166
|
[options.pathname]: {
|
|
@@ -218,3 +230,6 @@ export class RouteModuleBuildCache {
|
|
|
218
230
|
this.dependencies.writeManifest(this.manifestPath, manifest);
|
|
219
231
|
}
|
|
220
232
|
}
|
|
233
|
+
function resolveOutputPath(outputPath, outdir) {
|
|
234
|
+
return path.isAbsolute(outputPath) ? outputPath : path.join(outdir, outputPath);
|
|
235
|
+
}
|
|
@@ -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 ??
|
|
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
|
-
*
|
|
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;
|
|
@@ -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'
|
|
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
|
}
|
|
@@ -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
|
-
|
|
31
|
-
|
|
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.
|
|
@@ -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;
|
|
@@ -170,7 +166,6 @@ export type EcoPagesAppConfig = {
|
|
|
170
166
|
buildOwnership?: BuildOwnership;
|
|
171
167
|
buildAdapter?: BuildAdapter;
|
|
172
168
|
buildManifest?: AppBuildManifest;
|
|
173
|
-
devGraphService?: DevGraphService;
|
|
174
169
|
entrypointDependencyGraph?: EntrypointDependencyGraph;
|
|
175
170
|
pageBrowserGraphSession?: SessionPageBrowserGraphCache;
|
|
176
171
|
hostModuleLoader?: SourceModuleLoader;
|
|
@@ -223,15 +218,6 @@ export type EcoPagesAppConfig = {
|
|
|
223
218
|
unsafe?: Record<string, unknown>;
|
|
224
219
|
};
|
|
225
220
|
};
|
|
226
|
-
export type IntegrationDependencyConfig = {
|
|
227
|
-
integration: string;
|
|
228
|
-
kind: 'script' | 'stylesheet';
|
|
229
|
-
position?: 'head' | 'body';
|
|
230
|
-
srcUrl: string;
|
|
231
|
-
filePath: string;
|
|
232
|
-
/** @todo inline dependencies not implemented yet */
|
|
233
|
-
inline?: boolean;
|
|
234
|
-
};
|
|
235
221
|
/**
|
|
236
222
|
* The possible kinds of a route.
|
|
237
223
|
*/
|
|
@@ -249,18 +235,6 @@ export type MatchResult = {
|
|
|
249
235
|
query: Record<string, string>;
|
|
250
236
|
params: Record<string, string | string[]>;
|
|
251
237
|
};
|
|
252
|
-
/**
|
|
253
|
-
* Represents a route in EcoPages.
|
|
254
|
-
*/
|
|
255
|
-
export type Route = {
|
|
256
|
-
kind: RouteKind;
|
|
257
|
-
filePath: string;
|
|
258
|
-
pathname: string;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Represents the routes in EcoPages.
|
|
262
|
-
*/
|
|
263
|
-
export type Routes = Record<string, Route>;
|
|
264
238
|
/**
|
|
265
239
|
* Represents the options for the file system server.
|
|
266
240
|
*/
|
|
@@ -268,16 +242,4 @@ export type FileSystemServerOptions = {
|
|
|
268
242
|
watchMode: boolean;
|
|
269
243
|
port?: number | string;
|
|
270
244
|
};
|
|
271
|
-
/**
|
|
272
|
-
* Represents the file system server adapter.
|
|
273
|
-
*/
|
|
274
|
-
export interface EcoPagesFileSystemServerAdapter<ServerInstanceOptions = unknown> {
|
|
275
|
-
startServer(serverOptions: ServerInstanceOptions): {
|
|
276
|
-
router: RouteRegistry;
|
|
277
|
-
server: unknown;
|
|
278
|
-
} | Promise<{
|
|
279
|
-
router: RouteRegistry;
|
|
280
|
-
server: unknown;
|
|
281
|
-
}>;
|
|
282
|
-
}
|
|
283
245
|
export type { ClientBridgeEvent, DefaultHmrContext, HmrFileChangeOptions, IHmrManager, IClientBridge, } from './public-types.js';
|