@rspack-canary/core 1.6.2-canary-939d9a81-20251109174505 → 1.6.2-canary-5409f3fc-20251110174036
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.
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
|
+
import type { Compiler } from "../Compiler";
|
|
4
|
+
export type RemoteAliasMap = Record<string, {
|
|
5
|
+
name: string;
|
|
6
|
+
entry?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type ManifestExposeOption = {
|
|
9
|
+
path: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export type ManifestSharedOption = {
|
|
13
|
+
name: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
requiredVersion?: string;
|
|
16
|
+
singleton?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ModuleFederationManifestPluginOptions = {
|
|
19
|
+
name?: string;
|
|
20
|
+
globalName?: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
disableAssetsAnalyze?: boolean;
|
|
23
|
+
fileName?: string;
|
|
24
|
+
remoteAliasMap?: RemoteAliasMap;
|
|
25
|
+
exposes?: ManifestExposeOption[];
|
|
26
|
+
shared?: ManifestSharedOption[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
|
|
30
|
+
* To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
33
|
+
name: BuiltinPluginName;
|
|
34
|
+
private opts;
|
|
35
|
+
constructor(opts: ModuleFederationManifestPluginOptions);
|
|
36
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
37
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
|
+
import { type ModuleFederationManifestPluginOptions } from "./ModuleFederationManifestPlugin";
|
|
2
3
|
import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
|
|
3
4
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
|
|
4
5
|
runtimePlugins?: RuntimePlugins;
|
|
5
6
|
implementation?: string;
|
|
6
7
|
shareStrategy?: "version-first" | "loaded-first";
|
|
8
|
+
manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, "remoteAliasMap" | "globalName" | "name" | "exposes" | "shared">;
|
|
7
9
|
}
|
|
8
10
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
9
11
|
export declare class ModuleFederationPlugin {
|
package/dist/index.js
CHANGED
|
@@ -5747,7 +5747,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5747
5747
|
}, applyExperimentsDefaults = (experiments, { development })=>{
|
|
5748
5748
|
F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "deferImport", !1), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
|
|
5749
5749
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
5750
|
-
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.2-canary-
|
|
5750
|
+
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.2-canary-5409f3fc-20251110174036"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
|
|
5751
5751
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst, deferImport })=>{
|
|
5752
5752
|
if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { usedExports, inlineConst, deferImport })=>{
|
|
5753
5753
|
D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "unknownContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "commonjs", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
|
|
@@ -7397,7 +7397,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7397
7397
|
});
|
|
7398
7398
|
}
|
|
7399
7399
|
}
|
|
7400
|
-
let CORE_VERSION = "1.6.2-canary-
|
|
7400
|
+
let CORE_VERSION = "1.6.2-canary-5409f3fc-20251110174036", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
7401
7401
|
|
|
7402
7402
|
Help:
|
|
7403
7403
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
@@ -8690,7 +8690,7 @@ Help:
|
|
|
8690
8690
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8691
8691
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8692
8692
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8693
|
-
}), childOptions.version && (obj.rspackVersion = "1.6.2-canary-
|
|
8693
|
+
}), childOptions.version && (obj.rspackVersion = "1.6.2-canary-5409f3fc-20251110174036", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
|
8694
8694
|
let mapError = (j, obj)=>({
|
|
8695
8695
|
...obj,
|
|
8696
8696
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9589,7 +9589,7 @@ Help:
|
|
|
9589
9589
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
9590
9590
|
},
|
|
9591
9591
|
version: (object)=>{
|
|
9592
|
-
object.version = "5.75.0", object.rspackVersion = "1.6.2-canary-
|
|
9592
|
+
object.version = "5.75.0", object.rspackVersion = "1.6.2-canary-5409f3fc-20251110174036";
|
|
9593
9593
|
},
|
|
9594
9594
|
env: (object, _compilation, _context, { _env })=>{
|
|
9595
9595
|
object.env = _env;
|
|
@@ -11430,6 +11430,68 @@ Help:
|
|
|
11430
11430
|
});
|
|
11431
11431
|
}
|
|
11432
11432
|
}
|
|
11433
|
+
let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
11434
|
+
function isRequiredVersion(str) {
|
|
11435
|
+
return VERSION_PATTERN_REGEXP.test(str);
|
|
11436
|
+
}
|
|
11437
|
+
let MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
|
|
11438
|
+
function isPlainObject(value) {
|
|
11439
|
+
return !!value && "object" == typeof value && !Array.isArray(value);
|
|
11440
|
+
}
|
|
11441
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
11442
|
+
name = binding_.BuiltinPluginName.ModuleFederationManifestPlugin;
|
|
11443
|
+
opts;
|
|
11444
|
+
constructor(opts){
|
|
11445
|
+
super(), this.opts = opts;
|
|
11446
|
+
}
|
|
11447
|
+
raw(compiler) {
|
|
11448
|
+
var isDev;
|
|
11449
|
+
let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = function(manifestOptions) {
|
|
11450
|
+
var name;
|
|
11451
|
+
if (!manifestOptions) return {
|
|
11452
|
+
statsFileName: STATS_FILE_NAME,
|
|
11453
|
+
manifestFileName: MANIFEST_FILE_NAME
|
|
11454
|
+
};
|
|
11455
|
+
let filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "", fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "", manifestFileName = fileName ? (name = fileName).endsWith(JSON_EXT) ? name : `${name}${JSON_EXT}` : MANIFEST_FILE_NAME, statsFileName = fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME;
|
|
11456
|
+
return {
|
|
11457
|
+
statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
|
|
11458
|
+
manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
|
|
11459
|
+
};
|
|
11460
|
+
}(this.opts), rawOptions = {
|
|
11461
|
+
name: this.opts.name,
|
|
11462
|
+
globalName: this.opts.globalName,
|
|
11463
|
+
fileName,
|
|
11464
|
+
filePath,
|
|
11465
|
+
manifestFileName,
|
|
11466
|
+
statsFileName,
|
|
11467
|
+
disableAssetsAnalyze,
|
|
11468
|
+
remoteAliasMap,
|
|
11469
|
+
exposes,
|
|
11470
|
+
shared,
|
|
11471
|
+
buildInfo: (isDev = "development" === compiler.options.mode, pkg = function(root) {
|
|
11472
|
+
let base = root ? (0, external_node_path_namespaceObject.resolve)(root) : process.cwd(), pkgPath = (0, external_node_path_namespaceObject.join)(base, "package.json");
|
|
11473
|
+
try {
|
|
11474
|
+
let content = (0, external_node_fs_namespaceObject.readFileSync)(pkgPath, "utf-8"), parsed = function(input, guard) {
|
|
11475
|
+
try {
|
|
11476
|
+
let parsed = JSON.parse(input);
|
|
11477
|
+
if (guard(parsed)) return parsed;
|
|
11478
|
+
} catch {}
|
|
11479
|
+
}(content, isPlainObject);
|
|
11480
|
+
if (parsed) {
|
|
11481
|
+
let filtered = {};
|
|
11482
|
+
for (let [key, value] of Object.entries(parsed))"string" == typeof value && (filtered[key] = value);
|
|
11483
|
+
if (Object.keys(filtered).length > 0) return filtered;
|
|
11484
|
+
}
|
|
11485
|
+
} catch {}
|
|
11486
|
+
return {};
|
|
11487
|
+
}(compiler.context || process.cwd()), buildVersion = isDev ? "local" : pkg?.version, {
|
|
11488
|
+
buildVersion: process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
11489
|
+
buildName: process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
11490
|
+
})
|
|
11491
|
+
};
|
|
11492
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
11493
|
+
}
|
|
11494
|
+
}
|
|
11433
11495
|
let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
11434
11496
|
let items = [];
|
|
11435
11497
|
var options1 = options, normalizeSimple1 = normalizeSimple, normalizeOptions1 = normalizeOptions, fn = (key, value)=>{
|
|
@@ -11449,7 +11511,63 @@ Help:
|
|
|
11449
11511
|
} else if ("object" == typeof options1) object(options1);
|
|
11450
11512
|
else throw Error("Unexpected options format");
|
|
11451
11513
|
return items;
|
|
11452
|
-
}
|
|
11514
|
+
};
|
|
11515
|
+
function getRemoteInfos(options) {
|
|
11516
|
+
if (!options.remotes) return {};
|
|
11517
|
+
let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
|
|
11518
|
+
external: Array.isArray(item) ? item : [
|
|
11519
|
+
item
|
|
11520
|
+
],
|
|
11521
|
+
shareScope: options.shareScope || "default"
|
|
11522
|
+
}), (item)=>({
|
|
11523
|
+
external: Array.isArray(item.external) ? item.external : [
|
|
11524
|
+
item.external
|
|
11525
|
+
],
|
|
11526
|
+
shareScope: item.shareScope || options.shareScope || "default"
|
|
11527
|
+
})), remoteInfos = {};
|
|
11528
|
+
for (let [key, config] of remotes)for (let external of config.external){
|
|
11529
|
+
let [externalType, externalRequest] = function(external) {
|
|
11530
|
+
let result = function(external) {
|
|
11531
|
+
if (/^[a-z0-9-]+ /.test(external)) {
|
|
11532
|
+
let idx = external.indexOf(" ");
|
|
11533
|
+
return [
|
|
11534
|
+
external.slice(0, idx),
|
|
11535
|
+
external.slice(idx + 1)
|
|
11536
|
+
];
|
|
11537
|
+
}
|
|
11538
|
+
return null;
|
|
11539
|
+
}(external);
|
|
11540
|
+
return null === result ? [
|
|
11541
|
+
remoteType,
|
|
11542
|
+
external
|
|
11543
|
+
] : result;
|
|
11544
|
+
}(external);
|
|
11545
|
+
if (remoteInfos[key] ??= [], "script" === externalType) {
|
|
11546
|
+
let [url, global] = function(urlAndGlobal) {
|
|
11547
|
+
let index = urlAndGlobal.indexOf("@");
|
|
11548
|
+
return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
|
|
11549
|
+
urlAndGlobal.substring(index + 1),
|
|
11550
|
+
urlAndGlobal.substring(0, index)
|
|
11551
|
+
];
|
|
11552
|
+
}(externalRequest);
|
|
11553
|
+
remoteInfos[key].push({
|
|
11554
|
+
alias: key,
|
|
11555
|
+
name: global,
|
|
11556
|
+
entry: url,
|
|
11557
|
+
externalType,
|
|
11558
|
+
shareScope: config.shareScope
|
|
11559
|
+
});
|
|
11560
|
+
} else remoteInfos[key].push({
|
|
11561
|
+
alias: key,
|
|
11562
|
+
name: void 0,
|
|
11563
|
+
entry: void 0,
|
|
11564
|
+
externalType,
|
|
11565
|
+
shareScope: config.shareScope
|
|
11566
|
+
});
|
|
11567
|
+
}
|
|
11568
|
+
return remoteInfos;
|
|
11569
|
+
}
|
|
11570
|
+
let compilerSet = new WeakSet();
|
|
11453
11571
|
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
11454
11572
|
enhanced;
|
|
11455
11573
|
name = binding_.BuiltinPluginName.ShareRuntimePlugin;
|
|
@@ -11461,16 +11579,14 @@ Help:
|
|
|
11461
11579
|
if (compiler1 = compiler, !compilerSet.has(compiler1)) return compiler2 = compiler, compilerSet.add(compiler2), createBuiltinPlugin(this.name, this.enhanced);
|
|
11462
11580
|
}
|
|
11463
11581
|
}
|
|
11464
|
-
let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
11465
11582
|
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
11466
11583
|
name = binding_.BuiltinPluginName.ConsumeSharedPlugin;
|
|
11467
11584
|
_options;
|
|
11468
11585
|
constructor(options){
|
|
11469
11586
|
super(), this._options = {
|
|
11470
11587
|
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
11471
|
-
var str;
|
|
11472
11588
|
if (Array.isArray(item)) throw Error("Unexpected array in options");
|
|
11473
|
-
return item !== key && (
|
|
11589
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11474
11590
|
import: key,
|
|
11475
11591
|
shareScope: options.shareScope || "default",
|
|
11476
11592
|
shareKey: key,
|
|
@@ -11558,9 +11674,8 @@ Help:
|
|
|
11558
11674
|
_enhanced;
|
|
11559
11675
|
constructor(options){
|
|
11560
11676
|
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
11561
|
-
var str;
|
|
11562
11677
|
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11563
|
-
return item !== key && (
|
|
11678
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11564
11679
|
import: key,
|
|
11565
11680
|
requiredVersion: item
|
|
11566
11681
|
} : {
|
|
@@ -11693,7 +11808,7 @@ Help:
|
|
|
11693
11808
|
let _options = JSON.stringify(options || {});
|
|
11694
11809
|
return binding_default().transform(source, _options);
|
|
11695
11810
|
}
|
|
11696
|
-
let exports_rspackVersion = "1.6.2-canary-
|
|
11811
|
+
let exports_rspackVersion = "1.6.2-canary-5409f3fc-20251110174036", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
|
11697
11812
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
11698
11813
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
11699
11814
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -11754,67 +11869,13 @@ Help:
|
|
|
11754
11869
|
bundlerRuntime: bundlerRuntimePath,
|
|
11755
11870
|
runtime: runtimePath
|
|
11756
11871
|
});
|
|
11757
|
-
compiler.options.resolve.alias = {
|
|
11872
|
+
if (compiler.options.resolve.alias = {
|
|
11758
11873
|
"@module-federation/runtime-tools": paths.runtimeTools,
|
|
11759
11874
|
"@module-federation/runtime": paths.runtime,
|
|
11760
11875
|
...compiler.options.resolve.alias
|
|
11761
11876
|
}, new ModuleFederationRuntimePlugin({
|
|
11762
11877
|
entryRuntime: function(paths, options, compiler) {
|
|
11763
|
-
let runtimePlugins = options.runtimePlugins ?? [], remoteInfos =
|
|
11764
|
-
if (!options.remotes) return {};
|
|
11765
|
-
let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
|
|
11766
|
-
external: Array.isArray(item) ? item : [
|
|
11767
|
-
item
|
|
11768
|
-
],
|
|
11769
|
-
shareScope: options.shareScope || "default"
|
|
11770
|
-
}), (item)=>({
|
|
11771
|
-
external: Array.isArray(item.external) ? item.external : [
|
|
11772
|
-
item.external
|
|
11773
|
-
],
|
|
11774
|
-
shareScope: item.shareScope || options.shareScope || "default"
|
|
11775
|
-
})), remoteInfos = {};
|
|
11776
|
-
for (let [key, config] of remotes)for (let external of config.external){
|
|
11777
|
-
let [externalType, externalRequest] = function(external) {
|
|
11778
|
-
let result = function(external) {
|
|
11779
|
-
if (/^[a-z0-9-]+ /.test(external)) {
|
|
11780
|
-
let idx = external.indexOf(" ");
|
|
11781
|
-
return [
|
|
11782
|
-
external.slice(0, idx),
|
|
11783
|
-
external.slice(idx + 1)
|
|
11784
|
-
];
|
|
11785
|
-
}
|
|
11786
|
-
return null;
|
|
11787
|
-
}(external);
|
|
11788
|
-
return null === result ? [
|
|
11789
|
-
remoteType,
|
|
11790
|
-
external
|
|
11791
|
-
] : result;
|
|
11792
|
-
}(external);
|
|
11793
|
-
if (remoteInfos[key] ??= [], "script" === externalType) {
|
|
11794
|
-
let [url, global] = function(urlAndGlobal) {
|
|
11795
|
-
let index = urlAndGlobal.indexOf("@");
|
|
11796
|
-
return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
|
|
11797
|
-
urlAndGlobal.substring(index + 1),
|
|
11798
|
-
urlAndGlobal.substring(0, index)
|
|
11799
|
-
];
|
|
11800
|
-
}(externalRequest);
|
|
11801
|
-
remoteInfos[key].push({
|
|
11802
|
-
alias: key,
|
|
11803
|
-
name: global,
|
|
11804
|
-
entry: url,
|
|
11805
|
-
externalType,
|
|
11806
|
-
shareScope: config.shareScope
|
|
11807
|
-
});
|
|
11808
|
-
} else remoteInfos[key].push({
|
|
11809
|
-
alias: key,
|
|
11810
|
-
name: void 0,
|
|
11811
|
-
entry: void 0,
|
|
11812
|
-
externalType,
|
|
11813
|
-
shareScope: config.shareScope
|
|
11814
|
-
});
|
|
11815
|
-
}
|
|
11816
|
-
return remoteInfos;
|
|
11817
|
-
}(options), runtimePluginImports = [], runtimePluginVars = [];
|
|
11878
|
+
let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [];
|
|
11818
11879
|
for(let i = 0; i < runtimePlugins.length; i++){
|
|
11819
11880
|
let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
|
|
11820
11881
|
runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
|
|
@@ -11835,7 +11896,74 @@ Help:
|
|
|
11835
11896
|
}).apply(compiler), new webpack.container.ModuleFederationPluginV1({
|
|
11836
11897
|
...this._options,
|
|
11837
11898
|
enhanced: !0
|
|
11838
|
-
}).apply(compiler)
|
|
11899
|
+
}).apply(compiler), this._options.manifest) {
|
|
11900
|
+
let manifestOptions = !0 === this._options.manifest ? {} : {
|
|
11901
|
+
...this._options.manifest
|
|
11902
|
+
}, containerName = manifestOptions.name ?? this._options.name, globalName = manifestOptions.globalName ?? function(library) {
|
|
11903
|
+
if (!library) return;
|
|
11904
|
+
let libName = library.name;
|
|
11905
|
+
if (libName) {
|
|
11906
|
+
if ("string" == typeof libName) return libName;
|
|
11907
|
+
if (Array.isArray(libName)) return libName[0];
|
|
11908
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
11909
|
+
}
|
|
11910
|
+
}(this._options.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
11911
|
+
if (cur[1].length > 1) return sum;
|
|
11912
|
+
let { entry, alias, name } = cur[1][0];
|
|
11913
|
+
return entry && name && (sum[alias] = {
|
|
11914
|
+
name,
|
|
11915
|
+
entry
|
|
11916
|
+
}), sum;
|
|
11917
|
+
}, {}), manifestExposes = function(exposes) {
|
|
11918
|
+
if (!exposes) return;
|
|
11919
|
+
let result = parseOptions(exposes, (value, key)=>({
|
|
11920
|
+
import: Array.isArray(value) ? value : [
|
|
11921
|
+
value
|
|
11922
|
+
],
|
|
11923
|
+
name: void 0
|
|
11924
|
+
}), (value)=>({
|
|
11925
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
11926
|
+
value.import
|
|
11927
|
+
],
|
|
11928
|
+
name: value.name ?? void 0
|
|
11929
|
+
})).map(([exposeKey, info])=>{
|
|
11930
|
+
let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
11931
|
+
return {
|
|
11932
|
+
path: exposeKey,
|
|
11933
|
+
name: exposeName
|
|
11934
|
+
};
|
|
11935
|
+
});
|
|
11936
|
+
return result.length > 0 ? result : void 0;
|
|
11937
|
+
}(this._options.exposes);
|
|
11938
|
+
void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes);
|
|
11939
|
+
let manifestShared = function(shared) {
|
|
11940
|
+
if (!shared) return;
|
|
11941
|
+
let result = parseOptions(shared, (item, key)=>{
|
|
11942
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11943
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11944
|
+
import: key,
|
|
11945
|
+
requiredVersion: item
|
|
11946
|
+
} : {
|
|
11947
|
+
import: item
|
|
11948
|
+
};
|
|
11949
|
+
}, (item)=>item).map(([key, config])=>{
|
|
11950
|
+
let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
|
|
11951
|
+
return {
|
|
11952
|
+
name,
|
|
11953
|
+
version,
|
|
11954
|
+
requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
|
|
11955
|
+
singleton: config.singleton
|
|
11956
|
+
};
|
|
11957
|
+
});
|
|
11958
|
+
return result.length > 0 ? result : void 0;
|
|
11959
|
+
}(this._options.shared);
|
|
11960
|
+
void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), new ModuleFederationManifestPlugin({
|
|
11961
|
+
...manifestOptions,
|
|
11962
|
+
name: containerName,
|
|
11963
|
+
globalName,
|
|
11964
|
+
remoteAliasMap
|
|
11965
|
+
}).apply(compiler);
|
|
11966
|
+
}
|
|
11839
11967
|
}
|
|
11840
11968
|
},
|
|
11841
11969
|
ModuleFederationPluginV1: class {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/core",
|
|
3
|
-
"version": "1.6.2-canary-
|
|
3
|
+
"version": "1.6.2-canary-5409f3fc-20251110174036",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@module-federation/runtime-tools": "0.21.2",
|
|
60
60
|
"@rspack/lite-tapable": "1.0.1",
|
|
61
|
-
"@rspack/binding": "npm:@rspack-canary/binding@1.6.2-canary-
|
|
61
|
+
"@rspack/binding": "npm:@rspack-canary/binding@1.6.2-canary-5409f3fc-20251110174036"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@swc/helpers": ">=0.5.1"
|