@module-federation/vite 1.23.7 → 1.23.9
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/lib/{dtsConstants-CDuC8Bb7.js → dtsConstants-DIcz34LN.js} +29 -35
- package/lib/index.js +87 -43
- package/lib/{logger-D67aJYOe.js → logger-Ckj1FMRH.js} +8 -1
- package/lib/{pluginDts-rZMRTCTz.js → pluginDts-CSCuhD4x.js} +2 -2
- package/lib/{sharedKeyMatcher-C04bVN1q.js → sharedKeyMatcher-B5VKsEVQ.js} +1 -1
- package/lib/{ssrEntryLoader-DKpOrW8D.js → ssrEntryLoader--NkahIOF.js} +19 -13
- package/lib/{ssrVmStrategy-D1cSKUV-.js → ssrVmStrategy-uJaUmHLS.js} +3 -3
- package/lib/utils/ssrEntryLoader.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as getNodeModulesSuffix, r as getSharedRuntimeKey } from "./sharedKeyMatcher-
|
|
1
|
+
import { p as normalizePathForImport, r as mfWarn, t as createModuleFederationError } from "./logger-Ckj1FMRH.js";
|
|
2
|
+
import { d as getNodeModulesSuffix, r as getSharedRuntimeKey } from "./sharedKeyMatcher-B5VKsEVQ.js";
|
|
3
3
|
import { existsSync, readFileSync, readdirSync, realpathSync } from "fs";
|
|
4
4
|
import { createRequire } from "module";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -28,6 +28,14 @@ const REACT_DOM_CLIENT_SHARE = "react-dom/client";
|
|
|
28
28
|
function isReactCoreShare(pkg) {
|
|
29
29
|
return pkg === "react" || pkg.startsWith("react/");
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* React and its renderer, including subpath exports. Their wrappers bind
|
|
33
|
+
* synchronously and carry the mixed-mode guard, so the generic deferral of a
|
|
34
|
+
* negotiated singleton's local copy does not apply to them.
|
|
35
|
+
*/
|
|
36
|
+
function isReactFamilyShare(pkg) {
|
|
37
|
+
return isReactCoreShare(pkg) || pkg === "react-dom" || pkg.startsWith("react-dom/");
|
|
38
|
+
}
|
|
31
39
|
//#endregion
|
|
32
40
|
//#region src/utils/packageUtils.ts
|
|
33
41
|
const dependencyPresenceCache = /* @__PURE__ */ new Map();
|
|
@@ -279,35 +287,17 @@ function getPackageNameFromNodeModulePath(source) {
|
|
|
279
287
|
if (parts[0].startsWith("@")) return parts[1] ? `${parts[0]}/${parts[1]}` : void 0;
|
|
280
288
|
return parts[0];
|
|
281
289
|
}
|
|
282
|
-
function
|
|
283
|
-
const
|
|
284
|
-
const id =
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
key: `${scope}:${id}`
|
|
289
|
-
};
|
|
290
|
+
function createSharedCacheDescriptor(pkg, singleton, version, scope) {
|
|
291
|
+
const scopeName = (Array.isArray(scope) ? scope[0] : scope) || "default";
|
|
292
|
+
const id = singleton || !version ? pkg : pkg + "@" + version;
|
|
293
|
+
const descriptor = { canonical: scopeName + ":" + id };
|
|
294
|
+
if (scopeName === "default") descriptor.aliases = [id];
|
|
295
|
+
return descriptor;
|
|
290
296
|
}
|
|
291
297
|
function getSharedCacheDescriptor(pkg, shareItem) {
|
|
292
|
-
|
|
293
|
-
pkg: shareItem.shareConfig.request !== void 0 || shareItem.shareConfig.shareKey !== void 0 ? getSharedRuntimeKey(pkg, shareItem) : pkg,
|
|
294
|
-
singleton: shareItem.shareConfig.singleton,
|
|
295
|
-
version: shareItem.version,
|
|
296
|
-
scope: shareItem.scope
|
|
297
|
-
});
|
|
298
|
-
return {
|
|
299
|
-
canonical: parts.key,
|
|
300
|
-
...parts.scope === "default" ? { aliases: [parts.id] } : {}
|
|
301
|
-
};
|
|
298
|
+
return createSharedCacheDescriptor(shareItem.shareConfig.request !== void 0 || shareItem.shareConfig.shareKey !== void 0 ? getSharedRuntimeKey(pkg, shareItem) : pkg, shareItem.shareConfig.singleton, shareItem.version, shareItem.scope);
|
|
302
299
|
}
|
|
303
|
-
const sharedCacheHelperCode = `const __mfGetSharedCacheDescriptor = (
|
|
304
|
-
const normalizedScope = Array.isArray(scope) ? scope[0] : scope;
|
|
305
|
-
const scopeName = normalizedScope || "default";
|
|
306
|
-
const id = singleton || !version ? pkg : pkg + "@" + version;
|
|
307
|
-
const descriptor = { canonical: scopeName + ":" + id };
|
|
308
|
-
if (scopeName === "default") descriptor.aliases = [id];
|
|
309
|
-
return descriptor;
|
|
310
|
-
};
|
|
300
|
+
const sharedCacheHelperCode = `const __mfGetSharedCacheDescriptor = ${createSharedCacheDescriptor.toString()};
|
|
311
301
|
const __mfReadSharedCache = (cache, descriptor) => {
|
|
312
302
|
const value = cache[descriptor.canonical];
|
|
313
303
|
if (value !== undefined) return value;
|
|
@@ -530,7 +520,7 @@ function resolveInstalledPackageJson(pkg, cwd, packageName, opts) {
|
|
|
530
520
|
const directCandidate = tryReadPackageJson(path$1.join(dir, "node_modules", packageName, "package.json"), packageName);
|
|
531
521
|
if (directCandidate) return directCandidate;
|
|
532
522
|
}
|
|
533
|
-
return findPackageInDependents(packageName, cwd) ?? findPackageInPnpmStore(packageName, cwd);
|
|
523
|
+
return findPackageInDependents(packageName, cwd)?.copy ?? findPackageInPnpmStore(packageName, cwd);
|
|
534
524
|
}
|
|
535
525
|
function readDirEntries(dir) {
|
|
536
526
|
try {
|
|
@@ -605,12 +595,13 @@ function walkDependents(packageName, cwd, reachedNames) {
|
|
|
605
595
|
for (const rootDependencies of rootDependencyGroups) {
|
|
606
596
|
let level = rootDependencies.map((name) => ({
|
|
607
597
|
name,
|
|
608
|
-
fromDir: cwd
|
|
598
|
+
fromDir: cwd,
|
|
599
|
+
chain: [name]
|
|
609
600
|
}));
|
|
610
601
|
while (level.length) {
|
|
611
602
|
const candidates = [];
|
|
612
603
|
const nextLevel = [];
|
|
613
|
-
for (const { name, fromDir } of level) {
|
|
604
|
+
for (const { name, fromDir, chain } of level) {
|
|
614
605
|
if (name === packageName) continue;
|
|
615
606
|
const dependent = findPackageFrom(name, fromDir);
|
|
616
607
|
if (!dependent || visited.has(dependent.dir)) continue;
|
|
@@ -621,17 +612,20 @@ function walkDependents(packageName, cwd, reachedNames) {
|
|
|
621
612
|
const copy = findPackageFrom(packageName, dependent.dir);
|
|
622
613
|
if (copy) candidates.push({
|
|
623
614
|
copy,
|
|
624
|
-
via: name
|
|
615
|
+
via: name,
|
|
616
|
+
dependentDir: dependent.dir,
|
|
617
|
+
chain
|
|
625
618
|
});
|
|
626
619
|
}
|
|
627
620
|
for (const dependency of dependencies) nextLevel.push({
|
|
628
621
|
name: dependency,
|
|
629
|
-
fromDir: dependent.dir
|
|
622
|
+
fromDir: dependent.dir,
|
|
623
|
+
chain: [...chain, dependency]
|
|
630
624
|
});
|
|
631
625
|
}
|
|
632
626
|
if (candidates.length) {
|
|
633
627
|
warnOnAmbiguousDependents(packageName, candidates);
|
|
634
|
-
return candidates[0]
|
|
628
|
+
return candidates[0];
|
|
635
629
|
}
|
|
636
630
|
level = nextLevel;
|
|
637
631
|
}
|
|
@@ -804,4 +798,4 @@ function watchFileEvents(watcher, listener) {
|
|
|
804
798
|
//#region src/utils/dtsConstants.ts
|
|
805
799
|
const DEFAULT_PUBLIC_TYPES_FOLDER = "@mf-types";
|
|
806
800
|
//#endregion
|
|
807
|
-
export {
|
|
801
|
+
export { sharedCacheHelperCode as C, isReactCoreShare as D, REACT_DOM_CLIENT_SHARE as E, isReactFamilyShare as O, setPackageDetectionCwd as S, REACT_CLIENT_INTERNALS_KEY as T, isPackageInstalled as _, getDependencyNames as a, resolveImportPath as b, getIsRolldown as c, getPackageName as d, getPackageNameFromNodeModulePath as f, isPackageExportAvailable as g, isNuxtProjectRoot as h, findPackageInDependents as i, getPackageDetectionCwd as l, hasPackageDependency as m, formatDevServerHostForOrigin as n, getInstalledPackageEntry as o, getSharedCacheDescriptor as p, watchFileEvents as r, getInstalledPackageJson as s, DEFAULT_PUBLIC_TYPES_FOLDER as t, getPackageExportSpecifiersForFile as u, packageNameDecode as v, supportsCodeSplittingGroupDebugName as w, resolveModulePath as x, packageNameEncode as y };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CodeRewriter, c as
|
|
2
|
-
import { _ as removeTrailingSlash, a as matchesSharedSource, b as stripViteFsPrefix, c as filterId, d as getNodeModulesSuffix, f as isAssetLikeImport, g as normalizeNodeModulePath, h as isViteOptimizableEntry, i as invalidateSharedKeyMatcher, l as getBasePath$1, m as isNuxtClientBase, n as getSharedRequest, p as isNodeModulePath, r as getSharedRuntimeKey, s as ensureTrailingSlash, t as findSharedKey, u as getCommonSharedSubpaths, v as resolvePublicPath, x as toRelativeImport, y as stripQueryAndHash } from "./sharedKeyMatcher-
|
|
3
|
-
import { C as
|
|
1
|
+
import { a as CodeRewriter, c as VITE_ID_PREFIX, d as isAbsoluteUrl, f as isHttpUrl, h as resolveHashPlaceholderFileName, i as createCodePositionMap, l as VITE_NULL_BYTE_PLACEHOLDER, m as rebaseImport, o as createSourceMap, p as normalizePathForImport, r as mfWarn, t as createModuleFederationError, u as decodeViteId } from "./logger-Ckj1FMRH.js";
|
|
2
|
+
import { _ as removeTrailingSlash, a as matchesSharedSource, b as stripViteFsPrefix, c as filterId, d as getNodeModulesSuffix, f as isAssetLikeImport, g as normalizeNodeModulePath, h as isViteOptimizableEntry, i as invalidateSharedKeyMatcher, l as getBasePath$1, m as isNuxtClientBase, n as getSharedRequest, p as isNodeModulePath, r as getSharedRuntimeKey, s as ensureTrailingSlash, t as findSharedKey, u as getCommonSharedSubpaths, v as resolvePublicPath, x as toRelativeImport, y as stripQueryAndHash } from "./sharedKeyMatcher-B5VKsEVQ.js";
|
|
3
|
+
import { C as sharedCacheHelperCode, D as isReactCoreShare, E as REACT_DOM_CLIENT_SHARE, O as isReactFamilyShare, S as setPackageDetectionCwd, T as REACT_CLIENT_INTERNALS_KEY, _ as isPackageInstalled, a as getDependencyNames, b as resolveImportPath, c as getIsRolldown, d as getPackageName, f as getPackageNameFromNodeModulePath, g as isPackageExportAvailable, h as isNuxtProjectRoot, i as findPackageInDependents, l as getPackageDetectionCwd, m as hasPackageDependency, n as formatDevServerHostForOrigin, o as getInstalledPackageEntry, p as getSharedCacheDescriptor, r as watchFileEvents, s as getInstalledPackageJson, u as getPackageExportSpecifiersForFile, v as packageNameDecode, w as supportsCodeSplittingGroupDebugName, x as resolveModulePath, y as packageNameEncode } from "./dtsConstants-DIcz34LN.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as fs$2 from "fs";
|
|
6
6
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "fs";
|
|
@@ -852,8 +852,7 @@ function getSuffix(name) {
|
|
|
852
852
|
const patternMap = {};
|
|
853
853
|
const cacheMap = {};
|
|
854
854
|
const idCacheMap = {};
|
|
855
|
-
const
|
|
856
|
-
const VITE_ENCODED_NULL_BYTE_PREFIX = `${VITE_ID_PREFIX}__x00__`;
|
|
855
|
+
const VITE_ENCODED_NULL_BYTE_PREFIX = `${VITE_ID_PREFIX}${VITE_NULL_BYTE_PLACEHOLDER}`;
|
|
857
856
|
const MF_OWNER_INFIX = "__mf_owner__";
|
|
858
857
|
function createViteEncodedIdPrefixRegExp(sourcePrefix = "") {
|
|
859
858
|
return new RegExp(`^(?:${escapeRegExp(VITE_ENCODED_NULL_BYTE_PREFIX)})?${sourcePrefix}`);
|
|
@@ -861,11 +860,6 @@ function createViteEncodedIdPrefixRegExp(sourcePrefix = "") {
|
|
|
861
860
|
function toViteEncodedId(id) {
|
|
862
861
|
return `${VITE_ENCODED_NULL_BYTE_PREFIX}${id}`;
|
|
863
862
|
}
|
|
864
|
-
function decodeViteId(id) {
|
|
865
|
-
if (!id.startsWith("/@id/")) return id;
|
|
866
|
-
const viteId = id.slice(5);
|
|
867
|
-
return viteId.startsWith("__x00__") ? `\0${viteId.slice(7)}` : viteId;
|
|
868
|
-
}
|
|
869
863
|
function assertModuleFound(tag, str = "") {
|
|
870
864
|
const module = VirtualModule.findById(str) ?? VirtualModule.findModule(tag, str);
|
|
871
865
|
if (!module) throw createModuleFederationError(`Module Federation shared module '${str}' not found. Please ensure it's installed as a dependency in your package.json.`);
|
|
@@ -1669,10 +1663,13 @@ function getRuntimeRemoteAlias(alias, options) {
|
|
|
1669
1663
|
return `${getFederationScopeKey(options)}__${alias}`;
|
|
1670
1664
|
}
|
|
1671
1665
|
function getSsrRuntimeRemotes(remotes, options) {
|
|
1672
|
-
return Object.entries(remotes).map(([
|
|
1673
|
-
|
|
1666
|
+
return Object.entries(remotes).map(([alias, item]) => ({
|
|
1667
|
+
alias,
|
|
1668
|
+
entryGlobalName: item.entryGlobalName,
|
|
1669
|
+
name: getRuntimeRemoteAlias(alias, options),
|
|
1674
1670
|
entry: item.entry,
|
|
1675
|
-
type: item.type ?? "module"
|
|
1671
|
+
type: item.type ?? "module",
|
|
1672
|
+
shareScope: item.shareScope ?? "default"
|
|
1676
1673
|
}));
|
|
1677
1674
|
}
|
|
1678
1675
|
function getRuntimeInitGlobalKey(ownerImportId) {
|
|
@@ -1979,6 +1976,19 @@ function hasCodeMatch(source, regex, codePositions) {
|
|
|
1979
1976
|
while ((match = regex.exec(source)) !== null) if (codePositions[match.index]) return true;
|
|
1980
1977
|
return false;
|
|
1981
1978
|
}
|
|
1979
|
+
/** True when the code before `index` is a `.`: member access (`obj.export`), not an identifier. */
|
|
1980
|
+
function isMemberName(source, index, codePositions) {
|
|
1981
|
+
let previousCodeIndex = index - 1;
|
|
1982
|
+
while (previousCodeIndex >= 0 && (/\s/.test(source[previousCodeIndex]) || !codePositions[previousCodeIndex])) previousCodeIndex--;
|
|
1983
|
+
return source[previousCodeIndex] === ".";
|
|
1984
|
+
}
|
|
1985
|
+
/** TypeScript `export = value`; an assignment to a member named `export` (`e.export = 'export'`) is not one. */
|
|
1986
|
+
function hasExportAssignment(source, codePositions) {
|
|
1987
|
+
const regex = /\bexport\s*=/g;
|
|
1988
|
+
let match;
|
|
1989
|
+
while ((match = regex.exec(source)) !== null) if (codePositions[match.index] && !isMemberName(source, match.index, codePositions)) return true;
|
|
1990
|
+
return false;
|
|
1991
|
+
}
|
|
1982
1992
|
/**
|
|
1983
1993
|
* True when the file contains a top-level static `import`/`export` declaration.
|
|
1984
1994
|
* Local identifiers named `module` or `exports` (webpack/rspack helpers,
|
|
@@ -1997,9 +2007,7 @@ function hasEsmModuleSyntax(source, codePositions) {
|
|
|
1997
2007
|
}
|
|
1998
2008
|
if (!codePositions[match.index]) continue;
|
|
1999
2009
|
if (braceDepth !== 0) continue;
|
|
2000
|
-
|
|
2001
|
-
while (previousCodeIndex >= 0 && (/\s/.test(source[previousCodeIndex]) || !codePositions[previousCodeIndex])) previousCodeIndex--;
|
|
2002
|
-
if (source[previousCodeIndex] === ".") continue;
|
|
2010
|
+
if (isMemberName(source, match.index, codePositions)) continue;
|
|
2003
2011
|
let nextCodeIndex = match.index + match[0].length;
|
|
2004
2012
|
while (nextCodeIndex < source.length && (/\s/.test(source[nextCodeIndex]) || !codePositions[nextCodeIndex])) nextCodeIndex++;
|
|
2005
2013
|
if (source[nextCodeIndex] === "(") continue;
|
|
@@ -2015,9 +2023,7 @@ function hasCommonJsExports(source) {
|
|
|
2015
2023
|
let match;
|
|
2016
2024
|
while ((match = exportsRegex.exec(source)) !== null) {
|
|
2017
2025
|
if (!codePositions[match.index]) continue;
|
|
2018
|
-
|
|
2019
|
-
while (previousCodeIndex >= 0 && (/\s/.test(source[previousCodeIndex]) || !codePositions[previousCodeIndex])) previousCodeIndex--;
|
|
2020
|
-
if (source[previousCodeIndex] === ".") continue;
|
|
2026
|
+
if (isMemberName(source, match.index, codePositions)) continue;
|
|
2021
2027
|
return true;
|
|
2022
2028
|
}
|
|
2023
2029
|
return false;
|
|
@@ -2286,7 +2292,7 @@ function getNamedExportsViaRegex(source, filePath, visited, scanState = { comple
|
|
|
2286
2292
|
else for (const name of additionalNames) names.add(name);
|
|
2287
2293
|
if (hasUnsupportedBindingPattern(source, exportedVariableDeclarationRegex.lastIndex)) scanState.complete = false;
|
|
2288
2294
|
}
|
|
2289
|
-
if (hasCodeMatch(source, /export\s+import\s+/g, codePositions) ||
|
|
2295
|
+
if (hasCodeMatch(source, /export\s+import\s+/g, codePositions) || hasExportAssignment(source, codePositions)) scanState.complete = false;
|
|
2290
2296
|
if (hasCodeMatch(source, /export\s+@/g, codePositions)) scanState.complete = false;
|
|
2291
2297
|
const destructureRegex = /export\s+(?:const|let|var)\s+(\{[^}]*\}|\[[^\]]*\])\s*=/g;
|
|
2292
2298
|
const bindingNameRegex = new RegExp(`^(${JS_IDENTIFIER_PATTERN})`, "u");
|
|
@@ -2370,9 +2376,7 @@ function getNamedExportsViaRegex(source, filePath, visited, scanState = { comple
|
|
|
2370
2376
|
while ((match = exportKeywordRegex.exec(source)) !== null) {
|
|
2371
2377
|
if (!codePositions[match.index]) continue;
|
|
2372
2378
|
if (recognizedExportStarts.has(match.index)) continue;
|
|
2373
|
-
|
|
2374
|
-
while (previousCodeIndex >= 0 && (/\s/.test(source[previousCodeIndex]) || !codePositions[previousCodeIndex])) previousCodeIndex--;
|
|
2375
|
-
if (source[previousCodeIndex] === ".") continue;
|
|
2379
|
+
if (isMemberName(source, match.index, codePositions)) continue;
|
|
2376
2380
|
let nextCodeIndex = match.index + match[0].length;
|
|
2377
2381
|
while (nextCodeIndex < source.length && (/\s/.test(source[nextCodeIndex]) || !codePositions[nextCodeIndex])) nextCodeIndex++;
|
|
2378
2382
|
if (source[nextCodeIndex] === "(") continue;
|
|
@@ -3165,7 +3169,8 @@ function writeLoadShareModule(pkg, shareItem, command, options, exportConditions
|
|
|
3165
3169
|
const hasCompleteExportCoverage = detectedNamedExports !== void 0;
|
|
3166
3170
|
const isSingleton = shareItem.shareConfig.singleton === true;
|
|
3167
3171
|
const isWorkspaceSingleton = isWorkspacePackage && isSingleton;
|
|
3168
|
-
const
|
|
3172
|
+
const negotiatesSingletonWithRemotes = isSingleton && !isReactFamilyShare(pkg) && options.shareStrategy === "version-first" && hasRemotes(options) && pkg !== "solid-js" && !isSharedSingletonConsumedByPeer(pkg, options, true);
|
|
3173
|
+
const usesDeferredSingletonFallback = hasCompleteExportCoverage && shareItem.shareConfig.eager !== true && (isWorkspacePackage || negotiatesSingletonWithRemotes || command !== "build" && isRemoteOnlyContainer(options) && isSingleton || command === "build" && isRemoteContainer(options) && !isSharedSingletonConsumedByPeer(pkg, options, true));
|
|
3169
3174
|
const servesRemoteSingletonFallback = command !== "build" && isRemoteOnlyContainer(options) && isSingleton;
|
|
3170
3175
|
const isConsumedByPeerSingleton = isSharedSingletonConsumedByPeer(pkg, options);
|
|
3171
3176
|
const usesEntryInjectedRemoteFallback = hasCompleteExportCoverage && !isWorkspaceSingleton && isRemoteContainer(options) && isSingleton && options.hostInitInjectLocation === "entry" && (command === "build" || isConsumedByPeerSingleton);
|
|
@@ -4443,8 +4448,10 @@ function generateRuntimeSharedCacheSeedCode(shareStrategy, options, command = "b
|
|
|
4443
4448
|
const seedOrder = seedBatches.flat();
|
|
4444
4449
|
const seedIndex = new Map(seedOrder.map((pkg, index) => [pkg, index]));
|
|
4445
4450
|
const seedPrerequisites = Object.fromEntries(Array.from(getSharePrerequisites(seedOrder, options)).filter(([, prerequisites]) => prerequisites.length > 0).map(([pkg, prerequisites]) => [seedIndex.get(pkg), prerequisites.map((prerequisite) => seedIndex.get(prerequisite))]));
|
|
4451
|
+
const versionFirstDeferredSeeds = shareStrategy === "version-first" && hasRemotes(options) ? seedOrder.filter((pkg) => !isReactFamilyShare(pkg)) : [];
|
|
4446
4452
|
return `
|
|
4447
4453
|
const __mfSeedOrder = ${toSafeJsLiteral(seedOrder)};
|
|
4454
|
+
const __mfVersionFirstDeferredSeeds = new Set(${toSafeJsLiteral(versionFirstDeferredSeeds)});
|
|
4448
4455
|
const __mfSeedBatches = ${toSafeJsLiteral(seedBatches)};
|
|
4449
4456
|
const __mfSeedIndex = new Map(__mfSeedOrder.map((pkg, index) => [pkg, index]));
|
|
4450
4457
|
const __mfSeedPrerequisites = ${toSafeJsLiteral(seedPrerequisites)};
|
|
@@ -4599,6 +4606,13 @@ function generateRuntimeSharedCacheSeedCode(shareStrategy, options, command = "b
|
|
|
4599
4606
|
: __mfReadSharedCache(__mfModuleCache.share, cacheDescriptor);
|
|
4600
4607
|
if (cachedShare !== undefined) return false;
|
|
4601
4608
|
if (share.treeShaking || share.shareConfig?.import === false) return true;
|
|
4609
|
+
// version-first negotiates a singleton against this container's remotes, which only
|
|
4610
|
+
// register during initializeSharing(). Seeding the local copy before that evaluates it
|
|
4611
|
+
// even when a remote's higher version is selected, so a package with top-level side
|
|
4612
|
+
// effects (custom element registration, polyfills) runs twice (#1527). Wait for the
|
|
4613
|
+
// remotes; the deferred pass seeds the local copy only when no remote outranks it.
|
|
4614
|
+
// The React family keeps the eager seed its synchronous wrappers rely on.
|
|
4615
|
+
if (__mfVersionFirstDeferredSeeds.has(pkg) && share.shareConfig?.singleton) return true;
|
|
4602
4616
|
if (typeof __mfSelectExternalSharedProvider !== 'function') return false;
|
|
4603
4617
|
return Boolean(__mfSelectExternalSharedProvider(
|
|
4604
4618
|
initialShared[pkg],
|
|
@@ -5815,7 +5829,12 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
5815
5829
|
if (__mfModuleCache.pendingShareLoads) {
|
|
5816
5830
|
await Promise.all(__mfModuleCache.pendingShareLoads)
|
|
5817
5831
|
}
|
|
5818
|
-
|
|
5832
|
+
const res = await exposesMap[moduleName]()
|
|
5833
|
+
// Wrappers evaluated by the expose import may queue share loads only now (#1535).
|
|
5834
|
+
if (__mfModuleCache.pendingShareLoads) {
|
|
5835
|
+
await Promise.all(__mfModuleCache.pendingShareLoads)
|
|
5836
|
+
}
|
|
5837
|
+
return () => res
|
|
5819
5838
|
}
|
|
5820
5839
|
${guardHostAutoInit ? `let __mfInitPromise;
|
|
5821
5840
|
function __mfGuardedInit(shared, initScope, remoteEntryInitOptions) {
|
|
@@ -8372,7 +8391,7 @@ function ${helperName}(names) {
|
|
|
8372
8391
|
}
|
|
8373
8392
|
//#endregion
|
|
8374
8393
|
//#region package.json
|
|
8375
|
-
var version$1 = "1.23.
|
|
8394
|
+
var version$1 = "1.23.9";
|
|
8376
8395
|
//#endregion
|
|
8377
8396
|
//#region src/virtualModules/virtualExposesSSR.ts
|
|
8378
8397
|
/**
|
|
@@ -9656,9 +9675,7 @@ function pluginProxyRemoteEntry_default({ options, remoteEntryId, virtualExposes
|
|
|
9656
9675
|
let dependencyInvalidationVersion = 0;
|
|
9657
9676
|
let reactIslandExposes = /* @__PURE__ */ new Set();
|
|
9658
9677
|
let isTanStackStart = false;
|
|
9659
|
-
const isHostAutoInitId = (id) =>
|
|
9660
|
-
return id.split("?")[0].includes(getHostAutoInitPath(options));
|
|
9661
|
-
};
|
|
9678
|
+
const isHostAutoInitId = (id) => isOwnedHostAutoInitId(id, options);
|
|
9662
9679
|
const getEnvironmentConditions = (context) => context.environment?.config?.resolve?.conditions;
|
|
9663
9680
|
const isSsrBuild = (context) => isServerBuildContext(context, viteConfig);
|
|
9664
9681
|
const loadRemoteEntryCode = (context) => getParsePromise().then((_) => generateRemoteEntry(options, virtualExposesId, _command, getEnvironmentConditions(context), isSsrBuild(context)));
|
|
@@ -9735,7 +9752,7 @@ function pluginProxyRemoteEntry_default({ options, remoteEntryId, virtualExposes
|
|
|
9735
9752
|
if (id === remoteEntryId) return remoteEntryId;
|
|
9736
9753
|
if (id === virtualExposesId) return virtualExposesId;
|
|
9737
9754
|
if (_command === "serve" && isHostAutoInitId(id)) return id;
|
|
9738
|
-
if (importer === remoteEntryId && !id.startsWith(".") && !id.startsWith("/") && !id.startsWith("\0") && !id.startsWith("virtual:")) {
|
|
9755
|
+
if ((importer === remoteEntryId || importer !== void 0 && isHostAutoInitId(importer)) && !id.startsWith(".") && !id.startsWith("/") && !id.startsWith("\0") && !id.startsWith("virtual:")) {
|
|
9739
9756
|
const importPath = typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url);
|
|
9740
9757
|
const resolved = await this.resolve(id, importPath, { skipSelf: true });
|
|
9741
9758
|
if (resolved) return resolved;
|
|
@@ -10313,6 +10330,8 @@ function proxySharedModule(options) {
|
|
|
10313
10330
|
let devServer;
|
|
10314
10331
|
const materializedLoadShareSources = /* @__PURE__ */ new Set();
|
|
10315
10332
|
const emittedTreeShakingProviders = /* @__PURE__ */ new Set();
|
|
10333
|
+
const concreteShareSources = /* @__PURE__ */ new Map();
|
|
10334
|
+
let concreteShareSourcesSize = -1;
|
|
10316
10335
|
const hasAnalyzableShares = Object.values(shared).some((share) => shouldAnalyzeSharedExports(share));
|
|
10317
10336
|
const getEnvironmentConfig = (context) => context.environment?.config;
|
|
10318
10337
|
const getEnvironmentConditions = (context) => getEnvironmentConfig(context)?.resolve?.conditions;
|
|
@@ -10550,6 +10569,23 @@ function proxySharedModule(options) {
|
|
|
10550
10569
|
name: "proxyPreBuildShared:resolve-prebuild",
|
|
10551
10570
|
enforce: "pre",
|
|
10552
10571
|
async resolveId(source, importer) {
|
|
10572
|
+
if (_command === "serve" && path$1.isAbsolute(source)) {
|
|
10573
|
+
const usedShares = getUsedShares(federationOptions);
|
|
10574
|
+
if (concreteShareSourcesSize !== usedShares.size) {
|
|
10575
|
+
concreteShareSourcesSize = usedShares.size;
|
|
10576
|
+
concreteShareSources.clear();
|
|
10577
|
+
for (const used of usedShares) {
|
|
10578
|
+
const concrete = getConcreteSharedImportSource(used);
|
|
10579
|
+
if (concrete) concreteShareSources.set(concrete.replaceAll("\\", "/"), used);
|
|
10580
|
+
}
|
|
10581
|
+
}
|
|
10582
|
+
const share = concreteShareSources.get(source.replaceAll("\\", "/"));
|
|
10583
|
+
if (!share) return;
|
|
10584
|
+
const dependent = findPackageInDependents(getPackageName(share), getPackageDetectionCwd());
|
|
10585
|
+
if (!dependent) return;
|
|
10586
|
+
const dependentPackageJson = path$1.join(dependent.dependentDir, "package.json");
|
|
10587
|
+
return resolveInternally(this, share, dependentPackageJson);
|
|
10588
|
+
}
|
|
10553
10589
|
if (!source.includes("__prebuild__")) return;
|
|
10554
10590
|
if (source.startsWith(".")) return;
|
|
10555
10591
|
const pkgName = assertModuleFound(PREBUILD_TAG, source).name;
|
|
@@ -11171,7 +11207,7 @@ function pluginSSRRemoteEntry(options) {
|
|
|
11171
11207
|
} catch {}
|
|
11172
11208
|
}
|
|
11173
11209
|
const fetchedId = body.data.name === "fetchModule" ? body.data.data[0] : void 0;
|
|
11174
|
-
const shared = typeof fetchedId === "string" && !!findSharedKey(fetchedId, options.shared);
|
|
11210
|
+
const shared = typeof fetchedId === "string" && !!findSharedKey(decodeViteId(fetchedId).replace(/^\0+/, ""), options.shared);
|
|
11175
11211
|
res.setHeader("Content-Type", "application/json");
|
|
11176
11212
|
res.end(JSON.stringify(shared ? {
|
|
11177
11213
|
...result,
|
|
@@ -11455,6 +11491,7 @@ function pluginSsrRuntimeInit(options) {
|
|
|
11455
11491
|
if (isOwnedHostAutoInitId(id, options)) {
|
|
11456
11492
|
const pluginImports = options.runtimePlugins.map((plugin, index) => `import plugin${index} from ${toSafeJsLiteral(getRuntimePluginSpecifier(plugin))};`).join("\n");
|
|
11457
11493
|
const plugins = options.runtimePlugins.map((plugin, index) => `plugin${index}(${Array.isArray(plugin) ? serializeRuntimeOptions(plugin[1]) : ""})`).join(",");
|
|
11494
|
+
const fallbackRemotes = toSafeJsLiteral(getSsrRuntimeRemotes(options.remotes, options));
|
|
11458
11495
|
return {
|
|
11459
11496
|
code: `
|
|
11460
11497
|
import { init } from ${toSafeJsLiteral(options.implementation)};
|
|
@@ -11466,7 +11503,8 @@ function pluginSsrRuntimeInit(options) {
|
|
|
11466
11503
|
// names aliased to their configured names, and the runtime resolves an id
|
|
11467
11504
|
// against the first remote whose name or alias matches. Drop the alias once the
|
|
11468
11505
|
// application registers a remote under that name or alias, so its entry wins.
|
|
11469
|
-
const
|
|
11506
|
+
const bootstrapRemotes = Array.isArray(usedRemotes) ? usedRemotes : ${fallbackRemotes};
|
|
11507
|
+
const bootstrapRemoteNames = new Set(bootstrapRemotes.map((remote) => remote.name));
|
|
11470
11508
|
const applicationRemotePlugin = {
|
|
11471
11509
|
name: 'vite-ssr-application-remote-plugin',
|
|
11472
11510
|
beforeRegisterRemote(args) {
|
|
@@ -11485,7 +11523,7 @@ function pluginSsrRuntimeInit(options) {
|
|
|
11485
11523
|
};
|
|
11486
11524
|
const runtime = init({
|
|
11487
11525
|
name: ${toSafeJsLiteral(options.name)},
|
|
11488
|
-
remotes:
|
|
11526
|
+
remotes: bootstrapRemotes,
|
|
11489
11527
|
shared: usedShared,
|
|
11490
11528
|
plugins: [applicationRemotePlugin, ${plugins}],
|
|
11491
11529
|
shareStrategy: ${toSafeJsLiteral(options.shareStrategy)},
|
|
@@ -12027,6 +12065,11 @@ function canResolveSharedSubpath(subpath, projectRoot) {
|
|
|
12027
12065
|
return false;
|
|
12028
12066
|
}
|
|
12029
12067
|
}
|
|
12068
|
+
function getSharedIncludeEntry(subpath, projectRoot) {
|
|
12069
|
+
if (canResolveSharedSubpath(subpath, projectRoot)) return subpath;
|
|
12070
|
+
const dependent = findPackageInDependents(getPackageName(subpath), projectRoot);
|
|
12071
|
+
if (dependent && canResolveSharedSubpath(subpath, dependent.dependentDir)) return [...dependent.chain, subpath].join(" > ");
|
|
12072
|
+
}
|
|
12030
12073
|
const VITE_DEV_IMPORT_CONDITIONS = /* @__PURE__ */ new Set([
|
|
12031
12074
|
"browser",
|
|
12032
12075
|
"development",
|
|
@@ -12373,7 +12416,8 @@ export default __mfShared.default ?? __mfShared;`
|
|
|
12373
12416
|
optimizeDeps.exclude ??= [];
|
|
12374
12417
|
for (const subpath of getCommonSharedSubpaths(request)) {
|
|
12375
12418
|
writePreBuildLibPath(subpath, shareItem, options);
|
|
12376
|
-
|
|
12419
|
+
const includeEntry = getSharedIncludeEntry(subpath, root);
|
|
12420
|
+
if (includeEntry) optimizeDeps.include.push(includeEntry);
|
|
12377
12421
|
else optimizeDeps.exclude.push(subpath);
|
|
12378
12422
|
}
|
|
12379
12423
|
}
|
|
@@ -12391,18 +12435,18 @@ export default __mfShared.default ?? __mfShared;`
|
|
|
12391
12435
|
const optimizeDeps = config.optimizeDeps ??= {};
|
|
12392
12436
|
optimizeDeps.include ??= [];
|
|
12393
12437
|
optimizeDeps.exclude ??= [];
|
|
12394
|
-
const
|
|
12438
|
+
const includeEntry = isLitShare(runtimeKey) ? void 0 : getSharedIncludeEntry(runtimeKey, root);
|
|
12395
12439
|
if (optimizeDeps.include.includes(runtimeKey)) optimizeDeps.exclude = optimizeDeps.exclude.filter((dep) => dep !== runtimeKey);
|
|
12396
|
-
else if (
|
|
12397
|
-
else optimizeDeps.include.push(
|
|
12440
|
+
else if (!includeEntry || optimizeDeps.exclude.includes(runtimeKey)) optimizeDeps.exclude.push(runtimeKey);
|
|
12441
|
+
else optimizeDeps.include.push(includeEntry);
|
|
12398
12442
|
const commonSubpaths = shareItem.shareConfig.request === void 0 && shareItem.shareConfig.shareKey === void 0 ? getCommonSharedSubpaths(runtimeKey) : [];
|
|
12399
12443
|
for (const subpath of commonSubpaths) {
|
|
12400
|
-
const
|
|
12444
|
+
const subpathIncludeEntry = getSharedIncludeEntry(subpath, root);
|
|
12401
12445
|
if ([
|
|
12402
12446
|
"react/compiler-runtime",
|
|
12403
12447
|
"react-dom/client",
|
|
12404
12448
|
"react-dom/profiling"
|
|
12405
|
-
].includes(subpath) && !
|
|
12449
|
+
].includes(subpath) && !subpathIncludeEntry) {
|
|
12406
12450
|
optimizeDeps.exclude.push(subpath);
|
|
12407
12451
|
continue;
|
|
12408
12452
|
}
|
|
@@ -12410,9 +12454,9 @@ export default __mfShared.default ?? __mfShared;`
|
|
|
12410
12454
|
writeLoadShareModule(subpath, shareItem, _command, options);
|
|
12411
12455
|
writePreBuildLibPath(subpath, shareItem, options);
|
|
12412
12456
|
addConfiguredShare(subpath, options);
|
|
12413
|
-
if (
|
|
12414
|
-
optimizeDeps.include.push(
|
|
12415
|
-
if (runtimeKey === "react-dom") optimizeDeps.include.push(`${
|
|
12457
|
+
if (subpathIncludeEntry) {
|
|
12458
|
+
optimizeDeps.include.push(subpathIncludeEntry);
|
|
12459
|
+
if (runtimeKey === "react-dom" && includeEntry) optimizeDeps.include.push(`${includeEntry} > ${subpath}`);
|
|
12416
12460
|
} else optimizeDeps.exclude.push(subpath);
|
|
12417
12461
|
}
|
|
12418
12462
|
}
|
|
@@ -12500,7 +12544,7 @@ function withoutDynamicRemoteTypeHints(options) {
|
|
|
12500
12544
|
}
|
|
12501
12545
|
function loadPluginDts(options) {
|
|
12502
12546
|
if (options.dts === false) return [];
|
|
12503
|
-
return [import("./pluginDts-
|
|
12547
|
+
return [import("./pluginDts-CSCuhD4x.js").then(({ default: pluginDts }) => pluginDts(options))];
|
|
12504
12548
|
}
|
|
12505
12549
|
const INJECT_EXTERNAL_RUNTIME_CORE_PLUGIN = "@module-federation/vite/injectExternalRuntimeCorePlugin";
|
|
12506
12550
|
function isInjectExternalRuntimeCorePlugin(specifier) {
|
|
@@ -65,6 +65,13 @@ function resolveHashPlaceholderFileName(fileName) {
|
|
|
65
65
|
const normalized = fileName.replace(HASH_PLACEHOLDER_RE, "");
|
|
66
66
|
return hasFileExtension(normalized) ? normalized : `${normalized}.js`;
|
|
67
67
|
}
|
|
68
|
+
const VITE_ID_PREFIX = "/@id/";
|
|
69
|
+
const VITE_NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
70
|
+
function decodeViteId(id) {
|
|
71
|
+
if (!id.startsWith("/@id/")) return id;
|
|
72
|
+
const viteId = id.slice(5);
|
|
73
|
+
return viteId.startsWith("__x00__") ? `\0${viteId.slice(7)}` : viteId;
|
|
74
|
+
}
|
|
68
75
|
//#endregion
|
|
69
76
|
//#region src/utils/codeRewriter.ts
|
|
70
77
|
const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -457,4 +464,4 @@ const moduleFederationConsole = {
|
|
|
457
464
|
const mfWarn = moduleFederationConsole.warn;
|
|
458
465
|
const mfError = moduleFederationConsole.error;
|
|
459
466
|
//#endregion
|
|
460
|
-
export { CodeRewriter as a,
|
|
467
|
+
export { CodeRewriter as a, VITE_ID_PREFIX as c, isAbsoluteUrl as d, isHttpUrl as f, resolveHashPlaceholderFileName as h, createCodePositionMap as i, VITE_NULL_BYTE_PLACEHOLDER as l, rebaseImport as m, mfError as n, createSourceMap as o, normalizePathForImport as p, mfWarn as r, EXTERNAL_URL_RE as s, createModuleFederationError as t, decodeViteId as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as isHttpUrl, n as mfError, p as normalizePathForImport, t as createModuleFederationError } from "./logger-Ckj1FMRH.js";
|
|
2
|
+
import { b as resolveImportPath, m as hasPackageDependency, r as watchFileEvents } from "./dtsConstants-DIcz34LN.js";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import { normalizeOptions } from "@module-federation/sdk";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CodeRewriter,
|
|
1
|
+
import { a as CodeRewriter, f as isHttpUrl, i as createCodePositionMap, r as mfWarn, s as EXTERNAL_URL_RE, u as decodeViteId } from "./logger-Ckj1FMRH.js";
|
|
2
2
|
import { simpleJoinRemoteEntry } from "@module-federation/sdk";
|
|
3
3
|
//#region src/utils/fetchWithTimeout.ts
|
|
4
4
|
const DEFAULT_SSR_FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -225,7 +225,8 @@ async function resolveEsmSubpath(id, base) {
|
|
|
225
225
|
if (!existsSync(packageJson)) continue;
|
|
226
226
|
const { exports } = JSON.parse(readFileSync(packageJson, "utf8"));
|
|
227
227
|
const target = getEsmExportTarget(exports?.[subpath]);
|
|
228
|
-
|
|
228
|
+
const esmPath = target && join(dirname(packageJson), target);
|
|
229
|
+
return esmPath && existsSync(esmPath) ? esmPath : void 0;
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
/**
|
|
@@ -235,15 +236,17 @@ async function resolveEsmSubpath(id, base) {
|
|
|
235
236
|
*/
|
|
236
237
|
async function resolveSharedPath(id, resolvedShared) {
|
|
237
238
|
if (typeof id !== "string") return null;
|
|
238
|
-
const
|
|
239
|
+
const normalizedId = decodeViteId(id);
|
|
240
|
+
const matchedKey = findResolvedSharedKey(normalizedId, resolvedShared);
|
|
239
241
|
if (!matchedKey) return null;
|
|
240
242
|
const resolved = resolvedShared[matchedKey];
|
|
241
243
|
if (!resolved) return null;
|
|
242
|
-
if (
|
|
244
|
+
if (EXTERNAL_URL_RE.test(resolved)) return resolved;
|
|
245
|
+
if (matchedKey === normalizedId) return await resolveEsmSubpath(normalizedId, resolved).catch(() => void 0) ?? resolved;
|
|
243
246
|
const { createRequire } = await _module();
|
|
244
247
|
const { join } = await _path();
|
|
245
248
|
for (const base of [resolved, join(process.cwd(), "noop.js")]) try {
|
|
246
|
-
return await resolveEsmSubpath(
|
|
249
|
+
return await resolveEsmSubpath(normalizedId, base).catch(() => void 0) ?? createRequire(base).resolve(normalizedId);
|
|
247
250
|
} catch {}
|
|
248
251
|
return null;
|
|
249
252
|
}
|
|
@@ -789,14 +792,14 @@ function findSsrModuleSpecifiers(code) {
|
|
|
789
792
|
function isNodeModuleSpecifier(specifier) {
|
|
790
793
|
return specifier === "node:module" || specifier === "module";
|
|
791
794
|
}
|
|
792
|
-
function transformSsrCode(code, base, specifiers,
|
|
795
|
+
function transformSsrCode(code, base, specifiers, sharedImports, requireShimUrl, tempFileUrlMap) {
|
|
793
796
|
const rewriter = new CodeRewriter(code);
|
|
794
797
|
for (const { start, end, value } of specifiers) {
|
|
795
798
|
if (requireShimUrl && isNodeModuleSpecifier(value)) {
|
|
796
799
|
rewriter.overwrite(start, end, `"${requireShimUrl}"`);
|
|
797
800
|
continue;
|
|
798
801
|
}
|
|
799
|
-
const resolvedShared =
|
|
802
|
+
const resolvedShared = sharedImports?.get(value);
|
|
800
803
|
const relativeUrl = isRelativeSpecifier(value) ? new URL(value, base).href : void 0;
|
|
801
804
|
const absoluteHttpUrl = isHttpUrl(value) ? value : void 0;
|
|
802
805
|
const httpUrl = relativeUrl ?? absoluteHttpUrl;
|
|
@@ -805,14 +808,17 @@ function transformSsrCode(code, base, specifiers, sharedPkgMap, requireShimUrl,
|
|
|
805
808
|
}
|
|
806
809
|
return neutralizeBrowserPreloadHelpers(rewriter.toString());
|
|
807
810
|
}
|
|
808
|
-
async function
|
|
811
|
+
async function resolveSharedImports(specifiers, sharedPkgMap) {
|
|
809
812
|
const uniqueSpecifiers = new Set(specifiers.map(({ value }) => value));
|
|
810
813
|
const resolvedShared = Object.fromEntries(sharedPkgMap);
|
|
814
|
+
const sharedImports = /* @__PURE__ */ new Map();
|
|
811
815
|
for (const specifier of uniqueSpecifiers) {
|
|
812
|
-
if (sharedPkgMap.has(specifier)) continue;
|
|
813
816
|
const resolved = await resolveSharedPath(specifier, resolvedShared);
|
|
814
|
-
if (resolved)
|
|
817
|
+
if (!resolved) continue;
|
|
818
|
+
sharedImports.set(specifier, resolved);
|
|
819
|
+
if (!sharedPkgMap.has(specifier)) sharedPkgMap.set(specifier, resolved);
|
|
815
820
|
}
|
|
821
|
+
return sharedImports;
|
|
816
822
|
}
|
|
817
823
|
function isVitePreloadHelperSpecifier(specifier) {
|
|
818
824
|
return specifier.includes("preload-helper");
|
|
@@ -870,9 +876,9 @@ async function fetchEsmToTempFile(url, graph) {
|
|
|
870
876
|
const tmpPath = await fetchEsmToTempFile(u, graph);
|
|
871
877
|
subMap.set(u, getTempFileImportUrl(tmpPath, versionKey));
|
|
872
878
|
}));
|
|
873
|
-
|
|
879
|
+
const sharedImports = sharedPkgMap && await resolveSharedImports(specifiers, sharedPkgMap);
|
|
874
880
|
const requireShimUrl = sharedPkgMap?.size && specifiers.some(({ value }) => isNodeModuleSpecifier(value)) ? await getRequireShimUrl(tmpDir, sharedPkgMap, contextKey) : void 0;
|
|
875
|
-
code = transformSsrCode(code, base, specifiers,
|
|
881
|
+
code = transformSsrCode(code, base, specifiers, sharedImports, requireShimUrl, subMap);
|
|
876
882
|
const { writeFileSync } = await _fs();
|
|
877
883
|
writeFileSync(tmpFile, code, "utf8");
|
|
878
884
|
return tmpFile;
|
|
@@ -916,7 +922,7 @@ async function importTempModule(filePath, versionKey) {
|
|
|
916
922
|
}
|
|
917
923
|
let warnedVmUnavailable = false;
|
|
918
924
|
function getVmStrategyModule() {
|
|
919
|
-
if (!loaderState.vmStrategyModulePromise) loaderState.vmStrategyModulePromise = import("./ssrVmStrategy-
|
|
925
|
+
if (!loaderState.vmStrategyModulePromise) loaderState.vmStrategyModulePromise = import("./ssrVmStrategy-uJaUmHLS.js");
|
|
920
926
|
return loaderState.vmStrategyModulePromise;
|
|
921
927
|
}
|
|
922
928
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as findSharedKey } from "./sharedKeyMatcher-
|
|
3
|
-
import { d as readResponseTextBounded, i as resolveSharedPath, l as fetchWithTimeout, n as SsrEntryHttpError, r as neutralizeBrowserPreloadHelpers, u as getBodyPreview } from "./ssrEntryLoader
|
|
1
|
+
import { f as isHttpUrl, s as EXTERNAL_URL_RE } from "./logger-Ckj1FMRH.js";
|
|
2
|
+
import { t as findSharedKey } from "./sharedKeyMatcher-B5VKsEVQ.js";
|
|
3
|
+
import { d as readResponseTextBounded, i as resolveSharedPath, l as fetchWithTimeout, n as SsrEntryHttpError, r as neutralizeBrowserPreloadHelpers, u as getBodyPreview } from "./ssrEntryLoader--NkahIOF.js";
|
|
4
4
|
//#region src/utils/ssrVmStrategy.ts
|
|
5
5
|
/**
|
|
6
6
|
* vm.SourceTextModule strategy for loading remote SSR entries.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as revalidate, i as resolveSharedPath, n as SsrEntryHttpError, o as ssrEntryLoaderPlugin, r as neutralizeBrowserPreloadHelpers, t as SSR_ENTRY_LOADER_STATE_KEY } from "../ssrEntryLoader
|
|
1
|
+
import { a as revalidate, i as resolveSharedPath, n as SsrEntryHttpError, o as ssrEntryLoaderPlugin, r as neutralizeBrowserPreloadHelpers, t as SSR_ENTRY_LOADER_STATE_KEY } from "../ssrEntryLoader--NkahIOF.js";
|
|
2
2
|
export { SSR_ENTRY_LOADER_STATE_KEY, SsrEntryHttpError, ssrEntryLoaderPlugin as default, neutralizeBrowserPreloadHelpers, resolveSharedPath, revalidate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.9",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@module-federation/dts-plugin": "2.9.
|
|
81
|
-
"@module-federation/runtime": "2.9.
|
|
82
|
-
"@module-federation/sdk": "2.9.
|
|
80
|
+
"@module-federation/dts-plugin": "2.9.3",
|
|
81
|
+
"@module-federation/runtime": "2.9.3",
|
|
82
|
+
"@module-federation/sdk": "2.9.3"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@playwright/test": "1.62.0",
|