@rspack-canary/browser 1.6.5-canary-83f58863-20251120092333 → 1.6.5-canary-480f74ac-20251120174032
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/ModuleFederationManifestPlugin.d.ts +2 -9
- package/dist/container/ModuleFederationPlugin.d.ts +1 -16
- package/dist/exports.d.ts +0 -11
- package/dist/index.mjs +333 -841
- package/dist/napi-binding.d.ts +2 -29
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +0 -10
- package/dist/sharing/ProvideSharedPlugin.d.ts +0 -14
- package/dist/sharing/SharePlugin.d.ts +0 -29
- package/dist/sharing/utils.d.ts +0 -1
- package/package.json +1 -1
- package/dist/sharing/CollectShareEntryPlugin.d.ts +0 -22
- package/dist/sharing/IndependentSharePlugin.d.ts +0 -37
- package/dist/sharing/OptimizeDependencyReferencedExportsPlugin.d.ts +0 -14
- package/dist/sharing/ShareContainerPlugin.d.ts +0 -23
- package/dist/sharing/TreeShakeSharePlugin.d.ts +0 -17
package/dist/index.mjs
CHANGED
|
@@ -58137,7 +58137,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58137
58137
|
if ("object" == typeof rspackFuture) {
|
|
58138
58138
|
D(rspackFuture, "bundlerInfo", {});
|
|
58139
58139
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
58140
|
-
D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-
|
|
58140
|
+
D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-480f74ac-20251120174032");
|
|
58141
58141
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
58142
58142
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
58143
58143
|
}
|
|
@@ -62086,7 +62086,7 @@ class MultiStats {
|
|
|
62086
62086
|
return obj;
|
|
62087
62087
|
});
|
|
62088
62088
|
if (childOptions.version) {
|
|
62089
|
-
obj.rspackVersion = "1.6.5-canary-
|
|
62089
|
+
obj.rspackVersion = "1.6.5-canary-480f74ac-20251120174032";
|
|
62090
62090
|
obj.version = "5.75.0";
|
|
62091
62091
|
}
|
|
62092
62092
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -63391,7 +63391,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
63391
63391
|
},
|
|
63392
63392
|
version: (object)=>{
|
|
63393
63393
|
object.version = "5.75.0";
|
|
63394
|
-
object.rspackVersion = "1.6.5-canary-
|
|
63394
|
+
object.rspackVersion = "1.6.5-canary-480f74ac-20251120174032";
|
|
63395
63395
|
},
|
|
63396
63396
|
env: (object, _compilation, _context, { _env })=>{
|
|
63397
63397
|
object.env = _env;
|
|
@@ -65824,34 +65824,6 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
|
65824
65824
|
function isRequiredVersion(str) {
|
|
65825
65825
|
return VERSION_PATTERN_REGEXP.test(str);
|
|
65826
65826
|
}
|
|
65827
|
-
const encodeName = function(name, prefix = "", withExt = false) {
|
|
65828
|
-
const ext = withExt ? ".js" : "";
|
|
65829
|
-
return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
|
|
65830
|
-
};
|
|
65831
|
-
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
65832
|
-
const array = (items)=>{
|
|
65833
|
-
for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
|
|
65834
|
-
else if (item && "object" == typeof item) object(item);
|
|
65835
|
-
else throw new Error("Unexpected options format");
|
|
65836
|
-
};
|
|
65837
|
-
const object = (obj)=>{
|
|
65838
|
-
for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
65839
|
-
};
|
|
65840
|
-
if (!options) return;
|
|
65841
|
-
if (Array.isArray(options)) array(options);
|
|
65842
|
-
else if ("object" == typeof options) object(options);
|
|
65843
|
-
else throw new Error("Unexpected options format");
|
|
65844
|
-
};
|
|
65845
|
-
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
65846
|
-
const items = [];
|
|
65847
|
-
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
65848
|
-
items.push([
|
|
65849
|
-
key,
|
|
65850
|
-
value
|
|
65851
|
-
]);
|
|
65852
|
-
});
|
|
65853
|
-
return items;
|
|
65854
|
-
};
|
|
65855
65827
|
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
65856
65828
|
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
65857
65829
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -65918,87 +65890,6 @@ function getFileName(manifestOptions) {
|
|
|
65918
65890
|
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
65919
65891
|
};
|
|
65920
65892
|
}
|
|
65921
|
-
function resolveLibraryGlobalName(library) {
|
|
65922
|
-
if (!library) return;
|
|
65923
|
-
const libName = library.name;
|
|
65924
|
-
if (!libName) return;
|
|
65925
|
-
if ("string" == typeof libName) return libName;
|
|
65926
|
-
if (Array.isArray(libName)) return libName[0];
|
|
65927
|
-
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
65928
|
-
}
|
|
65929
|
-
function collectManifestExposes(exposes) {
|
|
65930
|
-
if (!exposes) return;
|
|
65931
|
-
const parsed = parseOptions(exposes, (value)=>({
|
|
65932
|
-
import: Array.isArray(value) ? value : [
|
|
65933
|
-
value
|
|
65934
|
-
],
|
|
65935
|
-
name: void 0
|
|
65936
|
-
}), (value)=>({
|
|
65937
|
-
import: Array.isArray(value.import) ? value.import : [
|
|
65938
|
-
value.import
|
|
65939
|
-
],
|
|
65940
|
-
name: value.name ?? void 0
|
|
65941
|
-
}));
|
|
65942
|
-
const result = parsed.map(([exposeKey, info])=>{
|
|
65943
|
-
const exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
65944
|
-
return {
|
|
65945
|
-
path: exposeKey,
|
|
65946
|
-
name: exposeName
|
|
65947
|
-
};
|
|
65948
|
-
});
|
|
65949
|
-
return result.length > 0 ? result : void 0;
|
|
65950
|
-
}
|
|
65951
|
-
function collectManifestShared(shared) {
|
|
65952
|
-
if (!shared) return;
|
|
65953
|
-
const parsed = parseOptions(shared, (item, key)=>{
|
|
65954
|
-
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
65955
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
65956
|
-
import: key,
|
|
65957
|
-
requiredVersion: item
|
|
65958
|
-
} : {
|
|
65959
|
-
import: item
|
|
65960
|
-
};
|
|
65961
|
-
}, (item)=>item);
|
|
65962
|
-
const result = parsed.map(([key, config])=>{
|
|
65963
|
-
const name = config.shareKey || key;
|
|
65964
|
-
const version = "string" == typeof config.version ? config.version : void 0;
|
|
65965
|
-
const requiredVersion = "string" == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
65966
|
-
return {
|
|
65967
|
-
name,
|
|
65968
|
-
version,
|
|
65969
|
-
requiredVersion,
|
|
65970
|
-
singleton: config.singleton
|
|
65971
|
-
};
|
|
65972
|
-
});
|
|
65973
|
-
return result.length > 0 ? result : void 0;
|
|
65974
|
-
}
|
|
65975
|
-
function normalizeManifestOptions(mfConfig) {
|
|
65976
|
-
const manifestOptions = true === mfConfig.manifest ? {} : {
|
|
65977
|
-
...mfConfig.manifest
|
|
65978
|
-
};
|
|
65979
|
-
const containerName = mfConfig.name;
|
|
65980
|
-
const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
|
|
65981
|
-
const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
|
|
65982
|
-
if (cur[1].length > 1) return sum;
|
|
65983
|
-
const remoteInfo = cur[1][0];
|
|
65984
|
-
const { entry, alias, name } = remoteInfo;
|
|
65985
|
-
if (entry && name) sum[alias] = {
|
|
65986
|
-
name,
|
|
65987
|
-
entry
|
|
65988
|
-
};
|
|
65989
|
-
return sum;
|
|
65990
|
-
}, {});
|
|
65991
|
-
const manifestExposes = collectManifestExposes(mfConfig.exposes);
|
|
65992
|
-
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
65993
|
-
const manifestShared = collectManifestShared(mfConfig.shared);
|
|
65994
|
-
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
65995
|
-
return {
|
|
65996
|
-
...manifestOptions,
|
|
65997
|
-
remoteAliasMap,
|
|
65998
|
-
globalName,
|
|
65999
|
-
name: containerName
|
|
66000
|
-
};
|
|
66001
|
-
}
|
|
66002
65893
|
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66003
65894
|
raw(compiler) {
|
|
66004
65895
|
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
|
|
@@ -66010,651 +65901,44 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
|
66010
65901
|
filePath,
|
|
66011
65902
|
manifestFileName,
|
|
66012
65903
|
statsFileName,
|
|
66013
|
-
disableAssetsAnalyze,
|
|
66014
|
-
remoteAliasMap,
|
|
66015
|
-
exposes,
|
|
66016
|
-
shared,
|
|
66017
|
-
buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
|
|
66018
|
-
};
|
|
66019
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66020
|
-
}
|
|
66021
|
-
constructor(opts){
|
|
66022
|
-
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
66023
|
-
this.opts =
|
|
66024
|
-
}
|
|
66025
|
-
}
|
|
66026
|
-
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66027
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66028
|
-
value: value,
|
|
66029
|
-
enumerable: true,
|
|
66030
|
-
configurable: true,
|
|
66031
|
-
writable: true
|
|
66032
|
-
});
|
|
66033
|
-
else obj[key] = value;
|
|
66034
|
-
return obj;
|
|
66035
|
-
}
|
|
66036
|
-
const compilerSet = new WeakSet();
|
|
66037
|
-
function isSingleton(compiler) {
|
|
66038
|
-
return compilerSet.has(compiler);
|
|
66039
|
-
}
|
|
66040
|
-
function setSingleton(compiler) {
|
|
66041
|
-
compilerSet.add(compiler);
|
|
66042
|
-
}
|
|
66043
|
-
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66044
|
-
raw(compiler) {
|
|
66045
|
-
if (isSingleton(compiler)) return;
|
|
66046
|
-
setSingleton(compiler);
|
|
66047
|
-
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66048
|
-
}
|
|
66049
|
-
constructor(enhanced = false){
|
|
66050
|
-
super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
|
|
66051
|
-
}
|
|
66052
|
-
}
|
|
66053
|
-
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66054
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66055
|
-
value: value,
|
|
66056
|
-
enumerable: true,
|
|
66057
|
-
configurable: true,
|
|
66058
|
-
writable: true
|
|
66059
|
-
});
|
|
66060
|
-
else obj[key] = value;
|
|
66061
|
-
return obj;
|
|
66062
|
-
}
|
|
66063
|
-
function normalizeConsumeShareOptions(consumes, shareScope) {
|
|
66064
|
-
return parseOptions(consumes, (item, key)=>{
|
|
66065
|
-
if (Array.isArray(item)) throw new Error("Unexpected array in options");
|
|
66066
|
-
const result = item !== key && isRequiredVersion(item) ? {
|
|
66067
|
-
import: key,
|
|
66068
|
-
shareScope: shareScope || "default",
|
|
66069
|
-
shareKey: key,
|
|
66070
|
-
requiredVersion: item,
|
|
66071
|
-
strictVersion: true,
|
|
66072
|
-
packageName: void 0,
|
|
66073
|
-
singleton: false,
|
|
66074
|
-
eager: false
|
|
66075
|
-
} : {
|
|
66076
|
-
import: key,
|
|
66077
|
-
shareScope: shareScope || "default",
|
|
66078
|
-
shareKey: key,
|
|
66079
|
-
requiredVersion: void 0,
|
|
66080
|
-
packageName: void 0,
|
|
66081
|
-
strictVersion: false,
|
|
66082
|
-
singleton: false,
|
|
66083
|
-
eager: false
|
|
66084
|
-
};
|
|
66085
|
-
return result;
|
|
66086
|
-
}, (item, key)=>({
|
|
66087
|
-
import: false === item.import ? void 0 : item.import || key,
|
|
66088
|
-
shareScope: item.shareScope || shareScope || "default",
|
|
66089
|
-
shareKey: item.shareKey || key,
|
|
66090
|
-
requiredVersion: item.requiredVersion,
|
|
66091
|
-
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66092
|
-
packageName: item.packageName,
|
|
66093
|
-
singleton: !!item.singleton,
|
|
66094
|
-
eager: !!item.eager
|
|
66095
|
-
}));
|
|
66096
|
-
}
|
|
66097
|
-
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66098
|
-
raw(compiler) {
|
|
66099
|
-
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66100
|
-
const rawOptions = {
|
|
66101
|
-
consumes: this._options.consumes.map(([key, v])=>({
|
|
66102
|
-
key,
|
|
66103
|
-
...v
|
|
66104
|
-
})),
|
|
66105
|
-
enhanced: this._options.enhanced
|
|
66106
|
-
};
|
|
66107
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66108
|
-
}
|
|
66109
|
-
constructor(options){
|
|
66110
|
-
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66111
|
-
this._options = {
|
|
66112
|
-
consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
|
|
66113
|
-
enhanced: options.enhanced ?? false
|
|
66114
|
-
};
|
|
66115
|
-
}
|
|
66116
|
-
}
|
|
66117
|
-
function OptimizeDependencyReferencedExportsPlugin_define_property(obj, key, value) {
|
|
66118
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66119
|
-
value: value,
|
|
66120
|
-
enumerable: true,
|
|
66121
|
-
configurable: true,
|
|
66122
|
-
writable: true
|
|
66123
|
-
});
|
|
66124
|
-
else obj[key] = value;
|
|
66125
|
-
return obj;
|
|
66126
|
-
}
|
|
66127
|
-
class OptimizeDependencyReferencedExportsPlugin extends RspackBuiltinPlugin {
|
|
66128
|
-
buildOptions() {
|
|
66129
|
-
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66130
|
-
shareKey,
|
|
66131
|
-
treeshake: !!config.treeshake,
|
|
66132
|
-
usedExports: config.usedExports
|
|
66133
|
-
}));
|
|
66134
|
-
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66135
|
-
return {
|
|
66136
|
-
shared,
|
|
66137
|
-
injectUsedExports: this.injectUsedExports,
|
|
66138
|
-
manifestFileName,
|
|
66139
|
-
statsFileName
|
|
66140
|
-
};
|
|
66141
|
-
}
|
|
66142
|
-
raw() {
|
|
66143
|
-
if (!this.sharedOptions.length) return;
|
|
66144
|
-
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66145
|
-
}
|
|
66146
|
-
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
66147
|
-
super(), OptimizeDependencyReferencedExportsPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.OptimizeDependencyReferencedExportsPlugin), OptimizeDependencyReferencedExportsPlugin_define_property(this, "sharedOptions", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "injectUsedExports", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "manifestOptions", void 0);
|
|
66148
|
-
this.sharedOptions = sharedOptions;
|
|
66149
|
-
this.injectUsedExports = injectUsedExports ?? true;
|
|
66150
|
-
this.manifestOptions = manifestOptions ?? {};
|
|
66151
|
-
}
|
|
66152
|
-
}
|
|
66153
|
-
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66154
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66155
|
-
value: value,
|
|
66156
|
-
enumerable: true,
|
|
66157
|
-
configurable: true,
|
|
66158
|
-
writable: true
|
|
66159
|
-
});
|
|
66160
|
-
else obj[key] = value;
|
|
66161
|
-
return obj;
|
|
66162
|
-
}
|
|
66163
|
-
function normalizeProvideShareOptions(options, shareScope, enhanced) {
|
|
66164
|
-
return parseOptions(options, (item)=>{
|
|
66165
|
-
if (Array.isArray(item)) throw new Error("Unexpected array of provides");
|
|
66166
|
-
return {
|
|
66167
|
-
shareKey: item,
|
|
66168
|
-
version: void 0,
|
|
66169
|
-
shareScope: shareScope || "default",
|
|
66170
|
-
eager: false
|
|
66171
|
-
};
|
|
66172
|
-
}, (item)=>{
|
|
66173
|
-
const raw = {
|
|
66174
|
-
shareKey: item.shareKey,
|
|
66175
|
-
version: item.version,
|
|
66176
|
-
shareScope: item.shareScope || shareScope || "default",
|
|
66177
|
-
eager: !!item.eager
|
|
66178
|
-
};
|
|
66179
|
-
if (enhanced) {
|
|
66180
|
-
const enhancedItem = item;
|
|
66181
|
-
return {
|
|
66182
|
-
...raw,
|
|
66183
|
-
singleton: enhancedItem.singleton,
|
|
66184
|
-
requiredVersion: enhancedItem.requiredVersion,
|
|
66185
|
-
strictVersion: enhancedItem.strictVersion
|
|
66186
|
-
};
|
|
66187
|
-
}
|
|
66188
|
-
return raw;
|
|
66189
|
-
});
|
|
66190
|
-
}
|
|
66191
|
-
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66192
|
-
raw(compiler) {
|
|
66193
|
-
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66194
|
-
const rawOptions = this._provides.map(([key, v])=>({
|
|
66195
|
-
key,
|
|
66196
|
-
...v
|
|
66197
|
-
}));
|
|
66198
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66199
|
-
}
|
|
66200
|
-
constructor(options){
|
|
66201
|
-
super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
|
|
66202
|
-
this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
|
|
66203
|
-
this._enhanced = options.enhanced;
|
|
66204
|
-
}
|
|
66205
|
-
}
|
|
66206
|
-
function SharePlugin_define_property(obj, key, value) {
|
|
66207
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66208
|
-
value: value,
|
|
66209
|
-
enumerable: true,
|
|
66210
|
-
configurable: true,
|
|
66211
|
-
writable: true
|
|
66212
|
-
});
|
|
66213
|
-
else obj[key] = value;
|
|
66214
|
-
return obj;
|
|
66215
|
-
}
|
|
66216
|
-
function normalizeSharedOptions(shared) {
|
|
66217
|
-
return parseOptions(shared, (item, key)=>{
|
|
66218
|
-
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66219
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
66220
|
-
import: key,
|
|
66221
|
-
requiredVersion: item
|
|
66222
|
-
} : {
|
|
66223
|
-
import: item
|
|
66224
|
-
};
|
|
66225
|
-
return config;
|
|
66226
|
-
}, (item)=>item);
|
|
66227
|
-
}
|
|
66228
|
-
function createProvideShareOptions(normalizedSharedOptions) {
|
|
66229
|
-
return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66230
|
-
[options.import || key]: {
|
|
66231
|
-
shareKey: options.shareKey || key,
|
|
66232
|
-
shareScope: options.shareScope,
|
|
66233
|
-
version: options.version,
|
|
66234
|
-
eager: options.eager,
|
|
66235
|
-
singleton: options.singleton,
|
|
66236
|
-
requiredVersion: options.requiredVersion,
|
|
66237
|
-
strictVersion: options.strictVersion
|
|
66238
|
-
}
|
|
66239
|
-
}));
|
|
66240
|
-
}
|
|
66241
|
-
function createConsumeShareOptions(normalizedSharedOptions) {
|
|
66242
|
-
return normalizedSharedOptions.map(([key, options])=>({
|
|
66243
|
-
[key]: {
|
|
66244
|
-
import: options.import,
|
|
66245
|
-
shareKey: options.shareKey || key,
|
|
66246
|
-
shareScope: options.shareScope,
|
|
66247
|
-
requiredVersion: options.requiredVersion,
|
|
66248
|
-
strictVersion: options.strictVersion,
|
|
66249
|
-
singleton: options.singleton,
|
|
66250
|
-
packageName: options.packageName,
|
|
66251
|
-
eager: options.eager
|
|
66252
|
-
}
|
|
66253
|
-
}));
|
|
66254
|
-
}
|
|
66255
|
-
class SharePlugin {
|
|
66256
|
-
apply(compiler) {
|
|
66257
|
-
new ConsumeSharedPlugin({
|
|
66258
|
-
shareScope: this._shareScope,
|
|
66259
|
-
consumes: this._consumes,
|
|
66260
|
-
enhanced: this._enhanced
|
|
66261
|
-
}).apply(compiler);
|
|
66262
|
-
new ProvideSharedPlugin({
|
|
66263
|
-
shareScope: this._shareScope,
|
|
66264
|
-
provides: this._provides,
|
|
66265
|
-
enhanced: this._enhanced
|
|
66266
|
-
}).apply(compiler);
|
|
66267
|
-
const treeshakeOptions = this._sharedOptions.filter(([, config])=>config.treeshake);
|
|
66268
|
-
if (treeshakeOptions.length > 0) new OptimizeDependencyReferencedExportsPlugin(treeshakeOptions).apply(compiler);
|
|
66269
|
-
}
|
|
66270
|
-
constructor(options){
|
|
66271
|
-
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66272
|
-
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66273
|
-
SharePlugin_define_property(this, "_provides", void 0);
|
|
66274
|
-
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66275
|
-
SharePlugin_define_property(this, "_sharedOptions", void 0);
|
|
66276
|
-
const sharedOptions = normalizeSharedOptions(options.shared);
|
|
66277
|
-
const consumes = createConsumeShareOptions(sharedOptions);
|
|
66278
|
-
const provides = createProvideShareOptions(sharedOptions);
|
|
66279
|
-
this._shareScope = options.shareScope;
|
|
66280
|
-
this._consumes = consumes;
|
|
66281
|
-
this._provides = provides;
|
|
66282
|
-
this._enhanced = options.enhanced ?? false;
|
|
66283
|
-
this._sharedOptions = sharedOptions;
|
|
66284
|
-
}
|
|
66285
|
-
}
|
|
66286
|
-
function CollectShareEntryPlugin_define_property(obj, key, value) {
|
|
66287
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66288
|
-
value: value,
|
|
66289
|
-
enumerable: true,
|
|
66290
|
-
configurable: true,
|
|
66291
|
-
writable: true
|
|
66292
|
-
});
|
|
66293
|
-
else obj[key] = value;
|
|
66294
|
-
return obj;
|
|
66295
|
-
}
|
|
66296
|
-
const SHARE_ENTRY_ASSET = "collect-share-entries.json";
|
|
66297
|
-
class CollectShareEntryPlugin extends RspackBuiltinPlugin {
|
|
66298
|
-
getData() {
|
|
66299
|
-
return this._collectedEntries;
|
|
66300
|
-
}
|
|
66301
|
-
getFilename() {
|
|
66302
|
-
return SHARE_ENTRY_ASSET;
|
|
66303
|
-
}
|
|
66304
|
-
apply(compiler) {
|
|
66305
|
-
super.apply(compiler);
|
|
66306
|
-
compiler.hooks.thisCompilation.tap("Collect share entry", (compilation)=>{
|
|
66307
|
-
compilation.hooks.processAssets.tapPromise({
|
|
66308
|
-
name: "CollectShareEntry",
|
|
66309
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
66310
|
-
}, async ()=>{
|
|
66311
|
-
const filename = this.getFilename();
|
|
66312
|
-
const asset = compilation.getAsset(filename);
|
|
66313
|
-
if (!asset) throw new Error(`Can not get ${filename}`);
|
|
66314
|
-
this._collectedEntries = JSON.parse(asset.source.source().toString());
|
|
66315
|
-
compilation.deleteAsset(filename);
|
|
66316
|
-
});
|
|
66317
|
-
});
|
|
66318
|
-
}
|
|
66319
|
-
raw() {
|
|
66320
|
-
const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
|
|
66321
|
-
const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
|
|
66322
|
-
const rawOptions = {
|
|
66323
|
-
consumes: normalizedConsumeShareOptions.map(([key, v])=>({
|
|
66324
|
-
key,
|
|
66325
|
-
...v
|
|
66326
|
-
})),
|
|
66327
|
-
filename: this.getFilename()
|
|
66328
|
-
};
|
|
66329
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66330
|
-
}
|
|
66331
|
-
constructor(options){
|
|
66332
|
-
super(), CollectShareEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectShareEntryPlugin), CollectShareEntryPlugin_define_property(this, "sharedOptions", void 0), CollectShareEntryPlugin_define_property(this, "_collectedEntries", void 0);
|
|
66333
|
-
const { sharedOptions } = options;
|
|
66334
|
-
this.sharedOptions = sharedOptions;
|
|
66335
|
-
this._collectedEntries = {};
|
|
66336
|
-
}
|
|
66337
|
-
}
|
|
66338
|
-
function ShareContainerPlugin_define_property(obj, key, value) {
|
|
66339
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66340
|
-
value: value,
|
|
66341
|
-
enumerable: true,
|
|
66342
|
-
configurable: true,
|
|
66343
|
-
writable: true
|
|
66344
|
-
});
|
|
66345
|
-
else obj[key] = value;
|
|
66346
|
-
return obj;
|
|
66347
|
-
}
|
|
66348
|
-
function assert(condition, msg) {
|
|
66349
|
-
if (!condition) throw new Error(msg);
|
|
66350
|
-
}
|
|
66351
|
-
const HOT_UPDATE_SUFFIX = ".hot-update";
|
|
66352
|
-
class ShareContainerPlugin extends RspackBuiltinPlugin {
|
|
66353
|
-
getData() {
|
|
66354
|
-
return [
|
|
66355
|
-
this.name,
|
|
66356
|
-
this._globalName
|
|
66357
|
-
];
|
|
66358
|
-
}
|
|
66359
|
-
raw(compiler) {
|
|
66360
|
-
const { library } = this._options;
|
|
66361
|
-
if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
66362
|
-
return createBuiltinPlugin(this.name, this._options);
|
|
66363
|
-
}
|
|
66364
|
-
apply(compiler) {
|
|
66365
|
-
super.apply(compiler);
|
|
66366
|
-
const shareName = this._shareName;
|
|
66367
|
-
compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
|
|
66368
|
-
compilation.hooks.processAssets.tapPromise({
|
|
66369
|
-
name: "getShareContainerFile"
|
|
66370
|
-
}, async ()=>{
|
|
66371
|
-
const remoteEntryPoint = compilation.entrypoints.get(shareName);
|
|
66372
|
-
assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
|
|
66373
|
-
const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
|
|
66374
|
-
assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
|
|
66375
|
-
const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
|
|
66376
|
-
assert(files.length > 0, `no files found for shared ${shareName} chunk`);
|
|
66377
|
-
assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
|
|
66378
|
-
this.filename = files[0];
|
|
66379
|
-
});
|
|
66380
|
-
});
|
|
66381
|
-
}
|
|
66382
|
-
constructor(options){
|
|
66383
|
-
super(), ShareContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ShareContainerPlugin), ShareContainerPlugin_define_property(this, "filename", ""), ShareContainerPlugin_define_property(this, "_options", void 0), ShareContainerPlugin_define_property(this, "_shareName", void 0), ShareContainerPlugin_define_property(this, "_globalName", void 0);
|
|
66384
|
-
const { shareName, library, request, independentShareFileName } = options;
|
|
66385
|
-
const version = options.version || "0.0.0";
|
|
66386
|
-
this._globalName = encodeName(`${options.mfName}_${shareName}_${version}`);
|
|
66387
|
-
const fileName = independentShareFileName || `${version}/share-entry.js`;
|
|
66388
|
-
this._shareName = shareName;
|
|
66389
|
-
this._options = {
|
|
66390
|
-
name: shareName,
|
|
66391
|
-
request: request,
|
|
66392
|
-
library: (library ? {
|
|
66393
|
-
...library,
|
|
66394
|
-
name: this._globalName
|
|
66395
|
-
} : void 0) || {
|
|
66396
|
-
type: "var",
|
|
66397
|
-
name: this._globalName
|
|
66398
|
-
},
|
|
66399
|
-
version,
|
|
66400
|
-
fileName
|
|
66401
|
-
};
|
|
66402
|
-
}
|
|
66403
|
-
}
|
|
66404
|
-
function IndependentSharePlugin_define_property(obj, key, value) {
|
|
66405
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66406
|
-
value: value,
|
|
66407
|
-
enumerable: true,
|
|
66408
|
-
configurable: true,
|
|
66409
|
-
writable: true
|
|
66410
|
-
});
|
|
66411
|
-
else obj[key] = value;
|
|
66412
|
-
return obj;
|
|
66413
|
-
}
|
|
66414
|
-
const VIRTUAL_ENTRY = "./virtual-entry.js";
|
|
66415
|
-
const VIRTUAL_ENTRY_NAME = "virtual-entry";
|
|
66416
|
-
const filterPlugin = (plugin)=>{
|
|
66417
|
-
if (!plugin) return true;
|
|
66418
|
-
const pluginName = plugin["name"] || plugin["constructor"]?.name;
|
|
66419
|
-
if (!pluginName) return true;
|
|
66420
|
-
return ![
|
|
66421
|
-
"TreeshakeSharePlugin",
|
|
66422
|
-
"IndependentSharePlugin",
|
|
66423
|
-
"ModuleFederationPlugin",
|
|
66424
|
-
"OptimizeDependencyReferencedExportsPlugin",
|
|
66425
|
-
"HtmlWebpackPlugin"
|
|
66426
|
-
].includes(pluginName);
|
|
66427
|
-
};
|
|
66428
|
-
class VirtualEntryPlugin {
|
|
66429
|
-
createEntry() {
|
|
66430
|
-
const { sharedOptions } = this;
|
|
66431
|
-
const entryContent = sharedOptions.reduce((acc, cur, index)=>`${acc}import shared_${index} from '${cur[0]}';\n`, "");
|
|
66432
|
-
return entryContent;
|
|
66433
|
-
}
|
|
66434
|
-
static entry() {
|
|
66435
|
-
return {
|
|
66436
|
-
[VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
|
|
66437
|
-
};
|
|
66438
|
-
}
|
|
66439
|
-
apply(compiler) {
|
|
66440
|
-
new compiler.rspack.experiments.VirtualModulesPlugin({
|
|
66441
|
-
[VIRTUAL_ENTRY]: this.createEntry()
|
|
66442
|
-
}).apply(compiler);
|
|
66443
|
-
compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
|
|
66444
|
-
compilation.hooks.processAssets.tapPromise({
|
|
66445
|
-
name: "RemoveVirtualEntryAsset",
|
|
66446
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
66447
|
-
}, async ()=>{
|
|
66448
|
-
try {
|
|
66449
|
-
const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
66450
|
-
chunk?.files.forEach((f)=>{
|
|
66451
|
-
compilation.deleteAsset(f);
|
|
66452
|
-
});
|
|
66453
|
-
} catch (_e) {
|
|
66454
|
-
console.error("Failed to remove virtual entry file!");
|
|
66455
|
-
}
|
|
66456
|
-
});
|
|
66457
|
-
});
|
|
66458
|
-
}
|
|
66459
|
-
constructor(sharedOptions){
|
|
66460
|
-
IndependentSharePlugin_define_property(this, "sharedOptions", void 0);
|
|
66461
|
-
this.sharedOptions = sharedOptions;
|
|
66462
|
-
}
|
|
66463
|
-
}
|
|
66464
|
-
class IndependentSharePlugin {
|
|
66465
|
-
apply(compiler) {
|
|
66466
|
-
compiler.hooks.beforeRun.tapAsync("IndependentSharePlugin", async (compiler, callback)=>{
|
|
66467
|
-
await this.createIndependentCompilers(compiler);
|
|
66468
|
-
callback();
|
|
66469
|
-
});
|
|
66470
|
-
compiler.hooks.shutdown.tapAsync("IndependentSharePlugin", (callback)=>{
|
|
66471
|
-
this.cleanup();
|
|
66472
|
-
console.log("cleanup");
|
|
66473
|
-
callback();
|
|
66474
|
-
});
|
|
66475
|
-
compiler.hooks.compilation.tap("IndependentSharePlugin", (compilation)=>{
|
|
66476
|
-
compilation.hooks.processAssets.tapPromise({
|
|
66477
|
-
name: "injectBuildAssets",
|
|
66478
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
66479
|
-
}, async ()=>{
|
|
66480
|
-
if (!this.manifest) return;
|
|
66481
|
-
const { statsFileName } = getFileName(this.manifest);
|
|
66482
|
-
const stats = compilation.getAsset(statsFileName);
|
|
66483
|
-
if (!stats) return;
|
|
66484
|
-
const statsContent = JSON.parse(stats.source.source().toString());
|
|
66485
|
-
const { shared } = statsContent;
|
|
66486
|
-
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
66487
|
-
const targetShared = shared.find((s)=>s.name === key);
|
|
66488
|
-
if (!targetShared) return;
|
|
66489
|
-
item.forEach(([entry, version, globalName])=>{
|
|
66490
|
-
if (version === targetShared.version) {
|
|
66491
|
-
targetShared.fallback = entry;
|
|
66492
|
-
targetShared.fallbackName = globalName;
|
|
66493
|
-
}
|
|
66494
|
-
});
|
|
66495
|
-
});
|
|
66496
|
-
compilation.updateAsset(statsFileName, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
66497
|
-
});
|
|
66498
|
-
});
|
|
66499
|
-
}
|
|
66500
|
-
async createIndependentCompilers(parentCompiler) {
|
|
66501
|
-
const { sharedOptions, buildAssets } = this;
|
|
66502
|
-
console.log("🚀 Start creating a standalone compiler...");
|
|
66503
|
-
const parentOutputDir = parentCompiler.options.output.path ? (0, path_browserify.basename)(parentCompiler.options.output.path) : "";
|
|
66504
|
-
const shareRequestsMap = await this.createIndependentCompiler(parentCompiler, parentOutputDir);
|
|
66505
|
-
await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
|
|
66506
|
-
if (!shareConfig.treeshake || false === shareConfig.import) return;
|
|
66507
|
-
const shareRequests = shareRequestsMap[shareName].requests;
|
|
66508
|
-
await Promise.all(shareRequests.map(async ([request, version])=>{
|
|
66509
|
-
const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
|
|
66510
|
-
const [shareFileName, globalName] = await this.createIndependentCompiler(parentCompiler, parentOutputDir, {
|
|
66511
|
-
shareRequestsMap,
|
|
66512
|
-
currentShare: {
|
|
66513
|
-
shareName,
|
|
66514
|
-
version,
|
|
66515
|
-
request,
|
|
66516
|
-
independentShareFileName: sharedConfig?.independentShareFileName
|
|
66517
|
-
}
|
|
66518
|
-
});
|
|
66519
|
-
if ("string" == typeof shareFileName) {
|
|
66520
|
-
buildAssets[shareName] ||= [];
|
|
66521
|
-
buildAssets[shareName].push([
|
|
66522
|
-
shareFileName,
|
|
66523
|
-
version,
|
|
66524
|
-
globalName
|
|
66525
|
-
]);
|
|
66526
|
-
}
|
|
66527
|
-
}));
|
|
66528
|
-
}));
|
|
66529
|
-
console.log("✅ All independent packages have been compiled successfully");
|
|
66530
|
-
}
|
|
66531
|
-
async createIndependentCompiler(parentCompiler, parentOutputDir, extraOptions) {
|
|
66532
|
-
const { mfName, plugins, outputDir, outputFilePath, sharedOptions, treeshake, library } = this;
|
|
66533
|
-
const outputDirWithShareName = outputFilePath || (0, path_browserify.join)(outputDir, encodeName(extraOptions?.currentShare?.shareName || ""));
|
|
66534
|
-
const parentConfig = parentCompiler.options;
|
|
66535
|
-
const finalPlugins = [];
|
|
66536
|
-
const rspack = parentCompiler.rspack;
|
|
66537
|
-
let extraPlugin;
|
|
66538
|
-
extraPlugin = extraOptions ? new ShareContainerPlugin({
|
|
66539
|
-
mfName,
|
|
66540
|
-
library,
|
|
66541
|
-
...extraOptions.currentShare
|
|
66542
|
-
}) : new CollectShareEntryPlugin({
|
|
66543
|
-
sharedOptions,
|
|
66544
|
-
shareScope: "default"
|
|
66545
|
-
});
|
|
66546
|
-
(parentConfig.plugins || []).forEach((plugin)=>{
|
|
66547
|
-
if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin)) finalPlugins.push(plugin);
|
|
66548
|
-
});
|
|
66549
|
-
plugins.forEach((plugin)=>{
|
|
66550
|
-
finalPlugins.push(plugin);
|
|
66551
|
-
});
|
|
66552
|
-
finalPlugins.push(extraPlugin);
|
|
66553
|
-
finalPlugins.push(new ConsumeSharedPlugin({
|
|
66554
|
-
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
66555
|
-
[key]: {
|
|
66556
|
-
import: false,
|
|
66557
|
-
shareKey: options.shareKey || key,
|
|
66558
|
-
shareScope: options.shareScope,
|
|
66559
|
-
requiredVersion: options.requiredVersion,
|
|
66560
|
-
strictVersion: options.strictVersion,
|
|
66561
|
-
singleton: options.singleton,
|
|
66562
|
-
packageName: options.packageName,
|
|
66563
|
-
eager: options.eager
|
|
66564
|
-
}
|
|
66565
|
-
})),
|
|
66566
|
-
enhanced: true
|
|
66567
|
-
}));
|
|
66568
|
-
if (treeshake) finalPlugins.push(new OptimizeDependencyReferencedExportsPlugin(sharedOptions, this.injectUsedExports));
|
|
66569
|
-
finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
|
|
66570
|
-
const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
|
|
66571
|
-
const compilerConfig = {
|
|
66572
|
-
...parentConfig,
|
|
66573
|
-
mode: parentConfig.mode || "development",
|
|
66574
|
-
entry: VirtualEntryPlugin.entry,
|
|
66575
|
-
output: {
|
|
66576
|
-
path: fullOutputDir,
|
|
66577
|
-
clean: true,
|
|
66578
|
-
publicPath: parentConfig.output?.publicPath || "auto"
|
|
66579
|
-
},
|
|
66580
|
-
plugins: finalPlugins,
|
|
66581
|
-
optimization: {
|
|
66582
|
-
...parentConfig.optimization,
|
|
66583
|
-
splitChunks: false
|
|
66584
|
-
}
|
|
66585
|
-
};
|
|
66586
|
-
const compiler = rspack.rspack(compilerConfig);
|
|
66587
|
-
compiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
66588
|
-
compiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
66589
|
-
compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
|
|
66590
|
-
const { currentShare } = extraOptions || {};
|
|
66591
|
-
currentShare && this.compilers.set(`${currentShare.shareName}@${currentShare.version}`, compiler);
|
|
66592
|
-
return new Promise((resolve, reject)=>{
|
|
66593
|
-
compiler.run((err, stats)=>{
|
|
66594
|
-
if (err || stats?.hasErrors()) {
|
|
66595
|
-
const target = currentShare ? currentShare.shareName : "收集依赖";
|
|
66596
|
-
console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
|
|
66597
|
-
reject(err || new Error(`${target} 编译失败`));
|
|
66598
|
-
return;
|
|
66599
|
-
}
|
|
66600
|
-
currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
|
|
66601
|
-
if (stats) {
|
|
66602
|
-
currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
|
|
66603
|
-
console.log(stats.toString({
|
|
66604
|
-
colors: true,
|
|
66605
|
-
chunks: false,
|
|
66606
|
-
modules: false
|
|
66607
|
-
}));
|
|
66608
|
-
}
|
|
66609
|
-
resolve(extraPlugin.getData());
|
|
66610
|
-
});
|
|
66611
|
-
});
|
|
66612
|
-
}
|
|
66613
|
-
cleanup() {
|
|
66614
|
-
this.compilers.forEach((compiler)=>{
|
|
66615
|
-
if (compiler.watching) compiler.watching.close(()=>{
|
|
66616
|
-
console.log("👋 编译器已关闭");
|
|
66617
|
-
});
|
|
66618
|
-
});
|
|
66619
|
-
this.compilers.clear();
|
|
66620
|
-
}
|
|
66621
|
-
constructor(options){
|
|
66622
|
-
IndependentSharePlugin_define_property(this, "mfName", void 0);
|
|
66623
|
-
IndependentSharePlugin_define_property(this, "shared", void 0);
|
|
66624
|
-
IndependentSharePlugin_define_property(this, "library", void 0);
|
|
66625
|
-
IndependentSharePlugin_define_property(this, "sharedOptions", void 0);
|
|
66626
|
-
IndependentSharePlugin_define_property(this, "outputDir", void 0);
|
|
66627
|
-
IndependentSharePlugin_define_property(this, "outputFilePath", void 0);
|
|
66628
|
-
IndependentSharePlugin_define_property(this, "plugins", void 0);
|
|
66629
|
-
IndependentSharePlugin_define_property(this, "compilers", new Map());
|
|
66630
|
-
IndependentSharePlugin_define_property(this, "treeshake", void 0);
|
|
66631
|
-
IndependentSharePlugin_define_property(this, "manifest", void 0);
|
|
66632
|
-
IndependentSharePlugin_define_property(this, "buildAssets", {});
|
|
66633
|
-
IndependentSharePlugin_define_property(this, "injectUsedExports", void 0);
|
|
66634
|
-
IndependentSharePlugin_define_property(this, "name", "IndependentSharePlugin");
|
|
66635
|
-
const { outputDir, outputFilePath, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
|
|
66636
|
-
this.shared = shared;
|
|
66637
|
-
this.mfName = name;
|
|
66638
|
-
this.outputDir = outputFilePath ? "" : outputDir || "independent-packages";
|
|
66639
|
-
this.outputFilePath = outputFilePath;
|
|
66640
|
-
this.plugins = plugins || [];
|
|
66641
|
-
this.treeshake = treeshake;
|
|
66642
|
-
this.manifest = manifest;
|
|
66643
|
-
this.injectUsedExports = injectUsedExports ?? true;
|
|
66644
|
-
this.library = library;
|
|
66645
|
-
this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
66646
|
-
if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
|
|
66647
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
66648
|
-
import: key,
|
|
66649
|
-
requiredVersion: item
|
|
66650
|
-
} : {
|
|
66651
|
-
import: item
|
|
66652
|
-
};
|
|
66653
|
-
return config;
|
|
66654
|
-
}, (item)=>item);
|
|
65904
|
+
disableAssetsAnalyze,
|
|
65905
|
+
remoteAliasMap,
|
|
65906
|
+
exposes,
|
|
65907
|
+
shared,
|
|
65908
|
+
buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
|
|
65909
|
+
};
|
|
65910
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
65911
|
+
}
|
|
65912
|
+
constructor(opts){
|
|
65913
|
+
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
65914
|
+
this.opts = opts;
|
|
66655
65915
|
}
|
|
66656
65916
|
}
|
|
66657
65917
|
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
65918
|
+
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
65919
|
+
const array = (items)=>{
|
|
65920
|
+
for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
|
|
65921
|
+
else if (item && "object" == typeof item) object(item);
|
|
65922
|
+
else throw new Error("Unexpected options format");
|
|
65923
|
+
};
|
|
65924
|
+
const object = (obj)=>{
|
|
65925
|
+
for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
65926
|
+
};
|
|
65927
|
+
if (!options) return;
|
|
65928
|
+
if (Array.isArray(options)) array(options);
|
|
65929
|
+
else if ("object" == typeof options) object(options);
|
|
65930
|
+
else throw new Error("Unexpected options format");
|
|
65931
|
+
};
|
|
65932
|
+
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
65933
|
+
const items = [];
|
|
65934
|
+
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
65935
|
+
items.push([
|
|
65936
|
+
key,
|
|
65937
|
+
value
|
|
65938
|
+
]);
|
|
65939
|
+
});
|
|
65940
|
+
return items;
|
|
65941
|
+
};
|
|
66658
65942
|
function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
66659
65943
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66660
65944
|
value: value,
|
|
@@ -66667,7 +65951,6 @@ function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
|
66667
65951
|
}
|
|
66668
65952
|
class ModuleFederationPlugin {
|
|
66669
65953
|
apply(compiler) {
|
|
66670
|
-
const { name, shared } = this._options;
|
|
66671
65954
|
const { webpack } = compiler;
|
|
66672
65955
|
const paths = getPaths(this._options);
|
|
66673
65956
|
compiler.options.resolve.alias = {
|
|
@@ -66675,40 +65958,101 @@ class ModuleFederationPlugin {
|
|
|
66675
65958
|
"@module-federation/runtime": paths.runtime,
|
|
66676
65959
|
...compiler.options.resolve.alias
|
|
66677
65960
|
};
|
|
66678
|
-
const
|
|
66679
|
-
|
|
66680
|
-
|
|
66681
|
-
|
|
66682
|
-
name,
|
|
66683
|
-
shared: shared || {},
|
|
66684
|
-
outputFilePath: this._options.independentShareFilePath
|
|
66685
|
-
});
|
|
66686
|
-
this._independentSharePlugin.apply(compiler);
|
|
66687
|
-
}
|
|
66688
|
-
let runtimePluginApplied = false;
|
|
66689
|
-
compiler.hooks.beforeRun.tapPromise({
|
|
66690
|
-
name: "ModuleFederationPlugin",
|
|
66691
|
-
stage: 100
|
|
66692
|
-
}, async ()=>{
|
|
66693
|
-
if (runtimePluginApplied) return;
|
|
66694
|
-
runtimePluginApplied = true;
|
|
66695
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._independentSharePlugin?.buildAssets || {});
|
|
66696
|
-
new ModuleFederationRuntimePlugin({
|
|
66697
|
-
entryRuntime
|
|
66698
|
-
}).apply(compiler);
|
|
66699
|
-
});
|
|
65961
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
|
|
65962
|
+
new ModuleFederationRuntimePlugin({
|
|
65963
|
+
entryRuntime
|
|
65964
|
+
}).apply(compiler);
|
|
66700
65965
|
new webpack.container.ModuleFederationPluginV1({
|
|
66701
65966
|
...this._options,
|
|
66702
65967
|
enhanced: true
|
|
66703
65968
|
}).apply(compiler);
|
|
66704
|
-
if (this._options.manifest)
|
|
65969
|
+
if (this._options.manifest) {
|
|
65970
|
+
const manifestOptions = true === this._options.manifest ? {} : {
|
|
65971
|
+
...this._options.manifest
|
|
65972
|
+
};
|
|
65973
|
+
const containerName = manifestOptions.name ?? this._options.name;
|
|
65974
|
+
const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
|
|
65975
|
+
const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
65976
|
+
if (cur[1].length > 1) return sum;
|
|
65977
|
+
const remoteInfo = cur[1][0];
|
|
65978
|
+
const { entry, alias, name } = remoteInfo;
|
|
65979
|
+
if (entry && name) sum[alias] = {
|
|
65980
|
+
name,
|
|
65981
|
+
entry
|
|
65982
|
+
};
|
|
65983
|
+
return sum;
|
|
65984
|
+
}, {});
|
|
65985
|
+
const manifestExposes = collectManifestExposes(this._options.exposes);
|
|
65986
|
+
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
65987
|
+
const manifestShared = collectManifestShared(this._options.shared);
|
|
65988
|
+
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
65989
|
+
new ModuleFederationManifestPlugin({
|
|
65990
|
+
...manifestOptions,
|
|
65991
|
+
name: containerName,
|
|
65992
|
+
globalName,
|
|
65993
|
+
remoteAliasMap
|
|
65994
|
+
}).apply(compiler);
|
|
65995
|
+
}
|
|
66705
65996
|
}
|
|
66706
65997
|
constructor(_options){
|
|
66707
65998
|
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
66708
|
-
ModuleFederationPlugin_define_property(this, "_independentSharePlugin", void 0);
|
|
66709
65999
|
this._options = _options;
|
|
66710
66000
|
}
|
|
66711
66001
|
}
|
|
66002
|
+
function collectManifestExposes(exposes) {
|
|
66003
|
+
if (!exposes) return;
|
|
66004
|
+
const parsed = parseOptions(exposes, (value, key)=>({
|
|
66005
|
+
import: Array.isArray(value) ? value : [
|
|
66006
|
+
value
|
|
66007
|
+
],
|
|
66008
|
+
name: void 0
|
|
66009
|
+
}), (value)=>({
|
|
66010
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
66011
|
+
value.import
|
|
66012
|
+
],
|
|
66013
|
+
name: value.name ?? void 0
|
|
66014
|
+
}));
|
|
66015
|
+
const result = parsed.map(([exposeKey, info])=>{
|
|
66016
|
+
const exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
66017
|
+
return {
|
|
66018
|
+
path: exposeKey,
|
|
66019
|
+
name: exposeName
|
|
66020
|
+
};
|
|
66021
|
+
});
|
|
66022
|
+
return result.length > 0 ? result : void 0;
|
|
66023
|
+
}
|
|
66024
|
+
function collectManifestShared(shared) {
|
|
66025
|
+
if (!shared) return;
|
|
66026
|
+
const parsed = parseOptions(shared, (item, key)=>{
|
|
66027
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66028
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
66029
|
+
import: key,
|
|
66030
|
+
requiredVersion: item
|
|
66031
|
+
} : {
|
|
66032
|
+
import: item
|
|
66033
|
+
};
|
|
66034
|
+
}, (item)=>item);
|
|
66035
|
+
const result = parsed.map(([key, config])=>{
|
|
66036
|
+
const name = config.shareKey || key;
|
|
66037
|
+
const version = "string" == typeof config.version ? config.version : void 0;
|
|
66038
|
+
const requiredVersion = "string" == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66039
|
+
return {
|
|
66040
|
+
name,
|
|
66041
|
+
version,
|
|
66042
|
+
requiredVersion,
|
|
66043
|
+
singleton: config.singleton
|
|
66044
|
+
};
|
|
66045
|
+
});
|
|
66046
|
+
return result.length > 0 ? result : void 0;
|
|
66047
|
+
}
|
|
66048
|
+
function resolveLibraryGlobalName(library) {
|
|
66049
|
+
if (!library) return;
|
|
66050
|
+
const libName = library.name;
|
|
66051
|
+
if (!libName) return;
|
|
66052
|
+
if ("string" == typeof libName) return libName;
|
|
66053
|
+
if (Array.isArray(libName)) return libName[0];
|
|
66054
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66055
|
+
}
|
|
66712
66056
|
function getRemoteInfos(options) {
|
|
66713
66057
|
if (!options.remotes) return {};
|
|
66714
66058
|
function extractUrlAndGlobal(urlAndGlobal) {
|
|
@@ -66775,18 +66119,6 @@ function getRemoteInfos(options) {
|
|
|
66775
66119
|
function getRuntimePlugins(options) {
|
|
66776
66120
|
return options.runtimePlugins ?? [];
|
|
66777
66121
|
}
|
|
66778
|
-
function getSharedOptions(options) {
|
|
66779
|
-
if (!options.shared) return [];
|
|
66780
|
-
return parseOptions(options.shared, (item, key)=>{
|
|
66781
|
-
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66782
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
66783
|
-
import: key,
|
|
66784
|
-
requiredVersion: item
|
|
66785
|
-
} : {
|
|
66786
|
-
import: item
|
|
66787
|
-
};
|
|
66788
|
-
}, (item)=>item);
|
|
66789
|
-
}
|
|
66790
66122
|
function getPaths(options) {
|
|
66791
66123
|
return {
|
|
66792
66124
|
runtimeTools: "@module-federation/runtime-tools",
|
|
@@ -66794,7 +66126,7 @@ function getPaths(options) {
|
|
|
66794
66126
|
runtime: "@module-federation/runtime"
|
|
66795
66127
|
};
|
|
66796
66128
|
}
|
|
66797
|
-
function getDefaultEntryRuntime(paths, options, compiler
|
|
66129
|
+
function getDefaultEntryRuntime(paths, options, compiler) {
|
|
66798
66130
|
const runtimePlugins = getRuntimePlugins(options);
|
|
66799
66131
|
const remoteInfos = getRemoteInfos(options);
|
|
66800
66132
|
const runtimePluginImports = [];
|
|
@@ -66815,11 +66147,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallback
|
|
|
66815
66147
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
66816
66148
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
66817
66149
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
66818
|
-
|
|
66819
|
-
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;const shareFallbacks=__module_federation_share_fallbacks__||{};for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};const fallbackEntry=shareFallbacks[name];if(fallbackEntry){const fallbackUrl=(__webpack_require__.p||"")+fallbackEntry[1];options.fallbackName=fallbackEntry[0];shareConfig.fallback=fallbackUrl;options.fallback=function(){return __webpack_require__.federation.importExternal(fallbackUrl)}}if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);if(Object.keys(shareFallbacks).length){early(__webpack_require__.federation.bundlerRuntimeOptions,"sharedEntries",()=>shareFallbacks)}merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
|
|
66150
|
+
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
|
|
66820
66151
|
].join(";");
|
|
66821
66152
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
66822
66153
|
}
|
|
66154
|
+
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66155
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66156
|
+
value: value,
|
|
66157
|
+
enumerable: true,
|
|
66158
|
+
configurable: true,
|
|
66159
|
+
writable: true
|
|
66160
|
+
});
|
|
66161
|
+
else obj[key] = value;
|
|
66162
|
+
return obj;
|
|
66163
|
+
}
|
|
66164
|
+
const compilerSet = new WeakSet();
|
|
66165
|
+
function isSingleton(compiler) {
|
|
66166
|
+
return compilerSet.has(compiler);
|
|
66167
|
+
}
|
|
66168
|
+
function setSingleton(compiler) {
|
|
66169
|
+
compilerSet.add(compiler);
|
|
66170
|
+
}
|
|
66171
|
+
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66172
|
+
raw(compiler) {
|
|
66173
|
+
if (isSingleton(compiler)) return;
|
|
66174
|
+
setSingleton(compiler);
|
|
66175
|
+
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66176
|
+
}
|
|
66177
|
+
constructor(enhanced = false){
|
|
66178
|
+
super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
|
|
66179
|
+
}
|
|
66180
|
+
}
|
|
66181
|
+
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66182
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66183
|
+
value: value,
|
|
66184
|
+
enumerable: true,
|
|
66185
|
+
configurable: true,
|
|
66186
|
+
writable: true
|
|
66187
|
+
});
|
|
66188
|
+
else obj[key] = value;
|
|
66189
|
+
return obj;
|
|
66190
|
+
}
|
|
66191
|
+
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66192
|
+
raw(compiler) {
|
|
66193
|
+
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66194
|
+
const rawOptions = {
|
|
66195
|
+
consumes: this._options.consumes.map(([key, v])=>({
|
|
66196
|
+
key,
|
|
66197
|
+
...v
|
|
66198
|
+
})),
|
|
66199
|
+
enhanced: this._options.enhanced
|
|
66200
|
+
};
|
|
66201
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66202
|
+
}
|
|
66203
|
+
constructor(options){
|
|
66204
|
+
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66205
|
+
this._options = {
|
|
66206
|
+
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
66207
|
+
if (Array.isArray(item)) throw new Error("Unexpected array in options");
|
|
66208
|
+
const result = item !== key && isRequiredVersion(item) ? {
|
|
66209
|
+
import: key,
|
|
66210
|
+
shareScope: options.shareScope || "default",
|
|
66211
|
+
shareKey: key,
|
|
66212
|
+
requiredVersion: item,
|
|
66213
|
+
strictVersion: true,
|
|
66214
|
+
packageName: void 0,
|
|
66215
|
+
singleton: false,
|
|
66216
|
+
eager: false
|
|
66217
|
+
} : {
|
|
66218
|
+
import: key,
|
|
66219
|
+
shareScope: options.shareScope || "default",
|
|
66220
|
+
shareKey: key,
|
|
66221
|
+
requiredVersion: void 0,
|
|
66222
|
+
packageName: void 0,
|
|
66223
|
+
strictVersion: false,
|
|
66224
|
+
singleton: false,
|
|
66225
|
+
eager: false
|
|
66226
|
+
};
|
|
66227
|
+
return result;
|
|
66228
|
+
}, (item, key)=>({
|
|
66229
|
+
import: false === item.import ? void 0 : item.import || key,
|
|
66230
|
+
shareScope: item.shareScope || options.shareScope || "default",
|
|
66231
|
+
shareKey: item.shareKey || key,
|
|
66232
|
+
requiredVersion: item.requiredVersion,
|
|
66233
|
+
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66234
|
+
packageName: item.packageName,
|
|
66235
|
+
singleton: !!item.singleton,
|
|
66236
|
+
eager: !!item.eager
|
|
66237
|
+
})),
|
|
66238
|
+
enhanced: options.enhanced ?? false
|
|
66239
|
+
};
|
|
66240
|
+
}
|
|
66241
|
+
}
|
|
66242
|
+
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66243
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66244
|
+
value: value,
|
|
66245
|
+
enumerable: true,
|
|
66246
|
+
configurable: true,
|
|
66247
|
+
writable: true
|
|
66248
|
+
});
|
|
66249
|
+
else obj[key] = value;
|
|
66250
|
+
return obj;
|
|
66251
|
+
}
|
|
66252
|
+
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66253
|
+
raw(compiler) {
|
|
66254
|
+
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66255
|
+
const rawOptions = this._provides.map(([key, v])=>({
|
|
66256
|
+
key,
|
|
66257
|
+
...v
|
|
66258
|
+
}));
|
|
66259
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66260
|
+
}
|
|
66261
|
+
constructor(options){
|
|
66262
|
+
super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
|
|
66263
|
+
this._provides = parseOptions(options.provides, (item)=>{
|
|
66264
|
+
if (Array.isArray(item)) throw new Error("Unexpected array of provides");
|
|
66265
|
+
return {
|
|
66266
|
+
shareKey: item,
|
|
66267
|
+
version: void 0,
|
|
66268
|
+
shareScope: options.shareScope || "default",
|
|
66269
|
+
eager: false
|
|
66270
|
+
};
|
|
66271
|
+
}, (item)=>{
|
|
66272
|
+
const raw = {
|
|
66273
|
+
shareKey: item.shareKey,
|
|
66274
|
+
version: item.version,
|
|
66275
|
+
shareScope: item.shareScope || options.shareScope || "default",
|
|
66276
|
+
eager: !!item.eager
|
|
66277
|
+
};
|
|
66278
|
+
if (options.enhanced) {
|
|
66279
|
+
const enhancedItem = item;
|
|
66280
|
+
return {
|
|
66281
|
+
...raw,
|
|
66282
|
+
singleton: enhancedItem.singleton,
|
|
66283
|
+
requiredVersion: enhancedItem.requiredVersion,
|
|
66284
|
+
strictVersion: enhancedItem.strictVersion
|
|
66285
|
+
};
|
|
66286
|
+
}
|
|
66287
|
+
return raw;
|
|
66288
|
+
});
|
|
66289
|
+
this._enhanced = options.enhanced;
|
|
66290
|
+
}
|
|
66291
|
+
}
|
|
66292
|
+
function SharePlugin_define_property(obj, key, value) {
|
|
66293
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66294
|
+
value: value,
|
|
66295
|
+
enumerable: true,
|
|
66296
|
+
configurable: true,
|
|
66297
|
+
writable: true
|
|
66298
|
+
});
|
|
66299
|
+
else obj[key] = value;
|
|
66300
|
+
return obj;
|
|
66301
|
+
}
|
|
66302
|
+
class SharePlugin {
|
|
66303
|
+
apply(compiler) {
|
|
66304
|
+
new ConsumeSharedPlugin({
|
|
66305
|
+
shareScope: this._shareScope,
|
|
66306
|
+
consumes: this._consumes,
|
|
66307
|
+
enhanced: this._enhanced
|
|
66308
|
+
}).apply(compiler);
|
|
66309
|
+
new ProvideSharedPlugin({
|
|
66310
|
+
shareScope: this._shareScope,
|
|
66311
|
+
provides: this._provides,
|
|
66312
|
+
enhanced: this._enhanced
|
|
66313
|
+
}).apply(compiler);
|
|
66314
|
+
}
|
|
66315
|
+
constructor(options){
|
|
66316
|
+
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66317
|
+
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66318
|
+
SharePlugin_define_property(this, "_provides", void 0);
|
|
66319
|
+
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66320
|
+
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
66321
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66322
|
+
const config = item !== key && isRequiredVersion(item) ? {
|
|
66323
|
+
import: key,
|
|
66324
|
+
requiredVersion: item
|
|
66325
|
+
} : {
|
|
66326
|
+
import: item
|
|
66327
|
+
};
|
|
66328
|
+
return config;
|
|
66329
|
+
}, (item)=>item);
|
|
66330
|
+
const consumes = sharedOptions.map(([key, options])=>({
|
|
66331
|
+
[key]: {
|
|
66332
|
+
import: options.import,
|
|
66333
|
+
shareKey: options.shareKey || key,
|
|
66334
|
+
shareScope: options.shareScope,
|
|
66335
|
+
requiredVersion: options.requiredVersion,
|
|
66336
|
+
strictVersion: options.strictVersion,
|
|
66337
|
+
singleton: options.singleton,
|
|
66338
|
+
packageName: options.packageName,
|
|
66339
|
+
eager: options.eager
|
|
66340
|
+
}
|
|
66341
|
+
}));
|
|
66342
|
+
const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66343
|
+
[options.import || key]: {
|
|
66344
|
+
shareKey: options.shareKey || key,
|
|
66345
|
+
shareScope: options.shareScope,
|
|
66346
|
+
version: options.version,
|
|
66347
|
+
eager: options.eager,
|
|
66348
|
+
singleton: options.singleton,
|
|
66349
|
+
requiredVersion: options.requiredVersion,
|
|
66350
|
+
strictVersion: options.strictVersion
|
|
66351
|
+
}
|
|
66352
|
+
}));
|
|
66353
|
+
this._shareScope = options.shareScope;
|
|
66354
|
+
this._consumes = consumes;
|
|
66355
|
+
this._provides = provides;
|
|
66356
|
+
this._enhanced = options.enhanced ?? false;
|
|
66357
|
+
}
|
|
66358
|
+
}
|
|
66823
66359
|
function ContainerPlugin_define_property(obj, key, value) {
|
|
66824
66360
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66825
66361
|
value: value,
|
|
@@ -66976,46 +66512,6 @@ class ModuleFederationPluginV1 {
|
|
|
66976
66512
|
this._options = _options;
|
|
66977
66513
|
}
|
|
66978
66514
|
}
|
|
66979
|
-
function TreeShakeSharePlugin_define_property(obj, key, value) {
|
|
66980
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66981
|
-
value: value,
|
|
66982
|
-
enumerable: true,
|
|
66983
|
-
configurable: true,
|
|
66984
|
-
writable: true
|
|
66985
|
-
});
|
|
66986
|
-
else obj[key] = value;
|
|
66987
|
-
return obj;
|
|
66988
|
-
}
|
|
66989
|
-
class TreeshakeSharePlugin {
|
|
66990
|
-
apply(compiler) {
|
|
66991
|
-
const { mfConfig, outputDir, plugins, reshake } = this;
|
|
66992
|
-
const { name, shared, library } = mfConfig;
|
|
66993
|
-
if (!shared) return;
|
|
66994
|
-
const sharedOptions = normalizeSharedOptions(shared);
|
|
66995
|
-
if (!sharedOptions.length) return;
|
|
66996
|
-
if (!reshake) new OptimizeDependencyReferencedExportsPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
|
|
66997
|
-
if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) new IndependentSharePlugin({
|
|
66998
|
-
name: name,
|
|
66999
|
-
shared: shared,
|
|
67000
|
-
outputDir,
|
|
67001
|
-
plugins,
|
|
67002
|
-
treeshake: reshake,
|
|
67003
|
-
library
|
|
67004
|
-
}).apply(compiler);
|
|
67005
|
-
}
|
|
67006
|
-
constructor(options){
|
|
67007
|
-
TreeShakeSharePlugin_define_property(this, "mfConfig", void 0);
|
|
67008
|
-
TreeShakeSharePlugin_define_property(this, "outputDir", void 0);
|
|
67009
|
-
TreeShakeSharePlugin_define_property(this, "plugins", void 0);
|
|
67010
|
-
TreeShakeSharePlugin_define_property(this, "reshake", void 0);
|
|
67011
|
-
TreeShakeSharePlugin_define_property(this, "name", "TreeshakeSharePlugin");
|
|
67012
|
-
const { mfConfig, plugins, reshake } = options;
|
|
67013
|
-
this.mfConfig = mfConfig;
|
|
67014
|
-
this.outputDir = mfConfig.independentShareDir || "independent-packages";
|
|
67015
|
-
this.plugins = plugins;
|
|
67016
|
-
this.reshake = Boolean(reshake);
|
|
67017
|
-
}
|
|
67018
|
-
}
|
|
67019
66515
|
async function minify(source, options) {
|
|
67020
66516
|
const _options = JSON.stringify(options || {});
|
|
67021
66517
|
return external_rspack_wasi_browser_js_["default"].minify(source, _options);
|
|
@@ -67032,7 +66528,7 @@ function transformSync(source, options) {
|
|
|
67032
66528
|
const _options = JSON.stringify(options || {});
|
|
67033
66529
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
67034
66530
|
}
|
|
67035
|
-
const exports_rspackVersion = "1.6.5-canary-
|
|
66531
|
+
const exports_rspackVersion = "1.6.5-canary-480f74ac-20251120174032";
|
|
67036
66532
|
const exports_version = "5.75.0";
|
|
67037
66533
|
const exports_WebpackError = Error;
|
|
67038
66534
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -67083,10 +66579,6 @@ const container = {
|
|
|
67083
66579
|
};
|
|
67084
66580
|
const sharing = {
|
|
67085
66581
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
67086
|
-
CollectShareEntryPlugin: CollectShareEntryPlugin,
|
|
67087
|
-
TreeshakeSharePlugin: TreeshakeSharePlugin,
|
|
67088
|
-
ShareContainerPlugin: ShareContainerPlugin,
|
|
67089
|
-
OptimizeDependencyReferencedExportsPlugin: OptimizeDependencyReferencedExportsPlugin,
|
|
67090
66582
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
67091
66583
|
SharePlugin: SharePlugin
|
|
67092
66584
|
};
|
|
@@ -67195,7 +66687,7 @@ function createCompiler(userOptions) {
|
|
|
67195
66687
|
function isMultiRspackOptions(o) {
|
|
67196
66688
|
return Array.isArray(o);
|
|
67197
66689
|
}
|
|
67198
|
-
function
|
|
66690
|
+
function rspack(options, callback) {
|
|
67199
66691
|
try {
|
|
67200
66692
|
if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
|
|
67201
66693
|
else validateRspackConfig(options);
|
|
@@ -67245,7 +66737,7 @@ function rspack_rspack(options, callback) {
|
|
|
67245
66737
|
return compiler;
|
|
67246
66738
|
}
|
|
67247
66739
|
}
|
|
67248
|
-
const src_fn = Object.assign(
|
|
66740
|
+
const src_fn = Object.assign(rspack, exports_namespaceObject);
|
|
67249
66741
|
src_fn.rspack = src_fn;
|
|
67250
66742
|
src_fn.webpack = src_fn;
|
|
67251
66743
|
const src_rspack_0 = src_fn;
|