@rspack-canary/core 1.7.0-canary-e20de023-20251223174329 → 1.7.0-canary-c8f933e3-20251224124051
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Compiler.d.ts +0 -3
- package/dist/builtin-loader/swc/types.d.ts +0 -6
- package/dist/builtin-plugin/{CaseSensitivePlugin.d.ts → WarnCaseSensitiveModulesPlugin.d.ts} +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -1
- package/dist/config/defaults.d.ts +1 -10
- package/dist/config/normalization.d.ts +4 -0
- package/dist/config/target.d.ts +6 -6
- package/dist/config/types.d.ts +5 -1
- package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
- package/dist/container/ModuleFederationPlugin.d.ts +16 -1
- package/dist/exports.d.ts +4 -5
- package/dist/index.js +730 -353
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/rspack.d.ts +0 -9
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +16 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +19 -0
- package/dist/sharing/SharePlugin.d.ts +36 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakeSharedPlugin.d.ts +19 -0
- package/dist/sharing/utils.d.ts +1 -0
- package/dist/util/index.d.ts +0 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -288,7 +288,7 @@ for(var __rspack_i in (()=>{
|
|
|
288
288
|
SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
|
|
289
289
|
ContextModule: ()=>binding_.ContextModule,
|
|
290
290
|
DllPlugin: ()=>DllPlugin,
|
|
291
|
-
WarnCaseSensitiveModulesPlugin: ()=>
|
|
291
|
+
WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
|
|
292
292
|
ProvidePlugin: ()=>ProvidePlugin,
|
|
293
293
|
Template: ()=>Template,
|
|
294
294
|
container: ()=>container,
|
|
@@ -330,10 +330,9 @@ for(var __rspack_i in (()=>{
|
|
|
330
330
|
ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
|
|
331
331
|
MultiCompiler: ()=>MultiCompiler,
|
|
332
332
|
SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
|
|
333
|
-
CaseSensitivePlugin: ()=>CaseSensitivePlugin,
|
|
334
333
|
SubresourceIntegrityPlugin: ()=>SubresourceIntegrityPlugin,
|
|
335
|
-
RuntimeGlobals: ()=>DefaultRuntimeGlobals,
|
|
336
334
|
library: ()=>exports_library,
|
|
335
|
+
RuntimeGlobals: ()=>DefaultRuntimeGlobals,
|
|
337
336
|
node: ()=>exports_node,
|
|
338
337
|
rspackVersion: ()=>exports_rspackVersion,
|
|
339
338
|
util: ()=>util,
|
|
@@ -361,7 +360,6 @@ for(var __rspack_i in (()=>{
|
|
|
361
360
|
__webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_namespaceObject, {
|
|
362
361
|
AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
|
|
363
362
|
BannerPlugin: ()=>BannerPlugin,
|
|
364
|
-
CaseSensitivePlugin: ()=>CaseSensitivePlugin,
|
|
365
363
|
CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
|
|
366
364
|
Compilation: ()=>Compilation,
|
|
367
365
|
Compiler: ()=>Compiler,
|
|
@@ -409,7 +407,7 @@ for(var __rspack_i in (()=>{
|
|
|
409
407
|
SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
|
|
410
408
|
Template: ()=>Template,
|
|
411
409
|
ValidationError: ()=>ValidationError,
|
|
412
|
-
WarnCaseSensitiveModulesPlugin: ()=>
|
|
410
|
+
WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
|
|
413
411
|
WebpackError: ()=>exports_WebpackError,
|
|
414
412
|
WebpackOptionsApply: ()=>RspackOptionsApply,
|
|
415
413
|
config: ()=>exports_config,
|
|
@@ -2044,7 +2042,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2044
2042
|
version: options.version || "unknown",
|
|
2045
2043
|
bundler: options.bundler || "rspack",
|
|
2046
2044
|
force: options.force ?? !0
|
|
2047
|
-
})),
|
|
2045
|
+
})), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
|
|
2048
2046
|
class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
|
|
2049
2047
|
name = binding_.BuiltinPluginName.CircularDependencyRspackPlugin;
|
|
2050
2048
|
_options;
|
|
@@ -2337,13 +2335,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
2337
2335
|
return o.path + o.query + o.fragment;
|
|
2338
2336
|
}
|
|
2339
2337
|
let unsupported = (name, issue)=>{
|
|
2340
|
-
let s = `${name} is not supported by
|
|
2341
|
-
throw issue && (s += `
|
|
2342
|
-
},
|
|
2343
|
-
function deprecate(message) {
|
|
2344
|
-
warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
|
|
2345
|
-
}
|
|
2346
|
-
let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
2338
|
+
let s = `${name} is not supported by rspack.`;
|
|
2339
|
+
throw issue && (s += ` Please refer to issue ${issue} for more information.`), Error(s);
|
|
2340
|
+
}, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
2347
2341
|
if ("/" === maybeAbsolutePath[0]) {
|
|
2348
2342
|
if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
2349
2343
|
let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
@@ -2427,12 +2421,6 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
2427
2421
|
query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
|
|
2428
2422
|
};
|
|
2429
2423
|
});
|
|
2430
|
-
function resolveCollectTypeScriptInfo(options) {
|
|
2431
|
-
return {
|
|
2432
|
-
typeExports: options.typeExports,
|
|
2433
|
-
exportedEnum: !0 === options.exportedEnum ? "all" : !1 === options.exportedEnum || void 0 === options.exportedEnum ? "none" : "const-only"
|
|
2434
|
-
};
|
|
2435
|
-
}
|
|
2436
2424
|
function toFeatures(featureOptions) {
|
|
2437
2425
|
let feature = 0;
|
|
2438
2426
|
for (let key of Reflect.ownKeys(featureOptions))if (!0 === featureOptions[key]) switch(key){
|
|
@@ -3730,27 +3718,33 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
3730
3718
|
let temp = function(identifier, o, options) {
|
|
3731
3719
|
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((options, _)=>{
|
|
3732
3720
|
if (options && "object" == typeof options) {
|
|
3733
|
-
options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0
|
|
3721
|
+
options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0;
|
|
3734
3722
|
let { rspackExperiments } = options;
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3723
|
+
if (rspackExperiments) {
|
|
3724
|
+
var options1;
|
|
3725
|
+
(rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
|
|
3726
|
+
if (pluginImport) return pluginImport.map((config)=>{
|
|
3727
|
+
let rawConfig = {
|
|
3728
|
+
...config,
|
|
3729
|
+
style: {}
|
|
3730
|
+
};
|
|
3731
|
+
if ("boolean" == typeof config.style) rawConfig.style.bool = config.style;
|
|
3732
|
+
else if ("string" == typeof config.style) {
|
|
3733
|
+
let isTpl = config.style.includes("{{");
|
|
3734
|
+
rawConfig.style[isTpl ? "custom" : "css"] = config.style;
|
|
3735
|
+
} else {
|
|
3736
|
+
var val;
|
|
3737
|
+
val = config.style, "[object Object]" === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
|
|
3738
|
+
}
|
|
3739
|
+
return config.styleLibraryDirectory && (rawConfig.style = {
|
|
3740
|
+
styleLibraryDirectory: config.styleLibraryDirectory
|
|
3741
|
+
}), rawConfig;
|
|
3742
|
+
});
|
|
3743
|
+
}(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (rspackExperiments.collectTypeScriptInfo = {
|
|
3744
|
+
typeExports: (options1 = rspackExperiments.collectTypeScriptInfo).typeExports,
|
|
3745
|
+
exportedEnum: !0 === options1.exportedEnum ? "all" : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? "none" : "const-only"
|
|
3752
3746
|
});
|
|
3753
|
-
}
|
|
3747
|
+
}
|
|
3754
3748
|
}
|
|
3755
3749
|
return options;
|
|
3756
3750
|
})(o, 0);
|
|
@@ -4468,9 +4462,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4468
4462
|
"function" == typeof next && next();
|
|
4469
4463
|
}, DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN = "The `experiments.lazyCompilation` option is deprecated, please use the configuration top level `lazyCompilation` instead.", REPEAT_LAZY_COMPILATION_OPTIONS_WARN = "Both top-level `lazyCompilation` and `experiments.lazyCompilation` options are set. The top-level `lazyCompilation` configuration will take precedence.", lazyCompilationMiddleware = (compiler)=>{
|
|
4470
4464
|
if (compiler instanceof MultiCompiler) {
|
|
4471
|
-
let middlewareByCompiler = new Map(), i = 0;
|
|
4465
|
+
let middlewareByCompiler = new Map(), i = 0, isReportDeprecatedWarned = !1, isReportRepeatWarned = !1;
|
|
4472
4466
|
for (let c of compiler.compilers){
|
|
4473
|
-
if (c.options.experiments.lazyCompilation && (c.name ?
|
|
4467
|
+
if (c.options.experiments.lazyCompilation && (c.name ? console.warn(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`) : isReportDeprecatedWarned || (console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), isReportDeprecatedWarned = !0)), c.options.lazyCompilation && c.options.experiments.lazyCompilation && (c.name ? console.warn(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`) : isReportRepeatWarned || (console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN), isReportRepeatWarned = !0)), !c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
|
|
4474
4468
|
let options = {
|
|
4475
4469
|
...c.options.experiments.lazyCompilation,
|
|
4476
4470
|
...c.options.lazyCompilation
|
|
@@ -4489,7 +4483,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4489
4483
|
return middleware?.(req, res, next);
|
|
4490
4484
|
};
|
|
4491
4485
|
}
|
|
4492
|
-
if (compiler.options.experiments.lazyCompilation && (
|
|
4486
|
+
if (compiler.options.experiments.lazyCompilation && (console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), compiler.options.lazyCompilation && console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
|
|
4493
4487
|
let activeModules = new Set(), options = {
|
|
4494
4488
|
...compiler.options.experiments.lazyCompilation,
|
|
4495
4489
|
...compiler.options.lazyCompilation
|
|
@@ -4869,7 +4863,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4869
4863
|
module: options?.minimizerOptions?.module
|
|
4870
4864
|
}
|
|
4871
4865
|
};
|
|
4872
|
-
}, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation");
|
|
4866
|
+
}, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation"), WarnCaseSensitiveModulesPlugin = base_create(binding_.BuiltinPluginName.WarnCaseSensitiveModulesPlugin, ()=>{}, "compilation");
|
|
4873
4867
|
class WebWorkerTemplatePlugin extends RspackBuiltinPlugin {
|
|
4874
4868
|
name = binding_.BuiltinPluginName.WebWorkerTemplatePlugin;
|
|
4875
4869
|
raw(compiler) {
|
|
@@ -5788,7 +5782,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5788
5782
|
if ("function" != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], "import", ()=>[
|
|
5789
5783
|
"./src"
|
|
5790
5784
|
]);
|
|
5791
|
-
|
|
5785
|
+
F(options, "devtool", ()=>!!development && "eval"), D(options, "watch", !1), D(options, "profile", !1), F(options, "lazyCompilation", ()=>!!targetProperties && !!targetProperties.web && !targetProperties.electron && !targetProperties.node && !targetProperties.nwjs && {
|
|
5792
5786
|
imports: !0,
|
|
5793
5787
|
entries: !1
|
|
5794
5788
|
}), D(options, "bail", !1), F(options, "cache", ()=>development), !1 === options.cache && (options.experiments.cache = !1), applyExperimentsDefaults(options.experiments, {
|
|
@@ -5830,24 +5824,15 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5830
5824
|
targetProperties,
|
|
5831
5825
|
mode: options.mode,
|
|
5832
5826
|
css: options.experiments.css
|
|
5833
|
-
}), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader)
|
|
5834
|
-
platform: !1 === targetProperties ? targetProperties : {
|
|
5835
|
-
web: targetProperties.web,
|
|
5836
|
-
browser: targetProperties.browser,
|
|
5837
|
-
webworker: targetProperties.webworker,
|
|
5838
|
-
node: targetProperties.node,
|
|
5839
|
-
nwjs: targetProperties.nwjs,
|
|
5840
|
-
electron: targetProperties.electron
|
|
5841
|
-
}
|
|
5842
|
-
};
|
|
5827
|
+
}), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader);
|
|
5843
5828
|
}, applyInfrastructureLoggingDefaults = (infrastructureLogging)=>{
|
|
5844
5829
|
F(infrastructureLogging, "stream", ()=>process.stderr);
|
|
5845
5830
|
let tty = infrastructureLogging.stream?.isTTY && "dumb" !== process.env.TERM;
|
|
5846
5831
|
D(infrastructureLogging, "level", "info"), D(infrastructureLogging, "debug", !1), D(infrastructureLogging, "colors", tty), D(infrastructureLogging, "appendOnly", !tty);
|
|
5847
5832
|
}, applyExperimentsDefaults = (experiments, { development })=>{
|
|
5848
|
-
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, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !0), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
|
|
5833
|
+
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", !0), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
|
|
5849
5834
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
5850
|
-
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-
|
|
5835
|
+
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-c8f933e3-20251224124051"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
|
|
5851
5836
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, deferImport })=>{
|
|
5852
5837
|
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, { deferImport })=>{
|
|
5853
5838
|
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", [
|
|
@@ -6327,7 +6312,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6327
6312
|
main: {}
|
|
6328
6313
|
} : "function" == typeof config.entry ? (fn = config.entry, ()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic)) : getNormalizedEntryStatic(config.entry),
|
|
6329
6314
|
output: nestedConfig(config.output, (output)=>{
|
|
6330
|
-
"cssHeadDataCompression" in output && deprecate("cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future");
|
|
6315
|
+
"cssHeadDataCompression" in output && external_node_util_default().deprecate(()=>{}, "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future")();
|
|
6331
6316
|
let { library } = output, libraryBase = "object" == typeof library && library && !Array.isArray(library) && "type" in library ? library : library || output.libraryTarget ? {
|
|
6332
6317
|
name: library
|
|
6333
6318
|
} : void 0;
|
|
@@ -6466,7 +6451,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6466
6451
|
plugins: nestedArray(config.plugins, (p)=>[
|
|
6467
6452
|
...p
|
|
6468
6453
|
]),
|
|
6469
|
-
experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers && deprecate("`experiments.layers` config
|
|
6454
|
+
experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers && external_node_util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")(), !1 === experiments.topLevelAwait && external_node_util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")(), experiments.parallelCodeSplitting && external_node_util_default().deprecate(()=>{}, "`experiments.parallelCodeSplitting` config has been deprecated and will be removed in next minor. It has huge regression in some edge cases where the chunk graph has lots of cycles, we'll improve the performance of build_chunk_graph in the future instead")(), experiments.lazyBarrel && external_node_util_default().deprecate(()=>{}, "`experiments.lazyBarrel` config has been deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Please remove this option from your Rspack configuration.")(), experiments.inlineConst && external_node_util_default().deprecate(()=>{}, "`experiments.inlineConst` config has been deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Please remove this option from your Rspack configuration.")(), experiments.inlineEnum && external_node_util_default().deprecate(()=>{}, "`experiments.inlineEnum` config has been deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Please remove this option from your Rspack configuration.")(), experiments.typeReexportsPresence && external_node_util_default().deprecate(()=>{}, "`experiments.typeReexportsPresence` config has been deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Please remove this option from your Rspack configuration.")(), {
|
|
6470
6455
|
...experiments,
|
|
6471
6456
|
cache: optionalNestedConfig(experiments.cache, (cache)=>{
|
|
6472
6457
|
if ("boolean" == typeof cache || "memory" === cache.type) return cache;
|
|
@@ -6496,6 +6481,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6496
6481
|
}),
|
|
6497
6482
|
lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, (options)=>!0 === options ? {} : options),
|
|
6498
6483
|
incremental: optionalNestedConfig(experiments.incremental, (options)=>getNormalizedIncrementalOptions(options)),
|
|
6484
|
+
parallelCodeSplitting: experiments.parallelCodeSplitting,
|
|
6499
6485
|
buildHttp: experiments.buildHttp,
|
|
6500
6486
|
parallelLoader: experiments.parallelLoader,
|
|
6501
6487
|
useInputFileSystem: experiments.useInputFileSystem
|
|
@@ -7613,7 +7599,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7613
7599
|
});
|
|
7614
7600
|
}
|
|
7615
7601
|
}
|
|
7616
|
-
let CORE_VERSION = "1.7.0-canary-
|
|
7602
|
+
let CORE_VERSION = "1.7.0-canary-c8f933e3-20251224124051", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
7617
7603
|
|
|
7618
7604
|
Help:
|
|
7619
7605
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
@@ -7913,7 +7899,6 @@ Help:
|
|
|
7913
7899
|
context;
|
|
7914
7900
|
cache;
|
|
7915
7901
|
compilerPath;
|
|
7916
|
-
#platform;
|
|
7917
7902
|
options;
|
|
7918
7903
|
unsafeFastDrop = !1;
|
|
7919
7904
|
__internal_browser_require;
|
|
@@ -8012,14 +7997,7 @@ Help:
|
|
|
8012
7997
|
}, this.rspack = {
|
|
8013
7998
|
...src_rspack_0,
|
|
8014
7999
|
RuntimeGlobals: compilerRuntimeGlobals
|
|
8015
|
-
}, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this
|
|
8016
|
-
web: null,
|
|
8017
|
-
browser: null,
|
|
8018
|
-
webworker: null,
|
|
8019
|
-
node: null,
|
|
8020
|
-
nwjs: null,
|
|
8021
|
-
electron: null
|
|
8022
|
-
}, this.__internal_browser_require = ()=>{
|
|
8000
|
+
}, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.__internal_browser_require = ()=>{
|
|
8023
8001
|
throw Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
|
|
8024
8002
|
}, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this);
|
|
8025
8003
|
}
|
|
@@ -8038,12 +8016,6 @@ Help:
|
|
|
8038
8016
|
get _lastCompilation() {
|
|
8039
8017
|
return this.#compilation;
|
|
8040
8018
|
}
|
|
8041
|
-
get platform() {
|
|
8042
|
-
return this.#platform;
|
|
8043
|
-
}
|
|
8044
|
-
set platform(platform) {
|
|
8045
|
-
this.#platform = platform;
|
|
8046
|
-
}
|
|
8047
8019
|
get __internal__builtinPlugins() {
|
|
8048
8020
|
return this.#builtinPlugins;
|
|
8049
8021
|
}
|
|
@@ -8310,7 +8282,7 @@ Help:
|
|
|
8310
8282
|
this.#registers = this.#createHooksRegisters();
|
|
8311
8283
|
let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options1.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
|
|
8312
8284
|
try {
|
|
8313
|
-
this.#instance = new instanceBinding.JsCompiler(this.compilerPath, rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop
|
|
8285
|
+
this.#instance = new instanceBinding.JsCompiler(this.compilerPath, rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop), callback(null, this.#instance);
|
|
8314
8286
|
} catch (err) {
|
|
8315
8287
|
err instanceof Error && delete err.stack, callback(Error("Failed to create Rspack compiler instance, check the Rspack configuration.", {
|
|
8316
8288
|
cause: err
|
|
@@ -8936,7 +8908,7 @@ Help:
|
|
|
8936
8908
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8937
8909
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8938
8910
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8939
|
-
}), childOptions.version && (obj.rspackVersion = "1.7.0-canary-
|
|
8911
|
+
}), childOptions.version && (obj.rspackVersion = "1.7.0-canary-c8f933e3-20251224124051", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
|
8940
8912
|
let mapError = (j, obj)=>({
|
|
8941
8913
|
...obj,
|
|
8942
8914
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9846,7 +9818,7 @@ Help:
|
|
|
9846
9818
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
9847
9819
|
},
|
|
9848
9820
|
version: (object)=>{
|
|
9849
|
-
object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-
|
|
9821
|
+
object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-c8f933e3-20251224124051";
|
|
9850
9822
|
},
|
|
9851
9823
|
env: (object, _compilation, _context, { _env })=>{
|
|
9852
9824
|
object.env = _env;
|
|
@@ -11687,69 +11659,7 @@ Help:
|
|
|
11687
11659
|
});
|
|
11688
11660
|
}
|
|
11689
11661
|
}
|
|
11690
|
-
let
|
|
11691
|
-
function isRequiredVersion(str) {
|
|
11692
|
-
return VERSION_PATTERN_REGEXP.test(str);
|
|
11693
|
-
}
|
|
11694
|
-
let MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
|
|
11695
|
-
function isPlainObject(value) {
|
|
11696
|
-
return !!value && "object" == typeof value && !Array.isArray(value);
|
|
11697
|
-
}
|
|
11698
|
-
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
11699
|
-
name = binding_.BuiltinPluginName.ModuleFederationManifestPlugin;
|
|
11700
|
-
opts;
|
|
11701
|
-
constructor(opts){
|
|
11702
|
-
super(), this.opts = opts;
|
|
11703
|
-
}
|
|
11704
|
-
raw(compiler) {
|
|
11705
|
-
var isDev;
|
|
11706
|
-
let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = function(manifestOptions) {
|
|
11707
|
-
var name;
|
|
11708
|
-
if (!manifestOptions) return {
|
|
11709
|
-
statsFileName: STATS_FILE_NAME,
|
|
11710
|
-
manifestFileName: MANIFEST_FILE_NAME
|
|
11711
|
-
};
|
|
11712
|
-
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;
|
|
11713
|
-
return {
|
|
11714
|
-
statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
|
|
11715
|
-
manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
|
|
11716
|
-
};
|
|
11717
|
-
}(this.opts), rawOptions = {
|
|
11718
|
-
name: this.opts.name,
|
|
11719
|
-
globalName: this.opts.globalName,
|
|
11720
|
-
fileName,
|
|
11721
|
-
filePath,
|
|
11722
|
-
manifestFileName,
|
|
11723
|
-
statsFileName,
|
|
11724
|
-
disableAssetsAnalyze,
|
|
11725
|
-
remoteAliasMap,
|
|
11726
|
-
exposes,
|
|
11727
|
-
shared,
|
|
11728
|
-
buildInfo: (isDev = "development" === compiler.options.mode, pkg = function(root) {
|
|
11729
|
-
let base = root ? (0, external_node_path_namespaceObject.resolve)(root) : process.cwd(), pkgPath = (0, external_node_path_namespaceObject.join)(base, "package.json");
|
|
11730
|
-
try {
|
|
11731
|
-
let content = (0, external_node_fs_namespaceObject.readFileSync)(pkgPath, "utf-8"), parsed = function(input, guard) {
|
|
11732
|
-
try {
|
|
11733
|
-
let parsed = JSON.parse(input);
|
|
11734
|
-
if (guard(parsed)) return parsed;
|
|
11735
|
-
} catch {}
|
|
11736
|
-
}(content, isPlainObject);
|
|
11737
|
-
if (parsed) {
|
|
11738
|
-
let filtered = {};
|
|
11739
|
-
for (let [key, value] of Object.entries(parsed))"string" == typeof value && (filtered[key] = value);
|
|
11740
|
-
if (Object.keys(filtered).length > 0) return filtered;
|
|
11741
|
-
}
|
|
11742
|
-
} catch {}
|
|
11743
|
-
return {};
|
|
11744
|
-
}(compiler.context || process.cwd()), buildVersion = isDev ? "local" : pkg?.version, {
|
|
11745
|
-
buildVersion: process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
11746
|
-
buildName: process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
11747
|
-
})
|
|
11748
|
-
};
|
|
11749
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
11750
|
-
}
|
|
11751
|
-
}
|
|
11752
|
-
let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
11662
|
+
let parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
11753
11663
|
let items = [];
|
|
11754
11664
|
var options1 = options, normalizeSimple1 = normalizeSimple, normalizeOptions1 = normalizeOptions, fn = (key, value)=>{
|
|
11755
11665
|
items.push([
|
|
@@ -11768,63 +11678,7 @@ Help:
|
|
|
11768
11678
|
} else if ("object" == typeof options1) object(options1);
|
|
11769
11679
|
else throw Error("Unexpected options format");
|
|
11770
11680
|
return items;
|
|
11771
|
-
};
|
|
11772
|
-
function getRemoteInfos(options) {
|
|
11773
|
-
if (!options.remotes) return {};
|
|
11774
|
-
let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
|
|
11775
|
-
external: Array.isArray(item) ? item : [
|
|
11776
|
-
item
|
|
11777
|
-
],
|
|
11778
|
-
shareScope: options.shareScope || "default"
|
|
11779
|
-
}), (item)=>({
|
|
11780
|
-
external: Array.isArray(item.external) ? item.external : [
|
|
11781
|
-
item.external
|
|
11782
|
-
],
|
|
11783
|
-
shareScope: item.shareScope || options.shareScope || "default"
|
|
11784
|
-
})), remoteInfos = {};
|
|
11785
|
-
for (let [key, config] of remotes)for (let external of config.external){
|
|
11786
|
-
let [externalType, externalRequest] = function(external) {
|
|
11787
|
-
let result = function(external) {
|
|
11788
|
-
if (/^[a-z0-9-]+ /.test(external)) {
|
|
11789
|
-
let idx = external.indexOf(" ");
|
|
11790
|
-
return [
|
|
11791
|
-
external.slice(0, idx),
|
|
11792
|
-
external.slice(idx + 1)
|
|
11793
|
-
];
|
|
11794
|
-
}
|
|
11795
|
-
return null;
|
|
11796
|
-
}(external);
|
|
11797
|
-
return null === result ? [
|
|
11798
|
-
remoteType,
|
|
11799
|
-
external
|
|
11800
|
-
] : result;
|
|
11801
|
-
}(external);
|
|
11802
|
-
if (remoteInfos[key] ??= [], "script" === externalType) {
|
|
11803
|
-
let [url, global] = function(urlAndGlobal) {
|
|
11804
|
-
let index = urlAndGlobal.indexOf("@");
|
|
11805
|
-
return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
|
|
11806
|
-
urlAndGlobal.substring(index + 1),
|
|
11807
|
-
urlAndGlobal.substring(0, index)
|
|
11808
|
-
];
|
|
11809
|
-
}(externalRequest);
|
|
11810
|
-
remoteInfos[key].push({
|
|
11811
|
-
alias: key,
|
|
11812
|
-
name: global,
|
|
11813
|
-
entry: url,
|
|
11814
|
-
externalType,
|
|
11815
|
-
shareScope: config.shareScope
|
|
11816
|
-
});
|
|
11817
|
-
} else remoteInfos[key].push({
|
|
11818
|
-
alias: key,
|
|
11819
|
-
name: void 0,
|
|
11820
|
-
entry: void 0,
|
|
11821
|
-
externalType,
|
|
11822
|
-
shareScope: config.shareScope
|
|
11823
|
-
});
|
|
11824
|
-
}
|
|
11825
|
-
return remoteInfos;
|
|
11826
|
-
}
|
|
11827
|
-
let compilerSet = new WeakSet();
|
|
11681
|
+
}, compilerSet = new WeakSet();
|
|
11828
11682
|
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
11829
11683
|
enhanced;
|
|
11830
11684
|
name = binding_.BuiltinPluginName.ShareRuntimePlugin;
|
|
@@ -11836,42 +11690,55 @@ Help:
|
|
|
11836
11690
|
if (compiler1 = compiler, !compilerSet.has(compiler1)) return compiler2 = compiler, compilerSet.add(compiler2), createBuiltinPlugin(this.name, this.enhanced);
|
|
11837
11691
|
}
|
|
11838
11692
|
}
|
|
11693
|
+
let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
11694
|
+
function isRequiredVersion(str) {
|
|
11695
|
+
return VERSION_PATTERN_REGEXP.test(str);
|
|
11696
|
+
}
|
|
11697
|
+
let encodeName = function(name, prefix = "", withExt = !1) {
|
|
11698
|
+
return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${withExt ? ".js" : ""}`;
|
|
11699
|
+
};
|
|
11700
|
+
function normalizeConsumeShareOptions(consumes, shareScope) {
|
|
11701
|
+
return parseOptions(consumes, (item, key)=>{
|
|
11702
|
+
if (Array.isArray(item)) throw Error("Unexpected array in options");
|
|
11703
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11704
|
+
import: key,
|
|
11705
|
+
shareScope: shareScope || "default",
|
|
11706
|
+
shareKey: key,
|
|
11707
|
+
requiredVersion: item,
|
|
11708
|
+
strictVersion: !0,
|
|
11709
|
+
packageName: void 0,
|
|
11710
|
+
singleton: !1,
|
|
11711
|
+
eager: !1,
|
|
11712
|
+
treeshakeStrategy: void 0
|
|
11713
|
+
} : {
|
|
11714
|
+
import: key,
|
|
11715
|
+
shareScope: shareScope || "default",
|
|
11716
|
+
shareKey: key,
|
|
11717
|
+
requiredVersion: void 0,
|
|
11718
|
+
packageName: void 0,
|
|
11719
|
+
strictVersion: !1,
|
|
11720
|
+
singleton: !1,
|
|
11721
|
+
eager: !1,
|
|
11722
|
+
treeshakeStrategy: void 0
|
|
11723
|
+
};
|
|
11724
|
+
}, (item, key)=>({
|
|
11725
|
+
import: !1 === item.import ? void 0 : item.import || key,
|
|
11726
|
+
shareScope: item.shareScope || shareScope || "default",
|
|
11727
|
+
shareKey: item.shareKey || key,
|
|
11728
|
+
requiredVersion: item.requiredVersion,
|
|
11729
|
+
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
|
|
11730
|
+
packageName: item.packageName,
|
|
11731
|
+
singleton: !!item.singleton,
|
|
11732
|
+
eager: !!item.eager,
|
|
11733
|
+
treeshakeStrategy: item.treeshakeStrategy
|
|
11734
|
+
}));
|
|
11735
|
+
}
|
|
11839
11736
|
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
11840
11737
|
name = binding_.BuiltinPluginName.ConsumeSharedPlugin;
|
|
11841
11738
|
_options;
|
|
11842
11739
|
constructor(options){
|
|
11843
11740
|
super(), this._options = {
|
|
11844
|
-
consumes:
|
|
11845
|
-
if (Array.isArray(item)) throw Error("Unexpected array in options");
|
|
11846
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
11847
|
-
import: key,
|
|
11848
|
-
shareScope: options.shareScope || "default",
|
|
11849
|
-
shareKey: key,
|
|
11850
|
-
requiredVersion: item,
|
|
11851
|
-
strictVersion: !0,
|
|
11852
|
-
packageName: void 0,
|
|
11853
|
-
singleton: !1,
|
|
11854
|
-
eager: !1
|
|
11855
|
-
} : {
|
|
11856
|
-
import: key,
|
|
11857
|
-
shareScope: options.shareScope || "default",
|
|
11858
|
-
shareKey: key,
|
|
11859
|
-
requiredVersion: void 0,
|
|
11860
|
-
packageName: void 0,
|
|
11861
|
-
strictVersion: !1,
|
|
11862
|
-
singleton: !1,
|
|
11863
|
-
eager: !1
|
|
11864
|
-
};
|
|
11865
|
-
}, (item, key)=>({
|
|
11866
|
-
import: !1 === item.import ? void 0 : item.import || key,
|
|
11867
|
-
shareScope: item.shareScope || options.shareScope || "default",
|
|
11868
|
-
shareKey: item.shareKey || key,
|
|
11869
|
-
requiredVersion: item.requiredVersion,
|
|
11870
|
-
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
|
|
11871
|
-
packageName: item.packageName,
|
|
11872
|
-
singleton: !!item.singleton,
|
|
11873
|
-
eager: !!item.eager
|
|
11874
|
-
})),
|
|
11741
|
+
consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
|
|
11875
11742
|
enhanced: options.enhanced ?? !1
|
|
11876
11743
|
};
|
|
11877
11744
|
}
|
|
@@ -11892,28 +11759,30 @@ Help:
|
|
|
11892
11759
|
_provides;
|
|
11893
11760
|
_enhanced;
|
|
11894
11761
|
constructor(options){
|
|
11895
|
-
|
|
11762
|
+
var options1, shareScope, enhanced;
|
|
11763
|
+
super(), this._provides = (options1 = options.provides, shareScope = options.shareScope, enhanced = options.enhanced, parseOptions(options1, (item)=>{
|
|
11896
11764
|
if (Array.isArray(item)) throw Error("Unexpected array of provides");
|
|
11897
11765
|
return {
|
|
11898
11766
|
shareKey: item,
|
|
11899
11767
|
version: void 0,
|
|
11900
|
-
shareScope:
|
|
11768
|
+
shareScope: shareScope || "default",
|
|
11901
11769
|
eager: !1
|
|
11902
11770
|
};
|
|
11903
11771
|
}, (item)=>{
|
|
11904
11772
|
let raw = {
|
|
11905
11773
|
shareKey: item.shareKey,
|
|
11906
11774
|
version: item.version,
|
|
11907
|
-
shareScope: item.shareScope ||
|
|
11775
|
+
shareScope: item.shareScope || shareScope || "default",
|
|
11908
11776
|
eager: !!item.eager
|
|
11909
11777
|
};
|
|
11910
|
-
return
|
|
11778
|
+
return enhanced ? {
|
|
11911
11779
|
...raw,
|
|
11912
11780
|
singleton: item.singleton,
|
|
11913
11781
|
requiredVersion: item.requiredVersion,
|
|
11914
|
-
strictVersion: item.strictVersion
|
|
11782
|
+
strictVersion: item.strictVersion,
|
|
11783
|
+
treeshakeStrategy: item.treeshakeStrategy
|
|
11915
11784
|
} : raw;
|
|
11916
|
-
}), this._enhanced = options.enhanced;
|
|
11785
|
+
})), this._enhanced = options.enhanced;
|
|
11917
11786
|
}
|
|
11918
11787
|
raw(compiler) {
|
|
11919
11788
|
new ShareRuntimePlugin(this._enhanced ?? !1).apply(compiler);
|
|
@@ -11924,32 +11793,40 @@ Help:
|
|
|
11924
11793
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
11925
11794
|
}
|
|
11926
11795
|
}
|
|
11796
|
+
function normalizeSharedOptions(shared) {
|
|
11797
|
+
return parseOptions(shared, (item, key)=>{
|
|
11798
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11799
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11800
|
+
import: key,
|
|
11801
|
+
requiredVersion: item
|
|
11802
|
+
} : {
|
|
11803
|
+
import: item
|
|
11804
|
+
};
|
|
11805
|
+
}, (item)=>item);
|
|
11806
|
+
}
|
|
11807
|
+
function createConsumeShareOptions(normalizedSharedOptions) {
|
|
11808
|
+
return normalizedSharedOptions.map(([key, options])=>({
|
|
11809
|
+
[key]: {
|
|
11810
|
+
import: options.import,
|
|
11811
|
+
shareKey: options.shareKey || key,
|
|
11812
|
+
shareScope: options.shareScope,
|
|
11813
|
+
requiredVersion: options.requiredVersion,
|
|
11814
|
+
strictVersion: options.strictVersion,
|
|
11815
|
+
singleton: options.singleton,
|
|
11816
|
+
packageName: options.packageName,
|
|
11817
|
+
eager: options.eager,
|
|
11818
|
+
treeshakeStrategy: options.treeshake?.strategy
|
|
11819
|
+
}
|
|
11820
|
+
}));
|
|
11821
|
+
}
|
|
11927
11822
|
class SharePlugin {
|
|
11928
11823
|
_shareScope;
|
|
11929
11824
|
_consumes;
|
|
11930
11825
|
_provides;
|
|
11931
11826
|
_enhanced;
|
|
11827
|
+
_sharedOptions;
|
|
11932
11828
|
constructor(options){
|
|
11933
|
-
const sharedOptions =
|
|
11934
|
-
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11935
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
11936
|
-
import: key,
|
|
11937
|
-
requiredVersion: item
|
|
11938
|
-
} : {
|
|
11939
|
-
import: item
|
|
11940
|
-
};
|
|
11941
|
-
}, (item)=>item), consumes = sharedOptions.map(([key, options])=>({
|
|
11942
|
-
[key]: {
|
|
11943
|
-
import: options.import,
|
|
11944
|
-
shareKey: options.shareKey || key,
|
|
11945
|
-
shareScope: options.shareScope,
|
|
11946
|
-
requiredVersion: options.requiredVersion,
|
|
11947
|
-
strictVersion: options.strictVersion,
|
|
11948
|
-
singleton: options.singleton,
|
|
11949
|
-
packageName: options.packageName,
|
|
11950
|
-
eager: options.eager
|
|
11951
|
-
}
|
|
11952
|
-
})), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
|
|
11829
|
+
const sharedOptions = normalizeSharedOptions(options.shared), consumes = createConsumeShareOptions(sharedOptions), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
|
|
11953
11830
|
[options.import || key]: {
|
|
11954
11831
|
shareKey: options.shareKey || key,
|
|
11955
11832
|
shareScope: options.shareScope,
|
|
@@ -11957,10 +11834,11 @@ Help:
|
|
|
11957
11834
|
eager: options.eager,
|
|
11958
11835
|
singleton: options.singleton,
|
|
11959
11836
|
requiredVersion: options.requiredVersion,
|
|
11960
|
-
strictVersion: options.strictVersion
|
|
11837
|
+
strictVersion: options.strictVersion,
|
|
11838
|
+
treeshakeStrategy: options.treeshake?.strategy
|
|
11961
11839
|
}
|
|
11962
11840
|
}));
|
|
11963
|
-
this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1;
|
|
11841
|
+
this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1, this._sharedOptions = sharedOptions;
|
|
11964
11842
|
}
|
|
11965
11843
|
apply(compiler) {
|
|
11966
11844
|
new ConsumeSharedPlugin({
|
|
@@ -11974,6 +11852,565 @@ Help:
|
|
|
11974
11852
|
}).apply(compiler);
|
|
11975
11853
|
}
|
|
11976
11854
|
}
|
|
11855
|
+
let MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
|
|
11856
|
+
function isPlainObject(value) {
|
|
11857
|
+
return !!value && "object" == typeof value && !Array.isArray(value);
|
|
11858
|
+
}
|
|
11859
|
+
function getFileName(manifestOptions) {
|
|
11860
|
+
var name;
|
|
11861
|
+
if (!manifestOptions) return {
|
|
11862
|
+
statsFileName: "",
|
|
11863
|
+
manifestFileName: ""
|
|
11864
|
+
};
|
|
11865
|
+
if ("boolean" == typeof manifestOptions) return {
|
|
11866
|
+
statsFileName: STATS_FILE_NAME,
|
|
11867
|
+
manifestFileName: MANIFEST_FILE_NAME
|
|
11868
|
+
};
|
|
11869
|
+
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;
|
|
11870
|
+
return {
|
|
11871
|
+
statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
|
|
11872
|
+
manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
|
|
11873
|
+
};
|
|
11874
|
+
}
|
|
11875
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
11876
|
+
name = binding_.BuiltinPluginName.ModuleFederationManifestPlugin;
|
|
11877
|
+
rawOpts;
|
|
11878
|
+
constructor(opts){
|
|
11879
|
+
super(), this.rawOpts = opts;
|
|
11880
|
+
}
|
|
11881
|
+
raw(compiler) {
|
|
11882
|
+
var mfConfig, isDev, compiler1, mfConfig1;
|
|
11883
|
+
let manifestOptions, containerName, globalName, remoteAliasMap, manifestExposes, manifestShared, pkg, buildVersion, statsBuildInfo, opts = (manifestOptions = !0 === (mfConfig = this.rawOpts).manifest ? {} : {
|
|
11884
|
+
...mfConfig.manifest
|
|
11885
|
+
}, containerName = mfConfig.name, globalName = function(library) {
|
|
11886
|
+
if (!library) return;
|
|
11887
|
+
let libName = library.name;
|
|
11888
|
+
if (libName) {
|
|
11889
|
+
if ("string" == typeof libName) return libName;
|
|
11890
|
+
if (Array.isArray(libName)) return libName[0];
|
|
11891
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
11892
|
+
}
|
|
11893
|
+
}(mfConfig.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
|
|
11894
|
+
if (cur[1].length > 1) return sum;
|
|
11895
|
+
let { entry, alias, name } = cur[1][0];
|
|
11896
|
+
return entry && name && (sum[alias] = {
|
|
11897
|
+
name,
|
|
11898
|
+
entry
|
|
11899
|
+
}), sum;
|
|
11900
|
+
}, {}), manifestExposes = function(exposes) {
|
|
11901
|
+
if (!exposes) return;
|
|
11902
|
+
let result = parseOptions(exposes, (value)=>({
|
|
11903
|
+
import: Array.isArray(value) ? value : [
|
|
11904
|
+
value
|
|
11905
|
+
],
|
|
11906
|
+
name: void 0
|
|
11907
|
+
}), (value)=>({
|
|
11908
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
11909
|
+
value.import
|
|
11910
|
+
],
|
|
11911
|
+
name: value.name ?? void 0
|
|
11912
|
+
})).map(([exposeKey, info])=>{
|
|
11913
|
+
let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
11914
|
+
return {
|
|
11915
|
+
path: exposeKey,
|
|
11916
|
+
name: exposeName
|
|
11917
|
+
};
|
|
11918
|
+
});
|
|
11919
|
+
return result.length > 0 ? result : void 0;
|
|
11920
|
+
}(mfConfig.exposes), void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes), manifestShared = function(shared) {
|
|
11921
|
+
if (!shared) return;
|
|
11922
|
+
let result = parseOptions(shared, (item, key)=>{
|
|
11923
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11924
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11925
|
+
import: key,
|
|
11926
|
+
requiredVersion: item
|
|
11927
|
+
} : {
|
|
11928
|
+
import: item
|
|
11929
|
+
};
|
|
11930
|
+
}, (item)=>item).map(([key, config])=>{
|
|
11931
|
+
let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
|
|
11932
|
+
return {
|
|
11933
|
+
name,
|
|
11934
|
+
version,
|
|
11935
|
+
requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
|
|
11936
|
+
singleton: config.singleton
|
|
11937
|
+
};
|
|
11938
|
+
});
|
|
11939
|
+
return result.length > 0 ? result : void 0;
|
|
11940
|
+
}(mfConfig.shared), void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), {
|
|
11941
|
+
...manifestOptions,
|
|
11942
|
+
remoteAliasMap,
|
|
11943
|
+
globalName,
|
|
11944
|
+
name: containerName
|
|
11945
|
+
}), { fileName, filePath, disableAssetsAnalyze, remoteAliasMap: remoteAliasMap1, exposes, shared } = opts, { statsFileName, manifestFileName } = getFileName(opts), rawOptions = {
|
|
11946
|
+
name: opts.name,
|
|
11947
|
+
globalName: opts.globalName,
|
|
11948
|
+
fileName,
|
|
11949
|
+
filePath,
|
|
11950
|
+
manifestFileName,
|
|
11951
|
+
statsFileName,
|
|
11952
|
+
disableAssetsAnalyze,
|
|
11953
|
+
remoteAliasMap: remoteAliasMap1,
|
|
11954
|
+
exposes,
|
|
11955
|
+
shared,
|
|
11956
|
+
buildInfo: (isDev = "development" === compiler.options.mode, compiler1 = compiler, mfConfig1 = this.rawOpts, pkg = function(root) {
|
|
11957
|
+
let base = root ? (0, external_node_path_namespaceObject.resolve)(root) : process.cwd(), pkgPath = (0, external_node_path_namespaceObject.join)(base, "package.json");
|
|
11958
|
+
try {
|
|
11959
|
+
let content = (0, external_node_fs_namespaceObject.readFileSync)(pkgPath, "utf-8"), parsed = function(input, guard) {
|
|
11960
|
+
try {
|
|
11961
|
+
let parsed = JSON.parse(input);
|
|
11962
|
+
if (guard(parsed)) return parsed;
|
|
11963
|
+
} catch {}
|
|
11964
|
+
}(content, isPlainObject);
|
|
11965
|
+
if (parsed) {
|
|
11966
|
+
let filtered = {};
|
|
11967
|
+
for (let [key, value] of Object.entries(parsed))"string" == typeof value && (filtered[key] = value);
|
|
11968
|
+
if (Object.keys(filtered).length > 0) return filtered;
|
|
11969
|
+
}
|
|
11970
|
+
} catch {}
|
|
11971
|
+
return {};
|
|
11972
|
+
}(compiler1.options.context || process.cwd()), buildVersion = isDev ? "local" : pkg?.version, statsBuildInfo = {
|
|
11973
|
+
buildVersion: process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
11974
|
+
buildName: process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
11975
|
+
}, Object.values(normalizeSharedOptions(mfConfig1.shared || {})).some((config)=>config[1].treeshake) && (statsBuildInfo.target = Array.isArray(compiler1.options.target) ? compiler1.options.target : [], statsBuildInfo.plugins = mfConfig1.treeshakeSharedExcludedPlugins || []), statsBuildInfo)
|
|
11976
|
+
};
|
|
11977
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
11978
|
+
}
|
|
11979
|
+
}
|
|
11980
|
+
let SHARE_ENTRY_ASSET = "collect-shared-entries.json";
|
|
11981
|
+
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
11982
|
+
name = binding_.BuiltinPluginName.CollectSharedEntryPlugin;
|
|
11983
|
+
sharedOptions;
|
|
11984
|
+
_collectedEntries;
|
|
11985
|
+
constructor(options){
|
|
11986
|
+
super();
|
|
11987
|
+
const { sharedOptions } = options;
|
|
11988
|
+
this.sharedOptions = sharedOptions, this._collectedEntries = {};
|
|
11989
|
+
}
|
|
11990
|
+
getData() {
|
|
11991
|
+
return this._collectedEntries;
|
|
11992
|
+
}
|
|
11993
|
+
getFilename() {
|
|
11994
|
+
return SHARE_ENTRY_ASSET;
|
|
11995
|
+
}
|
|
11996
|
+
apply(compiler) {
|
|
11997
|
+
super.apply(compiler), compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
|
|
11998
|
+
compilation.hooks.processAssets.tapPromise({
|
|
11999
|
+
name: "CollectSharedEntry",
|
|
12000
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
12001
|
+
}, async ()=>{
|
|
12002
|
+
compilation.getAssets().forEach((asset)=>{
|
|
12003
|
+
asset.name === SHARE_ENTRY_ASSET && (this._collectedEntries = JSON.parse(asset.source.source().toString())), compilation.deleteAsset(asset.name);
|
|
12004
|
+
});
|
|
12005
|
+
});
|
|
12006
|
+
});
|
|
12007
|
+
}
|
|
12008
|
+
raw() {
|
|
12009
|
+
let rawOptions = {
|
|
12010
|
+
consumes: normalizeConsumeShareOptions(createConsumeShareOptions(this.sharedOptions)).map(([key, v])=>({
|
|
12011
|
+
key,
|
|
12012
|
+
...v
|
|
12013
|
+
})),
|
|
12014
|
+
filename: this.getFilename()
|
|
12015
|
+
};
|
|
12016
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
12017
|
+
}
|
|
12018
|
+
}
|
|
12019
|
+
function assert(condition, msg) {
|
|
12020
|
+
if (!condition) throw Error(msg);
|
|
12021
|
+
}
|
|
12022
|
+
class SharedContainerPlugin extends RspackBuiltinPlugin {
|
|
12023
|
+
name = binding_.BuiltinPluginName.SharedContainerPlugin;
|
|
12024
|
+
filename = "";
|
|
12025
|
+
_options;
|
|
12026
|
+
_shareName;
|
|
12027
|
+
_globalName;
|
|
12028
|
+
constructor(options){
|
|
12029
|
+
super();
|
|
12030
|
+
const { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || "0.0.0";
|
|
12031
|
+
this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
|
|
12032
|
+
const fileName = independentShareFileName || `${version}/share-entry.js`;
|
|
12033
|
+
this._shareName = shareName, this._options = {
|
|
12034
|
+
name: shareName,
|
|
12035
|
+
request: request,
|
|
12036
|
+
library: (library ? {
|
|
12037
|
+
...library,
|
|
12038
|
+
name: this._globalName
|
|
12039
|
+
} : void 0) || {
|
|
12040
|
+
type: "global",
|
|
12041
|
+
name: this._globalName
|
|
12042
|
+
},
|
|
12043
|
+
version,
|
|
12044
|
+
fileName
|
|
12045
|
+
};
|
|
12046
|
+
}
|
|
12047
|
+
getData() {
|
|
12048
|
+
return [
|
|
12049
|
+
this._options.fileName,
|
|
12050
|
+
this._globalName,
|
|
12051
|
+
this._options.version
|
|
12052
|
+
];
|
|
12053
|
+
}
|
|
12054
|
+
raw(compiler) {
|
|
12055
|
+
let { library } = this._options;
|
|
12056
|
+
return compiler.options.output.enabledLibraryTypes.includes(library.type) || compiler.options.output.enabledLibraryTypes.push(library.type), createBuiltinPlugin(this.name, this._options);
|
|
12057
|
+
}
|
|
12058
|
+
apply(compiler) {
|
|
12059
|
+
super.apply(compiler);
|
|
12060
|
+
let shareName = this._shareName;
|
|
12061
|
+
compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
|
|
12062
|
+
compilation.hooks.processAssets.tapPromise({
|
|
12063
|
+
name: "getShareContainerFile"
|
|
12064
|
+
}, async ()=>{
|
|
12065
|
+
assert(compilation.entrypoints.get(shareName), `Can not get shared ${shareName} entryPoint!`);
|
|
12066
|
+
let remoteEntryNameChunk = compilation.namedChunks.get(shareName);
|
|
12067
|
+
assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
|
|
12068
|
+
let files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(".hot-update") && !f.endsWith(".css"));
|
|
12069
|
+
assert(files.length > 0, `no files found for shared ${shareName} chunk`), assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`), this.filename = files[0];
|
|
12070
|
+
});
|
|
12071
|
+
});
|
|
12072
|
+
}
|
|
12073
|
+
}
|
|
12074
|
+
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
12075
|
+
name = binding_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
|
|
12076
|
+
sharedOptions;
|
|
12077
|
+
injectUsedExports;
|
|
12078
|
+
manifestOptions;
|
|
12079
|
+
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
12080
|
+
super(), this.sharedOptions = sharedOptions, this.injectUsedExports = injectUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
|
|
12081
|
+
}
|
|
12082
|
+
buildOptions() {
|
|
12083
|
+
let shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
12084
|
+
shareKey,
|
|
12085
|
+
treeshake: !!config.treeshake,
|
|
12086
|
+
usedExports: config.treeshake?.usedExports
|
|
12087
|
+
})), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
12088
|
+
return {
|
|
12089
|
+
shared,
|
|
12090
|
+
injectUsedExports: this.injectUsedExports,
|
|
12091
|
+
manifestFileName,
|
|
12092
|
+
statsFileName
|
|
12093
|
+
};
|
|
12094
|
+
}
|
|
12095
|
+
raw() {
|
|
12096
|
+
if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
let VIRTUAL_ENTRY = "./virtual-entry.js", VIRTUAL_ENTRY_NAME = "virtual-entry";
|
|
12100
|
+
class VirtualEntryPlugin {
|
|
12101
|
+
sharedOptions;
|
|
12102
|
+
collectShared = !1;
|
|
12103
|
+
constructor(sharedOptions, collectShared){
|
|
12104
|
+
this.sharedOptions = sharedOptions, this.collectShared = collectShared;
|
|
12105
|
+
}
|
|
12106
|
+
createEntry() {
|
|
12107
|
+
let { sharedOptions, collectShared } = this;
|
|
12108
|
+
return sharedOptions.reduce((acc, cur, index)=>{
|
|
12109
|
+
let importLine = `import shared_${index} from '${cur[0]}';\n`;
|
|
12110
|
+
return acc + importLine + (collectShared ? `console.log(shared_${index});\n` : "");
|
|
12111
|
+
}, "");
|
|
12112
|
+
}
|
|
12113
|
+
static entry() {
|
|
12114
|
+
return {
|
|
12115
|
+
[VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
|
|
12116
|
+
};
|
|
12117
|
+
}
|
|
12118
|
+
apply(compiler) {
|
|
12119
|
+
new compiler.rspack.experiments.VirtualModulesPlugin({
|
|
12120
|
+
[VIRTUAL_ENTRY]: this.createEntry()
|
|
12121
|
+
}).apply(compiler), compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
|
|
12122
|
+
compilation.hooks.processAssets.tapPromise({
|
|
12123
|
+
name: "RemoveVirtualEntryAsset",
|
|
12124
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
12125
|
+
}, async ()=>{
|
|
12126
|
+
try {
|
|
12127
|
+
let chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
12128
|
+
chunk?.files.forEach((f)=>{
|
|
12129
|
+
compilation.deleteAsset(f);
|
|
12130
|
+
});
|
|
12131
|
+
} catch (_e) {
|
|
12132
|
+
console.error("Failed to remove virtual entry file!");
|
|
12133
|
+
}
|
|
12134
|
+
});
|
|
12135
|
+
});
|
|
12136
|
+
}
|
|
12137
|
+
}
|
|
12138
|
+
let resolveOutputDir = (outputDir, shareName)=>shareName ? (0, external_node_path_namespaceObject.join)(outputDir, encodeName(shareName)) : outputDir;
|
|
12139
|
+
class IndependentSharedPlugin {
|
|
12140
|
+
mfName;
|
|
12141
|
+
shared;
|
|
12142
|
+
library;
|
|
12143
|
+
sharedOptions;
|
|
12144
|
+
outputDir;
|
|
12145
|
+
plugins;
|
|
12146
|
+
treeshake;
|
|
12147
|
+
manifest;
|
|
12148
|
+
buildAssets = {};
|
|
12149
|
+
injectUsedExports;
|
|
12150
|
+
treeshakeSharedExcludedPlugins;
|
|
12151
|
+
name = "IndependentSharedPlugin";
|
|
12152
|
+
constructor(options){
|
|
12153
|
+
const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library, treeshakeSharedExcludedPlugins } = options;
|
|
12154
|
+
this.shared = shared, this.mfName = name, this.outputDir = outputDir || "independent-packages", this.plugins = plugins || [], this.treeshake = treeshake, this.manifest = manifest, this.injectUsedExports = injectUsedExports ?? !0, this.library = library, this.treeshakeSharedExcludedPlugins = treeshakeSharedExcludedPlugins || [], this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
12155
|
+
if ("string" != typeof item) throw Error(`Unexpected array in shared configuration for key "${key}"`);
|
|
12156
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
12157
|
+
import: key,
|
|
12158
|
+
requiredVersion: item
|
|
12159
|
+
} : {
|
|
12160
|
+
import: item
|
|
12161
|
+
};
|
|
12162
|
+
}, (item)=>item);
|
|
12163
|
+
}
|
|
12164
|
+
apply(compiler) {
|
|
12165
|
+
let { manifest } = this, runCount = 0;
|
|
12166
|
+
compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async ()=>{
|
|
12167
|
+
!runCount && (await this.createIndependentCompilers(compiler), runCount++);
|
|
12168
|
+
}), compiler.hooks.watchRun.tapPromise("IndependentSharedPlugin", async ()=>{
|
|
12169
|
+
!runCount && (await this.createIndependentCompilers(compiler), runCount++);
|
|
12170
|
+
}), compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
|
|
12171
|
+
callback();
|
|
12172
|
+
}), manifest && compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
|
|
12173
|
+
compilation.hooks.processAssets.tapPromise({
|
|
12174
|
+
name: "injectBuildAssets",
|
|
12175
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
12176
|
+
}, async ()=>{
|
|
12177
|
+
let { statsFileName, manifestFileName } = getFileName(manifest), injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
12178
|
+
let stats = compilation.getAsset(filename);
|
|
12179
|
+
if (!stats) return;
|
|
12180
|
+
let statsContent = JSON.parse(stats.source.source().toString()), { shared } = statsContent;
|
|
12181
|
+
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
12182
|
+
let targetShared = shared.find((s)=>s.name === key);
|
|
12183
|
+
targetShared && item.forEach(([entry, version, globalName])=>{
|
|
12184
|
+
version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
|
|
12185
|
+
});
|
|
12186
|
+
}), compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
12187
|
+
};
|
|
12188
|
+
injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
12189
|
+
});
|
|
12190
|
+
});
|
|
12191
|
+
}
|
|
12192
|
+
async createIndependentCompilers(parentCompiler) {
|
|
12193
|
+
let { sharedOptions, buildAssets, outputDir } = this;
|
|
12194
|
+
console.log("🚀 Start creating a standalone compiler...");
|
|
12195
|
+
let shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
|
|
12196
|
+
await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
|
|
12197
|
+
if (!shareConfig.treeshake || !1 === shareConfig.import) return;
|
|
12198
|
+
let shareRequests = shareRequestsMap[shareName].requests;
|
|
12199
|
+
await Promise.all(shareRequests.map(async ([request, version])=>{
|
|
12200
|
+
let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1], [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
|
|
12201
|
+
shareRequestsMap,
|
|
12202
|
+
currentShare: {
|
|
12203
|
+
shareName,
|
|
12204
|
+
version,
|
|
12205
|
+
request,
|
|
12206
|
+
independentShareFileName: sharedConfig?.treeshake?.filename
|
|
12207
|
+
}
|
|
12208
|
+
});
|
|
12209
|
+
"string" == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
|
|
12210
|
+
(0, external_node_path_namespaceObject.join)(resolveOutputDir(outputDir, shareName), shareFileName),
|
|
12211
|
+
sharedVersion,
|
|
12212
|
+
globalName
|
|
12213
|
+
]));
|
|
12214
|
+
}));
|
|
12215
|
+
})), console.log("✅ All independent packages have been compiled successfully");
|
|
12216
|
+
}
|
|
12217
|
+
async createIndependentCompiler(parentCompiler, extraOptions) {
|
|
12218
|
+
let extraPlugin, { mfName, plugins, outputDir, sharedOptions, treeshake, library, treeshakeSharedExcludedPlugins } = this, outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || ""), parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack;
|
|
12219
|
+
extraPlugin = extraOptions ? new SharedContainerPlugin({
|
|
12220
|
+
mfName,
|
|
12221
|
+
library,
|
|
12222
|
+
...extraOptions.currentShare
|
|
12223
|
+
}) : new CollectSharedEntryPlugin({
|
|
12224
|
+
sharedOptions,
|
|
12225
|
+
shareScope: "default"
|
|
12226
|
+
}), (parentConfig.plugins || []).forEach((plugin)=>{
|
|
12227
|
+
void 0 !== plugin && "string" != typeof plugin && ((plugin, excludedPlugins = [])=>{
|
|
12228
|
+
if (!plugin) return !0;
|
|
12229
|
+
let pluginName = plugin.name || plugin.constructor?.name;
|
|
12230
|
+
return !pluginName || ![
|
|
12231
|
+
"TreeShakeSharedPlugin",
|
|
12232
|
+
"IndependentSharedPlugin",
|
|
12233
|
+
"ModuleFederationPlugin",
|
|
12234
|
+
"SharedUsedExportsOptimizerPlugin",
|
|
12235
|
+
"HtmlWebpackPlugin",
|
|
12236
|
+
"HtmlRspackPlugin",
|
|
12237
|
+
"RsbuildHtmlPlugin",
|
|
12238
|
+
...excludedPlugins
|
|
12239
|
+
].includes(pluginName);
|
|
12240
|
+
})(plugin, treeshakeSharedExcludedPlugins) && finalPlugins.push(plugin);
|
|
12241
|
+
}), plugins.forEach((plugin)=>{
|
|
12242
|
+
finalPlugins.push(plugin);
|
|
12243
|
+
}), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
|
|
12244
|
+
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
12245
|
+
[key]: {
|
|
12246
|
+
import: !extraOptions && options.import,
|
|
12247
|
+
shareKey: options.shareKey || key,
|
|
12248
|
+
shareScope: options.shareScope,
|
|
12249
|
+
requiredVersion: options.requiredVersion,
|
|
12250
|
+
strictVersion: options.strictVersion,
|
|
12251
|
+
singleton: options.singleton,
|
|
12252
|
+
packageName: options.packageName,
|
|
12253
|
+
eager: options.eager
|
|
12254
|
+
}
|
|
12255
|
+
})),
|
|
12256
|
+
enhanced: !0
|
|
12257
|
+
})), treeshake && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
|
|
12258
|
+
let fullOutputDir = (0, external_node_path_namespaceObject.resolve)(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
|
|
12259
|
+
...parentConfig,
|
|
12260
|
+
module: {
|
|
12261
|
+
...parentConfig.module,
|
|
12262
|
+
rules: [
|
|
12263
|
+
{
|
|
12264
|
+
test: /virtual-entry\.js$/,
|
|
12265
|
+
type: "javascript/auto",
|
|
12266
|
+
resolve: {
|
|
12267
|
+
fullySpecified: !1
|
|
12268
|
+
},
|
|
12269
|
+
use: {
|
|
12270
|
+
loader: "builtin:swc-loader"
|
|
12271
|
+
}
|
|
12272
|
+
},
|
|
12273
|
+
...parentConfig.module?.rules || []
|
|
12274
|
+
]
|
|
12275
|
+
},
|
|
12276
|
+
mode: parentConfig.mode || "development",
|
|
12277
|
+
entry: VirtualEntryPlugin.entry,
|
|
12278
|
+
output: {
|
|
12279
|
+
path: fullOutputDir,
|
|
12280
|
+
clean: !0,
|
|
12281
|
+
publicPath: parentConfig.output?.publicPath || "auto"
|
|
12282
|
+
},
|
|
12283
|
+
plugins: finalPlugins,
|
|
12284
|
+
optimization: {
|
|
12285
|
+
...parentConfig.optimization,
|
|
12286
|
+
splitChunks: !1
|
|
12287
|
+
}
|
|
12288
|
+
}, compiler = rspack.rspack(compilerConfig);
|
|
12289
|
+
compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
|
|
12290
|
+
let { currentShare } = extraOptions || {};
|
|
12291
|
+
return new Promise((resolve, reject)=>{
|
|
12292
|
+
compiler.run((err, stats)=>{
|
|
12293
|
+
if (err || stats?.hasErrors()) {
|
|
12294
|
+
let target = currentShare ? currentShare.shareName : "收集依赖";
|
|
12295
|
+
console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n")), reject(err || Error(`${target} 编译失败`));
|
|
12296
|
+
return;
|
|
12297
|
+
}
|
|
12298
|
+
currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`), stats && (currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`), console.log(stats.toString({
|
|
12299
|
+
colors: !0,
|
|
12300
|
+
chunks: !1,
|
|
12301
|
+
modules: !1
|
|
12302
|
+
}))), resolve(extraPlugin.getData());
|
|
12303
|
+
});
|
|
12304
|
+
});
|
|
12305
|
+
}
|
|
12306
|
+
}
|
|
12307
|
+
class TreeShakeSharedPlugin {
|
|
12308
|
+
mfConfig;
|
|
12309
|
+
outputDir;
|
|
12310
|
+
plugins;
|
|
12311
|
+
reShake;
|
|
12312
|
+
_independentSharePlugin;
|
|
12313
|
+
name = "TreeShakeSharedPlugin";
|
|
12314
|
+
constructor(options){
|
|
12315
|
+
const { mfConfig, plugins, reShake } = options;
|
|
12316
|
+
this.mfConfig = mfConfig, this.outputDir = mfConfig.independentShareDir || "independent-packages", this.plugins = plugins, this.reShake = !!reShake;
|
|
12317
|
+
}
|
|
12318
|
+
apply(compiler) {
|
|
12319
|
+
let { mfConfig, outputDir, plugins, reShake } = this, { name, shared, library } = mfConfig;
|
|
12320
|
+
if (!shared) return;
|
|
12321
|
+
let sharedOptions = normalizeSharedOptions(shared);
|
|
12322
|
+
sharedOptions.length && sharedOptions.some(([_, config])=>config.treeshake && !1 !== config.import) && (reShake || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler), this._independentSharePlugin = new IndependentSharedPlugin({
|
|
12323
|
+
name: name,
|
|
12324
|
+
shared: shared,
|
|
12325
|
+
outputDir,
|
|
12326
|
+
plugins,
|
|
12327
|
+
treeshake: reShake,
|
|
12328
|
+
library,
|
|
12329
|
+
manifest: mfConfig.manifest,
|
|
12330
|
+
treeshakeSharedExcludedPlugins: mfConfig.treeshakeSharedExcludedPlugins
|
|
12331
|
+
}), this._independentSharePlugin.apply(compiler));
|
|
12332
|
+
}
|
|
12333
|
+
get buildAssets() {
|
|
12334
|
+
return this._independentSharePlugin?.buildAssets || {};
|
|
12335
|
+
}
|
|
12336
|
+
}
|
|
12337
|
+
let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
12338
|
+
function getRemoteInfos(options) {
|
|
12339
|
+
if (!options.remotes) return {};
|
|
12340
|
+
let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
|
|
12341
|
+
external: Array.isArray(item) ? item : [
|
|
12342
|
+
item
|
|
12343
|
+
],
|
|
12344
|
+
shareScope: options.shareScope || "default"
|
|
12345
|
+
}), (item)=>({
|
|
12346
|
+
external: Array.isArray(item.external) ? item.external : [
|
|
12347
|
+
item.external
|
|
12348
|
+
],
|
|
12349
|
+
shareScope: item.shareScope || options.shareScope || "default"
|
|
12350
|
+
})), remoteInfos = {};
|
|
12351
|
+
for (let [key, config] of remotes)for (let external of config.external){
|
|
12352
|
+
let [externalType, externalRequest] = function(external) {
|
|
12353
|
+
let result = function(external) {
|
|
12354
|
+
if (/^[a-z0-9-]+ /.test(external)) {
|
|
12355
|
+
let idx = external.indexOf(" ");
|
|
12356
|
+
return [
|
|
12357
|
+
external.slice(0, idx),
|
|
12358
|
+
external.slice(idx + 1)
|
|
12359
|
+
];
|
|
12360
|
+
}
|
|
12361
|
+
return null;
|
|
12362
|
+
}(external);
|
|
12363
|
+
return null === result ? [
|
|
12364
|
+
remoteType,
|
|
12365
|
+
external
|
|
12366
|
+
] : result;
|
|
12367
|
+
}(external);
|
|
12368
|
+
if (remoteInfos[key] ??= [], "script" === externalType) {
|
|
12369
|
+
let [url, global] = function(urlAndGlobal) {
|
|
12370
|
+
let index = urlAndGlobal.indexOf("@");
|
|
12371
|
+
return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
|
|
12372
|
+
urlAndGlobal.substring(index + 1),
|
|
12373
|
+
urlAndGlobal.substring(0, index)
|
|
12374
|
+
];
|
|
12375
|
+
}(externalRequest);
|
|
12376
|
+
remoteInfos[key].push({
|
|
12377
|
+
alias: key,
|
|
12378
|
+
name: global,
|
|
12379
|
+
entry: url,
|
|
12380
|
+
externalType,
|
|
12381
|
+
shareScope: config.shareScope
|
|
12382
|
+
});
|
|
12383
|
+
} else remoteInfos[key].push({
|
|
12384
|
+
alias: key,
|
|
12385
|
+
name: void 0,
|
|
12386
|
+
entry: void 0,
|
|
12387
|
+
externalType,
|
|
12388
|
+
shareScope: config.shareScope
|
|
12389
|
+
});
|
|
12390
|
+
}
|
|
12391
|
+
return remoteInfos;
|
|
12392
|
+
}
|
|
12393
|
+
function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
|
|
12394
|
+
let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [], libraryType = options.library?.type || "var";
|
|
12395
|
+
for(let i = 0; i < runtimePlugins.length; i++){
|
|
12396
|
+
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;
|
|
12397
|
+
runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
|
|
12398
|
+
let paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
|
|
12399
|
+
runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
|
|
12400
|
+
}
|
|
12401
|
+
let content = [
|
|
12402
|
+
`import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
|
|
12403
|
+
...runtimePluginImports,
|
|
12404
|
+
`const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
|
|
12405
|
+
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
12406
|
+
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
12407
|
+
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
12408
|
+
`const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
|
|
12409
|
+
`const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
|
|
12410
|
+
compiler.webpack.Template.getFunctionContent(__webpack_require__("./moduleFederationDefaultRuntime.js"))
|
|
12411
|
+
].join(";");
|
|
12412
|
+
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
12413
|
+
}
|
|
11977
12414
|
class ContainerPlugin extends RspackBuiltinPlugin {
|
|
11978
12415
|
name = binding_.BuiltinPluginName.ContainerPlugin;
|
|
11979
12416
|
_options;
|
|
@@ -11982,7 +12419,7 @@ Help:
|
|
|
11982
12419
|
name: options.name,
|
|
11983
12420
|
shareScope: options.shareScope || "default",
|
|
11984
12421
|
library: options.library || {
|
|
11985
|
-
type: "
|
|
12422
|
+
type: "global",
|
|
11986
12423
|
name: options.name
|
|
11987
12424
|
},
|
|
11988
12425
|
runtime: options.runtime,
|
|
@@ -12065,7 +12502,7 @@ Help:
|
|
|
12065
12502
|
let _options = JSON.stringify(options || {});
|
|
12066
12503
|
return binding_default().transform(source, _options);
|
|
12067
12504
|
}
|
|
12068
|
-
let exports_rspackVersion = "1.7.0-canary-
|
|
12505
|
+
let exports_rspackVersion = "1.7.0-canary-c8f933e3-20251224124051", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
|
12069
12506
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
12070
12507
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
12071
12508
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -12108,11 +12545,12 @@ Help:
|
|
|
12108
12545
|
ContainerReferencePlugin: ContainerReferencePlugin,
|
|
12109
12546
|
ModuleFederationPlugin: class {
|
|
12110
12547
|
_options;
|
|
12548
|
+
_treeShakeSharedPlugin;
|
|
12111
12549
|
constructor(_options){
|
|
12112
12550
|
this._options = _options;
|
|
12113
12551
|
}
|
|
12114
12552
|
apply(compiler) {
|
|
12115
|
-
var options;
|
|
12553
|
+
var options, options1;
|
|
12116
12554
|
let runtimeToolsPath, bundlerRuntimePath, runtimePath, { webpack } = compiler, paths = (runtimeToolsPath = (options = this._options).implementation ?? require.resolve("@module-federation/runtime-tools"), bundlerRuntimePath = require.resolve("@module-federation/webpack-bundler-runtime", {
|
|
12117
12555
|
paths: [
|
|
12118
12556
|
runtimeToolsPath
|
|
@@ -12126,101 +12564,41 @@ Help:
|
|
|
12126
12564
|
bundlerRuntime: bundlerRuntimePath,
|
|
12127
12565
|
runtime: runtimePath
|
|
12128
12566
|
});
|
|
12129
|
-
|
|
12567
|
+
compiler.options.resolve.alias = {
|
|
12130
12568
|
"@module-federation/runtime-tools": paths.runtimeTools,
|
|
12131
12569
|
"@module-federation/runtime": paths.runtime,
|
|
12132
12570
|
...compiler.options.resolve.alias
|
|
12133
|
-
},
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
}(
|
|
12153
|
-
})
|
|
12571
|
+
}, ((options1 = this._options).shared ? parseOptions(options1.shared, (item, key)=>{
|
|
12572
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
12573
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
12574
|
+
import: key,
|
|
12575
|
+
requiredVersion: item
|
|
12576
|
+
} : {
|
|
12577
|
+
import: item
|
|
12578
|
+
};
|
|
12579
|
+
}, (item)=>item) : []).filter(([, config])=>config.treeshake).length > 0 && (this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
|
|
12580
|
+
mfConfig: this._options,
|
|
12581
|
+
reShake: !1
|
|
12582
|
+
}), this._treeShakeSharedPlugin.apply(compiler));
|
|
12583
|
+
let runtimePluginApplied = !1;
|
|
12584
|
+
compiler.hooks.beforeRun.tapPromise({
|
|
12585
|
+
name: "ModuleFederationPlugin",
|
|
12586
|
+
stage: 100
|
|
12587
|
+
}, async ()=>{
|
|
12588
|
+
runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
|
|
12589
|
+
entryRuntime: getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {})
|
|
12590
|
+
}).apply(compiler));
|
|
12591
|
+
}), compiler.hooks.watchRun.tapPromise({
|
|
12592
|
+
name: "ModuleFederationPlugin",
|
|
12593
|
+
stage: 100
|
|
12594
|
+
}, async ()=>{
|
|
12595
|
+
runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
|
|
12596
|
+
entryRuntime: getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {})
|
|
12597
|
+
}).apply(compiler));
|
|
12598
|
+
}), new webpack.container.ModuleFederationPluginV1({
|
|
12154
12599
|
...this._options,
|
|
12155
12600
|
enhanced: !0
|
|
12156
|
-
}).apply(compiler), this._options.manifest)
|
|
12157
|
-
let manifestOptions = !0 === this._options.manifest ? {} : {
|
|
12158
|
-
...this._options.manifest
|
|
12159
|
-
}, containerName = manifestOptions.name ?? this._options.name, globalName = manifestOptions.globalName ?? function(library) {
|
|
12160
|
-
if (!library) return;
|
|
12161
|
-
let libName = library.name;
|
|
12162
|
-
if (libName) {
|
|
12163
|
-
if ("string" == typeof libName) return libName;
|
|
12164
|
-
if (Array.isArray(libName)) return libName[0];
|
|
12165
|
-
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
12166
|
-
}
|
|
12167
|
-
}(this._options.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
12168
|
-
if (cur[1].length > 1) return sum;
|
|
12169
|
-
let { entry, alias, name } = cur[1][0];
|
|
12170
|
-
return entry && name && (sum[alias] = {
|
|
12171
|
-
name,
|
|
12172
|
-
entry
|
|
12173
|
-
}), sum;
|
|
12174
|
-
}, {}), manifestExposes = function(exposes) {
|
|
12175
|
-
if (!exposes) return;
|
|
12176
|
-
let result = parseOptions(exposes, (value)=>({
|
|
12177
|
-
import: Array.isArray(value) ? value : [
|
|
12178
|
-
value
|
|
12179
|
-
],
|
|
12180
|
-
name: void 0
|
|
12181
|
-
}), (value)=>({
|
|
12182
|
-
import: Array.isArray(value.import) ? value.import : [
|
|
12183
|
-
value.import
|
|
12184
|
-
],
|
|
12185
|
-
name: value.name ?? void 0
|
|
12186
|
-
})).map(([exposeKey, info])=>{
|
|
12187
|
-
let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
12188
|
-
return {
|
|
12189
|
-
path: exposeKey,
|
|
12190
|
-
name: exposeName
|
|
12191
|
-
};
|
|
12192
|
-
});
|
|
12193
|
-
return result.length > 0 ? result : void 0;
|
|
12194
|
-
}(this._options.exposes);
|
|
12195
|
-
void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes);
|
|
12196
|
-
let manifestShared = function(shared) {
|
|
12197
|
-
if (!shared) return;
|
|
12198
|
-
let result = parseOptions(shared, (item, key)=>{
|
|
12199
|
-
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
12200
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
12201
|
-
import: key,
|
|
12202
|
-
requiredVersion: item
|
|
12203
|
-
} : {
|
|
12204
|
-
import: item
|
|
12205
|
-
};
|
|
12206
|
-
}, (item)=>item).map(([key, config])=>{
|
|
12207
|
-
let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
|
|
12208
|
-
return {
|
|
12209
|
-
name,
|
|
12210
|
-
version,
|
|
12211
|
-
requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
|
|
12212
|
-
singleton: config.singleton
|
|
12213
|
-
};
|
|
12214
|
-
});
|
|
12215
|
-
return result.length > 0 ? result : void 0;
|
|
12216
|
-
}(this._options.shared);
|
|
12217
|
-
void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), new ModuleFederationManifestPlugin({
|
|
12218
|
-
...manifestOptions,
|
|
12219
|
-
name: containerName,
|
|
12220
|
-
globalName,
|
|
12221
|
-
remoteAliasMap
|
|
12222
|
-
}).apply(compiler);
|
|
12223
|
-
}
|
|
12601
|
+
}).apply(compiler), this._options.manifest && new ModuleFederationManifestPlugin(this._options).apply(compiler);
|
|
12224
12602
|
}
|
|
12225
12603
|
},
|
|
12226
12604
|
ModuleFederationPluginV1: class {
|
|
@@ -12257,6 +12635,7 @@ Help:
|
|
|
12257
12635
|
}
|
|
12258
12636
|
}, sharing = {
|
|
12259
12637
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
12638
|
+
TreeShakeSharedPlugin: TreeShakeSharedPlugin,
|
|
12260
12639
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
12261
12640
|
SharePlugin: SharePlugin
|
|
12262
12641
|
}, exports_experiments = {
|
|
@@ -12334,8 +12713,7 @@ Help:
|
|
|
12334
12713
|
if (new NodeEnvironmentPlugin({
|
|
12335
12714
|
infrastructureLogging: options1.infrastructureLogging
|
|
12336
12715
|
}).apply(compiler), Array.isArray(options1.plugins)) for (let plugin of options1.plugins)"function" == typeof plugin ? plugin.call(compiler, compiler) : plugin && plugin.apply(compiler);
|
|
12337
|
-
|
|
12338
|
-
return platform && (compiler.platform = platform), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
|
|
12716
|
+
return applyRspackOptionsDefaults(compiler.options), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
|
|
12339
12717
|
}
|
|
12340
12718
|
function isMultiRspackOptions(o) {
|
|
12341
12719
|
return Array.isArray(o);
|
|
@@ -12380,15 +12758,14 @@ Help:
|
|
|
12380
12758
|
}
|
|
12381
12759
|
{
|
|
12382
12760
|
let { compiler, watch } = create();
|
|
12383
|
-
return watch && deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."), compiler;
|
|
12761
|
+
return watch && external_node_util_default().deprecate(()=>{}, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")(), compiler;
|
|
12384
12762
|
}
|
|
12385
12763
|
}, exports_namespaceObject);
|
|
12386
12764
|
src_fn.rspack = src_fn, src_fn.webpack = src_fn;
|
|
12387
12765
|
let src_rspack_0 = src_fn, src_0 = src_rspack_0;
|
|
12388
|
-
})(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.
|
|
12766
|
+
})(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.CircularDependencyRspackPlugin = __webpack_exports__.CircularDependencyRspackPlugin, exports.Compilation = __webpack_exports__.Compilation, exports.Compiler = __webpack_exports__.Compiler, exports.ConcatenatedModule = __webpack_exports__.ConcatenatedModule, exports.ContextModule = __webpack_exports__.ContextModule, exports.ContextReplacementPlugin = __webpack_exports__.ContextReplacementPlugin, exports.CopyRspackPlugin = __webpack_exports__.CopyRspackPlugin, exports.CssExtractRspackPlugin = __webpack_exports__.CssExtractRspackPlugin, exports.DefinePlugin = __webpack_exports__.DefinePlugin, exports.Dependency = __webpack_exports__.Dependency, exports.DllPlugin = __webpack_exports__.DllPlugin, exports.DllReferencePlugin = __webpack_exports__.DllReferencePlugin, exports.DynamicEntryPlugin = __webpack_exports__.DynamicEntryPlugin, exports.EntryDependency = __webpack_exports__.EntryDependency, exports.EntryOptionPlugin = __webpack_exports__.EntryOptionPlugin, exports.EntryPlugin = __webpack_exports__.EntryPlugin, exports.EnvironmentPlugin = __webpack_exports__.EnvironmentPlugin, exports.EvalDevToolModulePlugin = __webpack_exports__.EvalDevToolModulePlugin, exports.EvalSourceMapDevToolPlugin = __webpack_exports__.EvalSourceMapDevToolPlugin, exports.ExternalModule = __webpack_exports__.ExternalModule, exports.ExternalsPlugin = __webpack_exports__.ExternalsPlugin, exports.HotModuleReplacementPlugin = __webpack_exports__.HotModuleReplacementPlugin, exports.HtmlRspackPlugin = __webpack_exports__.HtmlRspackPlugin, exports.IgnorePlugin = __webpack_exports__.IgnorePlugin, exports.LightningCssMinimizerRspackPlugin = __webpack_exports__.LightningCssMinimizerRspackPlugin, exports.LoaderOptionsPlugin = __webpack_exports__.LoaderOptionsPlugin, exports.LoaderTargetPlugin = __webpack_exports__.LoaderTargetPlugin, exports.Module = __webpack_exports__.Module, exports.ModuleFilenameHelpers = __webpack_exports__.ModuleFilenameHelpers, exports.MultiCompiler = __webpack_exports__.MultiCompiler, exports.MultiStats = __webpack_exports__.MultiStats, exports.NoEmitOnErrorsPlugin = __webpack_exports__.NoEmitOnErrorsPlugin, exports.NormalModule = __webpack_exports__.NormalModule, exports.NormalModuleReplacementPlugin = __webpack_exports__.NormalModuleReplacementPlugin, exports.ProgressPlugin = __webpack_exports__.ProgressPlugin, exports.ProvidePlugin = __webpack_exports__.ProvidePlugin, exports.RspackOptionsApply = __webpack_exports__.RspackOptionsApply, exports.RuntimeGlobals = __webpack_exports__.RuntimeGlobals, exports.RuntimeModule = __webpack_exports__.RuntimeModule, exports.RuntimePlugin = __webpack_exports__.RuntimePlugin, exports.SourceMapDevToolPlugin = __webpack_exports__.SourceMapDevToolPlugin, exports.Stats = __webpack_exports__.Stats, exports.StatsErrorCode = __webpack_exports__.StatsErrorCode, exports.SubresourceIntegrityPlugin = __webpack_exports__.SubresourceIntegrityPlugin, exports.SwcJsMinimizerRspackPlugin = __webpack_exports__.SwcJsMinimizerRspackPlugin, exports.Template = __webpack_exports__.Template, exports.ValidationError = __webpack_exports__.ValidationError, exports.WarnCaseSensitiveModulesPlugin = __webpack_exports__.WarnCaseSensitiveModulesPlugin, exports.WebpackError = __webpack_exports__.WebpackError, exports.WebpackOptionsApply = __webpack_exports__.WebpackOptionsApply, exports.config = __webpack_exports__.config, exports.container = __webpack_exports__.container, exports.default = __webpack_exports__.default, exports.electron = __webpack_exports__.electron, exports.experiments = __webpack_exports__.experiments, exports.javascript = __webpack_exports__.javascript, exports.lazyCompilationMiddleware = __webpack_exports__.lazyCompilationMiddleware, exports.library = __webpack_exports__.library, exports.node = __webpack_exports__.node, exports.optimize = __webpack_exports__.optimize, exports.rspack = __webpack_exports__.rspack, exports.rspackVersion = __webpack_exports__.rspackVersion, exports.sharing = __webpack_exports__.sharing, exports.sources = __webpack_exports__.sources, exports.util = __webpack_exports__.util, exports.version = __webpack_exports__.version, exports.wasm = __webpack_exports__.wasm, exports.web = __webpack_exports__.web, exports.webworker = __webpack_exports__.webworker, __webpack_exports__)-1 === [
|
|
12389
12767
|
"AsyncDependenciesBlock",
|
|
12390
12768
|
"BannerPlugin",
|
|
12391
|
-
"CaseSensitivePlugin",
|
|
12392
12769
|
"CircularDependencyRspackPlugin",
|
|
12393
12770
|
"Compilation",
|
|
12394
12771
|
"Compiler",
|