vite-plugin-zephyr 0.0.0-canary-20250513050029 → 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/internal/extract/extract_mf_plugin.d.ts +6 -0
- package/dist/lib/internal/extract/extract_mf_plugin.js +8 -0
- package/dist/lib/internal/extract/extract_mf_plugin.js.map +1 -0
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.d.ts +11 -1
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js +8 -10
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js.map +1 -1
- package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.d.ts +1 -1
- package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js +32 -20
- package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js.map +1 -1
- package/dist/lib/internal/mf-vite-etl/runtime_plugin.d.ts +2 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugin.js +42 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugin.js.map +1 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugins_parser.d.ts +6 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugins_parser.js +48 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugins_parser.js.map +1 -0
- package/dist/lib/vite-plugin-zephyr-partial.d.ts +1 -1
- package/dist/lib/vite-plugin-zephyr-partial.js +8 -18
- package/dist/lib/vite-plugin-zephyr-partial.js.map +1 -1
- package/dist/lib/vite-plugin-zephyr.d.ts +1 -9
- package/dist/lib/vite-plugin-zephyr.js +11 -200
- package/dist/lib/vite-plugin-zephyr.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/lib/internal/extract/extract_preload_import.d.ts +0 -0
- package/dist/lib/internal/extract/extract_preload_import.js +0 -18
- package/dist/lib/internal/extract/extract_preload_import.js.map +0 -1
- package/dist/lib/internal/extract/extract_vite_build_stats.d.ts +0 -16
- package/dist/lib/internal/extract/extract_vite_build_stats.js +0 -294
- package/dist/lib/internal/extract/extract_vite_build_stats.js.map +0 -1
- package/dist/lib/internal/mf-vite-etl/preload-imports.d.ts +0 -0
- package/dist/lib/internal/mf-vite-etl/preload-imports.js +0 -124
- package/dist/lib/internal/mf-vite-etl/preload-imports.js.map +0 -1
- package/dist/lib/internal/mf-vite-etl/remote_map_parser.d.ts +0 -20
- package/dist/lib/internal/mf-vite-etl/remote_map_parser.js +0 -120
- package/dist/lib/internal/mf-vite-etl/remote_map_parser.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"vite-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr.ts"],"names":[],"mappings":";;AAeA,gCAQC;AAtBD,+CAAiF;AAEjF,kDAAqD;AACrD,wFAAqF;AACrF,4FAA8F;AAC9F,wFAAqF;AACrF,4EAAyE;AAQzE,SAAgB,UAAU,CAAC,QAAkC;IAC3D,MAAM,QAAQ,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC;IACpC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,GAAI,IAAA,iBAAU,EAAC,QAAQ,CAAc,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,YAAY;IACnB,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,GAAG,2BAAY,CAAC,YAAY,EAAE,CAAC;IAEjF,IAAI,6BAAqE,CAAC;IAC1E,MAAM,2BAA2B,GAAG,IAAI,OAAO,CAAwB,CAAC,OAAO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OAAO,KAAK,EAAE,CAAC;gBACf,IAAA,oBAAK,EAAC,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC1C,6CAA6C;gBAC7C,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC;gBACH,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;oBAC/D,2BAA2B;oBAC3B,mBAAmB;iBACpB,CAAC,CAAC;gBAEH,MAAM,aAAa,CAAC,eAAe,EAAE,CAAC;gBACtC,MAAM,SAAS,GAAG,MAAM,IAAA,iDAAuB,EAC7C,aAAa,EACb,qBAAqB,CACtB,CAAC;gBACF,MAAM,aAAa,CAAC,aAAa,CAAC;oBAChC,SAAS;oBACT,UAAU,EAAE,MAAM,IAAA,8BAAe,EAAC,aAAa,CAAC;iBACjD,CAAC,CAAC;gBACH,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": "vite-plugin-zephyr",
|
3
|
-
"version": "0.0.0-canary-
|
3
|
+
"version": "0.0.0-canary-20250514220856",
|
4
4
|
"description": "Vite plugin for Zephyr",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"json5": "2.2.3",
|
25
25
|
"rollup": "^4.36.0",
|
26
26
|
"vite": "^6.2.4",
|
27
|
-
"zephyr-agent": "0.0.0-canary-
|
27
|
+
"zephyr-agent": "0.0.0-canary-20250514220856"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@types/is-ci": "3.0.4",
|
File without changes
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// import { ze_log } from 'zephyr-agent';
|
3
|
-
// import { extractVitePreloadImports } from '../mf-vite-etl/preload-imports';
|
4
|
-
// import type { ProgramNode } from 'rollup';
|
5
|
-
// /**
|
6
|
-
// * Extract preload imports from Vite code This is a wrapper around
|
7
|
-
// * extractVitePreloadImports that can be called directly from other modules.
|
8
|
-
// */
|
9
|
-
// export function extract_preload_import(ast: ProgramNode, code: string) {
|
10
|
-
// try {
|
11
|
-
// const preloadImports = extractVitePreloadImports(ast, code);
|
12
|
-
// return preloadImports;
|
13
|
-
// } catch (error) {
|
14
|
-
// ze_log('Error extracting preload imports', { error });
|
15
|
-
// return [];
|
16
|
-
// }
|
17
|
-
// }
|
18
|
-
//# sourceMappingURL=extract_preload_import.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extract_preload_import.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/extract_preload_import.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,8EAA8E;AAC9E,6CAA6C;AAE7C,MAAM;AACN,qEAAqE;AACrE,+EAA+E;AAC/E,MAAM;AACN,2EAA2E;AAC3E,UAAU;AACV,mEAAmE;AACnE,6BAA6B;AAC7B,sBAAsB;AACtB,6DAA6D;AAC7D,iBAAiB;AACjB,MAAM;AACN,IAAI"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { OutputBundle } from 'rollup';
|
2
|
-
import type { ZephyrEngine } from 'zephyr-agent';
|
3
|
-
import type { ModuleFederationOptions } from '../../vite-plugin-zephyr';
|
4
|
-
import type { ZephyrBuildStats } from 'zephyr-edge-contract';
|
5
|
-
interface ViteBuildStatsOptions {
|
6
|
-
zephyr_engine: ZephyrEngine;
|
7
|
-
bundle: OutputBundle;
|
8
|
-
mfConfig?: ModuleFederationOptions;
|
9
|
-
root: string;
|
10
|
-
}
|
11
|
-
/**
|
12
|
-
* Extract build statistics specific to Vite builds Similar to webpack's getBuildStats but
|
13
|
-
* tailored for Vite
|
14
|
-
*/
|
15
|
-
export declare function extractViteBuildStats({ zephyr_engine, bundle, mfConfig, root, }: ViteBuildStatsOptions): Promise<ZephyrBuildStats>;
|
16
|
-
export {};
|
@@ -1,294 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.extractViteBuildStats = extractViteBuildStats;
|
4
|
-
const zephyr_agent_1 = require("zephyr-agent");
|
5
|
-
/**
|
6
|
-
* Extract build statistics specific to Vite builds Similar to webpack's getBuildStats but
|
7
|
-
* tailored for Vite
|
8
|
-
*/
|
9
|
-
async function extractViteBuildStats({ zephyr_engine, bundle, mfConfig, root,
|
10
|
-
// consumes,
|
11
|
-
}) {
|
12
|
-
(0, zephyr_agent_1.ze_log)('Extracting Vite build stats');
|
13
|
-
const consumeMap = new Map();
|
14
|
-
if (!bundle) {
|
15
|
-
(0, zephyr_agent_1.ze_log)('No bundle found, skipping build stats extraction');
|
16
|
-
}
|
17
|
-
const app = zephyr_engine.applicationProperties;
|
18
|
-
const { git } = zephyr_engine.gitProperties;
|
19
|
-
const { isCI } = zephyr_engine.env;
|
20
|
-
// Get IDs and configurations
|
21
|
-
const version = await zephyr_engine.snapshotId;
|
22
|
-
const application_uid = zephyr_engine.application_uid;
|
23
|
-
const buildId = await zephyr_engine.build_id;
|
24
|
-
const { EDGE_URL, PLATFORM, DELIMITER } = await zephyr_engine.application_configuration;
|
25
|
-
// Extract information from Module Federation config if available
|
26
|
-
const name = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.name) || app.name;
|
27
|
-
const filename = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.filename) || 'remoteEntry.js';
|
28
|
-
const remotes = (mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.remotes) ? Object.keys(mfConfig.remotes) : [];
|
29
|
-
// Get bundle stats
|
30
|
-
const totalSize = calculateBundleSize(bundle);
|
31
|
-
const fileCount = Object.keys(bundle).length;
|
32
|
-
const chunkCount = Object.values(bundle).filter((item) => item.type === 'chunk').length;
|
33
|
-
const assetCount = Object.values(bundle).filter((item) => item.type === 'asset').length;
|
34
|
-
// once we have the chunk and remote's name, we can find the imported remote, what's their used components and where they are being referenced
|
35
|
-
// Different regex patterns to match various loadRemote call formats
|
36
|
-
const regexPatterns = [
|
37
|
-
// Basic pattern: loadRemote("remote/component")
|
38
|
-
/loadRemote\(["']([^/]+)\/([^'"]+)["']\)/g,
|
39
|
-
// Destructured pattern: { loadRemote: c } = a, then c("remote/component")
|
40
|
-
/(?:\{[ \t]*loadRemote:[ \t]*([a-zA-Z0-9_$]+)[ \t]*\}|\blodRemote[ \t]*:[ \t]*([a-zA-Z0-9_$]+)\b).*?([a-zA-Z0-9_$]+)[ \t]*\(["']([^/]+)\/([^'"]+)["']\)/g,
|
41
|
-
// Promise chain pattern: n.then(e => c("remote/component"))
|
42
|
-
/\.then\([ \t]*(?:[a-zA-Z0-9_$]+)[ \t]*=>[ \t]*(?:[a-zA-Z0-9_$]+)\(["']([^/]+)\/([^'"]+)["']\)\)/g,
|
43
|
-
];
|
44
|
-
// Process the bundle to find the loadRemote calls using multiple regex patterns
|
45
|
-
Object.values(bundle)
|
46
|
-
.filter((item) => item.type === 'chunk')
|
47
|
-
.forEach((chunk) => {
|
48
|
-
try {
|
49
|
-
const code = chunk.code;
|
50
|
-
// Try each regex pattern
|
51
|
-
for (const pattern of regexPatterns) {
|
52
|
-
// Reset lastIndex to search from beginning
|
53
|
-
pattern.lastIndex = 0;
|
54
|
-
let match;
|
55
|
-
while ((match = pattern.exec(code)) !== null) {
|
56
|
-
// The match array structure depends on the regex pattern
|
57
|
-
let remoteName, componentName;
|
58
|
-
if (match.length === 3) {
|
59
|
-
// First pattern: loadRemote("remote/component")
|
60
|
-
remoteName = match[1];
|
61
|
-
componentName = match[2];
|
62
|
-
}
|
63
|
-
else if (match.length === 6) {
|
64
|
-
// Second pattern: destructured variant
|
65
|
-
remoteName = match[4];
|
66
|
-
componentName = match[5];
|
67
|
-
}
|
68
|
-
else if (match.length >= 3) {
|
69
|
-
// Third pattern: promise chain
|
70
|
-
remoteName = match[1];
|
71
|
-
componentName = match[2];
|
72
|
-
}
|
73
|
-
if (remoteName && componentName) {
|
74
|
-
consumeMap.set(`${remoteName}-${componentName}`, {
|
75
|
-
consumingApplicationID: componentName,
|
76
|
-
applicationID: remoteName,
|
77
|
-
name: componentName,
|
78
|
-
// TODO: move this to moduleParsed hook to process where the remote is being used. Doing this here is too late.
|
79
|
-
usedIn: [
|
80
|
-
...chunk.moduleIds.map((id) => ({
|
81
|
-
file: id.replace(root, ''),
|
82
|
-
url: id.replace(root, ''),
|
83
|
-
})),
|
84
|
-
],
|
85
|
-
});
|
86
|
-
(0, zephyr_agent_1.ze_log)('Found remote import', { remoteName, componentName });
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
// Extra pattern specifically for the promise chain syntax in your example
|
91
|
-
const promiseChainPattern = /\w+\s*=\s*\w+\.then\(\w+\s*=>\s*\w+\(["']([^/]+)\/([^'"]+)["']\)\)/g;
|
92
|
-
let promiseMatch;
|
93
|
-
while ((promiseMatch = promiseChainPattern.exec(chunk.code)) !== null) {
|
94
|
-
if (promiseMatch.length >= 3) {
|
95
|
-
const remoteName = promiseMatch[1];
|
96
|
-
const componentName = promiseMatch[2];
|
97
|
-
consumeMap.set(`${remoteName}-${componentName}`, {
|
98
|
-
consumingApplicationID: componentName,
|
99
|
-
applicationID: remoteName,
|
100
|
-
name: componentName,
|
101
|
-
usedIn: [
|
102
|
-
...chunk.moduleIds.map((id) => ({
|
103
|
-
file: id.replace(root, ''),
|
104
|
-
url: id.replace(root, ''),
|
105
|
-
})),
|
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, config]) => {
|
123
|
-
var _a, _b, _c, _d;
|
124
|
-
// Module Federation allows shared to be an object, array, or string
|
125
|
-
// Get version from package dependencies if available or from config
|
126
|
-
let version = '0.0.0';
|
127
|
-
if ((_a = zephyr_engine.npmProperties.dependencies) === null || _a === void 0 ? void 0 : _a[name]) {
|
128
|
-
// Resolve catalog reference in dependencies if present
|
129
|
-
const depVersion = zephyr_engine.npmProperties.dependencies[name];
|
130
|
-
version = depVersion.startsWith('catalog:')
|
131
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: depVersion })[name]
|
132
|
-
: depVersion;
|
133
|
-
}
|
134
|
-
else if ((_b = zephyr_engine.npmProperties.peerDependencies) === null || _b === void 0 ? void 0 : _b[name]) {
|
135
|
-
// Resolve catalog reference in peer dependencies if present
|
136
|
-
const peerVersion = zephyr_engine.npmProperties.peerDependencies[name];
|
137
|
-
version = peerVersion.startsWith('catalog:')
|
138
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: peerVersion })[name]
|
139
|
-
: peerVersion;
|
140
|
-
}
|
141
|
-
else if (typeof config === 'object' && config !== null) {
|
142
|
-
// Object format: { react: { requiredVersion: '18.0.0', singleton: true } }
|
143
|
-
if (config.requiredVersion) {
|
144
|
-
const reqVersion = config.requiredVersion;
|
145
|
-
version =
|
146
|
-
typeof reqVersion === 'string' && reqVersion.startsWith('catalog:')
|
147
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: reqVersion })[name]
|
148
|
-
: reqVersion;
|
149
|
-
}
|
150
|
-
}
|
151
|
-
else if (typeof config === 'string') {
|
152
|
-
// String format: { react: '18.0.0' }
|
153
|
-
// Only use string value if we didn't find the package in dependencies
|
154
|
-
if (!((_c = zephyr_engine.npmProperties.dependencies) === null || _c === void 0 ? void 0 : _c[name]) &&
|
155
|
-
!((_d = zephyr_engine.npmProperties.peerDependencies) === null || _d === void 0 ? void 0 : _d[name])) {
|
156
|
-
version = config.startsWith('catalog:')
|
157
|
-
? (0, zephyr_agent_1.resolveCatalogDependencies)({ [name]: config })[name]
|
158
|
-
: config;
|
159
|
-
}
|
160
|
-
}
|
161
|
-
// Array format is also possible but doesn't typically include version info
|
162
|
-
return {
|
163
|
-
id: name,
|
164
|
-
name,
|
165
|
-
version,
|
166
|
-
location: name,
|
167
|
-
applicationID: name,
|
168
|
-
};
|
169
|
-
})
|
170
|
-
: [];
|
171
|
-
// Build the stats object
|
172
|
-
const buildStats = {
|
173
|
-
id: application_uid,
|
174
|
-
name,
|
175
|
-
edge: { url: EDGE_URL, delimiter: DELIMITER },
|
176
|
-
domain: undefined,
|
177
|
-
platform: PLATFORM,
|
178
|
-
type: 'app',
|
179
|
-
app: Object.assign({}, app, { buildId }),
|
180
|
-
version,
|
181
|
-
git,
|
182
|
-
remote: filename,
|
183
|
-
remotes,
|
184
|
-
context: { isCI },
|
185
|
-
project: name,
|
186
|
-
tags: [],
|
187
|
-
// Module Federation related data
|
188
|
-
dependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.dependencies)),
|
189
|
-
devDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.devDependencies)),
|
190
|
-
optionalDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.optionalDependencies)),
|
191
|
-
peerDependencies: getPackageDependencies((0, zephyr_agent_1.resolveCatalogDependencies)(zephyr_engine.npmProperties.peerDependencies)),
|
192
|
-
consumes: Array.from(consumeMap.values()),
|
193
|
-
overrides,
|
194
|
-
modules: extractModulesFromExposes(mfConfig, application_uid),
|
195
|
-
// Add Vite-specific metadata
|
196
|
-
metadata: {
|
197
|
-
bundler: 'vite',
|
198
|
-
totalSize,
|
199
|
-
fileCount,
|
200
|
-
chunkCount,
|
201
|
-
assetCount,
|
202
|
-
// Include module federation details if available
|
203
|
-
hasFederation: !!mfConfig,
|
204
|
-
},
|
205
|
-
default: false,
|
206
|
-
environment: '',
|
207
|
-
};
|
208
|
-
(0, zephyr_agent_1.ze_log)('Vite build stats extracted successfully', buildStats);
|
209
|
-
return buildStats;
|
210
|
-
}
|
211
|
-
function getPackageDependencies(dependencies) {
|
212
|
-
if (!dependencies)
|
213
|
-
return [];
|
214
|
-
return Object.entries(dependencies).map(([name, version]) => ({ name, version }));
|
215
|
-
}
|
216
|
-
function calculateBundleSize(bundle) {
|
217
|
-
return Object.values(bundle).reduce((size, item) => {
|
218
|
-
if (item.type === 'chunk') {
|
219
|
-
return size + item.code.length;
|
220
|
-
}
|
221
|
-
else if (item.type === 'asset') {
|
222
|
-
if (typeof item.source === 'string') {
|
223
|
-
return size + item.source.length;
|
224
|
-
}
|
225
|
-
else {
|
226
|
-
return size + item.source.byteLength;
|
227
|
-
}
|
228
|
-
}
|
229
|
-
return size;
|
230
|
-
}, 0);
|
231
|
-
}
|
232
|
-
/**
|
233
|
-
* Extracts exposed modules from Module Federation configuration Creates formatted module
|
234
|
-
* entries for the build stats
|
235
|
-
*/
|
236
|
-
function extractModulesFromExposes(mfConfig, applicationID) {
|
237
|
-
if (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.exposes)) {
|
238
|
-
return [];
|
239
|
-
}
|
240
|
-
// Extract exposed modules from the Module Federation config
|
241
|
-
return Object.entries(mfConfig.exposes).map(([exposedPath, filePath]) => {
|
242
|
-
// Handle different formats of exposes configuration
|
243
|
-
// In Vite ModuleFederation, exposes can be an object where key is the exposed path and value is the file path
|
244
|
-
// Example: { './Button': './src/Button' }
|
245
|
-
// Normalize the file path (it might be an object in some federation implementations)
|
246
|
-
const normalizedFilePath = typeof filePath === 'string'
|
247
|
-
? filePath
|
248
|
-
: typeof filePath === 'object' && filePath !== null && 'import' in filePath
|
249
|
-
? String(filePath.import)
|
250
|
-
: String(filePath);
|
251
|
-
// Extract just the module name from the exposed path (removing './')
|
252
|
-
const name = exposedPath.startsWith('./') ? exposedPath.substring(2) : exposedPath;
|
253
|
-
// Create a unique ID for this module in the format used by Module Federation Dashboard
|
254
|
-
const id = `${name}:${name}`;
|
255
|
-
// Extract any potential requirements from shared dependencies
|
256
|
-
// In a more complete implementation, this would analyze the actual file to find imports
|
257
|
-
const requires = [];
|
258
|
-
// If we have shared dependencies and they're an object with keys, use them as requirements
|
259
|
-
if (mfConfig.shared) {
|
260
|
-
if (Array.isArray(mfConfig.shared)) {
|
261
|
-
// Handle array format: ['react', 'react-dom']
|
262
|
-
requires.push(...mfConfig.shared
|
263
|
-
.map((item) => {
|
264
|
-
return typeof item === 'string'
|
265
|
-
? item
|
266
|
-
: typeof item === 'object' && item !== null && 'libraryName' in item
|
267
|
-
? String(item.libraryName)
|
268
|
-
: '';
|
269
|
-
})
|
270
|
-
.filter(Boolean));
|
271
|
-
}
|
272
|
-
else if (typeof mfConfig.shared === 'object' && mfConfig.shared !== null) {
|
273
|
-
// Handle object format: { react: {...}, 'react-dom': {...} }
|
274
|
-
requires.push(...Object.keys(mfConfig.shared));
|
275
|
-
}
|
276
|
-
}
|
277
|
-
// Handle additionalShared format from Nx webpack module federation
|
278
|
-
if (mfConfig.additionalShared && Array.isArray(mfConfig.additionalShared)) {
|
279
|
-
requires.push(...mfConfig.additionalShared
|
280
|
-
.map((item) => typeof item === 'object' && item !== null && 'libraryName' in item
|
281
|
-
? String(item.libraryName)
|
282
|
-
: '')
|
283
|
-
.filter(Boolean));
|
284
|
-
}
|
285
|
-
return {
|
286
|
-
id,
|
287
|
-
name,
|
288
|
-
applicationID,
|
289
|
-
requires,
|
290
|
-
file: normalizedFilePath,
|
291
|
-
};
|
292
|
-
});
|
293
|
-
}
|
294
|
-
//# sourceMappingURL=extract_vite_build_stats.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extract_vite_build_stats.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/extract_vite_build_stats.ts"],"names":[],"mappings":";;AAiBA,sDAwOC;AArPD,+CAAkE;AASlE;;;GAGG;AACI,KAAK,UAAU,qBAAqB,CAAC,EAC1C,aAAa,EACb,MAAM,EACN,QAAQ,EACR,IAAI;AACJ,YAAY;EACU;IACtB,IAAA,qBAAM,EAAC,6BAA6B,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC1D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAA,qBAAM,EAAC,kDAAkD,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,GAAG,GAAG,aAAa,CAAC,qBAAqB,CAAC;IAChD,MAAM,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC;IAEnC,6BAA6B;IAC7B,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC;IAC/C,MAAM,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;IAC7C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,yBAAyB,CAAC;IAExF,iEAAiE;IACjE,MAAM,IAAI,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,KAAI,GAAG,CAAC,IAAI,CAAC;IACxC,MAAM,QAAQ,GAAG,CAAA,QAAQ,aAAR,Q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H,CAAC;QAED,mEAAmE;QACnE,IAAI,QAAQ,CAAC,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC1E,QAAQ,CAAC,IAAI,CACX,GAAG,QAAQ,CAAC,gBAAgB;iBACzB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,aAAa,IAAI,IAAI;gBAChE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;gBAC1B,CAAC,CAAC,EAAE,CACP;iBACA,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,EAAE;YACF,IAAI;YACJ,aAAa;YACb,QAAQ;YACR,IAAI,EAAE,kBAAkB;SACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
File without changes
|
@@ -1,124 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// import walk from 'acorn-walk';
|
3
|
-
// import type { Node } from 'acorn';
|
4
|
-
// import type { ProgramNode } from 'rollup';
|
5
|
-
// import { ze_log } from 'zephyr-agent';
|
6
|
-
// export interface VitePreloadImport {
|
7
|
-
// remoteId: string;
|
8
|
-
// importPath: string;
|
9
|
-
// originalNode: Node;
|
10
|
-
// location: {
|
11
|
-
// start: { line: number; column: number };
|
12
|
-
// end: { line: number; column: number };
|
13
|
-
// };
|
14
|
-
// }
|
15
|
-
// /**
|
16
|
-
// * We are doing AST again because the moduleParsed event would include the original code
|
17
|
-
// * Extracts remote module imports from __vitePreload calls in the AST Specifically targets
|
18
|
-
// * patterns like: lazy(() => __vitePreload(() => import("vite-remote/Button"),
|
19
|
-
// * **VITE_IS_MODERN**?**VITE_PRELOAD**:void 0))
|
20
|
-
// */
|
21
|
-
// export function extractVitePreloadImports(
|
22
|
-
// ast: ProgramNode,
|
23
|
-
// _code: string
|
24
|
-
// ): VitePreloadImport[] {
|
25
|
-
// const imports: VitePreloadImport[] = [];
|
26
|
-
// let arrayNode: Node | undefined;
|
27
|
-
// // Walk the AST to find __vitePreload calls
|
28
|
-
// walk.full(ast, (node: any) => {
|
29
|
-
// // Look for CallExpression nodes that might be __vitePreload calls
|
30
|
-
// if (
|
31
|
-
// node.type === 'CallExpression' &&
|
32
|
-
// node.callee?.type === 'Identifier' &&
|
33
|
-
// node.callee.name === '__vitePreload' &&
|
34
|
-
// node.arguments.length >= 1
|
35
|
-
// ) {
|
36
|
-
// const firstArg = node.arguments[0];
|
37
|
-
// ze_log('vite.extractVitePreloadImports.node: ', node);
|
38
|
-
// // Look for arrow functions in the first argument
|
39
|
-
// if (
|
40
|
-
// firstArg.type === 'ArrowFunctionExpression' &&
|
41
|
-
// firstArg.body.type === 'CallExpression' &&
|
42
|
-
// firstArg.body.callee?.type === 'Identifier' &&
|
43
|
-
// firstArg.body.callee.name === 'import' &&
|
44
|
-
// firstArg.body.arguments.length === 1
|
45
|
-
// ) {
|
46
|
-
// const importArg = firstArg.body.arguments[0];
|
47
|
-
// // Extract the import path from string literals
|
48
|
-
// if (importArg.type === 'Literal' && typeof importArg.value === 'string') {
|
49
|
-
// const importPath = importArg.value;
|
50
|
-
// // Parse the import path to get the remote ID (before the first slash)
|
51
|
-
// const slashIndex = importPath.indexOf('/');
|
52
|
-
// if (slashIndex > 0) {
|
53
|
-
// const remoteId = importPath.substring(0, slashIndex);
|
54
|
-
// const modulePath = importPath.substring(slashIndex + 1);
|
55
|
-
// imports.push({
|
56
|
-
// remoteId,
|
57
|
-
// importPath: modulePath,
|
58
|
-
// originalNode: node,
|
59
|
-
// location: node.loc,
|
60
|
-
// });
|
61
|
-
// ze_log('Found vite preload import', {
|
62
|
-
// remoteId,
|
63
|
-
// importPath,
|
64
|
-
// location: node.loc,
|
65
|
-
// });
|
66
|
-
// }
|
67
|
-
// }
|
68
|
-
// }
|
69
|
-
// }
|
70
|
-
// // Also check for lazy imports wrapped in React.lazy or just lazy
|
71
|
-
// if (
|
72
|
-
// node.type === 'CallExpression' &&
|
73
|
-
// ((node.callee?.type === 'Identifier' && node.callee.name === 'lazy') ||
|
74
|
-
// (node.callee?.type === 'MemberExpression' &&
|
75
|
-
// node.callee.property?.type === 'Identifier' &&
|
76
|
-
// node.callee.property.name === 'lazy')) &&
|
77
|
-
// node.arguments.length === 1 &&
|
78
|
-
// node.arguments[0].type === 'ArrowFunctionExpression'
|
79
|
-
// ) {
|
80
|
-
// // This is a lazy() call with an arrow function, check if it contains __vitePreload
|
81
|
-
// const arrowBody = node.arguments[0].body;
|
82
|
-
// if (
|
83
|
-
// arrowBody.type === 'CallExpression' &&
|
84
|
-
// arrowBody.callee?.type === 'Identifier' &&
|
85
|
-
// arrowBody.callee.name === '__vitePreload' &&
|
86
|
-
// arrowBody.arguments.length >= 1
|
87
|
-
// ) {
|
88
|
-
// // Handle nested __vitePreload call
|
89
|
-
// const nestedArrow = arrowBody.arguments[0];
|
90
|
-
// if (
|
91
|
-
// nestedArrow.type === 'ArrowFunctionExpression' &&
|
92
|
-
// nestedArrow.body.type === 'CallExpression' &&
|
93
|
-
// nestedArrow.body.callee?.type === 'Identifier' &&
|
94
|
-
// nestedArrow.body.callee.name === 'import' &&
|
95
|
-
// nestedArrow.body.arguments.length === 1
|
96
|
-
// ) {
|
97
|
-
// const importArg = nestedArrow.body.arguments[0];
|
98
|
-
// if (importArg.type === 'Literal' && typeof importArg.value === 'string') {
|
99
|
-
// const importPath = importArg.value;
|
100
|
-
// // Parse the import path
|
101
|
-
// const slashIndex = importPath.indexOf('/');
|
102
|
-
// if (slashIndex > 0) {
|
103
|
-
// const remoteId = importPath.substring(0, slashIndex);
|
104
|
-
// const modulePath = importPath.substring(slashIndex + 1);
|
105
|
-
// imports.push({
|
106
|
-
// remoteId,
|
107
|
-
// importPath: modulePath,
|
108
|
-
// originalNode: node,
|
109
|
-
// location: node.loc,
|
110
|
-
// });
|
111
|
-
// ze_log('Found lazy import with vite preload', {
|
112
|
-
// remoteId,
|
113
|
-
// importPath,
|
114
|
-
// location: node.loc,
|
115
|
-
// });
|
116
|
-
// }
|
117
|
-
// }
|
118
|
-
// }
|
119
|
-
// }
|
120
|
-
// }
|
121
|
-
// });
|
122
|
-
// return imports;
|
123
|
-
// }
|
124
|
-
//# sourceMappingURL=preload-imports.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"preload-imports.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/preload-imports.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,qCAAqC;AACrC,6CAA6C;AAC7C,yCAAyC;AAEzC,uCAAuC;AACvC,sBAAsB;AACtB,wBAAwB;AACxB,wBAAwB;AACxB,gBAAgB;AAChB,+CAA+C;AAC/C,6CAA6C;AAC7C,OAAO;AACP,IAAI;AAEJ,MAAM;AACN,2FAA2F;AAC3F,6FAA6F;AAC7F,iFAAiF;AACjF,kDAAkD;AAClD,MAAM;AACN,6CAA6C;AAC7C,sBAAsB;AACtB,kBAAkB;AAClB,2BAA2B;AAC3B,6CAA6C;AAE7C,qCAAqC;AACrC,gDAAgD;AAChD,oCAAoC;AACpC,yEAAyE;AACzE,WAAW;AACX,0CAA0C;AAC1C,8CAA8C;AAC9C,gDAAgD;AAChD,mCAAmC;AACnC,UAAU;AACV,4CAA4C;AAE5C,+DAA+D;AAE/D,0DAA0D;AAC1D,aAAa;AACb,yDAAyD;AACzD,qDAAqD;AACrD,yDAAyD;AACzD,oDAAoD;AACpD,+CAA+C;AAC/C,YAAY;AACZ,wDAAwD;AAExD,0DAA0D;AAC1D,qFAAqF;AACrF,gDAAgD;AAEhD,mFAAmF;AACnF,wDAAwD;AACxD,kCAAkC;AAClC,oEAAoE;AACpE,uEAAuE;AAEvE,6BAA6B;AAC7B,0BAA0B;AAC1B,wCAAwC;AACxC,oCAAoC;AACpC,oCAAoC;AACpC,kBAAkB;AAElB,oDAAoD;AACpD,0BAA0B;AAC1B,4BAA4B;AAC5B,oCAAoC;AACpC,kBAAkB;AAClB,cAAc;AACd,YAAY;AACZ,UAAU;AACV,QAAQ;AAER,wEAAwE;AACxE,WAAW;AACX,0CAA0C;AAC1C,gFAAgF;AAChF,uDAAuD;AACvD,2DAA2D;AAC3D,sDAAsD;AACtD,uCAAuC;AACvC,6DAA6D;AAC7D,UAAU;AACV,4FAA4F;AAC5F,kDAAkD;AAElD,aAAa;AACb,iDAAiD;AACjD,qDAAqD;AACrD,uDAAuD;AACvD,0CAA0C;AAC1C,YAAY;AACZ,8CAA8C;AAC9C,sDAAsD;AAEtD,eAAe;AACf,8DAA8D;AAC9D,0DAA0D;AAC1D,8DAA8D;AAC9D,yDAAyD;AACzD,oDAAoD;AACpD,cAAc;AACd,6DAA6D;AAE7D,uFAAuF;AACvF,kDAAkD;AAElD,uCAAuC;AACvC,0DAA0D;AAC1D,oCAAoC;AACpC,sEAAsE;AACtE,yEAAyE;AAEzE,+BAA+B;AAC/B,4BAA4B;AAC5B,0CAA0C;AAC1C,sCAAsC;AACtC,sCAAsC;AACtC,oBAAoB;AAEpB,gEAAgE;AAChE,4BAA4B;AAC5B,8BAA8B;AAC9B,sCAAsC;AACtC,oBAAoB;AACpB,gBAAgB;AAChB,cAAc;AACd,YAAY;AACZ,UAAU;AACV,QAAQ;AACR,QAAQ;AAER,oBAAoB;AACpB,IAAI"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
export interface RemoteEntry {
|
2
|
-
name: string;
|
3
|
-
entryGlobalName?: string;
|
4
|
-
entry: string;
|
5
|
-
type?: string;
|
6
|
-
}
|
7
|
-
export interface RemoteMapExtraction {
|
8
|
-
remotesMap: RemoteEntry[];
|
9
|
-
startIndex: number;
|
10
|
-
endIndex: number;
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Parses the provided code to extract the remotes object.
|
14
|
-
*
|
15
|
-
* @param code - The code containing the remotes object declaration.
|
16
|
-
* @returns An object containing the remotes object and the start and end indices of the
|
17
|
-
* remotes object declaration in the code, or undefined if parsing fails.
|
18
|
-
*/
|
19
|
-
export declare function parseRemoteMapAndImportedRemotes(code: string, id: string): RemoteMapExtraction | undefined;
|
20
|
-
export declare function replaceProtocolAndHost(originalUrl: string, newProtocolAndHost: string): string;
|