@module-federation/vite 1.21.5 → 1.22.0
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/README.md +25 -4
- package/lib/{buildPaths-BkaQHrd2.js → buildPaths-BoaQTkxt.js} +20 -1
- package/lib/{dtsConstants-BsaLBaaK.js → dtsConstants-BEGrtvcw.js} +21 -5
- package/lib/index.d.ts +25 -3
- package/lib/index.js +477 -213
- package/lib/{pluginDts-BhONN9dR.js → pluginDts-D7Faa4NJ.js} +9 -3
- package/lib/{ssrEntryLoader-CqtaiDUp.js → ssrEntryLoader-CMVCDSsG.js} +48 -13
- package/lib/{ssrVmStrategy-D4KB-y3H.js → ssrVmStrategy-Cx9WlTsx.js} +15 -3
- package/lib/utils/ssrEntryLoader.js +1 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as normalizePathForImport, r as rebaseImport } from "./buildPaths-
|
|
2
|
-
import { a as getPackageDetectionCwd, c as getSharedCacheDescriptor, d as packageNameDecode, f as packageNameEncode, g as createModuleFederationError, h as sharedCacheHelperCode, i as getIsRolldown, l as hasPackageDependency, m as setPackageDetectionCwd, n as getInstalledPackageEntry, o as getPackageName, p as resolveImportPath, r as getInstalledPackageJson, s as getPackageNameFromNodeModulePath, u as isNuxtProjectRoot, v as mfWarn } from "./dtsConstants-
|
|
1
|
+
import { i as resolveHashPlaceholderFileName, n as normalizePathForImport, r as rebaseImport } from "./buildPaths-BoaQTkxt.js";
|
|
2
|
+
import { a as getPackageDetectionCwd, c as getSharedCacheDescriptor, d as packageNameDecode, f as packageNameEncode, g as createModuleFederationError, h as sharedCacheHelperCode, i as getIsRolldown, l as hasPackageDependency, m as setPackageDetectionCwd, n as getInstalledPackageEntry, o as getPackageName, p as resolveImportPath, r as getInstalledPackageJson, s as getPackageNameFromNodeModulePath, u as isNuxtProjectRoot, v as mfWarn } from "./dtsConstants-BEGrtvcw.js";
|
|
3
3
|
import { a as filterId, c as getCommonSharedSubpaths, d as isNodeModulePath, f as isNuxtClientBase, h as resolvePublicPath, i as ensureTrailingSlash, l as getMatchingNodeModuleSubpath, m as normalizeNodeModulePath, n as invalidateSharedKeyMatcher, o as getBasePath$1, p as isViteOptimizableEntry, r as matchesSharedSource, s as getCommonSharedSubpathFromNodeModulePath, t as findSharedKey, u as isAssetLikeImport } from "./sharedKeyMatcher-DiUzRVH1.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as fs$2 from "fs";
|
|
@@ -14,13 +14,23 @@ import * as fs$1 from "node:fs";
|
|
|
14
14
|
import { existsSync as existsSync$1, readFileSync as readFileSync$1 } from "node:fs";
|
|
15
15
|
import { pathToFileURL as pathToFileURL$1 } from "node:url";
|
|
16
16
|
import { isIPv6 } from "node:net";
|
|
17
|
+
//#region src/utils/regexEscape.ts
|
|
18
|
+
const REGEXP_SPECIAL_CHARS_RE = /[.*+?^${}()|[\]\\]/g;
|
|
19
|
+
/**
|
|
20
|
+
* Escape `value` so it matches literally when interpolated into a regex source.
|
|
21
|
+
*
|
|
22
|
+
* Federation interpolates user-controlled strings — package names, chunk file
|
|
23
|
+
* names, virtual module ids — into generated matchers. Those routinely contain
|
|
24
|
+
* `.`, `+`, `[` and `\`, which would otherwise change what the pattern matches.
|
|
25
|
+
*/
|
|
26
|
+
function escapeRegExp(value) {
|
|
27
|
+
return value.replace(REGEXP_SPECIAL_CHARS_RE, "\\$&");
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
17
30
|
//#region src/utils/bundleHelpers.ts
|
|
18
31
|
function isOutputChunk$1(chunk) {
|
|
19
32
|
return chunk.type === "chunk";
|
|
20
33
|
}
|
|
21
|
-
function escapeRegExp$2(value) {
|
|
22
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
23
|
-
}
|
|
24
34
|
/**
|
|
25
35
|
* Whether `code` references `name` as a whole identifier.
|
|
26
36
|
*
|
|
@@ -30,7 +40,7 @@ function escapeRegExp$2(value) {
|
|
|
30
40
|
* as "unused", which orphans a still-referenced import.
|
|
31
41
|
*/
|
|
32
42
|
function isIdentifierReferenced(name, code) {
|
|
33
|
-
return new RegExp(`(?<![$\\w])${escapeRegExp
|
|
43
|
+
return new RegExp(`(?<![$\\w])${escapeRegExp(name)}(?![$\\w])`).test(code);
|
|
34
44
|
}
|
|
35
45
|
function getProxyBaseName(fileName) {
|
|
36
46
|
return fileName.replace(/^.*\//, "").replace(/\.js$/, "").replace(/-[A-Za-z0-9_-]+$/, "");
|
|
@@ -40,10 +50,10 @@ function getProxyBaseName(fileName) {
|
|
|
40
50
|
* regex end-anchor, so the pattern would silently match nothing.
|
|
41
51
|
*/
|
|
42
52
|
function functionDeclarationRegExp(name) {
|
|
43
|
-
return new RegExp(`function\\s+${escapeRegExp
|
|
53
|
+
return new RegExp(`function\\s+${escapeRegExp(name)}\\s*\\(`);
|
|
44
54
|
}
|
|
45
55
|
function extractFunctionDeclaration(code, functionName) {
|
|
46
|
-
const funcRe = new RegExp(`function\\s+${escapeRegExp
|
|
56
|
+
const funcRe = new RegExp(`function\\s+${escapeRegExp(functionName)}\\s*\\([^)]*\\)\\s*\\{`);
|
|
47
57
|
const funcStart = code.search(funcRe);
|
|
48
58
|
if (funcStart < 0) return;
|
|
49
59
|
let depth = 0;
|
|
@@ -127,7 +137,7 @@ function rewriteEsmProxyConsumers(code, proxyChunks) {
|
|
|
127
137
|
const claimedLocals = /* @__PURE__ */ new Set();
|
|
128
138
|
for (const [proxyFileName, proxyInfo] of Array.from(proxyChunks.entries())) {
|
|
129
139
|
const proxyBaseName = getProxyBaseName(proxyFileName);
|
|
130
|
-
const importMatch = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']([^"']*${escapeRegExp
|
|
140
|
+
const importMatch = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']([^"']*${escapeRegExp(proxyBaseName)}[^"']*)["']\\s*;?`).exec(nextCode);
|
|
131
141
|
if (!importMatch) continue;
|
|
132
142
|
const fullImport = importMatch[0];
|
|
133
143
|
const bindings = importMatch[1].split(",").map((s) => {
|
|
@@ -184,7 +194,7 @@ function rewriteSystemProxyConsumers(code, systemProxyInfo) {
|
|
|
184
194
|
let nextCode = code;
|
|
185
195
|
for (const [proxyFileName, proxyInfo] of Array.from(systemProxyInfo.entries())) {
|
|
186
196
|
const proxyBaseName = getProxyBaseName(proxyFileName);
|
|
187
|
-
const depMatch = new RegExp(`["']([^"']*${escapeRegExp
|
|
197
|
+
const depMatch = new RegExp(`["']([^"']*${escapeRegExp(proxyBaseName)}[^"']*)["']`).exec(nextCode);
|
|
188
198
|
if (!depMatch) continue;
|
|
189
199
|
let setterIndex = 0;
|
|
190
200
|
const depListMatch = nextCode.match(/System\.register\(\[([\s\S]*?)\]/);
|
|
@@ -363,6 +373,38 @@ async function mapCodeToCodeWithSourcemap(code) {
|
|
|
363
373
|
};
|
|
364
374
|
}
|
|
365
375
|
//#endregion
|
|
376
|
+
//#region src/utils/remoteConsumerTarget.ts
|
|
377
|
+
function getPluginEnvironmentName(ctx) {
|
|
378
|
+
if (ctx == null || typeof ctx !== "object") return void 0;
|
|
379
|
+
const environment = ctx["environment"];
|
|
380
|
+
if (environment == null || typeof environment !== "object") return void 0;
|
|
381
|
+
const name = environment["name"];
|
|
382
|
+
return typeof name === "string" ? name : void 0;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Classify a plugin hook context's Vite environment. Environment names are
|
|
386
|
+
* user-defined, so Vite's `config.consumer` is the semantic role; fall back to
|
|
387
|
+
* the name only when it is missing (Vite 5–7). Returns `undefined` when the hook
|
|
388
|
+
* has no environment context at all.
|
|
389
|
+
*/
|
|
390
|
+
function resolveEnvironmentConsumerTarget(ctx) {
|
|
391
|
+
if (ctx == null || typeof ctx !== "object") return void 0;
|
|
392
|
+
const environment = ctx["environment"];
|
|
393
|
+
if (environment == null || typeof environment !== "object") return void 0;
|
|
394
|
+
const consumer = environment.config?.consumer;
|
|
395
|
+
if (consumer === "client" || consumer === "server") return consumer;
|
|
396
|
+
const envName = getPluginEnvironmentName(ctx);
|
|
397
|
+
return !envName || envName === "client" ? "client" : "server";
|
|
398
|
+
}
|
|
399
|
+
/** Vite 5–7 hooks have no environment context and keep their client build behavior. */
|
|
400
|
+
function isClientEnvironment(ctx) {
|
|
401
|
+
return resolveEnvironmentConsumerTarget(ctx) !== "server";
|
|
402
|
+
}
|
|
403
|
+
function resolveRemoteConsumer(ctx, hasMultiEnvironment) {
|
|
404
|
+
if (!hasMultiEnvironment) return "unified";
|
|
405
|
+
return resolveEnvironmentConsumerTarget(ctx) ?? "client";
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
366
408
|
//#region src/utils/codePositionMap.ts
|
|
367
409
|
const REGEX_PREFIX_KEYWORDS = /* @__PURE__ */ new Set([
|
|
368
410
|
"await",
|
|
@@ -877,6 +919,11 @@ function normalizeExperiments(experiments) {
|
|
|
877
919
|
ssrMode: experiments?.ssrMode === "ISLAND" ? "ISLAND" : void 0
|
|
878
920
|
};
|
|
879
921
|
}
|
|
922
|
+
function normalizeSsrEntryLoader(ssrEntryLoader) {
|
|
923
|
+
const strategy = ssrEntryLoader?.strategy;
|
|
924
|
+
if (strategy !== "temp-file" && strategy !== "vm") return void 0;
|
|
925
|
+
return { strategy };
|
|
926
|
+
}
|
|
880
927
|
let config;
|
|
881
928
|
let explicitSharedKeys = /* @__PURE__ */ new Set();
|
|
882
929
|
const explicitSharedKeysByOptions = /* @__PURE__ */ new WeakMap();
|
|
@@ -895,6 +942,18 @@ function resolveRuntimeImplementation() {
|
|
|
895
942
|
function getNormalizeModuleFederationOptions() {
|
|
896
943
|
return config;
|
|
897
944
|
}
|
|
945
|
+
function hasRemotes(options = getNormalizeModuleFederationOptions()) {
|
|
946
|
+
return Object.keys(options.remotes || {}).length > 0;
|
|
947
|
+
}
|
|
948
|
+
function isRemoteContainer(options = getNormalizeModuleFederationOptions()) {
|
|
949
|
+
return Object.keys(options.exposes || {}).length > 0;
|
|
950
|
+
}
|
|
951
|
+
function isRemoteOnlyContainer(options = getNormalizeModuleFederationOptions()) {
|
|
952
|
+
return isRemoteContainer(options) && !hasRemotes(options);
|
|
953
|
+
}
|
|
954
|
+
function isLocalOnlyContainer(options = getNormalizeModuleFederationOptions()) {
|
|
955
|
+
return !isRemoteContainer(options) && !hasRemotes(options);
|
|
956
|
+
}
|
|
898
957
|
function isExplicitSharedKey(key, options) {
|
|
899
958
|
return (options ? explicitSharedKeysByOptions.get(options) : explicitSharedKeys)?.has(key) ?? false;
|
|
900
959
|
}
|
|
@@ -935,12 +994,13 @@ function normalizeModuleFederationOptions(options) {
|
|
|
935
994
|
varFilename: options.varFilename,
|
|
936
995
|
target: options.target,
|
|
937
996
|
ssrExternals: options.ssrExternals,
|
|
997
|
+
ssrEntryLoader: normalizeSsrEntryLoader(options.ssrEntryLoader),
|
|
938
998
|
disableRemote: options.disableRemote,
|
|
939
999
|
disableShared: options.disableShared,
|
|
940
1000
|
disableSnapshot: options.disableSnapshot,
|
|
941
1001
|
experiments: normalizeExperiments(options.experiments)
|
|
942
1002
|
};
|
|
943
|
-
if (normalized.experiments.ssrMode === "ISLAND" && Object.
|
|
1003
|
+
if (normalized.experiments.ssrMode === "ISLAND" && Object.hasOwn(normalized.shared, "react")) mfWarn("Island expose generation is disabled because experiments.ssrMode is \"ISLAND\" and React is configured as shared. Remove \"react\" from shared to generate island exposes, or remove ssrMode to use standard shared rendering.");
|
|
944
1004
|
explicitSharedKeysByOptions.set(normalized, new Set(explicitSharedKeys));
|
|
945
1005
|
return config = normalized;
|
|
946
1006
|
}
|
|
@@ -958,11 +1018,8 @@ const idCacheMap = {};
|
|
|
958
1018
|
const VITE_ID_PREFIX = "/@id/";
|
|
959
1019
|
const VITE_ENCODED_NULL_BYTE_PREFIX = `${VITE_ID_PREFIX}__x00__`;
|
|
960
1020
|
const MF_OWNER_INFIX = "__mf_owner__";
|
|
961
|
-
function escapeRegExp$1(value) {
|
|
962
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
963
|
-
}
|
|
964
1021
|
function createViteEncodedIdPrefixRegExp(sourcePrefix = "") {
|
|
965
|
-
return new RegExp(`^(?:${escapeRegExp
|
|
1022
|
+
return new RegExp(`^(?:${escapeRegExp(VITE_ENCODED_NULL_BYTE_PREFIX)})?${sourcePrefix}`);
|
|
966
1023
|
}
|
|
967
1024
|
function toViteEncodedId(id) {
|
|
968
1025
|
return `${VITE_ENCODED_NULL_BYTE_PREFIX}${id}`;
|
|
@@ -1015,11 +1072,14 @@ var VirtualModule = class VirtualModule {
|
|
|
1015
1072
|
cacheMap[this.tag][this.name] = this;
|
|
1016
1073
|
}
|
|
1017
1074
|
getImportId() {
|
|
1018
|
-
const
|
|
1075
|
+
const mfName = this.scopeName ?? getNormalizeModuleFederationOptions().internalName;
|
|
1076
|
+
const importIdKey = `${mfName}${this.tag}${this.name}${this.tag}`;
|
|
1019
1077
|
if (this.importId && this.importIdKey === importIdKey) return this.importId;
|
|
1020
1078
|
if (this.importId) delete idCacheMap[this.importId];
|
|
1021
1079
|
this.importIdKey = importIdKey;
|
|
1022
|
-
|
|
1080
|
+
const namePart = packageNameEncode(this.name);
|
|
1081
|
+
const mfNamePart = packageNameEncode(mfName);
|
|
1082
|
+
this.importId = `virtual:mf:${mfNamePart}${this.tag}${namePart}${this.tag}${this.suffix}`;
|
|
1023
1083
|
idCacheMap[this.importId] = this;
|
|
1024
1084
|
return this.importId;
|
|
1025
1085
|
}
|
|
@@ -1103,7 +1163,7 @@ function serializeRuntimeOptions(options) {
|
|
|
1103
1163
|
if (val instanceof Map) return `new Map([${Array.from(val.entries()).map(([k, v]) => `[${valueToCode(k)}, ${valueToCode(v)}]`).join(", ")}])`;
|
|
1104
1164
|
if (val instanceof Set) return `new Set([${Array.from(val.values()).map(valueToCode).join(", ")}])`;
|
|
1105
1165
|
const properties = [];
|
|
1106
|
-
for (const key in val) if (Object.
|
|
1166
|
+
for (const key in val) if (Object.hasOwn(val, key)) properties.push(`${toSafeJsLiteral(key)}: ${valueToCode(val[key])}`);
|
|
1107
1167
|
return `{${properties.join(", ")}}`;
|
|
1108
1168
|
} finally {
|
|
1109
1169
|
ancestors.delete(val);
|
|
@@ -1112,7 +1172,7 @@ function serializeRuntimeOptions(options) {
|
|
|
1112
1172
|
return toSafeJsLiteral(String(val));
|
|
1113
1173
|
}
|
|
1114
1174
|
const topLevelProps = [];
|
|
1115
|
-
for (const key in options) if (Object.
|
|
1175
|
+
for (const key in options) if (Object.hasOwn(options, key)) topLevelProps.push(`${toSafeJsLiteral(key)}: ${valueToCode(options[key])}`);
|
|
1116
1176
|
return `{${topLevelProps.join(", ")}}`;
|
|
1117
1177
|
}
|
|
1118
1178
|
const NATIVE_FUNCTION_SOURCE = /\{\s*\[native code\]\s*\}\s*$/;
|
|
@@ -1223,7 +1283,7 @@ function isReactComponentFile(filePath, seen = /* @__PURE__ */ new Set()) {
|
|
|
1223
1283
|
*/
|
|
1224
1284
|
function getReactIslandExposes(options, root) {
|
|
1225
1285
|
if (options.experiments.ssrMode !== "ISLAND") return /* @__PURE__ */ new Set();
|
|
1226
|
-
if (Object.
|
|
1286
|
+
if (Object.hasOwn(options.shared, "react")) return /* @__PURE__ */ new Set();
|
|
1227
1287
|
const islandExposes = /* @__PURE__ */ new Set();
|
|
1228
1288
|
for (const [key, expose] of Object.entries(options.exposes)) {
|
|
1229
1289
|
const sourceFile = resolveSourceFile(expose.import, root);
|
|
@@ -2184,8 +2244,12 @@ function getPackageEsmEntryPath(pkg) {
|
|
|
2184
2244
|
}
|
|
2185
2245
|
const packageNamedExportsCache = /* @__PURE__ */ new Map();
|
|
2186
2246
|
const sharedExportInspectionCache = /* @__PURE__ */ new Map();
|
|
2247
|
+
const sharedMutableExportsCache = /* @__PURE__ */ new Map();
|
|
2187
2248
|
function invalidateSharedExportInspectionCache(filePath) {
|
|
2188
|
-
if (!/(?:^|[/\\])node_modules(?:[/\\]|$)/.test(filePath))
|
|
2249
|
+
if (!/(?:^|[/\\])node_modules(?:[/\\]|$)/.test(filePath)) {
|
|
2250
|
+
sharedExportInspectionCache.clear();
|
|
2251
|
+
sharedMutableExportsCache.clear();
|
|
2252
|
+
}
|
|
2189
2253
|
}
|
|
2190
2254
|
const DEFAULT_SHARED_EXPORT_CONDITIONS = [
|
|
2191
2255
|
"browser",
|
|
@@ -2271,7 +2335,7 @@ function getMutableExportsFromFile(entryPath, exportConditions = DEFAULT_SHARED_
|
|
|
2271
2335
|
if (isValidEsmExportName(exported) && (mutableBindings.has(local) || reExportedMutable.has(local))) mutableExports.add(exported);
|
|
2272
2336
|
}
|
|
2273
2337
|
}
|
|
2274
|
-
const starExportRegex = /export\s
|
|
2338
|
+
const starExportRegex = /export\s*\*\s*from\s*['"]([^'"]+)['"]/g;
|
|
2275
2339
|
while ((match = starExportRegex.exec(source)) !== null) {
|
|
2276
2340
|
if (!codePositions[match.index]) continue;
|
|
2277
2341
|
const resolved = resolveReExportModule(entryPath, match[1], exportConditions);
|
|
@@ -2286,10 +2350,18 @@ function getMutableExportsFromFile(entryPath, exportConditions = DEFAULT_SHARED_
|
|
|
2286
2350
|
}
|
|
2287
2351
|
function getSharedMutableExports(pkg, shareItem, exportConditions = DEFAULT_SHARED_EXPORT_CONDITIONS) {
|
|
2288
2352
|
const configuredImport = shareItem?.shareConfig.import;
|
|
2289
|
-
|
|
2353
|
+
const entryPath = typeof configuredImport === "string" ? resolveConfiguredImportPath(configuredImport, exportConditions) : getInstalledPackageEntry(pkg, {
|
|
2290
2354
|
conditions: exportConditions,
|
|
2291
2355
|
resolveSubpathWithRequire: false
|
|
2292
|
-
})
|
|
2356
|
+
});
|
|
2357
|
+
if (!entryPath) return [];
|
|
2358
|
+
const cacheKey = `${entryPath}\0${exportConditions.join("\0")}`;
|
|
2359
|
+
let mutableExports = sharedMutableExportsCache.get(cacheKey);
|
|
2360
|
+
if (!mutableExports) {
|
|
2361
|
+
mutableExports = getMutableExportsFromFile(entryPath, exportConditions);
|
|
2362
|
+
sharedMutableExportsCache.set(cacheKey, mutableExports);
|
|
2363
|
+
}
|
|
2364
|
+
return mutableExports;
|
|
2293
2365
|
}
|
|
2294
2366
|
function resolveConfiguredImportPath(importSource, exportConditions = DEFAULT_SHARED_EXPORT_CONDITIONS) {
|
|
2295
2367
|
if (path$1.isAbsolute(importSource)) return resolveFileLikeModule(importSource);
|
|
@@ -2602,15 +2674,15 @@ function getNamedExportsViaRegex(source, filePath, visited, scanState = { comple
|
|
|
2602
2674
|
else if (name === "default" || name === "__esModule") {} else scanState.complete = false;
|
|
2603
2675
|
}
|
|
2604
2676
|
}
|
|
2605
|
-
const namespaceReExportRegex = new RegExp(`export\\s
|
|
2677
|
+
const namespaceReExportRegex = new RegExp(`export\\s*\\*\\s*as\\s+(${JS_IDENTIFIER_PATTERN})\\s*from\\s*['"][^'"]+['"]`, "gu");
|
|
2606
2678
|
while ((match = namespaceReExportRegex.exec(source)) !== null) {
|
|
2607
2679
|
if (!codePositions[match.index]) continue;
|
|
2608
2680
|
recognizedExportStarts.add(match.index);
|
|
2609
2681
|
if (isValidEsmExportName(match[1])) names.add(match[1]);
|
|
2610
2682
|
}
|
|
2611
|
-
if (hasCodeMatch(source, /export\s
|
|
2683
|
+
if (hasCodeMatch(source, /export\s*\*\s*as\s*['"]/g, codePositions)) scanState.complete = false;
|
|
2612
2684
|
if (filePath) {
|
|
2613
|
-
const starExportRegex = /export\s
|
|
2685
|
+
const starExportRegex = /export\s*\*\s*from\s*['"]([^'"]+)['"]/g;
|
|
2614
2686
|
while ((match = starExportRegex.exec(source)) !== null) {
|
|
2615
2687
|
if (!codePositions[match.index]) continue;
|
|
2616
2688
|
recognizedExportStarts.add(match.index);
|
|
@@ -2845,12 +2917,6 @@ function isSharedSingletonConsumedByPeer(pkg, options = getNormalizeModuleFedera
|
|
|
2845
2917
|
};
|
|
2846
2918
|
return Array.from(sharedKeyByPackageName.values()).some((sharedPkg) => sharedPkg !== pkg && reachesPkg(sharedPkg, /* @__PURE__ */ new Set([sharedPkg])));
|
|
2847
2919
|
}
|
|
2848
|
-
function isRemoteOnlyContainer(options = getNormalizeModuleFederationOptions()) {
|
|
2849
|
-
return Object.keys(options.exposes || {}).length > 0 && Object.keys(options.remotes || {}).length === 0;
|
|
2850
|
-
}
|
|
2851
|
-
function isLocalOnlyContainer(options = getNormalizeModuleFederationOptions()) {
|
|
2852
|
-
return Object.keys(options.exposes || {}).length === 0 && Object.keys(options.remotes || {}).length === 0;
|
|
2853
|
-
}
|
|
2854
2920
|
function tryResolveImportFromPackageRoot(pkg, root) {
|
|
2855
2921
|
try {
|
|
2856
2922
|
return resolveWorkspaceEsmEntry(pkg, createRequire$1(pathToFileURL(path$1.join(root, "package.json"))).resolve(pkg), root);
|
|
@@ -3371,11 +3437,10 @@ function writeLoadShareModule(pkg, shareItem, command, _isRolldown, options, exp
|
|
|
3371
3437
|
const liveNamedExportLine = liveNamedExports.length ? `export { ${liveNamedExports.join(", ")} } from ${escapeGeneratedStringLiteral(sharedImportSource)};` : "";
|
|
3372
3438
|
const hasCompleteExportCoverage = detectedNamedExports !== void 0;
|
|
3373
3439
|
const isWorkspaceSingleton = isWorkspacePackage && shareItem.shareConfig.singleton === true;
|
|
3374
|
-
const
|
|
3375
|
-
const usesDeferredSingletonFallback = hasCompleteExportCoverage && shareItem.shareConfig.eager !== true && (isWorkspacePackage || command !== "build" && isRemoteOnlyContainer(resolvedOptions) && shareItem.shareConfig.singleton === true || command === "build" && isRemoteOnlyContainer(resolvedOptions) && (shareItem.shareConfig.singleton === true || isDefaultShareScope) && !isSharedSingletonConsumedByPeer(pkg, resolvedOptions, true));
|
|
3440
|
+
const usesDeferredSingletonFallback = hasCompleteExportCoverage && shareItem.shareConfig.eager !== true && (isWorkspacePackage || command !== "build" && isRemoteOnlyContainer(resolvedOptions) && shareItem.shareConfig.singleton === true || command === "build" && isRemoteContainer(resolvedOptions) && !isSharedSingletonConsumedByPeer(pkg, resolvedOptions, true));
|
|
3376
3441
|
const servesRemoteSingletonFallback = command !== "build" && isRemoteOnlyContainer(resolvedOptions) && shareItem.shareConfig.singleton === true;
|
|
3377
3442
|
const isConsumedByPeerSingleton = isSharedSingletonConsumedByPeer(pkg, resolvedOptions);
|
|
3378
|
-
const usesEntryInjectedRemoteFallback = hasCompleteExportCoverage && !isWorkspaceSingleton &&
|
|
3443
|
+
const usesEntryInjectedRemoteFallback = hasCompleteExportCoverage && !isWorkspaceSingleton && isRemoteContainer(resolvedOptions) && shareItem.shareConfig.singleton === true && resolvedOptions.hostInitInjectLocation === "entry" && (command === "build" || isConsumedByPeerSingleton);
|
|
3379
3444
|
const usesEagerWorkspaceFallback = hasCompleteExportCoverage && isWorkspaceSingleton && !servesRemoteSingletonFallback && (isConsumedByPeerSingleton || shareItem.shareConfig.eager === true);
|
|
3380
3445
|
const usesDeferredTreeShakingFallback = hasCompleteExportCoverage && Boolean(treeShakingConsumer);
|
|
3381
3446
|
const reactMixedModeGuard = pkg === "react" ? createReactMixedModeRuntimeGuard() : "";
|
|
@@ -3559,6 +3624,7 @@ function generateLocalSharedImportMap(options) {
|
|
|
3559
3624
|
const useDirectReactImport = shouldUseDirectReactImport();
|
|
3560
3625
|
const orderedShares = getOrderedUsedShares(options);
|
|
3561
3626
|
const sharesToMaterialize = new Set(getMaterializedShares(options));
|
|
3627
|
+
const hasConsumeOnlyShare = orderedShares.some((pkg) => getNormalizeShareItem(pkg, resolvedOptions)?.shareConfig.import === false);
|
|
3562
3628
|
return `
|
|
3563
3629
|
import {loadShare} from "@module-federation/runtime";
|
|
3564
3630
|
${orderedShares.map((pkg, index) => {
|
|
@@ -3567,12 +3633,47 @@ function generateLocalSharedImportMap(options) {
|
|
|
3567
3633
|
return `import * as __mfEagerShare_${index} from ${toSafeJsLiteral(getLocalSharedPackagePath(pkg, shareItem, options))};`;
|
|
3568
3634
|
}).filter(Boolean).join("\n")}
|
|
3569
3635
|
${normalizeRuntimeShareCode}
|
|
3636
|
+
const __mfGetCachedReactFamily = (keys, reactKeys, localVersion, requiredExport) => {
|
|
3637
|
+
const cache = globalThis.__mf_module_cache__?.share;
|
|
3638
|
+
const react = reactKeys.map((key) => cache?.[key]).find((value) => value !== undefined);
|
|
3639
|
+
const reactVersion = react?.version ?? react?.default?.version;
|
|
3640
|
+
const actual = String(reactVersion || '').split(/[^0-9]+/).map(Number);
|
|
3641
|
+
const expected = String(localVersion || '').split(/[^0-9]+/).map(Number);
|
|
3642
|
+
for (let index = 0; index < Math.max(actual.length, expected.length); index++) {
|
|
3643
|
+
if ((actual[index] || 0) < (expected[index] || 0)) return undefined;
|
|
3644
|
+
if ((actual[index] || 0) > (expected[index] || 0)) break;
|
|
3645
|
+
}
|
|
3646
|
+
for (const key of keys) {
|
|
3647
|
+
const cached = cache?.[key];
|
|
3648
|
+
if (cached === undefined) continue;
|
|
3649
|
+
if (!requiredExport || typeof cached?.[requiredExport] === 'function' || typeof cached?.default?.[requiredExport] === 'function') return cached;
|
|
3650
|
+
}
|
|
3651
|
+
return undefined;
|
|
3652
|
+
};
|
|
3653
|
+
${hasConsumeOnlyShare ? `// A consume-only share has no local module: its entry is the same shape for every key, so one helper builds it instead of a literal per key
|
|
3654
|
+
const __mfHostOnly = (name) => async () => {
|
|
3655
|
+
throw new Error(\`[Module Federation] Shared module '\${name}' must be provided by host\`);
|
|
3656
|
+
};
|
|
3657
|
+
const __mfConsumeOnly = (name, version, scope, materialize, shareConfig) => ({
|
|
3658
|
+
name,
|
|
3659
|
+
version,
|
|
3660
|
+
scope: [scope],
|
|
3661
|
+
loaded: false,
|
|
3662
|
+
materialize,
|
|
3663
|
+
eager: shareConfig.eager,
|
|
3664
|
+
from: ${toSafeJsLiteral(resolvedOptions.name)},
|
|
3665
|
+
canLiveRebind: true,
|
|
3666
|
+
get: __mfHostOnly(name),
|
|
3667
|
+
shareConfig: { ...shareConfig, import: false },
|
|
3668
|
+
});` : ""}
|
|
3570
3669
|
const importMap = {
|
|
3571
3670
|
${orderedShares.map((pkg, index) => {
|
|
3572
3671
|
const shareItem = getNormalizeShareItem(pkg, resolvedOptions);
|
|
3672
|
+
if (shareItem?.shareConfig.import === false) return `
|
|
3673
|
+
${toSafeJsLiteral(pkg)}: __mfHostOnly(${toSafeJsLiteral(pkg)})`;
|
|
3573
3674
|
return `
|
|
3574
3675
|
${toSafeJsLiteral(pkg)}: async () => {
|
|
3575
|
-
${shareItem?.shareConfig.
|
|
3676
|
+
${shareItem?.shareConfig.eager ? `let pkg = __mfEagerShare_${index};
|
|
3576
3677
|
return pkg;` : `let pkg = await import(${toSafeJsLiteral(getLocalSharedPackagePath(pkg, shareItem, options))});
|
|
3577
3678
|
return pkg;`}
|
|
3578
3679
|
}
|
|
@@ -3583,9 +3684,20 @@ function generateLocalSharedImportMap(options) {
|
|
|
3583
3684
|
${orderedShares.map((key) => {
|
|
3584
3685
|
const shareItem = getNormalizeShareItem(key, resolvedOptions);
|
|
3585
3686
|
if (!shareItem) return null;
|
|
3687
|
+
const isReactFamily = key.startsWith("react/") || key === "react-dom/client";
|
|
3688
|
+
const cacheKeys = [key, ...key === "react-dom/client" ? ["react-dom"] : []].flatMap((pkg) => {
|
|
3689
|
+
const descriptor = getSharedCacheDescriptor(pkg, shareItem);
|
|
3690
|
+
return [descriptor.canonical, ...descriptor.aliases ?? []];
|
|
3691
|
+
});
|
|
3692
|
+
const reactCacheKeys = ["react"].flatMap((pkg) => {
|
|
3693
|
+
const descriptor = getSharedCacheDescriptor(pkg, shareItem);
|
|
3694
|
+
return [descriptor.canonical, ...descriptor.aliases ?? []];
|
|
3695
|
+
});
|
|
3586
3696
|
const detectedNamedExports = getSharedNamedExports(key, shareItem);
|
|
3587
3697
|
const canLiveRebind = shareItem.shareConfig.import === false || detectedNamedExports !== void 0;
|
|
3588
3698
|
const treeShakingConfig = canLiveRebind ? shareItem.shareConfig.treeShaking : void 0;
|
|
3699
|
+
if (shareItem.shareConfig.import === false && !treeShakingConfig) return `
|
|
3700
|
+
${toSafeJsLiteral(key)}: __mfConsumeOnly(${toSafeJsLiteral(key)}, ${toSafeJsLiteral(shareItem.version)}, ${toSafeJsLiteral(shareItem.scope)}, ${sharesToMaterialize.has(key)}, {singleton: ${shareItem.shareConfig.singleton}, requiredVersion: ${toSafeJsLiteral(shareItem.shareConfig.requiredVersion)}, strictVersion: ${shareItem.shareConfig.strictVersion}, eager: ${Boolean(shareItem.shareConfig.eager)}})`;
|
|
3589
3701
|
const treeShakingUsage = treeShakingConfig ? getTreeShakingExportUsage(key, shareItem, shareItem.name, options) : void 0;
|
|
3590
3702
|
const treeShakingProviderExports = treeShakingUsage?.kind === "exports" ? treeShakingUsage.usedExports : [];
|
|
3591
3703
|
const treeShakingUsedExports = resolvedOptions.injectTreeShakingUsedExports === false ? treeShakingConfig?.usedExports || [] : treeShakingProviderExports;
|
|
@@ -3602,26 +3714,54 @@ function generateLocalSharedImportMap(options) {
|
|
|
3602
3714
|
eager: ${Boolean(shareItem.shareConfig.eager)},
|
|
3603
3715
|
from: ${toSafeJsLiteral(resolvedOptions.name)},
|
|
3604
3716
|
canLiveRebind: ${canLiveRebind},
|
|
3605
|
-
|
|
3717
|
+
get () {
|
|
3606
3718
|
if (${shareItem.shareConfig.import === false}) {
|
|
3607
3719
|
throw new Error(\`[Module Federation] Shared module '\${${toSafeJsLiteral(key)}}' must be provided by host\`);
|
|
3608
3720
|
}
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
const
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3721
|
+
// A webpack consumer built with eager: true calls get() synchronously and needs the
|
|
3722
|
+
// factory, not a promise: once the module is loaded, hand the same factory back directly,
|
|
3723
|
+
// and while it is loading hand every caller the same pending promise.
|
|
3724
|
+
const share = usedShared[${toSafeJsLiteral(key)}]
|
|
3725
|
+
if (share.lib) return share.lib
|
|
3726
|
+
if (share.loading) return share.loading
|
|
3727
|
+
const cachedSingleton = ${shareItem.shareConfig.singleton && isReactFamily}
|
|
3728
|
+
? __mfGetCachedReactFamily(
|
|
3729
|
+
${toSafeJsLiteral(cacheKeys)},
|
|
3730
|
+
${toSafeJsLiteral(reactCacheKeys)},
|
|
3731
|
+
${toSafeJsLiteral(shareItem.version)},
|
|
3732
|
+
${toSafeJsLiteral(key === "react-dom/client" ? "createRoot" : void 0)}
|
|
3733
|
+
)
|
|
3734
|
+
: undefined
|
|
3735
|
+
if (cachedSingleton !== undefined) {
|
|
3736
|
+
share.lib = function () { return cachedSingleton }
|
|
3737
|
+
share.loaded = true
|
|
3738
|
+
return share.lib
|
|
3624
3739
|
}
|
|
3740
|
+
share.loading = (async () => {
|
|
3741
|
+
try {
|
|
3742
|
+
const {${toSafeJsLiteral(key)}: pkgDynamicImport} = importMap
|
|
3743
|
+
const res = await pkgDynamicImport()
|
|
3744
|
+
const exportModule = ${toSafeJsLiteral(useDirectReactImport)} && ${toSafeJsLiteral(key)} === "react"
|
|
3745
|
+
? (res?.default ?? res)
|
|
3746
|
+
: __mfNormalizeRuntimeShare({...res})
|
|
3747
|
+
// All npm packages pre-built by vite will be converted to esm
|
|
3748
|
+
if (exportModule.__esModule !== true) {
|
|
3749
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3750
|
+
value: true,
|
|
3751
|
+
enumerable: false
|
|
3752
|
+
})
|
|
3753
|
+
}
|
|
3754
|
+
share.lib = function () {
|
|
3755
|
+
return exportModule
|
|
3756
|
+
}
|
|
3757
|
+
share.loaded = true
|
|
3758
|
+
return share.lib
|
|
3759
|
+
} finally {
|
|
3760
|
+
// A failed import must not pin the rejection: the next get() retries
|
|
3761
|
+
share.loading = undefined
|
|
3762
|
+
}
|
|
3763
|
+
})()
|
|
3764
|
+
return share.loading
|
|
3625
3765
|
},
|
|
3626
3766
|
shareConfig: {
|
|
3627
3767
|
singleton: ${shareItem.shareConfig.singleton},
|
|
@@ -3707,6 +3847,7 @@ function getMaterializedShares(options) {
|
|
|
3707
3847
|
const pending = [...shares];
|
|
3708
3848
|
while (pending.length) {
|
|
3709
3849
|
const pkg = pending.pop();
|
|
3850
|
+
const share = getNormalizeShareItem(pkg, resolvedOptions);
|
|
3710
3851
|
const packageName = getPackageName(pkg);
|
|
3711
3852
|
const packageJson = getInstalledPackageJson(pkg)?.packageJson ?? (pkg !== packageName ? getInstalledPackageJson(packageName)?.packageJson : void 0);
|
|
3712
3853
|
const dependencies = {
|
|
@@ -3716,7 +3857,8 @@ function getMaterializedShares(options) {
|
|
|
3716
3857
|
};
|
|
3717
3858
|
for (const dependency of Object.keys(dependencies)) {
|
|
3718
3859
|
const sharedDependency = configured.get(dependency);
|
|
3719
|
-
|
|
3860
|
+
const dependencyShare = sharedDependency ? getNormalizeShareItem(sharedDependency, resolvedOptions) : void 0;
|
|
3861
|
+
if (sharedDependency && !shares.has(sharedDependency) && dependencyShare?.scope === share?.scope) {
|
|
3720
3862
|
shares.add(sharedDependency);
|
|
3721
3863
|
pending.push(sharedDependency);
|
|
3722
3864
|
}
|
|
@@ -4045,10 +4187,26 @@ function generateRuntimeSharedCacheSeedCode(shareStrategy, options) {
|
|
|
4045
4187
|
);
|
|
4046
4188
|
return;
|
|
4047
4189
|
}
|
|
4048
|
-
const
|
|
4049
|
-
?
|
|
4190
|
+
const externalProvider = typeof __mfGetExternalSharedProvider === 'function'
|
|
4191
|
+
? __mfGetExternalSharedProvider(pkg, share)
|
|
4050
4192
|
: undefined;
|
|
4051
|
-
if (
|
|
4193
|
+
if (externalProvider) {
|
|
4194
|
+
let externalFactory = externalProvider.lib;
|
|
4195
|
+
if (!externalFactory && externalProvider.loading) externalFactory = await externalProvider.loading;
|
|
4196
|
+
if (!externalFactory && externalProvider.loaded && typeof externalProvider.get === 'function') {
|
|
4197
|
+
externalFactory = await externalProvider.get();
|
|
4198
|
+
}
|
|
4199
|
+
if (externalFactory) {
|
|
4200
|
+
const externalModule = typeof externalFactory === "function" ? externalFactory() : externalFactory;
|
|
4201
|
+
const externalResolved = await Promise.resolve(externalModule);
|
|
4202
|
+
${normalizeRuntimeShareCode}
|
|
4203
|
+
__mfWriteSharedCache(
|
|
4204
|
+
__mfModuleCache.share,
|
|
4205
|
+
cacheDescriptor,
|
|
4206
|
+
__mfNormalizeRuntimeShare(externalResolved),
|
|
4207
|
+
externalProvider.from
|
|
4208
|
+
);
|
|
4209
|
+
}
|
|
4052
4210
|
return;
|
|
4053
4211
|
}
|
|
4054
4212
|
const providerKey = cacheDescriptor.canonical;
|
|
@@ -4333,7 +4491,7 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
4333
4491
|
const needsSharedProviderSelectionHelper = Object.keys(options.shared ?? {}).length > 0;
|
|
4334
4492
|
const hasTreeShakingShared = Object.values(options.shared ?? {}).some((share) => !!share?.shareConfig.treeShaking);
|
|
4335
4493
|
const hasMultipleShareScopes = Array.isArray(options.shareScope);
|
|
4336
|
-
const guardHostAutoInit = command === "build" &&
|
|
4494
|
+
const guardHostAutoInit = command === "build" && isRemoteContainer(options) && hasRemotes(options);
|
|
4337
4495
|
const materializedShareBatches = toSafeJsLiteral(getShareBatches(options, false));
|
|
4338
4496
|
const runtimeImports = [
|
|
4339
4497
|
"init as runtimeInit",
|
|
@@ -4388,6 +4546,7 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
4388
4546
|
import {${runtimeImports}} from "@module-federation/runtime";
|
|
4389
4547
|
${runtimeHelperImports.length ? `import {${runtimeHelperImports.join(", ")}} from "@module-federation/runtime/helpers";` : ""}
|
|
4390
4548
|
${pluginImportNames.filter((item) => !isSsrOnlyPlugin(item[1])).map((item) => item[1]).join("\n")}
|
|
4549
|
+
import __mfExposesMap from "${virtualExposesId}"
|
|
4391
4550
|
${command === "build" ? getRuntimeInitResolveBootstrapCode(false, getRuntimeInitStatusImportId(options)) : getRuntimeInitBootstrapCode(false, getRuntimeInitStatusImportId(options), void 0, void 0, exportConditions) + "\n const { initResolve } = globalThis[globalKey];"}
|
|
4392
4551
|
${getRuntimeModuleCacheBootstrapCode(exportConditions)}
|
|
4393
4552
|
const initTokens = {}
|
|
@@ -4396,7 +4555,6 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
4396
4555
|
const mfName = ${toSafeJsLiteral(options.name)}
|
|
4397
4556
|
const __mfMaterializedShareBatches = ${materializedShareBatches}
|
|
4398
4557
|
let localSharedImportMapPromise
|
|
4399
|
-
let exposesMapPromise
|
|
4400
4558
|
let __mfLateBridgeShared
|
|
4401
4559
|
const shouldRetrySharedInitError = ${command !== "build"} && ((error) => {
|
|
4402
4560
|
const message = String((error && error.message) || error || '');
|
|
@@ -4430,17 +4588,12 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
4430
4588
|
}
|
|
4431
4589
|
|
|
4432
4590
|
async function getExposesMap() {
|
|
4433
|
-
|
|
4434
|
-
exposesMapPromise = retrySharedInit(() => import("${virtualExposesId}"))
|
|
4435
|
-
.then((mod) => mod.default ?? mod)
|
|
4436
|
-
.catch((e) => { exposesMapPromise = undefined; throw e; });
|
|
4437
|
-
}
|
|
4438
|
-
return exposesMapPromise
|
|
4591
|
+
return __mfExposesMap
|
|
4439
4592
|
}
|
|
4440
4593
|
|
|
4441
|
-
async function init(shared = {}, initScope = []) {
|
|
4594
|
+
async function init(shared = {}, initScope = [], remoteEntryInitOptions = {}) {
|
|
4442
4595
|
${sharedCacheHelperCode}
|
|
4443
|
-
const getShareScope = (scopeName) => ${hasMultipleShareScopes} ? (shared?.[scopeName] || {}) : shared;
|
|
4596
|
+
const getShareScope = (scopeName) => remoteEntryInitOptions.shareScopeMap?.[scopeName] ?? (${hasMultipleShareScopes} ? (shared?.[scopeName] || {}) : shared);
|
|
4444
4597
|
const getShareScopeNames = (share) => {
|
|
4445
4598
|
const configuredScopes = Array.isArray(share?.scope) ? share.scope : [share?.scope || shareScopeName];
|
|
4446
4599
|
if (!${hasMultipleShareScopes}) return configuredScopes;
|
|
@@ -4551,29 +4704,33 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
4551
4704
|
const parts = pkg.split('/');
|
|
4552
4705
|
return pkg.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
|
|
4553
4706
|
};
|
|
4554
|
-
const
|
|
4707
|
+
const __mfGetExternalSharedProvider = (pkg, share, versionMap, includePackage) => {
|
|
4555
4708
|
if (typeof __mfSelectExternalSharedProvider !== 'function') return undefined;
|
|
4556
4709
|
const packageName = __mfGetSharePackageName(pkg);
|
|
4557
|
-
const candidates = packageName === pkg
|
|
4710
|
+
const candidates = !includePackage || packageName === pkg
|
|
4558
4711
|
? [[pkg, share]]
|
|
4559
4712
|
: [[pkg, share], [packageName, usedShared[packageName]]];
|
|
4560
4713
|
for (const [candidatePkg, candidateShare] of candidates) {
|
|
4561
4714
|
if (!candidateShare) continue;
|
|
4562
4715
|
const candidateVersionMap = versionMap
|
|
4563
4716
|
? (candidatePkg === pkg ? versionMap : initialShared[candidatePkg])
|
|
4564
|
-
: ${hasMultipleShareScopes ? "getShareVersions(candidatePkg, candidateShare)" : "shared[candidatePkg]"};
|
|
4717
|
+
: (initialShared[candidatePkg] ?? ${hasMultipleShareScopes ? "getShareVersions(candidatePkg, candidateShare)" : "shared[candidatePkg]"});
|
|
4565
4718
|
const provider = __mfSelectExternalSharedProvider(
|
|
4566
4719
|
candidateVersionMap,
|
|
4567
4720
|
candidatePkg,
|
|
4568
4721
|
candidateShare,
|
|
4569
4722
|
'${options.shareStrategy}'
|
|
4570
4723
|
);
|
|
4571
|
-
if (provider
|
|
4572
|
-
return provider;
|
|
4573
|
-
}
|
|
4724
|
+
if (provider) return provider;
|
|
4574
4725
|
}
|
|
4575
4726
|
return undefined;
|
|
4576
4727
|
};
|
|
4728
|
+
const __mfGetPendingExternalSharedProvider = (pkg, share, versionMap) => {
|
|
4729
|
+
const provider = __mfGetExternalSharedProvider(pkg, share, versionMap, true);
|
|
4730
|
+
return provider && isWebpackProvider(provider) && !provider.lib && !provider.loaded
|
|
4731
|
+
? provider
|
|
4732
|
+
: undefined;
|
|
4733
|
+
};
|
|
4577
4734
|
// handling circular init calls before an external provider can re-enter this container
|
|
4578
4735
|
${hasMultipleShareScopes ? `const shareScopeNamesToInitialize = [];
|
|
4579
4736
|
for (const shareScopeName of shareScopeNames) {
|
|
@@ -5272,9 +5429,9 @@ function generateRemoteEntry(options, virtualExposesId = getVirtualExposesId(opt
|
|
|
5272
5429
|
return (exposesMap[moduleName])().then(res => () => res)
|
|
5273
5430
|
}
|
|
5274
5431
|
${guardHostAutoInit ? `let __mfInitPromise;
|
|
5275
|
-
function __mfGuardedInit(shared, initScope) {
|
|
5432
|
+
function __mfGuardedInit(shared, initScope, remoteEntryInitOptions) {
|
|
5276
5433
|
if (shared === undefined && __mfInitPromise) return __mfInitPromise;
|
|
5277
|
-
__mfInitPromise = init(shared, initScope);
|
|
5434
|
+
__mfInitPromise = init(shared, initScope, remoteEntryInitOptions);
|
|
5278
5435
|
return __mfInitPromise;
|
|
5279
5436
|
}
|
|
5280
5437
|
export { __mfGuardedInit as init, getExposes as get }` : `export { init, getExposes as get }`}
|
|
@@ -5324,6 +5481,12 @@ function generateHostAutoInitCode(remoteEntryImport, _command = "build", options
|
|
|
5324
5481
|
const {usedShared} = await import("${getLocalSharedImportMapPath(options)}");
|
|
5325
5482
|
${normalizeRuntimeShareCode}
|
|
5326
5483
|
${shouldPreloadShares ? `
|
|
5484
|
+
const __mfHasAlternativeSharedVersion = (pkg, share) =>
|
|
5485
|
+
(Array.isArray(share.scope) ? share.scope : [share.scope || 'default']).some(
|
|
5486
|
+
(scopeName) => Object.keys(runtime.shareScopeMap?.[scopeName]?.[pkg] || {}).some(
|
|
5487
|
+
(version) => version !== share.version
|
|
5488
|
+
)
|
|
5489
|
+
);
|
|
5327
5490
|
const __mfHostInitShareBatches = ${hostInitShareBatches};
|
|
5328
5491
|
for (const __mfHostInitShareBatch of __mfHostInitShareBatches) {
|
|
5329
5492
|
await Promise.all(__mfHostInitShareBatch.map(async (pkg) => {
|
|
@@ -5336,7 +5499,10 @@ function generateHostAutoInitCode(remoteEntryImport, _command = "build", options
|
|
|
5336
5499
|
const cacheDescriptor = __mfGetSharedCacheDescriptor(pkg, share.shareConfig?.singleton, share.version, share.scope);
|
|
5337
5500
|
if (
|
|
5338
5501
|
__mfReadSharedCache(__mfModuleCache.share, cacheDescriptor) !== undefined &&
|
|
5339
|
-
|
|
5502
|
+
${_command === "serve" ? `__mfReadSharedCacheOwner(__mfModuleCache.share, cacheDescriptor) !== undefined` : `(
|
|
5503
|
+
(!share.shareConfig?.singleton && __mfReadSharedCacheOwner(__mfModuleCache.share, cacheDescriptor) === ${cacheOwner}) ||
|
|
5504
|
+
(share.shareConfig?.singleton && !__mfHasAlternativeSharedVersion(pkg, share))
|
|
5505
|
+
)`}
|
|
5340
5506
|
) return;
|
|
5341
5507
|
// An import:false share has nothing to load until a foreign provider
|
|
5342
5508
|
// registers: its own stub getter throws by construction.
|
|
@@ -5431,8 +5597,10 @@ function getPendingSharesState(options) {
|
|
|
5431
5597
|
function generatePendingSharesCode(command = "build", options) {
|
|
5432
5598
|
const resolvedOptions = options ?? getNormalizeModuleFederationOptions();
|
|
5433
5599
|
const pendingShareImports = command === "build" ? getMaterializedShares(options).filter((pkg) => {
|
|
5434
|
-
const shareItem = resolvedOptions
|
|
5435
|
-
|
|
5600
|
+
const shareItem = getShareItemForPreload(pkg, resolvedOptions);
|
|
5601
|
+
if (!shareItem || pkg.endsWith("/")) return false;
|
|
5602
|
+
if (shareItem.shareConfig.eager) return false;
|
|
5603
|
+
return shareItem.shareConfig.import !== false && !shareItem.shareConfig.treeShaking;
|
|
5436
5604
|
}).map((pkg) => `[${toSafeJsLiteral(pkg)}, () => import(${toSafeJsLiteral(getLoadShareModulePath(pkg, false, options))})]`) : [];
|
|
5437
5605
|
return `
|
|
5438
5606
|
${getRuntimeModuleCacheBootstrapCode()}
|
|
@@ -5525,8 +5693,15 @@ function getScopedUsedRemotesMap(options) {
|
|
|
5525
5693
|
return scoped;
|
|
5526
5694
|
}
|
|
5527
5695
|
function recordUsedRemote(map, remoteKey, remoteModule) {
|
|
5696
|
+
ensureUsedRemoteKey(map, remoteKey).add(remoteModule);
|
|
5697
|
+
}
|
|
5698
|
+
function ensureUsedRemoteKey(map, remoteKey) {
|
|
5528
5699
|
if (!map[remoteKey]) map[remoteKey] = /* @__PURE__ */ new Set();
|
|
5529
|
-
map[remoteKey]
|
|
5700
|
+
return map[remoteKey];
|
|
5701
|
+
}
|
|
5702
|
+
function ensureUsedRemote(remoteKey, options) {
|
|
5703
|
+
ensureUsedRemoteKey(usedRemotesMap, remoteKey);
|
|
5704
|
+
if (options) ensureUsedRemoteKey(getScopedUsedRemotesMap(options), remoteKey);
|
|
5530
5705
|
}
|
|
5531
5706
|
function addUsedRemote(remoteKey, remoteModule, options) {
|
|
5532
5707
|
recordUsedRemote(usedRemotesMap, remoteKey, remoteModule);
|
|
@@ -5767,9 +5942,10 @@ function generateRemotes(id, command, enableSsrInit = false, consumer = "unified
|
|
|
5767
5942
|
const devRuntimeBootstrap = `${getRuntimeInitBootstrapCode(enableSsrInit, getRuntimeInitStatusImportId(options), ssrRemotes, hostAutoInitPath, exportConditions)}
|
|
5768
5943
|
const { initPromise, initResolve, initReject, moduleCache: __mfModuleCache } = globalThis[globalKey];`;
|
|
5769
5944
|
const importLine = command === "build" ? `${getRuntimeModuleCacheBootstrapCode(exportConditions)}
|
|
5770
|
-
|
|
5945
|
+
const __mfHostInitPromise = () => import(${JSON.stringify(hostAutoInitPath)})
|
|
5946
|
+
.then((mod) => mod.hostInitPromise);` : `${devRuntimeBootstrap}
|
|
5771
5947
|
${command === "serve" && consumer !== "server" ? browserHostInitCode : ""}`;
|
|
5772
|
-
const remoteLoadRuntimePromise = command === "build" ? "__mfHostInitPromise" : "initPromise";
|
|
5948
|
+
const remoteLoadRuntimePromise = command === "build" ? "__mfHostInitPromise()" : "initPromise";
|
|
5773
5949
|
const remoteCacheKey = `${getRuntimeRemoteCachePrefix(options)}${id}`;
|
|
5774
5950
|
const remoteLoadFailureHandler = command === "build" ? `.catch((error) => {
|
|
5775
5951
|
delete __mfModuleCache.remote[pendingKey];
|
|
@@ -5833,24 +6009,19 @@ function generateRemotes(id, command, enableSsrInit = false, consumer = "unified
|
|
|
5833
6009
|
}
|
|
5834
6010
|
//#endregion
|
|
5835
6011
|
//#region src/plugins/pluginAddEntry.ts
|
|
5836
|
-
const isPreloadableVirtualMfChunk = (name) => name.includes("virtual_mf") && !name.includes("__prebuild__");
|
|
6012
|
+
const isPreloadableVirtualMfChunk = (name) => name.includes("virtual_mf") && !name.includes("__prebuild__") && !name.includes("__loadShare__") && !name.includes("__loadRemote__");
|
|
5837
6013
|
const HOST_INIT_PRELOAD_CHUNKS = [
|
|
5838
6014
|
(name) => name === "hostInit",
|
|
5839
6015
|
(name) => name === "remoteEntry",
|
|
5840
|
-
(name) => name === "virtualExposes",
|
|
5841
6016
|
isPreloadableVirtualMfChunk,
|
|
5842
6017
|
(name) => name === "index"
|
|
5843
6018
|
];
|
|
5844
6019
|
const isRemoteWarmupExcluded = (name) => name.includes("__prebuild__") || name.includes("__loadShare__");
|
|
5845
|
-
const REMOTE_ENTRY_WARMUP_CHUNKS = [
|
|
5846
|
-
(name) => name === "hostInit",
|
|
5847
|
-
(name) => name === "virtualExposes",
|
|
5848
|
-
(name) => isPreloadableVirtualMfChunk(name) && !isRemoteWarmupExcluded(name)
|
|
5849
|
-
];
|
|
6020
|
+
const REMOTE_ENTRY_WARMUP_CHUNKS = [(name) => name === "hostInit", (name) => isPreloadableVirtualMfChunk(name) && !isRemoteWarmupExcluded(name)];
|
|
5850
6021
|
function getChunksByFileName(bundle) {
|
|
5851
6022
|
return new Map(Object.values(bundle).filter((chunk) => chunk.type === "chunk").map((chunk) => [chunk.fileName, chunk]));
|
|
5852
6023
|
}
|
|
5853
|
-
function collectPreloadChunkFiles(chunksByFileName, seeds, excludeFromClosure = (name) => name.includes(
|
|
6024
|
+
function collectPreloadChunkFiles(chunksByFileName, seeds, excludeFromClosure = (name) => name.includes(PREBUILD_TAG)) {
|
|
5854
6025
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
5855
6026
|
const files = [];
|
|
5856
6027
|
const queue = [...seeds];
|
|
@@ -5935,12 +6106,6 @@ function stripQueryAndHash$1(file) {
|
|
|
5935
6106
|
function isReactRouterClientRouteInput(file) {
|
|
5936
6107
|
return /[?&]__react-router-build-client-route(?:[=&]|$)/.test(file);
|
|
5937
6108
|
}
|
|
5938
|
-
function resolveDevHashEntryFileName$1(fileName) {
|
|
5939
|
-
if (!fileName.includes("[hash")) return fileName;
|
|
5940
|
-
const normalized = fileName.replace(/(?:[._-]?\[hash(?::\d+)?\])/g, "");
|
|
5941
|
-
const baseName = path$1.basename(normalized);
|
|
5942
|
-
return path$1.extname(baseName) ? normalized : `${normalized}.js`;
|
|
5943
|
-
}
|
|
5944
6109
|
function getBuildInput(config) {
|
|
5945
6110
|
return config.build?.rollupOptions?.input ?? config.build?.rolldownOptions?.input;
|
|
5946
6111
|
}
|
|
@@ -6058,10 +6223,10 @@ const __mfCurrentScript = document.currentScript;
|
|
|
6058
6223
|
const normalizedOptions = federationOptions ?? getNormalizeModuleFederationOptions();
|
|
6059
6224
|
const isLoadedFirstClientBuild = (_command === "build" || viteConfig?.command === "build") && waitsForInit && !viteConfig?.build?.ssr && normalizedOptions.shareStrategy === "loaded-first";
|
|
6060
6225
|
if (normalizedOptions.shareStrategy === "loaded-first" && !isLoadedFirstClientBuild) return [];
|
|
6061
|
-
const remoteSources = isLoadedFirstClientBuild ? Array.from(getPreloadRemotes(normalizedOptions)) : Object.
|
|
6226
|
+
const remoteSources = isLoadedFirstClientBuild ? Array.from(getPreloadRemotes(normalizedOptions)) : Object.keys(getUsedRemotesMap(federationOptions));
|
|
6062
6227
|
return Array.from(new Set(remoteSources.flatMap((remote) => {
|
|
6063
6228
|
const registration = getRemoteRegistration(remote, normalizedOptions.remotes, federationOptions);
|
|
6064
|
-
return registration && (registration.type === "module" || registration.type === "esm") && /^(?:https?:)?\/\//.test(registration.entry) ? [registration.entry] : [];
|
|
6229
|
+
return registration && (registration.type === "module" || registration.type === "esm") && /^(?:https?:)?\/\//.test(registration.entry) && !/\.json(?:[?#]|$)/i.test(registration.entry) ? [registration.entry] : [];
|
|
6065
6230
|
})));
|
|
6066
6231
|
}
|
|
6067
6232
|
function getBootstrapSource(initSrc, entrySrc, useSystemImportFallback = false, options) {
|
|
@@ -6089,9 +6254,9 @@ for (const __mfRemoteEntryPrefetchUrl of __mfRemoteEntryPrefetchUrls) {
|
|
|
6089
6254
|
import(/* @vite-ignore */ __mfRemoteEntryPrefetchUrl).catch(() => {});
|
|
6090
6255
|
}
|
|
6091
6256
|
` : "";
|
|
6092
|
-
const sharedPreloadSources = _command === "serve" && waitsForInit &&
|
|
6257
|
+
const sharedPreloadSources = _command === "serve" && waitsForInit && isRemoteOnlyContainer(normalizedOptions) && federationOptions ? Array.from(getUsedShares(federationOptions)).filter((pkg) => !pkg.endsWith("/")).filter((pkg) => {
|
|
6093
6258
|
const shareItem = federationOptions.shared[pkg] || Object.entries(federationOptions.shared).find(([key]) => key.endsWith("/") && pkg.startsWith(key))?.[1];
|
|
6094
|
-
const isExplicitShare = Object.
|
|
6259
|
+
const isExplicitShare = Object.hasOwn(federationOptions.shared, pkg);
|
|
6095
6260
|
return shareItem?.shareConfig?.singleton === true && shareItem?.shareConfig?.import !== false && !shareItem?.shareConfig?.treeShaking && (isExplicitShare || typeof shareItem?.shareConfig?.import === "string" || Boolean(getProjectResolvedImportPath(pkg)));
|
|
6096
6261
|
}).map((pkg) => toViteEncodedId(getLoadShareModulePath(pkg, false, federationOptions))) : [];
|
|
6097
6262
|
const sharedPreloadBlock = sharedPreloadSources.length > 0 ? `
|
|
@@ -6175,7 +6340,7 @@ for (const __mfRemoteEntryPrefetchUrl of __mfRemoteEntryPrefetchUrls) {
|
|
|
6175
6340
|
}
|
|
6176
6341
|
function isFederationInternalVirtualId(id) {
|
|
6177
6342
|
const normalized = decodeViteId(id).replace(/^\0+/, "");
|
|
6178
|
-
return normalized.includes("virtual:mf:") || /__(?:loadShare|prebuild|loadRemote)__/.test(normalized);
|
|
6343
|
+
return normalized.includes("virtual:mf:") || normalized.startsWith("virtual:mf-") || /__(?:loadShare|prebuild|loadRemote)__/.test(normalized);
|
|
6179
6344
|
}
|
|
6180
6345
|
function isWorkspaceSourceId(id) {
|
|
6181
6346
|
const normalized = normalizeModuleId(decodeViteId(id));
|
|
@@ -6256,7 +6421,7 @@ for (const __mfRemoteEntryPrefetchUrl of __mfRemoteEntryPrefetchUrls) {
|
|
|
6256
6421
|
next();
|
|
6257
6422
|
return;
|
|
6258
6423
|
}
|
|
6259
|
-
const devFileName =
|
|
6424
|
+
const devFileName = resolveHashPlaceholderFileName(fileName);
|
|
6260
6425
|
if (devFileName !== fileName && req.url?.startsWith((viteConfig.base + devFileName).replace(/^\/?/, "/"))) req.url = req.url.replace(devFileName, fileName);
|
|
6261
6426
|
if (req.url && req.url.startsWith((viteConfig.base + fileName).replace(/^\/?/, "/"))) {
|
|
6262
6427
|
req.url = devEntryPath;
|
|
@@ -6314,15 +6479,24 @@ for (const __mfRemoteEntryPrefetchUrl of __mfRemoteEntryPrefetchUrls) {
|
|
|
6314
6479
|
configResolved(config) {
|
|
6315
6480
|
viteConfig = config;
|
|
6316
6481
|
skipTransformIds = new Set(skipTransformFor.map(resolveProjectId));
|
|
6317
|
-
const
|
|
6318
|
-
const
|
|
6319
|
-
|
|
6320
|
-
|
|
6482
|
+
const clientEnvironmentInputs = [];
|
|
6483
|
+
for (const environment of Object.values(config.environments ?? {})) {
|
|
6484
|
+
if (environment.consumer !== "client") continue;
|
|
6485
|
+
const input = getBuildInput(environment);
|
|
6486
|
+
if (!input) {
|
|
6487
|
+
htmlFilePath ??= path$1.resolve(config.root, "index.html");
|
|
6488
|
+
continue;
|
|
6489
|
+
}
|
|
6490
|
+
if (typeof input === "string") clientEnvironmentInputs.push(input);
|
|
6491
|
+
else if (Array.isArray(input)) clientEnvironmentInputs.push(...input);
|
|
6492
|
+
else clientEnvironmentInputs.push(...Object.values(input));
|
|
6493
|
+
}
|
|
6494
|
+
const inputOptions = clientEnvironmentInputs.length > 0 ? clientEnvironmentInputs : getBuildInput(config);
|
|
6321
6495
|
if (!inputOptions) htmlFilePath = path$1.resolve(config.root, "index.html");
|
|
6322
6496
|
else if (typeof inputOptions === "string") entryFiles = [resolveProjectId(inputOptions)];
|
|
6323
6497
|
else if (Array.isArray(inputOptions)) entryFiles = inputOptions.filter((input) => !isReactRouterClientRouteInput(String(input))).map(resolveProjectId);
|
|
6324
6498
|
else if (typeof inputOptions === "object") entryFiles = Object.values(inputOptions).filter((input) => !isReactRouterClientRouteInput(String(input))).map((input) => resolveProjectId(String(input)));
|
|
6325
|
-
if (entryFiles.length > 0) htmlFilePath = getFirstHtmlEntryFile(entryFiles);
|
|
6499
|
+
if (entryFiles.length > 0) htmlFilePath = getFirstHtmlEntryFile(entryFiles) ?? htmlFilePath;
|
|
6326
6500
|
if (config.command === "serve" && !htmlFilePath) {
|
|
6327
6501
|
const rootIndexHtml = path$1.resolve(config.root, "index.html");
|
|
6328
6502
|
if (fs$2.existsSync(rootIndexHtml)) htmlFilePath = rootIndexHtml;
|
|
@@ -6437,14 +6611,13 @@ for (const __mfRemoteEntryPrefetchUrl of __mfRemoteEntryPrefetchUrls) {
|
|
|
6437
6611
|
},
|
|
6438
6612
|
transform(code, id) {
|
|
6439
6613
|
if (skipSvelteKitSsrBuild()) return;
|
|
6614
|
+
if (viteConfig?.command === "build" && !waitsForInit) return;
|
|
6440
6615
|
if (isSvelteKitServerModule(id)) return;
|
|
6441
6616
|
if (hasEntryBootstrapParam(id)) return;
|
|
6442
6617
|
if (normalizeModuleId(id).endsWith(".html")) return;
|
|
6443
6618
|
const projectId = resolveProjectId(id);
|
|
6444
6619
|
if (skipTransformIds.has(projectId)) return;
|
|
6445
|
-
|
|
6446
|
-
const transformEnv = transformCtx != null && typeof transformCtx === "object" ? transformCtx["environment"] : void 0;
|
|
6447
|
-
if (transformEnv?.name && transformEnv.name !== "client") return;
|
|
6620
|
+
if (!isClientEnvironment(this)) return;
|
|
6448
6621
|
const isVinext = hasPackageDependency("vinext");
|
|
6449
6622
|
if (isVinext && inject === "html" && id.includes("virtual:vite-rsc/remove-duplicate-server-css")) {
|
|
6450
6623
|
const namespaceReactImport = `import * as React from 'react';`;
|
|
@@ -7231,6 +7404,9 @@ function pluginExternalRuntimeCore() {
|
|
|
7231
7404
|
};
|
|
7232
7405
|
}
|
|
7233
7406
|
//#endregion
|
|
7407
|
+
//#region package.json
|
|
7408
|
+
var version$1 = "1.22.0";
|
|
7409
|
+
//#endregion
|
|
7234
7410
|
//#region src/virtualModules/index.ts
|
|
7235
7411
|
function initVirtualModules(command, remoteEntryId, enableSsrInit = false, options) {
|
|
7236
7412
|
writeLocalSharedImportMap(options);
|
|
@@ -7458,21 +7634,22 @@ const REMOTE_ENTRY_SSR_ID = "virtual:mf-REMOTE_ENTRY_SSR_ID";
|
|
|
7458
7634
|
function getRemoteEntrySSRId(options) {
|
|
7459
7635
|
return `${REMOTE_ENTRY_SSR_ID}:${getVirtualModuleScopeKey(options)}`;
|
|
7460
7636
|
}
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
filename =
|
|
7464
|
-
|
|
7465
|
-
return
|
|
7637
|
+
const FILE_EXTENSION_RE = /\.[^.]+$/;
|
|
7638
|
+
function getSsrFileNameParts(browserFilename) {
|
|
7639
|
+
const filename = resolveHashPlaceholderFileName(browserFilename);
|
|
7640
|
+
const ext = FILE_EXTENSION_RE.exec(filename)?.[0];
|
|
7641
|
+
return {
|
|
7642
|
+
base: ext ? filename.slice(0, filename.length - ext.length) : filename,
|
|
7643
|
+
ext
|
|
7644
|
+
};
|
|
7466
7645
|
}
|
|
7467
7646
|
function getSsrRemoteEntryFileName(browserFilename) {
|
|
7468
|
-
const
|
|
7469
|
-
|
|
7470
|
-
return `${filename.slice(0, filename.length - ext.length)}.ssr${ext}`;
|
|
7647
|
+
const { base, ext } = getSsrFileNameParts(browserFilename);
|
|
7648
|
+
return `${base}.ssr${ext ?? ".js"}`;
|
|
7471
7649
|
}
|
|
7472
7650
|
function getSsrExposesFileName(browserFilename) {
|
|
7473
|
-
const
|
|
7474
|
-
|
|
7475
|
-
return `${ext ? filename.slice(0, filename.length - ext.length) : filename}.exposes.js`;
|
|
7651
|
+
const { base } = getSsrFileNameParts(browserFilename);
|
|
7652
|
+
return `${base}.exposes.js`;
|
|
7476
7653
|
}
|
|
7477
7654
|
/** Singleton map for SSR loadShare: expand `pkg/` via usedShares; never serialize the prefix. */
|
|
7478
7655
|
function getSsrSharedSingletons(options) {
|
|
@@ -7650,12 +7827,6 @@ function resolveTypesMeta(dts) {
|
|
|
7650
7827
|
api: `${typesFolder}.d.ts`
|
|
7651
7828
|
};
|
|
7652
7829
|
}
|
|
7653
|
-
function resolveDevRemoteEntryFileName(fileName) {
|
|
7654
|
-
if (!fileName.includes("[hash")) return fileName;
|
|
7655
|
-
const normalized = fileName.replace(/(?:[._-]?\[hash(?::\d+)?\])/g, "");
|
|
7656
|
-
const baseName = path$1.basename(normalized);
|
|
7657
|
-
return path$1.extname(baseName) ? normalized : `${normalized}.js`;
|
|
7658
|
-
}
|
|
7659
7830
|
function createRemoteEntryAssetMap(fileName) {
|
|
7660
7831
|
return {
|
|
7661
7832
|
js: {
|
|
@@ -7681,8 +7852,38 @@ function collectImportedCss(chunks) {
|
|
|
7681
7852
|
for (const chunk of chunks) for (const cssFile of chunk.viteMetadata?.importedCss ?? []) css.add(cssFile);
|
|
7682
7853
|
return Array.from(css);
|
|
7683
7854
|
}
|
|
7684
|
-
|
|
7855
|
+
/**
|
|
7856
|
+
* Collects the virtual module ids of the `__loadShare__` wrappers belonging to shares
|
|
7857
|
+
* that are not eager.
|
|
7858
|
+
*
|
|
7859
|
+
* Such a wrapper resolves its share through the host at runtime, so it is a deferred
|
|
7860
|
+
* dependency even though the expose statically imports it. Advertising it as a sync
|
|
7861
|
+
* asset makes a preloader fetch a provider the host is going to supply anyway.
|
|
7862
|
+
*/
|
|
7863
|
+
function collectDeferredShareModules(options, isRolldown) {
|
|
7864
|
+
const deferred = /* @__PURE__ */ new Set();
|
|
7865
|
+
for (const shareKey of getUsedShares(options)) {
|
|
7866
|
+
const shareConfig = getNormalizeShareItem(shareKey, options)?.shareConfig;
|
|
7867
|
+
if (shareConfig?.eager === true) continue;
|
|
7868
|
+
if (shareConfig?.import === false) continue;
|
|
7869
|
+
deferred.add(normalizeVirtualModuleId(getLoadShareModulePath(shareKey, isRolldown, options)));
|
|
7870
|
+
}
|
|
7871
|
+
return deferred;
|
|
7872
|
+
}
|
|
7873
|
+
/**
|
|
7874
|
+
* True when the chunk exists to load a deferred share rather than expose code.
|
|
7875
|
+
*
|
|
7876
|
+
* `chunk.moduleIds` carry Rollup's `\0` virtual-module prefix while
|
|
7877
|
+
* `getLoadShareModulePath` returns the unprefixed id, so both sides are normalized —
|
|
7878
|
+
* the same comparison `isContainerBootstrapChunk` makes.
|
|
7879
|
+
*/
|
|
7880
|
+
function isDeferredShareChunk(chunk, deferredShareModules) {
|
|
7881
|
+
if (!chunk || chunk.type !== "chunk" || deferredShareModules.size === 0) return false;
|
|
7882
|
+
return [chunk.facadeModuleId, ...chunk.moduleIds ?? []].some((id) => typeof id === "string" && deferredShareModules.has(normalizeVirtualModuleId(id)));
|
|
7883
|
+
}
|
|
7884
|
+
function expandExposeAssets(filesMap, exposeModules, bundle, remoteEntryFileName, options, isRolldown) {
|
|
7685
7885
|
if (exposeModules.length === 0) return;
|
|
7886
|
+
const deferredShareModules = collectDeferredShareModules(options, isRolldown);
|
|
7686
7887
|
const containerChunks = remoteEntryFileName ? collectStaticChunks(bundle, [remoteEntryFileName]) : [];
|
|
7687
7888
|
const bootstrapChunks = containerChunks.slice(1);
|
|
7688
7889
|
const seen = new Set(containerChunks.map((chunk) => chunk.fileName));
|
|
@@ -7703,11 +7904,13 @@ function expandExposeAssets(filesMap, exposeModules, bundle, remoteEntryFileName
|
|
|
7703
7904
|
for (const exposeModule of exposeModules) {
|
|
7704
7905
|
const assets = filesMap[exposeModule];
|
|
7705
7906
|
if (!assets) continue;
|
|
7706
|
-
const
|
|
7907
|
+
const allSyncChunks = collectStaticChunks(bundle, assets.js.sync);
|
|
7908
|
+
const syncChunks = allSyncChunks.filter((chunk) => !isDeferredShareChunk(chunk, deferredShareModules));
|
|
7909
|
+
const deferredChunks = allSyncChunks.filter((chunk) => isDeferredShareChunk(chunk, deferredShareModules));
|
|
7707
7910
|
const sync = Array.from(/* @__PURE__ */ new Set([...bootstrapAssets, ...syncChunks.map((chunk) => chunk.fileName)]));
|
|
7708
7911
|
const syncSet = new Set(sync);
|
|
7709
|
-
const asyncChunks = collectStaticChunks(bundle, assets.js.async);
|
|
7710
|
-
const async = asyncChunks.map((chunk) => chunk.fileName).filter((fileName) => !syncSet.has(fileName));
|
|
7912
|
+
const asyncChunks = [...collectStaticChunks(bundle, assets.js.async), ...deferredChunks];
|
|
7913
|
+
const async = Array.from(new Set(asyncChunks.map((chunk) => chunk.fileName))).filter((fileName) => !syncSet.has(fileName));
|
|
7711
7914
|
assets.js.sync = sync;
|
|
7712
7915
|
assets.js.async = async;
|
|
7713
7916
|
const syncCss = Array.from(/* @__PURE__ */ new Set([
|
|
@@ -7741,10 +7944,10 @@ const Manifest = (providedOptions) => {
|
|
|
7741
7944
|
let mfManifestStatsName = mfManifestName ? getStatsFileName(mfManifestName) : void 0;
|
|
7742
7945
|
const isConsumerProject = Object.keys(mfOptions.exposes).length === 0;
|
|
7743
7946
|
let disableAssetsAnalyze = false;
|
|
7744
|
-
const getDefaultDisableAssetsAnalyze = (command) => command === "serve" && isConsumerProject && (typeof manifestOptions !== "object" || !Object.
|
|
7947
|
+
const getDefaultDisableAssetsAnalyze = (command) => command === "serve" && isConsumerProject && (typeof manifestOptions !== "object" || !Object.hasOwn(manifestOptions, "disableAssetsAnalyze"));
|
|
7745
7948
|
const getConfiguredDisableAssetsAnalyze = (command) => {
|
|
7746
7949
|
if (typeof manifestOptions === "object" && manifestOptions !== null) {
|
|
7747
|
-
if (Object.
|
|
7950
|
+
if (Object.hasOwn(manifestOptions, "disableAssetsAnalyze")) return manifestOptions.disableAssetsAnalyze === true;
|
|
7748
7951
|
}
|
|
7749
7952
|
return getDefaultDisableAssetsAnalyze(command);
|
|
7750
7953
|
};
|
|
@@ -7774,7 +7977,7 @@ const Manifest = (providedOptions) => {
|
|
|
7774
7977
|
*/
|
|
7775
7978
|
configureServer(server) {
|
|
7776
7979
|
server.middlewares.use((req, res, next) => {
|
|
7777
|
-
const devRemoteEntryFile =
|
|
7980
|
+
const devRemoteEntryFile = resolveHashPlaceholderFileName(filename);
|
|
7778
7981
|
if (devRemoteEntryFile !== filename && Object.keys(mfOptions.exposes).length > 0 && req.url?.startsWith((viteConfig.base + devRemoteEntryFile).replace(/^\/?/, "/"))) {
|
|
7779
7982
|
req.url = req.url.replace(devRemoteEntryFile, filename);
|
|
7780
7983
|
next();
|
|
@@ -7817,7 +8020,7 @@ const Manifest = (providedOptions) => {
|
|
|
7817
8020
|
} : void 0,
|
|
7818
8021
|
types: resolveTypesMeta(mfOptions.dts),
|
|
7819
8022
|
globalName: name,
|
|
7820
|
-
pluginVersion:
|
|
8023
|
+
pluginVersion: version$1,
|
|
7821
8024
|
publicPath
|
|
7822
8025
|
}
|
|
7823
8026
|
});
|
|
@@ -7861,7 +8064,7 @@ const Manifest = (providedOptions) => {
|
|
|
7861
8064
|
const expectedSsrRemoteEntryFile = getSsrRemoteEntryFileName(mfOptions.filename);
|
|
7862
8065
|
const foundSsrRemoteEntryFile = Object.values(bundle).find((file) => file.fileName === expectedSsrRemoteEntryFile)?.fileName;
|
|
7863
8066
|
if (foundRemoteEntryFile) remoteEntryFile = foundRemoteEntryFile;
|
|
7864
|
-
ssrRemoteEntryFile = foundSsrRemoteEntryFile || (_command === "serve" ? getSsrRemoteEntryFileName(
|
|
8067
|
+
ssrRemoteEntryFile = foundSsrRemoteEntryFile || (_command === "serve" ? getSsrRemoteEntryFileName(resolveHashPlaceholderFileName(mfOptions.filename)) : expectedSsrRemoteEntryFile);
|
|
7865
8068
|
const allCssAssets = mfOptions.bundleAllCSS && !disableAssetsAnalyze ? collectCssAssets(bundle) : /* @__PURE__ */ new Set();
|
|
7866
8069
|
if (allCssAssets.size > 0) {
|
|
7867
8070
|
const secondaryCss = /* @__PURE__ */ new Set();
|
|
@@ -7883,9 +8086,16 @@ const Manifest = (providedOptions) => {
|
|
|
7883
8086
|
root,
|
|
7884
8087
|
stripKnownJsExtensions: true
|
|
7885
8088
|
});
|
|
7886
|
-
expandExposeAssets(filesMap, exposesModules, bundle, foundRemoteEntryFile, mfOptions);
|
|
8089
|
+
expandExposeAssets(filesMap, exposesModules, bundle, foundRemoteEntryFile, mfOptions, getIsRolldown(this));
|
|
7887
8090
|
const fileToShareKey = await buildFileToShareKeyMap(getUsedShares(mfOptions), this.resolve.bind(this), mfOptions);
|
|
7888
8091
|
processModuleAssets(Object.fromEntries(Object.entries(bundle).filter(([, file]) => !isTreeShakingProviderChunk(file))), filesMap, (modulePath) => fileToShareKey.get(modulePath));
|
|
8092
|
+
for (const shareKey of getUsedShares(mfOptions)) {
|
|
8093
|
+
const shareItem = getNormalizeShareItem(shareKey, mfOptions);
|
|
8094
|
+
const assets = filesMap[shareKey];
|
|
8095
|
+
if (!assets || shareItem?.shareConfig.eager === true) continue;
|
|
8096
|
+
assets.js.async.push(...assets.js.sync.splice(0));
|
|
8097
|
+
assets.css.async.push(...assets.css.sync.splice(0));
|
|
8098
|
+
}
|
|
7889
8099
|
if (mfOptions.bundleAllCSS) addCssAssetsToAllExports(filesMap, allCssAssets);
|
|
7890
8100
|
filesMap = deduplicateAssets(filesMap);
|
|
7891
8101
|
}
|
|
@@ -7913,14 +8123,14 @@ const Manifest = (providedOptions) => {
|
|
|
7913
8123
|
function generateMFManifest(preloadMap, disableAssetsAnalyze = false) {
|
|
7914
8124
|
const options = mfOptions;
|
|
7915
8125
|
const { name, varFilename } = options;
|
|
7916
|
-
const resolvedRemoteEntryFile = _command === "serve" ? remoteEntryFile ||
|
|
8126
|
+
const resolvedRemoteEntryFile = _command === "serve" ? remoteEntryFile || resolveHashPlaceholderFileName(filename) : remoteEntryFile;
|
|
7917
8127
|
const remoteEntry = {
|
|
7918
8128
|
name: resolvedRemoteEntryFile,
|
|
7919
8129
|
path: "",
|
|
7920
8130
|
type: "module"
|
|
7921
8131
|
};
|
|
7922
8132
|
const ssrRemoteEntry = {
|
|
7923
|
-
name: ssrRemoteEntryFile || getSsrRemoteEntryFileName(_command === "serve" ?
|
|
8133
|
+
name: ssrRemoteEntryFile || getSsrRemoteEntryFileName(_command === "serve" ? resolveHashPlaceholderFileName(filename) : filename),
|
|
7924
8134
|
path: _command === "serve" ? "/__mf_ssr__/" : "",
|
|
7925
8135
|
type: "module"
|
|
7926
8136
|
};
|
|
@@ -8007,7 +8217,7 @@ const Manifest = (providedOptions) => {
|
|
|
8007
8217
|
varRemoteEntry,
|
|
8008
8218
|
types: resolveTypesMeta(options.dts),
|
|
8009
8219
|
globalName: name,
|
|
8010
|
-
pluginVersion:
|
|
8220
|
+
pluginVersion: version$1,
|
|
8011
8221
|
...!!getPublicPath ? { getPublicPath } : { publicPath }
|
|
8012
8222
|
},
|
|
8013
8223
|
...disableAssetsAnalyze ? {} : { shared },
|
|
@@ -8220,12 +8430,6 @@ function pluginModuleParseEnd_default(excludeFn, options, controller = createMod
|
|
|
8220
8430
|
}
|
|
8221
8431
|
//#endregion
|
|
8222
8432
|
//#region src/plugins/pluginProxyRemoteEntry.ts
|
|
8223
|
-
function resolveDevHashEntryFileName(fileName) {
|
|
8224
|
-
if (!fileName.includes("[hash")) return fileName;
|
|
8225
|
-
const normalized = fileName.replace(/(?:[._-]?\[hash(?::\d+)?\])/g, "");
|
|
8226
|
-
const baseName = path$1.basename(normalized);
|
|
8227
|
-
return path$1.extname(baseName) ? normalized : `${normalized}.js`;
|
|
8228
|
-
}
|
|
8229
8433
|
function resolveAbsoluteDevRemoteEntryUrl(publicPath, fileName) {
|
|
8230
8434
|
const base = new URL(publicPath);
|
|
8231
8435
|
base.pathname = ensureTrailingSlash(base.pathname);
|
|
@@ -8366,7 +8570,7 @@ function pluginProxyRemoteEntry_default({ options, remoteEntryId, virtualExposes
|
|
|
8366
8570
|
const host = formatDevServerHostForOrigin(viteConfig.server?.host);
|
|
8367
8571
|
const resolvedPublicPath = resolvePublicPath(options, viteConfig.base, originalConfigBase);
|
|
8368
8572
|
const devPublicPath = resolvedPublicPath === "auto" ? "/" : resolvedPublicPath;
|
|
8369
|
-
const remoteEntryFileName =
|
|
8573
|
+
const remoteEntryFileName = resolveHashPlaceholderFileName(options.filename);
|
|
8370
8574
|
const isAbsolutePublicPath = /^https?:\/\//i.test(devPublicPath);
|
|
8371
8575
|
const remoteEntryUrl = JSON.stringify(isAbsolutePublicPath ? resolveAbsoluteDevRemoteEntryUrl(devPublicPath, remoteEntryFileName) : `${ensureTrailingSlash(devPublicPath)}${remoteEntryFileName}`);
|
|
8372
8576
|
const fallbackOrigin = `//${host}:${viteConfig.server?.port}`;
|
|
@@ -8419,28 +8623,10 @@ function pluginProxyRemoteEntry_default({ options, remoteEntryId, virtualExposes
|
|
|
8419
8623
|
};
|
|
8420
8624
|
}
|
|
8421
8625
|
//#endregion
|
|
8422
|
-
//#region src/utils/remoteConsumerTarget.ts
|
|
8423
|
-
function getPluginEnvironmentName(ctx) {
|
|
8424
|
-
if (ctx == null || typeof ctx !== "object") return void 0;
|
|
8425
|
-
const environment = ctx["environment"];
|
|
8426
|
-
if (environment == null || typeof environment !== "object") return void 0;
|
|
8427
|
-
const name = environment["name"];
|
|
8428
|
-
return typeof name === "string" ? name : void 0;
|
|
8429
|
-
}
|
|
8430
|
-
function resolveRemoteConsumer(ctx, hasMultiEnvironment) {
|
|
8431
|
-
if (!hasMultiEnvironment) return "unified";
|
|
8432
|
-
const envName = getPluginEnvironmentName(ctx);
|
|
8433
|
-
if (!envName || envName === "client") return "client";
|
|
8434
|
-
return "server";
|
|
8435
|
-
}
|
|
8436
|
-
//#endregion
|
|
8437
8626
|
//#region src/plugins/pluginProxyRemotes.ts
|
|
8438
8627
|
function isNodeModulesImporter(importer) {
|
|
8439
8628
|
return importer?.includes("/node_modules/") || importer?.includes("\\node_modules\\");
|
|
8440
8629
|
}
|
|
8441
|
-
function escapeRegExp(value) {
|
|
8442
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8443
|
-
}
|
|
8444
8630
|
function appendAlias(config, alias) {
|
|
8445
8631
|
config.resolve ??= {};
|
|
8446
8632
|
const existingAlias = config.resolve.alias;
|
|
@@ -8739,6 +8925,21 @@ function isSharedPackageDependency(sharedKey, dependency) {
|
|
|
8739
8925
|
}
|
|
8740
8926
|
return reachable.has(dependency);
|
|
8741
8927
|
}
|
|
8928
|
+
function isConfiguredSharedPackage(pkg, shared) {
|
|
8929
|
+
return Object.keys(shared).some((key) => getPackageName(key) === pkg);
|
|
8930
|
+
}
|
|
8931
|
+
function shouldKeepSharedImportLocal(source, importer, sharedKey, shared, importerPackage) {
|
|
8932
|
+
if (!importer || shared[sharedKey]?.shareConfig.import === false) return false;
|
|
8933
|
+
const prebuildImporter = importer.includes("__prebuild__") ? VirtualModule.findModule(PREBUILD_TAG, importer) : void 0;
|
|
8934
|
+
const fallbackPackage = prebuildImporter ? getPackageName(prebuildImporter.name) : importerPackage;
|
|
8935
|
+
if (!fallbackPackage || !isConfiguredSharedPackage(fallbackPackage, shared)) return false;
|
|
8936
|
+
const sourcePackage = getPackageName(sharedKey);
|
|
8937
|
+
if (fallbackPackage !== "react-dom" || sourcePackage !== "react") return false;
|
|
8938
|
+
if (prebuildImporter && matchesSharedSource(source, prebuildImporter.name)) return false;
|
|
8939
|
+
if (!isSharedPackageDependency(prebuildImporter?.name ?? fallbackPackage, sourcePackage)) return false;
|
|
8940
|
+
if (isSharedPackageDependency(sharedKey, fallbackPackage)) return false;
|
|
8941
|
+
return true;
|
|
8942
|
+
}
|
|
8742
8943
|
const sharedRuntimeDependencyCache = /* @__PURE__ */ new Map();
|
|
8743
8944
|
const SOURCE_FILE_RE = /\.(?:[cm]?js|[cm]?ts|jsx|tsx)$/;
|
|
8744
8945
|
const NON_RUNTIME_SOURCE_RE = /(?:\.d\.[cm]?ts|\.(?:test|spec|stories)\.[cm]?[jt]sx?)$/;
|
|
@@ -8748,7 +8949,7 @@ const NON_RUNTIME_DIRS = /* @__PURE__ */ new Set([
|
|
|
8748
8949
|
"dist",
|
|
8749
8950
|
"build"
|
|
8750
8951
|
]);
|
|
8751
|
-
/**
|
|
8952
|
+
/** Keep local runtime walks bounded without skipping the package entry itself. */
|
|
8752
8953
|
const MAX_SCANNED_SOURCE_BYTES = 256 * 1024;
|
|
8753
8954
|
const BARE_PACKAGE_SPECIFIER_RE = /^(?:@[^\s'"`()\/]+\/)?[^\s'"`()\/.@][^\s'"`()\/]*(?:\/[^\s'"`()]*)?$/;
|
|
8754
8955
|
/** Module specifiers evaluated by a source file. */
|
|
@@ -8764,24 +8965,30 @@ function collectAllRuntimeImports(dir, into) {
|
|
|
8764
8965
|
try {
|
|
8765
8966
|
entries = readdirSync(dir, { withFileTypes: true });
|
|
8766
8967
|
} catch {
|
|
8767
|
-
return;
|
|
8968
|
+
return false;
|
|
8768
8969
|
}
|
|
8970
|
+
let complete = true;
|
|
8769
8971
|
for (const entry of entries) {
|
|
8770
8972
|
if (entry.isDirectory()) {
|
|
8771
|
-
if (!NON_RUNTIME_DIRS.has(entry.name)
|
|
8973
|
+
if (!NON_RUNTIME_DIRS.has(entry.name) && !collectAllRuntimeImports(path$1.join(dir, entry.name), into)) complete = false;
|
|
8772
8974
|
continue;
|
|
8773
8975
|
}
|
|
8774
8976
|
if (!SOURCE_FILE_RE.test(entry.name) || NON_RUNTIME_SOURCE_RE.test(entry.name)) continue;
|
|
8775
8977
|
const file = path$1.join(dir, entry.name);
|
|
8776
8978
|
let code;
|
|
8777
8979
|
try {
|
|
8778
|
-
if (statSync(file).size > MAX_SCANNED_SOURCE_BYTES)
|
|
8980
|
+
if (statSync(file).size > MAX_SCANNED_SOURCE_BYTES) {
|
|
8981
|
+
complete = false;
|
|
8982
|
+
continue;
|
|
8983
|
+
}
|
|
8779
8984
|
code = readFileSync(file, "utf-8");
|
|
8780
8985
|
} catch {
|
|
8986
|
+
complete = false;
|
|
8781
8987
|
continue;
|
|
8782
8988
|
}
|
|
8783
8989
|
for (const specifier of getRuntimeImportSpecifiers(code)) into.add(specifier);
|
|
8784
8990
|
}
|
|
8991
|
+
return complete;
|
|
8785
8992
|
}
|
|
8786
8993
|
const SOURCE_EXTENSIONS = [
|
|
8787
8994
|
"",
|
|
@@ -8807,19 +9014,27 @@ function resolveLocalRuntimeImport(importer, specifier) {
|
|
|
8807
9014
|
}
|
|
8808
9015
|
function collectReachableRuntimeImports(entry, dir, into) {
|
|
8809
9016
|
const visited = /* @__PURE__ */ new Set();
|
|
8810
|
-
const queue = [
|
|
9017
|
+
const queue = [{
|
|
9018
|
+
file: entry,
|
|
9019
|
+
isEntry: true
|
|
9020
|
+
}];
|
|
8811
9021
|
let scanned = false;
|
|
9022
|
+
let complete = true;
|
|
8812
9023
|
while (queue.length) {
|
|
8813
|
-
const file = queue.shift();
|
|
9024
|
+
const { file, isEntry } = queue.shift();
|
|
8814
9025
|
const relative = path$1.relative(dir, file);
|
|
8815
9026
|
if (relative.startsWith("..") || path$1.isAbsolute(relative) || visited.has(file)) continue;
|
|
8816
9027
|
visited.add(file);
|
|
8817
9028
|
let code;
|
|
8818
9029
|
try {
|
|
8819
|
-
if (statSync(file).size > MAX_SCANNED_SOURCE_BYTES)
|
|
9030
|
+
if (!isEntry && statSync(file).size > MAX_SCANNED_SOURCE_BYTES) {
|
|
9031
|
+
complete = false;
|
|
9032
|
+
continue;
|
|
9033
|
+
}
|
|
8820
9034
|
code = readFileSync(file, "utf-8");
|
|
8821
9035
|
scanned = true;
|
|
8822
9036
|
} catch {
|
|
9037
|
+
complete = false;
|
|
8823
9038
|
continue;
|
|
8824
9039
|
}
|
|
8825
9040
|
for (const specifier of getRuntimeModuleSpecifiers(code)) {
|
|
@@ -8828,10 +9043,13 @@ function collectReachableRuntimeImports(entry, dir, into) {
|
|
|
8828
9043
|
continue;
|
|
8829
9044
|
}
|
|
8830
9045
|
const local = resolveLocalRuntimeImport(file, specifier);
|
|
8831
|
-
if (local) queue.push(
|
|
9046
|
+
if (local) queue.push({
|
|
9047
|
+
file: local,
|
|
9048
|
+
isEntry: false
|
|
9049
|
+
});
|
|
8832
9050
|
}
|
|
8833
9051
|
}
|
|
8834
|
-
return scanned;
|
|
9052
|
+
return scanned && complete;
|
|
8835
9053
|
}
|
|
8836
9054
|
/**
|
|
8837
9055
|
* Whether `dependency` is reachable from the shared package through the imports its source files
|
|
@@ -8840,11 +9058,13 @@ function collectReachableRuntimeImports(entry, dir, into) {
|
|
|
8840
9058
|
* the fallback's evaluation graph rather than the package's declared closure — in a monorepo the
|
|
8841
9059
|
* latter covers far more than the module graph ever does.
|
|
8842
9060
|
*/
|
|
8843
|
-
function isSharedPackageRuntimeDependency(sharedKey, dependency) {
|
|
9061
|
+
function isSharedPackageRuntimeDependency(sharedKey, dependency, conditions) {
|
|
8844
9062
|
const sharedPackage = getPackageName(sharedKey);
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
9063
|
+
const cacheKey = `${sharedKey}\0${JSON.stringify(conditions ?? null)}`;
|
|
9064
|
+
let result = sharedRuntimeDependencyCache.get(cacheKey);
|
|
9065
|
+
if (!result) {
|
|
9066
|
+
const reachable = /* @__PURE__ */ new Set();
|
|
9067
|
+
let complete = true;
|
|
8848
9068
|
const visited = /* @__PURE__ */ new Set();
|
|
8849
9069
|
const queue = [{
|
|
8850
9070
|
request: sharedKey,
|
|
@@ -8852,16 +9072,26 @@ function isSharedPackageRuntimeDependency(sharedKey, dependency) {
|
|
|
8852
9072
|
}];
|
|
8853
9073
|
while (queue.length) {
|
|
8854
9074
|
const { request, installed } = queue.shift();
|
|
8855
|
-
if (!installed)
|
|
9075
|
+
if (!installed) {
|
|
9076
|
+
complete = false;
|
|
9077
|
+
continue;
|
|
9078
|
+
}
|
|
8856
9079
|
const visitKey = `${installed.dir}\0${request}`;
|
|
8857
9080
|
if (visited.has(visitKey)) continue;
|
|
8858
9081
|
visited.add(visitKey);
|
|
8859
9082
|
const specifiers = /* @__PURE__ */ new Set();
|
|
8860
9083
|
const entry = getInstalledPackageEntry(request, {
|
|
8861
9084
|
cwd: installed.dir,
|
|
8862
|
-
packageName: getPackageName(request)
|
|
9085
|
+
packageName: getPackageName(request),
|
|
9086
|
+
resolveSubpathWithRequire: false,
|
|
9087
|
+
...conditions !== void 0 ? { conditions: [...conditions] } : {}
|
|
8863
9088
|
});
|
|
8864
|
-
if (!entry
|
|
9089
|
+
if (!entry) {
|
|
9090
|
+
if (!collectAllRuntimeImports(installed.dir, specifiers)) complete = false;
|
|
9091
|
+
} else if (!collectReachableRuntimeImports(entry, installed.dir, specifiers)) {
|
|
9092
|
+
complete = false;
|
|
9093
|
+
collectAllRuntimeImports(installed.dir, specifiers);
|
|
9094
|
+
}
|
|
8865
9095
|
for (const specifier of specifiers) {
|
|
8866
9096
|
const dep = getPackageName(specifier);
|
|
8867
9097
|
if (dep === sharedPackage) continue;
|
|
@@ -8873,9 +9103,13 @@ function isSharedPackageRuntimeDependency(sharedKey, dependency) {
|
|
|
8873
9103
|
});
|
|
8874
9104
|
}
|
|
8875
9105
|
}
|
|
8876
|
-
|
|
9106
|
+
result = {
|
|
9107
|
+
dependencies: reachable,
|
|
9108
|
+
complete
|
|
9109
|
+
};
|
|
9110
|
+
sharedRuntimeDependencyCache.set(cacheKey, result);
|
|
8877
9111
|
}
|
|
8878
|
-
return
|
|
9112
|
+
return result.dependencies.has(dependency) || !result.complete && isSharedPackageDependency(sharedKey, dependency);
|
|
8879
9113
|
}
|
|
8880
9114
|
function proxySharedModule(options) {
|
|
8881
9115
|
const { shared = {}, federationOptions, getParsePromise = () => Promise.resolve() } = options;
|
|
@@ -8883,12 +9117,30 @@ function proxySharedModule(options) {
|
|
|
8883
9117
|
let _command = "serve";
|
|
8884
9118
|
let useDirectReactImport = false;
|
|
8885
9119
|
let useRolldown = false;
|
|
9120
|
+
let isProduction = false;
|
|
9121
|
+
let rootResolveConditions;
|
|
9122
|
+
let ssrResolveConditions;
|
|
9123
|
+
let ssrTarget = "node";
|
|
8886
9124
|
const savePrebuild = new PromiseStore();
|
|
8887
9125
|
let devServer;
|
|
8888
9126
|
const materializedLoadShareSources = /* @__PURE__ */ new Set();
|
|
8889
9127
|
const emittedTreeShakingProviders = /* @__PURE__ */ new Set();
|
|
8890
9128
|
const hasAnalyzableShares = Object.values(shared).some((share) => shouldAnalyzeSharedExports(share));
|
|
8891
|
-
const
|
|
9129
|
+
const getEnvironmentConfig = (context) => context.environment?.config;
|
|
9130
|
+
const getEnvironmentConditions = (context) => getEnvironmentConfig(context)?.resolve?.conditions;
|
|
9131
|
+
const getRuntimeDependencyConditions = (context, resolveOptions) => {
|
|
9132
|
+
const environment = context.environment;
|
|
9133
|
+
const environmentConfig = environment?.config;
|
|
9134
|
+
const isSsr = resolveOptions.ssr === true || Boolean(_config?.build?.ssr) || environmentConfig?.consumer === "server" || Boolean(environmentConfig?.build?.ssr) || environment?.name === "ssr" || environment?.name === "server";
|
|
9135
|
+
return getSharedExportConditions({
|
|
9136
|
+
environmentConditions: environmentConfig?.resolve?.conditions,
|
|
9137
|
+
isProduction: environmentConfig?.isProduction ?? isProduction,
|
|
9138
|
+
isSsr,
|
|
9139
|
+
rootConditions: rootResolveConditions,
|
|
9140
|
+
ssrConditions: ssrResolveConditions,
|
|
9141
|
+
ssrTarget
|
|
9142
|
+
});
|
|
9143
|
+
};
|
|
8892
9144
|
const refreshTreeShakingForEnvironment = (context) => refreshTreeShakingModules(federationOptions, _command, getIsRolldown(context), getEnvironmentConditions(context));
|
|
8893
9145
|
const normalizeTreeShakingOutputPath = (value) => {
|
|
8894
9146
|
const normalized = normalizePathForImport(value);
|
|
@@ -8972,8 +9224,13 @@ function proxySharedModule(options) {
|
|
|
8972
9224
|
},
|
|
8973
9225
|
configResolved(config) {
|
|
8974
9226
|
_config = config;
|
|
9227
|
+
isProduction = config.isProduction;
|
|
9228
|
+
rootResolveConditions = config.resolve?.conditions ? [...config.resolve.conditions] : void 0;
|
|
9229
|
+
ssrResolveConditions = config.ssr?.resolve?.conditions ? [...config.ssr.resolve.conditions] : void 0;
|
|
9230
|
+
ssrTarget = config.ssr?.target ?? "node";
|
|
8975
9231
|
const isRolldown = getIsRolldown(this);
|
|
8976
|
-
const
|
|
9232
|
+
const resolvedOptions = federationOptions ?? getNormalizeModuleFederationOptions();
|
|
9233
|
+
const registerConfiguredShare = _command === "build" && Object.keys(resolvedOptions.exposes).length > 0 ? addUsedShares : addConfiguredShare;
|
|
8977
9234
|
Object.keys(shared).forEach((key) => {
|
|
8978
9235
|
if (key.endsWith("/")) return;
|
|
8979
9236
|
if (useDirectReactImport && key === "react") {
|
|
@@ -9052,8 +9309,10 @@ function proxySharedModule(options) {
|
|
|
9052
9309
|
if (!key) return;
|
|
9053
9310
|
const importerPackage = getSharedPackageFromFile(importer, shared);
|
|
9054
9311
|
if (importerPackage === getPackageName(key)) return;
|
|
9055
|
-
if (importerPackage) {
|
|
9056
|
-
|
|
9312
|
+
if (importerPackage && shared[key].shareConfig.import !== false) {
|
|
9313
|
+
const importerIsUnsharedWorkspacePackage = !isNodeModulePath(importer) && !Object.keys(shared).some((sharedKey) => getPackageName(sharedKey) === importerPackage);
|
|
9314
|
+
const runtimeDependencyRequest = key.endsWith("/") && matchesSharedSource(source, key) ? source : key;
|
|
9315
|
+
if (importerIsUnsharedWorkspacePackage ? isSharedPackageRuntimeDependency(runtimeDependencyRequest, importerPackage, getRuntimeDependencyConditions(this, resolveOptions)) : isSharedPackageDependency(key, importerPackage)) return;
|
|
9057
9316
|
}
|
|
9058
9317
|
if (useDirectReactImport && key === "react") return;
|
|
9059
9318
|
if (isAssetLikeImport(source)) return;
|
|
@@ -9064,6 +9323,10 @@ function proxySharedModule(options) {
|
|
|
9064
9323
|
if (shouldSkipTaggedImporterProxy(key, "__loadShare__")) return;
|
|
9065
9324
|
if (shouldSkipTaggedImporterProxy(key, "__prebuild__")) return;
|
|
9066
9325
|
const shareSource = key === "vue" && source.startsWith("vue/dist/") ? key : isNodeModulePath(source) ? getCommonSharedSubpathFromNodeModulePath(source, key) || key : source;
|
|
9326
|
+
if (shouldKeepSharedImportLocal(source, importer, key, shared, importerPackage)) {
|
|
9327
|
+
const localSource = getPrebuildResolutionSource(shareSource, shared[key]);
|
|
9328
|
+
return tryResolveFromProjectRoot(localSource) || localSource;
|
|
9329
|
+
}
|
|
9067
9330
|
const loadSharePath = getLoadShareModulePath(shareSource, useRolldown, federationOptions);
|
|
9068
9331
|
if (!materializedLoadShareSources.has(shareSource)) {
|
|
9069
9332
|
materializedLoadShareSources.add(shareSource);
|
|
@@ -9870,11 +10133,7 @@ var aliasToArrayPlugin_default = {
|
|
|
9870
10133
|
};
|
|
9871
10134
|
//#endregion
|
|
9872
10135
|
//#region src/utils/controlChunkSanitizer.ts
|
|
9873
|
-
const FEDERATION_CONTROL_CHUNK_HINTS = [
|
|
9874
|
-
"hostInit",
|
|
9875
|
-
"virtualExposes",
|
|
9876
|
-
"localSharedImportMap"
|
|
9877
|
-
];
|
|
10136
|
+
const FEDERATION_CONTROL_CHUNK_HINTS = ["hostInit", "localSharedImportMap"];
|
|
9878
10137
|
function stripEmptyPreloadCalls(code) {
|
|
9879
10138
|
const helperImportRegex = /import\s*\{\s*_\s*as\s*([A-Za-z_$][\w$]*)\s*\}\s*from\s*["'][^"']+["']\s*;?/g;
|
|
9880
10139
|
const helperAliases = [];
|
|
@@ -9922,7 +10181,7 @@ function isFederationControlChunk(fileName, filename) {
|
|
|
9922
10181
|
function sanitizeFederationControlChunk(code, fileName, filename) {
|
|
9923
10182
|
let nextCode = stripEmptyPreloadCalls(code);
|
|
9924
10183
|
if (fileName.includes("localSharedImportMap")) {
|
|
9925
|
-
const remoteEntryImportRegex = new RegExp(`import\\s*["'][^"']*${filename
|
|
10184
|
+
const remoteEntryImportRegex = new RegExp(`import\\s*["'][^"']*${escapeRegExp(filename)}["']\\s*;?`, "g");
|
|
9926
10185
|
nextCode = nextCode.replace(remoteEntryImportRegex, "");
|
|
9927
10186
|
}
|
|
9928
10187
|
return nextCode;
|
|
@@ -10054,13 +10313,15 @@ function appendResolveAlias(config, alias) {
|
|
|
10054
10313
|
replacement
|
|
10055
10314
|
})), alias];
|
|
10056
10315
|
}
|
|
10316
|
+
const RUNTIME_INDEX_ENTRY_RE = /^(.*[\\/])index(\.[cm]?js)$/;
|
|
10317
|
+
const TRAILING_SLASH_RE = /\/$/;
|
|
10057
10318
|
function getRuntimeHelpersImplementation(runtimeImplementation) {
|
|
10058
|
-
const indexEntryMatch =
|
|
10319
|
+
const indexEntryMatch = RUNTIME_INDEX_ENTRY_RE.exec(runtimeImplementation);
|
|
10059
10320
|
if (indexEntryMatch) return normalizePathForImport(`${indexEntryMatch[1]}helpers${indexEntryMatch[2]}`);
|
|
10060
10321
|
const extension = path$1.extname(runtimeImplementation);
|
|
10061
10322
|
if (extension) return normalizePathForImport(path$1.join(path$1.dirname(runtimeImplementation), `helpers${extension}`));
|
|
10062
10323
|
if (path$1.isAbsolute(runtimeImplementation) || runtimeImplementation.startsWith(".")) return normalizePathForImport(path$1.join(runtimeImplementation, "helpers"));
|
|
10063
|
-
return `${runtimeImplementation.replace(
|
|
10324
|
+
return `${runtimeImplementation.replace(TRAILING_SLASH_RE, "")}/helpers`;
|
|
10064
10325
|
}
|
|
10065
10326
|
const UNSAFE_JS_SOURCE_CHAR_MAP = {
|
|
10066
10327
|
"<": "\\u003C",
|
|
@@ -10083,7 +10344,7 @@ function escapeUnsafeJsSourceChars(str) {
|
|
|
10083
10344
|
}
|
|
10084
10345
|
function isFederationHtmlPreloadDependency(dep, includeSharedRuntime = false) {
|
|
10085
10346
|
const file = path$1.basename(dep);
|
|
10086
|
-
if (file.includes("__mfe_internal__") || file.includes("virtual_mf-") || file.includes("
|
|
10347
|
+
if (file.includes("__mfe_internal__") || file.includes("virtual_mf-") || file.includes("localSharedImportMap") || file.includes("hostInit")) return true;
|
|
10087
10348
|
return includeSharedRuntime && (file.includes("preload-helper") || file.includes("rolldown-runtime") || file.startsWith("dist-"));
|
|
10088
10349
|
}
|
|
10089
10350
|
function canResolveSharedSubpath(subpath, projectRoot) {
|
|
@@ -10307,7 +10568,7 @@ function createEarlyVirtualModulesPlugin(options) {
|
|
|
10307
10568
|
initVirtualModules(_command, getRemoteEntryId(options), false, options);
|
|
10308
10569
|
const isRolldown = getIsRolldown(this);
|
|
10309
10570
|
if (remotes && Object.keys(remotes).length > 0) {
|
|
10310
|
-
for (const key of Object.keys(remotes))
|
|
10571
|
+
for (const key of Object.keys(remotes)) ensureUsedRemote(key, options);
|
|
10311
10572
|
if (_command === "serve") {
|
|
10312
10573
|
config.optimizeDeps = config.optimizeDeps || {};
|
|
10313
10574
|
config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
|
|
@@ -10492,9 +10753,7 @@ export default __mfShared.default ?? __mfShared;`
|
|
|
10492
10753
|
const automaticJsxRuntime = getAutomaticJsxRuntime(config);
|
|
10493
10754
|
if (automaticJsxRuntime && materializeAutomaticJsxRuntime(options, automaticJsxRuntime)) writeLocalSharedImportMap(options);
|
|
10494
10755
|
}
|
|
10495
|
-
|
|
10496
|
-
const hasRemotes = Object.keys(options.remotes).length > 0;
|
|
10497
|
-
if (!getSsrCapabilities(viteMajor, config.command, hasRemotes).injectSsrEntryLoader) return;
|
|
10756
|
+
if (!getSsrCapabilities(parseInt(version, 10), config.command, hasRemotes(options)).injectSsrEntryLoader) return;
|
|
10498
10757
|
if (options.runtimePlugins.some((p) => {
|
|
10499
10758
|
return (typeof p === "string" ? p : p[0]) === "@module-federation/vite/ssrEntryLoader";
|
|
10500
10759
|
})) return;
|
|
@@ -10521,7 +10780,10 @@ export default __mfShared.default ?? __mfShared;`
|
|
|
10521
10780
|
const ssrEntryLoaderSpecifier = SSR_ENTRY_LOADER_SPECIFIER;
|
|
10522
10781
|
try {
|
|
10523
10782
|
resolveImportPath(ssrEntryLoaderSpecifier);
|
|
10524
|
-
options.runtimePlugins.push([ssrEntryLoaderSpecifier, {
|
|
10783
|
+
options.runtimePlugins.push([ssrEntryLoaderSpecifier, {
|
|
10784
|
+
resolvedShared,
|
|
10785
|
+
...options.ssrEntryLoader?.strategy ? { strategy: options.ssrEntryLoader.strategy } : {}
|
|
10786
|
+
}]);
|
|
10525
10787
|
} catch {}
|
|
10526
10788
|
}
|
|
10527
10789
|
};
|
|
@@ -10537,7 +10799,7 @@ function applyBuildTimeRuntimeDefines(define, options, { target, isAstro, defaul
|
|
|
10537
10799
|
}
|
|
10538
10800
|
function loadPluginDts(options) {
|
|
10539
10801
|
if (options.dts === false) return [];
|
|
10540
|
-
return [import("./pluginDts-
|
|
10802
|
+
return [import("./pluginDts-D7Faa4NJ.js").then(({ default: pluginDts }) => pluginDts(options))];
|
|
10541
10803
|
}
|
|
10542
10804
|
const INJECT_EXTERNAL_RUNTIME_CORE_PLUGIN = "@module-federation/vite/injectExternalRuntimeCorePlugin";
|
|
10543
10805
|
function isInjectExternalRuntimeCorePlugin(specifier) {
|
|
@@ -10562,7 +10824,6 @@ function resolveInjectExternalRuntimeCorePlugin() {
|
|
|
10562
10824
|
function applyExternalRuntimeExperiments(options) {
|
|
10563
10825
|
const { experiments } = options;
|
|
10564
10826
|
if (experiments.provideExternalRuntime) {
|
|
10565
|
-
if (Object.keys(options.exposes).length > 0) throw createModuleFederationError("You can only set provideExternalRuntime: true in pure consumer which not expose modules.");
|
|
10566
10827
|
if (!hasInjectExternalRuntimeCorePlugin(options.runtimePlugins)) options.runtimePlugins = options.runtimePlugins.concat(resolveInjectExternalRuntimeCorePlugin());
|
|
10567
10828
|
}
|
|
10568
10829
|
}
|
|
@@ -10578,7 +10839,7 @@ function federation(mfUserOptions) {
|
|
|
10578
10839
|
const virtualExposesId = getVirtualExposesId(options);
|
|
10579
10840
|
const moduleParseController = createModuleParseController();
|
|
10580
10841
|
const moduleParsePlugins = pluginModuleParseEnd_default((id) => {
|
|
10581
|
-
return id.includes(getHostAutoInitPath(options)) || id.includes(getPendingSharesPath(options)) || id.includes(
|
|
10842
|
+
return id.includes(getHostAutoInitPath(options)) || id.includes(getPendingSharesPath(options)) || id.includes("virtual:mf-REMOTE_ENTRY_ID") || id.includes(virtualExposesId) || id.includes("virtual:mf-localSharedImportMap") || id.includes("__loadShare__") || id.includes("__prebuild__") || id.includes("__treeShakingProvider__") || id.includes("__mf_tree_shaking_graph__");
|
|
10582
10843
|
}, {
|
|
10583
10844
|
moduleParseTimeout: options.moduleParseTimeout,
|
|
10584
10845
|
moduleParseIdleTimeout: options.moduleParseIdleTimeout,
|
|
@@ -10753,11 +11014,6 @@ function federation(mfUserOptions) {
|
|
|
10753
11014
|
skipTransformFor: Object.values(options.exposes).map((expose) => expose.import),
|
|
10754
11015
|
federationOptions: options
|
|
10755
11016
|
}),
|
|
10756
|
-
...addEntry({
|
|
10757
|
-
entryName: "virtualExposes",
|
|
10758
|
-
entryPath: virtualExposesId,
|
|
10759
|
-
federationOptions: options
|
|
10760
|
-
}),
|
|
10761
11017
|
pluginProxyRemoteEntry_default({
|
|
10762
11018
|
options,
|
|
10763
11019
|
remoteEntryId,
|
|
@@ -10781,6 +11037,10 @@ function federation(mfUserOptions) {
|
|
|
10781
11037
|
const runtimeInitId = getRuntimeInitStatusImportId(options);
|
|
10782
11038
|
config.build = config.build || {};
|
|
10783
11039
|
if (config.build.modulePreload !== false) {
|
|
11040
|
+
const remoteEntryBasename = path$1.posix.basename(options.filename);
|
|
11041
|
+
const hashParts = remoteEntryBasename.split(/\[hash(?::\d+)?\]/);
|
|
11042
|
+
const remoteEntryFilePattern = new RegExp(`^${hashParts.map((part) => escapeRegExp(part)).join("[\\w-]+")}${hashParts.length > 1 && !/\.[^/.]+$/.test(remoteEntryBasename) ? "\\.js" : ""}$`);
|
|
11043
|
+
const isRemoteEntryFile = (file) => file === remoteEntryBasename || remoteEntryFilePattern.test(file);
|
|
10784
11044
|
const currentModulePreload = config.build.modulePreload && typeof config.build.modulePreload === "object" ? config.build.modulePreload : {};
|
|
10785
11045
|
const existingResolveDependencies = currentModulePreload.resolveDependencies;
|
|
10786
11046
|
config.build.modulePreload = {
|
|
@@ -10788,7 +11048,7 @@ function federation(mfUserOptions) {
|
|
|
10788
11048
|
resolveDependencies(filename, deps, context) {
|
|
10789
11049
|
const resolvedDeps = existingResolveDependencies ? existingResolveDependencies(filename, deps, context) : deps;
|
|
10790
11050
|
const hostFile = path$1.basename(context.hostId);
|
|
10791
|
-
if (context.hostType === "js" && (hostFile
|
|
11051
|
+
if (context.hostType === "js" && (isRemoteEntryFile(hostFile) || hostFile.includes("hostInit") || hostFile.includes("localSharedImportMap"))) return [];
|
|
10792
11052
|
const hasFederationHtmlDeps = context.hostType === "html" && resolvedDeps.some((dep) => isFederationHtmlPreloadDependency(dep));
|
|
10793
11053
|
const hasFederationJsDeps = context.hostType === "js" && resolvedDeps.some((dep) => isFederationHtmlPreloadDependency(dep));
|
|
10794
11054
|
const treeShakingFallbackDeps = hasTreeShakingShared ? (dep) => dep.includes("__prebuild__") : () => false;
|
|
@@ -10827,6 +11087,10 @@ function federation(mfUserOptions) {
|
|
|
10827
11087
|
const mfChunkName = function(id) {
|
|
10828
11088
|
if (id.includes(runtimeInitId) || id.includes("__mf_v__runtimeInit__mf_v__")) return "runtimeInit";
|
|
10829
11089
|
if (id.includes("__loadShare__")) {
|
|
11090
|
+
const pkg = getCachedLoadSharePkg(id);
|
|
11091
|
+
const key = pkg && findSharedKey(pkg, shared);
|
|
11092
|
+
if (useCodeSplitting && key && shared[key].shareConfig.eager === true) return "loadShare-eager";
|
|
11093
|
+
if (key && shared[key].shareConfig.import === false) return null;
|
|
10830
11094
|
const match = id.match(/([^/\\]+__loadShare__[^/\\]+)/);
|
|
10831
11095
|
return match ? match[1] : "loadShare";
|
|
10832
11096
|
}
|
|
@@ -10935,8 +11199,8 @@ function federation(mfUserOptions) {
|
|
|
10935
11199
|
const virtualModule = VirtualModule.findById(id);
|
|
10936
11200
|
if (!virtualModule?.code) return null;
|
|
10937
11201
|
let code = virtualModule.code;
|
|
10938
|
-
const
|
|
10939
|
-
if (
|
|
11202
|
+
const consumerTarget = resolveEnvironmentConsumerTarget(this);
|
|
11203
|
+
if (consumerTarget === "server" || !consumerTarget && isSsrBuild) code = prependWorkspaceSingletonSsrImport(code);
|
|
10940
11204
|
code = code.replace(/import\s+["'][^"']*__prebuild__[^"']*["']\s*;?/g, "");
|
|
10941
11205
|
code = code.replace(/export\s+\*\s+from\s+["'][^"']*__prebuild__[^"']*["']\s*;?/g, "");
|
|
10942
11206
|
if (!(/\b(?:var|let|const)\s+__moduleExports\b/.test(code) || /\bexport\s+const\s+__moduleExports\b/.test(code) || /\bexport\s*\{[^}]*__moduleExports/.test(code))) {
|
|
@@ -11109,10 +11373,10 @@ function federation(mfUserOptions) {
|
|
|
11109
11373
|
apply: "build",
|
|
11110
11374
|
config(_config, { command }) {
|
|
11111
11375
|
const manifest = options.manifest;
|
|
11112
|
-
const getDefaultDisableAssetsAnalyze = (cfgCommand) => cfgCommand === "serve" && (typeof manifest !== "object" || !Object.
|
|
11376
|
+
const getDefaultDisableAssetsAnalyze = (cfgCommand) => cfgCommand === "serve" && (typeof manifest !== "object" || !Object.hasOwn(manifest, "disableAssetsAnalyze"));
|
|
11113
11377
|
const getConfiguredDisableAssetsAnalyze = (cfgCommand) => {
|
|
11114
11378
|
if (typeof manifest === "object" && manifest !== null) {
|
|
11115
|
-
if (Object.
|
|
11379
|
+
if (Object.hasOwn(manifest, "disableAssetsAnalyze")) return manifest.disableAssetsAnalyze === true;
|
|
11116
11380
|
}
|
|
11117
11381
|
return getDefaultDisableAssetsAnalyze(cfgCommand);
|
|
11118
11382
|
};
|