@ecopages/core 0.2.0-beta.26 → 0.2.0-beta.27
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/package.json +58 -50
- package/src/adapters/bun/server-adapter.js +2 -2
- package/src/adapters/node/server-adapter.js +2 -2
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +10 -0
- package/src/adapters/shared/hmr-entrypoint-registrar.js +34 -10
- package/src/adapters/shared/runtime-server-lifecycle.js +1 -1
- package/src/adapters/shared/server-static-builder.d.ts +2 -1
- package/src/adapters/shared/server-static-builder.js +16 -14
- package/src/adapters/shared/shared-hmr-manager.d.ts +11 -4
- package/src/adapters/shared/shared-hmr-manager.js +22 -3
- package/src/build/README.md +92 -46
- package/src/build/app-build-manifest-runtime.d.ts +28 -2
- package/src/build/app-build-manifest-runtime.js +26 -10
- package/src/build/{browser-runtime-plugin.d.ts → browser/browser-runtime-plugin.d.ts} +1 -1
- package/src/build/{browser-runtime-plugin.js → browser/browser-runtime-plugin.js} +1 -1
- package/src/build/{jsx-ownership-plugins.d.ts → browser/jsx-ownership-plugins.d.ts} +2 -2
- package/src/build/{jsx-ownership-plugins.js → browser/jsx-ownership-plugins.js} +2 -2
- package/src/build/build-adapter.d.ts +18 -21
- package/src/build/build-adapter.js +8 -43
- package/src/build/{build-input-fingerprint.d.ts → cache/build-input-fingerprint.d.ts} +3 -3
- package/src/build/cache/cache-constants.d.ts +4 -0
- package/src/build/cache/cache-constants.js +6 -0
- package/src/build/cache/cache-keys.d.ts +22 -0
- package/src/build/cache/cache-keys.js +63 -0
- package/src/build/{dev-browser-script-cache.d.ts → cache/dev-browser-script-cache.d.ts} +2 -2
- package/src/build/{dev-browser-script-cache.js → cache/dev-browser-script-cache.js} +4 -4
- package/src/build/{pages-unified-graph-build.d.ts → cache/pages-unified-graph-build.d.ts} +1 -1
- package/src/build/{pages-unified-graph-build.js → cache/pages-unified-graph-build.js} +18 -26
- package/src/build/{production-build-cache.d.ts → cache/production-build-cache.d.ts} +1 -1
- package/src/build/{production-build-cache.js → cache/production-build-cache.js} +2 -2
- package/src/build/{server-entry-build-cache.d.ts → cache/server-entry-build-cache.d.ts} +3 -4
- package/src/build/{server-entry-build-cache.js → cache/server-entry-build-cache.js} +16 -12
- package/src/build/{build-contracts.d.ts → contracts/build-contracts.d.ts} +1 -2
- package/src/build/contracts/build-manifest.d.ts +90 -0
- package/src/build/{build-manifest.js → contracts/build-manifest.js} +2 -2
- package/src/build/{rolldown-adapter-helpers.d.ts → rolldown/rolldown-adapter-helpers.d.ts} +20 -3
- package/src/build/{rolldown-adapter-helpers.js → rolldown/rolldown-adapter-helpers.js} +26 -6
- package/src/build/{rolldown-build-adapter.d.ts → rolldown/rolldown-build-adapter.d.ts} +1 -1
- package/src/build/{rolldown-plugin-bridge.d.ts → rolldown/rolldown-plugin-bridge.d.ts} +2 -2
- package/src/build/{rolldown-plugin-bridge.js → rolldown/rolldown-plugin-bridge.js} +1 -1
- package/src/build/{rolldown-source-transform-pass.d.ts → rolldown/rolldown-source-transform-pass.d.ts} +1 -1
- package/src/build/{rolldown-source-transform-pass.js → rolldown/rolldown-source-transform-pass.js} +4 -1
- package/src/build/{runtime-build-output-normalizer.js → rolldown/runtime-build-output-normalizer.js} +2 -2
- package/src/build/{build-profile-options.d.ts → runtime/build-profile-options.d.ts} +2 -2
- package/src/build/runtime/build-request-identity.d.ts +17 -0
- package/src/build/runtime/build-request-identity.js +54 -0
- package/src/build/runtime/build-request-policy.d.ts +59 -0
- package/src/build/runtime/build-request-policy.js +46 -0
- package/src/build/{build-runtime.d.ts → runtime/build-runtime.d.ts} +8 -4
- package/src/build/{build-runtime.js → runtime/build-runtime.js} +11 -11
- package/src/build/{deduping-build-executor.d.ts → runtime/deduping-build-executor.d.ts} +2 -9
- package/src/build/runtime/deduping-build-executor.js +34 -0
- package/src/build/{parallel-build-executor.d.ts → runtime/parallel-build-executor.d.ts} +1 -1
- package/src/build/{serialized-build-executor.d.ts → runtime/serialized-build-executor.d.ts} +1 -1
- package/src/config/config-builder.d.ts +1 -1
- package/src/diagnostics/startup-trace.d.ts +49 -2
- package/src/diagnostics/startup-trace.js +140 -8
- package/src/hmr/client/hmr-runtime.js +1 -1
- package/src/hmr/hmr-file-change-prep.d.ts +10 -0
- package/src/hmr/hmr-file-change-prep.js +17 -0
- package/src/plugins/alias-resolver-plugin.d.ts +1 -1
- package/src/plugins/eco-component-meta-plugin.d.ts +1 -1
- package/src/plugins/foreign-jsx-override-plugin.d.ts +1 -1
- package/src/plugins/integration-plugin.d.ts +16 -5
- package/src/plugins/integration-plugin.js +11 -1
- package/src/plugins/processor.d.ts +28 -8
- package/src/plugins/source-transform.d.ts +1 -1
- package/src/route-renderer/GRAPH.md +13 -19
- package/src/route-renderer/README.md +1 -1
- package/src/route-renderer/orchestration/component-render-context.d.ts +4 -4
- package/src/route-renderer/orchestration/foreign-subtree-execution.service.js +6 -2
- package/src/route-renderer/orchestration/integration-renderer.d.ts +11 -52
- package/src/route-renderer/orchestration/integration-renderer.js +38 -91
- package/src/route-renderer/orchestration/integration-route-render-adapter.d.ts +1 -8
- package/src/route-renderer/orchestration/integration-route-render-adapter.js +0 -2
- package/src/route-renderer/orchestration/page-browser-graph-session.d.ts +106 -0
- package/src/route-renderer/orchestration/page-browser-graph-session.js +436 -0
- package/src/route-renderer/orchestration/page-browser-graph.service.d.ts +9 -3
- package/src/route-renderer/orchestration/page-browser-graph.service.js +89 -40
- package/src/route-renderer/orchestration/render-output.utils.d.ts +14 -0
- package/src/route-renderer/orchestration/render-output.utils.js +30 -0
- package/src/route-renderer/orchestration/route-html-finalization.service.d.ts +0 -1
- package/src/route-renderer/orchestration/route-html-finalization.service.js +4 -9
- package/src/route-renderer/orchestration/route-prepared-options.builder.d.ts +1 -2
- package/src/route-renderer/orchestration/route-prepared-options.builder.js +1 -10
- package/src/route-renderer/orchestration/route-render-orchestrator.d.ts +3 -12
- package/src/route-renderer/orchestration/route-render-orchestrator.js +4 -14
- package/src/services/assets/asset-processing-service/asset-processing.service.js +1 -1
- package/src/services/assets/asset-processing-service/assets.types.d.ts +1 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +1 -1
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -2
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +2 -15
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +1 -1
- package/src/services/assets/browser-bundle.service.d.ts +27 -31
- package/src/services/assets/browser-bundle.service.js +12 -23
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +8 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +1 -7
- package/src/services/module-loading/page-module-import.service.d.ts +1 -1
- package/src/services/module-loading/page-module-import.service.js +40 -28
- package/src/services/module-loading/route-module-build-cache.store.js +1 -1
- package/src/services/module-loading/route-module-build-manifest.d.ts +2 -9
- package/src/services/module-loading/route-module-build-manifest.js +12 -43
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -1
- package/src/static-site-generator/README.md +1 -1
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +28 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +22 -0
- package/src/static-site-generator/static-build-invalidation.d.ts +2 -2
- package/src/static-site-generator/static-build-invalidation.js +3 -3
- package/src/static-site-generator/static-site-generator.js +23 -1
- package/src/types/internal-types.d.ts +10 -4
- package/src/types/public-types.d.ts +58 -9
- package/src/watchers/project-watcher.js +12 -2
- package/src/build/build-manifest.d.ts +0 -33
- package/src/build/deduping-build-executor.js +0 -56
- package/src/build/runtime-build-executor.d.ts +0 -14
- package/src/build/runtime-build-executor.js +0 -16
- /package/src/build/{browser-runtime-manifest.d.ts → browser/browser-runtime-manifest.d.ts} +0 -0
- /package/src/build/{browser-runtime-manifest.js → browser/browser-runtime-manifest.js} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.d.ts → browser/browser-runtime-plugin-helpers.d.ts} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.js → browser/browser-runtime-plugin-helpers.js} +0 -0
- /package/src/build/{lit-static-render-worker-context.d.ts → browser/lit-static-render-worker-context.d.ts} +0 -0
- /package/src/build/{lit-static-render-worker-context.js → browser/lit-static-render-worker-context.js} +0 -0
- /package/src/build/{build-input-fingerprint.js → cache/build-input-fingerprint.js} +0 -0
- /package/src/build/{build-contracts.js → contracts/build-contracts.js} +0 -0
- /package/src/build/{build-types.d.ts → contracts/build-types.d.ts} +0 -0
- /package/src/build/{build-types.js → contracts/build-types.js} +0 -0
- /package/src/build/{rolldown-build-adapter.js → rolldown/rolldown-build-adapter.js} +0 -0
- /package/src/build/{rolldown-build-invocation-metrics.d.ts → rolldown/rolldown-build-invocation-metrics.d.ts} +0 -0
- /package/src/build/{rolldown-build-invocation-metrics.js → rolldown/rolldown-build-invocation-metrics.js} +0 -0
- /package/src/build/{runtime-build-output-normalizer.d.ts → rolldown/runtime-build-output-normalizer.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.d.ts → rolldown/server-side-css-shim-plugin.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.js → rolldown/server-side-css-shim-plugin.js} +0 -0
- /package/src/build/{build-profile-options.js → runtime/build-profile-options.js} +0 -0
- /package/src/build/{parallel-build-executor.js → runtime/parallel-build-executor.js} +0 -0
- /package/src/build/{serialized-build-executor.js → runtime/serialized-build-executor.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
-
import { getAppBrowserBuildPlugins } from "
|
|
3
|
+
import { getAppBrowserBuildPlugins } from "../build-adapter.js";
|
|
4
4
|
import { createBuildInputsFingerprint, hashAppConfigFile } from "./build-input-fingerprint.js";
|
|
5
5
|
import {
|
|
6
6
|
readProductionCacheManifest,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
isProductionCacheManifestCurrent,
|
|
9
9
|
matchesProductionCacheFingerprint
|
|
10
10
|
} from "./production-build-cache.js";
|
|
11
|
-
import { getCorePackageVersion } from "
|
|
12
|
-
import { resolveInternalExecutionDir } from "
|
|
13
|
-
import { isDevelopmentRuntime } from "
|
|
11
|
+
import { getCorePackageVersion } from "./cache-keys.js";
|
|
12
|
+
import { resolveInternalExecutionDir } from "../../utils/resolve-work-dir.js";
|
|
13
|
+
import { isDevelopmentRuntime } from "../../utils/runtime.js";
|
|
14
14
|
const DEV_BROWSER_SCRIPT_CACHE_DIR = ".browser-script-bundles";
|
|
15
15
|
const DEV_BROWSER_SCRIPT_CACHE_FILENAME = ".build-cache.json";
|
|
16
16
|
function getDevBrowserScriptCacheDir(appConfig) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `ECOPAGES_UNIFIED_PAGES_GRAPH=0`. Covers all static page template extensions
|
|
6
6
|
* registered on the app config.
|
|
7
7
|
*/
|
|
8
|
-
import type { EcoPagesAppConfig } from '
|
|
8
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
9
9
|
export declare const PAGES_UNIFIED_GRAPH_CACHE_DIR = ".server-pages-graph";
|
|
10
10
|
export declare const PAGES_UNIFIED_GRAPH_CACHE_FILENAME = ".build-cache.json";
|
|
11
11
|
export interface PagesUnifiedGraphCacheManifest {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
import { fileSystem } from "@ecopages/file-system";
|
|
4
|
-
import { appLogger } from "
|
|
5
|
-
import { build
|
|
6
|
-
import { requireBuildRuntime } from "
|
|
7
|
-
import {
|
|
4
|
+
import { appLogger } from "../../global/app-logger.js";
|
|
5
|
+
import { build } from "../build-adapter.js";
|
|
6
|
+
import { requireBuildRuntime } from "../runtime/build-runtime.js";
|
|
7
|
+
import { createServerBuildRequest, resolveServerAppBuildPlugins } from "../runtime/build-request-policy.js";
|
|
8
8
|
import { createBuildInputsFingerprint, hashAppConfigFile } from "./build-input-fingerprint.js";
|
|
9
9
|
import {
|
|
10
10
|
isProductionCacheManifestCurrent,
|
|
@@ -13,12 +13,10 @@ import {
|
|
|
13
13
|
readProductionCacheManifest,
|
|
14
14
|
writeProductionCacheManifest
|
|
15
15
|
} from "./production-build-cache.js";
|
|
16
|
-
import { getCorePackageVersion } from "
|
|
17
|
-
import { resolveInternalExecutionDir } from "
|
|
18
|
-
import { getSharedRouteModuleBuildCache } from "
|
|
19
|
-
import {
|
|
20
|
-
import { resolveRouteModuleDependencyPaths } from "../services/module-loading/route-module-dependency-hasher.js";
|
|
21
|
-
import { getJsxOwnershipPlugins } from "./jsx-ownership-plugins.js";
|
|
16
|
+
import { getCorePackageVersion } from "./cache-keys.js";
|
|
17
|
+
import { resolveInternalExecutionDir } from "../../utils/resolve-work-dir.js";
|
|
18
|
+
import { getSharedRouteModuleBuildCache } from "../../services/module-loading/route-module-build-cache-registry.js";
|
|
19
|
+
import { resolveRouteModuleDependencyPaths } from "../../services/module-loading/route-module-dependency-hasher.js";
|
|
22
20
|
const PAGES_UNIFIED_GRAPH_CACHE_DIR = ".server-pages-graph";
|
|
23
21
|
const PAGES_UNIFIED_GRAPH_CACHE_FILENAME = ".build-cache.json";
|
|
24
22
|
function isPagesUnifiedGraphEnabled() {
|
|
@@ -45,8 +43,7 @@ function getPagesUnifiedGraphCachePath(appConfig) {
|
|
|
45
43
|
);
|
|
46
44
|
}
|
|
47
45
|
function createPagesUnifiedGraphBuildKey(appConfig, outdir) {
|
|
48
|
-
const
|
|
49
|
-
const pluginNames = [...plugins, ...getJsxOwnershipPlugins(appConfig)].map((plugin) => plugin.name).sort().join("|");
|
|
46
|
+
const pluginNames = resolveServerAppBuildPlugins(appConfig).map((plugin) => plugin.name).sort().join("|");
|
|
50
47
|
const templateExtensions = [...appConfig.templatesExt].sort().join("|");
|
|
51
48
|
return [
|
|
52
49
|
path.resolve(outdir),
|
|
@@ -121,8 +118,6 @@ async function ensurePagesUnifiedGraphBuilt(options) {
|
|
|
121
118
|
appLogger.debug("Reusing pages unified graph cache");
|
|
122
119
|
return existingManifest;
|
|
123
120
|
}
|
|
124
|
-
const plugins = options.appConfig.runtime?.buildManifest ? getAppServerBuildPlugins(options.appConfig) : [];
|
|
125
|
-
const mergedPlugins = [...plugins, ...getJsxOwnershipPlugins(options.appConfig)];
|
|
126
121
|
const routeModuleBuildCache = getSharedRouteModuleBuildCache(outdir, options.appConfig);
|
|
127
122
|
const entryRecord = {};
|
|
128
123
|
const entryKeysByPath = /* @__PURE__ */ new Map();
|
|
@@ -132,16 +127,14 @@ async function ensurePagesUnifiedGraphBuilt(options) {
|
|
|
132
127
|
entryKeysByPath.set(entryPath, entryKey);
|
|
133
128
|
}
|
|
134
129
|
appLogger.debugTime("pagesUnifiedGraphBuild");
|
|
135
|
-
const buildOptions = {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
entrypoints: entryRecord
|
|
144
|
-
};
|
|
130
|
+
const buildOptions = createServerBuildRequest(options.appConfig, {
|
|
131
|
+
profile: "route-module",
|
|
132
|
+
entrypoints: entryRecord,
|
|
133
|
+
outdir,
|
|
134
|
+
splitting: true,
|
|
135
|
+
naming: "[name]-[hash].[ext]"
|
|
136
|
+
});
|
|
137
|
+
const plugins = buildOptions.plugins ?? [];
|
|
145
138
|
const buildResult = await build(buildOptions, requireBuildRuntime(options.appConfig).getProfile("route-module"));
|
|
146
139
|
appLogger.debugTimeEnd("pagesUnifiedGraphBuild");
|
|
147
140
|
if (!buildResult.success) {
|
|
@@ -156,7 +149,6 @@ async function ensurePagesUnifiedGraphBuilt(options) {
|
|
|
156
149
|
if (!compiledOutput) {
|
|
157
150
|
throw new Error(`Pages unified graph build produced no output for ${entryPath}`);
|
|
158
151
|
}
|
|
159
|
-
normalizeNodeRuntimeBuildOutputFile(compiledOutput, options.appConfig.rootDir);
|
|
160
152
|
outputs[entryPath] = compiledOutput;
|
|
161
153
|
routeModuleBuildCache.recordBuild({
|
|
162
154
|
filePath: entryPath,
|
|
@@ -166,7 +158,7 @@ async function ensurePagesUnifiedGraphBuilt(options) {
|
|
|
166
158
|
outputPath: compiledOutput,
|
|
167
159
|
dependencyModulePaths: resolveRouteModuleDependencyPaths(buildResult, entryPath, options.appConfig.rootDir),
|
|
168
160
|
externalPackages: true,
|
|
169
|
-
plugins
|
|
161
|
+
plugins
|
|
170
162
|
});
|
|
171
163
|
}
|
|
172
164
|
const manifest = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileSystem } from "@ecopages/file-system";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { ROUTE_MODULE_BUILD_CACHE_FILENAME } from "
|
|
4
|
-
import { resolveInternalExecutionDir } from "
|
|
3
|
+
import { ROUTE_MODULE_BUILD_CACHE_FILENAME } from "./cache-constants.js";
|
|
4
|
+
import { resolveInternalExecutionDir } from "../../utils/resolve-work-dir.js";
|
|
5
5
|
const ROUTE_MODULE_CACHE_OUTDIRS = [".server-modules", ".server-route-modules"];
|
|
6
6
|
const PAGES_GRAPH_CACHE_DIR = ".server-pages-graph";
|
|
7
7
|
function getProductionBuildCacheManifestPaths(appConfig) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { BuildResult } from '
|
|
2
|
-
import type { EcoPagesAppConfig } from '
|
|
3
|
-
|
|
4
|
-
export declare const SERVER_ENTRY_BUILD_CACHE_FILENAME = ".build-cache.json";
|
|
1
|
+
import type { BuildResult } from '../build-adapter.js';
|
|
2
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
3
|
+
export { SERVER_ENTRY_BUILD_CACHE_FILENAME } from './cache-constants.js';
|
|
5
4
|
export declare const SERVER_BUNDLE_MANIFEST_FILENAME = "manifest.json";
|
|
6
5
|
export interface ServerBundleDeployManifest {
|
|
7
6
|
serverEntry: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveServerAppBuildPlugins } from "../runtime/build-request-policy.js";
|
|
4
4
|
import { createBuildInputsFingerprint } from "./build-input-fingerprint.js";
|
|
5
5
|
import {
|
|
6
6
|
isProductionCacheManifestCurrent,
|
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
readProductionCacheManifest,
|
|
10
10
|
writeProductionCacheManifest
|
|
11
11
|
} from "./production-build-cache.js";
|
|
12
|
-
import { getCorePackageVersion } from "
|
|
12
|
+
import { createPluginCacheKey, getCorePackageVersion } from "./cache-keys.js";
|
|
13
13
|
import {
|
|
14
14
|
RouteModuleDependencyHasher,
|
|
15
15
|
createRouteModuleDependencyHashes
|
|
16
|
-
} from "
|
|
17
|
-
import { resolveInternalExecutionDir } from "
|
|
18
|
-
import { SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME } from "
|
|
19
|
-
import {
|
|
20
|
-
|
|
16
|
+
} from "../../services/module-loading/route-module-dependency-hasher.js";
|
|
17
|
+
import { resolveInternalExecutionDir } from "../../utils/resolve-work-dir.js";
|
|
18
|
+
import { SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME } from "../../utils/resolve-entry-file.js";
|
|
19
|
+
import { SERVER_ENTRY_BUILD_CACHE_FILENAME } from "./cache-constants.js";
|
|
20
|
+
import { SERVER_ENTRY_BUILD_CACHE_FILENAME as SERVER_ENTRY_BUILD_CACHE_FILENAME2 } from "./cache-constants.js";
|
|
21
21
|
const SERVER_BUNDLE_MANIFEST_FILENAME = "manifest.json";
|
|
22
22
|
function getServerEntryCacheDir(appConfig) {
|
|
23
23
|
return path.join(resolveInternalExecutionDir(appConfig), ".server-entry");
|
|
@@ -33,11 +33,15 @@ function hashDependencyGraph(entryPath, dependencyGraph, hasher, rootDir) {
|
|
|
33
33
|
}
|
|
34
34
|
function createServerEntryBuildKey(appConfig) {
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return [
|
|
37
|
+
"server-entry-request-v2",
|
|
38
|
+
"node",
|
|
39
|
+
"esm",
|
|
40
|
+
"external-packages",
|
|
41
|
+
createPluginCacheKey(resolveServerAppBuildPlugins(appConfig))
|
|
42
|
+
].join("::");
|
|
39
43
|
} catch {
|
|
40
|
-
return "node::esm::external-packages";
|
|
44
|
+
return "server-entry-request-v2::node::esm::external-packages";
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
function getServerBundleOutputPaths(appConfig) {
|
|
@@ -151,7 +155,7 @@ function resolveProductionServerEntry(cwd = process.cwd()) {
|
|
|
151
155
|
}
|
|
152
156
|
export {
|
|
153
157
|
SERVER_BUNDLE_MANIFEST_FILENAME,
|
|
154
|
-
SERVER_ENTRY_BUILD_CACHE_FILENAME,
|
|
158
|
+
SERVER_ENTRY_BUILD_CACHE_FILENAME2 as SERVER_ENTRY_BUILD_CACHE_FILENAME,
|
|
155
159
|
getServerBundleOutputPaths,
|
|
156
160
|
lookupServerEntryBuildCache,
|
|
157
161
|
readServerEntryBuildCacheManifest,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EcoSourceTransform } from '
|
|
1
|
+
import type { EcoSourceTransform } from '../../plugins/source-transform.js';
|
|
2
2
|
import type { EcoBuildPlugin } from './build-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Which backend owns the app's build pipeline.
|
|
@@ -74,7 +74,6 @@ export interface BuildOptions {
|
|
|
74
74
|
};
|
|
75
75
|
plugins?: EcoBuildPlugin[];
|
|
76
76
|
sourceTransforms?: EcoSourceTransform[];
|
|
77
|
-
[key: string]: unknown;
|
|
78
77
|
}
|
|
79
78
|
/** Stable profile identifiers for `BuildAdapter.getTranspileOptions`. */
|
|
80
79
|
export type BuildTranspileProfile = 'browser-script' | 'hmr-runtime' | 'hmr-entrypoint';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
|
+
import { type BrowserRuntimeManifest } from '../browser/browser-runtime-manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sealed, app-owned registry of build plugins and browser runtime assets.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Core assembles one manifest during {@link ConfigBuilder.build} and stores it on
|
|
8
|
+
* `appConfig.runtime.buildManifest`. Request policy reads from this manifest when
|
|
9
|
+
* constructing server and browser {@link BuildOptions}; profiles do not inject
|
|
10
|
+
* plugins themselves.
|
|
11
|
+
*
|
|
12
|
+
* Contributor naming differs by layer but maps to the same buckets:
|
|
13
|
+
*
|
|
14
|
+
* | Integration getter | Processor getter | Manifest bucket |
|
|
15
|
+
* | --- | --- | --- |
|
|
16
|
+
* | `plugins` | `plugins` | `runtimePlugins` |
|
|
17
|
+
* | `browserBuildPlugins` | `buildPlugins` | `browserBundlePlugins` |
|
|
18
|
+
* | `browserRuntimeManifest` | — | `browserRuntimeManifest` |
|
|
19
|
+
* | — (file loaders on config) | — | `loaderPlugins` |
|
|
20
|
+
*
|
|
21
|
+
* Use {@link getServerBuildPlugins} and {@link getBrowserBuildPlugins} to turn
|
|
22
|
+
* buckets into the plugin lists passed to Rolldown. App-aware call sites should
|
|
23
|
+
* prefer {@link getAppServerBuildPlugins} and {@link getAppBrowserBuildPlugins},
|
|
24
|
+
* which add alias resolution, JSX ownership, and browser source-transform
|
|
25
|
+
* deduplication on top of the manifest lists.
|
|
26
|
+
*/
|
|
27
|
+
export interface AppBuildManifest {
|
|
28
|
+
/** File-extension loaders registered on the app config (for example `.mdx`). */
|
|
29
|
+
loaderPlugins: EcoBuildPlugin[];
|
|
30
|
+
/**
|
|
31
|
+
* Shared plugins for server-oriented and browser-oriented builds.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Sourced from integration `plugins` and processor `plugins`. Virtual-module
|
|
35
|
+
* loaders and transforms that must run during route-module transpile belong
|
|
36
|
+
* here.
|
|
37
|
+
*/
|
|
38
|
+
runtimePlugins: EcoBuildPlugin[];
|
|
39
|
+
/**
|
|
40
|
+
* Browser-bundle-only plugins.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Sourced from integration `browserBuildPlugins` and processor `buildPlugins`.
|
|
44
|
+
* Do not register server route or static-page transforms here.
|
|
45
|
+
*/
|
|
46
|
+
browserBundlePlugins: EcoBuildPlugin[];
|
|
47
|
+
/**
|
|
48
|
+
* Specifier → public URL map for client bundles.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Not a plugin list. {@link getBrowserBuildPlugins} synthesizes
|
|
52
|
+
* `browser-runtime-plugin` from this map to rewrite manifest-owned imports.
|
|
53
|
+
*/
|
|
54
|
+
browserRuntimeManifest: BrowserRuntimeManifest;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Merges plugin lists while preserving first-registration precedence by name.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Build manifests treat plugin names as stable identities. The first plugin
|
|
61
|
+
* with a given name wins so config-time assembly stays deterministic across
|
|
62
|
+
* loader, runtime, and browser buckets.
|
|
63
|
+
*/
|
|
64
|
+
export declare function mergeEcoBuildPlugins(...pluginLists: Array<EcoBuildPlugin[] | undefined>): EcoBuildPlugin[];
|
|
65
|
+
/**
|
|
66
|
+
* Creates one app-owned build manifest from the supplied plugin buckets.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createAppBuildManifest(input?: Partial<AppBuildManifest>): AppBuildManifest;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the shared browser runtime asset manifest sealed into the app build manifest.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBrowserRuntimeManifest(manifest: AppBuildManifest): BrowserRuntimeManifest;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the plugin list used for server-oriented builds.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Merges `loaderPlugins` then `runtimePlugins`. Browser-only buckets and the
|
|
78
|
+
* synthesized browser-runtime rewrite plugin are excluded.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getServerBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
81
|
+
/**
|
|
82
|
+
* Returns the plugin list used for browser-oriented builds.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* Merges, in order: `loaderPlugins`, `runtimePlugins`, a synthesized
|
|
86
|
+
* `browser-runtime-plugin` when `browserRuntimeManifest` has entries, then
|
|
87
|
+
* `browserBundlePlugins`. Plugin names dedupe with first-registration wins via
|
|
88
|
+
* {@link mergeEcoBuildPlugins}.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getBrowserBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME } from "
|
|
1
|
+
import { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME } from "../browser/browser-runtime-plugin.js";
|
|
2
2
|
import {
|
|
3
3
|
createBrowserRuntimeManifest,
|
|
4
4
|
mergeBrowserRuntimeManifests
|
|
5
|
-
} from "
|
|
5
|
+
} from "../browser/browser-runtime-manifest.js";
|
|
6
6
|
function mergeEcoBuildPlugins(...pluginLists) {
|
|
7
7
|
const byName = /* @__PURE__ */ new Map();
|
|
8
8
|
for (const plugins of pluginLists) {
|
|
@@ -8,10 +8,27 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import type { InputOptions, OutputOptions } from 'rolldown';
|
|
12
|
-
import type { EcoBuildPlugin } from '
|
|
13
|
-
import type { BuildDependencyGraph, BuildLog, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '
|
|
11
|
+
import type { InputOptions, OutputOptions, RolldownPlugin } from 'rolldown';
|
|
12
|
+
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
13
|
+
import type { BuildDependencyGraph, BuildLog, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '../build-adapter.js';
|
|
14
14
|
export declare function transpileProfileToOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves Node builtins as external before Rolldown falls back to file resolution.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Rolldown documents two first-class externalization points: its `external`
|
|
20
|
+
* option is checked before resolution, and a plugin `resolveId` hook can return
|
|
21
|
+
* `{ id, external: true }`. Core uses the latter to keep Node-builtin ownership
|
|
22
|
+
* explicit in the Node-target plugin pipeline.
|
|
23
|
+
*
|
|
24
|
+
* The hook runs before Rolldown's internal filesystem resolver, leaving imports
|
|
25
|
+
* such as `node:fs` intact for the Node runtime. It is installed only for
|
|
26
|
+
* Node-target builds, so browser bundles still surface accidental Node builtin
|
|
27
|
+
* imports as resolver failures.
|
|
28
|
+
*
|
|
29
|
+
* See {@link https://rolldown.rs/in-depth/external-modules | Rolldown external modules}.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createNodeBuiltinExternalPlugin(): RolldownPlugin;
|
|
15
32
|
export declare function extractDependencyGraph(chunks: Array<{
|
|
16
33
|
facadeModuleId: string | null;
|
|
17
34
|
moduleIds: string[];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
1
|
+
import { builtinModules, createRequire } from "node:module";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { isBarePackageImportSpecifier } from "
|
|
5
|
-
import {
|
|
4
|
+
import { isBarePackageImportSpecifier } from "../../plugins/tsconfig-import-resolver.js";
|
|
5
|
+
import {
|
|
6
|
+
collectBrowserRuntimeImportRewriteMap,
|
|
7
|
+
rewriteBrowserRuntimeImports
|
|
8
|
+
} from "../browser/browser-runtime-plugin.js";
|
|
6
9
|
import { createServerSideCssShimPlugin } from "./server-side-css-shim-plugin.js";
|
|
7
10
|
import { createRolldownPluginBridge } from "./rolldown-plugin-bridge.js";
|
|
8
11
|
import {
|
|
@@ -10,13 +13,14 @@ import {
|
|
|
10
13
|
isWorkspacePackageImport,
|
|
11
14
|
normalizeNodeRuntimeBuildOutputs
|
|
12
15
|
} from "./runtime-build-output-normalizer.js";
|
|
13
|
-
const corePackageRequire = createRequire(new URL("
|
|
16
|
+
const corePackageRequire = createRequire(new URL("../../../package.json", import.meta.url));
|
|
17
|
+
const nodeBuiltinSpecifiers = new Set(builtinModules);
|
|
14
18
|
let corePackageNames;
|
|
15
19
|
function getCorePackageNames() {
|
|
16
20
|
if (corePackageNames) {
|
|
17
21
|
return corePackageNames;
|
|
18
22
|
}
|
|
19
|
-
const packageJsonPath = new URL("
|
|
23
|
+
const packageJsonPath = new URL("../../../package.json", import.meta.url);
|
|
20
24
|
corePackageNames = /* @__PURE__ */ new Set();
|
|
21
25
|
try {
|
|
22
26
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -99,6 +103,17 @@ function createExternalMatcher(options, appRootRequireCache) {
|
|
|
99
103
|
return !shouldBundlePackageImport(id, contextRoot, appRootRequireCache);
|
|
100
104
|
};
|
|
101
105
|
}
|
|
106
|
+
function isNodeBuiltinSpecifier(id) {
|
|
107
|
+
return id.startsWith("node:") || nodeBuiltinSpecifiers.has(id);
|
|
108
|
+
}
|
|
109
|
+
function createNodeBuiltinExternalPlugin() {
|
|
110
|
+
return {
|
|
111
|
+
name: "ecopages-node-builtin-external",
|
|
112
|
+
resolveId(id) {
|
|
113
|
+
return isNodeBuiltinSpecifier(id) ? { id, external: true } : null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
102
117
|
function mapRolldownFormat(value) {
|
|
103
118
|
switch (value) {
|
|
104
119
|
case "cjs":
|
|
@@ -204,7 +219,11 @@ function resolveRolldownOptions(options, contextRoot, outdir, appRootRequireCach
|
|
|
204
219
|
const bundlePlugins = options.plugins ?? [];
|
|
205
220
|
const sourceTransforms = options.target === "browser" ? options.sourceTransforms ?? [] : [];
|
|
206
221
|
const appPlugins = createRolldownPluginBridge(bundlePlugins, contextRoot, sourceTransforms);
|
|
207
|
-
const allPlugins = [
|
|
222
|
+
const allPlugins = [
|
|
223
|
+
...mapRolldownPlatform(options.target) === "node" ? [createNodeBuiltinExternalPlugin()] : [],
|
|
224
|
+
...options.target !== "browser" ? [createServerSideCssShimPlugin()] : [],
|
|
225
|
+
...appPlugins
|
|
226
|
+
];
|
|
208
227
|
const inputOptions = {
|
|
209
228
|
input: options.entrypoints,
|
|
210
229
|
cwd: contextRoot,
|
|
@@ -322,6 +341,7 @@ function buildResultFromRolldownOutput(output, outdir, contextRoot) {
|
|
|
322
341
|
export {
|
|
323
342
|
buildResultFromRolldownOutput,
|
|
324
343
|
clearRewriteCacheForTests,
|
|
344
|
+
createNodeBuiltinExternalPlugin,
|
|
325
345
|
extractDependencyGraph,
|
|
326
346
|
resolveRolldownOptions,
|
|
327
347
|
rewriteBrowserRuntimeImportsInOutputs,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Each `build()` creates a fresh `rolldown()` bundler.
|
|
10
10
|
*/
|
|
11
|
-
import type { BuildAdapter, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '
|
|
11
|
+
import type { BuildAdapter, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '../build-adapter.js';
|
|
12
12
|
export declare class RolldownBuildAdapter implements BuildAdapter {
|
|
13
13
|
readonly ownership: "rolldown";
|
|
14
14
|
/** Per-adapter require cache, keyed on resolved context root. */
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
* on every source file.
|
|
41
41
|
*/
|
|
42
42
|
import type { Plugin } from 'rolldown';
|
|
43
|
-
import type { EcoSourceTransform } from '
|
|
44
|
-
import type { EcoBuildPlugin } from '
|
|
43
|
+
import type { EcoSourceTransform } from '../../plugins/source-transform.js';
|
|
44
|
+
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
45
45
|
/**
|
|
46
46
|
* Creates a Rolldown `Plugin` array that drives the supplied
|
|
47
47
|
* `EcoBuildPlugin` instances.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { finalizeLoadResultWithSourceTransforms } from "./rolldown-source-transform-pass.js";
|
|
3
|
-
import { escapeRegExp } from "
|
|
3
|
+
import { escapeRegExp } from "../browser/browser-runtime-plugin-helpers.js";
|
|
4
4
|
const NAMESPACE_SEPARATOR = ":";
|
|
5
5
|
function joinNamespace(namespace, value) {
|
|
6
6
|
return namespace ? `${namespace}${NAMESPACE_SEPARATOR}${value}` : value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LoadResult, SourceDescription } from 'rolldown';
|
|
2
|
-
import { type EcoSourceTransform } from '
|
|
2
|
+
import { type EcoSourceTransform } from '../../plugins/source-transform.js';
|
|
3
3
|
/**
|
|
4
4
|
* Runs app-owned source transforms after first-wins `onLoad` plugins produce
|
|
5
5
|
* module contents for one Rolldown load request.
|
package/src/build/{rolldown-source-transform-pass.js → rolldown/rolldown-source-transform-pass.js}
RENAMED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
applySourceTransforms,
|
|
5
|
+
normalizeTransformId
|
|
6
|
+
} from "../../plugins/source-transform.js";
|
|
4
7
|
const TRANSFORMABLE_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mdx"]);
|
|
5
8
|
function shouldApplySourceTransforms(namespace, sourcePath) {
|
|
6
9
|
if (namespace !== void 0) {
|
package/src/build/{runtime-build-output-normalizer.js → rolldown/runtime-build-output-normalizer.js}
RENAMED
|
@@ -2,8 +2,8 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { isBarePackageImportSpecifier } from "
|
|
6
|
-
const corePackageRequire = createRequire(new URL("
|
|
5
|
+
import { isBarePackageImportSpecifier } from "../../plugins/tsconfig-import-resolver.js";
|
|
6
|
+
const corePackageRequire = createRequire(new URL("../../../package.json", import.meta.url));
|
|
7
7
|
const appDeclaredPackageCache = /* @__PURE__ */ new Map();
|
|
8
8
|
const appWorkspacePackageCache = /* @__PURE__ */ new Map();
|
|
9
9
|
const CORE_RUNTIME_BARE_SPECIFIER_PACKAGES = /* @__PURE__ */ new Set(["ws"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BuildOptions } from '
|
|
1
|
+
import type { BuildOptions } from '../build-adapter.js';
|
|
2
2
|
import type { BuildProfile } from './build-runtime.js';
|
|
3
|
-
import type { EcoPagesAppConfig } from '
|
|
3
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Resolves shared Rolldown options for a build profile.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BuildOptions } from '../contracts/build-contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical identity for one complete {@link BuildOptions} request.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Semantically unordered collections (`external`, `define` keys, array entrypoints)
|
|
7
|
+
* are sorted. Plugin, `conditions`, and source-transform order is preserved because
|
|
8
|
+
* Rolldown hook and `conditionNames` precedence depend on it.
|
|
9
|
+
*
|
|
10
|
+
* Deprecated / ignored adapter fields (`splitting`, `bundle`, `outbase`) still
|
|
11
|
+
* participate in the key so requests that differ only on those fields do not
|
|
12
|
+
* coalesce. Empty `conditions` / `define` / `external` normalize to the same
|
|
13
|
+
* sentinel as `undefined`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createBuildRequestIdentity(options: BuildOptions): string;
|
|
16
|
+
/** @deprecated Use {@link createBuildRequestIdentity}. */
|
|
17
|
+
export declare const createBuildOptionsDedupeKey: typeof createBuildRequestIdentity;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { createJsxCacheKey, createPluginCacheKey, createSourceTransformCacheKey } from "../cache/cache-keys.js";
|
|
3
|
+
function normalizeEntrypoints(entrypoints) {
|
|
4
|
+
if (Array.isArray(entrypoints)) {
|
|
5
|
+
return entrypoints.map((entrypoint) => path.resolve(entrypoint)).sort().join("|");
|
|
6
|
+
}
|
|
7
|
+
return Object.entries(entrypoints).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}:${path.resolve(value)}`).join("|");
|
|
8
|
+
}
|
|
9
|
+
function normalizeOrderedStringList(values, label) {
|
|
10
|
+
if (!values || values.length === 0) {
|
|
11
|
+
return `${label}:default`;
|
|
12
|
+
}
|
|
13
|
+
return `${label}:${values.join(",")}`;
|
|
14
|
+
}
|
|
15
|
+
function normalizeUnorderedStringList(values, label) {
|
|
16
|
+
if (!values || values.length === 0) {
|
|
17
|
+
return `${label}:default`;
|
|
18
|
+
}
|
|
19
|
+
return `${label}:${[...values].sort().join(",")}`;
|
|
20
|
+
}
|
|
21
|
+
function normalizeDefine(define) {
|
|
22
|
+
if (!define || Object.keys(define).length === 0) {
|
|
23
|
+
return "define:default";
|
|
24
|
+
}
|
|
25
|
+
return `define:${Object.entries(define).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}=${value}`).join(",")}`;
|
|
26
|
+
}
|
|
27
|
+
function createBuildRequestIdentity(options) {
|
|
28
|
+
return [
|
|
29
|
+
normalizeEntrypoints(options.entrypoints),
|
|
30
|
+
options.root ? path.resolve(options.root) : "root:default",
|
|
31
|
+
options.outdir ? path.resolve(options.outdir) : "outdir:default",
|
|
32
|
+
options.outbase ? path.resolve(options.outbase) : "outbase:default",
|
|
33
|
+
options.splitting ?? "splitting:default",
|
|
34
|
+
options.bundle ?? "bundle:default",
|
|
35
|
+
options.externalPackages ?? "externalPackages:default",
|
|
36
|
+
options.target ?? "target:default",
|
|
37
|
+
options.format ?? "format:default",
|
|
38
|
+
options.sourcemap ?? "sourcemap:default",
|
|
39
|
+
options.minify ?? "minify:default",
|
|
40
|
+
options.treeshaking ?? "treeshaking:default",
|
|
41
|
+
options.naming ?? "naming:default",
|
|
42
|
+
normalizeOrderedStringList(options.conditions, "conditions"),
|
|
43
|
+
normalizeDefine(options.define),
|
|
44
|
+
normalizeUnorderedStringList(options.external, "external"),
|
|
45
|
+
createJsxCacheKey(options.jsx),
|
|
46
|
+
createPluginCacheKey(options.plugins),
|
|
47
|
+
createSourceTransformCacheKey(options.sourceTransforms)
|
|
48
|
+
].join("::");
|
|
49
|
+
}
|
|
50
|
+
const createBuildOptionsDedupeKey = createBuildRequestIdentity;
|
|
51
|
+
export {
|
|
52
|
+
createBuildOptionsDedupeKey,
|
|
53
|
+
createBuildRequestIdentity
|
|
54
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
2
|
+
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
3
|
+
import type { BuildOptions, BuildTranspileProfile } from '../contracts/build-contracts.js';
|
|
4
|
+
import type { BuildProfile } from './build-runtime.js';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves app-owned server plugins plus JSX ownership for one config.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Always goes through {@link getAppServerBuildPlugins} so sealed-manifest and
|
|
10
|
+
* loader-fallback apps share one plugin list with the alias resolver. Used by
|
|
11
|
+
* both request assembly and unified-graph cache keys.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveServerAppBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[];
|
|
14
|
+
/**
|
|
15
|
+
* Merges caller plugins with app-owned manifest plugins.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* App-manifest plugins cannot be silently replaced by same-name caller plugins.
|
|
19
|
+
* Unique caller plugins are prepended so first-wins Rolldown hooks (for example
|
|
20
|
+
* React vendor/alias rewrites) still run before general app loaders. Use
|
|
21
|
+
* `excludeAppBuildPlugins` on browser requests to omit app-owned plugins.
|
|
22
|
+
*/
|
|
23
|
+
export declare function mergeCallerBuildPlugins(appPlugins: EcoBuildPlugin[], callerPlugins?: EcoBuildPlugin[]): EcoBuildPlugin[];
|
|
24
|
+
export type ServerBuildRequestInput = Partial<BuildOptions> & {
|
|
25
|
+
entrypoints: BuildOptions['entrypoints'];
|
|
26
|
+
profile?: Extract<BuildProfile, 'server-entry' | 'route-module'>;
|
|
27
|
+
};
|
|
28
|
+
export type BrowserBuildRequestInput = Partial<BuildOptions> & {
|
|
29
|
+
entrypoints: BuildOptions['entrypoints'];
|
|
30
|
+
profile: BuildTranspileProfile;
|
|
31
|
+
excludeAppBuildPlugins?: string[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Assembles a complete server-oriented {@link BuildOptions} before scheduling.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Defaults `profile` to `'route-module'`. Plugins are
|
|
38
|
+
* {@link resolveServerAppBuildPlugins} plus unique caller contributions via
|
|
39
|
+
* {@link mergeCallerBuildPlugins}. Does not attach `sourceTransforms` — unlike
|
|
40
|
+
* {@link createBrowserBuildRequest}. Pass the returned options into
|
|
41
|
+
* {@link BuildRuntime.getProfile}; the runtime no longer injects plugins.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createServerBuildRequest(appConfig: EcoPagesAppConfig, input: ServerBuildRequestInput): BuildOptions;
|
|
44
|
+
/**
|
|
45
|
+
* Assembles a complete browser-oriented {@link BuildOptions} before scheduling.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Applies {@link resolveBuildProfileOptions} for `'browser-hmr'` (browser target
|
|
49
|
+
* defaults), then overlays {@link getAppTranspileOptions} for the given
|
|
50
|
+
* {@link BuildTranspileProfile}. That profile selects transpile settings only;
|
|
51
|
+
* the {@link BuildRuntime} executor slot is chosen later by the caller
|
|
52
|
+
* (typically {@link BrowserBundleService}).
|
|
53
|
+
*
|
|
54
|
+
* Always attaches {@link getAppSourceTransforms}. App browser plugins come from
|
|
55
|
+
* {@link getAppBrowserBuildPlugins} (includes JSX ownership); use
|
|
56
|
+
* `excludeAppBuildPlugins` to omit app-owned names. Caller plugins cannot
|
|
57
|
+
* replace app-manifest names ({@link mergeCallerBuildPlugins}).
|
|
58
|
+
*/
|
|
59
|
+
export declare function createBrowserBuildRequest(appConfig: EcoPagesAppConfig, input: BrowserBuildRequestInput): BuildOptions;
|