@ecopages/core 0.2.0-rc.10 → 0.2.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -9
- package/package.json +3 -152
- package/src/adapters/README.md +8 -2
- package/src/adapters/abstract/application-adapter.d.ts +6 -32
- package/src/adapters/abstract/application-adapter.js +6 -45
- package/src/adapters/abstract/ws-pattern-matcher.d.ts +0 -5
- package/src/adapters/abstract/ws-pattern-matcher.js +0 -9
- package/src/adapters/bun/create-app.d.ts +8 -12
- package/src/adapters/bun/create-app.js +13 -55
- package/src/adapters/bun/hmr-manager.d.ts +0 -1
- package/src/adapters/bun/hmr-manager.js +2 -4
- package/src/adapters/bun/server-adapter.d.ts +9 -19
- package/src/adapters/bun/server-adapter.js +19 -66
- package/src/adapters/bun/static-preview-host.d.ts +1 -0
- package/src/adapters/bun/static-preview-host.js +1 -1
- package/src/adapters/create-app.d.ts +1 -1
- package/src/adapters/create-app.js +2 -1
- package/src/adapters/node/create-app.d.ts +4 -8
- package/src/adapters/node/create-app.js +7 -12
- package/src/adapters/node/runtime-host.d.ts +10 -10
- package/src/adapters/node/runtime-host.js +4 -4
- package/src/adapters/node/server-adapter-dependencies.d.ts +2 -10
- package/src/adapters/node/server-adapter-dependencies.js +8 -13
- package/src/adapters/node/server-adapter.d.ts +25 -31
- package/src/adapters/node/server-adapter.js +43 -64
- package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +0 -4
- package/src/adapters/shared/hmr/shared-hmr-manager.js +0 -12
- package/src/adapters/shared/http/api-request-pipeline.d.ts +27 -1
- package/src/adapters/shared/http/api-request-pipeline.js +31 -16
- package/src/adapters/shared/http/fs-server-response-factory.d.ts +0 -1
- package/src/adapters/shared/http/fs-server-response-factory.js +0 -3
- package/src/adapters/shared/runtime/collect-dev-prewarm-plan.d.ts +1 -3
- package/src/adapters/shared/runtime/collect-dev-prewarm-plan.js +1 -4
- package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +0 -10
- package/src/adapters/shared/runtime/runtime-app-bootstrap.js +0 -7
- package/src/adapters/shared/runtime/runtime-host.d.ts +5 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +1 -1
- package/src/adapters/shared/runtime/server-adapter.d.ts +13 -0
- package/src/adapters/shared/runtime/server-adapter.js +22 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +9 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +8 -2
- package/src/build/README.md +5 -6
- package/src/build/cache/cache-constants.d.ts +0 -2
- package/src/build/cache/cache-constants.js +0 -2
- package/src/build/cache/cache-keys.d.ts +0 -2
- package/src/build/cache/cache-keys.js +0 -2
- package/src/build/cache/output-imports.d.ts +35 -0
- package/src/build/cache/output-imports.js +87 -0
- package/src/build/cache/pages-unified-graph-build.d.ts +6 -1
- package/src/build/cache/pages-unified-graph-build.js +49 -18
- package/src/build/cache/production-build-cache.d.ts +2 -2
- package/src/build/cache/production-build-cache.js +2 -2
- package/src/build/cache/server-entry-build-cache.d.ts +1 -2
- package/src/build/cache/server-entry-build-cache.js +4 -5
- package/src/build/contracts/build-contracts.d.ts +1 -13
- package/src/build/rolldown/runtime-build-output-normalizer.js +3 -6
- package/src/build/runtime/build-request-identity.d.ts +2 -6
- package/src/build/runtime/build-request-identity.js +2 -8
- package/src/build/runtime/deduping-build-executor.d.ts +0 -1
- package/src/build/runtime/deduping-build-executor.js +0 -1
- package/src/cache/index.d.ts +1 -1
- package/src/cache/index.js +1 -1
- package/src/cache/module-parse-cache.d.ts +2 -29
- package/src/cache/module-parse-cache.js +6 -39
- package/src/config/README.md +3 -3
- package/src/config/apply-user-config.d.ts +3 -1
- package/src/config/apply-user-config.js +3 -2
- package/src/config/config-builder.d.ts +1 -0
- package/src/config/config-builder.js +2 -2
- package/src/config/constants.d.ts +0 -4
- package/src/config/constants.js +0 -4
- package/src/config/index.d.ts +1 -1
- package/src/config/index.js +1 -1
- package/src/config/load-eco-config.d.ts +1 -1
- package/src/config/load-eco-config.js +18 -11
- package/src/config/resolve-eco-config-path.d.ts +9 -0
- package/src/config/resolve-eco-config-path.js +11 -0
- package/src/config/server-config-bundle.js +2 -2
- package/src/config/user-config-types.d.ts +9 -3
- package/src/dev/host-runtime.d.ts +0 -1
- package/src/dev/host-runtime.js +0 -3
- package/src/dev/sc-server.d.ts +4 -1
- package/src/dev/sc-server.js +11 -20
- package/src/dev/transform-server/dev-transform-import-rewriter.js +2 -2
- package/src/hmr/hmr-file-change-prep.d.ts +0 -1
- package/src/hmr/hmr-file-change-prep.js +2 -5
- package/src/hmr/hmr-strategy.d.ts +3 -8
- package/src/hmr/hmr-strategy.js +3 -8
- package/src/index.browser.d.ts +1 -2
- package/src/index.browser.js +1 -2
- package/src/index.d.ts +5 -6
- package/src/index.js +5 -6
- package/src/islands/island-host.d.ts +0 -9
- package/src/islands/island-host.js +1 -13
- package/src/plugins/component-import-discovery.js +2 -2
- package/src/plugins/eco-component-meta-plugin.js +5 -5
- package/src/plugins/integration-plugin.d.ts +0 -1
- package/src/plugins/integration-plugin.js +0 -4
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +1 -4
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +25 -24
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +18 -20
- package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -7
- package/src/route-renderer/orchestration/integration-renderer.js +44 -33
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
- package/src/services/README.md +1 -1
- package/src/services/assets/browser-bundle.service.d.ts +1 -6
- package/src/services/error-pages/default-error-pages.d.ts +1 -6
- package/src/services/error-pages/default-error-pages.js +0 -8
- package/src/services/html/html-rewriter.d.ts +77 -0
- package/src/services/html/html-rewriter.js +751 -0
- package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
- package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
- package/src/services/html/html-transformer.service.d.ts +29 -42
- package/src/services/html/html-transformer.service.js +85 -157
- package/src/services/invalidation/development-invalidation.service.d.ts +2 -19
- package/src/services/invalidation/development-invalidation.service.js +1 -39
- package/src/services/module-loading/README.md +1 -1
- package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
- package/src/services/module-loading/app-server-module-transpiler.service.js +0 -10
- package/src/services/module-loading/collection-server-module-build.service.d.ts +0 -1
- package/src/services/module-loading/collection-server-module-build.service.js +0 -3
- package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
- package/src/services/module-loading/host-module-loader-registry.js +0 -3
- package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
- package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
- package/src/services/module-loading/route-module-build-cache.store.d.ts +3 -0
- package/src/services/module-loading/route-module-build-cache.store.js +20 -5
- package/src/services/module-loading/route-module-build-manifest.d.ts +12 -1
- package/src/services/module-loading/route-module-build-manifest.js +7 -3
- package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
- package/src/services/module-loading/server-module-transpiler.service.js +0 -24
- package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
- package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
- package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
- package/src/types/internal-types.d.ts +0 -38
- package/src/types/public-types.d.ts +0 -112
- package/src/watchers/project-watcher.d.ts +0 -15
- package/src/watchers/project-watcher.js +1 -27
- package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
- package/src/watchers/project-watcher.test-helpers.js +12 -0
- package/src/adapters/abstract/router-adapter.d.ts +0 -26
- package/src/adapters/abstract/router-adapter.js +0 -13
- package/src/adapters/bun/index.d.ts +0 -2
- package/src/adapters/bun/index.js +0 -2
- package/src/adapters/index.d.ts +0 -2
- package/src/adapters/index.js +0 -2
- package/src/eco/eco.utils.d.ts +0 -1
- package/src/eco/eco.utils.js +0 -1
- package/src/services/cache/index.d.ts +0 -9
- package/src/services/cache/index.js +0 -8
- package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
- package/src/services/html/html-rewriter-provider.service.js +0 -68
- package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
- package/src/services/module-loading/route-module-build-cache.js +0 -3
- package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
- package/src/services/runtime-state/dev-graph.service.js +0 -170
package/src/cache/index.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @ecopages/core/cache
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
6
|
+
export { parseModuleSource } from './module-parse-cache.js';
|
|
7
7
|
export { recordModuleTransformProfile } from './module-transform-profiler.js';
|
|
@@ -22,22 +22,17 @@ export type ModuleParseOptions = ParserOptions & {
|
|
|
22
22
|
*/
|
|
23
23
|
lang?: ParserOptions['lang'];
|
|
24
24
|
};
|
|
25
|
-
export type ParserLanguage = 'js' | 'jsx' | 'ts' | 'tsx';
|
|
26
|
-
/** Resolves the Oxc dialect for a source module from its file extension. */
|
|
27
|
-
export declare function parserLanguageForFile(filePath: string): ParserLanguage;
|
|
28
25
|
/** Parses an ECMAScript module with the shared, normalized cache contract. */
|
|
29
26
|
export declare function parseModuleSource(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
|
|
30
27
|
/**
|
|
31
28
|
* LRU-bounded module parse cache.
|
|
32
29
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* One instance is shared across the process; call {@link parseModuleSource}
|
|
31
|
+
* to use it.
|
|
35
32
|
*/
|
|
36
33
|
export declare class ModuleParseCache {
|
|
37
34
|
private readonly entries;
|
|
38
35
|
private readonly maxEntries;
|
|
39
|
-
private hits;
|
|
40
|
-
private misses;
|
|
41
36
|
constructor(maxEntries?: number);
|
|
42
37
|
/**
|
|
43
38
|
* Parse `source` for `filePath`, memoizing by (filePath, source, options).
|
|
@@ -45,26 +40,4 @@ export declare class ModuleParseCache {
|
|
|
45
40
|
* @returns the {@link ParseResult} from `oxc-parser.parseSync`.
|
|
46
41
|
*/
|
|
47
42
|
getOrParse(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
|
|
48
|
-
/** Clear all cached entries. Useful in tests and on full-rebuild signals. */
|
|
49
|
-
clear(): void;
|
|
50
|
-
/** Current cache size (for observability). */
|
|
51
|
-
get size(): number;
|
|
52
|
-
/** Cumulative hit/miss counters (for observability). */
|
|
53
|
-
stats(): {
|
|
54
|
-
hits: number;
|
|
55
|
-
misses: number;
|
|
56
|
-
size: number;
|
|
57
|
-
hitRate: number;
|
|
58
|
-
};
|
|
59
43
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Default shared cache. Use this from plugin code so the cache is
|
|
62
|
-
* amortized across plugins and build invocations.
|
|
63
|
-
*/
|
|
64
|
-
export declare const moduleParseCache: ModuleParseCache;
|
|
65
|
-
/**
|
|
66
|
-
* Drop-in replacement for `oxc-parser.parseSync` that uses the shared
|
|
67
|
-
* {@link moduleParseCache}. Use everywhere we currently call `parseSync`
|
|
68
|
-
* on user/source files during a build.
|
|
69
|
-
*/
|
|
70
|
-
export declare function cachedParseSync(filePath: string, source: string, options?: ModuleParseOptions): ParseResult;
|
|
@@ -18,7 +18,7 @@ import { parseSync } from 'oxc-parser';
|
|
|
18
18
|
import { rapidhash } from '../utils/hash.js';
|
|
19
19
|
const DEFAULT_MAX_ENTRIES = 10_000;
|
|
20
20
|
/** Resolves the Oxc dialect for a source module from its file extension. */
|
|
21
|
-
|
|
21
|
+
function parserLanguageForFile(filePath) {
|
|
22
22
|
const extension = extname(filePath).toLowerCase();
|
|
23
23
|
if (extension === '.tsx')
|
|
24
24
|
return 'tsx';
|
|
@@ -30,19 +30,17 @@ export function parserLanguageForFile(filePath) {
|
|
|
30
30
|
}
|
|
31
31
|
/** Parses an ECMAScript module with the shared, normalized cache contract. */
|
|
32
32
|
export function parseModuleSource(filePath, source, options = {}) {
|
|
33
|
-
return moduleParseCache.getOrParse(filePath, source,
|
|
33
|
+
return moduleParseCache.getOrParse(filePath, source, options);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* LRU-bounded module parse cache.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* One instance is shared across the process; call {@link parseModuleSource}
|
|
39
|
+
* to use it.
|
|
40
40
|
*/
|
|
41
41
|
export class ModuleParseCache {
|
|
42
42
|
entries = new Map();
|
|
43
43
|
maxEntries;
|
|
44
|
-
hits = 0;
|
|
45
|
-
misses = 0;
|
|
46
44
|
constructor(maxEntries = DEFAULT_MAX_ENTRIES) {
|
|
47
45
|
if (maxEntries <= 0) {
|
|
48
46
|
throw new Error(`ModuleParseCache: maxEntries must be > 0, got ${maxEntries}`);
|
|
@@ -60,13 +58,11 @@ export class ModuleParseCache {
|
|
|
60
58
|
const key = makeKey(filePath, hash, normalizedOptions);
|
|
61
59
|
const existing = this.entries.get(key);
|
|
62
60
|
if (existing && existing.hash === hash) {
|
|
63
|
-
this.hits += 1;
|
|
64
61
|
// Refresh LRU position.
|
|
65
62
|
this.entries.delete(key);
|
|
66
63
|
this.entries.set(key, existing);
|
|
67
64
|
return existing.result;
|
|
68
65
|
}
|
|
69
|
-
this.misses += 1;
|
|
70
66
|
const result = parseSync(filePath, source, normalizedOptions);
|
|
71
67
|
this.entries.set(key, { hash, result });
|
|
72
68
|
if (this.entries.size > this.maxEntries) {
|
|
@@ -80,40 +76,11 @@ export class ModuleParseCache {
|
|
|
80
76
|
}
|
|
81
77
|
return result;
|
|
82
78
|
}
|
|
83
|
-
/** Clear all cached entries. Useful in tests and on full-rebuild signals. */
|
|
84
|
-
clear() {
|
|
85
|
-
this.entries.clear();
|
|
86
|
-
this.hits = 0;
|
|
87
|
-
this.misses = 0;
|
|
88
|
-
}
|
|
89
|
-
/** Current cache size (for observability). */
|
|
90
|
-
get size() {
|
|
91
|
-
return this.entries.size;
|
|
92
|
-
}
|
|
93
|
-
/** Cumulative hit/miss counters (for observability). */
|
|
94
|
-
stats() {
|
|
95
|
-
const total = this.hits + this.misses;
|
|
96
|
-
return {
|
|
97
|
-
hits: this.hits,
|
|
98
|
-
misses: this.misses,
|
|
99
|
-
size: this.entries.size,
|
|
100
|
-
hitRate: total === 0 ? 0 : this.hits / total,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
79
|
}
|
|
104
80
|
/**
|
|
105
|
-
* Default shared cache
|
|
106
|
-
* amortized across plugins and build invocations.
|
|
81
|
+
* Default shared cache, amortized across plugins and build invocations.
|
|
107
82
|
*/
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Drop-in replacement for `oxc-parser.parseSync` that uses the shared
|
|
111
|
-
* {@link moduleParseCache}. Use everywhere we currently call `parseSync`
|
|
112
|
-
* on user/source files during a build.
|
|
113
|
-
*/
|
|
114
|
-
export function cachedParseSync(filePath, source, options = {}) {
|
|
115
|
-
return parseModuleSource(filePath, source, options);
|
|
116
|
-
}
|
|
83
|
+
const moduleParseCache = new ModuleParseCache();
|
|
117
84
|
function normalizeModuleParseOptions(filePath, options) {
|
|
118
85
|
return {
|
|
119
86
|
...options,
|
package/src/config/README.md
CHANGED
|
@@ -19,8 +19,8 @@ It is responsible for:
|
|
|
19
19
|
## Main Files
|
|
20
20
|
|
|
21
21
|
- `define-config.ts`: synchronous `defineConfig()` identity for `eco.config.ts` authoring
|
|
22
|
-
- `load-eco-config.ts`: resolves the config module path, loads user config, and finalizes through `ConfigBuilder`
|
|
23
|
-
- `resolve-eco-config-path.ts`: `eco.config.ts` discovery (`configFile`, `ECOPAGES_CONFIG_FILE`, cwd default, and production `.server/eco.config.mjs`)
|
|
22
|
+
- `load-eco-config.ts`: resolves the config module path, loads user config, and finalizes through `ConfigBuilder` (omitted `rootDir` defaults to `cwd`; `baseUrl` defaults during `ConfigBuilder.build()`)
|
|
23
|
+
- `resolve-eco-config-path.ts`: `eco.config.ts` discovery (`configFile`, `ECOPAGES_CONFIG_FILE`, cwd default, and production `.server/eco.config.mjs`) and `resolveUserConfigRootDir()`
|
|
24
24
|
- `apply-user-config.ts`: maps declarative `EcoPagesUserConfig` fields onto `ConfigBuilder`
|
|
25
25
|
- `is-finalized-app-config.ts`: detects leftover `ConfigBuilder.build()` exports so `loadEcoPagesConfig()` can reuse them
|
|
26
26
|
- `user-config-types.ts`: TypeScript contracts for `EcoPagesUserConfig` and config loader options
|
|
@@ -47,5 +47,5 @@ That built config is then consumed by server adapters, static generation, route
|
|
|
47
47
|
|
|
48
48
|
- Production apps call `createApp()` (loads `eco.config.ts`) or pass `appConfig`, `userConfig`, or `configFile` explicitly.
|
|
49
49
|
- In development (`--dev`), adding, changing, or removing the resolved `eco.config` module or a supported project `.env` file triggers a supervised process restart (not in-process reload). The CLI re-merges dotenv files on respawn.
|
|
50
|
-
- `@ecopages/testing` `createTestAppConfig()` finalizes each in-memory user config independently through `finalizeEcoPagesConfig`; only module-backed `loadEcoPagesConfig()` calls are cached.
|
|
50
|
+
- `@ecopages/testing` `createTestAppConfig()` finalizes each in-memory user config independently through `finalizeEcoPagesConfig`; only module-backed `loadEcoPagesConfig()` calls are cached (by config path, build ownership, and cwd).
|
|
51
51
|
- Core fixture helpers live in `packages/core/__fixtures__/app/test-app-config.ts` (`createFixtureAppConfig`, `createFixtureApp`).
|
|
@@ -3,4 +3,6 @@ import type { EcoPagesUserConfig } from './user-config-types.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Applies author-owned config fields onto a {@link ConfigBuilder} instance.
|
|
5
5
|
*/
|
|
6
|
-
export declare function applyUserConfigToBuilder(builder: ConfigBuilder, userConfig: EcoPagesUserConfig
|
|
6
|
+
export declare function applyUserConfigToBuilder(builder: ConfigBuilder, userConfig: EcoPagesUserConfig, options?: {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
}): ConfigBuilder;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigBuilder } from './config-builder.js';
|
|
2
|
+
import { resolveUserConfigRootDir } from './resolve-eco-config-path.js';
|
|
2
3
|
function applyUserDirectoryConfig(builder, userConfig) {
|
|
3
4
|
if (userConfig.srcDir)
|
|
4
5
|
builder.setSrcDir(userConfig.srcDir);
|
|
@@ -57,8 +58,8 @@ function applyUserRuntimeConfig(builder, userConfig) {
|
|
|
57
58
|
/**
|
|
58
59
|
* Applies author-owned config fields onto a {@link ConfigBuilder} instance.
|
|
59
60
|
*/
|
|
60
|
-
export function applyUserConfigToBuilder(builder, userConfig) {
|
|
61
|
-
builder.setRootDir(userConfig.rootDir);
|
|
61
|
+
export function applyUserConfigToBuilder(builder, userConfig, options = {}) {
|
|
62
|
+
builder.setRootDir(resolveUserConfigRootDir(userConfig.rootDir, options.cwd));
|
|
62
63
|
applyUserDirectoryConfig(builder, userConfig);
|
|
63
64
|
applyUserPipelineConfig(builder, userConfig);
|
|
64
65
|
applyUserMetadataConfig(builder, userConfig);
|
|
@@ -16,6 +16,7 @@ export declare const CONFIG_BUILDER_ERRORS: {
|
|
|
16
16
|
readonly MIXED_JSX_ENGINES: "Both kitajs and react integrations are enabled. Use per-file JSX import source/pragma consistently (e.g. `/** @jsxImportSource react */` for React files and `/** @jsxImportSource @kitajs/html */` for Kita files).";
|
|
17
17
|
readonly duplicateProcessorName: (name: string) => string;
|
|
18
18
|
readonly duplicateLoaderName: (name: string) => string;
|
|
19
|
+
readonly duplicateSourceTransformName: (name: string) => string;
|
|
19
20
|
readonly duplicateSemanticTemplate: (kind: string, matches: string[]) => string;
|
|
20
21
|
readonly incompatibleRuntimeCapability: (kind: "integration" | "processor", name: string, runtime: RuntimeKind, reason: string) => string;
|
|
21
22
|
readonly unsupportedRuntimeVersion: (kind: "integration" | "processor", name: string, runtime: RuntimeKind, current: string, min: string) => string;
|
|
@@ -17,6 +17,7 @@ export const CONFIG_BUILDER_ERRORS = {
|
|
|
17
17
|
MIXED_JSX_ENGINES: 'Both kitajs and react integrations are enabled. Use per-file JSX import source/pragma consistently (e.g. `/** @jsxImportSource react */` for React files and `/** @jsxImportSource @kitajs/html */` for Kita files).',
|
|
18
18
|
duplicateProcessorName: (name) => `Processor with name "${name}" already exists`,
|
|
19
19
|
duplicateLoaderName: (name) => `Loader with name "${name}" already exists`,
|
|
20
|
+
duplicateSourceTransformName: (name) => `Source transform with name "${name}" already exists`,
|
|
20
21
|
duplicateSemanticTemplate: (kind, matches) => `Multiple ${kind} templates found: ${matches.join(', ')}`,
|
|
21
22
|
incompatibleRuntimeCapability: (kind, name, runtime, reason) => `Cannot enable ${kind} "${name}" on ${runtime}: ${reason}`,
|
|
22
23
|
unsupportedRuntimeVersion: (kind, name, runtime, current, min) => `Cannot enable ${kind} "${name}" on ${runtime} ${current}: requires runtime version ${min} or newer`,
|
|
@@ -67,7 +68,6 @@ export class ConfigBuilder {
|
|
|
67
68
|
exclude: [],
|
|
68
69
|
},
|
|
69
70
|
integrations: [],
|
|
70
|
-
integrationsDependencies: [],
|
|
71
71
|
distDir: DEFAULT_ECOPAGES_DIST_DIR,
|
|
72
72
|
defaultMetadata: {
|
|
73
73
|
title: 'Ecopages',
|
|
@@ -430,7 +430,7 @@ export class ConfigBuilder {
|
|
|
430
430
|
*/
|
|
431
431
|
addSourceTransform(name, sourceTransform) {
|
|
432
432
|
if (this.config.sourceTransforms.has(name)) {
|
|
433
|
-
throw new Error(CONFIG_BUILDER_ERRORS.
|
|
433
|
+
throw new Error(CONFIG_BUILDER_ERRORS.duplicateSourceTransformName(name));
|
|
434
434
|
}
|
|
435
435
|
this.config.sourceTransforms.set(name, sourceTransform);
|
|
436
436
|
return this;
|
package/src/config/constants.js
CHANGED
|
@@ -13,10 +13,6 @@ export const STATUS_MESSAGE = {
|
|
|
13
13
|
409: 'Conflict',
|
|
14
14
|
500: 'Internal Server Error',
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
*Variables used to determine if the app is running on Bun
|
|
18
|
-
*/
|
|
19
|
-
export const IS_BUN = typeof Bun !== 'undefined';
|
|
20
16
|
/**
|
|
21
17
|
* Directory used for storing assets.
|
|
22
18
|
*/
|
package/src/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineConfig } from './define-config.js';
|
|
2
2
|
export { loadEcoPagesConfig, loadEcoPagesUserConfig, finalizeEcoPagesConfig } from './load-eco-config.js';
|
|
3
|
-
export { resolveEcoConfigPath, resolveEmittedEcoConfigPath, DEFAULT_ECO_CONFIG_FILENAME, ECOPAGES_CONFIG_FILE_ENV, } from './resolve-eco-config-path.js';
|
|
3
|
+
export { resolveEcoConfigPath, resolveEmittedEcoConfigPath, resolveUserConfigRootDir, DEFAULT_ECO_CONFIG_FILENAME, ECOPAGES_CONFIG_FILE_ENV, } from './resolve-eco-config-path.js';
|
|
4
4
|
export { assertProductionConfigIdentity } from '../build/cache/server-entry-build-cache.js';
|
|
5
5
|
export type { EcoPagesUserConfig, LoadedEcoPagesUserConfig, FinalizeEcoPagesConfigOptions, LoadEcoPagesConfigOptions, } from './user-config-types.js';
|
package/src/config/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { defineConfig } from './define-config.js';
|
|
2
2
|
export { loadEcoPagesConfig, loadEcoPagesUserConfig, finalizeEcoPagesConfig } from './load-eco-config.js';
|
|
3
|
-
export { resolveEcoConfigPath, resolveEmittedEcoConfigPath, DEFAULT_ECO_CONFIG_FILENAME, ECOPAGES_CONFIG_FILE_ENV, } from './resolve-eco-config-path.js';
|
|
3
|
+
export { resolveEcoConfigPath, resolveEmittedEcoConfigPath, resolveUserConfigRootDir, DEFAULT_ECO_CONFIG_FILENAME, ECOPAGES_CONFIG_FILE_ENV, } from './resolve-eco-config-path.js';
|
|
4
4
|
export { assertProductionConfigIdentity } from '../build/cache/server-entry-build-cache.js';
|
|
@@ -12,7 +12,7 @@ export declare function finalizeEcoPagesConfig(loaded: LoadedEcoPagesUserConfig,
|
|
|
12
12
|
* Loads and finalizes the Ecopages config for the current project.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Coalesces concurrent loads and caches by `configFilePath` and `
|
|
15
|
+
* Coalesces concurrent loads and caches by `configFilePath`, `buildOwnership`, and `cwd`.
|
|
16
16
|
* Files that still export a finalized {@link ConfigBuilder.build} result are returned as-is
|
|
17
17
|
* so workers and tests can load existing `eco.config.ts` modules.
|
|
18
18
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { pathToFileURL } from 'node:url';
|
|
2
3
|
import { applyUserConfigToBuilder } from './apply-user-config.js';
|
|
3
4
|
import { ConfigBuilder } from './config-builder.js';
|
|
@@ -5,9 +6,11 @@ import { isFinalizedEcoPagesAppConfig } from './is-finalized-app-config.js';
|
|
|
5
6
|
import { resolveEcoConfigPath } from './resolve-eco-config-path.js';
|
|
6
7
|
const moduleLoadCache = new Map();
|
|
7
8
|
const appConfigCache = new Map();
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
function resolveLoaderCwd(cwd) {
|
|
10
|
+
return path.resolve(cwd ?? process.cwd());
|
|
11
|
+
}
|
|
12
|
+
function createCacheKey(configFilePath, buildOwnership, cwd) {
|
|
13
|
+
return `${configFilePath}::${buildOwnership}::${cwd}`;
|
|
11
14
|
}
|
|
12
15
|
async function importEcoConfigModule(configFilePath) {
|
|
13
16
|
const moduleUrl = pathToFileURL(configFilePath).href;
|
|
@@ -28,8 +31,9 @@ function loadConfigModule(configFilePath) {
|
|
|
28
31
|
throw new Error(`Ecopages config at ${configFilePath} must default-export an object from defineConfig(...).`);
|
|
29
32
|
}
|
|
30
33
|
const userConfig = exported;
|
|
31
|
-
if (
|
|
32
|
-
|
|
34
|
+
if (userConfig.rootDir !== undefined &&
|
|
35
|
+
(typeof userConfig.rootDir !== 'string' || userConfig.rootDir.length === 0)) {
|
|
36
|
+
throw new Error(`Ecopages config at ${configFilePath} must set rootDir to a non-empty string when provided.`);
|
|
33
37
|
}
|
|
34
38
|
return { kind: 'user', userConfig, configFilePath };
|
|
35
39
|
})();
|
|
@@ -43,7 +47,8 @@ function loadConfigModule(configFilePath) {
|
|
|
43
47
|
* Loads the user-owned config object from the resolved config module.
|
|
44
48
|
*/
|
|
45
49
|
export async function loadEcoPagesUserConfig(options = {}) {
|
|
46
|
-
const
|
|
50
|
+
const cwd = resolveLoaderCwd(options.cwd);
|
|
51
|
+
const configFilePath = resolveEcoConfigPath({ ...options, cwd });
|
|
47
52
|
const loaded = await loadConfigModule(configFilePath);
|
|
48
53
|
if (loaded.kind === 'finalized') {
|
|
49
54
|
throw new Error(`Ecopages config at ${configFilePath} exported a finalized app config. Use defineConfig(...) and let createApp() finalize the config.`);
|
|
@@ -58,8 +63,9 @@ export async function loadEcoPagesUserConfig(options = {}) {
|
|
|
58
63
|
*/
|
|
59
64
|
export async function finalizeEcoPagesConfig(loaded, options = {}) {
|
|
60
65
|
const buildOwnership = options.buildOwnership ?? loaded.config.buildOwnership ?? 'rolldown';
|
|
66
|
+
const cwd = resolveLoaderCwd(options.cwd);
|
|
61
67
|
const builder = new ConfigBuilder();
|
|
62
|
-
applyUserConfigToBuilder(builder, loaded.config);
|
|
68
|
+
applyUserConfigToBuilder(builder, loaded.config, { cwd });
|
|
63
69
|
builder.setBuildOwnership(buildOwnership);
|
|
64
70
|
builder.setConfigModulePath(loaded.configFilePath);
|
|
65
71
|
return await builder.build();
|
|
@@ -68,14 +74,15 @@ export async function finalizeEcoPagesConfig(loaded, options = {}) {
|
|
|
68
74
|
* Loads and finalizes the Ecopages config for the current project.
|
|
69
75
|
*
|
|
70
76
|
* @remarks
|
|
71
|
-
* Coalesces concurrent loads and caches by `configFilePath` and `
|
|
77
|
+
* Coalesces concurrent loads and caches by `configFilePath`, `buildOwnership`, and `cwd`.
|
|
72
78
|
* Files that still export a finalized {@link ConfigBuilder.build} result are returned as-is
|
|
73
79
|
* so workers and tests can load existing `eco.config.ts` modules.
|
|
74
80
|
*/
|
|
75
81
|
export async function loadEcoPagesConfig(options = {}) {
|
|
76
|
-
const
|
|
82
|
+
const cwd = resolveLoaderCwd(options.cwd);
|
|
83
|
+
const configFilePath = resolveEcoConfigPath({ ...options, cwd });
|
|
77
84
|
const buildOwnership = options.buildOwnership ?? 'rolldown';
|
|
78
|
-
const cacheKey = createCacheKey(configFilePath, buildOwnership);
|
|
85
|
+
const cacheKey = createCacheKey(configFilePath, buildOwnership, cwd);
|
|
79
86
|
const cached = appConfigCache.get(cacheKey);
|
|
80
87
|
if (cached) {
|
|
81
88
|
return cached;
|
|
@@ -85,7 +92,7 @@ export async function loadEcoPagesConfig(options = {}) {
|
|
|
85
92
|
if (loaded.kind === 'finalized') {
|
|
86
93
|
return loaded.appConfig;
|
|
87
94
|
}
|
|
88
|
-
return await finalizeEcoPagesConfig({ config: loaded.userConfig, configFilePath }, { buildOwnership: options.buildOwnership });
|
|
95
|
+
return await finalizeEcoPagesConfig({ config: loaded.userConfig, configFilePath }, { buildOwnership: options.buildOwnership, cwd });
|
|
89
96
|
})();
|
|
90
97
|
appConfigCache.set(cacheKey, loadPromise);
|
|
91
98
|
return loadPromise.catch((error) => {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export declare const DEFAULT_ECO_CONFIG_FILENAME = "eco.config.ts";
|
|
2
2
|
export declare const ECOPAGES_CONFIG_FILE_ENV = "ECOPAGES_CONFIG_FILE";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the project root used when `EcoPagesUserConfig.rootDir` is omitted.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Defaults to `cwd` so source configs, in-memory `createApp({ userConfig })`,
|
|
8
|
+
* and production loads of `dist/.server/eco.config.mjs` share one rule.
|
|
9
|
+
* `path.resolve` keeps an explicit absolute `rootDir` unchanged.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveUserConfigRootDir(rootDir?: string, cwd?: string): string;
|
|
3
12
|
export type ResolveEcoConfigPathOptions = {
|
|
4
13
|
configFile?: string;
|
|
5
14
|
cwd?: string;
|
|
@@ -4,6 +4,17 @@ import { SERVER_BUNDLE_DIR } from '../utils/resolve-entry-file.js';
|
|
|
4
4
|
import { EMITTED_ECO_CONFIG_FILENAME } from './server-config-bundle.js';
|
|
5
5
|
export const DEFAULT_ECO_CONFIG_FILENAME = 'eco.config.ts';
|
|
6
6
|
export const ECOPAGES_CONFIG_FILE_ENV = 'ECOPAGES_CONFIG_FILE';
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the project root used when `EcoPagesUserConfig.rootDir` is omitted.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Defaults to `cwd` so source configs, in-memory `createApp({ userConfig })`,
|
|
12
|
+
* and production loads of `dist/.server/eco.config.mjs` share one rule.
|
|
13
|
+
* `path.resolve` keeps an explicit absolute `rootDir` unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveUserConfigRootDir(rootDir, cwd = process.cwd()) {
|
|
16
|
+
return path.resolve(cwd, rootDir ?? '.');
|
|
17
|
+
}
|
|
7
18
|
/** Resolves the emitted production config without consulting source overrides. */
|
|
8
19
|
export function resolveEmittedEcoConfigPath(cwd = process.cwd()) {
|
|
9
20
|
const candidates = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
3
|
import { build, getAppBuildAdapter } from '../build/build-adapter.js';
|
|
4
|
-
import {
|
|
4
|
+
import { parseModuleSource } from '../cache/module-parse-cache.js';
|
|
5
5
|
import { createServerBuildRequest } from '../build/runtime/build-request-policy.js';
|
|
6
6
|
import { requireBuildRuntime } from '../build/runtime/build-runtime.js';
|
|
7
7
|
import { getServerBundleOutputPaths } from '../build/cache/server-entry-build-cache.js';
|
|
@@ -32,7 +32,7 @@ function isImportMeta(node) {
|
|
|
32
32
|
node.property.name === 'meta');
|
|
33
33
|
}
|
|
34
34
|
function collectImportMetaEdits(code, id, serverOutdir) {
|
|
35
|
-
const program =
|
|
35
|
+
const program = parseModuleSource(id, code, { sourceType: 'module' }).program;
|
|
36
36
|
const fileDir = path.dirname(id);
|
|
37
37
|
const relativeDir = path.relative(serverOutdir, fileDir).replaceAll('\\', '/');
|
|
38
38
|
const relativeFile = relativeDir ? `${relativeDir}/${path.basename(id)}` : `./${path.basename(id)}`;
|
|
@@ -20,8 +20,6 @@ import type { PageMetadataProps, SitemapConfig } from '../types/public-types.js'
|
|
|
20
20
|
* import { ecopagesJsxPlugin } from '@ecopages/ecopages-jsx';
|
|
21
21
|
*
|
|
22
22
|
* export default defineConfig({
|
|
23
|
-
* rootDir: import.meta.dirname,
|
|
24
|
-
* baseUrl: process.env.ECOPAGES_BASE_URL ?? 'http://localhost:3000',
|
|
25
23
|
* integrations: [ecopagesJsxPlugin()],
|
|
26
24
|
* });
|
|
27
25
|
* ```
|
|
@@ -29,8 +27,10 @@ import type { PageMetadataProps, SitemapConfig } from '../types/public-types.js'
|
|
|
29
27
|
export type EcoPagesUserConfig = {
|
|
30
28
|
/**
|
|
31
29
|
* Absolute or relative path to the project root directory.
|
|
30
|
+
*
|
|
31
|
+
* @default process.cwd()
|
|
32
32
|
*/
|
|
33
|
-
rootDir
|
|
33
|
+
rootDir?: string;
|
|
34
34
|
/**
|
|
35
35
|
* Canonical base URL for production deployment (e.g. `https://example.com`).
|
|
36
36
|
*
|
|
@@ -156,6 +156,12 @@ export type LoadedEcoPagesUserConfig = {
|
|
|
156
156
|
};
|
|
157
157
|
export type FinalizeEcoPagesConfigOptions = {
|
|
158
158
|
buildOwnership?: BuildOwnership;
|
|
159
|
+
/**
|
|
160
|
+
* Working directory used when `rootDir` is omitted.
|
|
161
|
+
*
|
|
162
|
+
* @default process.cwd()
|
|
163
|
+
*/
|
|
164
|
+
cwd?: string;
|
|
159
165
|
};
|
|
160
166
|
export type LoadEcoPagesConfigOptions = {
|
|
161
167
|
configFile?: string;
|
|
@@ -6,7 +6,6 @@ export interface DevelopmentHostRuntime {
|
|
|
6
6
|
registerHostModuleLoader(loader: HostRuntimeModuleLoader): void;
|
|
7
7
|
planFileChange(filePath: string): DevelopmentInvalidationPlan;
|
|
8
8
|
invalidateServerModules(changedFiles?: string[]): void;
|
|
9
|
-
resetRuntimeState(changedFiles?: string[]): void;
|
|
10
9
|
broadcastClientEvent(event: ClientBridgeEvent): void;
|
|
11
10
|
isServerRenderedTemplatePlan(plan: DevelopmentInvalidationPlan): boolean;
|
|
12
11
|
}
|
package/src/dev/host-runtime.js
CHANGED
|
@@ -13,9 +13,6 @@ export function createDevelopmentHostRuntime(appConfig) {
|
|
|
13
13
|
invalidateServerModules(changedFiles) {
|
|
14
14
|
invalidationService.invalidateServerModules(changedFiles);
|
|
15
15
|
},
|
|
16
|
-
resetRuntimeState(changedFiles) {
|
|
17
|
-
invalidationService.resetRuntimeState(changedFiles);
|
|
18
|
-
},
|
|
19
16
|
broadcastClientEvent(event) {
|
|
20
17
|
getAppDevClientBridge(appConfig)?.broadcast(event);
|
|
21
18
|
},
|
package/src/dev/sc-server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Server } from 'bun';
|
|
|
2
2
|
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
3
3
|
type StaticContentServerOptions = {
|
|
4
4
|
port?: number;
|
|
5
|
+
hostname?: string;
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* Static content server for production builds.
|
|
@@ -16,7 +17,9 @@ export declare class StaticContentServer {
|
|
|
16
17
|
options?: StaticContentServerOptions;
|
|
17
18
|
});
|
|
18
19
|
private shouldServeGzip;
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Serves the generated 404 page when present, or a plain-text fallback.
|
|
22
|
+
*/
|
|
20
23
|
private sendNotFoundPage;
|
|
21
24
|
private serveFromDir;
|
|
22
25
|
fetch(request: Request): Promise<Response>;
|
package/src/dev/sc-server.js
CHANGED
|
@@ -20,23 +20,18 @@ export class StaticContentServer {
|
|
|
20
20
|
shouldServeGzip(contentType) {
|
|
21
21
|
return ['text/javascript', 'text/css'].includes(contentType);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const error404TemplatePath =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return new Response(STATUS_MESSAGE[404], {
|
|
33
|
-
status: 404,
|
|
34
|
-
});
|
|
23
|
+
/**
|
|
24
|
+
* Serves the generated 404 page when present, or a plain-text fallback.
|
|
25
|
+
*/
|
|
26
|
+
sendNotFoundPage() {
|
|
27
|
+
const error404TemplatePath = join(this.appConfig.absolutePaths.distDir, '404.html');
|
|
28
|
+
if (!fileSystem.exists(error404TemplatePath)) {
|
|
29
|
+
return new Response(STATUS_MESSAGE[404], { status: 404 });
|
|
35
30
|
}
|
|
36
|
-
|
|
31
|
+
return new Response(fileSystem.readFileAsBuffer(error404TemplatePath), {
|
|
32
|
+
status: 404,
|
|
37
33
|
headers: { 'Content-Type': 'text/html' },
|
|
38
34
|
});
|
|
39
|
-
return response;
|
|
40
35
|
}
|
|
41
36
|
async serveFromDir({ path, request }) {
|
|
42
37
|
const { absolutePaths } = this.appConfig;
|
|
@@ -84,20 +79,16 @@ export class StaticContentServer {
|
|
|
84
79
|
let reqPath = new URL(request.url).pathname;
|
|
85
80
|
if (reqPath === '/')
|
|
86
81
|
reqPath = '/index.html';
|
|
87
|
-
|
|
82
|
+
return this.serveFromDir({
|
|
88
83
|
path: reqPath,
|
|
89
84
|
request,
|
|
90
85
|
});
|
|
91
|
-
if (response)
|
|
92
|
-
return response;
|
|
93
|
-
return new Response(STATUS_MESSAGE[404], {
|
|
94
|
-
status: 404,
|
|
95
|
-
});
|
|
96
86
|
}
|
|
97
87
|
startServer() {
|
|
98
88
|
this.server = getRequiredBunRuntime().serve({
|
|
99
89
|
fetch: this.fetch.bind(this),
|
|
100
90
|
port: this.options.port,
|
|
91
|
+
hostname: this.options.hostname,
|
|
101
92
|
});
|
|
102
93
|
}
|
|
103
94
|
stop() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
-
import {
|
|
3
|
+
import { parseModuleSource } from '../../cache/module-parse-cache.js';
|
|
4
4
|
import { isBarePackageImportSpecifier, resolveProjectModulePath } from '../../plugins/tsconfig-import-resolver.js';
|
|
5
5
|
import { resolveRuntimeSpecifierPublicPath } from '../../build/browser/browser-runtime-manifest.js';
|
|
6
6
|
import { resolveDevTransformModuleUrl } from './dev-transform-url.js';
|
|
@@ -41,7 +41,7 @@ export async function rewriteModuleImports(options) {
|
|
|
41
41
|
const normalizedSource = path.resolve(options.sourcePath);
|
|
42
42
|
const dependencies = new Set();
|
|
43
43
|
const specifierNodes = [];
|
|
44
|
-
const parseResult =
|
|
44
|
+
const parseResult = parseModuleSource(normalizedSource, options.code, {
|
|
45
45
|
sourceType: 'module',
|
|
46
46
|
lang: path.extname(normalizedSource).endsWith('x') ? 'tsx' : 'ts',
|
|
47
47
|
});
|
|
@@ -2,7 +2,6 @@ import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
|
2
2
|
import { type AffectedGraphIdentity } from '../route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js';
|
|
3
3
|
export type HmrFileChangePreparation = {
|
|
4
4
|
affectedGraphIdentities: AffectedGraphIdentity[];
|
|
5
|
-
invalidatedGraphCount: number;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
8
7
|
* Invalidates affected Page Browser Graph records before HMR strategy dispatch.
|
|
@@ -6,9 +6,6 @@ import { getAffectedPageBrowserGraphIdentities, invalidatePageBrowserGraphSessio
|
|
|
6
6
|
export function prepareHmrFileChange(appConfig, filePath) {
|
|
7
7
|
const resolvedFilePath = path.resolve(filePath);
|
|
8
8
|
const affectedGraphIdentities = getAffectedPageBrowserGraphIdentities(appConfig, resolvedFilePath);
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
affectedGraphIdentities,
|
|
12
|
-
invalidatedGraphCount,
|
|
13
|
-
};
|
|
9
|
+
invalidatePageBrowserGraphSession(appConfig, resolvedFilePath);
|
|
10
|
+
return { affectedGraphIdentities };
|
|
14
11
|
}
|
|
@@ -26,7 +26,7 @@ import type { ClientBridgeEvent } from '../types/public-types.js';
|
|
|
26
26
|
*/
|
|
27
27
|
/**
|
|
28
28
|
* Defines the category of an HMR strategy, which determines its execution priority.
|
|
29
|
-
* Strategies are evaluated in descending order: INTEGRATION →
|
|
29
|
+
* Strategies are evaluated in descending order: INTEGRATION → SCRIPT → FALLBACK.
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* The numeric values represent base priorities. Strategies can fine-tune their priority
|
|
@@ -38,11 +38,6 @@ export declare const HmrStrategyType: {
|
|
|
38
38
|
* Highest priority to allow framework-specific HMR handling.
|
|
39
39
|
*/
|
|
40
40
|
readonly INTEGRATION: 100;
|
|
41
|
-
/**
|
|
42
|
-
* Asset processing strategies (CSS, images, etc.)
|
|
43
|
-
* High priority for specialized asset handling.
|
|
44
|
-
*/
|
|
45
|
-
readonly ASSET: 50;
|
|
46
41
|
/**
|
|
47
42
|
* Generic script bundling strategies (JS/TS)
|
|
48
43
|
* Medium priority for standard script processing.
|
|
@@ -82,8 +77,8 @@ export interface HmrAction {
|
|
|
82
77
|
*
|
|
83
78
|
* @example
|
|
84
79
|
* ```typescript
|
|
85
|
-
* class
|
|
86
|
-
* readonly type = HmrStrategyType.
|
|
80
|
+
* class MyImageStrategy extends HmrStrategy {
|
|
81
|
+
* readonly type = HmrStrategyType.INTEGRATION;
|
|
87
82
|
* readonly priorityOffset = 5;
|
|
88
83
|
*
|
|
89
84
|
* matches(filePath: string): boolean {
|
package/src/hmr/hmr-strategy.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
/**
|
|
27
27
|
* Defines the category of an HMR strategy, which determines its execution priority.
|
|
28
|
-
* Strategies are evaluated in descending order: INTEGRATION →
|
|
28
|
+
* Strategies are evaluated in descending order: INTEGRATION → SCRIPT → FALLBACK.
|
|
29
29
|
*
|
|
30
30
|
* @remarks
|
|
31
31
|
* The numeric values represent base priorities. Strategies can fine-tune their priority
|
|
@@ -37,11 +37,6 @@ export const HmrStrategyType = {
|
|
|
37
37
|
* Highest priority to allow framework-specific HMR handling.
|
|
38
38
|
*/
|
|
39
39
|
INTEGRATION: 100,
|
|
40
|
-
/**
|
|
41
|
-
* Asset processing strategies (CSS, images, etc.)
|
|
42
|
-
* High priority for specialized asset handling.
|
|
43
|
-
*/
|
|
44
|
-
ASSET: 50,
|
|
45
40
|
/**
|
|
46
41
|
* Generic script bundling strategies (JS/TS)
|
|
47
42
|
* Medium priority for standard script processing.
|
|
@@ -66,8 +61,8 @@ export const HmrStrategyType = {
|
|
|
66
61
|
*
|
|
67
62
|
* @example
|
|
68
63
|
* ```typescript
|
|
69
|
-
* class
|
|
70
|
-
* readonly type = HmrStrategyType.
|
|
64
|
+
* class MyImageStrategy extends HmrStrategy {
|
|
65
|
+
* readonly type = HmrStrategyType.INTEGRATION;
|
|
71
66
|
* readonly priorityOffset = 5;
|
|
72
67
|
*
|
|
73
68
|
* matches(filePath: string): boolean {
|