@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
|
@@ -35,10 +35,5 @@ export type DefaultErrorPageDetails = {
|
|
|
35
35
|
* button. 4xx pages never serialize a stack.
|
|
36
36
|
*/
|
|
37
37
|
export declare function buildDefaultErrorHtml(status: number, details?: DefaultErrorPageDetails): string;
|
|
38
|
-
|
|
39
|
-
export declare function buildDefaultNotFoundHtml(): string;
|
|
40
|
-
export type DefaultServerErrorDetails = DefaultErrorPageDetails;
|
|
41
|
-
export declare function getDefaultServerErrorDetails(error: unknown): DefaultServerErrorDetails | undefined;
|
|
38
|
+
export declare function getDefaultServerErrorDetails(error: unknown): DefaultErrorPageDetails | undefined;
|
|
42
39
|
export declare function getPublicErrorMessage(error: unknown): string | undefined;
|
|
43
|
-
/** Self-contained HTML for the framework default server-error response. */
|
|
44
|
-
export declare function buildDefaultServerErrorHtml(details?: DefaultServerErrorDetails): string;
|
|
@@ -181,10 +181,6 @@ export function buildDefaultErrorHtml(status, details) {
|
|
|
181
181
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escapeHtml(view.title)}</title><style>${sharedStyles}</style></head>
|
|
182
182
|
<body class="${names.root} ${view.modifierClass}"><main class="${names.content}"><p class="${names.status}" aria-hidden="true">ERROR ${view.status}</p><h1 class="${names.title}">${escapeHtml(view.title)}</h1><p class="${names.message}">${escapeHtml(view.bodyMessage)}</p>${detailsBlock}</main></body></html>`;
|
|
183
183
|
}
|
|
184
|
-
/** Self-contained HTML for the framework default not-found response. */
|
|
185
|
-
export function buildDefaultNotFoundHtml() {
|
|
186
|
-
return buildDefaultErrorHtml(404);
|
|
187
|
-
}
|
|
188
184
|
export function getDefaultServerErrorDetails(error) {
|
|
189
185
|
if (!isDevelopmentRuntime() || error === undefined) {
|
|
190
186
|
return undefined;
|
|
@@ -201,7 +197,3 @@ export function getPublicErrorMessage(error) {
|
|
|
201
197
|
}
|
|
202
198
|
return undefined;
|
|
203
199
|
}
|
|
204
|
-
/** Self-contained HTML for the framework default server-error response. */
|
|
205
|
-
export function buildDefaultServerErrorHtml(details) {
|
|
206
|
-
return buildDefaultErrorHtml(500, details);
|
|
207
|
-
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type HtmlContentOptions = {
|
|
2
|
+
/** Insert `content` as raw markup. Otherwise it is inserted as escaped text. */
|
|
3
|
+
html?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Element passed to {@link HtmlRewriterElementHandlers.element}; a subset of Bun's
|
|
7
|
+
* `HTMLRewriter` element API.
|
|
8
|
+
*/
|
|
9
|
+
export interface HtmlRewriterElement {
|
|
10
|
+
/** Lowercased tag name. */
|
|
11
|
+
readonly tagName: string;
|
|
12
|
+
/** Attribute name/value pairs, names lowercased. */
|
|
13
|
+
readonly attributes: IterableIterator<[string, string]>;
|
|
14
|
+
readonly selfClosing: boolean;
|
|
15
|
+
/** `false` for void elements (and self-closing foreign elements), which ignore `prepend`/`append`. */
|
|
16
|
+
readonly canHaveContent: boolean;
|
|
17
|
+
getAttribute(name: string): string | null;
|
|
18
|
+
hasAttribute(name: string): boolean;
|
|
19
|
+
setAttribute(name: string, value: string): HtmlRewriterElement;
|
|
20
|
+
removeAttribute(name: string): HtmlRewriterElement;
|
|
21
|
+
before(content: string, options?: HtmlContentOptions): HtmlRewriterElement;
|
|
22
|
+
/** Inserts right after the start tag; repeated calls insert in reverse call order. */
|
|
23
|
+
prepend(content: string, options?: HtmlContentOptions): HtmlRewriterElement;
|
|
24
|
+
/** Inserts right before the end tag; dropped when the element never closes. */
|
|
25
|
+
append(content: string, options?: HtmlContentOptions): HtmlRewriterElement;
|
|
26
|
+
/** Inserts after the end tag in reverse call order; dropped when the element never closes. */
|
|
27
|
+
after(content: string, options?: HtmlContentOptions): HtmlRewriterElement;
|
|
28
|
+
}
|
|
29
|
+
export interface HtmlRewriterElementHandlers {
|
|
30
|
+
element?(element: HtmlRewriterElement): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Streaming HTML rewriter implementing the subset of Bun's `HTMLRewriter` API that
|
|
34
|
+
* Ecopages uses, so the same rewrite runs on Bun and Node without a wasm build of
|
|
35
|
+
* lol-html.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Supported selectors are tag names and `*`; anything else throws so an
|
|
39
|
+
* unsupported selector never silently matches nothing. Handlers are synchronous.
|
|
40
|
+
*
|
|
41
|
+
* Output follows lol-html (checked against Bun's native `HTMLRewriter`) on the
|
|
42
|
+
* behaviour Ecopages relies on: comments, doctypes and the content of raw-text
|
|
43
|
+
* elements (`script` with its escape states, `style`, `textarea`, `title`,
|
|
44
|
+
* `noscript`, `iframe`, `xmp`, `noembed`, `noframes`, `plaintext`) never produce
|
|
45
|
+
* tags; `>` inside quoted attribute values does not end a tag; tag matching is
|
|
46
|
+
* case-insensitive; untouched attributes keep their original text.
|
|
47
|
+
*
|
|
48
|
+
* There is no tree construction. An end tag closes the nearest open element with
|
|
49
|
+
* the same name, and `append`/`after` content of elements that it closes
|
|
50
|
+
* implicitly, or that are still open at the end of the document, is dropped.
|
|
51
|
+
*/
|
|
52
|
+
export declare class HtmlRewriter {
|
|
53
|
+
private readonly handlers;
|
|
54
|
+
on(selector: string, handlers: HtmlRewriterElementHandlers): this;
|
|
55
|
+
transform(input: string): string;
|
|
56
|
+
transform(input: Response): Response;
|
|
57
|
+
}
|
|
58
|
+
/** Attribute access on the element passed to {@link rewriteFirstElement}. */
|
|
59
|
+
export type HtmlRewriterAttributeTarget = Pick<HtmlRewriterElement, 'tagName' | 'attributes' | 'getAttribute' | 'hasAttribute' | 'setAttribute' | 'removeAttribute'>;
|
|
60
|
+
/**
|
|
61
|
+
* Rewrites the attributes of the first start tag that `isTarget` accepts and
|
|
62
|
+
* returns the rest of `html` unchanged.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Uses the same tokenizer as {@link HtmlRewriter}, so tags inside comments, raw
|
|
66
|
+
* text and quoted attribute values never match. Scanning stops once the target
|
|
67
|
+
* is rewritten, so the cost grows with the markup before the target rather than
|
|
68
|
+
* with the whole document. Only attribute changes are offered: content placed
|
|
69
|
+
* with `append` or `after` needs the element's end tag, which is never reached.
|
|
70
|
+
*
|
|
71
|
+
* With `leadingOnly`, the target must directly follow the previous start tag
|
|
72
|
+
* (or the start of `html`), whitespace aside. When text, a comment or an end tag
|
|
73
|
+
* comes first, scanning stops and nothing is rewritten.
|
|
74
|
+
*/
|
|
75
|
+
export declare function rewriteFirstElement(html: string, isTarget: (element: HtmlRewriterAttributeTarget) => boolean, rewrite: (element: HtmlRewriterAttributeTarget) => void, options?: {
|
|
76
|
+
leadingOnly?: boolean;
|
|
77
|
+
}): string;
|