@ecopages/react 0.2.0-rc.0 → 0.2.0-rc.10
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 +68 -14
- package/package.json +17 -5
- package/src/app/client-only.js +3 -8
- package/src/bundling/bundle.js +4 -1
- package/src/bundling/runtime-alias-map.d.ts +0 -1
- package/src/bundling/runtime-alias-map.js +1 -4
- package/src/bundling/runtime-bundle.d.ts +9 -2
- package/src/bundling/runtime-bundle.js +27 -16
- package/src/bundling/runtime-modules.d.ts +21 -0
- package/src/bundling/runtime-modules.js +25 -0
- package/src/client-graph/ast-transform-eco-page.d.ts +10 -0
- package/src/client-graph/ast-transform-eco-page.js +71 -0
- package/src/client-graph/ast-transform-import-edits.d.ts +13 -0
- package/src/client-graph/ast-transform-import-edits.js +75 -0
- package/src/client-graph/ast-transform-walk-imports.d.ts +19 -0
- package/src/client-graph/ast-transform-walk-imports.js +103 -0
- package/src/client-graph/ast-transform.d.ts +1 -7
- package/src/client-graph/ast-transform.js +42 -378
- package/src/client-graph/ast-walk.d.ts +10 -0
- package/src/client-graph/ast-walk.js +26 -0
- package/src/client-graph/boundary-plugin-read-file-inline.d.ts +8 -0
- package/src/client-graph/boundary-plugin-read-file-inline.js +45 -0
- package/src/client-graph/boundary-plugin-transform.d.ts +18 -0
- package/src/client-graph/boundary-plugin-transform.js +61 -0
- package/src/client-graph/boundary-plugin.d.ts +0 -20
- package/src/client-graph/boundary-plugin.js +16 -98
- package/src/client-graph/reachability-analyzer.d.ts +4 -36
- package/src/client-graph/reachability-analyzer.js +23 -483
- package/src/client-graph/reachability-client-roots.d.ts +8 -0
- package/src/client-graph/reachability-client-roots.js +59 -0
- package/src/client-graph/reachability-export-names.d.ts +5 -0
- package/src/client-graph/reachability-export-names.js +34 -0
- package/src/client-graph/reachability-fallback-roots.d.ts +3 -0
- package/src/client-graph/reachability-fallback-roots.js +71 -0
- package/src/client-graph/reachability-preload.d.ts +10 -0
- package/src/client-graph/reachability-preload.js +30 -0
- package/src/client-graph/reachability-top-level-index.d.ts +14 -0
- package/src/client-graph/reachability-top-level-index.js +93 -0
- package/src/client-graph/reachability-traverse.d.ts +7 -0
- package/src/client-graph/reachability-traverse.js +201 -0
- package/src/client-graph/specifier-classification.d.ts +3 -2
- package/src/client-graph/specifier-classification.js +6 -2
- package/src/content/collection-component-cache.d.ts +25 -0
- package/src/content/collection-component-cache.js +62 -0
- package/src/hmr/hmr-strategy-process.d.ts +34 -0
- package/src/hmr/hmr-strategy-process.js +83 -0
- package/src/hmr/hmr-strategy.d.ts +3 -0
- package/src/hmr/hmr-strategy.js +47 -86
- package/src/hmr/react-hmr-dev-transform-plugins.d.ts +1 -0
- package/src/hmr/react-hmr-dev-transform-plugins.js +4 -1
- package/src/hydration/browser/island-hydration.d.ts +82 -0
- package/src/hydration/browser/island-hydration.js +247 -0
- package/src/hydration/browser/page-hydration-hmr.d.ts +11 -0
- package/src/hydration/browser/page-hydration-hmr.js +56 -0
- package/src/hydration/browser/page-hydration-module.d.ts +8 -0
- package/src/hydration/browser/page-hydration-module.js +17 -0
- package/src/hydration/browser/page-hydration.d.ts +54 -0
- package/src/hydration/browser/page-hydration.js +177 -0
- package/src/hydration/compiled-page-hydration-options.d.ts +20 -0
- package/src/hydration/hydration-asset.d.ts +21 -1
- package/src/hydration/hydration-asset.js +54 -24
- package/src/hydration/hydration-lifecycle.test.browser.d.ts +1 -0
- package/src/hydration/hydration-lifecycle.test.browser.js +409 -0
- package/src/hydration/hydration-page-entry-source.d.ts +5 -0
- package/src/hydration/hydration-page-entry-source.js +87 -0
- package/src/hydration/hydration-script-compiler.d.ts +48 -0
- package/src/hydration/hydration-script-compiler.js +213 -0
- package/src/hydration/page-data-reader.d.ts +0 -14
- package/src/hydration/page-data-reader.js +1 -47
- package/src/mdx/mdx-loader-plugin.d.ts +5 -1
- package/src/mdx/mdx-loader-plugin.js +4 -2
- package/src/plugin/react.plugin.js +8 -1
- package/src/plugin/react.types.d.ts +11 -2
- package/src/render/component-ssr.d.ts +17 -0
- package/src/render/component-ssr.js +19 -1
- package/src/render/react-renderer.d.ts +4 -2
- package/src/render/react-renderer.js +13 -7
- package/src/render/unified-layout-composition.d.ts +2 -0
- package/src/render/unified-layout-composition.js +5 -1
- package/src/hydration/hydration-scripts.d.ts +0 -104
- package/src/hydration/hydration-scripts.js +0 -483
- package/src/hydration/hydration-scripts.test.browser.js +0 -199
- /package/src/hydration/{hydration-scripts.test.browser.d.ts → compiled-page-hydration-options.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EcoBuildOnLoadResult } from '@ecopages/core/plugins/integration-plugin';
|
|
2
|
+
import type { CachedTransform, ClientGraphBoundaryCache, RequestedExportRules } from './boundary-cache.js';
|
|
3
|
+
import type { ClientGraphModuleKind } from './module-classification.js';
|
|
4
|
+
export type TransformClientGraphModuleOptions = {
|
|
5
|
+
filePath: string;
|
|
6
|
+
source: string;
|
|
7
|
+
absWorkingDir: string;
|
|
8
|
+
category: ClientGraphModuleKind;
|
|
9
|
+
globallyDeclaredSources: Map<string, Set<string> | '*'>;
|
|
10
|
+
requestedExports: Map<string, RequestedExportRules>;
|
|
11
|
+
cache?: ClientGraphBoundaryCache;
|
|
12
|
+
inboundRules?: RequestedExportRules;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Applies read-file inlining and import transforms for one client-graph module.
|
|
16
|
+
*/
|
|
17
|
+
export declare function transformClientGraphModule(options: TransformClientGraphModuleOptions): EcoBuildOnLoadResult | undefined;
|
|
18
|
+
export declare function replayCachedClientGraphTransform(options: TransformClientGraphModuleOptions, cached: CachedTransform): EcoBuildOnLoadResult | undefined;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { dirname, extname } from 'node:path';
|
|
2
|
+
import { recordModuleTransformProfile } from '@ecopages/core/cache';
|
|
3
|
+
import { inlineReadFileSyncCalls } from './boundary-plugin-read-file-inline.js';
|
|
4
|
+
import { transformModuleImports } from './ast-transform.js';
|
|
5
|
+
import { isPageOrLayoutEntry } from './module-classification.js';
|
|
6
|
+
import { diffRequestedExportRules, mergeRequestedExportRules, snapshotRegistry } from './specifier-classification.js';
|
|
7
|
+
function toLoaderResult(filePath, contents) {
|
|
8
|
+
const ext = extname(filePath).slice(1);
|
|
9
|
+
return { contents, loader: ext, resolveDir: dirname(filePath) };
|
|
10
|
+
}
|
|
11
|
+
function persistTransformCache(options, source, transformed, modified, registryBefore, inlinedExternalFile) {
|
|
12
|
+
const cache = options.cache;
|
|
13
|
+
if (!cache || inlinedExternalFile)
|
|
14
|
+
return;
|
|
15
|
+
const rulesAdded = new Map();
|
|
16
|
+
for (const [key, afterRules] of options.requestedExports) {
|
|
17
|
+
const beforeRules = registryBefore.get(key);
|
|
18
|
+
const diff = diffRequestedExportRules(beforeRules, afterRules);
|
|
19
|
+
if (!diff)
|
|
20
|
+
continue;
|
|
21
|
+
rulesAdded.set(key, diff);
|
|
22
|
+
}
|
|
23
|
+
const entry = {
|
|
24
|
+
transformed,
|
|
25
|
+
modified,
|
|
26
|
+
rulesAdded,
|
|
27
|
+
};
|
|
28
|
+
cache.set(options.filePath, source, options.globallyDeclaredSources, entry, options.inboundRules);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Applies read-file inlining and import transforms for one client-graph module.
|
|
32
|
+
*/
|
|
33
|
+
export function transformClientGraphModule(options) {
|
|
34
|
+
const readFileInlining = inlineReadFileSyncCalls(options.source, options.filePath, options.absWorkingDir);
|
|
35
|
+
let transformed = readFileInlining.transformed;
|
|
36
|
+
let modified = readFileInlining.modified;
|
|
37
|
+
const registryBefore = snapshotRegistry(options.requestedExports);
|
|
38
|
+
const analysisStartedAt = performance.now();
|
|
39
|
+
const { transformed: oxcTransformed, modified: importsModified } = transformModuleImports(transformed, options.filePath, options.globallyDeclaredSources, options.requestedExports, isPageOrLayoutEntry(options.filePath));
|
|
40
|
+
recordModuleTransformProfile({
|
|
41
|
+
category: options.category,
|
|
42
|
+
phase: 'analysis',
|
|
43
|
+
ms: performance.now() - analysisStartedAt,
|
|
44
|
+
});
|
|
45
|
+
if (importsModified) {
|
|
46
|
+
modified = true;
|
|
47
|
+
transformed = oxcTransformed;
|
|
48
|
+
}
|
|
49
|
+
persistTransformCache(options, options.source, transformed, modified, registryBefore, readFileInlining.inlinedExternalFile);
|
|
50
|
+
if (!modified)
|
|
51
|
+
return undefined;
|
|
52
|
+
return toLoaderResult(options.filePath, transformed);
|
|
53
|
+
}
|
|
54
|
+
export function replayCachedClientGraphTransform(options, cached) {
|
|
55
|
+
for (const [moduleKey, rules] of cached.rulesAdded) {
|
|
56
|
+
mergeRequestedExportRules(options.requestedExports, moduleKey, rules);
|
|
57
|
+
}
|
|
58
|
+
if (!cached.modified)
|
|
59
|
+
return undefined;
|
|
60
|
+
return toLoaderResult(options.filePath, cached.transformed);
|
|
61
|
+
}
|
|
@@ -7,36 +7,16 @@ import type { EcoBuildPlugin } from '@ecopages/core/plugins/integration-plugin';
|
|
|
7
7
|
import { ClientGraphBoundaryCache } from './boundary-cache.js';
|
|
8
8
|
/**
|
|
9
9
|
* Configuration options for the Client Graph Boundary build plugin.
|
|
10
|
-
*
|
|
11
|
-
* This plugin serves as the primary security layer between server-only logic and the client-side JavaScript bundle.
|
|
12
|
-
* It prevents Node.js built-ins (`node:fs`, `node:path`) and backend-exclusive dependencies (e.g. `pg`, `redis`)
|
|
13
|
-
* from accidentally leaking into the browser compilation step, which would cause immediate crashes.
|
|
14
10
|
*/
|
|
15
11
|
type ClientGraphBoundaryOptions = {
|
|
16
|
-
/** Absolute path to the app project root, used for tsconfig path alias classification. */
|
|
17
12
|
projectRoot?: string;
|
|
18
|
-
/** Absolute path to the current working directory, used as a root fallback for resolving inline file reads. */
|
|
19
13
|
absWorkingDir?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Array of module specifiers that are explicitly whitelisted to be bundled in the client code.
|
|
22
|
-
* This is typically populated by parsing `modules: ["..."]` declarations in React/Lit components.
|
|
23
|
-
*/
|
|
24
14
|
declaredModules?: readonly string[];
|
|
25
|
-
/** Array of emergency escape-hatch specifiers that always bypass the boundary checks regardless of component declarations. */
|
|
26
15
|
alwaysAllowSpecifiers?: string[];
|
|
27
|
-
/**
|
|
28
|
-
* Persistent per-app cache for transform results. Owned by the React
|
|
29
|
-
* plugin for the app's lifetime; survives across HMR rebuilds. When
|
|
30
|
-
* omitted, transforms are still memoized inside the plugin for the
|
|
31
|
-
* duration of a single build but not across builds.
|
|
32
|
-
*/
|
|
33
16
|
cache?: ClientGraphBoundaryCache;
|
|
34
17
|
};
|
|
35
18
|
/**
|
|
36
19
|
* Instantiates the client graph boundary build plugin.
|
|
37
|
-
*
|
|
38
|
-
* @param options - Configuration options for the graph boundary.
|
|
39
|
-
* @returns The resulting `EcoBuildPlugin`.
|
|
40
20
|
*/
|
|
41
21
|
export declare function createClientGraphBoundaryPlugin(options?: ClientGraphBoundaryOptions): EcoBuildPlugin;
|
|
42
22
|
export {};
|
|
@@ -3,19 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Build plugin securing the Ecopages isomorphic compilation pipeline.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { dirname, extname, resolve, sep } from 'node:path';
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
8
7
|
import { ClientGraphBoundaryCache } from './boundary-cache.js';
|
|
9
|
-
import { parseDeclaredModules, toModuleBaseSpecifier,
|
|
10
|
-
import {
|
|
11
|
-
import { classifyClientGraphModule, isPageOrLayoutEntry } from './module-classification.js';
|
|
8
|
+
import { parseDeclaredModules, toModuleBaseSpecifier, normalizeRequestedExportsKey, } from './specifier-classification.js';
|
|
9
|
+
import { classifyClientGraphModule } from './module-classification.js';
|
|
12
10
|
import { recordModuleTransformProfile } from '@ecopages/core/cache';
|
|
11
|
+
import { replayCachedClientGraphTransform, transformClientGraphModule } from './boundary-plugin-transform.js';
|
|
13
12
|
const SOURCE_FILE_FILTER = /\.(tsx?|jsx?)$/;
|
|
14
13
|
/**
|
|
15
14
|
* Instantiates the client graph boundary build plugin.
|
|
16
|
-
*
|
|
17
|
-
* @param options - Configuration options for the graph boundary.
|
|
18
|
-
* @returns The resulting `EcoBuildPlugin`.
|
|
19
15
|
*/
|
|
20
16
|
export function createClientGraphBoundaryPlugin(options) {
|
|
21
17
|
return {
|
|
@@ -40,13 +36,17 @@ export function createClientGraphBoundaryPlugin(options) {
|
|
|
40
36
|
catch {
|
|
41
37
|
return undefined;
|
|
42
38
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Fast path: if the cache has a transform result for this
|
|
45
|
-
* exact (filePath, source, allowListRules, inboundRules) tuple,
|
|
46
|
-
* replay the captured `rulesAdded` into the live registry and
|
|
47
|
-
* return the cached transformed source.
|
|
48
|
-
*/
|
|
49
39
|
const inboundRules = requestedExports.get(normalizeRequestedExportsKey(args.path));
|
|
40
|
+
const transformOptions = {
|
|
41
|
+
filePath: args.path,
|
|
42
|
+
source,
|
|
43
|
+
absWorkingDir,
|
|
44
|
+
category,
|
|
45
|
+
globallyDeclaredSources,
|
|
46
|
+
requestedExports,
|
|
47
|
+
cache,
|
|
48
|
+
inboundRules,
|
|
49
|
+
};
|
|
50
50
|
if (cache) {
|
|
51
51
|
const cacheStartedAt = performance.now();
|
|
52
52
|
const cached = cache.get(args.path, source, globallyDeclaredSources, inboundRules);
|
|
@@ -57,93 +57,11 @@ export function createClientGraphBoundaryPlugin(options) {
|
|
|
57
57
|
cacheHit: Boolean(cached),
|
|
58
58
|
});
|
|
59
59
|
if (cached) {
|
|
60
|
-
|
|
61
|
-
mergeRequestedExportRules(requestedExports, moduleKey, rules);
|
|
62
|
-
}
|
|
63
|
-
if (!cached.modified)
|
|
64
|
-
return undefined;
|
|
65
|
-
const ext = extname(args.path).slice(1);
|
|
66
|
-
return { contents: cached.transformed, loader: ext, resolveDir: dirname(args.path) };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
let transformed = source;
|
|
70
|
-
let modified = false;
|
|
71
|
-
let inlinedExternalFile = false;
|
|
72
|
-
if (source.includes('readFileSync')) {
|
|
73
|
-
const readFileTransformed = transformed.replace(/\bfs\.readFileSync\s*\(\s*path\.resolve\s*\(\s*(['"`])([^'"`\n]+)\1\s*\)\s*,\s*['"`]utf-?8['"`]\s*\)/g, (_match, _q, relPath) => {
|
|
74
|
-
modified = true;
|
|
75
|
-
inlinedExternalFile = true;
|
|
76
|
-
try {
|
|
77
|
-
const sourceDir = dirname(args.path);
|
|
78
|
-
const inferredProjectRoot = inferProjectRootFromSourcePath(args.path);
|
|
79
|
-
const candidates = [
|
|
80
|
-
resolve(absWorkingDir, relPath),
|
|
81
|
-
resolve(process.cwd(), relPath),
|
|
82
|
-
resolve(sourceDir, relPath),
|
|
83
|
-
...(inferredProjectRoot ? [resolve(inferredProjectRoot, relPath)] : []),
|
|
84
|
-
];
|
|
85
|
-
const absolutePath = candidates.find((candidate) => existsSync(candidate));
|
|
86
|
-
if (!absolutePath)
|
|
87
|
-
return '""';
|
|
88
|
-
const content = readFileSync(absolutePath, 'utf-8');
|
|
89
|
-
return JSON.stringify(content);
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return '""';
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
transformed = readFileTransformed;
|
|
96
|
-
}
|
|
97
|
-
// Snapshot the live registry so we can diff per-key after
|
|
98
|
-
// the transform. We must capture the **after-state** of
|
|
99
|
-
// every key the transform touched — including keys that
|
|
100
|
-
// already existed and grew via Set union or were promoted
|
|
101
|
-
// to `'*'`. A snapshot keyed only on newly-added entries
|
|
102
|
-
// would under-populate the registry on cache hit.
|
|
103
|
-
const registryBefore = snapshotRegistry(requestedExports);
|
|
104
|
-
const analysisStartedAt = performance.now();
|
|
105
|
-
const { transformed: oxcTransformed, modified: importsModified } = transformModuleImports(transformed, args.path, globallyDeclaredSources, requestedExports, options?.projectRoot, isPageOrLayoutEntry(args.path));
|
|
106
|
-
recordModuleTransformProfile({
|
|
107
|
-
category,
|
|
108
|
-
phase: 'analysis',
|
|
109
|
-
ms: performance.now() - analysisStartedAt,
|
|
110
|
-
});
|
|
111
|
-
if (importsModified) {
|
|
112
|
-
modified = true;
|
|
113
|
-
transformed = oxcTransformed;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Skip persistent cache when the transform inlined another file:
|
|
117
|
-
* output depends on content outside the importer source hash.
|
|
118
|
-
*/
|
|
119
|
-
if (cache && !inlinedExternalFile) {
|
|
120
|
-
const rulesAdded = new Map();
|
|
121
|
-
for (const [key, afterRules] of requestedExports) {
|
|
122
|
-
const beforeRules = registryBefore.get(key);
|
|
123
|
-
const diff = diffRequestedExportRules(beforeRules, afterRules);
|
|
124
|
-
if (!diff)
|
|
125
|
-
continue;
|
|
126
|
-
rulesAdded.set(key, diff);
|
|
60
|
+
return replayCachedClientGraphTransform(transformOptions, cached);
|
|
127
61
|
}
|
|
128
|
-
const entry = {
|
|
129
|
-
transformed,
|
|
130
|
-
modified,
|
|
131
|
-
rulesAdded,
|
|
132
|
-
};
|
|
133
|
-
cache.set(args.path, source, globallyDeclaredSources, entry, inboundRules);
|
|
134
62
|
}
|
|
135
|
-
|
|
136
|
-
return undefined;
|
|
137
|
-
const ext = extname(args.path).slice(1);
|
|
138
|
-
return { contents: transformed, loader: ext, resolveDir: dirname(args.path) };
|
|
63
|
+
return transformClientGraphModule(transformOptions);
|
|
139
64
|
});
|
|
140
65
|
},
|
|
141
66
|
};
|
|
142
67
|
}
|
|
143
|
-
function inferProjectRootFromSourcePath(filePath) {
|
|
144
|
-
const parts = filePath.split(/[\\/]/);
|
|
145
|
-
const srcIndex = parts.lastIndexOf('src');
|
|
146
|
-
if (srcIndex <= 0)
|
|
147
|
-
return undefined;
|
|
148
|
-
return parts.slice(0, srcIndex).join(sep);
|
|
149
|
-
}
|
|
@@ -4,55 +4,23 @@
|
|
|
4
4
|
* This module is responsible for performing static analysis on Ecopages client components
|
|
5
5
|
* using the Oxc AST parser. It computes a strict "reachability graph" of all JavaScript/TypeScript
|
|
6
6
|
* dependencies (imports, variables, functions, and classes) that begin from explicit client roots.
|
|
7
|
-
*
|
|
8
|
-
* In Ecopages, "client roots" are defined as the `render`, `errorBoundary`, or `loadingFallback`
|
|
9
|
-
* properties passed into `eco.page()`, `eco.layout()`, or `eco.component()`. By tracing the execution path from
|
|
10
|
-
* these roots, the analyzer determines exactly which modules and bindings are actually needed
|
|
11
|
-
* by the browser to hydrate the page, and which imports are unused on the client (and thus can be pruned).
|
|
12
7
|
*/
|
|
13
8
|
import type { ParseResult } from 'oxc-parser';
|
|
9
|
+
export { hasPagePreloadExport } from './reachability-preload.js';
|
|
10
|
+
import type { ExplicitlyRequestedExports } from './reachability-export-names.js';
|
|
14
11
|
/**
|
|
15
12
|
* Represents the computed results of a reachability analysis pass.
|
|
16
13
|
*/
|
|
17
14
|
export type ReachabilityResult = {
|
|
18
|
-
/**
|
|
19
|
-
* Map from import specifier (e.g. 'node:fs', '@/components/Button')
|
|
20
|
-
* to a Set of imported bindings, or '*' for namespace imports.
|
|
21
|
-
*/
|
|
22
15
|
reachableImports: Map<string, Set<string> | '*'>;
|
|
23
|
-
/**
|
|
24
|
-
* AST nodes of top-level declarations that are reachable.
|
|
25
|
-
*/
|
|
26
16
|
reachableDeclarations: Set<unknown>;
|
|
27
17
|
unreachableSideEffectImports: unknown[];
|
|
28
|
-
/**
|
|
29
|
-
* Indicates whether the file had explicit eco client roots, or fell back to treating all exports as roots.
|
|
30
|
-
*/
|
|
31
18
|
isFallbackRoots: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Whether the file was successfully parsed and analyzed.
|
|
34
|
-
*/
|
|
35
19
|
analyzed: boolean;
|
|
36
20
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Optional export filter supplied by the client graph boundary when a local
|
|
39
|
-
* module is imported through a narrower named-export surface.
|
|
40
|
-
*
|
|
41
|
-
* `'*'` means the whole module namespace is considered reachable, while a
|
|
42
|
-
* `Set` restricts analysis to the named exports that are actually requested by
|
|
43
|
-
* downstream client-reachable modules.
|
|
44
|
-
*/
|
|
45
|
-
type ExplicitlyRequestedExports = Set<string> | '*';
|
|
46
21
|
/**
|
|
47
22
|
* Analyzes a module using Oxc AST and extracts a strict reachability graph
|
|
48
|
-
* starting from client roots
|
|
49
|
-
*
|
|
50
|
-
* @param source - Raw source string of the module.
|
|
51
|
-
* @param filename - Absolute or relative path to the module file.
|
|
52
|
-
* @param program - Optional pre-parsed Oxc program AST. When supplied, the
|
|
53
|
-
* internal `parseSync` call is skipped entirely (avoids double-parsing).
|
|
54
|
-
* @param explicitlyRequestedExports - Optional named export filter propagated
|
|
55
|
-
* from a downstream importer when this module is only partially reachable.
|
|
23
|
+
* starting from client roots: `render`, `errorBoundary`, and `loadingFallback` of
|
|
24
|
+
* `eco.page`, `eco.layout`, or `eco.component`, plus a Page's named `preload` export.
|
|
56
25
|
*/
|
|
57
26
|
export declare function analyzeReachability(source: string, filename: string, program?: ParseResult['program'], explicitlyRequestedExports?: ExplicitlyRequestedExports): ReachabilityResult;
|
|
58
|
-
export {};
|