@ecopages/core 0.5.0 → 0.6.1
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 +18 -14
- package/package.json +13 -4
- package/src/adapters/create-app.js +9 -5
- package/src/adapters/node/create-app.d.ts +18 -16
- package/src/adapters/node/create-app.js +26 -30
- package/src/adapters/node/server-adapter.d.ts +26 -9
- package/src/adapters/node/server-adapter.js +38 -8
- package/src/adapters/shared/hmr/hmr-manager.js +3 -2
- package/src/adapters/shared/http/dist-file-handler.js +25 -7
- package/src/adapters/shared/runtime/render-context.d.ts +2 -1
- package/src/adapters/shared/runtime/render-context.js +18 -21
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +4 -3
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +6 -4
- package/src/adapters/shared/runtime/server-request-pipeline.d.ts +6 -1
- package/src/adapters/shared/runtime/server-request-pipeline.js +10 -10
- package/src/adapters/shared/runtime/server-static-builder.d.ts +11 -11
- package/src/adapters/shared/runtime/server-static-builder.js +37 -18
- package/src/assets/app-browser-client-manifest.d.ts +1 -3
- package/src/assets/app-browser-client-manifest.js +5 -58
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +2 -2
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +2 -2
- package/src/assets/browser-asset-output.d.ts +1 -1
- package/src/assets/browser-asset-output.js +1 -1
- package/src/build/app-build-manifest-runtime.d.ts +11 -1
- package/src/build/app-build-manifest-runtime.js +17 -3
- package/src/build/cache/pages-unified-graph-build.d.ts +32 -35
- package/src/build/cache/pages-unified-graph-build.js +206 -124
- package/src/build/cache/server-module-entries.d.ts +35 -0
- package/src/build/cache/server-module-entries.js +109 -0
- package/src/build/contracts/build-contracts.d.ts +5 -0
- package/src/build/copy-server-files.d.ts +10 -0
- package/src/build/copy-server-files.js +37 -0
- package/src/build/preserve-import-meta-transform.d.ts +1 -1
- package/src/build/preserve-import-meta-transform.js +1 -1
- package/src/build/production-build-id.d.ts +9 -0
- package/src/build/production-build-id.js +19 -0
- package/src/build/production-dist-complete.d.ts +5 -0
- package/src/build/production-dist-complete.js +101 -0
- package/src/build/production-route-list.d.ts +26 -0
- package/src/build/production-route-list.js +78 -0
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +2 -2
- package/src/build/rolldown/rolldown-adapter-helpers.js +56 -4
- package/src/build/rolldown/rolldown-build-adapter.js +1 -1
- package/src/build/runtime/build-request-identity.js +2 -1
- package/src/build/runtime/build-request-policy.d.ts +3 -2
- package/src/build/runtime/build-request-policy.js +5 -3
- package/src/build/server/import-view-module.d.ts +11 -0
- package/src/build/server/import-view-module.js +21 -0
- package/src/build/server/imported-view-plugin.d.ts +16 -0
- package/src/build/server/imported-view-plugin.js +59 -0
- package/src/build/server/page-module-import.service.d.ts +19 -20
- package/src/build/server/page-module-import.service.js +65 -36
- package/src/build/server/resolve-static-view.d.ts +9 -0
- package/src/build/server/resolve-static-view.js +28 -0
- package/src/build/server/route-module-build-cache-registry.d.ts +5 -3
- package/src/build/server/route-module-build-cache-registry.js +5 -3
- package/src/build/server/server-modules-manifest.d.ts +51 -0
- package/src/build/server/server-modules-manifest.js +129 -0
- package/src/build/server/view-reference.d.ts +38 -0
- package/src/build/server/view-reference.js +112 -0
- package/src/build/server-bundle-deploy-manifest.d.ts +9 -9
- package/src/build/server-bundle-deploy-manifest.js +24 -28
- package/src/build.d.ts +3 -1
- package/src/build.js +3 -1
- package/src/config/assembly/app-runtime.d.ts +15 -2
- package/src/config/assembly/app-runtime.js +3 -1
- package/src/config/assembly/finalize-config.js +64 -13
- package/src/config/index.d.ts +1 -0
- package/src/config/index.js +1 -0
- package/src/config/internal-types.d.ts +6 -0
- package/src/config/load-eco-config.d.ts +1 -0
- package/src/config/load-eco-config.js +11 -2
- package/src/config/resolve-eco-config-path.d.ts +2 -1
- package/src/config/resolve-eco-config-path.js +21 -15
- package/src/config/user-config-types.d.ts +9 -2
- package/src/html-pages/html-page-module.d.ts +19 -0
- package/src/html-pages/html-page-module.js +66 -13
- package/src/html-pages/html-page-renderer.d.ts +4 -0
- package/src/html-pages/html-page-renderer.js +9 -3
- package/src/html-pages/html-pages.plugin.d.ts +10 -0
- package/src/html-pages/html-pages.plugin.js +7 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/integration.d.ts +2 -1
- package/src/integration.js +1 -0
- package/src/page-cache/page-cache-service.d.ts +8 -0
- package/src/page-cache/page-cache-service.js +12 -0
- package/src/plugins/integration-plugin.d.ts +33 -6
- package/src/plugins/integration-plugin.js +14 -2
- package/src/plugins/processor.d.ts +17 -0
- package/src/plugins/processor.js +20 -1
- package/src/plugins/server-dom.d.ts +29 -0
- package/src/plugins/server-dom.js +36 -0
- package/src/route-renderer/error-pages/error-page-renderer.d.ts +6 -4
- package/src/route-renderer/error-pages/error-page-renderer.js +9 -5
- package/src/route-renderer/orchestration/integration-renderer.d.ts +1 -0
- package/src/route-renderer/orchestration/integration-renderer.js +17 -2
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +21 -0
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +31 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +58 -24
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +12 -0
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +55 -0
- package/src/router/client/navigation-commit.js +16 -2
- package/src/router/client/navigation-head-order.fixture.css +3 -0
- package/src/router/client/navigation-head.d.ts +2 -1
- package/src/router/client/navigation-head.fixture.css +3 -0
- package/src/router/client/navigation-head.js +222 -39
- package/src/router/server/route-registry.d.ts +22 -2
- package/src/router/server/route-registry.js +39 -15
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +8 -2
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +14 -9
- package/src/static-site-generator/static-site-generator.d.ts +19 -3
- package/src/static-site-generator/static-site-generator.js +78 -40
- package/src/types/contracts.d.ts +20 -31
- package/src/types/public-types.d.ts +1 -0
- package/src/types/view-reference.d.ts +31 -0
- package/src/types/view-reference.js +15 -0
- package/src/utils/additional-watch-paths.d.ts +3 -3
- package/src/utils/additional-watch-paths.js +3 -1
- package/src/utils/resolve-entry-file.d.ts +4 -2
- package/src/utils/resolve-entry-file.js +4 -2
- package/src/utils/root-relative-path.d.ts +4 -0
- package/src/utils/root-relative-path.js +8 -0
- package/src/utils/server-bundle-context.d.ts +14 -0
- package/src/utils/server-bundle-context.js +45 -0
- package/src/watchers/project-watcher-ignore.d.ts +2 -5
- package/src/watchers/project-watcher-ignore.js +2 -5
- package/src/watchers/project-watcher.d.ts +9 -7
- package/src/watchers/project-watcher.js +100 -52
- package/src/watchers/workspace-package-watch-roots.d.ts +4 -4
- package/src/watchers/workspace-package-watch-roots.js +41 -25
- package/src/build/server/view-module-loader.d.ts +0 -10
- package/src/build/server/view-module-loader.js +0 -46
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { finalizeEcoPagesConfig } from './assembly/finalize-config.js';
|
|
4
|
-
import { resolveEcoConfigPath } from './resolve-eco-config-path.js';
|
|
4
|
+
import { resolveEcoConfigPath, resolveEcoConfigPathFromServerBundle } from './resolve-eco-config-path.js';
|
|
5
|
+
import { getProductionServerBundleDir } from '../utils/server-bundle-context.js';
|
|
5
6
|
const moduleLoadCache = new Map();
|
|
6
7
|
function resolveLoaderCwd(cwd) {
|
|
7
8
|
return path.resolve(cwd ?? process.cwd());
|
|
@@ -64,8 +65,16 @@ export async function loadEcoPagesUserConfig(options = {}) {
|
|
|
64
65
|
* state belongs to each caller.
|
|
65
66
|
*/
|
|
66
67
|
export async function loadEcoPagesConfig(options = {}) {
|
|
68
|
+
return await loadEcoPagesConfigWithBundleDir(options, getProductionServerBundleDir());
|
|
69
|
+
}
|
|
70
|
+
export async function loadEcoPagesConfigFromServerBundle(options, serverBundleDir) {
|
|
71
|
+
return await loadEcoPagesConfigWithBundleDir(options, serverBundleDir);
|
|
72
|
+
}
|
|
73
|
+
async function loadEcoPagesConfigWithBundleDir(options, serverBundleDir) {
|
|
67
74
|
const cwd = resolveLoaderCwd(options.cwd);
|
|
68
|
-
const configFilePath =
|
|
75
|
+
const configFilePath = serverBundleDir
|
|
76
|
+
? resolveEcoConfigPathFromServerBundle({ ...options, cwd }, serverBundleDir)
|
|
77
|
+
: resolveEcoConfigPath({ ...options, cwd });
|
|
69
78
|
const exported = await loadConfigModule(configFilePath);
|
|
70
79
|
const userConfig = materializeUserConfig(exported, configFilePath);
|
|
71
80
|
return await finalizeEcoPagesConfig(userConfig, { configFilePath, cwd });
|
|
@@ -5,7 +5,7 @@ export declare const ECOPAGES_CONFIG_FILE_ENV = "ECOPAGES_CONFIG_FILE";
|
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* Defaults to `cwd` so source configs, in-memory `createApp({ userConfig })`,
|
|
8
|
-
* and production loads of `dist
|
|
8
|
+
* and production loads of `dist/server/eco.config.mjs` share one rule.
|
|
9
9
|
* `path.resolve` keeps an explicit absolute `rootDir` unchanged.
|
|
10
10
|
*/
|
|
11
11
|
export declare function resolveUserConfigRootDir(rootDir?: string, cwd?: string): string;
|
|
@@ -36,3 +36,4 @@ export declare function resolveEcoConfigPath(options: ResolveEcoConfigPathOption
|
|
|
36
36
|
required: false;
|
|
37
37
|
}): string | undefined;
|
|
38
38
|
export declare function resolveEcoConfigPath(options?: ResolveEcoConfigPathOptions): string;
|
|
39
|
+
export declare function resolveEcoConfigPathFromServerBundle(options: ResolveEcoConfigPathOptions, serverBundleDir: string): string;
|
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { getEcopagesEnv } from '../env.js';
|
|
3
3
|
import { fileSystem } from '@ecopages/file-system';
|
|
4
4
|
import { SERVER_BUNDLE_DIR } from '../utils/resolve-entry-file.js';
|
|
5
|
+
import { getProductionServerBundleDir } from '../utils/server-bundle-context.js';
|
|
5
6
|
import { EMITTED_ECO_CONFIG_FILENAME } from './server-config-bundle.js';
|
|
6
7
|
export const DEFAULT_ECO_CONFIG_FILENAME = 'eco.config.ts';
|
|
7
8
|
export const ECOPAGES_CONFIG_FILE_ENV = 'ECOPAGES_CONFIG_FILE';
|
|
@@ -10,7 +11,7 @@ export const ECOPAGES_CONFIG_FILE_ENV = 'ECOPAGES_CONFIG_FILE';
|
|
|
10
11
|
*
|
|
11
12
|
* @remarks
|
|
12
13
|
* Defaults to `cwd` so source configs, in-memory `createApp({ userConfig })`,
|
|
13
|
-
* and production loads of `dist
|
|
14
|
+
* and production loads of `dist/server/eco.config.mjs` share one rule.
|
|
14
15
|
* `path.resolve` keeps an explicit absolute `rootDir` unchanged.
|
|
15
16
|
*/
|
|
16
17
|
export function resolveUserConfigRootDir(rootDir, cwd = process.cwd()) {
|
|
@@ -22,26 +23,31 @@ export function resolveEmittedEcoConfigPath(cwd, distDir) {
|
|
|
22
23
|
return fileSystem.exists(candidate) ? candidate : undefined;
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
|
-
* Returns the emitted config next to the running
|
|
26
|
-
* server bundle, such as `node dist/.server/app.mjs` or `bun dist/.server/app.mjs`.
|
|
26
|
+
* Returns the emitted config next to the running server bundle.
|
|
27
27
|
*
|
|
28
28
|
* @remarks
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* The generated loader records its own directory before dynamically importing the
|
|
30
|
+
* application bundle. The application may be launched by a wrapper, so `process.argv[1]`
|
|
31
|
+
* does not reliably identify the server bundle. `ecopages dev` has no loader context and
|
|
32
|
+
* keeps using `eco.config.ts`.
|
|
33
33
|
*/
|
|
34
|
-
function resolveRunningServerBundleConfigPath() {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
34
|
+
function resolveRunningServerBundleConfigPath(serverBundleDir) {
|
|
35
|
+
const resolvedServerBundleDir = serverBundleDir ?? getProductionServerBundleDir();
|
|
36
|
+
if (!resolvedServerBundleDir)
|
|
37
37
|
return undefined;
|
|
38
|
-
const
|
|
39
|
-
if (path.basename(entryDir) !== SERVER_BUNDLE_DIR)
|
|
40
|
-
return undefined;
|
|
41
|
-
const candidate = path.join(entryDir, EMITTED_ECO_CONFIG_FILENAME);
|
|
38
|
+
const candidate = path.join(resolvedServerBundleDir, EMITTED_ECO_CONFIG_FILENAME);
|
|
42
39
|
return fileSystem.exists(candidate) ? candidate : undefined;
|
|
43
40
|
}
|
|
44
41
|
export function resolveEcoConfigPath(options = {}) {
|
|
42
|
+
return resolveEcoConfigPathWithServerBundleDir(options, getProductionServerBundleDir());
|
|
43
|
+
}
|
|
44
|
+
export function resolveEcoConfigPathFromServerBundle(options, serverBundleDir) {
|
|
45
|
+
const resolvedPath = resolveEcoConfigPathWithServerBundleDir(options, serverBundleDir);
|
|
46
|
+
if (!resolvedPath)
|
|
47
|
+
throw new Error('Ecopages config path was unexpectedly unresolved.');
|
|
48
|
+
return resolvedPath;
|
|
49
|
+
}
|
|
50
|
+
function resolveEcoConfigPathWithServerBundleDir(options, serverBundleDir) {
|
|
45
51
|
const cwd = options.cwd ?? process.cwd();
|
|
46
52
|
const required = options.required ?? true;
|
|
47
53
|
const explicitPath = options.configFile || getEcopagesEnv(ECOPAGES_CONFIG_FILE_ENV);
|
|
@@ -52,7 +58,7 @@ export function resolveEcoConfigPath(options = {}) {
|
|
|
52
58
|
}
|
|
53
59
|
return resolved;
|
|
54
60
|
}
|
|
55
|
-
const serverBundleConfigPath = resolveRunningServerBundleConfigPath();
|
|
61
|
+
const serverBundleConfigPath = resolveRunningServerBundleConfigPath(serverBundleDir);
|
|
56
62
|
if (serverBundleConfigPath)
|
|
57
63
|
return serverBundleConfigPath;
|
|
58
64
|
const defaultPath = path.resolve(cwd, DEFAULT_ECO_CONFIG_FILENAME);
|
|
@@ -42,7 +42,7 @@ export type EcoPagesUserConfig = {
|
|
|
42
42
|
*/
|
|
43
43
|
srcDir?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Directory for static public assets copied
|
|
45
|
+
* Directory for static public assets copied into `<distDir>/client`, relative to `rootDir`.
|
|
46
46
|
*
|
|
47
47
|
* @default 'public'
|
|
48
48
|
*/
|
|
@@ -66,7 +66,7 @@ export type EcoPagesUserConfig = {
|
|
|
66
66
|
*/
|
|
67
67
|
layoutsDir?: string;
|
|
68
68
|
/**
|
|
69
|
-
* Output
|
|
69
|
+
* Output root for the production build, relative to `rootDir`. Public files are written to `client/` and private server output to `server/` beneath it.
|
|
70
70
|
*
|
|
71
71
|
* @default 'dist'
|
|
72
72
|
*/
|
|
@@ -97,6 +97,13 @@ export type EcoPagesUserConfig = {
|
|
|
97
97
|
* Additional file or directory paths to watch during development.
|
|
98
98
|
*/
|
|
99
99
|
additionalWatchPaths?: string[];
|
|
100
|
+
/**
|
|
101
|
+
* Globs, relative to `rootDir`, of files copied into `dist/server/` by
|
|
102
|
+
* basename so production code can read them next to `import.meta`. Two
|
|
103
|
+
* matches that share a basename fail the build. Prefer `public/` for static
|
|
104
|
+
* files the browser should fetch.
|
|
105
|
+
*/
|
|
106
|
+
serverFiles?: string[];
|
|
100
107
|
/**
|
|
101
108
|
* URL route paths to prewarm in the background when the development server starts.
|
|
102
109
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComponentIdentity } from '../eco/component-identity.js';
|
|
1
2
|
import type { EcoPagesAppConfig } from '../config/internal-types.js';
|
|
2
3
|
import type { EcoComponent, EcoPageFile } from '../types/contracts.js';
|
|
3
4
|
import { type HtmlTemplate } from './html-page-template.js';
|
|
@@ -15,6 +16,10 @@ export declare function warnHtmlTemplateRender(appConfig: EcoPagesAppConfig, fil
|
|
|
15
16
|
* Returns the compiled template behind an HTML Page or Html shell component.
|
|
16
17
|
*/
|
|
17
18
|
export declare function getCompiledHtmlTemplate(component: unknown): HtmlTemplate | undefined;
|
|
19
|
+
export type SerializedHtmlPageModule = {
|
|
20
|
+
template: HtmlTemplate;
|
|
21
|
+
identity?: ComponentIdentity;
|
|
22
|
+
};
|
|
18
23
|
/**
|
|
19
24
|
* Builds the module for one HTML Page or the `html.html` shell.
|
|
20
25
|
*
|
|
@@ -26,6 +31,20 @@ export declare function getCompiledHtmlTemplate(component: unknown): HtmlTemplat
|
|
|
26
31
|
* one invalidates the cached HTML of every route the template renders into.
|
|
27
32
|
*/
|
|
28
33
|
export declare function loadHtmlPageModule(appConfig: EcoPagesAppConfig, filePath: string): EcoPageFile;
|
|
34
|
+
/**
|
|
35
|
+
* Records a compiled HTML Page or Html shell so production can import it without compiling.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* File paths are stored relative to `rootDir` so the emitted module has no
|
|
39
|
+
* absolute paths of the build machine.
|
|
40
|
+
*/
|
|
41
|
+
export declare function serializeHtmlPageModule(module: EcoPageFile, rootDir: string): SerializedHtmlPageModule;
|
|
42
|
+
/**
|
|
43
|
+
* Restores a compiled HTML Page or Html shell from {@link serializeHtmlPageModule}.
|
|
44
|
+
*
|
|
45
|
+
* @param rootDir - App root used to resolve stored relative file paths.
|
|
46
|
+
*/
|
|
47
|
+
export declare function reviveHtmlPageModule(data: SerializedHtmlPageModule, rootDir?: string): EcoPageFile;
|
|
29
48
|
/**
|
|
30
49
|
* Returns the Html shell HTML Pages use when the app has no `src/includes/html.*`.
|
|
31
50
|
*/
|
|
@@ -4,6 +4,7 @@ import { registerDiscoveredDependencies } from '../eco/discovered-dependencies.j
|
|
|
4
4
|
import { appLogger } from '../global/app-logger.js';
|
|
5
5
|
import { requireAppRuntime } from '../utils/app-runtime.js';
|
|
6
6
|
import { contentHash } from '../utils/content-hash.js';
|
|
7
|
+
import { toRootRelativePath } from '../utils/root-relative-path.js';
|
|
7
8
|
import { isDevelopmentRuntime } from '../utils/runtime.js';
|
|
8
9
|
import { compileHtmlPage, compileHtmlShell, getHtmlTemplateWatchFiles, } from './html-page-template.js';
|
|
9
10
|
export const HTML_PAGES_INTEGRATION_NAME = 'html-pages';
|
|
@@ -60,6 +61,24 @@ function createTemplateComponent(template, identity) {
|
|
|
60
61
|
[HTML_TEMPLATE]: template,
|
|
61
62
|
});
|
|
62
63
|
}
|
|
64
|
+
function assembleHtmlPageFile(template, identity) {
|
|
65
|
+
const component = createTemplateComponent(template, identity);
|
|
66
|
+
if (identity) {
|
|
67
|
+
registerDiscoveredDependencies(identity, {
|
|
68
|
+
components: () => [],
|
|
69
|
+
stylesheets: [],
|
|
70
|
+
watchFiles: getHtmlTemplateWatchFiles(template),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (template.kind === 'page') {
|
|
74
|
+
const metadata = ({ appConfig: { defaultMetadata } }) => ({
|
|
75
|
+
...defaultMetadata,
|
|
76
|
+
...template.metadata,
|
|
77
|
+
});
|
|
78
|
+
component.metadata = metadata;
|
|
79
|
+
}
|
|
80
|
+
return { default: component };
|
|
81
|
+
}
|
|
63
82
|
/**
|
|
64
83
|
* Builds the module for one HTML Page or the `html.html` shell.
|
|
65
84
|
*
|
|
@@ -89,20 +108,54 @@ export function loadHtmlPageModule(appConfig, filePath) {
|
|
|
89
108
|
file,
|
|
90
109
|
integration: HTML_PAGES_INTEGRATION_NAME,
|
|
91
110
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
return assembleHtmlPageFile(template, identity);
|
|
112
|
+
}
|
|
113
|
+
function relativizeHtmlFilePath(rootDir, filePath) {
|
|
114
|
+
return path.isAbsolute(filePath) ? toRootRelativePath(rootDir, filePath) : filePath;
|
|
115
|
+
}
|
|
116
|
+
function relativizeHtmlTemplate(rootDir, template) {
|
|
117
|
+
const relativize = (filePath) => relativizeHtmlFilePath(rootDir, filePath);
|
|
118
|
+
const assets = template.assets.map((asset) => 'filepath' in asset ? { ...asset, filepath: relativize(asset.filepath) } : asset);
|
|
119
|
+
return { ...template, file: relativize(template.file), assets };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Records a compiled HTML Page or Html shell so production can import it without compiling.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* File paths are stored relative to `rootDir` so the emitted module has no
|
|
126
|
+
* absolute paths of the build machine.
|
|
127
|
+
*/
|
|
128
|
+
export function serializeHtmlPageModule(module, rootDir) {
|
|
129
|
+
const component = module.default;
|
|
130
|
+
const template = component[HTML_TEMPLATE];
|
|
131
|
+
if (!template) {
|
|
132
|
+
throw new Error('[ecopages] Cannot serialize an HTML Page module that has no compiled template.');
|
|
104
133
|
}
|
|
105
|
-
|
|
134
|
+
const identity = component.config?.identity;
|
|
135
|
+
return {
|
|
136
|
+
template: relativizeHtmlTemplate(rootDir, template),
|
|
137
|
+
identity: identity?.file ? { ...identity, file: relativizeHtmlFilePath(rootDir, identity.file) } : identity,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function resolveHtmlFilePath(rootDir, filePath) {
|
|
141
|
+
return path.isAbsolute(filePath) ? filePath : path.join(rootDir, filePath);
|
|
142
|
+
}
|
|
143
|
+
function resolveHtmlTemplate(rootDir, template) {
|
|
144
|
+
const resolve = (filePath) => resolveHtmlFilePath(rootDir, filePath);
|
|
145
|
+
const assets = template.assets.map((asset) => 'filepath' in asset ? { ...asset, filepath: resolve(asset.filepath) } : asset);
|
|
146
|
+
return { ...template, file: resolve(template.file), assets };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Restores a compiled HTML Page or Html shell from {@link serializeHtmlPageModule}.
|
|
150
|
+
*
|
|
151
|
+
* @param rootDir - App root used to resolve stored relative file paths.
|
|
152
|
+
*/
|
|
153
|
+
export function reviveHtmlPageModule(data, rootDir) {
|
|
154
|
+
const template = rootDir ? resolveHtmlTemplate(rootDir, data.template) : data.template;
|
|
155
|
+
const identity = rootDir && data.identity?.file
|
|
156
|
+
? { ...data.identity, file: resolveHtmlFilePath(rootDir, data.identity.file) }
|
|
157
|
+
: data.identity;
|
|
158
|
+
return assembleHtmlPageFile(template, identity);
|
|
106
159
|
}
|
|
107
160
|
/**
|
|
108
161
|
* Returns the Html shell HTML Pages use when the app has no `src/includes/html.*`.
|
|
@@ -19,6 +19,10 @@ export declare class HtmlPageRenderer extends StringMarkupRenderer {
|
|
|
19
19
|
name: string;
|
|
20
20
|
private readonly renderedHeads;
|
|
21
21
|
constructor(options: IntegrationRendererOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Loads the Html shell from disk, or from the production server-modules map
|
|
24
|
+
* when the source file is not in the deploy.
|
|
25
|
+
*/
|
|
22
26
|
protected getHtmlTemplate(): Promise<EcoComponent<HtmlTemplateProps>>;
|
|
23
27
|
/**
|
|
24
28
|
* Renders the `html.html` shell, including when a Page owned by another
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
3
|
import { AssetFactory } from '../assets/asset-processing-service/asset.factory.js';
|
|
4
|
+
import { hasProductionServerModule } from '../build/server/server-modules-manifest.js';
|
|
4
5
|
import { StringMarkupRenderer } from '../route-renderer/orchestration/string-markup-renderer.js';
|
|
5
6
|
import { findElements, parseHtml } from '../html/html-source-parser.js';
|
|
6
7
|
import { escapeHtmlAttribute } from '../utils/html-escaping.js';
|
|
@@ -62,12 +63,17 @@ export class HtmlPageRenderer extends StringMarkupRenderer {
|
|
|
62
63
|
finalizeDocument: (body, renderOptions) => this.finalizeHtmlPageDocument(body, renderOptions),
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Loads the Html shell from disk, or from the production server-modules map
|
|
68
|
+
* when the source file is not in the deploy.
|
|
69
|
+
*/
|
|
65
70
|
async getHtmlTemplate() {
|
|
66
71
|
const htmlTemplatePath = this.appConfig.absolutePaths.htmlTemplatePath;
|
|
67
|
-
if (
|
|
68
|
-
|
|
72
|
+
if (htmlTemplatePath &&
|
|
73
|
+
(fileSystem.exists(htmlTemplatePath) || hasProductionServerModule(this.appConfig, htmlTemplatePath))) {
|
|
74
|
+
return super.getHtmlTemplate();
|
|
69
75
|
}
|
|
70
|
-
return
|
|
76
|
+
return getBuiltInHtmlShell();
|
|
71
77
|
}
|
|
72
78
|
/**
|
|
73
79
|
* Renders the `html.html` shell, including when a Page owned by another
|
|
@@ -20,4 +20,14 @@ export declare class HtmlPagesPlugin extends IntegrationPlugin {
|
|
|
20
20
|
* @throws For any other `.html` file, which is neither a Page nor the HTML template.
|
|
21
21
|
*/
|
|
22
22
|
compilePageModule(filePath: string, appConfig: EcoPagesAppConfig): EcoPageFile;
|
|
23
|
+
serializeCompiledPageModule(module: EcoPageFile, context: {
|
|
24
|
+
rootDir: string;
|
|
25
|
+
filePath: string;
|
|
26
|
+
}): {
|
|
27
|
+
contents: string;
|
|
28
|
+
};
|
|
29
|
+
reviveCompiledPageModule(contents: string, context: {
|
|
30
|
+
rootDir: string;
|
|
31
|
+
filePath: string;
|
|
32
|
+
}): EcoPageFile;
|
|
23
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { IntegrationPlugin } from '../plugins/integration-plugin.js';
|
|
3
|
-
import { HTML_PAGES_INTEGRATION_NAME, loadHtmlPageModule } from './html-page-module.js';
|
|
3
|
+
import { HTML_PAGES_INTEGRATION_NAME, loadHtmlPageModule, reviveHtmlPageModule, serializeHtmlPageModule, } from './html-page-module.js';
|
|
4
4
|
import { HtmlPageRenderer } from './html-page-renderer.js';
|
|
5
5
|
/**
|
|
6
6
|
* Core-owned Integration for `.html` Filesystem Routes.
|
|
@@ -29,4 +29,10 @@ export class HtmlPagesPlugin extends IntegrationPlugin {
|
|
|
29
29
|
}
|
|
30
30
|
return loadHtmlPageModule(appConfig, file);
|
|
31
31
|
}
|
|
32
|
+
serializeCompiledPageModule(module, context) {
|
|
33
|
+
return { contents: `${JSON.stringify(serializeHtmlPageModule(module, context.rootDir))}\n` };
|
|
34
|
+
}
|
|
35
|
+
reviveCompiledPageModule(contents, context) {
|
|
36
|
+
return reviveHtmlPageModule(JSON.parse(contents), context.rootDir);
|
|
37
|
+
}
|
|
32
38
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type * from './types/public-types.js';
|
|
2
2
|
export { eco } from './eco/eco.js';
|
|
3
3
|
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, defineQuery, json, html, redirect, type GroupHandler, } from './adapters/shared/http/define-api-handler.js';
|
|
4
|
+
export { createViewReference } from './build/server/view-reference.js';
|
|
5
|
+
export { VIEW_REFERENCE, isViewReference } from './types/view-reference.js';
|
|
4
6
|
export { attributeMdxComponentIdentity } from './plugins/eco-component-meta-plugin.js';
|
|
5
7
|
export { bindComponentIdentity, getComponentIdentity, getComponentOwner, type ComponentIdentity, } from './eco/component-identity.js';
|
|
6
8
|
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { eco } from './eco/eco.js';
|
|
2
2
|
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, defineQuery, json, html, redirect, } from './adapters/shared/http/define-api-handler.js';
|
|
3
|
+
export { createViewReference } from './build/server/view-reference.js';
|
|
4
|
+
export { VIEW_REFERENCE, isViewReference } from './types/view-reference.js';
|
|
3
5
|
export { attributeMdxComponentIdentity } from './plugins/eco-component-meta-plugin.js';
|
|
4
6
|
export { bindComponentIdentity, getComponentIdentity, getComponentOwner, } from './eco/component-identity.js';
|
|
5
7
|
export { attachDiscoveredDependencies } from './eco/discovered-dependencies.js';
|
package/src/integration.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export { isRegisteredDevTransformEntrypoint, isRegisteredScriptEntrypoint } from
|
|
|
10
10
|
export { type HmrRegisteredEntrypointsContext } from './hmr/hmr-registered-entrypoints-context.js';
|
|
11
11
|
export { HmrStrategy, HmrStrategyType } from './hmr/hmr-strategy.js';
|
|
12
12
|
export { type DefinedIntegration, defineIntegration } from './plugins/define-integration.js';
|
|
13
|
-
export { type AnyIntegrationPlugin, type EcoBuildOnLoadArgs, type EcoBuildOnLoadResult, type EcoBuildImportKind, type EcoBuildOnResolveArgs, type EcoBuildOnResolveResult, type EcoBuildPlugin, type EcoBuildPluginBuilder, IntegrationPlugin, type IntegrationPluginConfig, type IntegrationRendererBase, type IntegrationRuntimeContext, mergeIntegrationOptions, type StaticExportContext, type StaticExportRelease, } from './plugins/integration-plugin.js';
|
|
13
|
+
export { type AnyIntegrationPlugin, type EcoBuildOnLoadArgs, type EcoBuildOnLoadResult, type EcoBuildImportKind, type EcoBuildOnResolveArgs, type EcoBuildOnResolveResult, type EcoBuildPlugin, type EcoBuildPluginBuilder, IntegrationPlugin, type IntegrationPluginConfig, type IntegrationRendererBase, type IntegrationRuntimeContext, mergeIntegrationOptions, type ServerDomInstaller, type ServerDomSurfaceKind, type StaticExportContext, type StaticExportRelease, } from './plugins/integration-plugin.js';
|
|
14
|
+
export { installConfiguredServerDom } from './plugins/server-dom.js';
|
|
14
15
|
export { CUSTOM_ELEMENT_SSR_PRELOAD_CACHE_SCOPES, CustomElementScriptPreloader, type CustomElementScriptPreloadScopeState, type CustomElementSsrPreloadComponent, invalidateCustomElementScriptPreload, } from './route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js';
|
|
15
16
|
export { createCustomElementServerModuleImporter, createSharedServerModuleImporter, } from './route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js';
|
|
16
17
|
export { createCustomElementSsrPipelineImporter } from './route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js';
|
package/src/integration.js
CHANGED
|
@@ -10,6 +10,7 @@ export {} from './hmr/hmr-registered-entrypoints-context.js';
|
|
|
10
10
|
export { HmrStrategy, HmrStrategyType } from './hmr/hmr-strategy.js';
|
|
11
11
|
export { defineIntegration } from './plugins/define-integration.js';
|
|
12
12
|
export { IntegrationPlugin, mergeIntegrationOptions, } from './plugins/integration-plugin.js';
|
|
13
|
+
export { installConfiguredServerDom } from './plugins/server-dom.js';
|
|
13
14
|
export { CUSTOM_ELEMENT_SSR_PRELOAD_CACHE_SCOPES, CustomElementScriptPreloader, invalidateCustomElementScriptPreload, } from './route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js';
|
|
14
15
|
export { createCustomElementServerModuleImporter, createSharedServerModuleImporter, } from './route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js';
|
|
15
16
|
export { createCustomElementSsrPipelineImporter } from './route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js';
|
|
@@ -46,6 +46,14 @@ export declare class PageCacheService {
|
|
|
46
46
|
* Uses promise deduplication to prevent multiple concurrent regenerations.
|
|
47
47
|
*/
|
|
48
48
|
private regenerateInBackground;
|
|
49
|
+
/**
|
|
50
|
+
* @remarks
|
|
51
|
+
* Shutdown awaits this before Integration teardown so a revalidating cache
|
|
52
|
+
* regeneration cannot render against a torn-down Integration. Regeneration
|
|
53
|
+
* failures are already logged and do not reject shutdown. The mutation gate
|
|
54
|
+
* still drops a write whose generation is older than a later invalidation.
|
|
55
|
+
*/
|
|
56
|
+
waitForInFlightRegenerations(): Promise<void>;
|
|
49
57
|
/**
|
|
50
58
|
* Invalidate cache entries by tags.
|
|
51
59
|
*/
|
|
@@ -278,6 +278,18 @@ export class PageCacheService {
|
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* @remarks
|
|
283
|
+
* Shutdown awaits this before Integration teardown so a revalidating cache
|
|
284
|
+
* regeneration cannot render against a torn-down Integration. Regeneration
|
|
285
|
+
* failures are already logged and do not reject shutdown. The mutation gate
|
|
286
|
+
* still drops a write whose generation is older than a later invalidation.
|
|
287
|
+
*/
|
|
288
|
+
async waitForInFlightRegenerations() {
|
|
289
|
+
while (this.regenerationPromises.size > 0) {
|
|
290
|
+
await Promise.allSettled([...this.regenerationPromises.values()]);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
281
293
|
/**
|
|
282
294
|
* Invalidate cache entries by tags.
|
|
283
295
|
*/
|
|
@@ -7,6 +7,8 @@ import type { IntegrationRenderer, IntegrationRendererOptions } from '../route-r
|
|
|
7
7
|
import { AssetProcessingService } from '../assets/asset-processing-service/asset-processing.service.js';
|
|
8
8
|
import type { AssetDefinition, ProcessedAsset } from '../assets/asset-processing-service/assets.types.js';
|
|
9
9
|
import type { StaticExportContext, StaticExportRelease } from '../static-site-generator/static-export-context.js';
|
|
10
|
+
import { type ServerDomInstaller } from './server-dom.js';
|
|
11
|
+
export type { ServerDomInstaller, ServerDomSurfaceKind } from './server-dom.js';
|
|
10
12
|
export type { EcoBuildLoader, EcoBuildOnLoadArgs, EcoBuildOnLoadResult, EcoBuildImportKind, EcoBuildOnResolveArgs, EcoBuildOnResolveResult, EcoBuildPlugin, EcoBuildPluginBuilder, } from '../build/contracts/build-types.js';
|
|
11
13
|
export type { PageBrowserGraphContribution, PageBrowserGraphContributionContext } from '../types/contracts.js';
|
|
12
14
|
export type { StaticExportContext, StaticExportRelease } from '../static-site-generator/static-export-context.js';
|
|
@@ -107,6 +109,15 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
107
109
|
readonly acceptsParams: boolean;
|
|
108
110
|
/** Whether core may collapse this Integration's eligible Page assets into page-owned bundles. */
|
|
109
111
|
readonly bundlesPageDependencies: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Server DOM installer this Integration contributes, if any.
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* Core runs every configured `complete` installer, then every `repair`, before
|
|
117
|
+
* Integration `setup()` continues. Config order does not change the result.
|
|
118
|
+
* Omit this when the Integration does not install DOM globals.
|
|
119
|
+
*/
|
|
120
|
+
readonly serverDom?: ServerDomInstaller;
|
|
110
121
|
protected integrationDependencies: AssetDefinition[];
|
|
111
122
|
protected resolvedIntegrationDependencies: ProcessedAsset[];
|
|
112
123
|
protected appConfig?: EcoPagesAppConfig;
|
|
@@ -142,12 +153,27 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
142
153
|
* calls it for every file of the Integration that it loads as a module, and never bundles
|
|
143
154
|
* those files itself.
|
|
144
155
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* not invalidate it.
|
|
156
|
+
* Production emit records the compiled module through {@link serializeCompiledPageModule}.
|
|
157
|
+
* Development caches the result by the file's content hash, so editing another file it
|
|
158
|
+
* reads does not invalidate it.
|
|
149
159
|
*/
|
|
150
160
|
compilePageModule?(filePath: string, appConfig: EcoPagesAppConfig): EcoPageFile | Promise<EcoPageFile>;
|
|
161
|
+
/**
|
|
162
|
+
* Records a {@link compilePageModule} result so production can import it without compiling.
|
|
163
|
+
*/
|
|
164
|
+
serializeCompiledPageModule?(module: EcoPageFile, context: {
|
|
165
|
+
rootDir: string;
|
|
166
|
+
filePath: string;
|
|
167
|
+
}): {
|
|
168
|
+
contents: string;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Restores a {@link serializeCompiledPageModule} record for production import.
|
|
172
|
+
*/
|
|
173
|
+
reviveCompiledPageModule?(contents: string, context: {
|
|
174
|
+
rootDir: string;
|
|
175
|
+
filePath: string;
|
|
176
|
+
}): EcoPageFile;
|
|
151
177
|
/**
|
|
152
178
|
* Returns processed global assets resolved during `setup()`.
|
|
153
179
|
*/
|
|
@@ -197,8 +223,9 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
197
223
|
*
|
|
198
224
|
* @remarks
|
|
199
225
|
* Core calls this after static-export releases and when the app stops or restarts,
|
|
200
|
-
* after in-flight `setup()` calls
|
|
201
|
-
*
|
|
226
|
+
* after in-flight `setup()` calls finish. On stop or restart it also waits for
|
|
227
|
+
* active prewarm renders and page-cache regenerations. It then clears activation
|
|
228
|
+
* state so the next runtime activation runs `setup()` again.
|
|
202
229
|
* Most integrations do not need custom teardown. Override this only for
|
|
203
230
|
* explicit cleanup such as watchers, compiler handles, or runtime registries
|
|
204
231
|
* that outlive individual requests.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createBrowserRuntimeManifest, } from '../build/browser/browser-runtime-manifest.js';
|
|
2
2
|
import { AssetProcessingService } from '../assets/asset-processing-service/asset-processing.service.js';
|
|
3
3
|
import { deepMerge } from '../utils/deep-merge.js';
|
|
4
|
+
import { installConfiguredServerDom } from './server-dom.js';
|
|
4
5
|
export const INTEGRATION_PLUGIN_ERRORS = {
|
|
5
6
|
NOT_INITIALIZED_WITH_APP_CONFIG: 'Plugin not initialized with app config',
|
|
6
7
|
};
|
|
@@ -42,6 +43,15 @@ export class IntegrationPlugin {
|
|
|
42
43
|
acceptsParams = true;
|
|
43
44
|
/** Whether core may collapse this Integration's eligible Page assets into page-owned bundles. */
|
|
44
45
|
bundlesPageDependencies = false;
|
|
46
|
+
/**
|
|
47
|
+
* Server DOM installer this Integration contributes, if any.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Core runs every configured `complete` installer, then every `repair`, before
|
|
51
|
+
* Integration `setup()` continues. Config order does not change the result.
|
|
52
|
+
* Omit this when the Integration does not install DOM globals.
|
|
53
|
+
*/
|
|
54
|
+
serverDom;
|
|
45
55
|
integrationDependencies;
|
|
46
56
|
resolvedIntegrationDependencies = [];
|
|
47
57
|
appConfig;
|
|
@@ -126,6 +136,7 @@ export class IntegrationPlugin {
|
|
|
126
136
|
* Performs runtime integration setup, after config finalization has sealed the build manifest.
|
|
127
137
|
*/
|
|
128
138
|
async setup(context) {
|
|
139
|
+
await installConfiguredServerDom(context.appConfig.integrations);
|
|
129
140
|
this.appConfig = context.appConfig;
|
|
130
141
|
this.runtime = context.runtime;
|
|
131
142
|
this.rendererInstance = undefined;
|
|
@@ -148,8 +159,9 @@ export class IntegrationPlugin {
|
|
|
148
159
|
*
|
|
149
160
|
* @remarks
|
|
150
161
|
* Core calls this after static-export releases and when the app stops or restarts,
|
|
151
|
-
* after in-flight `setup()` calls
|
|
152
|
-
*
|
|
162
|
+
* after in-flight `setup()` calls finish. On stop or restart it also waits for
|
|
163
|
+
* active prewarm renders and page-cache regenerations. It then clears activation
|
|
164
|
+
* state so the next runtime activation runs `setup()` again.
|
|
153
165
|
* Most integrations do not need custom teardown. Override this only for
|
|
154
166
|
* explicit cleanup such as watchers, compiler handles, or runtime registries
|
|
155
167
|
* that outlive individual requests.
|
|
@@ -86,6 +86,7 @@ export interface ProcessorContext {
|
|
|
86
86
|
config: EcoPagesAppConfig;
|
|
87
87
|
rootDir: string;
|
|
88
88
|
srcDir: string;
|
|
89
|
+
/** Public output directory (`client/` beneath the configured build output root). */
|
|
89
90
|
distDir: string;
|
|
90
91
|
cache?: string;
|
|
91
92
|
}
|
|
@@ -121,6 +122,22 @@ export declare abstract class Processor<TOptions = unknown> {
|
|
|
121
122
|
constructor(config: ProcessorConfig<TOptions>);
|
|
122
123
|
setContext(appConfig: EcoPagesAppConfig): void;
|
|
123
124
|
abstract setup(): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Source files this Processor needs in the production server-modules map.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* Core includes them in the unified graph after `setup()`. Production `ecopages start`
|
|
130
|
+
* imports the emitted modules and does not call `setup()`. Development never reads this list.
|
|
131
|
+
*/
|
|
132
|
+
listProductionServerModuleEntries(): string[];
|
|
133
|
+
/**
|
|
134
|
+
* Restores in-memory state from the production server-modules map.
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* Called instead of `setup()` on production `ecopages start`, and in the Lit static-render
|
|
138
|
+
* worker. Must not scan sources or write under the work directory.
|
|
139
|
+
*/
|
|
140
|
+
restoreProductionRuntime(): Promise<void>;
|
|
124
141
|
/**
|
|
125
142
|
* Transforms one stylesheet before core writes or inlines it.
|
|
126
143
|
*
|
package/src/plugins/processor.js
CHANGED
|
@@ -80,7 +80,6 @@ export class Processor {
|
|
|
80
80
|
root: workDir,
|
|
81
81
|
module: this.name,
|
|
82
82
|
});
|
|
83
|
-
fileSystem.ensureDir(cachePath);
|
|
84
83
|
this.context = {
|
|
85
84
|
config: appConfig,
|
|
86
85
|
rootDir: appConfig.rootDir,
|
|
@@ -89,6 +88,26 @@ export class Processor {
|
|
|
89
88
|
cache: cachePath,
|
|
90
89
|
};
|
|
91
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Source files this Processor needs in the production server-modules map.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Core includes them in the unified graph after `setup()`. Production `ecopages start`
|
|
96
|
+
* imports the emitted modules and does not call `setup()`. Development never reads this list.
|
|
97
|
+
*/
|
|
98
|
+
listProductionServerModuleEntries() {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Restores in-memory state from the production server-modules map.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* Called instead of `setup()` on production `ecopages start`, and in the Lit static-render
|
|
106
|
+
* worker. Must not scan sources or write under the work directory.
|
|
107
|
+
*/
|
|
108
|
+
restoreProductionRuntime() {
|
|
109
|
+
return Promise.resolve();
|
|
110
|
+
}
|
|
92
111
|
getCachePath(key) {
|
|
93
112
|
return `${this.context?.cache}/${key}`;
|
|
94
113
|
}
|