@rspack-canary/core 1.7.0-canary-c8f933e3-20251224124051 → 1.7.0-canary-08772c3f-20251224173339
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 +3 -0
- package/dist/builtin-loader/swc/types.d.ts +6 -0
- package/dist/builtin-plugin/{WarnCaseSensitiveModulesPlugin.d.ts → CaseSensitivePlugin.d.ts} +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -1
- package/dist/config/defaults.d.ts +10 -1
- package/dist/config/normalization.d.ts +0 -4
- package/dist/config/target.d.ts +6 -6
- package/dist/config/types.d.ts +1 -5
- package/dist/container/ModuleFederationManifestPlugin.d.ts +3 -10
- package/dist/container/ModuleFederationPlugin.d.ts +1 -16
- package/dist/exports.d.ts +5 -4
- package/dist/index.js +359 -730
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/rspack.d.ts +9 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +0 -16
- package/dist/sharing/ProvideSharedPlugin.d.ts +0 -19
- package/dist/sharing/SharePlugin.d.ts +0 -36
- package/dist/sharing/utils.d.ts +0 -1
- package/dist/util/index.d.ts +1 -0
- package/package.json +3 -3
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +0 -22
- package/dist/sharing/IndependentSharedPlugin.d.ts +0 -35
- package/dist/sharing/SharedContainerPlugin.d.ts +0 -23
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +0 -14
- package/dist/sharing/TreeShakeSharedPlugin.d.ts +0 -19
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: ()=>CaseSensitivePlugin,
|
|
292
292
|
ProvidePlugin: ()=>ProvidePlugin,
|
|
293
293
|
Template: ()=>Template,
|
|
294
294
|
container: ()=>container,
|
|
@@ -330,9 +330,10 @@ for(var __rspack_i in (()=>{
|
|
|
330
330
|
ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
|
|
331
331
|
MultiCompiler: ()=>MultiCompiler,
|
|
332
332
|
SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
|
|
333
|
+
CaseSensitivePlugin: ()=>CaseSensitivePlugin,
|
|
333
334
|
SubresourceIntegrityPlugin: ()=>SubresourceIntegrityPlugin,
|
|
334
|
-
library: ()=>exports_library,
|
|
335
335
|
RuntimeGlobals: ()=>DefaultRuntimeGlobals,
|
|
336
|
+
library: ()=>exports_library,
|
|
336
337
|
node: ()=>exports_node,
|
|
337
338
|
rspackVersion: ()=>exports_rspackVersion,
|
|
338
339
|
util: ()=>util,
|
|
@@ -360,6 +361,7 @@ for(var __rspack_i in (()=>{
|
|
|
360
361
|
__webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_namespaceObject, {
|
|
361
362
|
AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
|
|
362
363
|
BannerPlugin: ()=>BannerPlugin,
|
|
364
|
+
CaseSensitivePlugin: ()=>CaseSensitivePlugin,
|
|
363
365
|
CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
|
|
364
366
|
Compilation: ()=>Compilation,
|
|
365
367
|
Compiler: ()=>Compiler,
|
|
@@ -407,7 +409,7 @@ for(var __rspack_i in (()=>{
|
|
|
407
409
|
SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
|
|
408
410
|
Template: ()=>Template,
|
|
409
411
|
ValidationError: ()=>ValidationError,
|
|
410
|
-
WarnCaseSensitiveModulesPlugin: ()=>
|
|
412
|
+
WarnCaseSensitiveModulesPlugin: ()=>CaseSensitivePlugin,
|
|
411
413
|
WebpackError: ()=>exports_WebpackError,
|
|
412
414
|
WebpackOptionsApply: ()=>RspackOptionsApply,
|
|
413
415
|
config: ()=>exports_config,
|
|
@@ -2042,7 +2044,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2042
2044
|
version: options.version || "unknown",
|
|
2043
2045
|
bundler: options.bundler || "rspack",
|
|
2044
2046
|
force: options.force ?? !0
|
|
2045
|
-
})), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
|
|
2047
|
+
})), CaseSensitivePlugin = base_create(binding_.BuiltinPluginName.CaseSensitivePlugin, ()=>{}, "compilation"), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
|
|
2046
2048
|
class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
|
|
2047
2049
|
name = binding_.BuiltinPluginName.CircularDependencyRspackPlugin;
|
|
2048
2050
|
_options;
|
|
@@ -2335,9 +2337,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
2335
2337
|
return o.path + o.query + o.fragment;
|
|
2336
2338
|
}
|
|
2337
2339
|
let unsupported = (name, issue)=>{
|
|
2338
|
-
let s = `${name} is not supported by
|
|
2339
|
-
throw issue && (s += `
|
|
2340
|
-
},
|
|
2340
|
+
let s = `${name} is not supported by Rspack.`;
|
|
2341
|
+
throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
|
|
2342
|
+
}, warnedMessages = new Set();
|
|
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)=>{
|
|
2341
2347
|
if ("/" === maybeAbsolutePath[0]) {
|
|
2342
2348
|
if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
2343
2349
|
let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
@@ -2421,6 +2427,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
2421
2427
|
query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
|
|
2422
2428
|
};
|
|
2423
2429
|
});
|
|
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
|
+
}
|
|
2424
2436
|
function toFeatures(featureOptions) {
|
|
2425
2437
|
let feature = 0;
|
|
2426
2438
|
for (let key of Reflect.ownKeys(featureOptions))if (!0 === featureOptions[key]) switch(key){
|
|
@@ -3718,33 +3730,27 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
3718
3730
|
let temp = function(identifier, o, options) {
|
|
3719
3731
|
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((options, _)=>{
|
|
3720
3732
|
if (options && "object" == typeof options) {
|
|
3721
|
-
options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0;
|
|
3733
|
+
options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.collectTypeScriptInfo && (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo));
|
|
3722
3734
|
let { rspackExperiments } = options;
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
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"
|
|
3735
|
+
rspackExperiments && ((rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
|
|
3736
|
+
if (pluginImport) return pluginImport.map((config)=>{
|
|
3737
|
+
let rawConfig = {
|
|
3738
|
+
...config,
|
|
3739
|
+
style: {}
|
|
3740
|
+
};
|
|
3741
|
+
if ("boolean" == typeof config.style) rawConfig.style.bool = config.style;
|
|
3742
|
+
else if ("string" == typeof config.style) {
|
|
3743
|
+
let isTpl = config.style.includes("{{");
|
|
3744
|
+
rawConfig.style[isTpl ? "custom" : "css"] = config.style;
|
|
3745
|
+
} else {
|
|
3746
|
+
var val;
|
|
3747
|
+
val = config.style, "[object Object]" === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
|
|
3748
|
+
}
|
|
3749
|
+
return config.styleLibraryDirectory && (rawConfig.style = {
|
|
3750
|
+
styleLibraryDirectory: config.styleLibraryDirectory
|
|
3751
|
+
}), rawConfig;
|
|
3746
3752
|
});
|
|
3747
|
-
}
|
|
3753
|
+
}(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (deprecate("`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead."), options.collectTypeScriptInfo || (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo)), delete rspackExperiments.collectTypeScriptInfo));
|
|
3748
3754
|
}
|
|
3749
3755
|
return options;
|
|
3750
3756
|
})(o, 0);
|
|
@@ -4047,6 +4053,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4047
4053
|
};
|
|
4048
4054
|
if (![
|
|
4049
4055
|
"asset/source",
|
|
4056
|
+
"asset/bytes",
|
|
4050
4057
|
"javascript",
|
|
4051
4058
|
"javascript/auto",
|
|
4052
4059
|
"javascript/dynamic",
|
|
@@ -4462,9 +4469,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4462
4469
|
"function" == typeof next && next();
|
|
4463
4470
|
}, 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)=>{
|
|
4464
4471
|
if (compiler instanceof MultiCompiler) {
|
|
4465
|
-
let middlewareByCompiler = new Map(), i = 0
|
|
4472
|
+
let middlewareByCompiler = new Map(), i = 0;
|
|
4466
4473
|
for (let c of compiler.compilers){
|
|
4467
|
-
if (c.options.experiments.lazyCompilation && (c.name ?
|
|
4474
|
+
if (c.options.experiments.lazyCompilation && (c.name ? deprecate(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`) : deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN)), c.options.lazyCompilation && c.options.experiments.lazyCompilation && (c.name ? deprecate(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`) : deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
|
|
4468
4475
|
let options = {
|
|
4469
4476
|
...c.options.experiments.lazyCompilation,
|
|
4470
4477
|
...c.options.lazyCompilation
|
|
@@ -4483,7 +4490,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4483
4490
|
return middleware?.(req, res, next);
|
|
4484
4491
|
};
|
|
4485
4492
|
}
|
|
4486
|
-
if (compiler.options.experiments.lazyCompilation && (
|
|
4493
|
+
if (compiler.options.experiments.lazyCompilation && (deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), compiler.options.lazyCompilation && deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
|
|
4487
4494
|
let activeModules = new Set(), options = {
|
|
4488
4495
|
...compiler.options.experiments.lazyCompilation,
|
|
4489
4496
|
...compiler.options.lazyCompilation
|
|
@@ -4863,7 +4870,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4863
4870
|
module: options?.minimizerOptions?.module
|
|
4864
4871
|
}
|
|
4865
4872
|
};
|
|
4866
|
-
}, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation")
|
|
4873
|
+
}, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation");
|
|
4867
4874
|
class WebWorkerTemplatePlugin extends RspackBuiltinPlugin {
|
|
4868
4875
|
name = binding_.BuiltinPluginName.WebWorkerTemplatePlugin;
|
|
4869
4876
|
raw(compiler) {
|
|
@@ -5782,7 +5789,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5782
5789
|
if ("function" != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], "import", ()=>[
|
|
5783
5790
|
"./src"
|
|
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
|
+
return 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 && {
|
|
5786
5793
|
imports: !0,
|
|
5787
5794
|
entries: !1
|
|
5788
5795
|
}), D(options, "bail", !1), F(options, "cache", ()=>development), !1 === options.cache && (options.experiments.cache = !1), applyExperimentsDefaults(options.experiments, {
|
|
@@ -5824,15 +5831,24 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5824
5831
|
targetProperties,
|
|
5825
5832
|
mode: options.mode,
|
|
5826
5833
|
css: options.experiments.css
|
|
5827
|
-
}), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader)
|
|
5834
|
+
}), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), {
|
|
5835
|
+
platform: !1 === targetProperties ? targetProperties : {
|
|
5836
|
+
web: targetProperties.web,
|
|
5837
|
+
browser: targetProperties.browser,
|
|
5838
|
+
webworker: targetProperties.webworker,
|
|
5839
|
+
node: targetProperties.node,
|
|
5840
|
+
nwjs: targetProperties.nwjs,
|
|
5841
|
+
electron: targetProperties.electron
|
|
5842
|
+
}
|
|
5843
|
+
};
|
|
5828
5844
|
}, applyInfrastructureLoggingDefaults = (infrastructureLogging)=>{
|
|
5829
5845
|
F(infrastructureLogging, "stream", ()=>process.stderr);
|
|
5830
5846
|
let tty = infrastructureLogging.stream?.isTTY && "dumb" !== process.env.TERM;
|
|
5831
5847
|
D(infrastructureLogging, "level", "info"), D(infrastructureLogging, "debug", !1), D(infrastructureLogging, "colors", tty), D(infrastructureLogging, "appendOnly", !tty);
|
|
5832
5848
|
}, applyExperimentsDefaults = (experiments, { development })=>{
|
|
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, "
|
|
5849
|
+
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);
|
|
5834
5850
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
5835
|
-
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-
|
|
5851
|
+
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-08772c3f-20251224173339"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
|
|
5836
5852
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, deferImport })=>{
|
|
5837
5853
|
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 })=>{
|
|
5838
5854
|
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", [
|
|
@@ -5964,6 +5980,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5964
5980
|
type: "text"
|
|
5965
5981
|
},
|
|
5966
5982
|
type: "asset/source"
|
|
5983
|
+
}, {
|
|
5984
|
+
with: {
|
|
5985
|
+
type: "bytes"
|
|
5986
|
+
},
|
|
5987
|
+
type: "asset/bytes"
|
|
5967
5988
|
}), rules;
|
|
5968
5989
|
});
|
|
5969
5990
|
}, applyOutputDefaults = (output, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
|
|
@@ -6312,7 +6333,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6312
6333
|
main: {}
|
|
6313
6334
|
} : "function" == typeof config.entry ? (fn = config.entry, ()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic)) : getNormalizedEntryStatic(config.entry),
|
|
6314
6335
|
output: nestedConfig(config.output, (output)=>{
|
|
6315
|
-
"cssHeadDataCompression" in output &&
|
|
6336
|
+
"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");
|
|
6316
6337
|
let { library } = output, libraryBase = "object" == typeof library && library && !Array.isArray(library) && "type" in library ? library : library || output.libraryTarget ? {
|
|
6317
6338
|
name: library
|
|
6318
6339
|
} : void 0;
|
|
@@ -6451,7 +6472,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6451
6472
|
plugins: nestedArray(config.plugins, (p)=>[
|
|
6452
6473
|
...p
|
|
6453
6474
|
]),
|
|
6454
|
-
experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers &&
|
|
6475
|
+
experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers && deprecate("`experiments.layers` config is deprecated and will be removed in Rspack v2.0. Feature layers will always be enabled. Remove this option from your Rspack configuration."), !1 === experiments.topLevelAwait && deprecate("`experiments.topLevelAwait` config is deprecated and will be removed in Rspack v2.0. Top-level await will always be enabled. Remove this option from your Rspack configuration."), experiments.lazyBarrel && deprecate("`experiments.lazyBarrel` config is deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Remove this option from your Rspack configuration."), experiments.inlineConst && deprecate("`experiments.inlineConst` config is deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Remove this option from your Rspack configuration."), experiments.inlineEnum && deprecate("`experiments.inlineEnum` config is deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Remove this option from your Rspack configuration."), experiments.typeReexportsPresence && deprecate("`experiments.typeReexportsPresence` config is deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Remove this option from your Rspack configuration."), {
|
|
6455
6476
|
...experiments,
|
|
6456
6477
|
cache: optionalNestedConfig(experiments.cache, (cache)=>{
|
|
6457
6478
|
if ("boolean" == typeof cache || "memory" === cache.type) return cache;
|
|
@@ -6481,7 +6502,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6481
6502
|
}),
|
|
6482
6503
|
lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, (options)=>!0 === options ? {} : options),
|
|
6483
6504
|
incremental: optionalNestedConfig(experiments.incremental, (options)=>getNormalizedIncrementalOptions(options)),
|
|
6484
|
-
parallelCodeSplitting: experiments.parallelCodeSplitting,
|
|
6485
6505
|
buildHttp: experiments.buildHttp,
|
|
6486
6506
|
parallelLoader: experiments.parallelLoader,
|
|
6487
6507
|
useInputFileSystem: experiments.useInputFileSystem
|
|
@@ -7599,7 +7619,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7599
7619
|
});
|
|
7600
7620
|
}
|
|
7601
7621
|
}
|
|
7602
|
-
let CORE_VERSION = "1.7.0-canary-
|
|
7622
|
+
let CORE_VERSION = "1.7.0-canary-08772c3f-20251224173339", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
7603
7623
|
|
|
7604
7624
|
Help:
|
|
7605
7625
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
@@ -7899,6 +7919,7 @@ Help:
|
|
|
7899
7919
|
context;
|
|
7900
7920
|
cache;
|
|
7901
7921
|
compilerPath;
|
|
7922
|
+
#platform;
|
|
7902
7923
|
options;
|
|
7903
7924
|
unsafeFastDrop = !1;
|
|
7904
7925
|
__internal_browser_require;
|
|
@@ -7997,7 +8018,14 @@ Help:
|
|
|
7997
8018
|
}, this.rspack = {
|
|
7998
8019
|
...src_rspack_0,
|
|
7999
8020
|
RuntimeGlobals: compilerRuntimeGlobals
|
|
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
|
|
8021
|
+
}, 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.#platform = {
|
|
8022
|
+
web: null,
|
|
8023
|
+
browser: null,
|
|
8024
|
+
webworker: null,
|
|
8025
|
+
node: null,
|
|
8026
|
+
nwjs: null,
|
|
8027
|
+
electron: null
|
|
8028
|
+
}, this.__internal_browser_require = ()=>{
|
|
8001
8029
|
throw Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
|
|
8002
8030
|
}, 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);
|
|
8003
8031
|
}
|
|
@@ -8016,6 +8044,12 @@ Help:
|
|
|
8016
8044
|
get _lastCompilation() {
|
|
8017
8045
|
return this.#compilation;
|
|
8018
8046
|
}
|
|
8047
|
+
get platform() {
|
|
8048
|
+
return this.#platform;
|
|
8049
|
+
}
|
|
8050
|
+
set platform(platform) {
|
|
8051
|
+
this.#platform = platform;
|
|
8052
|
+
}
|
|
8019
8053
|
get __internal__builtinPlugins() {
|
|
8020
8054
|
return this.#builtinPlugins;
|
|
8021
8055
|
}
|
|
@@ -8282,7 +8316,7 @@ Help:
|
|
|
8282
8316
|
this.#registers = this.#createHooksRegisters();
|
|
8283
8317
|
let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options1.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
|
|
8284
8318
|
try {
|
|
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);
|
|
8319
|
+
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, this.#platform), callback(null, this.#instance);
|
|
8286
8320
|
} catch (err) {
|
|
8287
8321
|
err instanceof Error && delete err.stack, callback(Error("Failed to create Rspack compiler instance, check the Rspack configuration.", {
|
|
8288
8322
|
cause: err
|
|
@@ -8908,7 +8942,7 @@ Help:
|
|
|
8908
8942
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8909
8943
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8910
8944
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8911
|
-
}), childOptions.version && (obj.rspackVersion = "1.7.0-canary-
|
|
8945
|
+
}), childOptions.version && (obj.rspackVersion = "1.7.0-canary-08772c3f-20251224173339", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
|
8912
8946
|
let mapError = (j, obj)=>({
|
|
8913
8947
|
...obj,
|
|
8914
8948
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9818,7 +9852,7 @@ Help:
|
|
|
9818
9852
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
9819
9853
|
},
|
|
9820
9854
|
version: (object)=>{
|
|
9821
|
-
object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-
|
|
9855
|
+
object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-08772c3f-20251224173339";
|
|
9822
9856
|
},
|
|
9823
9857
|
env: (object, _compilation, _context, { _env })=>{
|
|
9824
9858
|
object.env = _env;
|
|
@@ -11659,7 +11693,69 @@ Help:
|
|
|
11659
11693
|
});
|
|
11660
11694
|
}
|
|
11661
11695
|
}
|
|
11662
|
-
let
|
|
11696
|
+
let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
11697
|
+
function isRequiredVersion(str) {
|
|
11698
|
+
return VERSION_PATTERN_REGEXP.test(str);
|
|
11699
|
+
}
|
|
11700
|
+
let MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
|
|
11701
|
+
function isPlainObject(value) {
|
|
11702
|
+
return !!value && "object" == typeof value && !Array.isArray(value);
|
|
11703
|
+
}
|
|
11704
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
11705
|
+
name = binding_.BuiltinPluginName.ModuleFederationManifestPlugin;
|
|
11706
|
+
opts;
|
|
11707
|
+
constructor(opts){
|
|
11708
|
+
super(), this.opts = opts;
|
|
11709
|
+
}
|
|
11710
|
+
raw(compiler) {
|
|
11711
|
+
var isDev;
|
|
11712
|
+
let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = function(manifestOptions) {
|
|
11713
|
+
var name;
|
|
11714
|
+
if (!manifestOptions) return {
|
|
11715
|
+
statsFileName: STATS_FILE_NAME,
|
|
11716
|
+
manifestFileName: MANIFEST_FILE_NAME
|
|
11717
|
+
};
|
|
11718
|
+
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;
|
|
11719
|
+
return {
|
|
11720
|
+
statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
|
|
11721
|
+
manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
|
|
11722
|
+
};
|
|
11723
|
+
}(this.opts), rawOptions = {
|
|
11724
|
+
name: this.opts.name,
|
|
11725
|
+
globalName: this.opts.globalName,
|
|
11726
|
+
fileName,
|
|
11727
|
+
filePath,
|
|
11728
|
+
manifestFileName,
|
|
11729
|
+
statsFileName,
|
|
11730
|
+
disableAssetsAnalyze,
|
|
11731
|
+
remoteAliasMap,
|
|
11732
|
+
exposes,
|
|
11733
|
+
shared,
|
|
11734
|
+
buildInfo: (isDev = "development" === compiler.options.mode, pkg = function(root) {
|
|
11735
|
+
let base = root ? (0, external_node_path_namespaceObject.resolve)(root) : process.cwd(), pkgPath = (0, external_node_path_namespaceObject.join)(base, "package.json");
|
|
11736
|
+
try {
|
|
11737
|
+
let content = (0, external_node_fs_namespaceObject.readFileSync)(pkgPath, "utf-8"), parsed = function(input, guard) {
|
|
11738
|
+
try {
|
|
11739
|
+
let parsed = JSON.parse(input);
|
|
11740
|
+
if (guard(parsed)) return parsed;
|
|
11741
|
+
} catch {}
|
|
11742
|
+
}(content, isPlainObject);
|
|
11743
|
+
if (parsed) {
|
|
11744
|
+
let filtered = {};
|
|
11745
|
+
for (let [key, value] of Object.entries(parsed))"string" == typeof value && (filtered[key] = value);
|
|
11746
|
+
if (Object.keys(filtered).length > 0) return filtered;
|
|
11747
|
+
}
|
|
11748
|
+
} catch {}
|
|
11749
|
+
return {};
|
|
11750
|
+
}(compiler.context || process.cwd()), buildVersion = isDev ? "local" : pkg?.version, {
|
|
11751
|
+
buildVersion: process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
11752
|
+
buildName: process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
11753
|
+
})
|
|
11754
|
+
};
|
|
11755
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
11756
|
+
}
|
|
11757
|
+
}
|
|
11758
|
+
let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
11663
11759
|
let items = [];
|
|
11664
11760
|
var options1 = options, normalizeSimple1 = normalizeSimple, normalizeOptions1 = normalizeOptions, fn = (key, value)=>{
|
|
11665
11761
|
items.push([
|
|
@@ -11678,7 +11774,63 @@ Help:
|
|
|
11678
11774
|
} else if ("object" == typeof options1) object(options1);
|
|
11679
11775
|
else throw Error("Unexpected options format");
|
|
11680
11776
|
return items;
|
|
11681
|
-
}
|
|
11777
|
+
};
|
|
11778
|
+
function getRemoteInfos(options) {
|
|
11779
|
+
if (!options.remotes) return {};
|
|
11780
|
+
let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
|
|
11781
|
+
external: Array.isArray(item) ? item : [
|
|
11782
|
+
item
|
|
11783
|
+
],
|
|
11784
|
+
shareScope: options.shareScope || "default"
|
|
11785
|
+
}), (item)=>({
|
|
11786
|
+
external: Array.isArray(item.external) ? item.external : [
|
|
11787
|
+
item.external
|
|
11788
|
+
],
|
|
11789
|
+
shareScope: item.shareScope || options.shareScope || "default"
|
|
11790
|
+
})), remoteInfos = {};
|
|
11791
|
+
for (let [key, config] of remotes)for (let external of config.external){
|
|
11792
|
+
let [externalType, externalRequest] = function(external) {
|
|
11793
|
+
let result = function(external) {
|
|
11794
|
+
if (/^[a-z0-9-]+ /.test(external)) {
|
|
11795
|
+
let idx = external.indexOf(" ");
|
|
11796
|
+
return [
|
|
11797
|
+
external.slice(0, idx),
|
|
11798
|
+
external.slice(idx + 1)
|
|
11799
|
+
];
|
|
11800
|
+
}
|
|
11801
|
+
return null;
|
|
11802
|
+
}(external);
|
|
11803
|
+
return null === result ? [
|
|
11804
|
+
remoteType,
|
|
11805
|
+
external
|
|
11806
|
+
] : result;
|
|
11807
|
+
}(external);
|
|
11808
|
+
if (remoteInfos[key] ??= [], "script" === externalType) {
|
|
11809
|
+
let [url, global] = function(urlAndGlobal) {
|
|
11810
|
+
let index = urlAndGlobal.indexOf("@");
|
|
11811
|
+
return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
|
|
11812
|
+
urlAndGlobal.substring(index + 1),
|
|
11813
|
+
urlAndGlobal.substring(0, index)
|
|
11814
|
+
];
|
|
11815
|
+
}(externalRequest);
|
|
11816
|
+
remoteInfos[key].push({
|
|
11817
|
+
alias: key,
|
|
11818
|
+
name: global,
|
|
11819
|
+
entry: url,
|
|
11820
|
+
externalType,
|
|
11821
|
+
shareScope: config.shareScope
|
|
11822
|
+
});
|
|
11823
|
+
} else remoteInfos[key].push({
|
|
11824
|
+
alias: key,
|
|
11825
|
+
name: void 0,
|
|
11826
|
+
entry: void 0,
|
|
11827
|
+
externalType,
|
|
11828
|
+
shareScope: config.shareScope
|
|
11829
|
+
});
|
|
11830
|
+
}
|
|
11831
|
+
return remoteInfos;
|
|
11832
|
+
}
|
|
11833
|
+
let compilerSet = new WeakSet();
|
|
11682
11834
|
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
11683
11835
|
enhanced;
|
|
11684
11836
|
name = binding_.BuiltinPluginName.ShareRuntimePlugin;
|
|
@@ -11690,55 +11842,42 @@ Help:
|
|
|
11690
11842
|
if (compiler1 = compiler, !compilerSet.has(compiler1)) return compiler2 = compiler, compilerSet.add(compiler2), createBuiltinPlugin(this.name, this.enhanced);
|
|
11691
11843
|
}
|
|
11692
11844
|
}
|
|
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
|
-
}
|
|
11736
11845
|
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
11737
11846
|
name = binding_.BuiltinPluginName.ConsumeSharedPlugin;
|
|
11738
11847
|
_options;
|
|
11739
11848
|
constructor(options){
|
|
11740
11849
|
super(), this._options = {
|
|
11741
|
-
consumes:
|
|
11850
|
+
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
11851
|
+
if (Array.isArray(item)) throw Error("Unexpected array in options");
|
|
11852
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11853
|
+
import: key,
|
|
11854
|
+
shareScope: options.shareScope || "default",
|
|
11855
|
+
shareKey: key,
|
|
11856
|
+
requiredVersion: item,
|
|
11857
|
+
strictVersion: !0,
|
|
11858
|
+
packageName: void 0,
|
|
11859
|
+
singleton: !1,
|
|
11860
|
+
eager: !1
|
|
11861
|
+
} : {
|
|
11862
|
+
import: key,
|
|
11863
|
+
shareScope: options.shareScope || "default",
|
|
11864
|
+
shareKey: key,
|
|
11865
|
+
requiredVersion: void 0,
|
|
11866
|
+
packageName: void 0,
|
|
11867
|
+
strictVersion: !1,
|
|
11868
|
+
singleton: !1,
|
|
11869
|
+
eager: !1
|
|
11870
|
+
};
|
|
11871
|
+
}, (item, key)=>({
|
|
11872
|
+
import: !1 === item.import ? void 0 : item.import || key,
|
|
11873
|
+
shareScope: item.shareScope || options.shareScope || "default",
|
|
11874
|
+
shareKey: item.shareKey || key,
|
|
11875
|
+
requiredVersion: item.requiredVersion,
|
|
11876
|
+
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
|
|
11877
|
+
packageName: item.packageName,
|
|
11878
|
+
singleton: !!item.singleton,
|
|
11879
|
+
eager: !!item.eager
|
|
11880
|
+
})),
|
|
11742
11881
|
enhanced: options.enhanced ?? !1
|
|
11743
11882
|
};
|
|
11744
11883
|
}
|
|
@@ -11759,30 +11898,28 @@ Help:
|
|
|
11759
11898
|
_provides;
|
|
11760
11899
|
_enhanced;
|
|
11761
11900
|
constructor(options){
|
|
11762
|
-
|
|
11763
|
-
super(), this._provides = (options1 = options.provides, shareScope = options.shareScope, enhanced = options.enhanced, parseOptions(options1, (item)=>{
|
|
11901
|
+
super(), this._provides = parseOptions(options.provides, (item)=>{
|
|
11764
11902
|
if (Array.isArray(item)) throw Error("Unexpected array of provides");
|
|
11765
11903
|
return {
|
|
11766
11904
|
shareKey: item,
|
|
11767
11905
|
version: void 0,
|
|
11768
|
-
shareScope: shareScope || "default",
|
|
11906
|
+
shareScope: options.shareScope || "default",
|
|
11769
11907
|
eager: !1
|
|
11770
11908
|
};
|
|
11771
11909
|
}, (item)=>{
|
|
11772
11910
|
let raw = {
|
|
11773
11911
|
shareKey: item.shareKey,
|
|
11774
11912
|
version: item.version,
|
|
11775
|
-
shareScope: item.shareScope || shareScope || "default",
|
|
11913
|
+
shareScope: item.shareScope || options.shareScope || "default",
|
|
11776
11914
|
eager: !!item.eager
|
|
11777
11915
|
};
|
|
11778
|
-
return enhanced ? {
|
|
11916
|
+
return options.enhanced ? {
|
|
11779
11917
|
...raw,
|
|
11780
11918
|
singleton: item.singleton,
|
|
11781
11919
|
requiredVersion: item.requiredVersion,
|
|
11782
|
-
strictVersion: item.strictVersion
|
|
11783
|
-
treeshakeStrategy: item.treeshakeStrategy
|
|
11920
|
+
strictVersion: item.strictVersion
|
|
11784
11921
|
} : raw;
|
|
11785
|
-
})
|
|
11922
|
+
}), this._enhanced = options.enhanced;
|
|
11786
11923
|
}
|
|
11787
11924
|
raw(compiler) {
|
|
11788
11925
|
new ShareRuntimePlugin(this._enhanced ?? !1).apply(compiler);
|
|
@@ -11793,40 +11930,32 @@ Help:
|
|
|
11793
11930
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
11794
11931
|
}
|
|
11795
11932
|
}
|
|
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
|
-
}
|
|
11822
11933
|
class SharePlugin {
|
|
11823
11934
|
_shareScope;
|
|
11824
11935
|
_consumes;
|
|
11825
11936
|
_provides;
|
|
11826
11937
|
_enhanced;
|
|
11827
|
-
_sharedOptions;
|
|
11828
11938
|
constructor(options){
|
|
11829
|
-
const sharedOptions =
|
|
11939
|
+
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
11940
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
11941
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
11942
|
+
import: key,
|
|
11943
|
+
requiredVersion: item
|
|
11944
|
+
} : {
|
|
11945
|
+
import: item
|
|
11946
|
+
};
|
|
11947
|
+
}, (item)=>item), consumes = sharedOptions.map(([key, options])=>({
|
|
11948
|
+
[key]: {
|
|
11949
|
+
import: options.import,
|
|
11950
|
+
shareKey: options.shareKey || key,
|
|
11951
|
+
shareScope: options.shareScope,
|
|
11952
|
+
requiredVersion: options.requiredVersion,
|
|
11953
|
+
strictVersion: options.strictVersion,
|
|
11954
|
+
singleton: options.singleton,
|
|
11955
|
+
packageName: options.packageName,
|
|
11956
|
+
eager: options.eager
|
|
11957
|
+
}
|
|
11958
|
+
})), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
|
|
11830
11959
|
[options.import || key]: {
|
|
11831
11960
|
shareKey: options.shareKey || key,
|
|
11832
11961
|
shareScope: options.shareScope,
|
|
@@ -11834,11 +11963,10 @@ Help:
|
|
|
11834
11963
|
eager: options.eager,
|
|
11835
11964
|
singleton: options.singleton,
|
|
11836
11965
|
requiredVersion: options.requiredVersion,
|
|
11837
|
-
strictVersion: options.strictVersion
|
|
11838
|
-
treeshakeStrategy: options.treeshake?.strategy
|
|
11966
|
+
strictVersion: options.strictVersion
|
|
11839
11967
|
}
|
|
11840
11968
|
}));
|
|
11841
|
-
this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1
|
|
11969
|
+
this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1;
|
|
11842
11970
|
}
|
|
11843
11971
|
apply(compiler) {
|
|
11844
11972
|
new ConsumeSharedPlugin({
|
|
@@ -11852,565 +11980,6 @@ Help:
|
|
|
11852
11980
|
}).apply(compiler);
|
|
11853
11981
|
}
|
|
11854
11982
|
}
|
|
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
|
-
}
|
|
12414
11983
|
class ContainerPlugin extends RspackBuiltinPlugin {
|
|
12415
11984
|
name = binding_.BuiltinPluginName.ContainerPlugin;
|
|
12416
11985
|
_options;
|
|
@@ -12419,7 +11988,7 @@ Help:
|
|
|
12419
11988
|
name: options.name,
|
|
12420
11989
|
shareScope: options.shareScope || "default",
|
|
12421
11990
|
library: options.library || {
|
|
12422
|
-
type: "
|
|
11991
|
+
type: "var",
|
|
12423
11992
|
name: options.name
|
|
12424
11993
|
},
|
|
12425
11994
|
runtime: options.runtime,
|
|
@@ -12502,7 +12071,7 @@ Help:
|
|
|
12502
12071
|
let _options = JSON.stringify(options || {});
|
|
12503
12072
|
return binding_default().transform(source, _options);
|
|
12504
12073
|
}
|
|
12505
|
-
let exports_rspackVersion = "1.7.0-canary-
|
|
12074
|
+
let exports_rspackVersion = "1.7.0-canary-08772c3f-20251224173339", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
|
12506
12075
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
12507
12076
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
12508
12077
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -12545,12 +12114,11 @@ Help:
|
|
|
12545
12114
|
ContainerReferencePlugin: ContainerReferencePlugin,
|
|
12546
12115
|
ModuleFederationPlugin: class {
|
|
12547
12116
|
_options;
|
|
12548
|
-
_treeShakeSharedPlugin;
|
|
12549
12117
|
constructor(_options){
|
|
12550
12118
|
this._options = _options;
|
|
12551
12119
|
}
|
|
12552
12120
|
apply(compiler) {
|
|
12553
|
-
var options
|
|
12121
|
+
var options;
|
|
12554
12122
|
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", {
|
|
12555
12123
|
paths: [
|
|
12556
12124
|
runtimeToolsPath
|
|
@@ -12564,41 +12132,101 @@ Help:
|
|
|
12564
12132
|
bundlerRuntime: bundlerRuntimePath,
|
|
12565
12133
|
runtime: runtimePath
|
|
12566
12134
|
});
|
|
12567
|
-
compiler.options.resolve.alias = {
|
|
12135
|
+
if (compiler.options.resolve.alias = {
|
|
12568
12136
|
"@module-federation/runtime-tools": paths.runtimeTools,
|
|
12569
12137
|
"@module-federation/runtime": paths.runtime,
|
|
12570
12138
|
...compiler.options.resolve.alias
|
|
12571
|
-
},
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
}
|
|
12591
|
-
}),
|
|
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({
|
|
12139
|
+
}, new ModuleFederationRuntimePlugin({
|
|
12140
|
+
entryRuntime: function(paths, options, compiler) {
|
|
12141
|
+
let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [];
|
|
12142
|
+
for(let i = 0; i < runtimePlugins.length; i++){
|
|
12143
|
+
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;
|
|
12144
|
+
runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
|
|
12145
|
+
let paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
|
|
12146
|
+
runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
|
|
12147
|
+
}
|
|
12148
|
+
let content = [
|
|
12149
|
+
`import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
|
|
12150
|
+
...runtimePluginImports,
|
|
12151
|
+
`const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
|
|
12152
|
+
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
12153
|
+
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
12154
|
+
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
12155
|
+
compiler.webpack.Template.getFunctionContent(__webpack_require__("./moduleFederationDefaultRuntime.js"))
|
|
12156
|
+
].join(";");
|
|
12157
|
+
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
12158
|
+
}(paths, this._options, compiler)
|
|
12159
|
+
}).apply(compiler), new webpack.container.ModuleFederationPluginV1({
|
|
12599
12160
|
...this._options,
|
|
12600
12161
|
enhanced: !0
|
|
12601
|
-
}).apply(compiler), this._options.manifest
|
|
12162
|
+
}).apply(compiler), this._options.manifest) {
|
|
12163
|
+
let manifestOptions = !0 === this._options.manifest ? {} : {
|
|
12164
|
+
...this._options.manifest
|
|
12165
|
+
}, containerName = manifestOptions.name ?? this._options.name, globalName = manifestOptions.globalName ?? function(library) {
|
|
12166
|
+
if (!library) return;
|
|
12167
|
+
let libName = library.name;
|
|
12168
|
+
if (libName) {
|
|
12169
|
+
if ("string" == typeof libName) return libName;
|
|
12170
|
+
if (Array.isArray(libName)) return libName[0];
|
|
12171
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
12172
|
+
}
|
|
12173
|
+
}(this._options.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
12174
|
+
if (cur[1].length > 1) return sum;
|
|
12175
|
+
let { entry, alias, name } = cur[1][0];
|
|
12176
|
+
return entry && name && (sum[alias] = {
|
|
12177
|
+
name,
|
|
12178
|
+
entry
|
|
12179
|
+
}), sum;
|
|
12180
|
+
}, {}), manifestExposes = function(exposes) {
|
|
12181
|
+
if (!exposes) return;
|
|
12182
|
+
let result = parseOptions(exposes, (value)=>({
|
|
12183
|
+
import: Array.isArray(value) ? value : [
|
|
12184
|
+
value
|
|
12185
|
+
],
|
|
12186
|
+
name: void 0
|
|
12187
|
+
}), (value)=>({
|
|
12188
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
12189
|
+
value.import
|
|
12190
|
+
],
|
|
12191
|
+
name: value.name ?? void 0
|
|
12192
|
+
})).map(([exposeKey, info])=>{
|
|
12193
|
+
let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
12194
|
+
return {
|
|
12195
|
+
path: exposeKey,
|
|
12196
|
+
name: exposeName
|
|
12197
|
+
};
|
|
12198
|
+
});
|
|
12199
|
+
return result.length > 0 ? result : void 0;
|
|
12200
|
+
}(this._options.exposes);
|
|
12201
|
+
void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes);
|
|
12202
|
+
let manifestShared = function(shared) {
|
|
12203
|
+
if (!shared) return;
|
|
12204
|
+
let result = parseOptions(shared, (item, key)=>{
|
|
12205
|
+
if ("string" != typeof item) throw Error("Unexpected array in shared");
|
|
12206
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
12207
|
+
import: key,
|
|
12208
|
+
requiredVersion: item
|
|
12209
|
+
} : {
|
|
12210
|
+
import: item
|
|
12211
|
+
};
|
|
12212
|
+
}, (item)=>item).map(([key, config])=>{
|
|
12213
|
+
let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
|
|
12214
|
+
return {
|
|
12215
|
+
name,
|
|
12216
|
+
version,
|
|
12217
|
+
requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
|
|
12218
|
+
singleton: config.singleton
|
|
12219
|
+
};
|
|
12220
|
+
});
|
|
12221
|
+
return result.length > 0 ? result : void 0;
|
|
12222
|
+
}(this._options.shared);
|
|
12223
|
+
void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), new ModuleFederationManifestPlugin({
|
|
12224
|
+
...manifestOptions,
|
|
12225
|
+
name: containerName,
|
|
12226
|
+
globalName,
|
|
12227
|
+
remoteAliasMap
|
|
12228
|
+
}).apply(compiler);
|
|
12229
|
+
}
|
|
12602
12230
|
}
|
|
12603
12231
|
},
|
|
12604
12232
|
ModuleFederationPluginV1: class {
|
|
@@ -12635,7 +12263,6 @@ Help:
|
|
|
12635
12263
|
}
|
|
12636
12264
|
}, sharing = {
|
|
12637
12265
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
12638
|
-
TreeShakeSharedPlugin: TreeShakeSharedPlugin,
|
|
12639
12266
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
12640
12267
|
SharePlugin: SharePlugin
|
|
12641
12268
|
}, exports_experiments = {
|
|
@@ -12713,7 +12340,8 @@ Help:
|
|
|
12713
12340
|
if (new NodeEnvironmentPlugin({
|
|
12714
12341
|
infrastructureLogging: options1.infrastructureLogging
|
|
12715
12342
|
}).apply(compiler), Array.isArray(options1.plugins)) for (let plugin of options1.plugins)"function" == typeof plugin ? plugin.call(compiler, compiler) : plugin && plugin.apply(compiler);
|
|
12716
|
-
|
|
12343
|
+
let { platform } = applyRspackOptionsDefaults(compiler.options);
|
|
12344
|
+
return platform && (compiler.platform = platform), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
|
|
12717
12345
|
}
|
|
12718
12346
|
function isMultiRspackOptions(o) {
|
|
12719
12347
|
return Array.isArray(o);
|
|
@@ -12758,14 +12386,15 @@ Help:
|
|
|
12758
12386
|
}
|
|
12759
12387
|
{
|
|
12760
12388
|
let { compiler, watch } = create();
|
|
12761
|
-
return watch &&
|
|
12389
|
+
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;
|
|
12762
12390
|
}
|
|
12763
12391
|
}, exports_namespaceObject);
|
|
12764
12392
|
src_fn.rspack = src_fn, src_fn.webpack = src_fn;
|
|
12765
12393
|
let src_rspack_0 = src_fn, src_0 = src_rspack_0;
|
|
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 === [
|
|
12394
|
+
})(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.CaseSensitivePlugin = __webpack_exports__.CaseSensitivePlugin, 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 === [
|
|
12767
12395
|
"AsyncDependenciesBlock",
|
|
12768
12396
|
"BannerPlugin",
|
|
12397
|
+
"CaseSensitivePlugin",
|
|
12769
12398
|
"CircularDependencyRspackPlugin",
|
|
12770
12399
|
"Compilation",
|
|
12771
12400
|
"Compiler",
|