@ecopages/core 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +14 -4
- package/src/adapters/node/create-app.d.ts +5 -5
- package/src/adapters/node/create-app.js +1 -1
- package/src/adapters/node/server-adapter.d.ts +1 -0
- package/src/adapters/node/server-adapter.js +4 -1
- package/src/adapters/shared/hmr/hmr-manager.d.ts +2 -0
- package/src/adapters/shared/hmr/hmr-manager.js +8 -4
- package/src/adapters/shared/http/api-request-pipeline.d.ts +16 -3
- package/src/adapters/shared/http/api-request-pipeline.js +23 -16
- package/src/adapters/shared/http/define-api-handler.d.ts +8 -8
- package/src/adapters/shared/http/explicit-static-route-matcher.js +8 -4
- package/src/adapters/shared/http/file-route-middleware-pipeline.d.ts +10 -11
- package/src/adapters/shared/http/file-route-middleware-pipeline.js +5 -6
- package/src/adapters/shared/http/fs-server-response-matcher.js +12 -4
- package/src/adapters/shared/http/run-middleware-chain.d.ts +29 -2
- package/src/adapters/shared/http/run-middleware-chain.js +108 -10
- package/src/adapters/shared/runtime/render-context.d.ts +2 -0
- package/src/adapters/shared/runtime/render-context.js +6 -21
- package/src/adapters/shared/runtime/server-request-pipeline.d.ts +2 -2
- package/src/adapters/shared/runtime/server-request-pipeline.js +4 -3
- package/src/adapters/shared/runtime/server-static-builder.js +4 -1
- package/src/adapters/shared/runtime/unattached-scripts.d.ts +17 -0
- package/src/adapters/shared/runtime/unattached-scripts.js +57 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +3 -2
- package/src/adapters/shared/ws/ws-pattern-matcher.d.ts +14 -1
- package/src/adapters/shared/ws/ws-pattern-matcher.js +14 -13
- package/src/assets/app-browser-client-build.js +3 -0
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +9 -0
- package/src/assets/asset-processing-service/asset-processing.service.js +19 -0
- package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +16 -2
- package/src/assets/asset-processing-service/processed-asset-ledger.js +31 -3
- package/src/build/build-graph.d.ts +19 -2
- package/src/build/build-graph.js +19 -18
- package/src/build/cache/pages-unified-graph-build.d.ts +4 -6
- package/src/build/cache/pages-unified-graph-build.js +14 -51
- package/src/build/cache/server-module-entries.d.ts +5 -9
- package/src/build/cache/server-module-entries.js +5 -58
- package/src/build/contracts/build-contracts.d.ts +15 -0
- package/src/build/contracts.d.ts +1 -1
- package/src/build/contracts.js +1 -1
- package/src/build/production-asset-ledger.d.ts +1 -1
- package/src/build/production-asset-ledger.js +4 -2
- package/src/build/rolldown/file-role-grammar-plugin.d.ts +11 -0
- package/src/build/rolldown/file-role-grammar-plugin.js +32 -0
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +11 -0
- package/src/build/rolldown/rolldown-adapter-helpers.js +79 -10
- package/src/build/rolldown/ssr-script-entries-plugin.d.ts +31 -0
- package/src/build/rolldown/ssr-script-entries-plugin.js +104 -0
- package/src/build/runtime/build-request-policy.js +4 -1
- package/src/build/server/server-modules-manifest.d.ts +6 -1
- package/src/build/server/server-modules-manifest.js +10 -1
- package/src/build/server/view-reference.d.ts +9 -0
- package/src/build/server/view-reference.js +11 -0
- package/src/build.d.ts +3 -1
- package/src/build.js +3 -1
- package/src/cli.d.ts +14 -0
- package/src/cli.js +14 -0
- package/src/config/assembly/app-runtime.d.ts +13 -0
- package/src/config/assembly/app-runtime.js +2 -0
- package/src/config/assembly/finalize-config.js +13 -8
- package/src/config/internal-types.d.ts +0 -12
- package/src/config/resolve-eco-config-path.d.ts +2 -0
- package/src/config/resolve-eco-config-path.js +2 -1
- package/src/config/server-config-bundle.d.ts +0 -1
- package/src/config/server-config-bundle.js +1 -1
- package/src/config/user-config-types.d.ts +0 -12
- package/src/declarations.d.ts +2 -0
- package/src/dev/invalidation/development-invalidation.service.d.ts +0 -2
- package/src/dev/invalidation/development-invalidation.service.js +1 -11
- package/src/dev/transform-server/dev-transform-vendor-registry.js +33 -19
- package/src/eco/discovered-dependencies.d.ts +5 -0
- package/src/eco/discovered-dependencies.js +9 -0
- package/src/eco/eco.browser.js +6 -26
- package/src/eco/eco.js +24 -16
- package/src/eco/migration-docs.d.ts +7 -0
- package/src/eco/migration-docs.js +7 -0
- package/src/eco/page-data-hooks.d.ts +27 -0
- package/src/eco/page-data-hooks.js +64 -0
- package/src/eco/page-layout-normalization.d.ts +2 -2
- package/src/hmr/client/hmr-runtime.js +1 -1
- package/src/hmr/strategies/js-hmr-strategy.d.ts +0 -2
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +2 -1
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +4 -3
- package/src/html/html-rewriter.d.ts +9 -7
- package/src/html/html-rewriter.js +26 -41
- package/src/html/html-transformer.service.d.ts +2 -2
- package/src/html/html-transformer.service.js +21 -15
- package/src/html-pages/html-page-module-scripts.js +2 -1
- package/src/html-pages/html-pages.plugin.d.ts +1 -1
- package/src/html-pages/html-pages.plugin.js +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/integration.d.ts +2 -2
- package/src/integration.js +2 -2
- package/src/islands/island-host.d.ts +16 -5
- package/src/islands/island-host.js +8 -1
- package/src/middleware/create-middleware.d.ts +41 -0
- package/src/middleware/create-middleware.js +72 -0
- package/src/plugins/component-import-discovery.d.ts +14 -1
- package/src/plugins/component-import-discovery.js +36 -16
- package/src/plugins/eco-component-meta-plugin.d.ts +38 -0
- package/src/plugins/eco-component-meta-plugin.js +208 -44
- package/src/plugins/ecopages-virtual-imports.d.ts +15 -0
- package/src/plugins/ecopages-virtual-imports.js +25 -0
- package/src/plugins/integration-plugin.d.ts +1 -1
- package/src/plugins/integration-plugin.js +1 -1
- package/src/plugins/tsconfig-import-resolver.d.ts +2 -0
- package/src/plugins/tsconfig-import-resolver.js +7 -5
- package/src/route-renderer/error-pages/error-page-renderer.js +32 -3
- package/src/route-renderer/explicit-view-render-preparation.d.ts +28 -3
- package/src/route-renderer/explicit-view-render-preparation.js +63 -11
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.d.ts +15 -5
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.js +27 -15
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +24 -9
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +73 -50
- package/src/route-renderer/orchestration/integration-renderer.d.ts +42 -11
- package/src/route-renderer/orchestration/integration-renderer.js +83 -43
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.js +0 -3
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +36 -11
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +74 -62
- package/src/route-renderer/page-declaration.d.ts +25 -0
- package/src/route-renderer/page-declaration.js +39 -0
- package/src/route-renderer/page-loading/component-declarations.d.ts +65 -0
- package/src/route-renderer/page-loading/component-declarations.js +77 -0
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -16
- package/src/route-renderer/page-loading/component-dependency-collection.js +36 -105
- package/src/route-renderer/page-loading/declared-asset-collection.d.ts +19 -14
- package/src/route-renderer/page-loading/declared-asset-collection.js +66 -67
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +18 -10
- package/src/route-renderer/page-loading/dependency-resolver.js +58 -99
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +19 -26
- package/src/route-renderer/page-loading/lazy-entry-collection.js +53 -64
- package/src/route-renderer/page-loading/module-declaration-aggregation.d.ts +17 -3
- package/src/route-renderer/page-loading/module-declaration-aggregation.js +14 -13
- package/src/route-renderer/page-loading/page-module-loader.d.ts +31 -12
- package/src/route-renderer/page-loading/page-module-loader.js +66 -35
- package/src/route-renderer/page-loading/resolved-page-dependencies.js +14 -9
- package/src/router/server/pages-dir.d.ts +7 -0
- package/src/router/server/pages-dir.js +7 -0
- package/src/router/server/route-registry.d.ts +22 -10
- package/src/router/server/route-registry.js +54 -23
- package/src/router/server/segment-path-matcher.d.ts +29 -5
- package/src/router/server/segment-path-matcher.js +22 -19
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +2 -2
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +5 -5
- package/src/static-site-generator/static-site-generator.d.ts +17 -2
- package/src/static-site-generator/static-site-generator.js +52 -18
- package/src/types/contracts.d.ts +216 -160
- package/src/types/eco-api-types.d.ts +86 -51
- package/src/types/locals-brand.d.ts +9 -0
- package/src/types/locals-brand.js +9 -0
- package/src/types/middleware-types.d.ts +143 -0
- package/src/types/middleware-types.js +1 -0
- package/src/types/public-types.d.ts +3 -2
- package/src/utils/file-roles.d.ts +48 -0
- package/src/utils/file-roles.js +85 -0
- package/src/utils/node-builtin.d.ts +10 -0
- package/src/utils/node-builtin.js +13 -0
- package/src/watchers/project-watcher.js +2 -2
- package/src/build/contracts/server-only-specifier.d.ts +0 -8
- package/src/build/contracts/server-only-specifier.js +0 -11
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.d.ts +0 -5
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.js +0 -11
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.d.ts +0 -4
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.js +0 -30
- package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +0 -12
- package/src/route-renderer/page-loading/ecopages-virtual-imports.js +0 -100
- package/src/utils/endpoint-file-extensions.d.ts +0 -11
- package/src/utils/endpoint-file-extensions.js +0 -13
- package/src/utils/locals-utils.d.ts +0 -15
- package/src/utils/locals-utils.js +0 -34
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EcoComponentConfig } from '../types/contracts.js';
|
|
2
2
|
import type { ComponentIdentity } from './component-identity.js';
|
|
3
|
+
import type { EcopagesVirtualImport } from '../plugins/ecopages-virtual-imports.js';
|
|
3
4
|
/**
|
|
4
5
|
* What the component meta transform discovered for one declaration.
|
|
5
6
|
*
|
|
@@ -16,6 +17,8 @@ export type DiscoveredDependencies = {
|
|
|
16
17
|
plainModuleStylesheets?: string[];
|
|
17
18
|
/** The entries of `stylesheets` and `plainModuleStylesheets` whose import named a package: package paths. */
|
|
18
19
|
packageStylesheets?: string[];
|
|
20
|
+
/** The `ecopages:` virtual modules the declaring module imports. */
|
|
21
|
+
virtualImports?: EcopagesVirtualImport[];
|
|
19
22
|
watchFiles?: string[];
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
@@ -52,6 +55,8 @@ export declare function getDiscoveredStylesheets(config: EcoComponentConfig | un
|
|
|
52
55
|
* without editing the importing Page.
|
|
53
56
|
*/
|
|
54
57
|
export declare function getDiscoveredWatchFiles(config: EcoComponentConfig | undefined): readonly string[];
|
|
58
|
+
/** The `ecopages:` virtual modules discovery recorded for this component identity. */
|
|
59
|
+
export declare function getDiscoveredVirtualImports(config: EcoComponentConfig | undefined): readonly EcopagesVirtualImport[];
|
|
55
60
|
/**
|
|
56
61
|
* Attaches deferred discovered Component references to `config.dependencies`.
|
|
57
62
|
*
|
|
@@ -3,6 +3,7 @@ const INFERRED_STYLESHEETS = Symbol.for('ecopages.identity.inferredStylesheets')
|
|
|
3
3
|
const PLAIN_MODULE_STYLESHEETS = Symbol.for('ecopages.identity.plainModuleStylesheets');
|
|
4
4
|
const PACKAGE_STYLESHEETS = Symbol.for('ecopages.identity.packageStylesheets');
|
|
5
5
|
const DISCOVERED_WATCH_FILES = Symbol.for('ecopages.identity.watchFiles');
|
|
6
|
+
const VIRTUAL_IMPORTS = Symbol.for('ecopages.identity.virtualImports');
|
|
6
7
|
function discoveryRecord(identity) {
|
|
7
8
|
return identity;
|
|
8
9
|
}
|
|
@@ -21,6 +22,7 @@ export function registerDiscoveredDependencies(identity, discovered) {
|
|
|
21
22
|
record[PLAIN_MODULE_STYLESHEETS] = discovered.plainModuleStylesheets;
|
|
22
23
|
record[PACKAGE_STYLESHEETS] = discovered.packageStylesheets;
|
|
23
24
|
record[DISCOVERED_WATCH_FILES] = discovered.watchFiles;
|
|
25
|
+
record[VIRTUAL_IMPORTS] = discovered.virtualImports;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Inferred stylesheets registered for this component identity, split by where the import sits, as discovery
|
|
@@ -59,6 +61,13 @@ export function getDiscoveredWatchFiles(config) {
|
|
|
59
61
|
return [];
|
|
60
62
|
return discoveryRecord(identity)[DISCOVERED_WATCH_FILES] ?? discoveries.get(identity)?.watchFiles ?? [];
|
|
61
63
|
}
|
|
64
|
+
/** The `ecopages:` virtual modules discovery recorded for this component identity. */
|
|
65
|
+
export function getDiscoveredVirtualImports(config) {
|
|
66
|
+
const identity = config?.identity;
|
|
67
|
+
if (!identity)
|
|
68
|
+
return [];
|
|
69
|
+
return discoveryRecord(identity)[VIRTUAL_IMPORTS] ?? discoveries.get(identity)?.virtualImports ?? [];
|
|
70
|
+
}
|
|
62
71
|
function isDeclared(value) {
|
|
63
72
|
return typeof value === 'function' && Boolean(value.config?.identity);
|
|
64
73
|
}
|
package/src/eco/eco.browser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { applyPageLayoutConfig, mergeLayoutDependencies, normalizePageLayouts } from './page-layout-normalization.js';
|
|
2
|
+
import { attachPageOptions } from './page-data-hooks.js';
|
|
2
3
|
/**
|
|
3
4
|
* Creates a browser component that renders inline for every caller.
|
|
4
5
|
*
|
|
@@ -30,43 +31,22 @@ function layout(options) {
|
|
|
30
31
|
return createComponentFactory(options);
|
|
31
32
|
}
|
|
32
33
|
function page(options) {
|
|
33
|
-
const { layout: pageLayout, dependencies: dependenciesInput, render
|
|
34
|
+
const { layout: pageLayout, dependencies: dependenciesInput, render } = options;
|
|
34
35
|
const layoutEntries = normalizePageLayouts(pageLayout);
|
|
35
|
-
const resolveDependencies = typeof dependenciesInput === 'function' ? dependenciesInput : undefined;
|
|
36
36
|
const staticDependencies = typeof dependenciesInput === 'function'
|
|
37
37
|
? mergeLayoutDependencies(undefined, layoutEntries)
|
|
38
38
|
: mergeLayoutDependencies(dependenciesInput, layoutEntries);
|
|
39
|
-
const
|
|
39
|
+
const componentOptions = {
|
|
40
40
|
identity: options.identity,
|
|
41
41
|
integration: options.integration,
|
|
42
42
|
dependencies: staticDependencies,
|
|
43
43
|
render,
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
|
+
const pageComponent = createComponentFactory(componentOptions);
|
|
45
46
|
if (pageComponent.config) {
|
|
46
47
|
applyPageLayoutConfig(pageComponent.config, layoutEntries);
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
pageComponent.staticPaths = staticPaths;
|
|
50
|
-
}
|
|
51
|
-
if (staticProps) {
|
|
52
|
-
pageComponent.staticProps = staticProps;
|
|
53
|
-
}
|
|
54
|
-
if (metadata) {
|
|
55
|
-
pageComponent.metadata = metadata;
|
|
56
|
-
}
|
|
57
|
-
if (resolveDependencies) {
|
|
58
|
-
pageComponent.resolveDependencies = resolveDependencies;
|
|
59
|
-
}
|
|
60
|
-
if (cache) {
|
|
61
|
-
pageComponent.cache = cache;
|
|
62
|
-
}
|
|
63
|
-
if (requires) {
|
|
64
|
-
pageComponent.requires = requires;
|
|
65
|
-
}
|
|
66
|
-
if (middleware) {
|
|
67
|
-
pageComponent.middleware = middleware;
|
|
68
|
-
}
|
|
69
|
-
return pageComponent;
|
|
49
|
+
return attachPageOptions(pageComponent, options);
|
|
70
50
|
}
|
|
71
51
|
export const eco = {
|
|
72
52
|
component,
|
package/src/eco/eco.js
CHANGED
|
@@ -7,6 +7,9 @@ import { isThenable } from './component-render-output.js';
|
|
|
7
7
|
import { applyPageLayoutConfig, mergeLayoutDependencies, normalizePageLayouts } from './page-layout-normalization.js';
|
|
8
8
|
import { getComponentIdentity, getComponentOwner } from './component-identity.js';
|
|
9
9
|
import { attachDiscoveredDependencies } from './discovered-dependencies.js';
|
|
10
|
+
import { DATA_HOOKS_MIGRATION_URL } from './migration-docs.js';
|
|
11
|
+
import { flattenMiddleware } from '../middleware/create-middleware.js';
|
|
12
|
+
import { attachPageOptions } from './page-data-hooks.js';
|
|
10
13
|
/**
|
|
11
14
|
* Creates a component factory with lazy-trigger support and foreign-child-runtime
|
|
12
15
|
* interception.
|
|
@@ -110,6 +113,23 @@ function html(options) {
|
|
|
110
113
|
function layout(options) {
|
|
111
114
|
return createComponentFactory(options);
|
|
112
115
|
}
|
|
116
|
+
const RENAMED_PAGE_OPTIONS = { staticProps: 'props', staticPaths: 'paths' };
|
|
117
|
+
/**
|
|
118
|
+
* Fails a page that still declares a data hook under its pre-rename option name.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* `eco.page()` copies only the options it knows, so an old name would otherwise be dropped silently and the
|
|
122
|
+
* page would render without its data.
|
|
123
|
+
*/
|
|
124
|
+
function assertNoRenamedPageOptions(options) {
|
|
125
|
+
const found = Object.keys(RENAMED_PAGE_OPTIONS).filter((name) => name in options);
|
|
126
|
+
if (found.length === 0)
|
|
127
|
+
return;
|
|
128
|
+
const renames = found
|
|
129
|
+
.map((name) => `${name} is now ${RENAMED_PAGE_OPTIONS[name]}`)
|
|
130
|
+
.join(', ');
|
|
131
|
+
throw new Error(`[ecopages] eco.page() no longer accepts ${found.join(', ')}: ${renames}, and the hook returns its value directly instead of a { props } or { paths } envelope. Migration steps: ${DATA_HOOKS_MIGRATION_URL}`);
|
|
132
|
+
}
|
|
113
133
|
/**
|
|
114
134
|
* Creates a page component and attaches optional static APIs.
|
|
115
135
|
*
|
|
@@ -117,9 +137,9 @@ function layout(options) {
|
|
|
117
137
|
* @returns Eco page component.
|
|
118
138
|
*/
|
|
119
139
|
function page(options) {
|
|
120
|
-
|
|
140
|
+
assertNoRenamedPageOptions(options);
|
|
141
|
+
const { layout, dependencies: dependenciesInput, render, middleware } = options;
|
|
121
142
|
const layoutEntries = normalizePageLayouts(layout);
|
|
122
|
-
const resolveDependencies = typeof dependenciesInput === 'function' ? dependenciesInput : undefined;
|
|
123
143
|
const staticDependencies = typeof dependenciesInput === 'function'
|
|
124
144
|
? mergeLayoutDependencies(undefined, layoutEntries)
|
|
125
145
|
: mergeLayoutDependencies(dependenciesInput, layoutEntries);
|
|
@@ -133,21 +153,9 @@ function page(options) {
|
|
|
133
153
|
if (pageComponent.config) {
|
|
134
154
|
applyPageLayoutConfig(pageComponent.config, layoutEntries);
|
|
135
155
|
}
|
|
136
|
-
if (staticPaths)
|
|
137
|
-
pageComponent.staticPaths = staticPaths;
|
|
138
|
-
if (staticProps)
|
|
139
|
-
pageComponent.staticProps = staticProps;
|
|
140
|
-
if (metadata)
|
|
141
|
-
pageComponent.metadata = metadata;
|
|
142
|
-
if (resolveDependencies)
|
|
143
|
-
pageComponent.resolveDependencies = resolveDependencies;
|
|
144
|
-
if (cache)
|
|
145
|
-
pageComponent.cache = cache;
|
|
146
|
-
if (requires)
|
|
147
|
-
pageComponent.requires = requires;
|
|
148
156
|
if (middleware)
|
|
149
|
-
|
|
150
|
-
return pageComponent;
|
|
157
|
+
flattenMiddleware(middleware, 'page middleware');
|
|
158
|
+
return attachPageOptions(pageComponent, options);
|
|
151
159
|
}
|
|
152
160
|
/**
|
|
153
161
|
* The eco namespace - provides factories for components and pages
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the docs explain how to migrate a page to the current data hooks.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Errors link here instead of naming `@ecopages/codemod`, which is not published to npm.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DATA_HOOKS_MIGRATION_URL = "https://ecopages.app/docs/core/data-fetching#migrating-from-staticprops-and-staticpaths";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the docs explain how to migrate a page to the current data hooks.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Errors link here instead of naming `@ecopages/codemod`, which is not published to npm.
|
|
6
|
+
*/
|
|
7
|
+
export const DATA_HOOKS_MIGRATION_URL = 'https://ecopages.app/docs/core/data-fetching#migrating-from-staticprops-and-staticpaths';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DynamicEcoPageComponent, EcoComponent, EcoPageComponent, PagePropsFor } from '../types/contracts.js';
|
|
2
|
+
import type { PageOptions } from '../types/eco-api-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Adds the options `eco.page()` keeps on the Page to its rendered component.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The `props` and dependency hooks are kept by Cache Strategy, so the result is the matching member of
|
|
8
|
+
* {@link EcoPageComponent}: a Dynamic Page's hooks take the request context, any other Page's the build context.
|
|
9
|
+
*/
|
|
10
|
+
export declare function attachPageOptions<T, E>(component: EcoComponent<PagePropsFor<T>>, options: PageOptions<T, E>): EcoPageComponent<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a loaded Page declares `cache: 'dynamic'`, read from an untyped module export or a typed Page.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* It narrows to the Dynamic Page member of {@link EcoPageComponent}, so code that holds a loaded module calls it
|
|
16
|
+
* instead of reading `cache` itself.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isDynamicPage(page: unknown): page is DynamicEcoPageComponent<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Throws when a Page's `props` hook returned a key that {@link NoRouteProps} bars.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The hook's type rejects those keys; this catches a hook whose types do not, such as one that returns `any` or a
|
|
24
|
+
* Page written in JavaScript. A `null` or `undefined` result passes, and so does a barred key set to `undefined`, which
|
|
25
|
+
* the type allows and the route overwrites.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assertNoRouteProps(props: unknown, source: string): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the options `eco.page()` keeps on the Page to its rendered component.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The `props` and dependency hooks are kept by Cache Strategy, so the result is the matching member of
|
|
6
|
+
* {@link EcoPageComponent}: a Dynamic Page's hooks take the request context, any other Page's the build context.
|
|
7
|
+
*/
|
|
8
|
+
export function attachPageOptions(component, options) {
|
|
9
|
+
const statics = options.cache === 'dynamic' ? createDynamicStatics(options) : createStaticStatics(options);
|
|
10
|
+
if (options.paths)
|
|
11
|
+
statics.paths = options.paths;
|
|
12
|
+
if (options.metadata)
|
|
13
|
+
statics.metadata = options.metadata;
|
|
14
|
+
if (options.middleware)
|
|
15
|
+
statics.middleware = options.middleware;
|
|
16
|
+
return Object.assign(component, statics);
|
|
17
|
+
}
|
|
18
|
+
function createDynamicStatics(options) {
|
|
19
|
+
const statics = { cache: 'dynamic' };
|
|
20
|
+
if (options.props)
|
|
21
|
+
statics.props = options.props;
|
|
22
|
+
if (typeof options.dependencies === 'function')
|
|
23
|
+
statics.resolveDependencies = options.dependencies;
|
|
24
|
+
return statics;
|
|
25
|
+
}
|
|
26
|
+
function createStaticStatics(options) {
|
|
27
|
+
const statics = {};
|
|
28
|
+
if (options.cache)
|
|
29
|
+
statics.cache = options.cache;
|
|
30
|
+
if (options.props)
|
|
31
|
+
statics.props = options.props;
|
|
32
|
+
if (typeof options.dependencies === 'function')
|
|
33
|
+
statics.resolveDependencies = options.dependencies;
|
|
34
|
+
return statics;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether a loaded Page declares `cache: 'dynamic'`, read from an untyped module export or a typed Page.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* It narrows to the Dynamic Page member of {@link EcoPageComponent}, so code that holds a loaded module calls it
|
|
41
|
+
* instead of reading `cache` itself.
|
|
42
|
+
*/
|
|
43
|
+
export function isDynamicPage(page) {
|
|
44
|
+
return typeof page === 'function' && 'cache' in page && page.cache === 'dynamic';
|
|
45
|
+
}
|
|
46
|
+
/** The keys of {@link NoRouteProps}, listed once so the type and this check cannot drift apart. */
|
|
47
|
+
const ROUTE_PROPS = { params: true, query: true };
|
|
48
|
+
/**
|
|
49
|
+
* Throws when a Page's `props` hook returned a key that {@link NoRouteProps} bars.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The hook's type rejects those keys; this catches a hook whose types do not, such as one that returns `any` or a
|
|
53
|
+
* Page written in JavaScript. A `null` or `undefined` result passes, and so does a barred key set to `undefined`, which
|
|
54
|
+
* the type allows and the route overwrites.
|
|
55
|
+
*/
|
|
56
|
+
export function assertNoRouteProps(props, source) {
|
|
57
|
+
if (typeof props !== 'object' || props === null)
|
|
58
|
+
return;
|
|
59
|
+
for (const key of Object.keys(ROUTE_PROPS)) {
|
|
60
|
+
if (Object.hasOwn(props, key) && Reflect.get(props, key) !== undefined) {
|
|
61
|
+
throw new Error(`[ecopages] The props hook of ${source} returned "${key}", a key render receives from the route. Rename the prop.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { EcoComponentConfig, EcoComponentDependencies, EcoPageLayoutEntry, EcoPageLayouts } from '../types/contracts.js';
|
|
1
|
+
import type { EcoComponentConfig, EcoComponentDependencies, EcoPageLayoutEntry, EcoPageLayouts, LayoutRequestContext } from '../types/contracts.js';
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes `layout` page options to an outer→inner stack of layout entries.
|
|
4
4
|
*/
|
|
5
|
-
export declare function normalizePageLayouts<E>(layout?: EcoPageLayouts<E>): EcoPageLayoutEntry[];
|
|
5
|
+
export declare function normalizePageLayouts<E>(layout?: EcoPageLayouts<E, LayoutRequestContext>): EcoPageLayoutEntry[];
|
|
6
6
|
/**
|
|
7
7
|
* Merges `eco.layout()` components into `dependencies.components` without duplicates.
|
|
8
8
|
*
|
|
@@ -75,7 +75,7 @@ import { resetBuildErrors, reportBuildError } from './build-error-presentation.j
|
|
|
75
75
|
getHandlers: () => window.__ECO_PAGES__?.hmrHandlers,
|
|
76
76
|
getActivePageModule: () => window.__ECO_PAGES__?.page?.module,
|
|
77
77
|
reloadCurrentPage: async (request) => Boolean(await navigationRuntime.reloadCurrentPage(request)),
|
|
78
|
-
importModule: (url) => import(url),
|
|
78
|
+
importModule: (url) => import(/* @vite-ignore */ url),
|
|
79
79
|
waitForSettled: async () => waitForNavigationToSettle(navigationRuntime),
|
|
80
80
|
reloadPage,
|
|
81
81
|
}, timestamp);
|
|
@@ -19,8 +19,6 @@ export interface JsHmrContext extends HmrRegisteredEntrypointsContext {
|
|
|
19
19
|
getDependencyEntrypoints(filePath: string): Set<string>;
|
|
20
20
|
};
|
|
21
21
|
getSrcDir(): string;
|
|
22
|
-
getPagesDir(): string;
|
|
23
|
-
getLayoutsDir(): string;
|
|
24
22
|
getTemplateExtensions(): string[];
|
|
25
23
|
/** Whether `filePath` is a stylesheet, which a served module can import as text. */
|
|
26
24
|
isStylesheet(filePath: string): boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HMR strategy for server-rendered include templates and explicit server views.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* An explicit view is a file the server entry imports as a View Reference, wherever it lives. These files affect
|
|
5
|
+
* SSR output (head, layout shell, explicit views) but are not
|
|
5
6
|
* client HMR entrypoints. Broadcast a layout-update so the active navigation
|
|
6
7
|
* runtime can refresh the current page without a full document reload.
|
|
7
8
|
*/
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HMR strategy for server-rendered include templates and explicit server views.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* An explicit view is a file the server entry imports as a View Reference, wherever it lives. These files affect
|
|
5
|
+
* SSR output (head, layout shell, explicit views) but are not
|
|
5
6
|
* client HMR entrypoints. Broadcast a layout-update so the active navigation
|
|
6
7
|
* runtime can refresh the current page without a full document reload.
|
|
7
8
|
*/
|
|
8
9
|
import { HmrStrategy, HmrStrategyType } from '../hmr-strategy.js';
|
|
10
|
+
import { isViewReferencePath } from '../../build/server/view-reference.js';
|
|
9
11
|
/** Outranks integration-owned strategies that may also match shared dependencies. */
|
|
10
12
|
const SERVER_RENDERED_TEMPLATE_PRIORITY_OFFSET = 50;
|
|
11
13
|
export class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
|
|
@@ -17,8 +19,7 @@ export class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
|
|
|
17
19
|
this.invalidationService = invalidationService;
|
|
18
20
|
}
|
|
19
21
|
matches(filePath) {
|
|
20
|
-
return
|
|
21
|
-
this.invalidationService.isExplicitServerViewFile(filePath));
|
|
22
|
+
return this.invalidationService.isIncludeSourceFile(filePath) || isViewReferencePath(filePath);
|
|
22
23
|
}
|
|
23
24
|
async process(filePath) {
|
|
24
25
|
return {
|
|
@@ -55,7 +55,7 @@ export declare class HtmlRewriter {
|
|
|
55
55
|
transform(input: string): string;
|
|
56
56
|
transform(input: Response): Response;
|
|
57
57
|
}
|
|
58
|
-
/** Attribute access on the element passed to {@link rewriteFirstElement}. */
|
|
58
|
+
/** Attribute access on the element passed to {@link rewriteFirstElement} and {@link rewriteLeadingElement}. */
|
|
59
59
|
export type HtmlRewriterAttributeTarget = Pick<HtmlRewriterElement, 'tagName' | 'attributes' | 'getAttribute' | 'hasAttribute' | 'setAttribute' | 'removeAttribute'>;
|
|
60
60
|
/**
|
|
61
61
|
* Rewrites the attributes of the first start tag that `isTarget` accepts and
|
|
@@ -67,11 +67,13 @@ export type HtmlRewriterAttributeTarget = Pick<HtmlRewriterElement, 'tagName' |
|
|
|
67
67
|
* is rewritten, so the cost grows with the markup before the target rather than
|
|
68
68
|
* with the whole document. Only attribute changes are offered: content placed
|
|
69
69
|
* with `append` or `after` needs the element's end tag, which is never reached.
|
|
70
|
+
*/
|
|
71
|
+
export declare function rewriteFirstElement(html: string, isTarget: (element: HtmlRewriterAttributeTarget) => boolean, rewrite: (element: HtmlRewriterAttributeTarget) => void): string;
|
|
72
|
+
/**
|
|
73
|
+
* Rewrites the attributes of the element `html` starts with, whitespace aside.
|
|
70
74
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* Only the leading start tag is read. When text, a comment or an end tag comes first, `html` is returned unchanged,
|
|
77
|
+
* so a Lit render that opens with `<!--lit-part-->` keeps its markup.
|
|
74
78
|
*/
|
|
75
|
-
export declare function
|
|
76
|
-
leadingOnly?: boolean;
|
|
77
|
-
}): string;
|
|
79
|
+
export declare function rewriteLeadingElement(html: string, rewrite: (element: HtmlRewriterAttributeTarget) => void): string;
|
|
@@ -68,13 +68,8 @@ export class HtmlRewriter {
|
|
|
68
68
|
* is rewritten, so the cost grows with the markup before the target rather than
|
|
69
69
|
* with the whole document. Only attribute changes are offered: content placed
|
|
70
70
|
* with `append` or `after` needs the element's end tag, which is never reached.
|
|
71
|
-
*
|
|
72
|
-
* With `leadingOnly`, the target must directly follow the previous start tag
|
|
73
|
-
* (or the start of `html`), whitespace aside. When text, a comment or an end tag
|
|
74
|
-
* comes first, scanning stops and nothing is rewritten.
|
|
75
71
|
*/
|
|
76
|
-
export function rewriteFirstElement(html, isTarget, rewrite
|
|
77
|
-
const leadingOnly = options.leadingOnly ?? false;
|
|
72
|
+
export function rewriteFirstElement(html, isTarget, rewrite) {
|
|
78
73
|
const session = new RewriteSession([
|
|
79
74
|
{
|
|
80
75
|
tagName: '*',
|
|
@@ -82,15 +77,35 @@ export function rewriteFirstElement(html, isTarget, rewrite, options = {}) {
|
|
|
82
77
|
element(element) {
|
|
83
78
|
if (!isTarget(element))
|
|
84
79
|
return;
|
|
85
|
-
|
|
86
|
-
rewrite(element);
|
|
80
|
+
rewrite(element);
|
|
87
81
|
session.stop();
|
|
88
82
|
},
|
|
89
83
|
},
|
|
90
84
|
},
|
|
91
|
-
]
|
|
85
|
+
]);
|
|
92
86
|
return `${session.write(html)}${session.end()}`;
|
|
93
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Rewrites the attributes of the element `html` starts with, whitespace aside.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Only the leading start tag is read. When text, a comment or an end tag comes first, `html` is returned unchanged,
|
|
93
|
+
* so a Lit render that opens with `<!--lit-part-->` keeps its markup.
|
|
94
|
+
*/
|
|
95
|
+
export function rewriteLeadingElement(html, rewrite) {
|
|
96
|
+
let index = 0;
|
|
97
|
+
while (index < html.length && isWhitespaceCode(html.charCodeAt(index)))
|
|
98
|
+
index += 1;
|
|
99
|
+
if (html[index] !== '<' || !isAsciiAlpha(html[index + 1] ?? ''))
|
|
100
|
+
return html;
|
|
101
|
+
const tag = scanTag(html, index);
|
|
102
|
+
if (!tag)
|
|
103
|
+
return html;
|
|
104
|
+
const end = tag.end + 1;
|
|
105
|
+
const element = new RewriterElement(html.slice(index, end), readTagName(html, index + 1).toLowerCase(), tag.selfClosing, false);
|
|
106
|
+
rewrite(element);
|
|
107
|
+
return `${html.slice(0, index)}${element.renderStart()}${html.slice(end)}`;
|
|
108
|
+
}
|
|
94
109
|
/** SVG and MathML elements whose children are parsed as HTML again. */
|
|
95
110
|
const HTML_INTEGRATION_POINTS = new Set(['foreignobject', 'desc', 'title', 'mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
96
111
|
/** HTML start tags that end foreign (SVG or MathML) content. */
|
|
@@ -158,29 +173,14 @@ class RewriteSession {
|
|
|
158
173
|
rawTextTag = null;
|
|
159
174
|
scriptState = 'data';
|
|
160
175
|
stopped = false;
|
|
161
|
-
markupSinceStartTag = false;
|
|
162
176
|
openElements = [];
|
|
163
177
|
handlers;
|
|
164
178
|
handledTags;
|
|
165
179
|
handlesAnyTag;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @param options.trackLeadingText Also count non-whitespace text in
|
|
169
|
-
* {@link contentBeforeStartTag}. Off by default because it scans every text run.
|
|
170
|
-
*/
|
|
171
|
-
constructor(handlers, options = {}) {
|
|
180
|
+
constructor(handlers) {
|
|
172
181
|
this.handlers = handlers;
|
|
173
182
|
this.handledTags = new Set(handlers.map((entry) => entry.tagName));
|
|
174
183
|
this.handlesAnyTag = this.handledTags.has('*');
|
|
175
|
-
this.trackLeadingText = options.trackLeadingText ?? false;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Whether a comment, end tag or other non-start-tag markup (and, when tracked,
|
|
179
|
-
* non-whitespace text) appeared between the previous start tag and the one
|
|
180
|
-
* whose handlers are running.
|
|
181
|
-
*/
|
|
182
|
-
get contentBeforeStartTag() {
|
|
183
|
-
return this.markupSinceStartTag;
|
|
184
184
|
}
|
|
185
185
|
write(chunk) {
|
|
186
186
|
this.buffer += chunk;
|
|
@@ -218,10 +218,6 @@ class RewriteSession {
|
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
const lt = source.indexOf('<', index);
|
|
221
|
-
const textEnd = lt === -1 ? source.length : lt;
|
|
222
|
-
if (this.trackLeadingText && !this.markupSinceStartTag && hasNonWhitespace(source, index, textEnd)) {
|
|
223
|
-
this.markupSinceStartTag = true;
|
|
224
|
-
}
|
|
225
221
|
if (lt === -1) {
|
|
226
222
|
index = source.length;
|
|
227
223
|
break;
|
|
@@ -256,10 +252,7 @@ class RewriteSession {
|
|
|
256
252
|
return null;
|
|
257
253
|
return { end: tag.end + 1, replacement: this.openElement(source, index, tag.end + 1, tag.selfClosing) };
|
|
258
254
|
}
|
|
259
|
-
|
|
260
|
-
if (token)
|
|
261
|
-
this.markupSinceStartTag = true;
|
|
262
|
-
return token;
|
|
255
|
+
return this.readNonStartTag(source, index, next, final);
|
|
263
256
|
}
|
|
264
257
|
/** Reads a comment, declaration, processing instruction, end tag or a stray `<`. */
|
|
265
258
|
readNonStartTag(source, index, next, final) {
|
|
@@ -330,7 +323,6 @@ class RewriteSession {
|
|
|
330
323
|
if (isVoid)
|
|
331
324
|
replacement += openElement.after;
|
|
332
325
|
}
|
|
333
|
-
this.markupSinceStartTag = false;
|
|
334
326
|
if (!isVoid) {
|
|
335
327
|
this.openElements.push(openElement);
|
|
336
328
|
if (!foreign && RAW_TEXT_ELEMENTS.has(name)) {
|
|
@@ -581,10 +573,3 @@ function toMarkup(content, options) {
|
|
|
581
573
|
return content;
|
|
582
574
|
return content.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
583
575
|
}
|
|
584
|
-
function hasNonWhitespace(source, start, end) {
|
|
585
|
-
for (let position = start; position < end; position++) {
|
|
586
|
-
if (!isWhitespaceCode(source.charCodeAt(position)))
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
return false;
|
|
590
|
-
}
|
|
@@ -26,9 +26,9 @@ export declare class HtmlTransformerService {
|
|
|
26
26
|
*/
|
|
27
27
|
applyAttributesToHtmlElement(html: string, attributes: Record<string, string>): string;
|
|
28
28
|
/**
|
|
29
|
-
* Injects page assets and document contributions into
|
|
29
|
+
* Injects page assets and document contributions into rendered HTML.
|
|
30
30
|
*/
|
|
31
|
-
transform(
|
|
31
|
+
transform(html: string, input?: PageAssetInjection): string;
|
|
32
32
|
/**
|
|
33
33
|
* @remarks
|
|
34
34
|
* Each slot is inserted as one joined string, so contributions and assets keep
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { escapeHtmlAttribute } from '../utils/html-escaping.js';
|
|
2
|
-
import { HtmlRewriter, rewriteFirstElement } from './html-rewriter.js';
|
|
2
|
+
import { HtmlRewriter, rewriteFirstElement, rewriteLeadingElement } from './html-rewriter.js';
|
|
3
3
|
import { buildProcessedAssetDedupeKey, dedupeProcessedAssets } from '../assets/processed-asset-dedupe.js';
|
|
4
4
|
/**
|
|
5
5
|
* Rewrites rendered HTML with processed assets and per-render document contributions.
|
|
@@ -41,13 +41,19 @@ export class HtmlTransformerService {
|
|
|
41
41
|
* Sets attributes on the first `<html>` start tag.
|
|
42
42
|
*/
|
|
43
43
|
applyAttributesToHtmlElement(html, attributes) {
|
|
44
|
-
|
|
44
|
+
const entries = stampableEntries(attributes);
|
|
45
|
+
if (entries.length === 0)
|
|
46
|
+
return html;
|
|
47
|
+
return rewriteFirstElement(html, (element) => element.tagName === 'html', (element) => {
|
|
48
|
+
for (const [name, value] of entries)
|
|
49
|
+
element.setAttribute(name, value);
|
|
50
|
+
});
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
|
-
* Injects page assets and document contributions into
|
|
53
|
+
* Injects page assets and document contributions into rendered HTML.
|
|
48
54
|
*/
|
|
49
|
-
transform(
|
|
50
|
-
return this.createRewriter(input.contributions ?? [], input.pagePackage).transform(
|
|
55
|
+
transform(html, input = {}) {
|
|
56
|
+
return this.createRewriter(input.contributions ?? [], input.pagePackage).transform(html);
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* @remarks
|
|
@@ -120,22 +126,22 @@ export class HtmlTransformerService {
|
|
|
120
126
|
* so a Lit render that opens with `<!--lit-part-->` keeps its markup.
|
|
121
127
|
*/
|
|
122
128
|
export function applyAttributesToFirstElement(html, attributes) {
|
|
123
|
-
|
|
129
|
+
const entries = stampableEntries(attributes);
|
|
130
|
+
if (entries.length === 0)
|
|
131
|
+
return html;
|
|
132
|
+
return rewriteLeadingElement(html, (element) => {
|
|
133
|
+
for (const [name, value] of entries)
|
|
134
|
+
element.setAttribute(name, value);
|
|
135
|
+
});
|
|
124
136
|
}
|
|
125
137
|
/**
|
|
126
|
-
*
|
|
138
|
+
* The attributes to stamp.
|
|
127
139
|
*
|
|
128
140
|
* @remarks
|
|
129
141
|
* Entries with an empty name are skipped. An empty value is kept and rendered as
|
|
130
142
|
* `name=""`, so presence markers such as `data-eco-island` survive. An attribute
|
|
131
143
|
* the element already has is replaced rather than duplicated.
|
|
132
144
|
*/
|
|
133
|
-
function
|
|
134
|
-
|
|
135
|
-
if (entries.length === 0)
|
|
136
|
-
return html;
|
|
137
|
-
return rewriteFirstElement(html, isTarget, (element) => {
|
|
138
|
-
for (const [name, value] of entries)
|
|
139
|
-
element.setAttribute(name, value);
|
|
140
|
-
}, options);
|
|
145
|
+
function stampableEntries(attributes) {
|
|
146
|
+
return Object.entries(attributes).filter(([name]) => name.length > 0);
|
|
141
147
|
}
|
|
@@ -12,6 +12,7 @@ import { isCssImport, isDeliveredStylesheetImport } from '../plugins/component-i
|
|
|
12
12
|
import { stripsSideEffectStylesheetImports } from '../plugins/eco-component-meta-plugin.js';
|
|
13
13
|
import { isBarePackageImportSpecifier, loadTsconfigPathPrefixes, resolveProjectModulePath, } from '../plugins/tsconfig-import-resolver.js';
|
|
14
14
|
import { BrowserBundleService } from '../assets/browser-bundle.service.js';
|
|
15
|
+
import { isPrivatePath } from '../utils/file-roles.js';
|
|
15
16
|
import { isProductionRuntime } from '../utils/runtime.js';
|
|
16
17
|
import { compileHtmlPage, compileHtmlShell } from './html-page-template.js';
|
|
17
18
|
export function createHtmlPageModuleScriptState() {
|
|
@@ -225,7 +226,7 @@ function listHtmlFiles(appConfig) {
|
|
|
225
226
|
? fileSystem
|
|
226
227
|
.readdir(pagesDir, { recursive: true })
|
|
227
228
|
.map((entry) => entry.name)
|
|
228
|
-
.filter((name) => name.endsWith('.html'))
|
|
229
|
+
.filter((name) => name.endsWith('.html') && !isPrivatePath(name))
|
|
229
230
|
.map((name) => path.join(pagesDir, name))
|
|
230
231
|
.sort()
|
|
231
232
|
: [];
|
|
@@ -8,7 +8,7 @@ import { HtmlPageRenderer } from './html-page-renderer.js';
|
|
|
8
8
|
* @remarks
|
|
9
9
|
* `finalizeEcoPagesConfig()` appends it after user Integrations unless one of them
|
|
10
10
|
* already owns `.html`, so apps never register it themselves. HTML Pages have no
|
|
11
|
-
* `
|
|
11
|
+
* `paths`, so they receive no Params.
|
|
12
12
|
*/
|
|
13
13
|
export declare class HtmlPagesPlugin extends IntegrationPlugin {
|
|
14
14
|
renderer: typeof HtmlPageRenderer;
|
|
@@ -8,7 +8,7 @@ import { HtmlPageRenderer } from './html-page-renderer.js';
|
|
|
8
8
|
* @remarks
|
|
9
9
|
* `finalizeEcoPagesConfig()` appends it after user Integrations unless one of them
|
|
10
10
|
* already owns `.html`, so apps never register it themselves. HTML Pages have no
|
|
11
|
-
* `
|
|
11
|
+
* `paths`, so they receive no Params.
|
|
12
12
|
*/
|
|
13
13
|
export class HtmlPagesPlugin extends IntegrationPlugin {
|
|
14
14
|
renderer = HtmlPageRenderer;
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type * from './types/public-types.js';
|
|
2
2
|
export { eco } from './eco/eco.js';
|
|
3
|
+
export { composeMiddleware, createMiddleware } from './middleware/create-middleware.js';
|
|
3
4
|
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
5
|
export { createViewReference } from './build/server/view-reference.js';
|
|
5
6
|
export { VIEW_REFERENCE, isViewReference } from './types/view-reference.js';
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { eco } from './eco/eco.js';
|
|
2
|
+
export { composeMiddleware, createMiddleware } from './middleware/create-middleware.js';
|
|
2
3
|
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, defineQuery, json, html, redirect, } from './adapters/shared/http/define-api-handler.js';
|
|
3
4
|
export { createViewReference } from './build/server/view-reference.js';
|
|
4
5
|
export { VIEW_REFERENCE, isViewReference } from './types/view-reference.js';
|