zephyr-rolldown-plugin 0.0.0-canary-20250513234234 → 0.0.0-canary-20250514220856
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/dist/lib/zephyr-rolldown-plugin.d.ts +2 -21
- package/dist/lib/zephyr-rolldown-plugin.js +7 -18
- package/dist/lib/zephyr-rolldown-plugin.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/lib/internal/extract-rolldown-build-stats.d.ts +0 -13
- package/dist/lib/internal/extract-rolldown-build-stats.js +0 -248
- package/dist/lib/internal/extract-rolldown-build-stats.js.map +0 -1
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
import type { InputOptions, NormalizedOutputOptions, OutputBundle } from 'rolldown';
|
|
2
|
-
export
|
|
3
|
-
name?: string;
|
|
4
|
-
filename?: string;
|
|
5
|
-
exposes?: Record<string, string | {
|
|
6
|
-
import: string;
|
|
7
|
-
}>;
|
|
8
|
-
remotes?: Record<string, string>;
|
|
9
|
-
shared?: Record<string, string | {
|
|
10
|
-
requiredVersion?: string;
|
|
11
|
-
singleton?: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
additionalShared?: Array<string | {
|
|
14
|
-
libraryName: string;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
interface ZephyrRolldownOptions {
|
|
18
|
-
mfConfig?: RolldownModuleFederationConfig | undefined;
|
|
19
|
-
}
|
|
20
|
-
export declare function withZephyr(options?: ZephyrRolldownOptions): {
|
|
2
|
+
export declare function withZephyr(): {
|
|
21
3
|
name: string;
|
|
22
|
-
buildStart: (
|
|
4
|
+
buildStart: (options: InputOptions) => Promise<void>;
|
|
23
5
|
writeBundle: (_options: NormalizedOutputOptions, bundle: OutputBundle) => Promise<void>;
|
|
24
6
|
};
|
|
25
|
-
export {};
|
|
@@ -4,7 +4,6 @@ exports.withZephyr = withZephyr;
|
|
|
4
4
|
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
5
|
const node_process_1 = require("node:process");
|
|
6
6
|
const get_assets_map_1 = require("./internal/get-assets-map");
|
|
7
|
-
const extract_rolldown_build_stats_1 = require("./internal/extract-rolldown-build-stats");
|
|
8
7
|
const getInputFolder = (options) => {
|
|
9
8
|
if (typeof options.input === 'string')
|
|
10
9
|
return options.input;
|
|
@@ -14,15 +13,14 @@ const getInputFolder = (options) => {
|
|
|
14
13
|
return Object.values(options.input)[0];
|
|
15
14
|
return (0, node_process_1.cwd)();
|
|
16
15
|
};
|
|
17
|
-
function withZephyr(
|
|
16
|
+
function withZephyr() {
|
|
18
17
|
const { zephyr_engine_defer, zephyr_defer_create } = zephyr_agent_1.ZephyrEngine.defer_create();
|
|
19
|
-
let path_to_execution_dir;
|
|
20
18
|
return {
|
|
21
19
|
name: 'with-zephyr',
|
|
22
|
-
buildStart: async (
|
|
23
|
-
path_to_execution_dir = getInputFolder(
|
|
20
|
+
buildStart: async (options) => {
|
|
21
|
+
const path_to_execution_dir = getInputFolder(options);
|
|
24
22
|
zephyr_defer_create({
|
|
25
|
-
builder: '
|
|
23
|
+
builder: 'rollup', //TODO(Nestor): API is the same, but we should make it explicit.
|
|
26
24
|
context: path_to_execution_dir,
|
|
27
25
|
});
|
|
28
26
|
},
|
|
@@ -31,19 +29,10 @@ function withZephyr(options) {
|
|
|
31
29
|
const zephyr_engine = await zephyr_engine_defer;
|
|
32
30
|
// Start a new build
|
|
33
31
|
await zephyr_engine.start_new_build();
|
|
34
|
-
//
|
|
35
|
-
const assetsMap = (0, get_assets_map_1.getAssetsMap)(bundle);
|
|
36
|
-
// Generate enhanced build stats for Rolldown
|
|
37
|
-
const buildStats = await (0, extract_rolldown_build_stats_1.extractRolldownBuildStats)({
|
|
38
|
-
zephyr_engine,
|
|
39
|
-
bundle,
|
|
40
|
-
mfConfig: options === null || options === void 0 ? void 0 : options.mfConfig,
|
|
41
|
-
root: path_to_execution_dir,
|
|
42
|
-
});
|
|
43
|
-
// Upload assets and build stats
|
|
32
|
+
// Upload assets and finish the build
|
|
44
33
|
await zephyr_engine.upload_assets({
|
|
45
|
-
assetsMap,
|
|
46
|
-
buildStats,
|
|
34
|
+
assetsMap: (0, get_assets_map_1.getAssetsMap)(bundle),
|
|
35
|
+
buildStats: await (0, zephyr_agent_1.zeBuildDashData)(zephyr_engine),
|
|
47
36
|
});
|
|
48
37
|
await zephyr_engine.build_finished();
|
|
49
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zephyr-rolldown-plugin.js","sourceRoot":"","sources":["../../src/lib/zephyr-rolldown-plugin.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"zephyr-rolldown-plugin.js","sourceRoot":"","sources":["../../src/lib/zephyr-rolldown-plugin.ts"],"names":[],"mappings":";;AAYA,gCA+BC;AA1CD,+CAAiF;AACjF,+CAAmC;AACnC,8DAAyD;AAEzD,MAAM,cAAc,GAAG,CAAC,OAAqB,EAAU,EAAE;IACvD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,IAAA,kBAAG,GAAE,CAAC;AACf,CAAC,CAAC;AAEF,SAAgB,UAAU;IACxB,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,GAAG,2BAAY,CAAC,YAAY,EAAE,CAAC;IAEjF,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,KAAK,EAAE,OAAqB,EAAE,EAAE;YAC1C,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YACtD,mBAAmB,CAAC;gBAClB,OAAO,EAAE,QAAQ,EAAE,gEAAgE;gBACnF,OAAO,EAAE,qBAAqB;aAC/B,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,KAAK,EAAE,QAAiC,EAAE,MAAoB,EAAE,EAAE;YAC7E,IAAI,CAAC;gBACH,MAAM,aAAa,GAAG,MAAM,mBAAmB,CAAC;gBAEhD,oBAAoB;gBACpB,MAAM,aAAa,CAAC,eAAe,EAAE,CAAC;gBAEtC,qCAAqC;gBACrC,MAAM,aAAa,CAAC,aAAa,CAAC;oBAChC,SAAS,EAAE,IAAA,6BAAY,EAAC,MAAM,CAAC;oBAC/B,UAAU,EAAE,MAAM,IAAA,8BAAe,EAAC,aAAa,CAAC;iBACjD,CAAC,CAAC;gBAEH,MAAM,aAAa,CAAC,cAAc,EAAE,CAAC;YACvC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAA,oBAAK,EAAC,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-rolldown-plugin",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20250514220856",
|
|
4
4
|
"description": "Rolldown plugin for Zephyr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"is-ci": "^4.1.0",
|
|
20
20
|
"rolldown": "1.0.0-beta.3",
|
|
21
|
-
"zephyr-agent": "0.0.0-canary-
|
|
21
|
+
"zephyr-agent": "0.0.0-canary-20250514220856"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/is-ci": "3.0.4",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { OutputBundle } from 'rolldown';
|
|
2
|
-
import type { ZephyrEngine } from 'zephyr-agent';
|
|
3
|
-
import type { ZephyrBuildStats } from 'zephyr-edge-contract';
|
|
4
|
-
import type { RolldownModuleFederationConfig } from '../zephyr-rolldown-plugin';
|
|
5
|
-
interface RolldownBuildStatsOptions {
|
|
6
|
-
zephyr_engine: ZephyrEngine;
|
|
7
|
-
bundle: OutputBundle;
|
|
8
|
-
mfConfig?: RolldownModuleFederationConfig | undefined;
|
|
9
|
-
root?: string;
|
|
10
|
-
}
|
|
11
|
-
/** Extract build statistics specific to Rolldown builds */
|
|
12
|
-
export declare function extractRolldownBuildStats({ zephyr_engine, bundle, mfConfig, root, }: RolldownBuildStatsOptions): Promise<ZephyrBuildStats>;
|
|
13
|
-
export {};
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractRolldownBuildStats = extractRolldownBuildStats;
|
|
4
|
-
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
-
/** Extract build statistics specific to Rolldown builds */
|
|
6
|
-
async function extractRolldownBuildStats({ zephyr_engine, bundle, mfConfig, root = process.cwd(), }) {
|
|
7
|
-
(0, zephyr_agent_1.ze_log)('Extracting Rolldown build stats');
|
|
8
|
-
const consumeMap = new Map();
|
|
9
|
-
if (!bundle) {
|
|
10
|
-
(0, zephyr_agent_1.ze_log)('No bundle found, skipping build stats extraction');
|
|
11
|
-
}
|
|
12
|
-
const app = zephyr_engine.applicationProperties;
|
|
13
|
-
const { git } = zephyr_engine.gitProperties;
|
|
14
|
-
const { isCI } = zephyr_engine.env;
|
|
15
|
-
// Get IDs and configurations
|
|
16
|
-
const version = await zephyr_engine.snapshotId;
|
|
17
|
-
const application_uid = zephyr_engine.application_uid;
|
|
18
|
-
const buildId = await zephyr_engine.build_id;
|
|
19
|
-
const { EDGE_URL, PLATFORM, DELIMITER } = await zephyr_engine.application_configuration;
|
|
20
|
-
// Extract information from Module Federation config if available
|
|
21
|
-
const name = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.name) || app.name;
|
|
22
|
-
const filename = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.filename) || 'remoteEntry.js';
|
|
23
|
-
const remotes = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.remotes) ? Object.keys(mfConfig.remotes) : [];
|
|
24
|
-
// Get bundle stats
|
|
25
|
-
const totalSize = calculateBundleSize(bundle);
|
|
26
|
-
const fileCount = Object.keys(bundle).length;
|
|
27
|
-
// Count chunks and collect import/export info
|
|
28
|
-
const chunks = Object.values(bundle).filter((item) => item.type === 'chunk');
|
|
29
|
-
const chunkCount = chunks.length;
|
|
30
|
-
const assetCount = fileCount - chunkCount;
|
|
31
|
-
// Extract all dynamic imports from chunks
|
|
32
|
-
const dynamicImports = new Set();
|
|
33
|
-
chunks.forEach((chunk) => {
|
|
34
|
-
(chunk.dynamicImports || []).forEach((imp) => dynamicImports.add(imp));
|
|
35
|
-
});
|
|
36
|
-
// Different regex patterns to match various loadRemote call formats
|
|
37
|
-
const regexPatterns = [
|
|
38
|
-
// Basic pattern: loadRemote("remote/component")
|
|
39
|
-
/loadRemote\(["']([^/]+)\/([^'"]+)["']\)/g,
|
|
40
|
-
// Destructured pattern: { loadRemote: c } = a, then c("remote/component")
|
|
41
|
-
/(?:\{[ \t]*loadRemote:[ \t]*([a-zA-Z0-9_$]+)[ \t]*\}|\blodRemote[ \t]*:[ \t]*([a-zA-Z0-9_$]+)\b).*?([a-zA-Z0-9_$]+)[ \t]*\(["']([^/]+)\/([^'"]+)["']\)/g,
|
|
42
|
-
// Promise chain pattern: n.then(e => c("remote/component"))
|
|
43
|
-
/\.then\([ \t]*(?:[a-zA-Z0-9_$]+)[ \t]*=>[ \t]*(?:[a-zA-Z0-9_$]+)\(["']([^/]+)\/([^'"]+)["']\)\)/g,
|
|
44
|
-
];
|
|
45
|
-
// Process the bundle to find the loadRemote calls using multiple regex patterns
|
|
46
|
-
chunks.forEach((chunk) => {
|
|
47
|
-
try {
|
|
48
|
-
const code = chunk.code;
|
|
49
|
-
// Try each regex pattern
|
|
50
|
-
for (const pattern of regexPatterns) {
|
|
51
|
-
// Reset lastIndex to search from beginning
|
|
52
|
-
pattern.lastIndex = 0;
|
|
53
|
-
let match;
|
|
54
|
-
while ((match = pattern.exec(code)) !== null) {
|
|
55
|
-
// The match array structure depends on the regex pattern
|
|
56
|
-
let remoteName, componentName;
|
|
57
|
-
if (match.length === 3) {
|
|
58
|
-
// First pattern: loadRemote("remote/component")
|
|
59
|
-
remoteName = match[1];
|
|
60
|
-
componentName = match[2];
|
|
61
|
-
}
|
|
62
|
-
else if (match.length === 6) {
|
|
63
|
-
// Second pattern: destructured variant
|
|
64
|
-
remoteName = match[4];
|
|
65
|
-
componentName = match[5];
|
|
66
|
-
}
|
|
67
|
-
else if (match.length >= 3) {
|
|
68
|
-
// Third pattern: promise chain
|
|
69
|
-
remoteName = match[1];
|
|
70
|
-
componentName = match[2];
|
|
71
|
-
}
|
|
72
|
-
if (remoteName && componentName) {
|
|
73
|
-
const moduleIds = chunk.facadeModuleId
|
|
74
|
-
? [chunk.facadeModuleId]
|
|
75
|
-
: Object.keys(chunk.modules || {});
|
|
76
|
-
consumeMap.set(`${remoteName}-${componentName}`, {
|
|
77
|
-
consumingApplicationID: componentName,
|
|
78
|
-
applicationID: remoteName,
|
|
79
|
-
name: componentName,
|
|
80
|
-
usedIn: moduleIds.map((id) => ({
|
|
81
|
-
file: id.replace(root, ''),
|
|
82
|
-
url: id.replace(root, ''),
|
|
83
|
-
})),
|
|
84
|
-
});
|
|
85
|
-
(0, zephyr_agent_1.ze_log)('Found remote import', { remoteName, componentName });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Extra pattern specifically for the promise chain syntax
|
|
90
|
-
const promiseChainPattern = /\w+\s*=\s*\w+\.then\(\w+\s*=>\s*\w+\(["']([^/]+)\/([^'"]+)["']\)\)/g;
|
|
91
|
-
let promiseMatch;
|
|
92
|
-
while ((promiseMatch = promiseChainPattern.exec(chunk.code)) !== null) {
|
|
93
|
-
if (promiseMatch.length >= 3) {
|
|
94
|
-
const remoteName = promiseMatch[1];
|
|
95
|
-
const componentName = promiseMatch[2];
|
|
96
|
-
const moduleIds = chunk.facadeModuleId
|
|
97
|
-
? [chunk.facadeModuleId]
|
|
98
|
-
: Object.keys(chunk.modules || {});
|
|
99
|
-
consumeMap.set(`${remoteName}-${componentName}`, {
|
|
100
|
-
consumingApplicationID: componentName,
|
|
101
|
-
applicationID: remoteName,
|
|
102
|
-
name: componentName,
|
|
103
|
-
usedIn: moduleIds.map((id) => ({
|
|
104
|
-
file: id.replace(root, ''),
|
|
105
|
-
url: id.replace(root, ''),
|
|
106
|
-
})),
|
|
107
|
-
});
|
|
108
|
-
(0, zephyr_agent_1.ze_log)('Found remote import in promise chain', { remoteName, componentName });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
(0, zephyr_agent_1.ze_log)('Error parsing chunk for loadRemote calls', {
|
|
114
|
-
error,
|
|
115
|
-
chunkId: chunk.fileName,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
(0, zephyr_agent_1.ze_log)('consumeMap', ...consumeMap);
|
|
120
|
-
// Extract shared dependencies from Module Federation config
|
|
121
|
-
const overrides = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.shared)
|
|
122
|
-
? Object.entries(mfConfig.shared).map(([name, version]) => {
|
|
123
|
-
var _a, _b;
|
|
124
|
-
// Get version from package dependencies if available or from config
|
|
125
|
-
let finalVersion = '0.0.0';
|
|
126
|
-
if ((_a = zephyr_engine.npmProperties.dependencies) === null || _a === void 0 ? void 0 : _a[name]) {
|
|
127
|
-
// Resolve catalog reference in dependencies if present
|
|
128
|
-
const depVersion = zephyr_engine.npmProperties.dependencies[name];
|
|
129
|
-
finalVersion = depVersion.startsWith('catalog:')
|
|
130
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: depVersion })[name]
|
|
131
|
-
: depVersion;
|
|
132
|
-
}
|
|
133
|
-
else if ((_b = zephyr_engine.npmProperties.peerDependencies) === null || _b === void 0 ? void 0 : _b[name]) {
|
|
134
|
-
// Resolve catalog reference in peer dependencies if present
|
|
135
|
-
const peerVersion = zephyr_engine.npmProperties.peerDependencies[name];
|
|
136
|
-
finalVersion = peerVersion.startsWith('catalog:')
|
|
137
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: peerVersion })[name]
|
|
138
|
-
: peerVersion;
|
|
139
|
-
}
|
|
140
|
-
else if (typeof version === 'string') {
|
|
141
|
-
// Resolve catalog reference if present
|
|
142
|
-
finalVersion = version.startsWith('catalog:')
|
|
143
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: version })[name]
|
|
144
|
-
: version;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
id: name,
|
|
148
|
-
name,
|
|
149
|
-
version: finalVersion,
|
|
150
|
-
location: name,
|
|
151
|
-
applicationID: name,
|
|
152
|
-
};
|
|
153
|
-
})
|
|
154
|
-
: [];
|
|
155
|
-
// Build the stats object
|
|
156
|
-
const buildStats = {
|
|
157
|
-
id: application_uid,
|
|
158
|
-
name,
|
|
159
|
-
edge: { url: EDGE_URL, delimiter: DELIMITER },
|
|
160
|
-
domain: undefined,
|
|
161
|
-
platform: PLATFORM,
|
|
162
|
-
type: 'lib',
|
|
163
|
-
app: Object.assign({}, app, { buildId }),
|
|
164
|
-
version,
|
|
165
|
-
git,
|
|
166
|
-
remote: filename,
|
|
167
|
-
remotes,
|
|
168
|
-
context: { isCI },
|
|
169
|
-
project: name,
|
|
170
|
-
tags: [],
|
|
171
|
-
// Module Federation related data
|
|
172
|
-
dependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.dependencies)),
|
|
173
|
-
devDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.devDependencies)),
|
|
174
|
-
optionalDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.optionalDependencies)),
|
|
175
|
-
peerDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.peerDependencies)),
|
|
176
|
-
consumes: Array.from(consumeMap.values()),
|
|
177
|
-
overrides,
|
|
178
|
-
modules: extractModulesFromExposes(mfConfig, application_uid),
|
|
179
|
-
// Add Rolldown-specific metadata
|
|
180
|
-
metadata: {
|
|
181
|
-
bundler: 'rolldown',
|
|
182
|
-
totalSize,
|
|
183
|
-
fileCount,
|
|
184
|
-
chunkCount,
|
|
185
|
-
assetCount,
|
|
186
|
-
dynamicImportCount: dynamicImports.size,
|
|
187
|
-
hasFederation: !!mfConfig,
|
|
188
|
-
},
|
|
189
|
-
default: false,
|
|
190
|
-
environment: '',
|
|
191
|
-
};
|
|
192
|
-
(0, zephyr_agent_1.ze_log)('Rolldown build stats extracted successfully', buildStats);
|
|
193
|
-
return buildStats;
|
|
194
|
-
}
|
|
195
|
-
function getPackageDependencies(dependencies) {
|
|
196
|
-
if (!dependencies)
|
|
197
|
-
return [];
|
|
198
|
-
return Object.entries(dependencies).map(([name, version]) => ({ name, version }));
|
|
199
|
-
}
|
|
200
|
-
function calculateBundleSize(bundle) {
|
|
201
|
-
return Object.values(bundle).reduce((size, item) => {
|
|
202
|
-
if (item.type === 'chunk') {
|
|
203
|
-
return size + item.code.length;
|
|
204
|
-
}
|
|
205
|
-
else if (item.type === 'asset') {
|
|
206
|
-
if (typeof item.source === 'string') {
|
|
207
|
-
return size + item.source.length;
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
return size + item.source.byteLength;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return size;
|
|
214
|
-
}, 0);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Extracts exposed modules from Module Federation configuration Creates formatted module
|
|
218
|
-
* entries for the build stats
|
|
219
|
-
*/
|
|
220
|
-
function extractModulesFromExposes(mfConfig, applicationID) {
|
|
221
|
-
if (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.exposes)) {
|
|
222
|
-
return [];
|
|
223
|
-
}
|
|
224
|
-
// Extract exposed modules from the Module Federation config
|
|
225
|
-
return Object.entries(mfConfig.exposes).map(([exposedPath, filePath]) => {
|
|
226
|
-
// Handle different formats of exposes configuration
|
|
227
|
-
// Normalize the file path
|
|
228
|
-
const normalizedFilePath = typeof filePath === 'string' ? filePath : String(filePath);
|
|
229
|
-
// Extract just the module name from the exposed path (removing './')
|
|
230
|
-
const name = exposedPath.startsWith('./') ? exposedPath.substring(2) : exposedPath;
|
|
231
|
-
// Create a unique ID for this module in the format used by Module Federation Dashboard
|
|
232
|
-
const id = `${name}:${name}`;
|
|
233
|
-
// Extract any potential requirements from shared dependencies
|
|
234
|
-
const requires = [];
|
|
235
|
-
// If we have shared dependencies, use them as requirements
|
|
236
|
-
if (mfConfig.shared) {
|
|
237
|
-
requires.push(...Object.keys(mfConfig.shared));
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
id,
|
|
241
|
-
name,
|
|
242
|
-
applicationID,
|
|
243
|
-
requires,
|
|
244
|
-
file: normalizedFilePath,
|
|
245
|
-
};
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
//# sourceMappingURL=extract-rolldown-build-stats.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-rolldown-build-stats.js","sourceRoot":"","sources":["../../../src/lib/internal/extract-rolldown-build-stats.ts"],"names":[],"mappings":";;AAcA,8DAgOC;AA3OD,+CAAkE;AAUlE,2DAA2D;AACpD,KAAK,UAAU,yBAAyB,CAAC,EAC9C,aAAa,EACb,MAAM,EACN,QAAQ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