@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
package/src/index.browser.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export type * from './eco/eco.types.js';
|
|
|
3
3
|
export { eco } from './eco/eco.browser.js';
|
|
4
4
|
export { bindComponentIdentity, getComponentIdentity, type ComponentIdentity } from './eco/component-identity.js';
|
|
5
5
|
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
|
6
|
-
export {
|
|
7
|
-
export { mergeLayoutDependencies } from './eco/page-layout-normalization.js';
|
|
6
|
+
export { mergePageDependencies } from './eco/page-dependency-contributions.js';
|
package/src/index.browser.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { eco } from './eco/eco.browser.js';
|
|
2
2
|
export { bindComponentIdentity, getComponentIdentity } from './eco/component-identity.js';
|
|
3
3
|
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
|
4
|
-
export {
|
|
5
|
-
export { mergeLayoutDependencies } from './eco/page-layout-normalization.js';
|
|
4
|
+
export { mergePageDependencies } from './eco/page-dependency-contributions.js';
|
package/src/index.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ export type * from './types/public-types.js';
|
|
|
2
2
|
export type * from './eco/eco.types.js';
|
|
3
3
|
export { eco } from './eco/eco.js';
|
|
4
4
|
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, json, html, redirect, type GroupHandler, } from './adapters/shared/http/define-api-handler.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { createVitePluginsFromAppSourceTransforms, createVitePluginFromSourceTransform, type EcoSourceTransform, type EcoSourceTransformResult, type EcoViteCompatiblePlugin, } from './plugins/source-transform.js';
|
|
6
|
+
export { attributeMdxComponentIdentity, createEcoComponentMetaTransform } from './plugins/eco-component-meta-plugin.js';
|
|
7
7
|
export { bindComponentIdentity, getComponentIdentity, type ComponentIdentity } from './eco/component-identity.js';
|
|
8
|
-
export { attachDiscoveredDependencies
|
|
9
|
-
export {
|
|
10
|
-
export { mergeLayoutDependencies } from './eco/page-layout-normalization.js';
|
|
8
|
+
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
|
9
|
+
export { mergePageDependencies } from './eco/page-dependency-contributions.js';
|
|
11
10
|
export { SchemaError, validateStandardSchema } from './services/validation/validate-standard-schema.js';
|
|
12
|
-
export { buildIslandHostAttributes,
|
|
11
|
+
export { buildIslandHostAttributes, finalizeIslandComponentRender } from './islands/island-host.js';
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { eco } from './eco/eco.js';
|
|
2
2
|
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, json, html, redirect, } from './adapters/shared/http/define-api-handler.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { createVitePluginsFromAppSourceTransforms, createVitePluginFromSourceTransform, } from './plugins/source-transform.js';
|
|
4
|
+
export { attributeMdxComponentIdentity, createEcoComponentMetaTransform } from './plugins/eco-component-meta-plugin.js';
|
|
5
5
|
export { bindComponentIdentity, getComponentIdentity } from './eco/component-identity.js';
|
|
6
|
-
export { attachDiscoveredDependencies
|
|
7
|
-
export {
|
|
8
|
-
export { mergeLayoutDependencies } from './eco/page-layout-normalization.js';
|
|
6
|
+
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
|
7
|
+
export { mergePageDependencies } from './eco/page-dependency-contributions.js';
|
|
9
8
|
export { SchemaError, validateStandardSchema } from './services/validation/validate-standard-schema.js';
|
|
10
|
-
export { buildIslandHostAttributes,
|
|
9
|
+
export { buildIslandHostAttributes, finalizeIslandComponentRender } from './islands/island-host.js';
|
|
@@ -10,16 +10,7 @@ export type IslandHostAttributesInput = {
|
|
|
10
10
|
props?: Record<string, unknown>;
|
|
11
11
|
existing?: Record<string, string>;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
14
|
-
* @remarks Presence marker for hydratable component hosts, similar in spirit to Astro's `astro-island`.
|
|
15
|
-
*/
|
|
16
|
-
export declare function mergeIslandHostAttributes(input: {
|
|
17
|
-
integrationName: string;
|
|
18
|
-
componentInstanceId: string;
|
|
19
|
-
existing?: Record<string, string>;
|
|
20
|
-
}): Record<string, string>;
|
|
21
13
|
export declare function buildIslandHostAttributes(input: IslandHostAttributesInput): Record<string, string>;
|
|
22
|
-
export declare function isIslandHostElement(element: Element): boolean;
|
|
23
14
|
export declare function componentRenderHasIslandBootstrap(assets: Array<{
|
|
24
15
|
kind: string;
|
|
25
16
|
}> | undefined): boolean;
|
|
@@ -6,7 +6,7 @@ export const ECO_ISLAND_PROPS_ATTRIBUTE = 'data-eco-props';
|
|
|
6
6
|
/**
|
|
7
7
|
* @remarks Presence marker for hydratable component hosts, similar in spirit to Astro's `astro-island`.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
function mergeIslandHostAttributes(input) {
|
|
10
10
|
return {
|
|
11
11
|
...input.existing,
|
|
12
12
|
[ECO_ISLAND_HOST_ATTRIBUTE]: '',
|
|
@@ -24,18 +24,6 @@ export function buildIslandHostAttributes(input) {
|
|
|
24
24
|
}
|
|
25
25
|
return attributes;
|
|
26
26
|
}
|
|
27
|
-
export function isIslandHostElement(element) {
|
|
28
|
-
if (element.hasAttribute(ECO_ISLAND_HOST_ATTRIBUTE)) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
if (element.hasAttribute(ECO_ISLAND_COMPONENT_KEY_ATTRIBUTE)) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
if (element.tagName.toLowerCase() === 'eco-island') {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
return element.hasAttribute(ECO_ISLAND_COMPONENT_ID_ATTRIBUTE) && element.hasAttribute(ECO_ISLAND_PROPS_ATTRIBUTE);
|
|
38
|
-
}
|
|
39
27
|
export function componentRenderHasIslandBootstrap(assets) {
|
|
40
28
|
return (assets ?? []).some((asset) => asset.kind === 'script');
|
|
41
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
3
|
-
import {
|
|
3
|
+
import { parseModuleSource } from '../cache/module-parse-cache.js';
|
|
4
4
|
import { loadTsconfigPathPrefixes, matchesTsconfigPathPrefix, resolveProjectModulePath, } from './tsconfig-import-resolver.js';
|
|
5
5
|
function node(value) {
|
|
6
6
|
return typeof value === 'object' && value !== null ? value : undefined;
|
|
@@ -90,7 +90,7 @@ function indexModuleExports(file, cache) {
|
|
|
90
90
|
if (cached)
|
|
91
91
|
return cached;
|
|
92
92
|
const source = readFileSync(file, 'utf8');
|
|
93
|
-
const parsed =
|
|
93
|
+
const parsed = parseModuleSource(file, source, { sourceType: 'module' });
|
|
94
94
|
const body = nodes(parsed.program.body);
|
|
95
95
|
const { declared, factories } = collectDeclaredFactoryBindings(body);
|
|
96
96
|
const namedReexports = new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { prependJsxImportSourceIfMissing } from './jsx-import-source.utils.js';
|
|
2
2
|
import { createEcoBuildPluginFromSourceTransform, createVitePluginFromSourceTransform } from './source-transform.js';
|
|
3
|
-
import {
|
|
3
|
+
import { parseModuleSource } from '../cache/module-parse-cache.js';
|
|
4
4
|
import { rapidhash } from '../utils/hash.js';
|
|
5
5
|
import { discoverComponentImports } from './component-import-discovery.js';
|
|
6
6
|
function integrationForFile(filePath, config) {
|
|
@@ -98,7 +98,7 @@ export function attributeComponentIdentity(contents, filePath, integration, proj
|
|
|
98
98
|
return contents;
|
|
99
99
|
let program;
|
|
100
100
|
try {
|
|
101
|
-
program =
|
|
101
|
+
program = parseModuleSource(filePath, contents, { sourceType: 'module' }).program;
|
|
102
102
|
}
|
|
103
103
|
catch {
|
|
104
104
|
return contents;
|
|
@@ -133,7 +133,7 @@ export function attributeComponentIdentity(contents, filePath, integration, proj
|
|
|
133
133
|
for (const edit of edits.sort((left, right) => right.start - left.start)) {
|
|
134
134
|
transformed = `${transformed.slice(0, edit.start)}${edit.replacement}${transformed.slice(edit.end)}`;
|
|
135
135
|
}
|
|
136
|
-
return addIdentityBindingImport(transformed,
|
|
136
|
+
return addIdentityBindingImport(transformed, parseModuleSource(filePath, transformed, { sourceType: 'module' }).program);
|
|
137
137
|
}
|
|
138
138
|
function findMdxConfigDeclarator(program) {
|
|
139
139
|
for (const statement of nodes(program?.body)) {
|
|
@@ -180,7 +180,7 @@ export function attributeMdxComponentIdentity(contents, filePath, integration, p
|
|
|
180
180
|
}
|
|
181
181
|
let program;
|
|
182
182
|
try {
|
|
183
|
-
program =
|
|
183
|
+
program = parseModuleSource(filePath, contents, { lang: 'jsx', sourceType: 'module' })
|
|
184
184
|
.program;
|
|
185
185
|
}
|
|
186
186
|
catch {
|
|
@@ -206,7 +206,7 @@ export function attributeMdxComponentIdentity(contents, filePath, integration, p
|
|
|
206
206
|
transformed = `${transformed.slice(0, edit.start)}${edit.replacement}${transformed.slice(edit.end)}`;
|
|
207
207
|
}
|
|
208
208
|
transformed = `${transformed}\n${appended}`;
|
|
209
|
-
return addNamedImport(transformed,
|
|
209
|
+
return addNamedImport(transformed, parseModuleSource(filePath, transformed, { lang: 'jsx', sourceType: 'module' }).program, '@ecopages/core', ['bindComponentIdentity', 'attachDiscoveredDependencies']);
|
|
210
210
|
}
|
|
211
211
|
export function createEcoComponentMetaTransform(options) {
|
|
212
212
|
const extensions = options.config.integrations
|
|
@@ -25,7 +25,6 @@ export declare const INTEGRATION_PLUGIN_ERRORS: {
|
|
|
25
25
|
readonly NOT_INITIALIZED_WITH_ASSET_SERVICE: "Plugin not initialized with asset dependency service";
|
|
26
26
|
};
|
|
27
27
|
export declare function mergeIntegrationOptions<TDefaults, TOverrides>(defaults: TDefaults, overrides: TOverrides): TDefaults & TOverrides;
|
|
28
|
-
export declare function assertIntegrationInvariant(condition: boolean, message?: string): asserts condition;
|
|
29
28
|
/**
|
|
30
29
|
* Base configuration shared by all integration plugins.
|
|
31
30
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createBrowserRuntimeManifest, } from '../build/browser/browser-runtime-manifest.js';
|
|
2
2
|
import { AssetProcessingService } from '../services/assets/asset-processing-service/asset-processing.service.js';
|
|
3
3
|
import { deepMerge } from '../utils/deep-merge.js';
|
|
4
|
-
import { invariant } from '../utils/invariant.js';
|
|
5
4
|
export const INTEGRATION_PLUGIN_ERRORS = {
|
|
6
5
|
NOT_INITIALIZED_WITH_APP_CONFIG: 'Plugin not initialized with app config',
|
|
7
6
|
NOT_INITIALIZED_WITH_ASSET_SERVICE: 'Plugin not initialized with asset dependency service',
|
|
@@ -9,9 +8,6 @@ export const INTEGRATION_PLUGIN_ERRORS = {
|
|
|
9
8
|
export function mergeIntegrationOptions(defaults, overrides) {
|
|
10
9
|
return deepMerge(defaults, overrides);
|
|
11
10
|
}
|
|
12
|
-
export function assertIntegrationInvariant(condition, message) {
|
|
13
|
-
invariant(condition, message);
|
|
14
|
-
}
|
|
15
11
|
/**
|
|
16
12
|
* Base class for framework integrations.
|
|
17
13
|
*
|
|
@@ -150,8 +150,5 @@ export async function finalizeDocumentShellHtml(htmlTransformer, options) {
|
|
|
150
150
|
if (!shouldTransform) {
|
|
151
151
|
return html;
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
headers: { 'Content-Type': 'text/html' },
|
|
155
|
-
}), options.htmlContributions);
|
|
156
|
-
return await transformedResponse.text();
|
|
153
|
+
return htmlTransformer.transformHtml(html, options.htmlContributions);
|
|
157
154
|
}
|
package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts
CHANGED
|
@@ -24,11 +24,22 @@ export type QueuedForeignSubtreeResolutionContext = {
|
|
|
24
24
|
queuedResolutions: QueuedForeignSubtreeResolution[];
|
|
25
25
|
};
|
|
26
26
|
type QueuedForeignSubtreeIntegrationContext = BaseIntegrationContext & Record<string, unknown>;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Children of a queued foreign subtree after the host renderer has processed them.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Set `html` when the host serialized the children, or `children` to pass them
|
|
32
|
+
* to the owning renderer unserialized. Leave both unset when there are no
|
|
33
|
+
* children. Assets are not returned here: the owning renderer reports the
|
|
34
|
+
* foreign component's assets, and host components' assets come from their
|
|
35
|
+
* declared dependencies.
|
|
36
|
+
*/
|
|
37
|
+
export type QueuedForeignSubtreeChildRenderResult = {
|
|
29
38
|
html?: string;
|
|
30
39
|
children?: unknown;
|
|
31
40
|
};
|
|
41
|
+
/** Renders the children of one queued foreign subtree inside the host renderer. */
|
|
42
|
+
export type RenderQueuedForeignSubtreeChildren<TContext extends QueuedForeignSubtreeResolutionContext> = (children: unknown, runtimeContext: TContext, queuedResolutionsByToken: Map<string, QueuedForeignSubtreeResolution>, resolveToken: (token: string) => Promise<string>) => Promise<QueuedForeignSubtreeChildRenderResult>;
|
|
32
43
|
export interface ForeignSubtreeExecutionOwningRenderer {
|
|
33
44
|
readonly name: string;
|
|
34
45
|
renderComponentWithForeignChildren(input: ComponentRenderInput): Promise<ComponentRenderResult>;
|
|
@@ -56,38 +67,20 @@ export interface ForeignSubtreeQueuedRuntimeOptions<TContext extends QueuedForei
|
|
|
56
67
|
tokenPrefix: string;
|
|
57
68
|
createRuntimeContext?: (integrationContext: BaseIntegrationContext & Record<string, unknown>, rendererCache: Map<string, unknown>) => TContext;
|
|
58
69
|
}
|
|
59
|
-
export interface ForeignSubtreeStringQueuedHtmlOptions {
|
|
60
|
-
currentIntegrationName: string;
|
|
61
|
-
renderInput: ComponentRenderInput;
|
|
62
|
-
html: string;
|
|
63
|
-
runtimeContextKey: string;
|
|
64
|
-
queueLabel: string;
|
|
65
|
-
getOwningRenderer(integrationName: string, rendererCache: Map<string, ForeignSubtreeExecutionOwningRenderer>): Promise<ForeignSubtreeExecutionOwningRenderer>;
|
|
66
|
-
applyAttributesToFirstElement(html: string, attributes: Record<string, string>): string;
|
|
67
|
-
dedupeProcessedAssets(assets: ProcessedAsset[]): ProcessedAsset[];
|
|
68
|
-
}
|
|
69
70
|
export interface ForeignSubtreeQueuedHtmlOptions<TContext extends QueuedForeignSubtreeResolutionContext> {
|
|
70
71
|
currentIntegrationName: string;
|
|
71
72
|
html: string;
|
|
72
73
|
runtimeContext?: TContext;
|
|
73
|
-
|
|
74
|
-
renderQueuedChildren(children: unknown, runtimeContext: TContext, queuedResolutionsByToken: Map<string, QueuedForeignSubtreeResolution>, resolveToken: (token: string) => Promise<string>): Promise<{
|
|
75
|
-
assets: ProcessedAsset[];
|
|
76
|
-
children?: unknown;
|
|
77
|
-
html?: string;
|
|
78
|
-
}>;
|
|
74
|
+
renderQueuedChildren: RenderQueuedForeignSubtreeChildren<TContext>;
|
|
79
75
|
getOwningRenderer(integrationName: string, rendererCache: Map<string, ForeignSubtreeExecutionOwningRenderer>): Promise<ForeignSubtreeExecutionOwningRenderer>;
|
|
80
|
-
applyAttributesToFirstElement(html: string, attributes: Record<string, string>): string;
|
|
81
|
-
dedupeProcessedAssets(assets: ProcessedAsset[]): ProcessedAsset[];
|
|
82
76
|
}
|
|
77
|
+
export type ForeignSubtreeStringQueuedHtmlOptions = Omit<ForeignSubtreeQueuedHtmlOptions<QueuedForeignSubtreeResolutionContext>, 'renderQueuedChildren'>;
|
|
83
78
|
export interface ResolveQueuedForeignSubtreeTokensOptions<TContext extends QueuedForeignSubtreeResolutionContext> {
|
|
84
79
|
html: string;
|
|
85
80
|
runtimeContext?: TContext;
|
|
86
81
|
queueLabel: string;
|
|
87
|
-
renderQueuedChildren:
|
|
82
|
+
renderQueuedChildren: RenderQueuedForeignSubtreeChildren<TContext>;
|
|
88
83
|
resolveForeignSubtree: (input: ComponentRenderInput, rendererCache: Map<string, unknown>) => Promise<ForeignSubtreeRenderPayload | undefined>;
|
|
89
|
-
applyAttributesToFirstElement: (html: string, attributes: Record<string, string>) => string;
|
|
90
|
-
dedupeProcessedAssets: (assets: ProcessedAsset[]) => ProcessedAsset[];
|
|
91
84
|
}
|
|
92
85
|
/**
|
|
93
86
|
* Maps one component render result into the foreign-subtree payload shape used by
|
|
@@ -115,7 +108,15 @@ export declare class ForeignSubtreeExecutionService {
|
|
|
115
108
|
createRuntimeContext?: (integrationContext: QueuedForeignSubtreeIntegrationContext, rendererCache: Map<string, unknown>) => TContext;
|
|
116
109
|
}): ForeignChildRuntime;
|
|
117
110
|
getRuntimeContext<TContext extends QueuedForeignSubtreeResolutionContext>(input: ComponentRenderInput, runtimeContextKey: string): TContext | undefined;
|
|
118
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Resolves queued foreign subtrees for a renderer whose children are markup.
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* String children and markup nodes are serialized and their nested tokens
|
|
116
|
+
* resolved. Structured children pass to the owning renderer unchanged; opaque
|
|
117
|
+
* objects are rejected.
|
|
118
|
+
*/
|
|
119
|
+
resolveStringQueuedHtml(options: ForeignSubtreeStringQueuedHtmlOptions): Promise<{
|
|
119
120
|
assets: ProcessedAsset[];
|
|
120
121
|
html: string;
|
|
121
122
|
}>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { applyAttributesToFirstElement } from '../../../services/html/html-transformer.service.js';
|
|
1
2
|
import { getComponentRenderContext, runWithComponentRenderContext, } from './component-render-context.js';
|
|
2
3
|
import { assertForeignChildrenNotOpaque, isMarkupNodeLike } from './foreign-child-output.utils.js';
|
|
4
|
+
import { dedupeProcessedAssets } from '../page-browser-graph/processed-asset-dedupe.js';
|
|
3
5
|
/**
|
|
4
6
|
* Maps one component render result into the foreign-subtree payload shape used by
|
|
5
7
|
* queue resolution and integration tests.
|
|
@@ -106,34 +108,35 @@ export class ForeignSubtreeExecutionService {
|
|
|
106
108
|
}
|
|
107
109
|
return runtimeContext;
|
|
108
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolves queued foreign subtrees for a renderer whose children are markup.
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* String children and markup nodes are serialized and their nested tokens
|
|
116
|
+
* resolved. Structured children pass to the owning renderer unchanged; opaque
|
|
117
|
+
* objects are rejected.
|
|
118
|
+
*/
|
|
109
119
|
async resolveStringQueuedHtml(options) {
|
|
110
|
-
const runtimeContext = this.getQueuedRuntimeContext(options.renderInput, options.runtimeContextKey);
|
|
111
120
|
return this.resolveQueuedHtml({
|
|
112
|
-
|
|
113
|
-
html: options.html,
|
|
114
|
-
runtimeContext,
|
|
115
|
-
queueLabel: options.queueLabel,
|
|
121
|
+
...options,
|
|
116
122
|
renderQueuedChildren: async (children, _runtimeContext, queuedResolutionsByToken, resolveToken) => {
|
|
117
123
|
if (children === undefined) {
|
|
118
|
-
return {
|
|
124
|
+
return {};
|
|
119
125
|
}
|
|
120
126
|
if (typeof children !== 'string' && !isMarkupNodeLike(children)) {
|
|
121
|
-
assertForeignChildrenNotOpaque(children, options.
|
|
122
|
-
return {
|
|
127
|
+
assertForeignChildrenNotOpaque(children, options.currentIntegrationName);
|
|
128
|
+
return { children };
|
|
123
129
|
}
|
|
124
130
|
const html = await this.resolveQueuedTokens(typeof children === 'string' ? children : (children.outerHTML ?? ''), queuedResolutionsByToken, resolveToken);
|
|
125
|
-
return {
|
|
131
|
+
return { html };
|
|
126
132
|
},
|
|
127
|
-
getOwningRenderer: options.getOwningRenderer,
|
|
128
|
-
applyAttributesToFirstElement: options.applyAttributesToFirstElement,
|
|
129
|
-
dedupeProcessedAssets: options.dedupeProcessedAssets,
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
async resolveQueuedHtml(options) {
|
|
133
136
|
return this.resolveQueuedForeignSubtreeTokens({
|
|
134
137
|
html: options.html,
|
|
135
138
|
runtimeContext: options.runtimeContext,
|
|
136
|
-
queueLabel: options.
|
|
139
|
+
queueLabel: options.currentIntegrationName,
|
|
137
140
|
renderQueuedChildren: options.renderQueuedChildren,
|
|
138
141
|
resolveForeignSubtree: (input, rendererCache) => this.resolveForeignSubtreeInOwningRenderer({
|
|
139
142
|
currentIntegrationName: options.currentIntegrationName,
|
|
@@ -141,8 +144,6 @@ export class ForeignSubtreeExecutionService {
|
|
|
141
144
|
rendererCache: rendererCache,
|
|
142
145
|
getOwningRenderer: options.getOwningRenderer,
|
|
143
146
|
}),
|
|
144
|
-
applyAttributesToFirstElement: options.applyAttributesToFirstElement,
|
|
145
|
-
dedupeProcessedAssets: options.dedupeProcessedAssets,
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
149
|
async resolveQueuedForeignSubtreeTokens(options) {
|
|
@@ -178,9 +179,6 @@ export class ForeignSubtreeExecutionService {
|
|
|
178
179
|
try {
|
|
179
180
|
const renderedChildren = await options.renderQueuedChildren(resolution.props.children, runtimeContext, queuedResolutionsByToken, resolveToken);
|
|
180
181
|
syncQueuedResolutions();
|
|
181
|
-
if (renderedChildren.assets.length > 0) {
|
|
182
|
-
collectedAssets.push(...renderedChildren.assets);
|
|
183
|
-
}
|
|
184
182
|
const foreignSubtreeRender = await options.resolveForeignSubtree({
|
|
185
183
|
component: resolution.component,
|
|
186
184
|
props: { ...resolution.props },
|
|
@@ -198,7 +196,7 @@ export class ForeignSubtreeExecutionService {
|
|
|
198
196
|
}
|
|
199
197
|
const resolvedHtml = foreignSubtreeRender.attachmentPolicy.kind === 'first-element' &&
|
|
200
198
|
foreignSubtreeRender.rootAttributes
|
|
201
|
-
?
|
|
199
|
+
? applyAttributesToFirstElement(foreignSubtreeRender.html, foreignSubtreeRender.rootAttributes)
|
|
202
200
|
: foreignSubtreeRender.html;
|
|
203
201
|
resolvedHtmlByToken.set(token, resolvedHtml);
|
|
204
202
|
return resolvedHtml;
|
|
@@ -217,7 +215,7 @@ export class ForeignSubtreeExecutionService {
|
|
|
217
215
|
resolvedHtml = resolvedHtml.split(resolution.token).join(await resolveToken(resolution.token));
|
|
218
216
|
}
|
|
219
217
|
return {
|
|
220
|
-
assets:
|
|
218
|
+
assets: dedupeProcessedAssets(collectedAssets),
|
|
221
219
|
html: resolvedHtml,
|
|
222
220
|
};
|
|
223
221
|
}
|
|
@@ -15,7 +15,7 @@ import { RouteRenderOrchestrator, type RouteRenderOrchestratorAdapter, type Rout
|
|
|
15
15
|
import { type ResolvedPageDependencies } from '../page-loading/resolved-page-dependencies.js';
|
|
16
16
|
import { type GroupedGraphBuildPlan } from './page-browser-graph/grouped-graph-build-plan.js';
|
|
17
17
|
import type { ForeignChildRuntime } from './foreign-child/component-render-context.js';
|
|
18
|
-
import { ForeignSubtreeExecutionService } from './foreign-child/foreign-subtree-execution.service.js';
|
|
18
|
+
import { ForeignSubtreeExecutionService, type ForeignSubtreeExecutionOwningRenderer, type QueuedForeignSubtreeResolutionContext, type RenderQueuedForeignSubtreeChildren } from './foreign-child/foreign-subtree-execution.service.js';
|
|
19
19
|
import { type DocumentShellLayoutInput } from './document-shell/document-shell-render.service.js';
|
|
20
20
|
/**
|
|
21
21
|
* Controls how one route module is loaded outside the normal render path.
|
|
@@ -325,7 +325,6 @@ export declare abstract class IntegrationRenderer<C = EcoPagesElement> {
|
|
|
325
325
|
* other runtime coordination markers without relying on script sniffing.
|
|
326
326
|
*/
|
|
327
327
|
protected getDocumentAttributes(_renderOptions: IntegrationRendererRenderOptions<C>): Record<string, string> | undefined;
|
|
328
|
-
protected applyAttributesToFirstBodyElement(html: string, attributes: Record<string, string>): string;
|
|
329
328
|
protected applyAttributesToHtmlElement(html: string, attributes: Record<string, string>): string;
|
|
330
329
|
/**
|
|
331
330
|
* Returns declarative HTML fragments that core should inject into the final document.
|
|
@@ -354,6 +353,29 @@ export declare abstract class IntegrationRenderer<C = EcoPagesElement> {
|
|
|
354
353
|
* renderer's nested foreign-child handoff.
|
|
355
354
|
*/
|
|
356
355
|
renderComponentWithForeignChildren(input: InternalComponentRenderInput): Promise<ComponentRenderResult>;
|
|
356
|
+
/**
|
|
357
|
+
* Returns the renderer that owns `integrationName`, reusing `rendererCache`
|
|
358
|
+
* for the current render.
|
|
359
|
+
*/
|
|
360
|
+
protected resolveOwningRenderer(integrationName: string, rendererCache: Map<string, ForeignSubtreeExecutionOwningRenderer>): Promise<ForeignSubtreeExecutionOwningRenderer>;
|
|
361
|
+
/**
|
|
362
|
+
* Returns the queued foreign-subtree state this renderer keeps on `input`, or
|
|
363
|
+
* `undefined` when nothing was queued for it.
|
|
364
|
+
*/
|
|
365
|
+
protected getQueuedForeignSubtreeContext<TContext extends QueuedForeignSubtreeResolutionContext = QueuedForeignSubtreeResolutionContext>(input: ComponentRenderInput): TContext | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* Replaces the foreign-subtree tokens queued while rendering `html` with the
|
|
368
|
+
* HTML each owning renderer produces.
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* `renderQueuedChildren` renders a subtree's children inside this renderer
|
|
372
|
+
* before the owning renderer renders the subtree around them. The returned
|
|
373
|
+
* assets are the owning renderers' assets, deduplicated.
|
|
374
|
+
*/
|
|
375
|
+
protected resolveQueuedForeignSubtrees<TContext extends QueuedForeignSubtreeResolutionContext>(html: string, runtimeContext: TContext | undefined, renderQueuedChildren: RenderQueuedForeignSubtreeChildren<TContext>): Promise<{
|
|
376
|
+
assets: ProcessedAsset[];
|
|
377
|
+
html: string;
|
|
378
|
+
}>;
|
|
357
379
|
protected finalizeIslandComponentRender(input: ComponentRenderInput, result: ComponentRenderResult): ComponentRenderResult;
|
|
358
380
|
private normalizeComponentRenderOutput;
|
|
359
381
|
protected normalizeUnresolvedMarkerArtifactHtml(html: string): string;
|
|
@@ -424,9 +446,4 @@ export declare abstract class IntegrationRenderer<C = EcoPagesElement> {
|
|
|
424
446
|
renderInput: ComponentRenderInput;
|
|
425
447
|
rendererCache: Map<string, IntegrationRenderer<any>>;
|
|
426
448
|
}): ForeignChildRuntime;
|
|
427
|
-
/**
|
|
428
|
-
* Creates an explicit fail-fast runtime for tests or renderers that do not
|
|
429
|
-
* support cross-integration foreign-child execution.
|
|
430
|
-
*/
|
|
431
|
-
protected createFailFastForeignChildRuntime(): ForeignChildRuntime;
|
|
432
449
|
}
|
|
@@ -22,7 +22,7 @@ import { normalizeUnresolvedMarkerArtifactHtml } from './route-pipeline/marker-a
|
|
|
22
22
|
import { isMarkupNodeLike } from './foreign-child/foreign-child-output.utils.js';
|
|
23
23
|
import { getForeignSubtreeResolutionContextKey, getForeignSubtreeTokenPrefix, resolveOwningIntegrationRenderer, } from './foreign-child/owning-renderer-resolution.js';
|
|
24
24
|
import { ensureIntegrationRuntimeReady } from '../../build/app-build-manifest-runtime.js';
|
|
25
|
-
import { ForeignSubtreeExecutionService } from './foreign-child/foreign-subtree-execution.service.js';
|
|
25
|
+
import { ForeignSubtreeExecutionService, } from './foreign-child/foreign-subtree-execution.service.js';
|
|
26
26
|
import { composeDocumentShell, finalizeDocumentShellHtml, renderPageDocumentShell, } from './document-shell/document-shell-render.service.js';
|
|
27
27
|
import { resolveInnermostPageLayout, resolvePageLayoutComponents, } from './document-shell/layout-shell-props.service.js';
|
|
28
28
|
import { finalizeIslandComponentRender } from '../../islands/island-host.js';
|
|
@@ -421,20 +421,9 @@ export class IntegrationRenderer {
|
|
|
421
421
|
const componentRender = await this.renderStringComponentWithSerializedChildren(input, component);
|
|
422
422
|
const queuedForeignSubtreeResolution = await this.foreignSubtreeExecutionService.resolveStringQueuedHtml({
|
|
423
423
|
currentIntegrationName: this.name,
|
|
424
|
-
renderInput: input,
|
|
425
424
|
html: componentRender.html,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
getOwningRenderer: (integrationName, rendererCache) => resolveOwningIntegrationRenderer({
|
|
429
|
-
appConfig: this.appConfig,
|
|
430
|
-
runtimeOrigin: this.runtimeOrigin,
|
|
431
|
-
currentIntegrationName: this.name,
|
|
432
|
-
currentRenderer: this,
|
|
433
|
-
integrationName,
|
|
434
|
-
cache: rendererCache,
|
|
435
|
-
}),
|
|
436
|
-
applyAttributesToFirstElement: (html, attributes) => this.htmlTransformer.applyAttributesToFirstElement(html, attributes),
|
|
437
|
-
dedupeProcessedAssets: (assets) => this.htmlTransformer.dedupeProcessedAssets(assets),
|
|
425
|
+
runtimeContext: this.getQueuedForeignSubtreeContext(input),
|
|
426
|
+
getOwningRenderer: (integrationName, rendererCache) => this.resolveOwningRenderer(integrationName, rendererCache),
|
|
438
427
|
});
|
|
439
428
|
const mergedAssets = this.htmlTransformer.dedupeProcessedAssets([
|
|
440
429
|
...(componentRender.assets ?? []),
|
|
@@ -547,7 +536,7 @@ export class IntegrationRenderer {
|
|
|
547
536
|
applyAttributesToHtmlElement: (html, attributes) => this.applyAttributesToHtmlElement(html, attributes),
|
|
548
537
|
transformRouteResponse: async (response, htmlContributions, pagePackage) => {
|
|
549
538
|
const resolvedPagePackage = this.htmlTransformer.getPagePackage() ?? pagePackage;
|
|
550
|
-
const transformedResponse =
|
|
539
|
+
const transformedResponse = this.htmlTransformer.transform(response, htmlContributions, resolvedPagePackage);
|
|
551
540
|
return (transformedResponse.body ?? (await transformedResponse.text()));
|
|
552
541
|
},
|
|
553
542
|
});
|
|
@@ -670,9 +659,6 @@ export class IntegrationRenderer {
|
|
|
670
659
|
getDocumentAttributes(_renderOptions) {
|
|
671
660
|
return undefined;
|
|
672
661
|
}
|
|
673
|
-
applyAttributesToFirstBodyElement(html, attributes) {
|
|
674
|
-
return this.htmlTransformer.applyAttributesToFirstBodyElement(html, attributes);
|
|
675
|
-
}
|
|
676
662
|
applyAttributesToHtmlElement(html, attributes) {
|
|
677
663
|
return this.htmlTransformer.applyAttributesToHtmlElement(html, attributes);
|
|
678
664
|
}
|
|
@@ -707,14 +693,46 @@ export class IntegrationRenderer {
|
|
|
707
693
|
renderInput,
|
|
708
694
|
rendererCache: rendererCache,
|
|
709
695
|
}),
|
|
710
|
-
getOwningRenderer: (integrationName, rendererCache) =>
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
696
|
+
getOwningRenderer: (integrationName, rendererCache) => this.resolveOwningRenderer(integrationName, rendererCache),
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Returns the renderer that owns `integrationName`, reusing `rendererCache`
|
|
701
|
+
* for the current render.
|
|
702
|
+
*/
|
|
703
|
+
resolveOwningRenderer(integrationName, rendererCache) {
|
|
704
|
+
return resolveOwningIntegrationRenderer({
|
|
705
|
+
appConfig: this.appConfig,
|
|
706
|
+
runtimeOrigin: this.runtimeOrigin,
|
|
707
|
+
currentIntegrationName: this.name,
|
|
708
|
+
currentRenderer: this,
|
|
709
|
+
integrationName,
|
|
710
|
+
cache: rendererCache,
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Returns the queued foreign-subtree state this renderer keeps on `input`, or
|
|
715
|
+
* `undefined` when nothing was queued for it.
|
|
716
|
+
*/
|
|
717
|
+
getQueuedForeignSubtreeContext(input) {
|
|
718
|
+
return this.foreignSubtreeExecutionService.getQueuedRuntimeContext(input, getForeignSubtreeResolutionContextKey(this.name));
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Replaces the foreign-subtree tokens queued while rendering `html` with the
|
|
722
|
+
* HTML each owning renderer produces.
|
|
723
|
+
*
|
|
724
|
+
* @remarks
|
|
725
|
+
* `renderQueuedChildren` renders a subtree's children inside this renderer
|
|
726
|
+
* before the owning renderer renders the subtree around them. The returned
|
|
727
|
+
* assets are the owning renderers' assets, deduplicated.
|
|
728
|
+
*/
|
|
729
|
+
resolveQueuedForeignSubtrees(html, runtimeContext, renderQueuedChildren) {
|
|
730
|
+
return this.foreignSubtreeExecutionService.resolveQueuedHtml({
|
|
731
|
+
currentIntegrationName: this.name,
|
|
732
|
+
html,
|
|
733
|
+
runtimeContext,
|
|
734
|
+
renderQueuedChildren,
|
|
735
|
+
getOwningRenderer: (integrationName, rendererCache) => this.resolveOwningRenderer(integrationName, rendererCache),
|
|
718
736
|
});
|
|
719
737
|
}
|
|
720
738
|
finalizeIslandComponentRender(input, result) {
|
|
@@ -809,11 +827,4 @@ export class IntegrationRenderer {
|
|
|
809
827
|
tokenPrefix: getForeignSubtreeTokenPrefix(this.name),
|
|
810
828
|
});
|
|
811
829
|
}
|
|
812
|
-
/**
|
|
813
|
-
* Creates an explicit fail-fast runtime for tests or renderers that do not
|
|
814
|
-
* support cross-integration foreign-child execution.
|
|
815
|
-
*/
|
|
816
|
-
createFailFastForeignChildRuntime() {
|
|
817
|
-
return this.foreignSubtreeExecutionService.createFailFastRuntime(this.name);
|
|
818
|
-
}
|
|
819
830
|
}
|
|
@@ -163,7 +163,7 @@ export class TestIntegrationRenderer extends IntegrationRenderer {
|
|
|
163
163
|
createForeignChildRuntime(options) {
|
|
164
164
|
this.ForeignChildRuntimeCreationCount += 1;
|
|
165
165
|
if (this.UseFailFastForeignChildRuntime) {
|
|
166
|
-
return this.
|
|
166
|
+
return this.foreignSubtreeExecutionService.createFailFastRuntime(this.name);
|
|
167
167
|
}
|
|
168
168
|
return super.createForeignChildRuntime(options);
|
|
169
169
|
}
|
|
@@ -110,7 +110,7 @@ export declare function getAppPageBrowserGraphSession(appConfig: EcoPagesAppConf
|
|
|
110
110
|
/**
|
|
111
111
|
* Invalidates graph records that depend on the changed file path.
|
|
112
112
|
*/
|
|
113
|
-
export declare function invalidatePageBrowserGraphSession(appConfig: EcoPagesAppConfig, filePath: string):
|
|
113
|
+
export declare function invalidatePageBrowserGraphSession(appConfig: EcoPagesAppConfig, filePath: string): void;
|
|
114
114
|
/**
|
|
115
115
|
* Returns graph identities affected by a source file change.
|
|
116
116
|
*/
|
|
@@ -474,7 +474,7 @@ export function getAppPageBrowserGraphSession(appConfig) {
|
|
|
474
474
|
* Invalidates graph records that depend on the changed file path.
|
|
475
475
|
*/
|
|
476
476
|
export function invalidatePageBrowserGraphSession(appConfig, filePath) {
|
|
477
|
-
|
|
477
|
+
getAppPageBrowserGraphSession(appConfig).invalidateByFilePath(filePath);
|
|
478
478
|
}
|
|
479
479
|
/**
|
|
480
480
|
* Returns graph identities affected by a source file change.
|
package/src/services/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Typical responsibilities include:
|
|
|
22
22
|
- `invalidation/`: file-change classification and invalidation policy
|
|
23
23
|
- `runtime-state/`: app-owned invalidation state and dependency graphs
|
|
24
24
|
- `runtime-manifest/`: node runtime manifest derivation and persistence
|
|
25
|
-
- `html/`: final HTML dependency injection and rewriter
|
|
25
|
+
- `html/`: final HTML dependency injection and attribute stamping through `HtmlRewriter`, an in-house streaming rewriter with a subset of Bun's `HTMLRewriter` API that matches lol-html output (tag-name selectors; `before`/`prepend`/`append`/`after`; attributes). It runs the same way on Bun and Node, and `html-rewriter.parity.test.bun.ts` checks it against the native rewriter.
|
|
26
26
|
- `error-pages/`: shared semantic 404/500 source precedence, rendering, built-in documents, and static export artifacts
|
|
27
27
|
|
|
28
28
|
The asset-processing service caches emitted file assets by source identity in development as well as production.
|
|
@@ -22,7 +22,6 @@ import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
|
22
22
|
export type BrowserBundleOptions = {
|
|
23
23
|
entrypoints: string[] | Record<string, string>;
|
|
24
24
|
outdir?: string;
|
|
25
|
-
outbase?: string;
|
|
26
25
|
naming?: string;
|
|
27
26
|
conditions?: string[];
|
|
28
27
|
define?: Record<string, string>;
|
|
@@ -30,7 +29,6 @@ export type BrowserBundleOptions = {
|
|
|
30
29
|
treeshaking?: boolean;
|
|
31
30
|
splitting?: boolean;
|
|
32
31
|
root?: string;
|
|
33
|
-
bundle?: boolean;
|
|
34
32
|
externalPackages?: boolean;
|
|
35
33
|
external?: string[];
|
|
36
34
|
plugins?: EcoBuildPlugin[];
|
|
@@ -39,9 +37,6 @@ export type BrowserBundleOptions = {
|
|
|
39
37
|
excludeAppBuildPlugins?: string[];
|
|
40
38
|
};
|
|
41
39
|
type BrowserBundleGroupedOptions = Omit<BrowserBundleOptions, 'entrypoints'>;
|
|
42
|
-
export interface BrowserBundleExecutor {
|
|
43
|
-
bundle(options: BrowserBundleOptions): Promise<BuildResult>;
|
|
44
|
-
}
|
|
45
40
|
export type BrowserBundleGroupedEntry = {
|
|
46
41
|
entrypoint: string;
|
|
47
42
|
entryName: string;
|
|
@@ -54,7 +49,7 @@ export type BrowserBundleGroupedEntry = {
|
|
|
54
49
|
* the app-owned executor rather than direct backend calls. Assembles a complete
|
|
55
50
|
* request via {@link createBrowserBuildRequest} before scheduling.
|
|
56
51
|
*/
|
|
57
|
-
export declare class BrowserBundleService
|
|
52
|
+
export declare class BrowserBundleService {
|
|
58
53
|
private readonly appConfig;
|
|
59
54
|
constructor(appConfig: EcoPagesAppConfig);
|
|
60
55
|
/**
|