@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
|
@@ -655,11 +655,8 @@ export interface ErrorPageTemplateProps extends Omit<HtmlTemplateProps, 'childre
|
|
|
655
655
|
message?: string;
|
|
656
656
|
stack?: string;
|
|
657
657
|
}
|
|
658
|
-
export type Error400TemplateProps = ErrorPageTemplateProps;
|
|
659
|
-
export type Error401TemplateProps = ErrorPageTemplateProps;
|
|
660
658
|
export type Error403TemplateProps = ErrorPageTemplateProps;
|
|
661
659
|
export type Error404TemplateProps = ErrorPageTemplateProps;
|
|
662
|
-
export type Error409TemplateProps = ErrorPageTemplateProps;
|
|
663
660
|
export type Error500TemplateProps = ErrorPageTemplateProps;
|
|
664
661
|
/**
|
|
665
662
|
* Represents the parameters for a page.
|
|
@@ -759,23 +756,6 @@ export type EcoPageFile<T = unknown> = T & {
|
|
|
759
756
|
getMetadata?: GetMetadata;
|
|
760
757
|
cache?: CacheStrategy;
|
|
761
758
|
};
|
|
762
|
-
/**
|
|
763
|
-
* Represents a CSS processor.
|
|
764
|
-
*/
|
|
765
|
-
export interface CssProcessor {
|
|
766
|
-
/**
|
|
767
|
-
* Processes a CSS file at the specified path.
|
|
768
|
-
* @param path - The path to the CSS file.
|
|
769
|
-
* @returns A promise that resolves to the processed CSS as a string.
|
|
770
|
-
*/
|
|
771
|
-
processPath: (path: string, options?: any) => Promise<string>;
|
|
772
|
-
/**
|
|
773
|
-
* Processes a CSS string or buffer.
|
|
774
|
-
* @param contents - The CSS contents as a string or buffer.
|
|
775
|
-
* @returns A promise that resolves to the processed CSS as a string.
|
|
776
|
-
*/
|
|
777
|
-
processStringOrBuffer: (contents: string | Buffer, options?: any) => Promise<string>;
|
|
778
|
-
}
|
|
779
759
|
/**
|
|
780
760
|
* The options for the route renderer.
|
|
781
761
|
*/
|
|
@@ -813,57 +793,6 @@ export type RouteRenderResult = {
|
|
|
813
793
|
/** Source paths observed during render preparation for HTML cache invalidation. */
|
|
814
794
|
sourceDependencyPaths?: readonly string[];
|
|
815
795
|
};
|
|
816
|
-
/**
|
|
817
|
-
* Represents the dependencies required for an integration plugin.
|
|
818
|
-
* It combines the base integration plugin dependencies with specific integration plugin dependencies.
|
|
819
|
-
*/
|
|
820
|
-
export type IntegrationPluginDependencies = BaseIntegrationPluginDependencies & SpecificIntegrationPluginDependencies;
|
|
821
|
-
type BaseIntegrationPluginDependencies = {
|
|
822
|
-
inline?: boolean;
|
|
823
|
-
};
|
|
824
|
-
/**
|
|
825
|
-
* Represents the dependencies required for a specific integration plugin.
|
|
826
|
-
* It can be one of the following types:
|
|
827
|
-
* {@link ScriptImportIntegrationPluginDependencies}
|
|
828
|
-
* {@link ScriptContentIntegrationPluginDependencies}
|
|
829
|
-
* {@link StylesheetImportIntegrationPluginDependencies}
|
|
830
|
-
* {@link StylesheetContentIntegrationPluginDependencies}
|
|
831
|
-
*/
|
|
832
|
-
type SpecificIntegrationPluginDependencies = ScriptImportIntegrationPluginDependencies | ScriptContentIntegrationPluginDependencies | StylesheetImportIntegrationPluginDependencies | StylesheetContentIntegrationPluginDependencies;
|
|
833
|
-
/**
|
|
834
|
-
* Script dependencies for an integration plugin with an import path.
|
|
835
|
-
*/
|
|
836
|
-
type ScriptImportIntegrationPluginDependencies = {
|
|
837
|
-
kind: 'script';
|
|
838
|
-
importPath: string;
|
|
839
|
-
position?: 'head' | 'body';
|
|
840
|
-
/** @default true */
|
|
841
|
-
minify?: boolean;
|
|
842
|
-
};
|
|
843
|
-
/**
|
|
844
|
-
* Script dependencies for an integration plugin with content.
|
|
845
|
-
*/
|
|
846
|
-
type ScriptContentIntegrationPluginDependencies = {
|
|
847
|
-
kind: 'script';
|
|
848
|
-
content: string;
|
|
849
|
-
position?: 'head' | 'body';
|
|
850
|
-
/** @default true */
|
|
851
|
-
minify?: boolean;
|
|
852
|
-
};
|
|
853
|
-
/**
|
|
854
|
-
* Stylesheet dependencies for an integration plugin with an import path.
|
|
855
|
-
*/
|
|
856
|
-
type StylesheetImportIntegrationPluginDependencies = {
|
|
857
|
-
kind: 'stylesheet';
|
|
858
|
-
importPath: string;
|
|
859
|
-
};
|
|
860
|
-
/**
|
|
861
|
-
* Stylesheet dependencies for an integration plugin with content.
|
|
862
|
-
*/
|
|
863
|
-
type StylesheetContentIntegrationPluginDependencies = {
|
|
864
|
-
kind: 'stylesheet';
|
|
865
|
-
content: string;
|
|
866
|
-
};
|
|
867
796
|
/**
|
|
868
797
|
* The options for the integration renderer.
|
|
869
798
|
*/
|
|
@@ -1016,18 +945,6 @@ export interface ComponentRenderResult {
|
|
|
1016
945
|
rootAttributes?: Record<string, string>;
|
|
1017
946
|
assets?: ProcessedAsset[];
|
|
1018
947
|
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Represents a deep required type for a given object
|
|
1021
|
-
*/
|
|
1022
|
-
export type DeepRequired<T> = Required<{
|
|
1023
|
-
[K in keyof T]: T[K] extends Required<T[K]> ? T[K] : DeepRequired<T[K]>;
|
|
1024
|
-
}>;
|
|
1025
|
-
/**
|
|
1026
|
-
* The Prettify helper is a utility type that takes an object type and makes the hover overlay more readable.
|
|
1027
|
-
*/
|
|
1028
|
-
export type Prettify<T> = {
|
|
1029
|
-
[K in keyof T]: T[K];
|
|
1030
|
-
} & {};
|
|
1031
948
|
/**
|
|
1032
949
|
* Services available to API handlers.
|
|
1033
950
|
*/
|
|
@@ -1431,35 +1348,6 @@ export interface RouteSchema {
|
|
|
1431
1348
|
* Helper type to extract inferred types from a schema, with fallback to unknown.
|
|
1432
1349
|
*/
|
|
1433
1350
|
export type InferSchemaOutput<T> = T extends StandardSchema ? InferOutput<T> : unknown;
|
|
1434
|
-
/**
|
|
1435
|
-
* Context with typed body/query/headers based on the provided schema.
|
|
1436
|
-
*/
|
|
1437
|
-
export type TypedApiHandlerContext<TSchema extends RouteSchema, TRequest extends Request = Request, TServer = any> = Omit<ApiHandlerContext<TRequest, TServer>, 'body' | 'query' | 'headers'> & {
|
|
1438
|
-
body: InferSchemaOutput<TSchema['body']>;
|
|
1439
|
-
query: InferSchemaOutput<TSchema['query']>;
|
|
1440
|
-
headers: InferSchemaOutput<TSchema['headers']>;
|
|
1441
|
-
params: InferSchemaOutput<TSchema['params']>;
|
|
1442
|
-
};
|
|
1443
|
-
/**
|
|
1444
|
-
* Options for the group method.
|
|
1445
|
-
*
|
|
1446
|
-
* @typeParam TContext - Extended context type that middleware provides to handlers
|
|
1447
|
-
*
|
|
1448
|
-
* @example Group with auth middleware extending context
|
|
1449
|
-
* ```typescript
|
|
1450
|
-
* type AuthContext = ApiHandlerContext<BunRequest<string>, Server> & { user: User };
|
|
1451
|
-
*
|
|
1452
|
-
* app.group<AuthContext>('/api', (r) => {
|
|
1453
|
-
* r.get('/profile', (ctx) => {
|
|
1454
|
-
* // ctx.user is properly typed!
|
|
1455
|
-
* return ctx.json({ name: ctx.user.name });
|
|
1456
|
-
* });
|
|
1457
|
-
* }, { middleware: [authMiddleware] });
|
|
1458
|
-
* ```
|
|
1459
|
-
*/
|
|
1460
|
-
export interface GroupOptions<TRequest extends Request = Request, TServer = any, TContext extends ApiHandlerContext<TRequest, TServer> = ApiHandlerContext<TRequest, TServer>> {
|
|
1461
|
-
middleware?: Middleware<TRequest, TServer, TContext>[];
|
|
1462
|
-
}
|
|
1463
1351
|
/**
|
|
1464
1352
|
* Context type that combines schema-typed fields with an extended base context.
|
|
1465
1353
|
* Used by RouteGroupBuilder to merge schema validation types with middleware-extended context.
|
|
@@ -68,7 +68,6 @@ export declare class ProjectWatcher {
|
|
|
68
68
|
*/
|
|
69
69
|
private uncacheModules;
|
|
70
70
|
private isRouteSourceFile;
|
|
71
|
-
private isIncludeSourceFile;
|
|
72
71
|
private requestBrowserReload;
|
|
73
72
|
/**
|
|
74
73
|
* Handles public directory file changes by copying only the changed file.
|
|
@@ -120,20 +119,6 @@ export declare class ProjectWatcher {
|
|
|
120
119
|
*/
|
|
121
120
|
private notifyProcessors;
|
|
122
121
|
private getProcessorHandler;
|
|
123
|
-
/**
|
|
124
|
-
* Checks if a file is in the public directory.
|
|
125
|
-
*/
|
|
126
|
-
private isPublicDirFile;
|
|
127
|
-
/**
|
|
128
|
-
* Checks if file path matches any additionalWatchPaths patterns.
|
|
129
|
-
*/
|
|
130
|
-
private matchesAdditionalWatchPaths;
|
|
131
|
-
/**
|
|
132
|
-
* Checks if a file is owned by a processor as an asset input.
|
|
133
|
-
* Ownership requires declared asset capabilities; watch config only drives
|
|
134
|
-
* {@link notifyProcessors} notifications.
|
|
135
|
-
*/
|
|
136
|
-
private isHandledByProcessor;
|
|
137
122
|
/**
|
|
138
123
|
* Triggers router refresh for page directory changes.
|
|
139
124
|
* This ensures the router is updated when pages are added or removed.
|
|
@@ -86,9 +86,6 @@ export class ProjectWatcher {
|
|
|
86
86
|
isRouteSourceFile(filePath) {
|
|
87
87
|
return this.invalidationService.isRouteSourceFile(filePath);
|
|
88
88
|
}
|
|
89
|
-
isIncludeSourceFile(filePath) {
|
|
90
|
-
return this.invalidationService.isIncludeSourceFile(filePath);
|
|
91
|
-
}
|
|
92
89
|
requestBrowserReload() {
|
|
93
90
|
if (this.hostOwnsDevClient) {
|
|
94
91
|
return;
|
|
@@ -254,10 +251,7 @@ export class ProjectWatcher {
|
|
|
254
251
|
await this.handleStandardHmrFileChange(filePath, event, plan, graphPreparation);
|
|
255
252
|
}
|
|
256
253
|
catch (error) {
|
|
257
|
-
|
|
258
|
-
this.bridge.error(error.message);
|
|
259
|
-
this.handleError(error);
|
|
260
|
-
}
|
|
254
|
+
this.handleError(error);
|
|
261
255
|
}
|
|
262
256
|
}
|
|
263
257
|
/**
|
|
@@ -329,26 +323,6 @@ export class ProjectWatcher {
|
|
|
329
323
|
return watchConfig.onDelete;
|
|
330
324
|
}
|
|
331
325
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Checks if a file is in the public directory.
|
|
334
|
-
*/
|
|
335
|
-
isPublicDirFile(filePath) {
|
|
336
|
-
return this.invalidationService.isPublicDirFile(filePath);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Checks if file path matches any additionalWatchPaths patterns.
|
|
340
|
-
*/
|
|
341
|
-
matchesAdditionalWatchPaths(filePath) {
|
|
342
|
-
return this.invalidationService.matchesAdditionalWatchPaths(filePath);
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Checks if a file is owned by a processor as an asset input.
|
|
346
|
-
* Ownership requires declared asset capabilities; watch config only drives
|
|
347
|
-
* {@link notifyProcessors} notifications.
|
|
348
|
-
*/
|
|
349
|
-
isHandledByProcessor(filePath) {
|
|
350
|
-
return this.invalidationService.isProcessorOwnedAsset(filePath);
|
|
351
|
-
}
|
|
352
326
|
/**
|
|
353
327
|
* Triggers router refresh for page directory changes.
|
|
354
328
|
* This ensures the router is updated when pages are added or removed.
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import type { IHmrManager } from '../types/internal-types.js';
|
|
1
|
+
import type { EcoPagesAppConfig, IHmrManager } from '../types/internal-types.js';
|
|
2
2
|
import type { ClientBridge } from '../adapters/bun/client-bridge.js';
|
|
3
3
|
export declare const createMockHmrManager: () => IHmrManager;
|
|
4
4
|
export declare const createMockBridge: () => ClientBridge;
|
|
5
|
+
/**
|
|
6
|
+
* Installs the in-memory entrypoint dependency graph that the HMR managers
|
|
7
|
+
* provide in dev.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* `ConfigBuilder.build()` already installs the invalidation counter and a
|
|
11
|
+
* no-op graph; this swaps in a graph that records dependencies.
|
|
12
|
+
*/
|
|
13
|
+
export declare function installDevRuntimeState(appConfig: EcoPagesAppConfig): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { vi } from 'vitest';
|
|
2
|
+
import { InMemoryEntrypointDependencyGraph, setAppEntrypointDependencyGraph, } from '../services/runtime-state/entrypoint-dependency-graph.service.js';
|
|
2
3
|
export const createMockHmrManager = () => ({
|
|
3
4
|
handleFileChange: vi.fn(async () => { }),
|
|
4
5
|
broadcast: vi.fn(() => { }),
|
|
@@ -45,3 +46,14 @@ export const createMockBridge = () => ({
|
|
|
45
46
|
broadcast: vi.fn(() => { }),
|
|
46
47
|
subscriberCount: 0,
|
|
47
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* Installs the in-memory entrypoint dependency graph that the HMR managers
|
|
51
|
+
* provide in dev.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* `ConfigBuilder.build()` already installs the invalidation counter and a
|
|
55
|
+
* no-op graph; this swaps in a graph that records dependencies.
|
|
56
|
+
*/
|
|
57
|
+
export function installDevRuntimeState(appConfig) {
|
|
58
|
+
setAppEntrypointDependencyGraph(appConfig, new InMemoryEntrypointDependencyGraph());
|
|
59
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the abstract router adapter class and its methods.
|
|
3
|
-
* It is designed to be extended by specific router adapters for different runtimes.
|
|
4
|
-
* The class provides methods for converting paths, creating route handlers,
|
|
5
|
-
* and adapting routes to the expected format of the runtime.
|
|
6
|
-
*
|
|
7
|
-
* @module RouterAdapter
|
|
8
|
-
*/
|
|
9
|
-
import type { Routes } from '../../types/internal-types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Abstract base class for router adapters across different runtimes
|
|
12
|
-
*/
|
|
13
|
-
export declare abstract class AbstractRouterAdapter<TRouteFormat = any> {
|
|
14
|
-
/**
|
|
15
|
-
* Convert a route path to the format expected by the runtime
|
|
16
|
-
*/
|
|
17
|
-
protected abstract convertPath(pathname: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Create a route handler compatible with the runtime
|
|
20
|
-
*/
|
|
21
|
-
protected abstract createRouteHandler(route: any): any;
|
|
22
|
-
/**
|
|
23
|
-
* Adapt framework routes to the format expected by the runtime
|
|
24
|
-
*/
|
|
25
|
-
abstract adaptRoutes(routes: Routes): TRouteFormat;
|
|
26
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the abstract router adapter class and its methods.
|
|
3
|
-
* It is designed to be extended by specific router adapters for different runtimes.
|
|
4
|
-
* The class provides methods for converting paths, creating route handlers,
|
|
5
|
-
* and adapting routes to the expected format of the runtime.
|
|
6
|
-
*
|
|
7
|
-
* @module RouterAdapter
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Abstract base class for router adapters across different runtimes
|
|
11
|
-
*/
|
|
12
|
-
export class AbstractRouterAdapter {
|
|
13
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { BunEcopagesApp, createApp } from './create-app.js';
|
|
2
|
-
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, json, html, redirect, type GroupHandler, } from '../shared/http/define-api-handler.js';
|
package/src/adapters/index.d.ts
DELETED
package/src/adapters/index.js
DELETED
package/src/eco/eco.utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { addTriggerAttribute, isThenable, wrapWithScriptsInjector, } from '../route-renderer/orchestration/foreign-child/foreign-child-output.utils.js';
|
package/src/eco/eco.utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { addTriggerAttribute, isThenable, wrapWithScriptsInjector, } from '../route-renderer/orchestration/foreign-child/foreign-child-output.utils.js';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache services exports
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
export type { CacheConfig, CacheEntry, CacheResult, CacheStats, CacheStore, CacheStrategy, RenderResult, } from './cache.types.js';
|
|
6
|
-
export { MemoryCacheStore, type MemoryCacheStoreOptions } from './memory-cache-store.js';
|
|
7
|
-
export { HtmlPageCacheDependencyIndex } from './html-page-cache-dependency-index.js';
|
|
8
|
-
export { getCacheControlHeader, PageCacheService, type PageCacheServiceOptions } from './page-cache-service.js';
|
|
9
|
-
export { clearAppPageCache, getAppPageCacheService, invalidateAppPageCacheBySourcePaths, registerAppPageCacheService, } from './page-cache-service.js';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache services exports
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
export { MemoryCacheStore } from './memory-cache-store.js';
|
|
6
|
-
export { HtmlPageCacheDependencyIndex } from './html-page-cache-dependency-index.js';
|
|
7
|
-
export { getCacheControlHeader, PageCacheService } from './page-cache-service.js';
|
|
8
|
-
export { clearAppPageCache, getAppPageCacheService, invalidateAppPageCacheBySourcePaths, registerAppPageCacheService, } from './page-cache-service.js';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type HtmlRewriterElement = {
|
|
2
|
-
prepend(content: string, options?: {
|
|
3
|
-
html?: boolean;
|
|
4
|
-
}): void;
|
|
5
|
-
append(content: string, options?: {
|
|
6
|
-
html?: boolean;
|
|
7
|
-
}): void;
|
|
8
|
-
};
|
|
9
|
-
export type HtmlRewriterRuntime = {
|
|
10
|
-
on(selector: 'head' | 'body', handler: {
|
|
11
|
-
element: (element: HtmlRewriterElement) => void;
|
|
12
|
-
}): HtmlRewriterRuntime;
|
|
13
|
-
transform(response: Response): Response;
|
|
14
|
-
};
|
|
15
|
-
export type HtmlRewriterConstructor = new () => HtmlRewriterRuntime;
|
|
16
|
-
export type HtmlRewriterMode = 'auto' | 'native' | 'worker-tools' | 'fallback';
|
|
17
|
-
export interface HtmlRewriterProvider {
|
|
18
|
-
createHtmlRewriter(): Promise<HtmlRewriterRuntime | null>;
|
|
19
|
-
setMode(mode: HtmlRewriterMode): void;
|
|
20
|
-
}
|
|
21
|
-
export interface HtmlRewriterLogger {
|
|
22
|
-
warn(message: string): void;
|
|
23
|
-
}
|
|
24
|
-
export interface DefaultHtmlRewriterProviderOptions {
|
|
25
|
-
mode?: HtmlRewriterMode;
|
|
26
|
-
logger?: HtmlRewriterLogger;
|
|
27
|
-
getNativeHtmlRewriter?: () => HtmlRewriterConstructor | undefined;
|
|
28
|
-
loadWorkerToolsHtmlRewriter?: () => Promise<HtmlRewriterConstructor | null>;
|
|
29
|
-
}
|
|
30
|
-
export declare class DefaultHtmlRewriterProvider implements HtmlRewriterProvider {
|
|
31
|
-
private htmlRewriterConstructorPromise?;
|
|
32
|
-
private htmlRewriterMode;
|
|
33
|
-
private logger;
|
|
34
|
-
private getNativeHtmlRewriter;
|
|
35
|
-
private loadWorkerToolsHtmlRewriter;
|
|
36
|
-
constructor(options?: DefaultHtmlRewriterProviderOptions);
|
|
37
|
-
setMode(mode: HtmlRewriterMode): void;
|
|
38
|
-
createHtmlRewriter(): Promise<HtmlRewriterRuntime | null>;
|
|
39
|
-
private resolveHtmlRewriterConstructor;
|
|
40
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { appLogger } from '../../global/app-logger.js';
|
|
2
|
-
export class DefaultHtmlRewriterProvider {
|
|
3
|
-
htmlRewriterConstructorPromise;
|
|
4
|
-
htmlRewriterMode;
|
|
5
|
-
logger;
|
|
6
|
-
getNativeHtmlRewriter;
|
|
7
|
-
loadWorkerToolsHtmlRewriter;
|
|
8
|
-
constructor(options = {}) {
|
|
9
|
-
this.htmlRewriterMode = options.mode ?? 'auto';
|
|
10
|
-
this.logger = options.logger ?? appLogger;
|
|
11
|
-
this.getNativeHtmlRewriter =
|
|
12
|
-
options.getNativeHtmlRewriter ??
|
|
13
|
-
(() => globalThis.HTMLRewriter);
|
|
14
|
-
this.loadWorkerToolsHtmlRewriter = options.loadWorkerToolsHtmlRewriter ?? loadWorkerToolsHtmlRewriter;
|
|
15
|
-
}
|
|
16
|
-
setMode(mode) {
|
|
17
|
-
this.htmlRewriterMode = mode;
|
|
18
|
-
this.htmlRewriterConstructorPromise = undefined;
|
|
19
|
-
}
|
|
20
|
-
async createHtmlRewriter() {
|
|
21
|
-
const RuntimeHtmlRewriter = await this.resolveHtmlRewriterConstructor();
|
|
22
|
-
return RuntimeHtmlRewriter ? new RuntimeHtmlRewriter() : null;
|
|
23
|
-
}
|
|
24
|
-
async resolveHtmlRewriterConstructor() {
|
|
25
|
-
if (!this.htmlRewriterConstructorPromise) {
|
|
26
|
-
const mode = this.htmlRewriterMode;
|
|
27
|
-
const RuntimeHtmlRewriter = this.getNativeHtmlRewriter();
|
|
28
|
-
if (mode === 'fallback') {
|
|
29
|
-
this.htmlRewriterConstructorPromise = Promise.resolve(null);
|
|
30
|
-
}
|
|
31
|
-
else if (mode === 'native') {
|
|
32
|
-
if (RuntimeHtmlRewriter) {
|
|
33
|
-
this.htmlRewriterConstructorPromise = Promise.resolve(RuntimeHtmlRewriter);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.logger.warn('[HtmlTransformerService] Native HTMLRewriter was forced but is unavailable, falling back to string injection.');
|
|
37
|
-
this.htmlRewriterConstructorPromise = Promise.resolve(null);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else if (mode === 'auto' && RuntimeHtmlRewriter) {
|
|
41
|
-
this.htmlRewriterConstructorPromise = Promise.resolve(RuntimeHtmlRewriter);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.htmlRewriterConstructorPromise = this.loadWorkerToolsHtmlRewriter();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return this.htmlRewriterConstructorPromise;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function loadWorkerToolsHtmlRewriter() {
|
|
51
|
-
try {
|
|
52
|
-
const module = await import('@worker-tools/html-rewriter/base64');
|
|
53
|
-
return module.HTMLRewriter;
|
|
54
|
-
}
|
|
55
|
-
catch (primaryError) {
|
|
56
|
-
try {
|
|
57
|
-
const runtimeLocalModule = await import(
|
|
58
|
-
/* @vite-ignore */ new URL('../node_modules/@worker-tools/html-rewriter/base64.js', import.meta.url)
|
|
59
|
-
.href);
|
|
60
|
-
return runtimeLocalModule.HTMLRewriter;
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
const message = primaryError instanceof Error ? primaryError.message : String(primaryError);
|
|
64
|
-
appLogger.warn(`[HtmlTransformerService] Failed to load @worker-tools/html-rewriter/base64, falling back to string injection: ${message}`);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { RouteModuleDependencyHashes } from './route-module-dependency-hasher.js';
|
|
2
|
-
export { ROUTE_MODULE_BUILD_CACHE_FILENAME, createEmptyRouteModuleBuildCacheManifest, createPersistedRouteModuleBuildKey, createPluginCacheKey, createJsxCacheKey, hashPluginSetup, getCorePackageVersion, normalizeRouteModuleCachePath, readRouteModuleBuildCacheManifest, resolvePageModuleOutputFileName, shouldPersistRouteModuleBuildCache, writeRouteModuleBuildCacheManifest, type RouteModuleBuildCacheEntry, type RouteModuleBuildCacheLookup, type RouteModuleBuildCacheManifest, type RouteModuleStaticRenderCacheContext, type RouteModuleStaticRenderCacheEntry, } from './route-module-build-manifest.js';
|
|
3
|
-
export { RouteModuleBuildCache } from './route-module-build-cache.store.js';
|
|
4
|
-
export { getRouteModuleBuildCacheOutdir, getServerModuleBuildCacheOutdir, getSharedRouteModuleBuildCache, } from './route-module-build-cache-registry.js';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { ROUTE_MODULE_BUILD_CACHE_FILENAME, createEmptyRouteModuleBuildCacheManifest, createPersistedRouteModuleBuildKey, createPluginCacheKey, createJsxCacheKey, hashPluginSetup, getCorePackageVersion, normalizeRouteModuleCachePath, readRouteModuleBuildCacheManifest, resolvePageModuleOutputFileName, shouldPersistRouteModuleBuildCache, writeRouteModuleBuildCacheManifest, } from './route-module-build-manifest.js';
|
|
2
|
-
export { RouteModuleBuildCache } from './route-module-build-cache.store.js';
|
|
3
|
-
export { getRouteModuleBuildCacheOutdir, getServerModuleBuildCacheOutdir, getSharedRouteModuleBuildCache, } from './route-module-build-cache-registry.js';
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
2
|
-
import { type ServerInvalidationState } from './server-invalidation-state.service.js';
|
|
3
|
-
import { type EntrypointDependencyGraph } from './entrypoint-dependency-graph.service.js';
|
|
4
|
-
/**
|
|
5
|
-
* Tracks development-time dependency relationships and invalidation state for
|
|
6
|
-
* one Ecopages app instance.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* The current contract stays intentionally small. It supports today's needs for
|
|
10
|
-
* server-module cache invalidation and entrypoint-to-dependency lookups without
|
|
11
|
-
* forcing the rest of the runtime to know about one specific graph
|
|
12
|
-
* implementation.
|
|
13
|
-
*/
|
|
14
|
-
export interface DevGraphService extends ServerInvalidationState, EntrypointDependencyGraph {
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Minimal dev-graph implementation used when an app has no selective graph
|
|
18
|
-
* metadata available.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* This preserves correct behavior by using coarse invalidation version bumps.
|
|
22
|
-
* Callers still pass changed-file information through the interface now so a
|
|
23
|
-
* richer graph can become more selective later without changing call sites.
|
|
24
|
-
*/
|
|
25
|
-
export declare class NoopDevGraphService implements DevGraphService {
|
|
26
|
-
private readonly invalidationState;
|
|
27
|
-
private readonly dependencyGraph;
|
|
28
|
-
/**
|
|
29
|
-
* Returns the current coarse invalidation version.
|
|
30
|
-
*/
|
|
31
|
-
getServerInvalidationVersion(): number;
|
|
32
|
-
/**
|
|
33
|
-
* Invalidates all server-side module state by incrementing the shared version.
|
|
34
|
-
*/
|
|
35
|
-
invalidateServerModules(changedFiles?: string[]): void;
|
|
36
|
-
/**
|
|
37
|
-
* Indicates that this graph cannot target invalidation to one entrypoint set.
|
|
38
|
-
*/
|
|
39
|
-
supportsSelectiveInvalidation(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Returns an empty entrypoint set because this implementation stores no
|
|
42
|
-
* dependency graph metadata.
|
|
43
|
-
*/
|
|
44
|
-
getDependencyEntrypoints(filePath: string): Set<string>;
|
|
45
|
-
/**
|
|
46
|
-
* Accepts dependency updates to preserve interface compatibility, but stores no
|
|
47
|
-
* graph state in the noop implementation.
|
|
48
|
-
*/
|
|
49
|
-
setEntrypointDependencies(entrypointPath: string, dependencies: string[]): void;
|
|
50
|
-
/**
|
|
51
|
-
* Clears one entrypoint from the graph.
|
|
52
|
-
*
|
|
53
|
-
* @remarks
|
|
54
|
-
* There is no stored graph state in this implementation, so this is a no-op.
|
|
55
|
-
*/
|
|
56
|
-
clearEntrypointDependencies(entrypointPath: string): void;
|
|
57
|
-
/**
|
|
58
|
-
* Resets graph-owned state for a fresh runtime cycle.
|
|
59
|
-
*/
|
|
60
|
-
reset(): void;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* In-memory development graph with entrypoint-to-dependency reverse lookups.
|
|
64
|
-
*
|
|
65
|
-
* @remarks
|
|
66
|
-
* This is the current selective graph implementation used by development flows
|
|
67
|
-
* that need to answer which entrypoints depend on a changed file while still
|
|
68
|
-
* keeping invalidation state app-local.
|
|
69
|
-
*/
|
|
70
|
-
export declare class InMemoryDevGraphService implements DevGraphService {
|
|
71
|
-
private readonly invalidationState;
|
|
72
|
-
private readonly dependencyGraph;
|
|
73
|
-
/**
|
|
74
|
-
* Returns the current app-local server invalidation version.
|
|
75
|
-
*/
|
|
76
|
-
getServerInvalidationVersion(): number;
|
|
77
|
-
/**
|
|
78
|
-
* Invalidates the current server-module cache generation.
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
81
|
-
* The current implementation still uses a coarse generation bump for server
|
|
82
|
-
* modules. Selective dependency lookups are used by callers that need to limit
|
|
83
|
-
* browser rebuild work.
|
|
84
|
-
*/
|
|
85
|
-
invalidateServerModules(changedFiles?: string[]): void;
|
|
86
|
-
/**
|
|
87
|
-
* Indicates that this graph can answer dependency-to-entrypoint lookups.
|
|
88
|
-
*/
|
|
89
|
-
supportsSelectiveInvalidation(): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Returns all known entrypoints that currently depend on the given file.
|
|
92
|
-
*/
|
|
93
|
-
getDependencyEntrypoints(filePath: string): Set<string>;
|
|
94
|
-
/**
|
|
95
|
-
* Replaces the stored dependency set for one entrypoint.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* The entrypoint itself is always included in its own dependency set so reverse
|
|
99
|
-
* lookups can map a changed entry file back to that same entrypoint.
|
|
100
|
-
*/
|
|
101
|
-
setEntrypointDependencies(entrypointPath: string, dependencies: string[]): void;
|
|
102
|
-
/**
|
|
103
|
-
* Removes one entrypoint and all of its reverse dependency edges.
|
|
104
|
-
*/
|
|
105
|
-
clearEntrypointDependencies(entrypointPath: string): void;
|
|
106
|
-
/**
|
|
107
|
-
* Clears all graph state and starts a fresh invalidation generation.
|
|
108
|
-
*/
|
|
109
|
-
reset(): void;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Returns the dev-graph service owned by one app instance.
|
|
113
|
-
*/
|
|
114
|
-
export declare function getAppDevGraphService(appConfig: EcoPagesAppConfig): DevGraphService;
|
|
115
|
-
/**
|
|
116
|
-
* Installs the dev-graph service that should back one app/runtime instance.
|
|
117
|
-
*/
|
|
118
|
-
export declare function setAppDevGraphService(appConfig: EcoPagesAppConfig, devGraphService: DevGraphService): void;
|