@rspack-canary/core 1.6.5-canary-1b7f543c-20251121112112 → 1.6.5-canary-a407d226-20251124112255
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/container/ModuleFederationPlugin.d.ts +1 -1
- package/dist/exports.d.ts +3 -11
- package/dist/index.js +102 -95
- package/dist/sharing/{CollectShareEntryPlugin.d.ts → CollectSharedEntryPlugin.d.ts} +3 -3
- package/dist/sharing/{IndependentSharePlugin.d.ts → IndependentSharedPlugin.d.ts} +1 -1
- package/dist/sharing/{OptimizeDependencyReferencedExportsPlugin.d.ts → SharedUsedExportsOptimizerPlugin.d.ts} +1 -1
- package/dist/sharing/{TreeShakeSharePlugin.d.ts → TreeShakeSharedPlugin.d.ts} +5 -3
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
|
|
|
14
14
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
15
15
|
export declare class ModuleFederationPlugin {
|
|
16
16
|
private _options;
|
|
17
|
-
private
|
|
17
|
+
private _treeShakeSharedPlugin?;
|
|
18
18
|
constructor(_options: ModuleFederationPluginOptions);
|
|
19
19
|
apply(compiler: Compiler): void;
|
|
20
20
|
}
|
package/dist/exports.d.ts
CHANGED
|
@@ -116,25 +116,17 @@ export declare const container: {
|
|
|
116
116
|
ModuleFederationPlugin: typeof ModuleFederationPlugin;
|
|
117
117
|
ModuleFederationPluginV1: typeof ModuleFederationPluginV1;
|
|
118
118
|
};
|
|
119
|
-
import { CollectShareEntryPlugin } from "./sharing/CollectShareEntryPlugin";
|
|
120
119
|
import { ConsumeSharedPlugin } from "./sharing/ConsumeSharedPlugin";
|
|
121
|
-
import { OptimizeDependencyReferencedExportsPlugin } from "./sharing/OptimizeDependencyReferencedExportsPlugin";
|
|
122
120
|
import { ProvideSharedPlugin } from "./sharing/ProvideSharedPlugin";
|
|
123
|
-
import { ShareContainerPlugin } from "./sharing/ShareContainerPlugin";
|
|
124
121
|
import { SharePlugin } from "./sharing/SharePlugin";
|
|
125
|
-
import {
|
|
126
|
-
export type { CollectShareEntryPluginOptions } from "./sharing/CollectShareEntryPlugin";
|
|
122
|
+
import { TreeShakeSharedPlugin } from "./sharing/TreeShakeSharedPlugin";
|
|
127
123
|
export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject } from "./sharing/ConsumeSharedPlugin";
|
|
128
124
|
export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject } from "./sharing/ProvideSharedPlugin";
|
|
129
|
-
export type { ShareContainerPluginOptions } from "./sharing/ShareContainerPlugin";
|
|
130
125
|
export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions } from "./sharing/SharePlugin";
|
|
131
|
-
export type {
|
|
126
|
+
export type { TreeshakeSharedPluginOptions } from "./sharing/TreeShakeSharedPlugin";
|
|
132
127
|
export declare const sharing: {
|
|
133
128
|
ProvideSharedPlugin: typeof ProvideSharedPlugin;
|
|
134
|
-
|
|
135
|
-
TreeshakeSharePlugin: typeof TreeshakeSharePlugin;
|
|
136
|
-
ShareContainerPlugin: typeof ShareContainerPlugin;
|
|
137
|
-
OptimizeDependencyReferencedExportsPlugin: typeof OptimizeDependencyReferencedExportsPlugin;
|
|
129
|
+
TreeShakeSharedPlugin: typeof TreeShakeSharedPlugin;
|
|
138
130
|
ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
|
|
139
131
|
SharePlugin: typeof SharePlugin;
|
|
140
132
|
};
|
package/dist/index.js
CHANGED
|
@@ -4706,6 +4706,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4706
4706
|
}
|
|
4707
4707
|
}(tag);
|
|
4708
4708
|
if (!tagSrc) return;
|
|
4709
|
+
try {
|
|
4710
|
+
let url = new URL(tagSrc);
|
|
4711
|
+
if (("http:" === url.protocol || "https:" === url.protocol) && (!publicPath || !tagSrc.startsWith(publicPath))) return;
|
|
4712
|
+
} catch (_) {}
|
|
4709
4713
|
let src = (0, external_node_path_namespaceObject.relative)(publicPath, decodeURIComponent(tagSrc));
|
|
4710
4714
|
tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
|
|
4711
4715
|
let { createHash } = __webpack_require__("node:crypto");
|
|
@@ -5736,7 +5740,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5736
5740
|
}, applyExperimentsDefaults = (experiments, { development })=>{
|
|
5737
5741
|
F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "deferImport", !1), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
|
|
5738
5742
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
5739
|
-
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-
|
|
5743
|
+
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-a407d226-20251124112255"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
|
|
5740
5744
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst, deferImport })=>{
|
|
5741
5745
|
if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { usedExports, inlineConst, deferImport })=>{
|
|
5742
5746
|
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", [
|
|
@@ -7386,7 +7390,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7386
7390
|
});
|
|
7387
7391
|
}
|
|
7388
7392
|
}
|
|
7389
|
-
let CORE_VERSION = "1.6.5-canary-
|
|
7393
|
+
let CORE_VERSION = "1.6.5-canary-a407d226-20251124112255", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
7390
7394
|
|
|
7391
7395
|
Help:
|
|
7392
7396
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
@@ -8686,7 +8690,7 @@ Help:
|
|
|
8686
8690
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8687
8691
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8688
8692
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8689
|
-
}), childOptions.version && (obj.rspackVersion = "1.6.5-canary-
|
|
8693
|
+
}), childOptions.version && (obj.rspackVersion = "1.6.5-canary-a407d226-20251124112255", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
|
8690
8694
|
let mapError = (j, obj)=>({
|
|
8691
8695
|
...obj,
|
|
8692
8696
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9585,7 +9589,7 @@ Help:
|
|
|
9585
9589
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
9586
9590
|
},
|
|
9587
9591
|
version: (object)=>{
|
|
9588
|
-
object.version = "5.75.0", object.rspackVersion = "1.6.5-canary-
|
|
9592
|
+
object.version = "5.75.0", object.rspackVersion = "1.6.5-canary-a407d226-20251124112255";
|
|
9589
9593
|
},
|
|
9590
9594
|
env: (object, _compilation, _context, { _env })=>{
|
|
9591
9595
|
object.env = _env;
|
|
@@ -11640,31 +11644,6 @@ Help:
|
|
|
11640
11644
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
11641
11645
|
}
|
|
11642
11646
|
}
|
|
11643
|
-
class OptimizeDependencyReferencedExportsPlugin extends RspackBuiltinPlugin {
|
|
11644
|
-
name = binding_.BuiltinPluginName.OptimizeDependencyReferencedExportsPlugin;
|
|
11645
|
-
sharedOptions;
|
|
11646
|
-
injectUsedExports;
|
|
11647
|
-
manifestOptions;
|
|
11648
|
-
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
11649
|
-
super(), this.sharedOptions = sharedOptions, this.injectUsedExports = injectUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
|
|
11650
|
-
}
|
|
11651
|
-
buildOptions() {
|
|
11652
|
-
let shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
11653
|
-
shareKey,
|
|
11654
|
-
treeshake: !!config.treeshake,
|
|
11655
|
-
usedExports: config.usedExports
|
|
11656
|
-
})), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
11657
|
-
return {
|
|
11658
|
-
shared,
|
|
11659
|
-
injectUsedExports: this.injectUsedExports,
|
|
11660
|
-
manifestFileName,
|
|
11661
|
-
statsFileName
|
|
11662
|
-
};
|
|
11663
|
-
}
|
|
11664
|
-
raw() {
|
|
11665
|
-
if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
|
|
11666
|
-
}
|
|
11667
|
-
}
|
|
11668
11647
|
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
11669
11648
|
name = binding_.BuiltinPluginName.ProvideSharedPlugin;
|
|
11670
11649
|
_provides;
|
|
@@ -11758,12 +11737,10 @@ Help:
|
|
|
11758
11737
|
provides: this._provides,
|
|
11759
11738
|
enhanced: this._enhanced
|
|
11760
11739
|
}).apply(compiler);
|
|
11761
|
-
let treeshakeOptions = this._sharedOptions.filter(([, config])=>config.treeshake);
|
|
11762
|
-
treeshakeOptions.length > 0 && new OptimizeDependencyReferencedExportsPlugin(treeshakeOptions).apply(compiler);
|
|
11763
11740
|
}
|
|
11764
11741
|
}
|
|
11765
|
-
class
|
|
11766
|
-
name = binding_.BuiltinPluginName.
|
|
11742
|
+
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
11743
|
+
name = binding_.BuiltinPluginName.CollectSharedEntryPlugin;
|
|
11767
11744
|
sharedOptions;
|
|
11768
11745
|
_collectedEntries;
|
|
11769
11746
|
constructor(options){
|
|
@@ -11775,13 +11752,13 @@ Help:
|
|
|
11775
11752
|
return this._collectedEntries;
|
|
11776
11753
|
}
|
|
11777
11754
|
getFilename() {
|
|
11778
|
-
return "collect-
|
|
11755
|
+
return "collect-shared-entries.json";
|
|
11779
11756
|
}
|
|
11780
11757
|
apply(compiler) {
|
|
11781
|
-
super.apply(compiler), compiler.hooks.thisCompilation.tap("Collect
|
|
11758
|
+
super.apply(compiler), compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
|
|
11782
11759
|
compilation.hooks.processAssets.tapPromise({
|
|
11783
|
-
name: "
|
|
11784
|
-
stage: compiler.webpack.Compilation.
|
|
11760
|
+
name: "CollectSharedEntry",
|
|
11761
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
11785
11762
|
}, async ()=>{
|
|
11786
11763
|
let filename = this.getFilename(), asset = compilation.getAsset(filename);
|
|
11787
11764
|
if (!asset) throw Error(`Can not get ${filename}`);
|
|
@@ -11854,6 +11831,31 @@ Help:
|
|
|
11854
11831
|
});
|
|
11855
11832
|
}
|
|
11856
11833
|
}
|
|
11834
|
+
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
11835
|
+
name = binding_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
|
|
11836
|
+
sharedOptions;
|
|
11837
|
+
injectUsedExports;
|
|
11838
|
+
manifestOptions;
|
|
11839
|
+
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
11840
|
+
super(), this.sharedOptions = sharedOptions, this.injectUsedExports = injectUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
|
|
11841
|
+
}
|
|
11842
|
+
buildOptions() {
|
|
11843
|
+
let shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
11844
|
+
shareKey,
|
|
11845
|
+
treeshake: !!config.treeshake,
|
|
11846
|
+
usedExports: config.usedExports
|
|
11847
|
+
})), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
11848
|
+
return {
|
|
11849
|
+
shared,
|
|
11850
|
+
injectUsedExports: this.injectUsedExports,
|
|
11851
|
+
manifestFileName,
|
|
11852
|
+
statsFileName
|
|
11853
|
+
};
|
|
11854
|
+
}
|
|
11855
|
+
raw() {
|
|
11856
|
+
if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
|
|
11857
|
+
}
|
|
11858
|
+
}
|
|
11857
11859
|
let VIRTUAL_ENTRY = "./virtual-entry.js", VIRTUAL_ENTRY_NAME = "virtual-entry";
|
|
11858
11860
|
class VirtualEntryPlugin {
|
|
11859
11861
|
sharedOptions;
|
|
@@ -11889,7 +11891,7 @@ Help:
|
|
|
11889
11891
|
});
|
|
11890
11892
|
}
|
|
11891
11893
|
}
|
|
11892
|
-
class
|
|
11894
|
+
class IndependentSharedPlugin {
|
|
11893
11895
|
mfName;
|
|
11894
11896
|
shared;
|
|
11895
11897
|
library;
|
|
@@ -11902,7 +11904,7 @@ Help:
|
|
|
11902
11904
|
manifest;
|
|
11903
11905
|
buildAssets = {};
|
|
11904
11906
|
injectUsedExports;
|
|
11905
|
-
name = "
|
|
11907
|
+
name = "IndependentSharedPlugin";
|
|
11906
11908
|
constructor(options){
|
|
11907
11909
|
const { outputDir, outputFilePath, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
|
|
11908
11910
|
this.shared = shared, this.mfName = name, this.outputDir = outputFilePath ? "" : outputDir || "independent-packages", this.outputFilePath = outputFilePath, this.plugins = plugins || [], this.treeshake = treeshake, this.manifest = manifest, this.injectUsedExports = injectUsedExports ?? !0, this.library = library, this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
@@ -11916,25 +11918,28 @@ Help:
|
|
|
11916
11918
|
}, (item)=>item);
|
|
11917
11919
|
}
|
|
11918
11920
|
apply(compiler) {
|
|
11919
|
-
compiler.hooks.beforeRun.
|
|
11920
|
-
await this.createIndependentCompilers(compiler)
|
|
11921
|
-
}), compiler.hooks.shutdown.tapAsync("
|
|
11922
|
-
this.cleanup(),
|
|
11923
|
-
}), compiler.hooks.compilation.tap("
|
|
11921
|
+
compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async (compiler)=>{
|
|
11922
|
+
await this.createIndependentCompilers(compiler);
|
|
11923
|
+
}), compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
|
|
11924
|
+
this.cleanup(), callback();
|
|
11925
|
+
}), compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
|
|
11924
11926
|
compilation.hooks.processAssets.tapPromise({
|
|
11925
11927
|
name: "injectBuildAssets",
|
|
11926
11928
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
11927
11929
|
}, async ()=>{
|
|
11928
11930
|
if (!this.manifest) return;
|
|
11929
|
-
let { statsFileName } = getFileName(this.manifest),
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11931
|
+
let { statsFileName, manifestFileName } = getFileName(this.manifest), injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
11932
|
+
let stats = compilation.getAsset(filename);
|
|
11933
|
+
if (!stats) return;
|
|
11934
|
+
let statsContent = JSON.parse(stats.source.source().toString()), { shared } = statsContent;
|
|
11935
|
+
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
11936
|
+
let targetShared = shared.find((s)=>s.name === key);
|
|
11937
|
+
targetShared && item.forEach(([entry, version, globalName])=>{
|
|
11938
|
+
version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
|
|
11939
|
+
});
|
|
11940
|
+
}), compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
11941
|
+
};
|
|
11942
|
+
injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
11938
11943
|
});
|
|
11939
11944
|
});
|
|
11940
11945
|
}
|
|
@@ -11969,7 +11974,7 @@ Help:
|
|
|
11969
11974
|
mfName,
|
|
11970
11975
|
library,
|
|
11971
11976
|
...extraOptions.currentShare
|
|
11972
|
-
}) : new
|
|
11977
|
+
}) : new CollectSharedEntryPlugin({
|
|
11973
11978
|
sharedOptions,
|
|
11974
11979
|
shareScope: "default"
|
|
11975
11980
|
}), (parentConfig.plugins || []).forEach((plugin)=>{
|
|
@@ -11977,10 +11982,10 @@ Help:
|
|
|
11977
11982
|
if (!plugin) return !0;
|
|
11978
11983
|
let pluginName = plugin.name || plugin.constructor?.name;
|
|
11979
11984
|
return !pluginName || ![
|
|
11980
|
-
"
|
|
11981
|
-
"
|
|
11985
|
+
"TreeShakeSharedPlugin",
|
|
11986
|
+
"IndependentSharedPlugin",
|
|
11982
11987
|
"ModuleFederationPlugin",
|
|
11983
|
-
"
|
|
11988
|
+
"SharedUsedExportsOptimizerPlugin",
|
|
11984
11989
|
"HtmlWebpackPlugin"
|
|
11985
11990
|
].includes(pluginName);
|
|
11986
11991
|
})(plugin) && finalPlugins.push(plugin);
|
|
@@ -11989,7 +11994,7 @@ Help:
|
|
|
11989
11994
|
}), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
|
|
11990
11995
|
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
11991
11996
|
[key]: {
|
|
11992
|
-
import:
|
|
11997
|
+
import: !extraOptions && options.import,
|
|
11993
11998
|
shareKey: options.shareKey || key,
|
|
11994
11999
|
shareScope: options.shareScope,
|
|
11995
12000
|
requiredVersion: options.requiredVersion,
|
|
@@ -12000,7 +12005,7 @@ Help:
|
|
|
12000
12005
|
}
|
|
12001
12006
|
})),
|
|
12002
12007
|
enhanced: !0
|
|
12003
|
-
})), treeshake && finalPlugins.push(new
|
|
12008
|
+
})), treeshake && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
|
|
12004
12009
|
let fullOutputDir = (0, external_node_path_namespaceObject.resolve)(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
|
|
12005
12010
|
...parentConfig,
|
|
12006
12011
|
mode: parentConfig.mode || "development",
|
|
@@ -12041,6 +12046,35 @@ Help:
|
|
|
12041
12046
|
}), this.compilers.clear();
|
|
12042
12047
|
}
|
|
12043
12048
|
}
|
|
12049
|
+
class TreeShakeSharedPlugin {
|
|
12050
|
+
mfConfig;
|
|
12051
|
+
outputDir;
|
|
12052
|
+
plugins;
|
|
12053
|
+
reshake;
|
|
12054
|
+
_independentSharePlugin;
|
|
12055
|
+
name = "TreeShakeSharedPlugin";
|
|
12056
|
+
constructor(options){
|
|
12057
|
+
const { mfConfig, plugins, reshake } = options;
|
|
12058
|
+
this.mfConfig = mfConfig, this.outputDir = mfConfig.independentShareDir || "independent-packages", this.plugins = plugins, this.reshake = !!reshake;
|
|
12059
|
+
}
|
|
12060
|
+
apply(compiler) {
|
|
12061
|
+
let { mfConfig, outputDir, plugins, reshake } = this, { name, shared, library } = mfConfig;
|
|
12062
|
+
if (!shared) return;
|
|
12063
|
+
let sharedOptions = normalizeSharedOptions(shared);
|
|
12064
|
+
sharedOptions.length && (reshake || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler), sharedOptions.some(([_, config])=>config.treeshake && !1 !== config.import) && (this._independentSharePlugin = new IndependentSharedPlugin({
|
|
12065
|
+
name: name,
|
|
12066
|
+
shared: shared,
|
|
12067
|
+
outputDir,
|
|
12068
|
+
plugins,
|
|
12069
|
+
treeshake: reshake,
|
|
12070
|
+
library,
|
|
12071
|
+
manifest: mfConfig.manifest
|
|
12072
|
+
}), this._independentSharePlugin.apply(compiler)));
|
|
12073
|
+
}
|
|
12074
|
+
get buildAssets() {
|
|
12075
|
+
return this._independentSharePlugin?.buildAssets || {};
|
|
12076
|
+
}
|
|
12077
|
+
}
|
|
12044
12078
|
let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
12045
12079
|
function getRemoteInfos(options) {
|
|
12046
12080
|
if (!options.remotes) return {};
|
|
@@ -12188,7 +12222,7 @@ Help:
|
|
|
12188
12222
|
let _options = JSON.stringify(options || {});
|
|
12189
12223
|
return binding_default().transform(source, _options);
|
|
12190
12224
|
}
|
|
12191
|
-
let exports_rspackVersion = "1.6.5-canary-
|
|
12225
|
+
let exports_rspackVersion = "1.6.5-canary-a407d226-20251124112255", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
|
12192
12226
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
12193
12227
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
12194
12228
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -12231,13 +12265,13 @@ Help:
|
|
|
12231
12265
|
ContainerReferencePlugin: ContainerReferencePlugin,
|
|
12232
12266
|
ModuleFederationPlugin: class {
|
|
12233
12267
|
_options;
|
|
12234
|
-
|
|
12268
|
+
_treeShakeSharedPlugin;
|
|
12235
12269
|
constructor(_options){
|
|
12236
12270
|
this._options = _options;
|
|
12237
12271
|
}
|
|
12238
12272
|
apply(compiler) {
|
|
12239
12273
|
var options, options1;
|
|
12240
|
-
let runtimeToolsPath, bundlerRuntimePath, runtimePath, {
|
|
12274
|
+
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", {
|
|
12241
12275
|
paths: [
|
|
12242
12276
|
runtimeToolsPath
|
|
12243
12277
|
]
|
|
@@ -12262,11 +12296,10 @@ Help:
|
|
|
12262
12296
|
} : {
|
|
12263
12297
|
import: item
|
|
12264
12298
|
};
|
|
12265
|
-
}, (item)=>item) : []).filter(([, config])=>config.treeshake).length > 0 && (this.
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
}), this._independentSharePlugin.apply(compiler));
|
|
12299
|
+
}, (item)=>item) : []).filter(([, config])=>config.treeshake).length > 0 && (this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
|
|
12300
|
+
mfConfig: this._options,
|
|
12301
|
+
reshake: !1
|
|
12302
|
+
}), this._treeShakeSharedPlugin.apply(compiler));
|
|
12270
12303
|
let runtimePluginApplied = !1;
|
|
12271
12304
|
compiler.hooks.beforeRun.tapPromise({
|
|
12272
12305
|
name: "ModuleFederationPlugin",
|
|
@@ -12292,7 +12325,7 @@ Help:
|
|
|
12292
12325
|
compiler.webpack.Template.getFunctionContent(__webpack_require__("./moduleFederationDefaultRuntime.js"))
|
|
12293
12326
|
].join(";");
|
|
12294
12327
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
12295
|
-
}(paths, this._options, compiler, this.
|
|
12328
|
+
}(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {})
|
|
12296
12329
|
}).apply(compiler));
|
|
12297
12330
|
}), new webpack.container.ModuleFederationPluginV1({
|
|
12298
12331
|
...this._options,
|
|
@@ -12334,33 +12367,7 @@ Help:
|
|
|
12334
12367
|
}
|
|
12335
12368
|
}, sharing = {
|
|
12336
12369
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
12337
|
-
|
|
12338
|
-
TreeshakeSharePlugin: class {
|
|
12339
|
-
mfConfig;
|
|
12340
|
-
outputDir;
|
|
12341
|
-
plugins;
|
|
12342
|
-
reshake;
|
|
12343
|
-
name = "TreeshakeSharePlugin";
|
|
12344
|
-
constructor(options){
|
|
12345
|
-
const { mfConfig, plugins, reshake } = options;
|
|
12346
|
-
this.mfConfig = mfConfig, this.outputDir = mfConfig.independentShareDir || "independent-packages", this.plugins = plugins, this.reshake = !!reshake;
|
|
12347
|
-
}
|
|
12348
|
-
apply(compiler) {
|
|
12349
|
-
let { mfConfig, outputDir, plugins, reshake } = this, { name, shared, library } = mfConfig;
|
|
12350
|
-
if (!shared) return;
|
|
12351
|
-
let sharedOptions = normalizeSharedOptions(shared);
|
|
12352
|
-
sharedOptions.length && (reshake || new OptimizeDependencyReferencedExportsPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler), sharedOptions.some(([_, config])=>config.treeshake && !1 !== config.import) && new IndependentSharePlugin({
|
|
12353
|
-
name: name,
|
|
12354
|
-
shared: shared,
|
|
12355
|
-
outputDir,
|
|
12356
|
-
plugins,
|
|
12357
|
-
treeshake: reshake,
|
|
12358
|
-
library
|
|
12359
|
-
}).apply(compiler));
|
|
12360
|
-
}
|
|
12361
|
-
},
|
|
12362
|
-
ShareContainerPlugin: ShareContainerPlugin,
|
|
12363
|
-
OptimizeDependencyReferencedExportsPlugin: OptimizeDependencyReferencedExportsPlugin,
|
|
12370
|
+
TreeShakeSharedPlugin: TreeShakeSharedPlugin,
|
|
12364
12371
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
12365
12372
|
SharePlugin: SharePlugin
|
|
12366
12373
|
}, exports_experiments = {
|
|
@@ -2,7 +2,7 @@ import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
|
2
2
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
3
|
import type { Compiler } from "../Compiler";
|
|
4
4
|
import { type NormalizedSharedOptions } from "./SharePlugin";
|
|
5
|
-
export type
|
|
5
|
+
export type CollectSharedEntryPluginOptions = {
|
|
6
6
|
sharedOptions: NormalizedSharedOptions;
|
|
7
7
|
shareScope?: string;
|
|
8
8
|
};
|
|
@@ -10,11 +10,11 @@ export type ShareRequestsMap = Record<string, {
|
|
|
10
10
|
shareScope: string;
|
|
11
11
|
requests: [string, string][];
|
|
12
12
|
}>;
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
14
14
|
name: BuiltinPluginName;
|
|
15
15
|
sharedOptions: NormalizedSharedOptions;
|
|
16
16
|
private _collectedEntries;
|
|
17
|
-
constructor(options:
|
|
17
|
+
constructor(options: CollectSharedEntryPluginOptions);
|
|
18
18
|
getData(): ShareRequestsMap;
|
|
19
19
|
getFilename(): string;
|
|
20
20
|
apply(compiler: Compiler): void;
|
|
@@ -15,7 +15,7 @@ export interface IndependentSharePluginOptions {
|
|
|
15
15
|
injectUsedExports?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export type ShareFallback = Record<string, [string, string, string][]>;
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class IndependentSharedPlugin {
|
|
19
19
|
mfName: string;
|
|
20
20
|
shared: Shared;
|
|
21
21
|
library?: LibraryOptions;
|
|
@@ -3,7 +3,7 @@ import { BuiltinPluginName } from "@rspack/binding";
|
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
import { type ModuleFederationManifestPluginOptions } from "../container/ModuleFederationManifestPlugin";
|
|
5
5
|
import type { SharedConfig } from "./SharePlugin";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
7
7
|
name: BuiltinPluginName;
|
|
8
8
|
private sharedOptions;
|
|
9
9
|
private injectUsedExports;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
2
|
import type { Plugins } from "../config";
|
|
3
3
|
import type { ModuleFederationPluginOptions } from "../container/ModuleFederationPlugin";
|
|
4
|
-
export interface
|
|
4
|
+
export interface TreeshakeSharedPluginOptions {
|
|
5
5
|
mfConfig: ModuleFederationPluginOptions;
|
|
6
6
|
plugins?: Plugins;
|
|
7
7
|
reshake?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class TreeShakeSharedPlugin {
|
|
10
10
|
mfConfig: ModuleFederationPluginOptions;
|
|
11
11
|
outputDir: string;
|
|
12
12
|
plugins?: Plugins;
|
|
13
13
|
reshake?: boolean;
|
|
14
|
+
private _independentSharePlugin?;
|
|
14
15
|
name: string;
|
|
15
|
-
constructor(options:
|
|
16
|
+
constructor(options: TreeshakeSharedPluginOptions);
|
|
16
17
|
apply(compiler: Compiler): void;
|
|
18
|
+
get buildAssets(): import("./IndependentSharedPlugin").ShareFallback;
|
|
17
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/core",
|
|
3
|
-
"version": "1.6.5-canary-
|
|
3
|
+
"version": "1.6.5-canary-a407d226-20251124112255",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@module-federation/runtime-tools": "0.21.4",
|
|
60
60
|
"@rspack/lite-tapable": "1.1.0",
|
|
61
|
-
"@rspack/binding": "npm:@rspack-canary/binding@1.6.5-canary-
|
|
61
|
+
"@rspack/binding": "npm:@rspack-canary/binding@1.6.5-canary-a407d226-20251124112255"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@swc/helpers": ">=0.5.1"
|