vite-plugin-zephyr 0.0.0-canary-20250508125404 → 0.0.0-canary-20250513003429

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.
Files changed (30) hide show
  1. package/dist/lib/internal/extract/extract_preload_import.d.ts +0 -0
  2. package/dist/lib/internal/extract/extract_preload_import.js +18 -0
  3. package/dist/lib/internal/extract/extract_preload_import.js.map +1 -0
  4. package/dist/lib/internal/extract/extract_vite_assets_map.d.ts +1 -1
  5. package/dist/lib/internal/extract/extract_vite_build_stats.d.ts +16 -0
  6. package/dist/lib/internal/extract/extract_vite_build_stats.js +280 -0
  7. package/dist/lib/internal/extract/extract_vite_build_stats.js.map +1 -0
  8. package/dist/lib/internal/extract/load_public_dir.d.ts +1 -1
  9. package/dist/lib/internal/extract/load_static_entries.d.ts +1 -1
  10. package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.d.ts +1 -1
  11. package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js +1 -1
  12. package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js.map +1 -1
  13. package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.d.ts +1 -1
  14. package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js +1 -1
  15. package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js.map +1 -1
  16. package/dist/lib/internal/mf-vite-etl/preload-imports.d.ts +0 -0
  17. package/dist/lib/internal/mf-vite-etl/preload-imports.js +124 -0
  18. package/dist/lib/internal/mf-vite-etl/preload-imports.js.map +1 -0
  19. package/dist/lib/internal/mf-vite-etl/remote_map_parser.d.ts +1 -1
  20. package/dist/lib/internal/mf-vite-etl/remote_map_parser.js +30 -3
  21. package/dist/lib/internal/mf-vite-etl/remote_map_parser.js.map +1 -1
  22. package/dist/lib/internal/types/zephyr-internal-options.d.ts +1 -1
  23. package/dist/lib/vite-plugin-zephyr-partial.d.ts +1 -1
  24. package/dist/lib/vite-plugin-zephyr-partial.js +29 -14
  25. package/dist/lib/vite-plugin-zephyr-partial.js.map +1 -1
  26. package/dist/lib/vite-plugin-zephyr.d.ts +9 -1
  27. package/dist/lib/vite-plugin-zephyr.js +226 -18
  28. package/dist/lib/vite-plugin-zephyr.js.map +1 -1
  29. package/dist/package.json +1 -1
  30. package/package.json +2 -2
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
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,3 +1,3 @@
1
- import { ZeBuildAssetsMap, ZephyrEngine } from 'zephyr-agent';
1
+ import { type ZeBuildAssetsMap, type ZephyrEngine } from 'zephyr-agent';
2
2
  import type { ZephyrInternalOptions } from '../types/zephyr-internal-options';
3
3
  export declare function extract_vite_assets_map(zephyr_engine: ZephyrEngine, vite_internal_options: ZephyrInternalOptions): Promise<ZeBuildAssetsMap>;
@@ -0,0 +1,16 @@
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 {};
@@ -0,0 +1,280 @@
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
+ version = zephyr_engine.npmProperties.dependencies[name];
129
+ }
130
+ else if ((_b = zephyr_engine.npmProperties.peerDependencies) === null || _b === void 0 ? void 0 : _b[name]) {
131
+ version = zephyr_engine.npmProperties.peerDependencies[name];
132
+ }
133
+ else if (typeof config === 'object' && config !== null) {
134
+ // Object format: { react: { requiredVersion: '18.0.0', singleton: true } }
135
+ if (config.requiredVersion) {
136
+ version = config.requiredVersion;
137
+ }
138
+ }
139
+ else if (typeof config === 'string') {
140
+ // String format: { react: '18.0.0' }
141
+ // Only use string value if we didn't find the package in dependencies
142
+ if (!((_c = zephyr_engine.npmProperties.dependencies) === null || _c === void 0 ? void 0 : _c[name]) &&
143
+ !((_d = zephyr_engine.npmProperties.peerDependencies) === null || _d === void 0 ? void 0 : _d[name])) {
144
+ version = config;
145
+ }
146
+ }
147
+ // Array format is also possible but doesn't typically include version info
148
+ return {
149
+ id: name,
150
+ name,
151
+ version,
152
+ location: name,
153
+ applicationID: name,
154
+ };
155
+ })
156
+ : [];
157
+ // Build the stats object
158
+ const buildStats = {
159
+ id: application_uid,
160
+ name,
161
+ edge: { url: EDGE_URL, delimiter: DELIMITER },
162
+ domain: undefined,
163
+ platform: PLATFORM,
164
+ type: 'app',
165
+ app: Object.assign({}, app, { buildId }),
166
+ version,
167
+ git,
168
+ remote: filename,
169
+ remotes,
170
+ context: { isCI },
171
+ project: name,
172
+ tags: [],
173
+ // Module Federation related data
174
+ dependencies: getPackageDependencies(zephyr_engine.npmProperties.dependencies),
175
+ devDependencies: getPackageDependencies(zephyr_engine.npmProperties.devDependencies),
176
+ optionalDependencies: getPackageDependencies(zephyr_engine.npmProperties.optionalDependencies),
177
+ peerDependencies: getPackageDependencies(zephyr_engine.npmProperties.peerDependencies),
178
+ consumes: Array.from(consumeMap.values()),
179
+ overrides,
180
+ modules: extractModulesFromExposes(mfConfig, application_uid),
181
+ // Add Vite-specific metadata
182
+ metadata: {
183
+ bundler: 'vite',
184
+ totalSize,
185
+ fileCount,
186
+ chunkCount,
187
+ assetCount,
188
+ // Include module federation details if available
189
+ hasFederation: !!mfConfig,
190
+ },
191
+ default: false,
192
+ environment: '',
193
+ };
194
+ (0, zephyr_agent_1.ze_log)('Vite build stats extracted successfully', buildStats);
195
+ return buildStats;
196
+ }
197
+ function getPackageDependencies(dependencies) {
198
+ if (!dependencies)
199
+ return [];
200
+ return Object.entries(dependencies).map(([name, version]) => ({ name, version }));
201
+ }
202
+ function calculateBundleSize(bundle) {
203
+ return Object.values(bundle).reduce((size, item) => {
204
+ if (item.type === 'chunk') {
205
+ return size + item.code.length;
206
+ }
207
+ else if (item.type === 'asset') {
208
+ if (typeof item.source === 'string') {
209
+ return size + item.source.length;
210
+ }
211
+ else {
212
+ return size + item.source.byteLength;
213
+ }
214
+ }
215
+ return size;
216
+ }, 0);
217
+ }
218
+ /**
219
+ * Extracts exposed modules from Module Federation configuration Creates formatted module
220
+ * entries for the build stats
221
+ */
222
+ function extractModulesFromExposes(mfConfig, applicationID) {
223
+ if (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.exposes)) {
224
+ return [];
225
+ }
226
+ // Extract exposed modules from the Module Federation config
227
+ return Object.entries(mfConfig.exposes).map(([exposedPath, filePath]) => {
228
+ // Handle different formats of exposes configuration
229
+ // In Vite ModuleFederation, exposes can be an object where key is the exposed path and value is the file path
230
+ // Example: { './Button': './src/Button' }
231
+ // Normalize the file path (it might be an object in some federation implementations)
232
+ const normalizedFilePath = typeof filePath === 'string'
233
+ ? filePath
234
+ : typeof filePath === 'object' && filePath !== null && 'import' in filePath
235
+ ? String(filePath.import)
236
+ : String(filePath);
237
+ // Extract just the module name from the exposed path (removing './')
238
+ const name = exposedPath.startsWith('./') ? exposedPath.substring(2) : exposedPath;
239
+ // Create a unique ID for this module in the format used by Module Federation Dashboard
240
+ const id = `${name}:${name}`;
241
+ // Extract any potential requirements from shared dependencies
242
+ // In a more complete implementation, this would analyze the actual file to find imports
243
+ const requires = [];
244
+ // If we have shared dependencies and they're an object with keys, use them as requirements
245
+ if (mfConfig.shared) {
246
+ if (Array.isArray(mfConfig.shared)) {
247
+ // Handle array format: ['react', 'react-dom']
248
+ requires.push(...mfConfig.shared
249
+ .map((item) => {
250
+ return typeof item === 'string'
251
+ ? item
252
+ : typeof item === 'object' && item !== null && 'libraryName' in item
253
+ ? String(item.libraryName)
254
+ : '';
255
+ })
256
+ .filter(Boolean));
257
+ }
258
+ else if (typeof mfConfig.shared === 'object' && mfConfig.shared !== null) {
259
+ // Handle object format: { react: {...}, 'react-dom': {...} }
260
+ requires.push(...Object.keys(mfConfig.shared));
261
+ }
262
+ }
263
+ // Handle additionalShared format from Nx webpack module federation
264
+ if (mfConfig.additionalShared && Array.isArray(mfConfig.additionalShared)) {
265
+ requires.push(...mfConfig.additionalShared
266
+ .map((item) => typeof item === 'object' && item !== null && 'libraryName' in item
267
+ ? String(item.libraryName)
268
+ : '')
269
+ .filter(Boolean));
270
+ }
271
+ return {
272
+ id,
273
+ name,
274
+ applicationID,
275
+ requires,
276
+ file: normalizedFilePath,
277
+ };
278
+ });
279
+ }
280
+ //# sourceMappingURL=extract_vite_build_stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract_vite_build_stats.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/extract_vite_build_stats.ts"],"names":[],"mappings":";;AAiBA,sDAsNC;AAnOD,+CAAsC;AAStC;;;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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Q,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"}
@@ -1,4 +1,4 @@
1
- import { OutputAsset } from 'rollup';
1
+ import type { OutputAsset } from 'rollup';
2
2
  interface LoadPublicDirOptions {
3
3
  outDir: string;
4
4
  publicDir: string;
@@ -1,4 +1,4 @@
1
- import { OutputAsset } from 'rollup';
1
+ import type { OutputAsset } from 'rollup';
2
2
  interface LoadStaticEntriesOptions {
3
3
  root: string;
4
4
  outDir: string;
@@ -1,2 +1,2 @@
1
- import { ZeDependencyPair } from 'zephyr-agent';
1
+ import type { ZeDependencyPair } from 'zephyr-agent';
2
2
  export declare function extract_remotes_dependencies(root: string, code: string, id: string): ZeDependencyPair[] | undefined;
@@ -14,7 +14,7 @@ function extract_remotes_dependencies(root, code, id) {
14
14
  });
15
15
  }
16
16
  const dependencyPairs = [];
17
- const extractedRemotes = (0, remote_map_parser_1.parseRemoteMap)(code, id);
17
+ const extractedRemotes = (0, remote_map_parser_1.parseRemoteMapAndImportedRemotes)(code, id);
18
18
  if (extractedRemotes === undefined)
19
19
  return;
20
20
  const { remotesMap } = extractedRemotes;
@@ -1 +1 @@
1
- {"version":3,"file":"extract-mf-vite-remotes.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/extract-mf-vite-remotes.ts"],"names":[],"mappings":";;AAGA,oEA2BC;AA9BD,+CAAiE;AACjE,2DAAqD;AAErD,SAAgB,4BAA4B,CAC1C,IAAY,EACZ,IAAY,EACZ,EAAU;IAEV,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,CAAC;IACrD,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAChE,OAAO;gBACL,IAAI;gBACJ,OAAO;aACY,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,eAAe,GAAuB,EAAE,CAAC;IAC/C,MAAM,gBAAgB,GAAG,IAAA,kCAAc,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,gBAAgB,KAAK,SAAS;QAAE,OAAO;IAE3C,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC;IAExC,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACxC,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"extract-mf-vite-remotes.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/extract-mf-vite-remotes.ts"],"names":[],"mappings":";;AAIA,oEA2BC;AA9BD,+CAA+C;AAC/C,2DAAuE;AAEvE,SAAgB,4BAA4B,CAC1C,IAAY,EACZ,IAAY,EACZ,EAAU;IAEV,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,CAAC;IACrD,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAChE,OAAO;gBACL,IAAI;gBACJ,OAAO;aACY,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,eAAe,GAAuB,EAAE,CAAC;IAC/C,MAAM,gBAAgB,GAAG,IAAA,oDAAgC,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,IAAI,gBAAgB,KAAK,SAAS;QAAE,OAAO;IAE3C,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC;IAExC,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACxC,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,2 +1,2 @@
1
- import { ZeResolvedDependency } from 'zephyr-agent';
1
+ import type { ZeResolvedDependency } from 'zephyr-agent';
2
2
  export declare function load_resolved_remotes(resolved_remotes: ZeResolvedDependency[], code: string, id: string): string | undefined;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.load_resolved_remotes = load_resolved_remotes;
4
4
  const remote_map_parser_1 = require("./remote_map_parser");
5
5
  function load_resolved_remotes(resolved_remotes, code, id) {
6
- const extractedRemotes = (0, remote_map_parser_1.parseRemoteMap)(code, id);
6
+ const extractedRemotes = (0, remote_map_parser_1.parseRemoteMapAndImportedRemotes)(code, id);
7
7
  if (extractedRemotes === undefined)
8
8
  return;
9
9
  const remotes = [];
@@ -1 +1 @@
1
- {"version":3,"file":"load_resolved_remotes.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/load_resolved_remotes.ts"],"names":[],"mappings":";;AAOA,sDA0BC;AAhCD,2DAI6B;AAE7B,SAAgB,qBAAqB,CACnC,gBAAwC,EACxC,IAAY,EACZ,EAAU;IAEV,MAAM,gBAAgB,GAAG,IAAA,kCAAc,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,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,UAAU,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;IAC9D,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QACrC,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CACzC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,CAC9C,CAAC;QACF,IAAI,CAAC,aAAa;YAAE,SAAS;QAE7B,MAAM,UAAU,GAAG,IAAA,0CAAsB,EAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,IAAI;YACJ,eAAe,EAAE,IAAI;YACrB,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,124 @@
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
@@ -0,0 +1 @@
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;A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c;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"}
@@ -16,5 +16,5 @@ export interface RemoteMapExtraction {
16
16
  * @returns An object containing the remotes object and the start and end indices of the
17
17
  * remotes object declaration in the code, or undefined if parsing fails.
18
18
  */
19
- export declare function parseRemoteMap(code: string, id: string): RemoteMapExtraction | undefined;
19
+ export declare function parseRemoteMapAndImportedRemotes(code: string, id: string): RemoteMapExtraction | undefined;
20
20
  export declare function replaceProtocolAndHost(originalUrl: string, newProtocolAndHost: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRemoteMap = parseRemoteMap;
3
+ exports.parseRemoteMapAndImportedRemotes = parseRemoteMapAndImportedRemotes;
4
4
  exports.replaceProtocolAndHost = replaceProtocolAndHost;
5
5
  const tslib_1 = require("tslib");
6
6
  const json5_1 = tslib_1.__importDefault(require("json5"));
@@ -14,8 +14,32 @@ const zephyr_agent_1 = require("zephyr-agent");
14
14
  * @returns An object containing the remotes object and the start and end indices of the
15
15
  * remotes object declaration in the code, or undefined if parsing fails.
16
16
  */
17
- function parseRemoteMap(code, id) {
18
- if (!id.includes('localSharedImportMap')) {
17
+ function parseRemoteMapAndImportedRemotes(code, id
18
+ //remotes?: string[]
19
+ ) {
20
+ // let remoteNamesAndImports: acorn.Node | undefined;
21
+ function isImportedRemote(node) {
22
+ var _a, _b;
23
+ if (((_a = node.callee) === null || _a === void 0 ? void 0 : _a.type) === 'Identifier' &&
24
+ node.callee.name === '__vitePreload' &&
25
+ node.arguments.length >= 1) {
26
+ (0, zephyr_agent_1.ze_log)('vite.isImportedRemote.node: ', node);
27
+ for (const arg of node.arguments) {
28
+ (0, zephyr_agent_1.ze_log)('vite.isImportedRemote.arg Pos1: ', arg);
29
+ if (arg.type === 'ArrowFunctionExpression' &&
30
+ arg.body.type === 'CallExpression' &&
31
+ ((_b = arg.body.callee) === null || _b === void 0 ? void 0 : _b.type) === 'Identifier' &&
32
+ arg.body.callee.name === 'import' &&
33
+ arg.body.arguments.length === 1) {
34
+ (0, zephyr_agent_1.ze_log)('vite.isImportedRemote.arg Pos2: ', arg);
35
+ // remoteNamesAndImports = arg.body.arguments[0];
36
+ return true;
37
+ }
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ if (!id.includes('localSharedImportMap') || id.includes('node_modules')) {
19
43
  return undefined;
20
44
  }
21
45
  let arrayNode;
@@ -43,6 +67,8 @@ function parseRemoteMap(code, id) {
43
67
  }
44
68
  acorn_walk_1.default.simple(ast, {
45
69
  VariableDeclaration: findUsedRemotes,
70
+ CallExpression: isImportedRemote,
71
+ // ImportDeclaration: isImportedRemote,
46
72
  });
47
73
  const endTime = Date.now();
48
74
  (0, zephyr_agent_1.ze_log)(`parseRemoteMap took ${endTime - startTime}ms`);
@@ -76,6 +102,7 @@ function parseRemoteMap(code, id) {
76
102
  remotesMap: remotesArray,
77
103
  startIndex,
78
104
  endIndex,
105
+ // consumes: remoteNamesAndImports,
79
106
  };
80
107
  }
81
108
  function replaceProtocolAndHost(originalUrl, newProtocolAndHost) {
@@ -1 +1 @@
1
- {"version":3,"file":"remote_map_parser.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/remote_map_parser.ts"],"names":[],"mappings":";;AAyBA,wCA4EC;AAED,wDAiBC;;AAxHD,0DAA0B;AAC1B,0DAA0B;AAC1B,oEAA8B;AAC9B,+CAAsC;AAetC;;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Q,CAAC;IAC/B,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;IAEd,IAAA,qBAAM,EAAC,uBAAuB,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { OutputBundle } from 'rollup';
1
+ import type { OutputBundle } from 'rollup';
2
2
  export interface ZephyrInternalOptions {
3
3
  root: string;
4
4
  outDir: string;
@@ -5,6 +5,6 @@ export declare function withZephyrPartial(): {
5
5
  apply: string;
6
6
  enforce: string;
7
7
  configResolved: (config: ResolvedConfig) => Promise<void>;
8
- writeBundle: (options: NormalizedOutputOptions, bundle: OutputBundle) => Promise<void>;
8
+ writeBundle: (opts: NormalizedOutputOptions, bundle: OutputBundle) => Promise<void>;
9
9
  closeBundle: () => Promise<void>;
10
10
  };
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withZephyrPartial = withZephyrPartial;
4
4
  const zephyr_agent_1 = require("zephyr-agent");
5
5
  const extract_vite_assets_map_1 = require("./internal/extract/extract_vite_assets_map");
6
+ const extract_vite_build_stats_1 = require("./internal/extract/extract_vite_build_stats");
6
7
  function withZephyrPartial() {
7
8
  const { zephyr_engine_defer, zephyr_defer_create } = zephyr_agent_1.ZephyrEngine.defer_create();
8
9
  let resolve_vite_internal_options;
9
10
  const vite_internal_options_defer = new Promise((resolve) => {
10
11
  resolve_vite_internal_options = resolve;
11
12
  });
13
+ let outputBundle;
12
14
  return {
13
15
  name: 'with-zephyr-partial',
14
16
  apply: 'build',
@@ -25,25 +27,38 @@ function withZephyrPartial() {
25
27
  publicDir: config.publicDir,
26
28
  });
27
29
  },
28
- writeBundle: async (options, bundle) => {
30
+ writeBundle: async (opts, bundle) => {
31
+ outputBundle = bundle;
29
32
  const vite_internal_options = await vite_internal_options_defer;
30
- vite_internal_options.dir = options.dir;
33
+ vite_internal_options.dir = opts.dir;
31
34
  vite_internal_options.assets = bundle;
32
35
  },
33
36
  closeBundle: async () => {
34
37
  var _a;
35
- const vite_internal_options = await vite_internal_options_defer;
36
- const zephyr_engine = await zephyr_engine_defer;
37
- const application_uid = zephyr_engine.application_uid;
38
- // context import ^
39
- const assetsMap = await (0, extract_vite_assets_map_1.extract_vite_assets_map)(zephyr_engine, vite_internal_options);
40
- await (0, zephyr_agent_1.savePartialAssetMap)(application_uid, (_a = vite_internal_options.configFile) !== null && _a !== void 0 ? _a : 'partial', assetsMap);
41
- // todo: initially partial build doesn't have deploy, but code below could enable it if needed
42
- // await zephyr_engine.upload_assets({
43
- // assetsMap,
44
- // // todo: this should be updated if we have remotes
45
- // buildStats: await zeBuildDashData(zephyr_engine),
46
- // });
38
+ try {
39
+ const vite_internal_options = await vite_internal_options_defer;
40
+ const zephyr_engine = await zephyr_engine_defer;
41
+ const application_uid = zephyr_engine.application_uid;
42
+ // context import ^
43
+ const assetsMap = await (0, extract_vite_assets_map_1.extract_vite_assets_map)(zephyr_engine, vite_internal_options);
44
+ await (0, zephyr_agent_1.savePartialAssetMap)(application_uid, (_a = vite_internal_options.configFile) !== null && _a !== void 0 ? _a : 'partial', assetsMap);
45
+ // Enable deployment for partial builds if requested
46
+ await zephyr_engine.start_new_build();
47
+ // Generate enhanced build stats for Vite
48
+ const buildStats = await (0, extract_vite_build_stats_1.extractViteBuildStats)({
49
+ zephyr_engine,
50
+ bundle: outputBundle || {},
51
+ root: vite_internal_options.root,
52
+ });
53
+ await zephyr_engine.upload_assets({
54
+ assetsMap,
55
+ buildStats,
56
+ });
57
+ await zephyr_engine.build_finished();
58
+ }
59
+ catch (error) {
60
+ (0, zephyr_agent_1.logFn)('error', zephyr_agent_1.ZephyrError.format(error));
61
+ }
47
62
  },
48
63
  };
49
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-zephyr-partial.js","sourceRoot":"","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ModuleFederationOptions = Parameters<typeof federation>[0];
3
+ export type ModuleFederationOptions = Parameters<typeof federation>[0] & {
4
+ additionalShared?: Array<{
5
+ libraryName: string;
6
+ sharedConfig?: {
7
+ singleton?: boolean;
8
+ requiredVersion?: string;
9
+ };
10
+ }>;
11
+ };
4
12
  interface VitePluginZephyrOptions {
5
13
  mfConfig?: ModuleFederationOptions;
6
14
  }
@@ -4,6 +4,7 @@ exports.withZephyr = withZephyr;
4
4
  const zephyr_agent_1 = require("zephyr-agent");
5
5
  const vite_1 = require("@module-federation/vite");
6
6
  const extract_vite_assets_map_1 = require("./internal/extract/extract_vite_assets_map");
7
+ const extract_vite_build_stats_1 = require("./internal/extract/extract_vite_build_stats");
7
8
  const extract_mf_vite_remotes_1 = require("./internal/mf-vite-etl/extract-mf-vite-remotes");
8
9
  const load_resolved_remotes_1 = require("./internal/mf-vite-etl/load_resolved_remotes");
9
10
  function withZephyr(_options) {
@@ -12,16 +13,84 @@ function withZephyr(_options) {
12
13
  if (mfConfig) {
13
14
  plugins.push(...(0, vite_1.federation)(mfConfig));
14
15
  }
15
- plugins.push(zephyrPlugin());
16
+ plugins.push(zephyrPlugin(_options));
16
17
  return plugins;
17
18
  }
18
- function zephyrPlugin() {
19
+ function zephyrPlugin(_options) {
19
20
  const { zephyr_engine_defer, zephyr_defer_create } = zephyr_agent_1.ZephyrEngine.defer_create();
21
+ // const mfConfig = _options?.mfConfig;
20
22
  let resolve_vite_internal_options;
21
23
  const vite_internal_options_defer = new Promise((resolve) => {
22
24
  resolve_vite_internal_options = resolve;
23
25
  });
24
26
  let root;
27
+ let outputBundle;
28
+ // // remote names from the mfConfig
29
+ // let remoteNames: string[] = [];
30
+ // if (mfConfig?.remotes) {
31
+ // remoteNames = Object.entries(mfConfig.remotes)
32
+ // .map(([key, remote]) => {
33
+ // if (typeof remote === 'string') {
34
+ // return key;
35
+ // }
36
+ // if (typeof remote === 'object' && 'name' in remote) {
37
+ // return remote.name;
38
+ // }
39
+ // return key;
40
+ // })
41
+ // .filter(Boolean);
42
+ // }
43
+ // ze_log('vite.remoteNames: ', remoteNames);
44
+ // Storage for tracking discovered remote imports
45
+ // const consumes: ApplicationConsumes[] = [];
46
+ // const processedRemotes = new Set<string>();
47
+ // // Track module information for AST analysis
48
+ // const moduleSourceMap = new Map<
49
+ // string,
50
+ // {
51
+ // originalId: string;
52
+ // imports: Set<string>;
53
+ // dynamicImports: Set<string>;
54
+ // source: Set<string>;
55
+ // }
56
+ // >();
57
+ // // Helper function to process remote imports consistently across hooks
58
+ // function processRemoteImport(importItem: {
59
+ // applicationID: string;
60
+ // name: string;
61
+ // usedIn: UsedIn[];
62
+ // consumingApplicationID?: string;
63
+ // }) {
64
+ // const remoteKey = `${importItem.applicationID}/${importItem.name}`;
65
+ // // Get consuming application ID - if it's a remote from the mfConfig, use the remote name
66
+ // let consumingApplicationID = importItem.consumingApplicationID;
67
+ // if (!consumingApplicationID && mfConfig?.name) {
68
+ // consumingApplicationID = mfConfig.name;
69
+ // }
70
+ // if (!processedRemotes.has(remoteKey)) {
71
+ // processedRemotes.add(remoteKey);
72
+ // consumes.push({
73
+ // consumingApplicationID: consumingApplicationID || importItem.name,
74
+ // applicationID: importItem.applicationID,
75
+ // name: importItem.name,
76
+ // usedIn: importItem.usedIn,
77
+ // });
78
+ // } else {
79
+ // // If we've already seen this import, update the usedIn array
80
+ // const existingImport = consumes.find(
81
+ // (item) =>
82
+ // item.applicationID === importItem.applicationID && item.name === importItem.name
83
+ // );
84
+ // if (existingImport) {
85
+ // // Add any new usedIn locations that aren't already in the list
86
+ // for (const usedInItem of importItem.usedIn) {
87
+ // if (!existingImport.usedIn.some((u) => u.file === usedInItem.file)) {
88
+ // existingImport.usedIn.push(usedInItem);
89
+ // }
90
+ // }
91
+ // }
92
+ // }
93
+ // }
25
94
  return {
26
95
  name: 'with-zephyr',
27
96
  enforce: 'post',
@@ -38,26 +107,165 @@ function zephyrPlugin() {
38
107
  publicDir: config.publicDir,
39
108
  });
40
109
  },
110
+ // moduleParsed: async ({
111
+ // id,
112
+ // ast,
113
+ // code,
114
+ // dynamicallyImportedIds,
115
+ // isEntry,
116
+ // isExternal,
117
+ // }) => {
118
+ // // Initialize the module info if it doesn't exist
119
+ // if (!moduleSourceMap.has(id)) {
120
+ // moduleSourceMap.set(id, {
121
+ // originalId: id,
122
+ // imports: new Set(),
123
+ // dynamicImports: new Set(),
124
+ // source: new Set(),
125
+ // });
126
+ // }
127
+ // const moduleInfo = moduleSourceMap.get(id) as {
128
+ // originalId: string;
129
+ // imports: Set<string>;
130
+ // dynamicImports: Set<string>;
131
+ // source: Set<string>;
132
+ // };
133
+ // // Track static imports
134
+ // if (ast?.body) {
135
+ // for (const content of ast.body) {
136
+ // if (content.type === 'ImportDeclaration' && content && isEntry !== true) {
137
+ // const importSource = content.source.raw as string;
138
+ // ze_log('vite.moduleParsed.id: ', id);
139
+ // ze_log('vite.moduleParsed.content: ', importSource);
140
+ // ze_log('vite.moduleParsed.code: ', code);
141
+ // ze_log('vite.moduleParsed.isEntry: ', isEntry);
142
+ // ze_log('vite.moduleParsed.isExternal: ', isExternal);
143
+ // ze_log('vite.moduleParsed.dynamicallyImportedIds: ', dynamicallyImportedIds);
144
+ // if (code) {
145
+ // moduleInfo.source.add(code);
146
+ // }
147
+ // moduleInfo.imports.add(importSource);
148
+ // // Check if this is a Module Federation remote import (e.g., "remote-name/component-name")
149
+ // const match = /^["']([^\/]+)\/([^\/]+)["']$/.exec(importSource);
150
+ // if (match) {
151
+ // const remoteName = match[1];
152
+ // const componentName = match[2];
153
+ // ze_log('vite.moduleParsed.match: ', { remoteName, componentName });
154
+ // // Only process remotes that make sense in a Module Federation context
155
+ // for (const remote of remoteNames) {
156
+ // if (remoteName === remote) {
157
+ // ze_log('Found MF static import in moduleParsed', {
158
+ // remoteName,
159
+ // componentName,
160
+ // id,
161
+ // });
162
+ // // Create a consistent usedIn entry
163
+ // const usedIn = [
164
+ // {
165
+ // file: id,
166
+ // url: id.replace(root, ''),
167
+ // },
168
+ // ];
169
+ // ze_log('vite.moduleParsed.processRemoteImport: ', {
170
+ // remoteName,
171
+ // componentName,
172
+ // id,
173
+ // });
174
+ // // Process the remote import
175
+ // processRemoteImport({
176
+ // applicationID: remoteName,
177
+ // name: componentName,
178
+ // consumingApplicationID: componentName,
179
+ // usedIn,
180
+ // });
181
+ // }
182
+ // }
183
+ // }
184
+ // }
185
+ // }
186
+ // }
187
+ // // Extract __vitePreload imports for lazy-loaded components
188
+ // if (ast && code) {
189
+ // try {
190
+ // const preloadImports = extractVitePreloadImports(ast as ProgramNode, code);
191
+ // for (const preloadImport of preloadImports) {
192
+ // const { remoteId, importPath } = preloadImport;
193
+ // // Only process remotes that are configured in the MF config
194
+ // if (remoteNames.includes(remoteId)) {
195
+ // ze_log('Found MF lazy import via __vitePreload', {
196
+ // remoteId,
197
+ // importPath,
198
+ // id,
199
+ // });
200
+ // // Create a consistent usedIn entry
201
+ // const usedIn = [
202
+ // {
203
+ // file: id,
204
+ // url: id.replace(root, ''),
205
+ // },
206
+ // ];
207
+ // // Process the remote import
208
+ // processRemoteImport({
209
+ // applicationID: remoteId,
210
+ // name: importPath,
211
+ // consumingApplicationID: mfConfig?.name,
212
+ // usedIn,
213
+ // });
214
+ // }
215
+ // }
216
+ // } catch (error) {
217
+ // // Log but don't crash on parse errors
218
+ // ze_log('Error parsing __vitePreload imports', { error, id });
219
+ // }
220
+ // }
221
+ // },
41
222
  transform: async (code, id) => {
42
- const zephyr_engine = await zephyr_engine_defer;
43
- const dependencyPairs = (0, extract_mf_vite_remotes_1.extract_remotes_dependencies)(root, code, id);
44
- if (!dependencyPairs)
223
+ try {
224
+ // Handle dependency resolution
225
+ const dependencyPairs = (0, extract_mf_vite_remotes_1.extract_remotes_dependencies)(root, code, id);
226
+ if (!dependencyPairs)
227
+ return code;
228
+ const zephyr_engine = await zephyr_engine_defer;
229
+ const resolved_remotes = await zephyr_engine.resolve_remote_dependencies(dependencyPairs);
230
+ if (!resolved_remotes)
231
+ return code;
232
+ return (0, load_resolved_remotes_1.load_resolved_remotes)(resolved_remotes, code, id);
233
+ }
234
+ catch (error) {
235
+ (0, zephyr_agent_1.logFn)('error', zephyr_agent_1.ZephyrError.format(error));
236
+ // returns the original code in case of error
45
237
  return code;
46
- const resolved_remotes = await zephyr_engine.resolve_remote_dependencies(dependencyPairs);
47
- if (!resolved_remotes)
48
- return code;
49
- return (0, load_resolved_remotes_1.load_resolved_remotes)(resolved_remotes, code, id);
238
+ }
239
+ },
240
+ // Capture the output bundle for build stats generation
241
+ writeBundle: (_, bundle) => {
242
+ outputBundle = bundle;
50
243
  },
51
244
  closeBundle: async () => {
52
- const vite_internal_options = await vite_internal_options_defer;
53
- const zephyr_engine = await zephyr_engine_defer;
54
- await zephyr_engine.start_new_build();
55
- const assetsMap = await (0, extract_vite_assets_map_1.extract_vite_assets_map)(zephyr_engine, vite_internal_options);
56
- await zephyr_engine.upload_assets({
57
- assetsMap,
58
- buildStats: await (0, zephyr_agent_1.zeBuildDashData)(zephyr_engine),
59
- });
60
- await zephyr_engine.build_finished();
245
+ try {
246
+ const [vite_internal_options, zephyr_engine] = await Promise.all([
247
+ vite_internal_options_defer,
248
+ zephyr_engine_defer,
249
+ ]);
250
+ await zephyr_engine.start_new_build();
251
+ const assetsMap = await (0, extract_vite_assets_map_1.extract_vite_assets_map)(zephyr_engine, vite_internal_options);
252
+ // Generate enhanced build stats for Vite using the discovered remote imports
253
+ const buildStats = await (0, extract_vite_build_stats_1.extractViteBuildStats)({
254
+ zephyr_engine,
255
+ bundle: outputBundle || {},
256
+ mfConfig: _options === null || _options === void 0 ? void 0 : _options.mfConfig,
257
+ root,
258
+ });
259
+ // Upload assets and build stats
260
+ await zephyr_engine.upload_assets({
261
+ assetsMap,
262
+ buildStats,
263
+ });
264
+ await zephyr_engine.build_finished();
265
+ }
266
+ catch (error) {
267
+ (0, zephyr_agent_1.logFn)('error', zephyr_agent_1.ZephyrError.format(error));
268
+ }
61
269
  },
62
270
  };
63
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EH,gCAAgC;gBAChC,MAAM,aAAa,CAAC,aAAa,CAAC;oBAChC,SAAS;oBACT,UAAU;iBACX,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-zephyr",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "Vite plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-zephyr",
3
- "version": "0.0.0-canary-20250508125404",
3
+ "version": "0.0.0-canary-20250513003429",
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-20250508125404"
27
+ "zephyr-agent": "0.0.0-canary-20250513003429"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/is-ci": "3.0.4",