@ecopages/core 0.2.0-beta.25 → 0.2.0-beta.27
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/package.json +58 -50
- package/src/adapters/bun/server-adapter.js +2 -2
- package/src/adapters/node/server-adapter.js +2 -2
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +10 -0
- package/src/adapters/shared/hmr-entrypoint-registrar.js +34 -10
- package/src/adapters/shared/runtime-server-lifecycle.js +1 -1
- package/src/adapters/shared/server-static-builder.d.ts +2 -1
- package/src/adapters/shared/server-static-builder.js +16 -14
- package/src/adapters/shared/shared-hmr-manager.d.ts +11 -4
- package/src/adapters/shared/shared-hmr-manager.js +22 -3
- package/src/build/README.md +92 -46
- package/src/build/app-build-manifest-runtime.d.ts +28 -2
- package/src/build/app-build-manifest-runtime.js +26 -10
- package/src/build/{browser-runtime-plugin.d.ts → browser/browser-runtime-plugin.d.ts} +1 -1
- package/src/build/{browser-runtime-plugin.js → browser/browser-runtime-plugin.js} +1 -1
- package/src/build/{jsx-ownership-plugins.d.ts → browser/jsx-ownership-plugins.d.ts} +2 -2
- package/src/build/{jsx-ownership-plugins.js → browser/jsx-ownership-plugins.js} +2 -2
- package/src/build/build-adapter.d.ts +18 -21
- package/src/build/build-adapter.js +8 -43
- package/src/build/{build-input-fingerprint.d.ts → cache/build-input-fingerprint.d.ts} +3 -3
- package/src/build/cache/cache-constants.d.ts +4 -0
- package/src/build/cache/cache-constants.js +6 -0
- package/src/build/cache/cache-keys.d.ts +22 -0
- package/src/build/cache/cache-keys.js +63 -0
- package/src/build/{dev-browser-script-cache.d.ts → cache/dev-browser-script-cache.d.ts} +2 -2
- package/src/build/{dev-browser-script-cache.js → cache/dev-browser-script-cache.js} +4 -4
- package/src/build/{pages-unified-graph-build.d.ts → cache/pages-unified-graph-build.d.ts} +1 -1
- package/src/build/{pages-unified-graph-build.js → cache/pages-unified-graph-build.js} +18 -26
- package/src/build/{production-build-cache.d.ts → cache/production-build-cache.d.ts} +1 -1
- package/src/build/{production-build-cache.js → cache/production-build-cache.js} +2 -2
- package/src/build/{server-entry-build-cache.d.ts → cache/server-entry-build-cache.d.ts} +3 -4
- package/src/build/{server-entry-build-cache.js → cache/server-entry-build-cache.js} +16 -12
- package/src/build/{build-contracts.d.ts → contracts/build-contracts.d.ts} +1 -2
- package/src/build/contracts/build-manifest.d.ts +90 -0
- package/src/build/{build-manifest.js → contracts/build-manifest.js} +2 -2
- package/src/build/{rolldown-adapter-helpers.d.ts → rolldown/rolldown-adapter-helpers.d.ts} +20 -3
- package/src/build/{rolldown-adapter-helpers.js → rolldown/rolldown-adapter-helpers.js} +26 -6
- package/src/build/{rolldown-build-adapter.d.ts → rolldown/rolldown-build-adapter.d.ts} +1 -1
- package/src/build/{rolldown-plugin-bridge.d.ts → rolldown/rolldown-plugin-bridge.d.ts} +2 -2
- package/src/build/{rolldown-plugin-bridge.js → rolldown/rolldown-plugin-bridge.js} +1 -1
- package/src/build/{rolldown-source-transform-pass.d.ts → rolldown/rolldown-source-transform-pass.d.ts} +1 -1
- package/src/build/{rolldown-source-transform-pass.js → rolldown/rolldown-source-transform-pass.js} +4 -1
- package/src/build/{runtime-build-output-normalizer.js → rolldown/runtime-build-output-normalizer.js} +2 -2
- package/src/build/{build-profile-options.d.ts → runtime/build-profile-options.d.ts} +2 -2
- package/src/build/runtime/build-request-identity.d.ts +17 -0
- package/src/build/runtime/build-request-identity.js +54 -0
- package/src/build/runtime/build-request-policy.d.ts +59 -0
- package/src/build/runtime/build-request-policy.js +46 -0
- package/src/build/{build-runtime.d.ts → runtime/build-runtime.d.ts} +8 -4
- package/src/build/{build-runtime.js → runtime/build-runtime.js} +11 -11
- package/src/build/{deduping-build-executor.d.ts → runtime/deduping-build-executor.d.ts} +2 -9
- package/src/build/runtime/deduping-build-executor.js +34 -0
- package/src/build/{parallel-build-executor.d.ts → runtime/parallel-build-executor.d.ts} +1 -1
- package/src/build/{serialized-build-executor.d.ts → runtime/serialized-build-executor.d.ts} +1 -1
- package/src/config/config-builder.d.ts +1 -1
- package/src/diagnostics/startup-trace.d.ts +49 -2
- package/src/diagnostics/startup-trace.js +140 -8
- package/src/hmr/client/hmr-runtime.js +1 -1
- package/src/hmr/hmr-file-change-prep.d.ts +10 -0
- package/src/hmr/hmr-file-change-prep.js +17 -0
- package/src/plugins/alias-resolver-plugin.d.ts +1 -1
- package/src/plugins/eco-component-meta-plugin.d.ts +1 -1
- package/src/plugins/foreign-jsx-override-plugin.d.ts +1 -1
- package/src/plugins/integration-plugin.d.ts +16 -5
- package/src/plugins/integration-plugin.js +11 -1
- package/src/plugins/processor.d.ts +28 -8
- package/src/plugins/source-transform.d.ts +1 -1
- package/src/route-renderer/GRAPH.md +13 -19
- package/src/route-renderer/README.md +1 -1
- package/src/route-renderer/orchestration/component-render-context.d.ts +4 -4
- package/src/route-renderer/orchestration/foreign-subtree-execution.service.js +6 -2
- package/src/route-renderer/orchestration/integration-renderer.d.ts +11 -52
- package/src/route-renderer/orchestration/integration-renderer.js +38 -91
- package/src/route-renderer/orchestration/integration-route-render-adapter.d.ts +1 -8
- package/src/route-renderer/orchestration/integration-route-render-adapter.js +0 -2
- package/src/route-renderer/orchestration/page-browser-graph-session.d.ts +106 -0
- package/src/route-renderer/orchestration/page-browser-graph-session.js +436 -0
- package/src/route-renderer/orchestration/page-browser-graph.service.d.ts +9 -3
- package/src/route-renderer/orchestration/page-browser-graph.service.js +89 -40
- package/src/route-renderer/orchestration/render-output.utils.d.ts +14 -0
- package/src/route-renderer/orchestration/render-output.utils.js +30 -0
- package/src/route-renderer/orchestration/route-html-finalization.service.d.ts +0 -1
- package/src/route-renderer/orchestration/route-html-finalization.service.js +4 -9
- package/src/route-renderer/orchestration/route-prepared-options.builder.d.ts +1 -2
- package/src/route-renderer/orchestration/route-prepared-options.builder.js +1 -10
- package/src/route-renderer/orchestration/route-render-orchestrator.d.ts +3 -12
- package/src/route-renderer/orchestration/route-render-orchestrator.js +4 -14
- package/src/services/assets/asset-processing-service/asset-dependency-keys.d.ts +13 -0
- package/src/services/assets/asset-processing-service/asset-dependency-keys.js +3 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +3 -1
- package/src/services/assets/asset-processing-service/asset-processing.service.js +4 -2
- package/src/services/assets/asset-processing-service/assets.types.d.ts +1 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +1 -1
- package/src/services/assets/asset-processing-service/grouped-content-bundles.js +19 -3
- package/src/services/assets/asset-processing-service/inline-content-script-body.d.ts +11 -0
- package/src/services/assets/asset-processing-service/inline-content-script-body.js +17 -0
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.d.ts +4 -6
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.js +2 -1
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -2
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +2 -15
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +3 -2
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +33 -54
- package/src/services/assets/browser-bundle.service.d.ts +27 -31
- package/src/services/assets/browser-bundle.service.js +12 -23
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +8 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +1 -7
- package/src/services/module-loading/page-module-import.service.d.ts +1 -1
- package/src/services/module-loading/page-module-import.service.js +40 -28
- package/src/services/module-loading/route-module-build-cache.store.js +1 -1
- package/src/services/module-loading/route-module-build-manifest.d.ts +2 -9
- package/src/services/module-loading/route-module-build-manifest.js +12 -43
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -1
- package/src/static-site-generator/README.md +1 -1
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +28 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +22 -0
- package/src/static-site-generator/static-build-invalidation.d.ts +2 -2
- package/src/static-site-generator/static-build-invalidation.js +3 -3
- package/src/static-site-generator/static-site-generator.js +23 -1
- package/src/types/internal-types.d.ts +10 -4
- package/src/types/public-types.d.ts +58 -9
- package/src/watchers/project-watcher.js +12 -2
- package/src/build/build-manifest.d.ts +0 -33
- package/src/build/deduping-build-executor.js +0 -56
- package/src/build/runtime-build-executor.d.ts +0 -14
- package/src/build/runtime-build-executor.js +0 -16
- /package/src/build/{browser-runtime-manifest.d.ts → browser/browser-runtime-manifest.d.ts} +0 -0
- /package/src/build/{browser-runtime-manifest.js → browser/browser-runtime-manifest.js} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.d.ts → browser/browser-runtime-plugin-helpers.d.ts} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.js → browser/browser-runtime-plugin-helpers.js} +0 -0
- /package/src/build/{lit-static-render-worker-context.d.ts → browser/lit-static-render-worker-context.d.ts} +0 -0
- /package/src/build/{lit-static-render-worker-context.js → browser/lit-static-render-worker-context.js} +0 -0
- /package/src/build/{build-input-fingerprint.js → cache/build-input-fingerprint.js} +0 -0
- /package/src/build/{build-contracts.js → contracts/build-contracts.js} +0 -0
- /package/src/build/{build-types.d.ts → contracts/build-types.d.ts} +0 -0
- /package/src/build/{build-types.js → contracts/build-types.js} +0 -0
- /package/src/build/{rolldown-build-adapter.js → rolldown/rolldown-build-adapter.js} +0 -0
- /package/src/build/{rolldown-build-invocation-metrics.d.ts → rolldown/rolldown-build-invocation-metrics.d.ts} +0 -0
- /package/src/build/{rolldown-build-invocation-metrics.js → rolldown/rolldown-build-invocation-metrics.js} +0 -0
- /package/src/build/{runtime-build-output-normalizer.d.ts → rolldown/runtime-build-output-normalizer.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.d.ts → rolldown/server-side-css-shim-plugin.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.js → rolldown/server-side-css-shim-plugin.js} +0 -0
- /package/src/build/{build-profile-options.js → runtime/build-profile-options.js} +0 -0
- /package/src/build/{parallel-build-executor.js → runtime/parallel-build-executor.js} +0 -0
- /package/src/build/{serialized-build-executor.js → runtime/serialized-build-executor.js} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
import type { PageRendererResolver } from '../route-renderer/route-renderer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether production static export should warm Page Browser Graphs before rendering.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* True only when `NODE_ENV === 'production'`. Independent of `force` and of
|
|
8
|
+
* unified pages-graph env flags. Does not persist a disk manifest.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shouldPrebuildProductionPageBrowserGraphs(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Clears in-memory production Page Browser Graph session records.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Clears only the `'production'` policy so a failed or force export cannot
|
|
16
|
+
* reuse staged graph output. Development session records are left intact.
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearProductionPageBrowserGraphSession(appConfig: EcoPagesAppConfig): void;
|
|
19
|
+
/**
|
|
20
|
+
* Warms production Page Browser Graphs for the supplied static route files.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Deduplicates and lexicographically sorts absolute route paths, then calls
|
|
24
|
+
* each integration renderer's `prebuildProductionPageBrowserGraph` sequentially
|
|
25
|
+
* (activates integration runtime, then resolves into
|
|
26
|
+
* `page-browser-graph-session`). Does not persist a disk manifest.
|
|
27
|
+
*/
|
|
28
|
+
export declare function prebuildProductionPageBrowserGraphs(routeFiles: readonly string[], routeRendererFactory: PageRendererResolver): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { getAppPageBrowserGraphSession } from "../route-renderer/orchestration/page-browser-graph-session.js";
|
|
3
|
+
function shouldPrebuildProductionPageBrowserGraphs() {
|
|
4
|
+
return process.env.NODE_ENV === "production";
|
|
5
|
+
}
|
|
6
|
+
function clearProductionPageBrowserGraphSession(appConfig) {
|
|
7
|
+
getAppPageBrowserGraphSession(appConfig).clearPolicyRecords("production");
|
|
8
|
+
}
|
|
9
|
+
async function prebuildProductionPageBrowserGraphs(routeFiles, routeRendererFactory) {
|
|
10
|
+
const uniqueRouteFiles = [...new Set(routeFiles.map((routeFile) => path.resolve(routeFile)))].sort(
|
|
11
|
+
(left, right) => left.localeCompare(right)
|
|
12
|
+
);
|
|
13
|
+
for (const routeFile of uniqueRouteFiles) {
|
|
14
|
+
const renderer = routeRendererFactory.getPageRenderer(routeFile);
|
|
15
|
+
await renderer.prebuildProductionPageBrowserGraph(routeFile);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
clearProductionPageBrowserGraphSession,
|
|
20
|
+
prebuildProductionPageBrowserGraphs,
|
|
21
|
+
shouldPrebuildProductionPageBrowserGraphs
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
2
|
import { type RouteModuleStaticRenderCacheContext } from '../services/module-loading/route-module-build-manifest.js';
|
|
3
|
-
export type { BuildInputChangeContributor, IntegrationPlugin, Processor } from '../build/build-input-fingerprint.js';
|
|
4
|
-
export { collectBuildInputContributors, createBuildInputsFingerprint, didBuildInputContributorChange, hashAppConfigFile, haveBuildInputsChanged, } from '../build/build-input-fingerprint.js';
|
|
3
|
+
export type { BuildInputChangeContributor, IntegrationPlugin, Processor, } from '../build/cache/build-input-fingerprint.js';
|
|
4
|
+
export { collectBuildInputContributors, createBuildInputsFingerprint, didBuildInputContributorChange, hashAppConfigFile, haveBuildInputsChanged, } from '../build/cache/build-input-fingerprint.js';
|
|
5
5
|
/** Builds the static-render invalidation context for one app config. */
|
|
6
6
|
export declare function createRouteModuleStaticRenderCacheContext(appConfig: EcoPagesAppConfig): RouteModuleStaticRenderCacheContext;
|
|
7
7
|
/** Returns whether `dist/` should be wiped before the next static export. */
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createBuildInputsFingerprint,
|
|
3
3
|
hashAppConfigFile,
|
|
4
4
|
haveBuildInputsChanged
|
|
5
|
-
} from "../build/build-input-fingerprint.js";
|
|
6
|
-
import { clearPersistedProductionBuildCacheManifests } from "../build/production-build-cache.js";
|
|
5
|
+
} from "../build/cache/build-input-fingerprint.js";
|
|
6
|
+
import { clearPersistedProductionBuildCacheManifests } from "../build/cache/production-build-cache.js";
|
|
7
7
|
import {} from "../services/module-loading/route-module-build-manifest.js";
|
|
8
8
|
import {
|
|
9
9
|
getSharedRouteModuleBuildCache,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
didBuildInputContributorChange,
|
|
16
16
|
hashAppConfigFile as hashAppConfigFile2,
|
|
17
17
|
haveBuildInputsChanged as haveBuildInputsChanged2
|
|
18
|
-
} from "../build/build-input-fingerprint.js";
|
|
18
|
+
} from "../build/cache/build-input-fingerprint.js";
|
|
19
19
|
function createRouteModuleStaticRenderCacheContext(appConfig) {
|
|
20
20
|
return {
|
|
21
21
|
configHash: hashAppConfigFile(appConfig),
|
|
@@ -8,7 +8,15 @@ import {
|
|
|
8
8
|
getServerModuleBuildCacheOutdir,
|
|
9
9
|
getSharedRouteModuleBuildCache
|
|
10
10
|
} from "../services/module-loading/route-module-build-cache-registry.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ensurePagesUnifiedGraphBuilt,
|
|
13
|
+
shouldBuildPagesUnifiedGraph
|
|
14
|
+
} from "../build/cache/pages-unified-graph-build.js";
|
|
15
|
+
import {
|
|
16
|
+
clearProductionPageBrowserGraphSession,
|
|
17
|
+
prebuildProductionPageBrowserGraphs,
|
|
18
|
+
shouldPrebuildProductionPageBrowserGraphs
|
|
19
|
+
} from "./production-page-browser-graph-prebuild.js";
|
|
12
20
|
const STATIC_SITE_GENERATOR_ERRORS = {
|
|
13
21
|
ROUTE_RENDERER_FACTORY_REQUIRED: "RouteRendererFactory is required for render strategy",
|
|
14
22
|
unsupportedBodyType: (bodyType) => `Unsupported body type for static generation: ${bodyType}`,
|
|
@@ -241,6 +249,9 @@ class StaticSiteGenerator {
|
|
|
241
249
|
if (!force) {
|
|
242
250
|
this.getRouteModuleBuildCache().ensureIncrementalStaticGenerationContext(this.staticRenderCacheContext);
|
|
243
251
|
}
|
|
252
|
+
if (shouldPrebuildProductionPageBrowserGraphs() && force) {
|
|
253
|
+
clearProductionPageBrowserGraphSession(this.appConfig);
|
|
254
|
+
}
|
|
244
255
|
const routes = await router.listStaticGenerationRoutes({ runtimeOrigin: baseUrl });
|
|
245
256
|
if (shouldBuildPagesUnifiedGraph()) {
|
|
246
257
|
await ensurePagesUnifiedGraphBuilt({
|
|
@@ -260,6 +271,12 @@ class StaticSiteGenerator {
|
|
|
260
271
|
});
|
|
261
272
|
await this.invokeStaticExportHook("beforeStaticExport", staticExportContext);
|
|
262
273
|
try {
|
|
274
|
+
if (shouldPrebuildProductionPageBrowserGraphs() && routeRendererFactory) {
|
|
275
|
+
await prebuildProductionPageBrowserGraphs(
|
|
276
|
+
routes.map((route) => route.templateRoute.filePath),
|
|
277
|
+
routeRendererFactory
|
|
278
|
+
);
|
|
279
|
+
}
|
|
263
280
|
this.generateRobotsTxt();
|
|
264
281
|
await this.generateStaticPages(
|
|
265
282
|
router,
|
|
@@ -280,6 +297,11 @@ class StaticSiteGenerator {
|
|
|
280
297
|
if (preserveExportDirectory) {
|
|
281
298
|
this.pruneStaleStaticOutputs(activeStaticPathnames);
|
|
282
299
|
}
|
|
300
|
+
} catch (error) {
|
|
301
|
+
if (shouldPrebuildProductionPageBrowserGraphs()) {
|
|
302
|
+
clearProductionPageBrowserGraphSession(this.appConfig);
|
|
303
|
+
}
|
|
304
|
+
throw error;
|
|
283
305
|
} finally {
|
|
284
306
|
await this.invokeStaticExportHook("afterStaticExport", staticExportContext);
|
|
285
307
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
2
|
-
import type { AppBuildManifest } from '../build/build-manifest.js';
|
|
1
|
+
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
2
|
+
import type { AppBuildManifest } from '../build/contracts/build-manifest.js';
|
|
3
3
|
import type { BuildAdapter, BuildOwnership } from '../build/build-adapter.js';
|
|
4
|
-
import type { BuildRuntime } from '../build/build-runtime.js';
|
|
4
|
+
import type { BuildRuntime } from '../build/runtime/build-runtime.js';
|
|
5
5
|
import type { AnyIntegrationPlugin } from '../plugins/integration-plugin.js';
|
|
6
6
|
import type { Processor } from '../plugins/processor.js';
|
|
7
7
|
import type { EcoSourceTransform } from '../plugins/source-transform.js';
|
|
@@ -12,6 +12,7 @@ import type { DevGraphService } from '../services/runtime-state/dev-graph.servic
|
|
|
12
12
|
import type { AppModuleLoader } from '../services/module-loading/app-module-loader.service.js';
|
|
13
13
|
import type { SourceModuleLoader } from '../services/module-loading/module-loading-types.js';
|
|
14
14
|
import type { EntrypointDependencyGraph } from '../services/runtime-state/entrypoint-dependency-graph.service.js';
|
|
15
|
+
import type { SessionPageBrowserGraphCache } from '../route-renderer/orchestration/page-browser-graph-session.js';
|
|
15
16
|
import type { ServerInvalidationState } from '../services/runtime-state/server-invalidation-state.service.js';
|
|
16
17
|
import type { ServerModuleTranspiler } from '../services/module-loading/server-module-transpiler.service.js';
|
|
17
18
|
import type { RouteModuleBuildCache } from '../services/module-loading/route-module-build-cache.store.js';
|
|
@@ -155,6 +156,7 @@ export type EcoPagesAppConfig = {
|
|
|
155
156
|
buildManifest?: AppBuildManifest;
|
|
156
157
|
devGraphService?: DevGraphService;
|
|
157
158
|
entrypointDependencyGraph?: EntrypointDependencyGraph;
|
|
159
|
+
pageBrowserGraphSession?: SessionPageBrowserGraphCache;
|
|
158
160
|
hostModuleLoader?: SourceModuleLoader;
|
|
159
161
|
rendererModuleContext?: unknown;
|
|
160
162
|
serverInvalidationState?: ServerInvalidationState;
|
|
@@ -164,6 +166,10 @@ export type EcoPagesAppConfig = {
|
|
|
164
166
|
buildRuntime?: BuildRuntime;
|
|
165
167
|
/** Set after {@link setupAppRuntimePlugins} runs processor/integration setup once per process. */
|
|
166
168
|
runtimeAssetsPrepared?: boolean;
|
|
169
|
+
/** Registers integration runtime plugins when lazy activation completes. */
|
|
170
|
+
onRuntimePlugin?: (plugin: import('../build/contracts/build-types.js').EcoBuildPlugin) => void;
|
|
171
|
+
/** Integration names that completed lazy runtime activation. */
|
|
172
|
+
activatedIntegrations?: Set<string>;
|
|
167
173
|
/** When `'host'`, the embedded dev server owns browser dev-client bootstrap. */
|
|
168
174
|
devClientOwner?: 'core' | 'host';
|
|
169
175
|
/** Integration hooks run when a registered `dependencies.scripts` entrypoint changes. */
|
|
@@ -236,4 +242,4 @@ export interface EcoPagesFileSystemServerAdapter<ServerInstanceOptions = unknown
|
|
|
236
242
|
server: unknown;
|
|
237
243
|
}>;
|
|
238
244
|
}
|
|
239
|
-
export type { ClientBridgeEvent, DefaultHmrContext, IHmrManager, IClientBridge } from './public-types.js';
|
|
245
|
+
export type { ClientBridgeEvent, DefaultHmrContext, HmrFileChangeOptions, IHmrManager, IClientBridge, } from './public-types.js';
|
|
@@ -204,6 +204,14 @@ export interface DefaultHmrContext {
|
|
|
204
204
|
* Entrypoint dependency graph for selective HMR invalidation.
|
|
205
205
|
*/
|
|
206
206
|
getEntrypointDependencyGraph(): EntrypointDependencyGraph;
|
|
207
|
+
/**
|
|
208
|
+
* Registers an already-materialized HMR entrypoint without rebuilding it.
|
|
209
|
+
*
|
|
210
|
+
* @remarks
|
|
211
|
+
* Cold dev batches seed the registrar after grouped builds so the first SSR
|
|
212
|
+
* resolves the artifact from disk instead of triggering a rebuild.
|
|
213
|
+
*/
|
|
214
|
+
seedResolvedEntrypoint(resolved: ResolvedHmrEntrypoint): void;
|
|
207
215
|
}
|
|
208
216
|
/**
|
|
209
217
|
* Represents an event broadcast to connected clients via the ClientBridge.
|
|
@@ -225,6 +233,22 @@ export type ClientBridgeEvent = {
|
|
|
225
233
|
* Timestamp for cache busting
|
|
226
234
|
*/
|
|
227
235
|
timestamp?: number;
|
|
236
|
+
/**
|
|
237
|
+
* Page Browser Graph identities invalidated by the originating file change.
|
|
238
|
+
*/
|
|
239
|
+
graphIdentities?: Array<{
|
|
240
|
+
integrationName: string;
|
|
241
|
+
routeFile: string;
|
|
242
|
+
policy: 'development' | 'production';
|
|
243
|
+
entryFingerprint: string;
|
|
244
|
+
}>;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Options for handling a development file change through HMR.
|
|
248
|
+
*/
|
|
249
|
+
export type HmrFileChangeOptions = {
|
|
250
|
+
broadcast?: boolean;
|
|
251
|
+
graphIdentities?: ClientBridgeEvent['graphIdentities'];
|
|
228
252
|
};
|
|
229
253
|
/**
|
|
230
254
|
* Adapter-agnostic interface for broadcasting development events to connected clients.
|
|
@@ -296,6 +320,14 @@ export interface IHmrManager {
|
|
|
296
320
|
* Returns an existing emitted HMR script artifact without registering it.
|
|
297
321
|
*/
|
|
298
322
|
getResolvedScriptOutput?(entrypointPath: string): ResolvedHmrEntrypoint | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Registers an already-materialized HMR entrypoint without rebuilding it.
|
|
325
|
+
*
|
|
326
|
+
* @remarks
|
|
327
|
+
* Cold dev batches seed the registrar after grouped builds so the first SSR
|
|
328
|
+
* resolves the artifact from disk instead of triggering a rebuild.
|
|
329
|
+
*/
|
|
330
|
+
seedResolvedEntrypoint?(resolved: ResolvedHmrEntrypoint): void;
|
|
299
331
|
/**
|
|
300
332
|
* Gets the map of watched files.
|
|
301
333
|
*/
|
|
@@ -311,7 +343,7 @@ export interface IHmrManager {
|
|
|
311
343
|
/**
|
|
312
344
|
* Handles a file change event.
|
|
313
345
|
*/
|
|
314
|
-
handleFileChange(path: string): Promise<void>;
|
|
346
|
+
handleFileChange(path: string, options?: HmrFileChangeOptions): Promise<void>;
|
|
315
347
|
}
|
|
316
348
|
/**
|
|
317
349
|
* Represents the dependencies for an EcoComponent.
|
|
@@ -345,17 +377,16 @@ export type EcoPagesElement = string | Promise<string>;
|
|
|
345
377
|
/**
|
|
346
378
|
* Serializable child payloads accepted by cross-integration deferred rendering.
|
|
347
379
|
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
380
|
+
* @remarks
|
|
381
|
+
* Covers primitives, arrays, and Kita/Lit-style template results (`strings` /
|
|
382
|
+
* optional `values`). Plain opaque objects are intentionally excluded; foreign
|
|
383
|
+
* composition boundaries reject them before serializers can coerce `String(object)`.
|
|
384
|
+
* Framework-native trees (React nodes, JSX elements) stay outside this type and
|
|
385
|
+
* use EcoEmbed or already-serialized HTML at the boundary.
|
|
353
386
|
*/
|
|
354
387
|
export type EcoChildren = string | Promise<string> | number | bigint | boolean | null | undefined | readonly EcoChildren[] | {
|
|
355
388
|
strings: readonly string[];
|
|
356
389
|
values?: readonly EcoChildren[];
|
|
357
|
-
} | {
|
|
358
|
-
[key: string]: EcoChildren;
|
|
359
390
|
};
|
|
360
391
|
/**
|
|
361
392
|
* Represents the input configuration for EcoPages.
|
|
@@ -535,6 +566,15 @@ export interface HtmlTemplateProps<T = EcoPagesElement> extends PageHeadProps<T>
|
|
|
535
566
|
language?: string;
|
|
536
567
|
headContent?: T;
|
|
537
568
|
pageProps: Record<string, unknown>;
|
|
569
|
+
/**
|
|
570
|
+
* Browser-importable page module URL for router-enabled documents.
|
|
571
|
+
*
|
|
572
|
+
* @remarks
|
|
573
|
+
* Transport-only: threaded into HTML shells (for example `EcoPropsScript`
|
|
574
|
+
* `moduleUrl`) and serialized as the page-data envelope `moduleUrl`. Not page
|
|
575
|
+
* component state.
|
|
576
|
+
*/
|
|
577
|
+
pageModuleUrl?: string;
|
|
538
578
|
}
|
|
539
579
|
/**
|
|
540
580
|
* Request-scoped context available to layout prop factories on `eco.page`.
|
|
@@ -789,7 +829,6 @@ export type IntegrationRendererRenderOptions<C = EcoPagesElement> = RouteRendere
|
|
|
789
829
|
dependencies?: EcoComponentDependencies;
|
|
790
830
|
resolvedDependencies: ProcessedAsset[];
|
|
791
831
|
pagePackage?: PagePackageResult;
|
|
792
|
-
componentRender?: ComponentRenderResult;
|
|
793
832
|
pageProps?: Record<string, unknown>;
|
|
794
833
|
cacheStrategy?: CacheStrategy;
|
|
795
834
|
pageLocals?: RequestLocals;
|
|
@@ -894,6 +933,16 @@ export interface BaseIntegrationContext {
|
|
|
894
933
|
rendererCache?: Map<string, unknown>;
|
|
895
934
|
componentInstanceId?: string;
|
|
896
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Shared input for renderer-owned component execution.
|
|
938
|
+
*
|
|
939
|
+
* @remarks
|
|
940
|
+
* `children` stays `unknown` at this boundary so integrations can receive
|
|
941
|
+
* queued tokens, already-serialized HTML, or framework-native values before
|
|
942
|
+
* their own placement rules apply. Opaque values must be rejected or converted
|
|
943
|
+
* by foreign-child interception before string serializers run; adapters keep
|
|
944
|
+
* framework-specific placement (React raw HTML, Lit slot markers).
|
|
945
|
+
*/
|
|
897
946
|
export interface ComponentRenderInput<TIntegrationContext extends BaseIntegrationContext = BaseIntegrationContext> {
|
|
898
947
|
component: EcoComponent;
|
|
899
948
|
props: Record<string, unknown>;
|
|
@@ -5,6 +5,8 @@ import { appLogger } from "../global/app-logger.js";
|
|
|
5
5
|
import {
|
|
6
6
|
DevelopmentInvalidationService
|
|
7
7
|
} from "../services/invalidation/development-invalidation.service.js";
|
|
8
|
+
import { prepareHmrFileChange } from "../hmr/hmr-file-change-prep.js";
|
|
9
|
+
import { getAppPageBrowserGraphSession } from "../route-renderer/orchestration/page-browser-graph-session.js";
|
|
8
10
|
import { isRegisteredScriptEntrypoint } from "../hmr/hmr-entrypoint-output.js";
|
|
9
11
|
import { resolveInternalExecutionDir } from "../utils/resolve-work-dir.js";
|
|
10
12
|
import { createProjectWatcherIgnorePredicate } from "./project-watcher-ignore.js";
|
|
@@ -150,6 +152,10 @@ class ProjectWatcher {
|
|
|
150
152
|
}
|
|
151
153
|
this.uncacheModules();
|
|
152
154
|
const resolvedFilePath = path.resolve(filePath);
|
|
155
|
+
const graphPreparation = this.hmrManager.isEnabled() ? prepareHmrFileChange(this.appConfig, resolvedFilePath) : void 0;
|
|
156
|
+
if (plan.refreshRoutes && (event === "unlink" || event === "add")) {
|
|
157
|
+
getAppPageBrowserGraphSession(this.appConfig).invalidateByRouteFile(resolvedFilePath);
|
|
158
|
+
}
|
|
153
159
|
const isRegisteredScriptEdit = isRegisteredScriptEntrypoint(
|
|
154
160
|
this.hmrManager.getWatchedFiles(),
|
|
155
161
|
resolvedFilePath
|
|
@@ -167,7 +173,9 @@ class ProjectWatcher {
|
|
|
167
173
|
const deferProcessorNotifications = plan.category === "include-source" || plan.category === "explicit-server-view" || isRegisteredScriptEdit;
|
|
168
174
|
if (deferProcessorNotifications && plan.delegateToHmr) {
|
|
169
175
|
await this.prewarmBeforeHmr(resolvedFilePath, plan);
|
|
170
|
-
await this.hmrManager.handleFileChange(filePath
|
|
176
|
+
await this.hmrManager.handleFileChange(filePath, {
|
|
177
|
+
graphIdentities: graphPreparation?.affectedGraphIdentities
|
|
178
|
+
});
|
|
171
179
|
await this.notifyProcessors(filePath, event);
|
|
172
180
|
return;
|
|
173
181
|
}
|
|
@@ -176,7 +184,9 @@ class ProjectWatcher {
|
|
|
176
184
|
return;
|
|
177
185
|
}
|
|
178
186
|
if (plan.delegateToHmr) {
|
|
179
|
-
await this.hmrManager.handleFileChange(filePath
|
|
187
|
+
await this.hmrManager.handleFileChange(filePath, {
|
|
188
|
+
graphIdentities: graphPreparation?.affectedGraphIdentities
|
|
189
|
+
});
|
|
180
190
|
}
|
|
181
191
|
} catch (error) {
|
|
182
192
|
if (error instanceof Error) {
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
|
-
import { type BrowserRuntimeManifest } from './browser-runtime-manifest.js';
|
|
3
|
-
export interface AppBuildManifest {
|
|
4
|
-
loaderPlugins: EcoBuildPlugin[];
|
|
5
|
-
runtimePlugins: EcoBuildPlugin[];
|
|
6
|
-
browserBundlePlugins: EcoBuildPlugin[];
|
|
7
|
-
browserRuntimeManifest: BrowserRuntimeManifest;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Merges plugin lists while preserving first-registration precedence by name.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Build manifests treat plugin names as stable identities. The first plugin
|
|
14
|
-
* with a given name wins so config-time assembly stays deterministic across
|
|
15
|
-
* loader, runtime, and browser buckets.
|
|
16
|
-
*/
|
|
17
|
-
export declare function mergeEcoBuildPlugins(...pluginLists: Array<EcoBuildPlugin[] | undefined>): EcoBuildPlugin[];
|
|
18
|
-
/**
|
|
19
|
-
* Creates one app-owned build manifest from the supplied plugin buckets.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createAppBuildManifest(input?: Partial<AppBuildManifest>): AppBuildManifest;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the shared browser runtime asset manifest sealed into the app build manifest.
|
|
24
|
-
*/
|
|
25
|
-
export declare function getBrowserRuntimeManifest(manifest: AppBuildManifest): BrowserRuntimeManifest;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the plugin list used for server-oriented builds.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getServerBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
30
|
-
/**
|
|
31
|
-
* Returns the plugin list used for browser-oriented builds.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getBrowserBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { createJsxCacheKey, createPluginCacheKey } from "../services/module-loading/route-module-build-manifest.js";
|
|
3
|
-
function createBuildOptionsDedupeKey(options) {
|
|
4
|
-
return [
|
|
5
|
-
normalizeEntrypoints(options.entrypoints),
|
|
6
|
-
options.root ? path.resolve(options.root) : "root:default",
|
|
7
|
-
options.outdir ? path.resolve(options.outdir) : "outdir:default",
|
|
8
|
-
options.splitting ?? "splitting:default",
|
|
9
|
-
options.externalPackages ?? "externalPackages:default",
|
|
10
|
-
options.target ?? "target:default",
|
|
11
|
-
options.format ?? "format:default",
|
|
12
|
-
options.sourcemap ?? "sourcemap:default",
|
|
13
|
-
options.minify ?? "minify:default",
|
|
14
|
-
options.treeshaking ?? "treeshaking:default",
|
|
15
|
-
options.naming ?? "naming:default",
|
|
16
|
-
createJsxCacheKey(options.jsx),
|
|
17
|
-
createPluginCacheKey(options.plugins)
|
|
18
|
-
].join("::");
|
|
19
|
-
}
|
|
20
|
-
function normalizeEntrypoints(entrypoints) {
|
|
21
|
-
if (Array.isArray(entrypoints)) {
|
|
22
|
-
return entrypoints.map((entrypoint) => path.resolve(entrypoint)).sort().join("|");
|
|
23
|
-
}
|
|
24
|
-
return Object.entries(entrypoints).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}:${path.resolve(value)}`).join("|");
|
|
25
|
-
}
|
|
26
|
-
class DedupingBuildExecutor {
|
|
27
|
-
inner;
|
|
28
|
-
inFlight = /* @__PURE__ */ new Map();
|
|
29
|
-
constructor(inner) {
|
|
30
|
-
this.inner = inner;
|
|
31
|
-
}
|
|
32
|
-
build(options) {
|
|
33
|
-
const key = createBuildOptionsDedupeKey(options);
|
|
34
|
-
const existing = this.inFlight.get(key);
|
|
35
|
-
if (existing) {
|
|
36
|
-
return existing;
|
|
37
|
-
}
|
|
38
|
-
const buildPromise = this.inner.build(options).finally(() => {
|
|
39
|
-
if (this.inFlight.get(key) === buildPromise) {
|
|
40
|
-
this.inFlight.delete(key);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
this.inFlight.set(key, buildPromise);
|
|
44
|
-
return buildPromise;
|
|
45
|
-
}
|
|
46
|
-
unwrap() {
|
|
47
|
-
return this.inner;
|
|
48
|
-
}
|
|
49
|
-
getInFlightCountForTests() {
|
|
50
|
-
return this.inFlight.size;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
54
|
-
DedupingBuildExecutor,
|
|
55
|
-
createBuildOptionsDedupeKey
|
|
56
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
-
import type { BuildExecutor } from './build-adapter.js';
|
|
3
|
-
export type { BuildProfile, BuildRuntime } from './build-runtime.js';
|
|
4
|
-
export { disposeAppBuildRuntime, getBuildRuntime, installBuildRuntime, requireBuildRuntime } from './build-runtime.js';
|
|
5
|
-
/**
|
|
6
|
-
* Installs the app-owned runtime build executors for one app instance.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Delegates to {@link installBuildRuntime}. Route-module and HMR browser builds
|
|
10
|
-
* use parallel one-shot Rolldown. Server-entry bundling stays serialized
|
|
11
|
-
* single-flight.
|
|
12
|
-
*/
|
|
13
|
-
export declare function installAppRuntimeBuildExecutor(appConfig: EcoPagesAppConfig): BuildExecutor;
|
|
14
|
-
export declare function getInstalledServerEntryBuildExecutor(appConfig: EcoPagesAppConfig): BuildExecutor;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { installBuildRuntime, requireBuildRuntime } from "./build-runtime.js";
|
|
2
|
-
import { disposeAppBuildRuntime, getBuildRuntime, installBuildRuntime as installBuildRuntime2, requireBuildRuntime as requireBuildRuntime2 } from "./build-runtime.js";
|
|
3
|
-
function installAppRuntimeBuildExecutor(appConfig) {
|
|
4
|
-
return installBuildRuntime(appConfig).getProfile("route-module");
|
|
5
|
-
}
|
|
6
|
-
function getInstalledServerEntryBuildExecutor(appConfig) {
|
|
7
|
-
return requireBuildRuntime(appConfig).getProfile("server-entry");
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
disposeAppBuildRuntime,
|
|
11
|
-
getBuildRuntime,
|
|
12
|
-
getInstalledServerEntryBuildExecutor,
|
|
13
|
-
installAppRuntimeBuildExecutor,
|
|
14
|
-
installBuildRuntime2 as installBuildRuntime,
|
|
15
|
-
requireBuildRuntime2 as requireBuildRuntime
|
|
16
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/build/{browser-runtime-plugin-helpers.js → browser/browser-runtime-plugin-helpers.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/build/{server-side-css-shim-plugin.d.ts → rolldown/server-side-css-shim-plugin.d.ts}
RENAMED
|
File without changes
|
/package/src/build/{server-side-css-shim-plugin.js → rolldown/server-side-css-shim-plugin.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|