@rspack-canary/browser 1.7.3-canary-467a44da-20260119082229 → 1.7.3-canary-6991b7b5-20260119174555
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 +3 -10
- package/dist/container/ModuleFederationPlugin.d.ts +1 -17
- package/dist/exports.d.ts +0 -3
- package/dist/index.mjs +353 -909
- package/dist/napi-binding.d.ts +0 -33
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +0 -13
- package/dist/sharing/ProvideSharedPlugin.d.ts +0 -19
- package/dist/sharing/SharePlugin.d.ts +0 -36
- package/dist/sharing/utils.d.ts +0 -1
- package/package.json +1 -1
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +0 -22
- package/dist/sharing/IndependentSharedPlugin.d.ts +0 -35
- package/dist/sharing/SharedContainerPlugin.d.ts +0 -23
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +0 -14
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +0 -16
package/dist/index.mjs
CHANGED
|
@@ -58128,7 +58128,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58128
58128
|
if ('object' == typeof rspackFuture) {
|
|
58129
58129
|
D(rspackFuture, 'bundlerInfo', {});
|
|
58130
58130
|
if ('object' == typeof rspackFuture.bundlerInfo) {
|
|
58131
|
-
D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-
|
|
58131
|
+
D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-6991b7b5-20260119174555");
|
|
58132
58132
|
D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
|
|
58133
58133
|
D(rspackFuture.bundlerInfo, 'force', !library);
|
|
58134
58134
|
}
|
|
@@ -60398,7 +60398,7 @@ class MultiStats {
|
|
|
60398
60398
|
return obj;
|
|
60399
60399
|
});
|
|
60400
60400
|
if (childOptions.version) {
|
|
60401
|
-
obj.rspackVersion = "1.7.3-canary-
|
|
60401
|
+
obj.rspackVersion = "1.7.3-canary-6991b7b5-20260119174555";
|
|
60402
60402
|
obj.version = "5.75.0";
|
|
60403
60403
|
}
|
|
60404
60404
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
|
|
@@ -62230,7 +62230,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
62230
62230
|
},
|
|
62231
62231
|
version: (object)=>{
|
|
62232
62232
|
object.version = "5.75.0";
|
|
62233
|
-
object.rspackVersion = "1.7.3-canary-
|
|
62233
|
+
object.rspackVersion = "1.7.3-canary-6991b7b5-20260119174555";
|
|
62234
62234
|
},
|
|
62235
62235
|
env: (object, _compilation, _context, { _env })=>{
|
|
62236
62236
|
object.env = _env;
|
|
@@ -64025,7 +64025,7 @@ function createCompiler(userOptions) {
|
|
|
64025
64025
|
function isMultiRspackOptions(o) {
|
|
64026
64026
|
return Array.isArray(o);
|
|
64027
64027
|
}
|
|
64028
|
-
function
|
|
64028
|
+
function rspack(options, callback) {
|
|
64029
64029
|
try {
|
|
64030
64030
|
if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
|
|
64031
64031
|
else validateRspackConfig(options);
|
|
@@ -65690,7 +65690,7 @@ class Compiler {
|
|
|
65690
65690
|
};
|
|
65691
65691
|
const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
|
|
65692
65692
|
const compilerFn = function(...params) {
|
|
65693
|
-
return
|
|
65693
|
+
return rspack(...params);
|
|
65694
65694
|
};
|
|
65695
65695
|
const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
|
|
65696
65696
|
RuntimeGlobals: compilerRuntimeGlobals
|
|
@@ -66192,266 +66192,10 @@ class NodeTemplatePlugin {
|
|
|
66192
66192
|
this._options = _options;
|
|
66193
66193
|
}
|
|
66194
66194
|
}
|
|
66195
|
-
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
66196
|
-
const array = (items)=>{
|
|
66197
|
-
for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
|
|
66198
|
-
else if (item && 'object' == typeof item) object(item);
|
|
66199
|
-
else throw new Error('Unexpected options format');
|
|
66200
|
-
};
|
|
66201
|
-
const object = (obj)=>{
|
|
66202
|
-
for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
66203
|
-
};
|
|
66204
|
-
if (!options) return;
|
|
66205
|
-
if (Array.isArray(options)) array(options);
|
|
66206
|
-
else if ('object' == typeof options) object(options);
|
|
66207
|
-
else throw new Error('Unexpected options format');
|
|
66208
|
-
};
|
|
66209
|
-
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
66210
|
-
const items = [];
|
|
66211
|
-
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
66212
|
-
items.push([
|
|
66213
|
-
key,
|
|
66214
|
-
value
|
|
66215
|
-
]);
|
|
66216
|
-
});
|
|
66217
|
-
return items;
|
|
66218
|
-
};
|
|
66219
|
-
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66220
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66221
|
-
value: value,
|
|
66222
|
-
enumerable: true,
|
|
66223
|
-
configurable: true,
|
|
66224
|
-
writable: true
|
|
66225
|
-
});
|
|
66226
|
-
else obj[key] = value;
|
|
66227
|
-
return obj;
|
|
66228
|
-
}
|
|
66229
|
-
const compilerSet = new WeakSet();
|
|
66230
|
-
function isSingleton(compiler) {
|
|
66231
|
-
return compilerSet.has(compiler);
|
|
66232
|
-
}
|
|
66233
|
-
function setSingleton(compiler) {
|
|
66234
|
-
compilerSet.add(compiler);
|
|
66235
|
-
}
|
|
66236
|
-
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66237
|
-
raw(compiler) {
|
|
66238
|
-
if (isSingleton(compiler)) return;
|
|
66239
|
-
setSingleton(compiler);
|
|
66240
|
-
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66241
|
-
}
|
|
66242
|
-
constructor(enhanced = false){
|
|
66243
|
-
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;
|
|
66244
|
-
}
|
|
66245
|
-
}
|
|
66246
66195
|
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
66247
66196
|
function isRequiredVersion(str) {
|
|
66248
66197
|
return VERSION_PATTERN_REGEXP.test(str);
|
|
66249
66198
|
}
|
|
66250
|
-
const encodeName = function(name, prefix = '', withExt = false) {
|
|
66251
|
-
const ext = withExt ? '.js' : '';
|
|
66252
|
-
return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
|
|
66253
|
-
};
|
|
66254
|
-
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66255
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66256
|
-
value: value,
|
|
66257
|
-
enumerable: true,
|
|
66258
|
-
configurable: true,
|
|
66259
|
-
writable: true
|
|
66260
|
-
});
|
|
66261
|
-
else obj[key] = value;
|
|
66262
|
-
return obj;
|
|
66263
|
-
}
|
|
66264
|
-
function normalizeConsumeShareOptions(consumes, shareScope) {
|
|
66265
|
-
return parseOptions(consumes, (item, key)=>{
|
|
66266
|
-
if (Array.isArray(item)) throw new Error('Unexpected array in options');
|
|
66267
|
-
const result = item !== key && isRequiredVersion(item) ? {
|
|
66268
|
-
import: key,
|
|
66269
|
-
shareScope: shareScope || 'default',
|
|
66270
|
-
shareKey: key,
|
|
66271
|
-
requiredVersion: item,
|
|
66272
|
-
strictVersion: true,
|
|
66273
|
-
packageName: void 0,
|
|
66274
|
-
singleton: false,
|
|
66275
|
-
eager: false,
|
|
66276
|
-
treeShakingMode: void 0
|
|
66277
|
-
} : {
|
|
66278
|
-
import: key,
|
|
66279
|
-
shareScope: shareScope || 'default',
|
|
66280
|
-
shareKey: key,
|
|
66281
|
-
requiredVersion: void 0,
|
|
66282
|
-
packageName: void 0,
|
|
66283
|
-
strictVersion: false,
|
|
66284
|
-
singleton: false,
|
|
66285
|
-
eager: false,
|
|
66286
|
-
treeShakingMode: void 0
|
|
66287
|
-
};
|
|
66288
|
-
return result;
|
|
66289
|
-
}, (item, key)=>({
|
|
66290
|
-
import: false === item.import ? void 0 : item.import || key,
|
|
66291
|
-
shareScope: item.shareScope || shareScope || 'default',
|
|
66292
|
-
shareKey: item.shareKey || key,
|
|
66293
|
-
requiredVersion: item.requiredVersion,
|
|
66294
|
-
strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66295
|
-
packageName: item.packageName,
|
|
66296
|
-
singleton: !!item.singleton,
|
|
66297
|
-
eager: !!item.eager,
|
|
66298
|
-
treeShakingMode: item.treeShakingMode
|
|
66299
|
-
}));
|
|
66300
|
-
}
|
|
66301
|
-
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66302
|
-
raw(compiler) {
|
|
66303
|
-
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66304
|
-
const rawOptions = {
|
|
66305
|
-
consumes: this._options.consumes.map(([key, v])=>({
|
|
66306
|
-
key,
|
|
66307
|
-
...v
|
|
66308
|
-
})),
|
|
66309
|
-
enhanced: this._options.enhanced
|
|
66310
|
-
};
|
|
66311
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66312
|
-
}
|
|
66313
|
-
constructor(options){
|
|
66314
|
-
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66315
|
-
this._options = {
|
|
66316
|
-
consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
|
|
66317
|
-
enhanced: options.enhanced ?? false
|
|
66318
|
-
};
|
|
66319
|
-
}
|
|
66320
|
-
}
|
|
66321
|
-
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66322
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66323
|
-
value: value,
|
|
66324
|
-
enumerable: true,
|
|
66325
|
-
configurable: true,
|
|
66326
|
-
writable: true
|
|
66327
|
-
});
|
|
66328
|
-
else obj[key] = value;
|
|
66329
|
-
return obj;
|
|
66330
|
-
}
|
|
66331
|
-
function normalizeProvideShareOptions(options, shareScope, enhanced) {
|
|
66332
|
-
return parseOptions(options, (item)=>{
|
|
66333
|
-
if (Array.isArray(item)) throw new Error('Unexpected array of provides');
|
|
66334
|
-
return {
|
|
66335
|
-
shareKey: item,
|
|
66336
|
-
version: void 0,
|
|
66337
|
-
shareScope: shareScope || 'default',
|
|
66338
|
-
eager: false
|
|
66339
|
-
};
|
|
66340
|
-
}, (item)=>{
|
|
66341
|
-
const raw = {
|
|
66342
|
-
shareKey: item.shareKey,
|
|
66343
|
-
version: item.version,
|
|
66344
|
-
shareScope: item.shareScope || shareScope || 'default',
|
|
66345
|
-
eager: !!item.eager
|
|
66346
|
-
};
|
|
66347
|
-
if (enhanced) {
|
|
66348
|
-
const enhancedItem = item;
|
|
66349
|
-
return {
|
|
66350
|
-
...raw,
|
|
66351
|
-
singleton: enhancedItem.singleton,
|
|
66352
|
-
requiredVersion: enhancedItem.requiredVersion,
|
|
66353
|
-
strictVersion: enhancedItem.strictVersion,
|
|
66354
|
-
treeShakingMode: enhancedItem.treeShakingMode
|
|
66355
|
-
};
|
|
66356
|
-
}
|
|
66357
|
-
return raw;
|
|
66358
|
-
});
|
|
66359
|
-
}
|
|
66360
|
-
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66361
|
-
raw(compiler) {
|
|
66362
|
-
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66363
|
-
const rawOptions = this._provides.map(([key, v])=>({
|
|
66364
|
-
key,
|
|
66365
|
-
...v
|
|
66366
|
-
}));
|
|
66367
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66368
|
-
}
|
|
66369
|
-
constructor(options){
|
|
66370
|
-
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);
|
|
66371
|
-
this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
|
|
66372
|
-
this._enhanced = options.enhanced;
|
|
66373
|
-
}
|
|
66374
|
-
}
|
|
66375
|
-
function SharePlugin_define_property(obj, key, value) {
|
|
66376
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66377
|
-
value: value,
|
|
66378
|
-
enumerable: true,
|
|
66379
|
-
configurable: true,
|
|
66380
|
-
writable: true
|
|
66381
|
-
});
|
|
66382
|
-
else obj[key] = value;
|
|
66383
|
-
return obj;
|
|
66384
|
-
}
|
|
66385
|
-
function normalizeSharedOptions(shared) {
|
|
66386
|
-
return parseOptions(shared, (item, key)=>{
|
|
66387
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66388
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
66389
|
-
import: key,
|
|
66390
|
-
requiredVersion: item
|
|
66391
|
-
} : {
|
|
66392
|
-
import: item
|
|
66393
|
-
};
|
|
66394
|
-
return config;
|
|
66395
|
-
}, (item)=>item);
|
|
66396
|
-
}
|
|
66397
|
-
function createProvideShareOptions(normalizedSharedOptions) {
|
|
66398
|
-
return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66399
|
-
[options.import || key]: {
|
|
66400
|
-
shareKey: options.shareKey || key,
|
|
66401
|
-
shareScope: options.shareScope,
|
|
66402
|
-
version: options.version,
|
|
66403
|
-
eager: options.eager,
|
|
66404
|
-
singleton: options.singleton,
|
|
66405
|
-
requiredVersion: options.requiredVersion,
|
|
66406
|
-
strictVersion: options.strictVersion,
|
|
66407
|
-
treeShakingMode: options.treeShaking?.mode
|
|
66408
|
-
}
|
|
66409
|
-
}));
|
|
66410
|
-
}
|
|
66411
|
-
function createConsumeShareOptions(normalizedSharedOptions) {
|
|
66412
|
-
return normalizedSharedOptions.map(([key, options])=>({
|
|
66413
|
-
[key]: {
|
|
66414
|
-
import: options.import,
|
|
66415
|
-
shareKey: options.shareKey || key,
|
|
66416
|
-
shareScope: options.shareScope,
|
|
66417
|
-
requiredVersion: options.requiredVersion,
|
|
66418
|
-
strictVersion: options.strictVersion,
|
|
66419
|
-
singleton: options.singleton,
|
|
66420
|
-
packageName: options.packageName,
|
|
66421
|
-
eager: options.eager,
|
|
66422
|
-
treeShakingMode: options.treeShaking?.mode
|
|
66423
|
-
}
|
|
66424
|
-
}));
|
|
66425
|
-
}
|
|
66426
|
-
class SharePlugin {
|
|
66427
|
-
apply(compiler) {
|
|
66428
|
-
new ConsumeSharedPlugin({
|
|
66429
|
-
shareScope: this._shareScope,
|
|
66430
|
-
consumes: this._consumes,
|
|
66431
|
-
enhanced: this._enhanced
|
|
66432
|
-
}).apply(compiler);
|
|
66433
|
-
new ProvideSharedPlugin({
|
|
66434
|
-
shareScope: this._shareScope,
|
|
66435
|
-
provides: this._provides,
|
|
66436
|
-
enhanced: this._enhanced
|
|
66437
|
-
}).apply(compiler);
|
|
66438
|
-
}
|
|
66439
|
-
constructor(options){
|
|
66440
|
-
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66441
|
-
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66442
|
-
SharePlugin_define_property(this, "_provides", void 0);
|
|
66443
|
-
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66444
|
-
SharePlugin_define_property(this, "_sharedOptions", void 0);
|
|
66445
|
-
const sharedOptions = normalizeSharedOptions(options.shared);
|
|
66446
|
-
const consumes = createConsumeShareOptions(sharedOptions);
|
|
66447
|
-
const provides = createProvideShareOptions(sharedOptions);
|
|
66448
|
-
this._shareScope = options.shareScope;
|
|
66449
|
-
this._consumes = consumes;
|
|
66450
|
-
this._provides = provides;
|
|
66451
|
-
this._enhanced = options.enhanced ?? false;
|
|
66452
|
-
this._sharedOptions = sharedOptions;
|
|
66453
|
-
}
|
|
66454
|
-
}
|
|
66455
66199
|
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
66456
66200
|
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
66457
66201
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -66490,29 +66234,17 @@ function readPKGJson(root) {
|
|
|
66490
66234
|
} catch {}
|
|
66491
66235
|
return {};
|
|
66492
66236
|
}
|
|
66493
|
-
function getBuildInfo(isDev,
|
|
66494
|
-
const rootPath =
|
|
66237
|
+
function getBuildInfo(isDev, root) {
|
|
66238
|
+
const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
|
|
66495
66239
|
const pkg = readPKGJson(rootPath);
|
|
66496
66240
|
const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
|
|
66497
|
-
|
|
66241
|
+
return {
|
|
66498
66242
|
buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
|
|
66499
66243
|
buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
|
|
66500
66244
|
};
|
|
66501
|
-
const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
|
|
66502
|
-
const enableTreeShaking = Object.values(normalizedShared).some((config)=>config[1].treeShaking);
|
|
66503
|
-
if (enableTreeShaking) {
|
|
66504
|
-
statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
|
|
66505
|
-
statsBuildInfo.plugins = mfConfig.treeShakingSharedPlugins || [];
|
|
66506
|
-
statsBuildInfo.excludePlugins = mfConfig.treeShakingSharedExcludePlugins || [];
|
|
66507
|
-
}
|
|
66508
|
-
return statsBuildInfo;
|
|
66509
66245
|
}
|
|
66510
66246
|
function getFileName(manifestOptions) {
|
|
66511
66247
|
if (!manifestOptions) return {
|
|
66512
|
-
statsFileName: '',
|
|
66513
|
-
manifestFileName: ''
|
|
66514
|
-
};
|
|
66515
|
-
if ('boolean' == typeof manifestOptions) return {
|
|
66516
66248
|
statsFileName: STATS_FILE_NAME,
|
|
66517
66249
|
manifestFileName: MANIFEST_FILE_NAME
|
|
66518
66250
|
};
|
|
@@ -66525,588 +66257,60 @@ function getFileName(manifestOptions) {
|
|
|
66525
66257
|
const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
|
|
66526
66258
|
const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
|
|
66527
66259
|
const statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : STATS_FILE_NAME;
|
|
66528
|
-
return {
|
|
66529
|
-
statsFileName: (0, path_browserify.join)(filePath, statsFileName),
|
|
66530
|
-
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
66531
|
-
};
|
|
66532
|
-
}
|
|
66533
|
-
|
|
66534
|
-
|
|
66535
|
-
|
|
66536
|
-
|
|
66537
|
-
|
|
66538
|
-
|
|
66539
|
-
|
|
66540
|
-
|
|
66541
|
-
|
|
66542
|
-
|
|
66543
|
-
|
|
66544
|
-
|
|
66545
|
-
|
|
66546
|
-
|
|
66547
|
-
|
|
66548
|
-
|
|
66549
|
-
|
|
66550
|
-
|
|
66551
|
-
],
|
|
66552
|
-
name: value.name ?? void 0
|
|
66553
|
-
}));
|
|
66554
|
-
const result = parsed.map(([exposeKey, info])=>{
|
|
66555
|
-
const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
|
|
66556
|
-
return {
|
|
66557
|
-
path: exposeKey,
|
|
66558
|
-
name: exposeName
|
|
66559
|
-
};
|
|
66560
|
-
});
|
|
66561
|
-
return result.length > 0 ? result : void 0;
|
|
66562
|
-
}
|
|
66563
|
-
function collectManifestShared(shared) {
|
|
66564
|
-
if (!shared) return;
|
|
66565
|
-
const parsed = parseOptions(shared, (item, key)=>{
|
|
66566
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66567
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
66568
|
-
import: key,
|
|
66569
|
-
requiredVersion: item
|
|
66570
|
-
} : {
|
|
66571
|
-
import: item
|
|
66572
|
-
};
|
|
66573
|
-
}, (item)=>item);
|
|
66574
|
-
const result = parsed.map(([key, config])=>{
|
|
66575
|
-
const name = config.shareKey || key;
|
|
66576
|
-
const version = 'string' == typeof config.version ? config.version : void 0;
|
|
66577
|
-
const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66578
|
-
return {
|
|
66579
|
-
name,
|
|
66580
|
-
version,
|
|
66581
|
-
requiredVersion,
|
|
66582
|
-
singleton: config.singleton
|
|
66583
|
-
};
|
|
66584
|
-
});
|
|
66585
|
-
return result.length > 0 ? result : void 0;
|
|
66586
|
-
}
|
|
66587
|
-
function normalizeManifestOptions(mfConfig) {
|
|
66588
|
-
const manifestOptions = true === mfConfig.manifest ? {} : {
|
|
66589
|
-
...mfConfig.manifest
|
|
66590
|
-
};
|
|
66591
|
-
const containerName = mfConfig.name;
|
|
66592
|
-
const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
|
|
66593
|
-
const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
|
|
66594
|
-
if (cur[1].length > 1) return sum;
|
|
66595
|
-
const remoteInfo = cur[1][0];
|
|
66596
|
-
const { entry, alias, name } = remoteInfo;
|
|
66597
|
-
if (entry && name) sum[alias] = {
|
|
66598
|
-
name,
|
|
66599
|
-
entry
|
|
66600
|
-
};
|
|
66601
|
-
return sum;
|
|
66602
|
-
}, {});
|
|
66603
|
-
const manifestExposes = collectManifestExposes(mfConfig.exposes);
|
|
66604
|
-
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66605
|
-
const manifestShared = collectManifestShared(mfConfig.shared);
|
|
66606
|
-
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66607
|
-
return {
|
|
66608
|
-
...manifestOptions,
|
|
66609
|
-
remoteAliasMap,
|
|
66610
|
-
globalName,
|
|
66611
|
-
name: containerName
|
|
66612
|
-
};
|
|
66613
|
-
}
|
|
66614
|
-
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66615
|
-
raw(compiler) {
|
|
66616
|
-
const opts = normalizeManifestOptions(this.rawOpts);
|
|
66617
|
-
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
|
|
66618
|
-
const { statsFileName, manifestFileName } = getFileName(opts);
|
|
66619
|
-
const rawOptions = {
|
|
66620
|
-
name: opts.name,
|
|
66621
|
-
globalName: opts.globalName,
|
|
66622
|
-
fileName,
|
|
66623
|
-
filePath,
|
|
66624
|
-
manifestFileName,
|
|
66625
|
-
statsFileName,
|
|
66626
|
-
disableAssetsAnalyze,
|
|
66627
|
-
remoteAliasMap,
|
|
66628
|
-
exposes,
|
|
66629
|
-
shared,
|
|
66630
|
-
buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
|
|
66631
|
-
};
|
|
66632
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66633
|
-
}
|
|
66634
|
-
constructor(opts){
|
|
66635
|
-
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "rawOpts", void 0);
|
|
66636
|
-
this.rawOpts = opts;
|
|
66637
|
-
}
|
|
66638
|
-
}
|
|
66639
|
-
function CollectSharedEntryPlugin_define_property(obj, key, value) {
|
|
66640
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66641
|
-
value: value,
|
|
66642
|
-
enumerable: true,
|
|
66643
|
-
configurable: true,
|
|
66644
|
-
writable: true
|
|
66645
|
-
});
|
|
66646
|
-
else obj[key] = value;
|
|
66647
|
-
return obj;
|
|
66648
|
-
}
|
|
66649
|
-
const SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
|
|
66650
|
-
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
66651
|
-
getData() {
|
|
66652
|
-
return this._collectedEntries;
|
|
66653
|
-
}
|
|
66654
|
-
getFilename() {
|
|
66655
|
-
return SHARE_ENTRY_ASSET;
|
|
66656
|
-
}
|
|
66657
|
-
apply(compiler) {
|
|
66658
|
-
super.apply(compiler);
|
|
66659
|
-
compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
|
|
66660
|
-
compilation.hooks.processAssets.tap({
|
|
66661
|
-
name: 'CollectSharedEntry',
|
|
66662
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
66663
|
-
}, ()=>{
|
|
66664
|
-
compilation.getAssets().forEach((asset)=>{
|
|
66665
|
-
if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
|
|
66666
|
-
compilation.deleteAsset(asset.name);
|
|
66667
|
-
});
|
|
66668
|
-
});
|
|
66669
|
-
});
|
|
66670
|
-
}
|
|
66671
|
-
raw() {
|
|
66672
|
-
const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
|
|
66673
|
-
const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
|
|
66674
|
-
const rawOptions = {
|
|
66675
|
-
consumes: normalizedConsumeShareOptions.map(([key, v])=>({
|
|
66676
|
-
key,
|
|
66677
|
-
...v
|
|
66678
|
-
})),
|
|
66679
|
-
filename: this.getFilename()
|
|
66680
|
-
};
|
|
66681
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66682
|
-
}
|
|
66683
|
-
constructor(options){
|
|
66684
|
-
super(), CollectSharedEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectSharedEntryPlugin), CollectSharedEntryPlugin_define_property(this, "sharedOptions", void 0), CollectSharedEntryPlugin_define_property(this, "_collectedEntries", void 0);
|
|
66685
|
-
const { sharedOptions } = options;
|
|
66686
|
-
this.sharedOptions = sharedOptions;
|
|
66687
|
-
this._collectedEntries = {};
|
|
66688
|
-
}
|
|
66689
|
-
}
|
|
66690
|
-
function SharedContainerPlugin_define_property(obj, key, value) {
|
|
66691
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66692
|
-
value: value,
|
|
66693
|
-
enumerable: true,
|
|
66694
|
-
configurable: true,
|
|
66695
|
-
writable: true
|
|
66696
|
-
});
|
|
66697
|
-
else obj[key] = value;
|
|
66698
|
-
return obj;
|
|
66699
|
-
}
|
|
66700
|
-
function assert(condition, msg) {
|
|
66701
|
-
if (!condition) throw new Error(msg);
|
|
66702
|
-
}
|
|
66703
|
-
const HOT_UPDATE_SUFFIX = '.hot-update';
|
|
66704
|
-
class SharedContainerPlugin extends RspackBuiltinPlugin {
|
|
66705
|
-
getData() {
|
|
66706
|
-
return [
|
|
66707
|
-
this._options.fileName,
|
|
66708
|
-
this._globalName,
|
|
66709
|
-
this._options.version
|
|
66710
|
-
];
|
|
66711
|
-
}
|
|
66712
|
-
raw(compiler) {
|
|
66713
|
-
const { library } = this._options;
|
|
66714
|
-
if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
66715
|
-
return createBuiltinPlugin(this.name, this._options);
|
|
66716
|
-
}
|
|
66717
|
-
apply(compiler) {
|
|
66718
|
-
super.apply(compiler);
|
|
66719
|
-
const shareName = this._shareName;
|
|
66720
|
-
compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
|
|
66721
|
-
compilation.hooks.processAssets.tap({
|
|
66722
|
-
name: 'getShareContainerFile'
|
|
66723
|
-
}, ()=>{
|
|
66724
|
-
const remoteEntryPoint = compilation.entrypoints.get(shareName);
|
|
66725
|
-
assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
|
|
66726
|
-
const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
|
|
66727
|
-
assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
|
|
66728
|
-
const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
|
|
66729
|
-
assert(files.length > 0, `no files found for shared ${shareName} chunk`);
|
|
66730
|
-
assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
|
|
66731
|
-
this.filename = files[0];
|
|
66732
|
-
});
|
|
66733
|
-
});
|
|
66734
|
-
}
|
|
66735
|
-
constructor(options){
|
|
66736
|
-
super(), SharedContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedContainerPlugin), SharedContainerPlugin_define_property(this, "filename", ''), SharedContainerPlugin_define_property(this, "_options", void 0), SharedContainerPlugin_define_property(this, "_shareName", void 0), SharedContainerPlugin_define_property(this, "_globalName", void 0);
|
|
66737
|
-
const { shareName, library, request, independentShareFileName, mfName } = options;
|
|
66738
|
-
const version = options.version || '0.0.0';
|
|
66739
|
-
this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
|
|
66740
|
-
const fileName = independentShareFileName || `${version}/share-entry.js`;
|
|
66741
|
-
this._shareName = shareName;
|
|
66742
|
-
this._options = {
|
|
66743
|
-
name: shareName,
|
|
66744
|
-
request: request,
|
|
66745
|
-
library: (library ? {
|
|
66746
|
-
...library,
|
|
66747
|
-
name: this._globalName
|
|
66748
|
-
} : void 0) || {
|
|
66749
|
-
type: 'global',
|
|
66750
|
-
name: this._globalName
|
|
66751
|
-
},
|
|
66752
|
-
version,
|
|
66753
|
-
fileName
|
|
66754
|
-
};
|
|
66755
|
-
}
|
|
66756
|
-
}
|
|
66757
|
-
function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
|
|
66758
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66759
|
-
value: value,
|
|
66760
|
-
enumerable: true,
|
|
66761
|
-
configurable: true,
|
|
66762
|
-
writable: true
|
|
66763
|
-
});
|
|
66764
|
-
else obj[key] = value;
|
|
66765
|
-
return obj;
|
|
66766
|
-
}
|
|
66767
|
-
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
66768
|
-
buildOptions() {
|
|
66769
|
-
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66770
|
-
shareKey,
|
|
66771
|
-
treeShaking: !!config.treeShaking,
|
|
66772
|
-
usedExports: config.treeShaking?.usedExports
|
|
66773
|
-
}));
|
|
66774
|
-
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66775
|
-
return {
|
|
66776
|
-
shared,
|
|
66777
|
-
injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
|
|
66778
|
-
manifestFileName,
|
|
66779
|
-
statsFileName
|
|
66780
|
-
};
|
|
66781
|
-
}
|
|
66782
|
-
raw() {
|
|
66783
|
-
if (!this.sharedOptions.length) return;
|
|
66784
|
-
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66785
|
-
}
|
|
66786
|
-
constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
|
|
66787
|
-
super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectTreeShakingUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
|
|
66788
|
-
this.sharedOptions = sharedOptions;
|
|
66789
|
-
this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
|
|
66790
|
-
this.manifestOptions = manifestOptions ?? {};
|
|
66791
|
-
}
|
|
66792
|
-
}
|
|
66793
|
-
function IndependentSharedPlugin_define_property(obj, key, value) {
|
|
66794
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66795
|
-
value: value,
|
|
66796
|
-
enumerable: true,
|
|
66797
|
-
configurable: true,
|
|
66798
|
-
writable: true
|
|
66799
|
-
});
|
|
66800
|
-
else obj[key] = value;
|
|
66801
|
-
return obj;
|
|
66802
|
-
}
|
|
66803
|
-
const VIRTUAL_ENTRY = './virtual-entry.js';
|
|
66804
|
-
const VIRTUAL_ENTRY_NAME = 'virtual-entry';
|
|
66805
|
-
const filterPlugin = (plugin, excludedPlugins = [])=>{
|
|
66806
|
-
if (!plugin) return true;
|
|
66807
|
-
const pluginName = plugin.name || plugin.constructor?.name;
|
|
66808
|
-
if (!pluginName) return true;
|
|
66809
|
-
return ![
|
|
66810
|
-
'TreeShakingSharedPlugin',
|
|
66811
|
-
'IndependentSharedPlugin',
|
|
66812
|
-
'ModuleFederationPlugin',
|
|
66813
|
-
'SharedUsedExportsOptimizerPlugin',
|
|
66814
|
-
'HtmlWebpackPlugin',
|
|
66815
|
-
'HtmlRspackPlugin',
|
|
66816
|
-
'RsbuildHtmlPlugin',
|
|
66817
|
-
...excludedPlugins
|
|
66818
|
-
].includes(pluginName);
|
|
66819
|
-
};
|
|
66820
|
-
class VirtualEntryPlugin {
|
|
66821
|
-
createEntry() {
|
|
66822
|
-
const { sharedOptions, collectShared } = this;
|
|
66823
|
-
const entryContent = sharedOptions.reduce((acc, cur, index)=>{
|
|
66824
|
-
const importLine = `import shared_${index} from '${cur[0]}';\n`;
|
|
66825
|
-
const logLine = collectShared ? `console.log(shared_${index});\n` : '';
|
|
66826
|
-
return acc + importLine + logLine;
|
|
66827
|
-
}, '');
|
|
66828
|
-
return entryContent;
|
|
66829
|
-
}
|
|
66830
|
-
static entry() {
|
|
66831
|
-
return {
|
|
66832
|
-
[VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
|
|
66833
|
-
};
|
|
66834
|
-
}
|
|
66835
|
-
apply(compiler) {
|
|
66836
|
-
new compiler.rspack.experiments.VirtualModulesPlugin({
|
|
66837
|
-
[VIRTUAL_ENTRY]: this.createEntry()
|
|
66838
|
-
}).apply(compiler);
|
|
66839
|
-
compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
|
|
66840
|
-
compilation.hooks.processAssets.tap({
|
|
66841
|
-
name: 'RemoveVirtualEntryAsset',
|
|
66842
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
66843
|
-
}, ()=>{
|
|
66844
|
-
try {
|
|
66845
|
-
const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
66846
|
-
chunk?.files.forEach((f)=>{
|
|
66847
|
-
compilation.deleteAsset(f);
|
|
66848
|
-
});
|
|
66849
|
-
} catch (_e) {
|
|
66850
|
-
console.error('Failed to remove virtual entry file!');
|
|
66851
|
-
}
|
|
66852
|
-
});
|
|
66853
|
-
});
|
|
66854
|
-
}
|
|
66855
|
-
constructor(sharedOptions, collectShared){
|
|
66856
|
-
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66857
|
-
IndependentSharedPlugin_define_property(this, "collectShared", false);
|
|
66858
|
-
this.sharedOptions = sharedOptions;
|
|
66859
|
-
this.collectShared = collectShared;
|
|
66860
|
-
}
|
|
66861
|
-
}
|
|
66862
|
-
const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
|
|
66863
|
-
class IndependentSharedPlugin {
|
|
66864
|
-
apply(compiler) {
|
|
66865
|
-
const { manifest } = this;
|
|
66866
|
-
let runCount = 0;
|
|
66867
|
-
compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
|
|
66868
|
-
if (runCount) return;
|
|
66869
|
-
await this.createIndependentCompilers(compiler);
|
|
66870
|
-
runCount++;
|
|
66871
|
-
});
|
|
66872
|
-
compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
|
|
66873
|
-
if (runCount) return;
|
|
66874
|
-
await this.createIndependentCompilers(compiler);
|
|
66875
|
-
runCount++;
|
|
66876
|
-
});
|
|
66877
|
-
if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
|
|
66878
|
-
compilation.hooks.processAssets.tap({
|
|
66879
|
-
name: 'injectBuildAssets',
|
|
66880
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
66881
|
-
}, ()=>{
|
|
66882
|
-
const { statsFileName, manifestFileName } = getFileName(manifest);
|
|
66883
|
-
const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
66884
|
-
const stats = compilation.getAsset(filename);
|
|
66885
|
-
if (!stats) return;
|
|
66886
|
-
const statsContent = JSON.parse(stats.source.source().toString());
|
|
66887
|
-
const { shared } = statsContent;
|
|
66888
|
-
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
66889
|
-
const targetShared = shared.find((s)=>s.name === key);
|
|
66890
|
-
if (!targetShared) return;
|
|
66891
|
-
item.forEach(([entry, version, globalName])=>{
|
|
66892
|
-
if (version === targetShared.version) {
|
|
66893
|
-
targetShared.fallback = entry;
|
|
66894
|
-
targetShared.fallbackName = globalName;
|
|
66895
|
-
}
|
|
66896
|
-
});
|
|
66897
|
-
});
|
|
66898
|
-
compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
66899
|
-
};
|
|
66900
|
-
injectBuildAssetsIntoStatsOrManifest(statsFileName);
|
|
66901
|
-
injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
66902
|
-
});
|
|
66903
|
-
});
|
|
66904
|
-
}
|
|
66905
|
-
async createIndependentCompilers(parentCompiler) {
|
|
66906
|
-
const { sharedOptions, buildAssets, outputDir } = this;
|
|
66907
|
-
console.log('Start building shared fallback resources ...');
|
|
66908
|
-
const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
|
|
66909
|
-
await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
|
|
66910
|
-
if (!shareConfig.treeShaking || false === shareConfig.import) return;
|
|
66911
|
-
const shareRequests = shareRequestsMap[shareName].requests;
|
|
66912
|
-
await Promise.all(shareRequests.map(async ([request, version])=>{
|
|
66913
|
-
const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
|
|
66914
|
-
const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
|
|
66915
|
-
shareRequestsMap,
|
|
66916
|
-
currentShare: {
|
|
66917
|
-
shareName,
|
|
66918
|
-
version,
|
|
66919
|
-
request,
|
|
66920
|
-
independentShareFileName: sharedConfig?.treeShaking?.filename
|
|
66921
|
-
}
|
|
66922
|
-
});
|
|
66923
|
-
if ('string' == typeof shareFileName) {
|
|
66924
|
-
buildAssets[shareName] ||= [];
|
|
66925
|
-
buildAssets[shareName].push([
|
|
66926
|
-
(0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
|
|
66927
|
-
sharedVersion,
|
|
66928
|
-
globalName
|
|
66929
|
-
]);
|
|
66930
|
-
}
|
|
66931
|
-
}));
|
|
66932
|
-
}));
|
|
66933
|
-
console.log('All shared fallback have been compiled successfully!');
|
|
66934
|
-
}
|
|
66935
|
-
async createIndependentCompiler(parentCompiler, extraOptions) {
|
|
66936
|
-
const { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this;
|
|
66937
|
-
const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
|
|
66938
|
-
const parentConfig = parentCompiler.options;
|
|
66939
|
-
const finalPlugins = [];
|
|
66940
|
-
const rspack = parentCompiler.rspack;
|
|
66941
|
-
let extraPlugin;
|
|
66942
|
-
extraPlugin = extraOptions ? new SharedContainerPlugin({
|
|
66943
|
-
mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
|
|
66944
|
-
library,
|
|
66945
|
-
...extraOptions.currentShare
|
|
66946
|
-
}) : new CollectSharedEntryPlugin({
|
|
66947
|
-
sharedOptions,
|
|
66948
|
-
shareScope: 'default'
|
|
66949
|
-
});
|
|
66950
|
-
(parentConfig.plugins || []).forEach((plugin)=>{
|
|
66951
|
-
if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeShakingSharedExcludePlugins)) finalPlugins.push(plugin);
|
|
66952
|
-
});
|
|
66953
|
-
plugins.forEach((plugin)=>{
|
|
66954
|
-
finalPlugins.push(plugin);
|
|
66955
|
-
});
|
|
66956
|
-
finalPlugins.push(extraPlugin);
|
|
66957
|
-
finalPlugins.push(new ConsumeSharedPlugin({
|
|
66958
|
-
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
66959
|
-
[key]: {
|
|
66960
|
-
import: extraOptions ? false : options.import,
|
|
66961
|
-
shareKey: options.shareKey || key,
|
|
66962
|
-
shareScope: options.shareScope,
|
|
66963
|
-
requiredVersion: options.requiredVersion,
|
|
66964
|
-
strictVersion: options.strictVersion,
|
|
66965
|
-
singleton: options.singleton,
|
|
66966
|
-
packageName: options.packageName,
|
|
66967
|
-
eager: options.eager
|
|
66968
|
-
}
|
|
66969
|
-
})),
|
|
66970
|
-
enhanced: true
|
|
66971
|
-
}));
|
|
66972
|
-
if (treeShaking) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports));
|
|
66973
|
-
finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
|
|
66974
|
-
const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
|
|
66975
|
-
const compilerConfig = {
|
|
66976
|
-
...parentConfig,
|
|
66977
|
-
module: {
|
|
66978
|
-
...parentConfig.module,
|
|
66979
|
-
rules: [
|
|
66980
|
-
{
|
|
66981
|
-
test: /virtual-entry\.js$/,
|
|
66982
|
-
type: "javascript/auto",
|
|
66983
|
-
resolve: {
|
|
66984
|
-
fullySpecified: false
|
|
66985
|
-
},
|
|
66986
|
-
use: {
|
|
66987
|
-
loader: 'builtin:swc-loader'
|
|
66988
|
-
}
|
|
66989
|
-
},
|
|
66990
|
-
...parentConfig.module?.rules || []
|
|
66991
|
-
]
|
|
66992
|
-
},
|
|
66993
|
-
mode: parentConfig.mode || 'development',
|
|
66994
|
-
entry: VirtualEntryPlugin.entry,
|
|
66995
|
-
output: {
|
|
66996
|
-
path: fullOutputDir,
|
|
66997
|
-
clean: true,
|
|
66998
|
-
publicPath: parentConfig.output?.publicPath || 'auto'
|
|
66999
|
-
},
|
|
67000
|
-
plugins: finalPlugins,
|
|
67001
|
-
optimization: {
|
|
67002
|
-
...parentConfig.optimization,
|
|
67003
|
-
splitChunks: false
|
|
67004
|
-
}
|
|
67005
|
-
};
|
|
67006
|
-
const compiler = rspack.rspack(compilerConfig);
|
|
67007
|
-
compiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
67008
|
-
compiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
67009
|
-
compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
|
|
67010
|
-
const { currentShare } = extraOptions || {};
|
|
67011
|
-
return new Promise((resolve, reject)=>{
|
|
67012
|
-
compiler.run((err, stats)=>{
|
|
67013
|
-
if (err || stats?.hasErrors()) {
|
|
67014
|
-
const target = currentShare ? currentShare.shareName : 'Collect deps';
|
|
67015
|
-
console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
|
|
67016
|
-
reject(err || new Error(`${target} Compile failed`));
|
|
67017
|
-
return;
|
|
67018
|
-
}
|
|
67019
|
-
currentShare && console.log(`${currentShare.shareName} Compile success`);
|
|
67020
|
-
resolve(extraPlugin.getData());
|
|
67021
|
-
});
|
|
67022
|
-
});
|
|
67023
|
-
}
|
|
67024
|
-
constructor(options){
|
|
67025
|
-
IndependentSharedPlugin_define_property(this, "mfName", void 0);
|
|
67026
|
-
IndependentSharedPlugin_define_property(this, "shared", void 0);
|
|
67027
|
-
IndependentSharedPlugin_define_property(this, "library", void 0);
|
|
67028
|
-
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
67029
|
-
IndependentSharedPlugin_define_property(this, "outputDir", void 0);
|
|
67030
|
-
IndependentSharedPlugin_define_property(this, "plugins", void 0);
|
|
67031
|
-
IndependentSharedPlugin_define_property(this, "treeShaking", void 0);
|
|
67032
|
-
IndependentSharedPlugin_define_property(this, "manifest", void 0);
|
|
67033
|
-
IndependentSharedPlugin_define_property(this, "buildAssets", {});
|
|
67034
|
-
IndependentSharedPlugin_define_property(this, "injectTreeShakingUsedExports", void 0);
|
|
67035
|
-
IndependentSharedPlugin_define_property(this, "treeShakingSharedExcludePlugins", void 0);
|
|
67036
|
-
IndependentSharedPlugin_define_property(this, "name", 'IndependentSharedPlugin');
|
|
67037
|
-
const { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
|
|
67038
|
-
this.shared = shared;
|
|
67039
|
-
this.mfName = name;
|
|
67040
|
-
this.outputDir = outputDir || 'independent-packages';
|
|
67041
|
-
this.plugins = plugins || [];
|
|
67042
|
-
this.treeShaking = treeShaking;
|
|
67043
|
-
this.manifest = manifest;
|
|
67044
|
-
this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
|
|
67045
|
-
this.library = library;
|
|
67046
|
-
this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [];
|
|
67047
|
-
this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
67048
|
-
if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
|
|
67049
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
67050
|
-
import: key,
|
|
67051
|
-
requiredVersion: item
|
|
67052
|
-
} : {
|
|
67053
|
-
import: item
|
|
67054
|
-
};
|
|
67055
|
-
return config;
|
|
67056
|
-
}, (item)=>item);
|
|
67057
|
-
}
|
|
67058
|
-
}
|
|
67059
|
-
function TreeShakingSharedPlugin_define_property(obj, key, value) {
|
|
67060
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
67061
|
-
value: value,
|
|
67062
|
-
enumerable: true,
|
|
67063
|
-
configurable: true,
|
|
67064
|
-
writable: true
|
|
67065
|
-
});
|
|
67066
|
-
else obj[key] = value;
|
|
67067
|
-
return obj;
|
|
67068
|
-
}
|
|
67069
|
-
class TreeShakingSharedPlugin {
|
|
67070
|
-
apply(compiler) {
|
|
67071
|
-
const { mfConfig, outputDir, secondary } = this;
|
|
67072
|
-
const { name, shared, library, treeShakingSharedPlugins } = mfConfig;
|
|
67073
|
-
if (!shared) return;
|
|
67074
|
-
const sharedOptions = normalizeSharedOptions(shared);
|
|
67075
|
-
if (!sharedOptions.length) return;
|
|
67076
|
-
if (sharedOptions.some(([_, config])=>config.treeShaking && false !== config.import)) {
|
|
67077
|
-
if (!secondary) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler);
|
|
67078
|
-
this._independentSharePlugin = new IndependentSharedPlugin({
|
|
67079
|
-
name: name,
|
|
67080
|
-
shared: shared,
|
|
67081
|
-
outputDir,
|
|
67082
|
-
plugins: treeShakingSharedPlugins?.map((p)=>{
|
|
67083
|
-
const _constructor = require(p);
|
|
67084
|
-
return new _constructor();
|
|
67085
|
-
}) || [],
|
|
67086
|
-
treeShaking: secondary,
|
|
67087
|
-
library,
|
|
67088
|
-
manifest: mfConfig.manifest,
|
|
67089
|
-
treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
|
|
67090
|
-
});
|
|
67091
|
-
this._independentSharePlugin.apply(compiler);
|
|
67092
|
-
}
|
|
67093
|
-
}
|
|
67094
|
-
get buildAssets() {
|
|
67095
|
-
return this._independentSharePlugin?.buildAssets || {};
|
|
66260
|
+
return {
|
|
66261
|
+
statsFileName: (0, path_browserify.join)(filePath, statsFileName),
|
|
66262
|
+
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
66263
|
+
};
|
|
66264
|
+
}
|
|
66265
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66266
|
+
raw(compiler) {
|
|
66267
|
+
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
|
|
66268
|
+
const { statsFileName, manifestFileName } = getFileName(this.opts);
|
|
66269
|
+
const rawOptions = {
|
|
66270
|
+
name: this.opts.name,
|
|
66271
|
+
globalName: this.opts.globalName,
|
|
66272
|
+
fileName,
|
|
66273
|
+
filePath,
|
|
66274
|
+
manifestFileName,
|
|
66275
|
+
statsFileName,
|
|
66276
|
+
disableAssetsAnalyze,
|
|
66277
|
+
remoteAliasMap,
|
|
66278
|
+
exposes,
|
|
66279
|
+
shared,
|
|
66280
|
+
buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
|
|
66281
|
+
};
|
|
66282
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
67096
66283
|
}
|
|
67097
|
-
constructor(
|
|
67098
|
-
|
|
67099
|
-
|
|
67100
|
-
TreeShakingSharedPlugin_define_property(this, "secondary", void 0);
|
|
67101
|
-
TreeShakingSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
|
|
67102
|
-
TreeShakingSharedPlugin_define_property(this, "name", 'TreeShakingSharedPlugin');
|
|
67103
|
-
const { mfConfig, secondary } = options;
|
|
67104
|
-
this.mfConfig = mfConfig;
|
|
67105
|
-
this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages';
|
|
67106
|
-
this.secondary = Boolean(secondary);
|
|
66284
|
+
constructor(opts){
|
|
66285
|
+
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
66286
|
+
this.opts = opts;
|
|
67107
66287
|
}
|
|
67108
66288
|
}
|
|
67109
66289
|
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
66290
|
+
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
66291
|
+
const array = (items)=>{
|
|
66292
|
+
for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
|
|
66293
|
+
else if (item && 'object' == typeof item) object(item);
|
|
66294
|
+
else throw new Error('Unexpected options format');
|
|
66295
|
+
};
|
|
66296
|
+
const object = (obj)=>{
|
|
66297
|
+
for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
66298
|
+
};
|
|
66299
|
+
if (!options) return;
|
|
66300
|
+
if (Array.isArray(options)) array(options);
|
|
66301
|
+
else if ('object' == typeof options) object(options);
|
|
66302
|
+
else throw new Error('Unexpected options format');
|
|
66303
|
+
};
|
|
66304
|
+
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
66305
|
+
const items = [];
|
|
66306
|
+
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
66307
|
+
items.push([
|
|
66308
|
+
key,
|
|
66309
|
+
value
|
|
66310
|
+
]);
|
|
66311
|
+
});
|
|
66312
|
+
return items;
|
|
66313
|
+
};
|
|
67110
66314
|
function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
67111
66315
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
67112
66316
|
value: value,
|
|
@@ -67126,50 +66330,101 @@ class ModuleFederationPlugin {
|
|
|
67126
66330
|
'@module-federation/runtime': paths.runtime,
|
|
67127
66331
|
...compiler.options.resolve.alias
|
|
67128
66332
|
};
|
|
67129
|
-
const
|
|
67130
|
-
|
|
67131
|
-
|
|
67132
|
-
|
|
67133
|
-
mfConfig: this._options,
|
|
67134
|
-
secondary: false
|
|
67135
|
-
});
|
|
67136
|
-
this._treeShakingSharedPlugin.apply(compiler);
|
|
67137
|
-
}
|
|
67138
|
-
let runtimePluginApplied = false;
|
|
67139
|
-
compiler.hooks.beforeRun.tap({
|
|
67140
|
-
name: 'ModuleFederationPlugin',
|
|
67141
|
-
stage: 100
|
|
67142
|
-
}, ()=>{
|
|
67143
|
-
if (runtimePluginApplied) return;
|
|
67144
|
-
runtimePluginApplied = true;
|
|
67145
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets);
|
|
67146
|
-
new ModuleFederationRuntimePlugin({
|
|
67147
|
-
entryRuntime
|
|
67148
|
-
}).apply(compiler);
|
|
67149
|
-
});
|
|
67150
|
-
compiler.hooks.watchRun.tap({
|
|
67151
|
-
name: 'ModuleFederationPlugin',
|
|
67152
|
-
stage: 100
|
|
67153
|
-
}, ()=>{
|
|
67154
|
-
if (runtimePluginApplied) return;
|
|
67155
|
-
runtimePluginApplied = true;
|
|
67156
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {});
|
|
67157
|
-
new ModuleFederationRuntimePlugin({
|
|
67158
|
-
entryRuntime
|
|
67159
|
-
}).apply(compiler);
|
|
67160
|
-
});
|
|
66333
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
|
|
66334
|
+
new ModuleFederationRuntimePlugin({
|
|
66335
|
+
entryRuntime
|
|
66336
|
+
}).apply(compiler);
|
|
67161
66337
|
new webpack.container.ModuleFederationPluginV1({
|
|
67162
66338
|
...this._options,
|
|
67163
66339
|
enhanced: true
|
|
67164
66340
|
}).apply(compiler);
|
|
67165
|
-
if (this._options.manifest)
|
|
66341
|
+
if (this._options.manifest) {
|
|
66342
|
+
const manifestOptions = true === this._options.manifest ? {} : {
|
|
66343
|
+
...this._options.manifest
|
|
66344
|
+
};
|
|
66345
|
+
const containerName = manifestOptions.name ?? this._options.name;
|
|
66346
|
+
const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
|
|
66347
|
+
const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
66348
|
+
if (cur[1].length > 1) return sum;
|
|
66349
|
+
const remoteInfo = cur[1][0];
|
|
66350
|
+
const { entry, alias, name } = remoteInfo;
|
|
66351
|
+
if (entry && name) sum[alias] = {
|
|
66352
|
+
name,
|
|
66353
|
+
entry
|
|
66354
|
+
};
|
|
66355
|
+
return sum;
|
|
66356
|
+
}, {});
|
|
66357
|
+
const manifestExposes = collectManifestExposes(this._options.exposes);
|
|
66358
|
+
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66359
|
+
const manifestShared = collectManifestShared(this._options.shared);
|
|
66360
|
+
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66361
|
+
new ModuleFederationManifestPlugin({
|
|
66362
|
+
...manifestOptions,
|
|
66363
|
+
name: containerName,
|
|
66364
|
+
globalName,
|
|
66365
|
+
remoteAliasMap
|
|
66366
|
+
}).apply(compiler);
|
|
66367
|
+
}
|
|
67166
66368
|
}
|
|
67167
66369
|
constructor(_options){
|
|
67168
66370
|
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
67169
|
-
ModuleFederationPlugin_define_property(this, "_treeShakingSharedPlugin", void 0);
|
|
67170
66371
|
this._options = _options;
|
|
67171
66372
|
}
|
|
67172
66373
|
}
|
|
66374
|
+
function collectManifestExposes(exposes) {
|
|
66375
|
+
if (!exposes) return;
|
|
66376
|
+
const parsed = parseOptions(exposes, (value)=>({
|
|
66377
|
+
import: Array.isArray(value) ? value : [
|
|
66378
|
+
value
|
|
66379
|
+
],
|
|
66380
|
+
name: void 0
|
|
66381
|
+
}), (value)=>({
|
|
66382
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
66383
|
+
value.import
|
|
66384
|
+
],
|
|
66385
|
+
name: value.name ?? void 0
|
|
66386
|
+
}));
|
|
66387
|
+
const result = parsed.map(([exposeKey, info])=>{
|
|
66388
|
+
const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
|
|
66389
|
+
return {
|
|
66390
|
+
path: exposeKey,
|
|
66391
|
+
name: exposeName
|
|
66392
|
+
};
|
|
66393
|
+
});
|
|
66394
|
+
return result.length > 0 ? result : void 0;
|
|
66395
|
+
}
|
|
66396
|
+
function collectManifestShared(shared) {
|
|
66397
|
+
if (!shared) return;
|
|
66398
|
+
const parsed = parseOptions(shared, (item, key)=>{
|
|
66399
|
+
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66400
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
66401
|
+
import: key,
|
|
66402
|
+
requiredVersion: item
|
|
66403
|
+
} : {
|
|
66404
|
+
import: item
|
|
66405
|
+
};
|
|
66406
|
+
}, (item)=>item);
|
|
66407
|
+
const result = parsed.map(([key, config])=>{
|
|
66408
|
+
const name = config.shareKey || key;
|
|
66409
|
+
const version = 'string' == typeof config.version ? config.version : void 0;
|
|
66410
|
+
const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66411
|
+
return {
|
|
66412
|
+
name,
|
|
66413
|
+
version,
|
|
66414
|
+
requiredVersion,
|
|
66415
|
+
singleton: config.singleton
|
|
66416
|
+
};
|
|
66417
|
+
});
|
|
66418
|
+
return result.length > 0 ? result : void 0;
|
|
66419
|
+
}
|
|
66420
|
+
function resolveLibraryGlobalName(library) {
|
|
66421
|
+
if (!library) return;
|
|
66422
|
+
const libName = library.name;
|
|
66423
|
+
if (!libName) return;
|
|
66424
|
+
if ('string' == typeof libName) return libName;
|
|
66425
|
+
if (Array.isArray(libName)) return libName[0];
|
|
66426
|
+
if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66427
|
+
}
|
|
67173
66428
|
function getRemoteInfos(options) {
|
|
67174
66429
|
if (!options.remotes) return {};
|
|
67175
66430
|
function extractUrlAndGlobal(urlAndGlobal) {
|
|
@@ -67236,18 +66491,6 @@ function getRemoteInfos(options) {
|
|
|
67236
66491
|
function getRuntimePlugins(options) {
|
|
67237
66492
|
return options.runtimePlugins ?? [];
|
|
67238
66493
|
}
|
|
67239
|
-
function getSharedOptions(options) {
|
|
67240
|
-
if (!options.shared) return [];
|
|
67241
|
-
return parseOptions(options.shared, (item, key)=>{
|
|
67242
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
67243
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
67244
|
-
import: key,
|
|
67245
|
-
requiredVersion: item
|
|
67246
|
-
} : {
|
|
67247
|
-
import: item
|
|
67248
|
-
};
|
|
67249
|
-
}, (item)=>item);
|
|
67250
|
-
}
|
|
67251
66494
|
function getPaths(options) {
|
|
67252
66495
|
return {
|
|
67253
66496
|
runtimeTools: '@module-federation/runtime-tools',
|
|
@@ -67255,12 +66498,11 @@ function getPaths(options) {
|
|
|
67255
66498
|
runtime: '@module-federation/runtime'
|
|
67256
66499
|
};
|
|
67257
66500
|
}
|
|
67258
|
-
function getDefaultEntryRuntime(paths, options, compiler
|
|
66501
|
+
function getDefaultEntryRuntime(paths, options, compiler) {
|
|
67259
66502
|
const runtimePlugins = getRuntimePlugins(options);
|
|
67260
66503
|
const remoteInfos = getRemoteInfos(options);
|
|
67261
66504
|
const runtimePluginImports = [];
|
|
67262
66505
|
const runtimePluginVars = [];
|
|
67263
|
-
const libraryType = options.library?.type || 'var';
|
|
67264
66506
|
for(let i = 0; i < runtimePlugins.length; i++){
|
|
67265
66507
|
const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
|
|
67266
66508
|
const pluginSpec = runtimePlugins[i];
|
|
@@ -67277,12 +66519,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
|
|
|
67277
66519
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
67278
66520
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
67279
66521
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
|
|
67280
|
-
|
|
67281
|
-
`const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
|
|
67282
|
-
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var _ref,_ref1,_ref2,_ref3,_ref4;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,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1,_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,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};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,"libraryType",()=>__module_federation_library_type__);early(__webpack_require__.federation,"sharedFallback",()=>__module_federation_share_fallbacks__);const sharedFallback=__webpack_require__.federation.sharedFallback;early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){var __webpack_require___federation_bundlerRuntime;consumesLoadingModuleToHandlerMapping[moduleId]={getter:sharedFallback?(__webpack_require___federation_bundlerRuntime=__webpack_require__.federation.bundlerRuntime)===null||__webpack_require___federation_bundlerRuntime===void 0?void 0:__webpack_require___federation_bundlerRuntime.getSharedFallbackGetter({shareKey:data.shareKey,factory:data.fallback,webpackRequire:__webpack_require__,libraryType:__webpack_require__.federation.libraryType}):data.fallback,treeShakingGetter:sharedFallback?data.fallback:undefined,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey,treeShaking:__webpack_require__.federation.sharedFallback?{get:data.fallback,mode:data.treeShakingMode}:undefined}}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,treeShakingMode}=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,treeShaking:treeShakingMode?{mode:treeShakingMode}:undefined};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.bundlerRuntime.init({webpackRequire:__webpack_require__});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})}}'
|
|
66522
|
+
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var _ref,_ref1,_ref2,_ref3,_ref4;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,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1,_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,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};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})}}'
|
|
67283
66523
|
].join(';');
|
|
67284
66524
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
67285
66525
|
}
|
|
66526
|
+
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66527
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66528
|
+
value: value,
|
|
66529
|
+
enumerable: true,
|
|
66530
|
+
configurable: true,
|
|
66531
|
+
writable: true
|
|
66532
|
+
});
|
|
66533
|
+
else obj[key] = value;
|
|
66534
|
+
return obj;
|
|
66535
|
+
}
|
|
66536
|
+
const compilerSet = new WeakSet();
|
|
66537
|
+
function isSingleton(compiler) {
|
|
66538
|
+
return compilerSet.has(compiler);
|
|
66539
|
+
}
|
|
66540
|
+
function setSingleton(compiler) {
|
|
66541
|
+
compilerSet.add(compiler);
|
|
66542
|
+
}
|
|
66543
|
+
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66544
|
+
raw(compiler) {
|
|
66545
|
+
if (isSingleton(compiler)) return;
|
|
66546
|
+
setSingleton(compiler);
|
|
66547
|
+
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66548
|
+
}
|
|
66549
|
+
constructor(enhanced = false){
|
|
66550
|
+
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;
|
|
66551
|
+
}
|
|
66552
|
+
}
|
|
66553
|
+
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66554
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66555
|
+
value: value,
|
|
66556
|
+
enumerable: true,
|
|
66557
|
+
configurable: true,
|
|
66558
|
+
writable: true
|
|
66559
|
+
});
|
|
66560
|
+
else obj[key] = value;
|
|
66561
|
+
return obj;
|
|
66562
|
+
}
|
|
66563
|
+
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66564
|
+
raw(compiler) {
|
|
66565
|
+
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66566
|
+
const rawOptions = {
|
|
66567
|
+
consumes: this._options.consumes.map(([key, v])=>({
|
|
66568
|
+
key,
|
|
66569
|
+
...v
|
|
66570
|
+
})),
|
|
66571
|
+
enhanced: this._options.enhanced
|
|
66572
|
+
};
|
|
66573
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66574
|
+
}
|
|
66575
|
+
constructor(options){
|
|
66576
|
+
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66577
|
+
this._options = {
|
|
66578
|
+
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
66579
|
+
if (Array.isArray(item)) throw new Error('Unexpected array in options');
|
|
66580
|
+
const result = item !== key && isRequiredVersion(item) ? {
|
|
66581
|
+
import: key,
|
|
66582
|
+
shareScope: options.shareScope || 'default',
|
|
66583
|
+
shareKey: key,
|
|
66584
|
+
requiredVersion: item,
|
|
66585
|
+
strictVersion: true,
|
|
66586
|
+
packageName: void 0,
|
|
66587
|
+
singleton: false,
|
|
66588
|
+
eager: false
|
|
66589
|
+
} : {
|
|
66590
|
+
import: key,
|
|
66591
|
+
shareScope: options.shareScope || 'default',
|
|
66592
|
+
shareKey: key,
|
|
66593
|
+
requiredVersion: void 0,
|
|
66594
|
+
packageName: void 0,
|
|
66595
|
+
strictVersion: false,
|
|
66596
|
+
singleton: false,
|
|
66597
|
+
eager: false
|
|
66598
|
+
};
|
|
66599
|
+
return result;
|
|
66600
|
+
}, (item, key)=>({
|
|
66601
|
+
import: false === item.import ? void 0 : item.import || key,
|
|
66602
|
+
shareScope: item.shareScope || options.shareScope || 'default',
|
|
66603
|
+
shareKey: item.shareKey || key,
|
|
66604
|
+
requiredVersion: item.requiredVersion,
|
|
66605
|
+
strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66606
|
+
packageName: item.packageName,
|
|
66607
|
+
singleton: !!item.singleton,
|
|
66608
|
+
eager: !!item.eager
|
|
66609
|
+
})),
|
|
66610
|
+
enhanced: options.enhanced ?? false
|
|
66611
|
+
};
|
|
66612
|
+
}
|
|
66613
|
+
}
|
|
66614
|
+
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66615
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66616
|
+
value: value,
|
|
66617
|
+
enumerable: true,
|
|
66618
|
+
configurable: true,
|
|
66619
|
+
writable: true
|
|
66620
|
+
});
|
|
66621
|
+
else obj[key] = value;
|
|
66622
|
+
return obj;
|
|
66623
|
+
}
|
|
66624
|
+
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66625
|
+
raw(compiler) {
|
|
66626
|
+
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66627
|
+
const rawOptions = this._provides.map(([key, v])=>({
|
|
66628
|
+
key,
|
|
66629
|
+
...v
|
|
66630
|
+
}));
|
|
66631
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66632
|
+
}
|
|
66633
|
+
constructor(options){
|
|
66634
|
+
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);
|
|
66635
|
+
this._provides = parseOptions(options.provides, (item)=>{
|
|
66636
|
+
if (Array.isArray(item)) throw new Error('Unexpected array of provides');
|
|
66637
|
+
return {
|
|
66638
|
+
shareKey: item,
|
|
66639
|
+
version: void 0,
|
|
66640
|
+
shareScope: options.shareScope || 'default',
|
|
66641
|
+
eager: false
|
|
66642
|
+
};
|
|
66643
|
+
}, (item)=>{
|
|
66644
|
+
const raw = {
|
|
66645
|
+
shareKey: item.shareKey,
|
|
66646
|
+
version: item.version,
|
|
66647
|
+
shareScope: item.shareScope || options.shareScope || 'default',
|
|
66648
|
+
eager: !!item.eager
|
|
66649
|
+
};
|
|
66650
|
+
if (options.enhanced) {
|
|
66651
|
+
const enhancedItem = item;
|
|
66652
|
+
return {
|
|
66653
|
+
...raw,
|
|
66654
|
+
singleton: enhancedItem.singleton,
|
|
66655
|
+
requiredVersion: enhancedItem.requiredVersion,
|
|
66656
|
+
strictVersion: enhancedItem.strictVersion
|
|
66657
|
+
};
|
|
66658
|
+
}
|
|
66659
|
+
return raw;
|
|
66660
|
+
});
|
|
66661
|
+
this._enhanced = options.enhanced;
|
|
66662
|
+
}
|
|
66663
|
+
}
|
|
66664
|
+
function SharePlugin_define_property(obj, key, value) {
|
|
66665
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66666
|
+
value: value,
|
|
66667
|
+
enumerable: true,
|
|
66668
|
+
configurable: true,
|
|
66669
|
+
writable: true
|
|
66670
|
+
});
|
|
66671
|
+
else obj[key] = value;
|
|
66672
|
+
return obj;
|
|
66673
|
+
}
|
|
66674
|
+
class SharePlugin {
|
|
66675
|
+
apply(compiler) {
|
|
66676
|
+
new ConsumeSharedPlugin({
|
|
66677
|
+
shareScope: this._shareScope,
|
|
66678
|
+
consumes: this._consumes,
|
|
66679
|
+
enhanced: this._enhanced
|
|
66680
|
+
}).apply(compiler);
|
|
66681
|
+
new ProvideSharedPlugin({
|
|
66682
|
+
shareScope: this._shareScope,
|
|
66683
|
+
provides: this._provides,
|
|
66684
|
+
enhanced: this._enhanced
|
|
66685
|
+
}).apply(compiler);
|
|
66686
|
+
}
|
|
66687
|
+
constructor(options){
|
|
66688
|
+
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66689
|
+
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66690
|
+
SharePlugin_define_property(this, "_provides", void 0);
|
|
66691
|
+
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66692
|
+
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
66693
|
+
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66694
|
+
const config = item !== key && isRequiredVersion(item) ? {
|
|
66695
|
+
import: key,
|
|
66696
|
+
requiredVersion: item
|
|
66697
|
+
} : {
|
|
66698
|
+
import: item
|
|
66699
|
+
};
|
|
66700
|
+
return config;
|
|
66701
|
+
}, (item)=>item);
|
|
66702
|
+
const consumes = sharedOptions.map(([key, options])=>({
|
|
66703
|
+
[key]: {
|
|
66704
|
+
import: options.import,
|
|
66705
|
+
shareKey: options.shareKey || key,
|
|
66706
|
+
shareScope: options.shareScope,
|
|
66707
|
+
requiredVersion: options.requiredVersion,
|
|
66708
|
+
strictVersion: options.strictVersion,
|
|
66709
|
+
singleton: options.singleton,
|
|
66710
|
+
packageName: options.packageName,
|
|
66711
|
+
eager: options.eager
|
|
66712
|
+
}
|
|
66713
|
+
}));
|
|
66714
|
+
const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66715
|
+
[options.import || key]: {
|
|
66716
|
+
shareKey: options.shareKey || key,
|
|
66717
|
+
shareScope: options.shareScope,
|
|
66718
|
+
version: options.version,
|
|
66719
|
+
eager: options.eager,
|
|
66720
|
+
singleton: options.singleton,
|
|
66721
|
+
requiredVersion: options.requiredVersion,
|
|
66722
|
+
strictVersion: options.strictVersion
|
|
66723
|
+
}
|
|
66724
|
+
}));
|
|
66725
|
+
this._shareScope = options.shareScope;
|
|
66726
|
+
this._consumes = consumes;
|
|
66727
|
+
this._provides = provides;
|
|
66728
|
+
this._enhanced = options.enhanced ?? false;
|
|
66729
|
+
}
|
|
66730
|
+
}
|
|
67286
66731
|
function ContainerPlugin_define_property(obj, key, value) {
|
|
67287
66732
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
67288
66733
|
value: value,
|
|
@@ -67318,7 +66763,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
67318
66763
|
name: options.name,
|
|
67319
66764
|
shareScope: options.shareScope || 'default',
|
|
67320
66765
|
library: options.library || {
|
|
67321
|
-
type: '
|
|
66766
|
+
type: 'var',
|
|
67322
66767
|
name: options.name
|
|
67323
66768
|
},
|
|
67324
66769
|
runtime: options.runtime,
|
|
@@ -67455,7 +66900,7 @@ function transformSync(source, options) {
|
|
|
67455
66900
|
const _options = JSON.stringify(options || {});
|
|
67456
66901
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
67457
66902
|
}
|
|
67458
|
-
const exports_rspackVersion = "1.7.3-canary-
|
|
66903
|
+
const exports_rspackVersion = "1.7.3-canary-6991b7b5-20260119174555";
|
|
67459
66904
|
const exports_version = "5.75.0";
|
|
67460
66905
|
const exports_WebpackError = Error;
|
|
67461
66906
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -67506,7 +66951,6 @@ const container = {
|
|
|
67506
66951
|
};
|
|
67507
66952
|
const sharing = {
|
|
67508
66953
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
67509
|
-
TreeShakingSharedPlugin: TreeShakingSharedPlugin,
|
|
67510
66954
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
67511
66955
|
SharePlugin: SharePlugin
|
|
67512
66956
|
};
|
|
@@ -67546,7 +66990,7 @@ const exports_experiments = {
|
|
|
67546
66990
|
createNativePlugin: createNativePlugin,
|
|
67547
66991
|
VirtualModulesPlugin: VirtualModulesPlugin
|
|
67548
66992
|
};
|
|
67549
|
-
const src_fn = Object.assign(
|
|
66993
|
+
const src_fn = Object.assign(rspack, exports_namespaceObject);
|
|
67550
66994
|
src_fn.rspack = src_fn;
|
|
67551
66995
|
src_fn.webpack = src_fn;
|
|
67552
66996
|
const src_rspack_0 = src_fn;
|