@rspack-canary/browser 1.7.3-canary-58d41d16-20260115035302 → 1.7.3-canary-ef467b46-20260115180501
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 +393 -901
- 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
|
@@ -56337,6 +56337,7 @@ const BuiltinLazyCompilationPlugin = base_create(external_rspack_wasi_browser_js
|
|
|
56337
56337
|
client,
|
|
56338
56338
|
currentActiveModules
|
|
56339
56339
|
}), 'thisCompilation');
|
|
56340
|
+
var middleware_Buffer = __webpack_require__("./src/browser/buffer.ts")["Buffer"];
|
|
56340
56341
|
const LAZY_COMPILATION_PREFIX = '/lazy-compilation-using-';
|
|
56341
56342
|
const getDefaultClient = (compiler)=>require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? 'node' : 'web'}.js`);
|
|
56342
56343
|
const noop = (_req, _res, next)=>{
|
|
@@ -56399,15 +56400,62 @@ function applyPlugin(compiler, options, activeModules) {
|
|
|
56399
56400
|
}, options.entries ?? true, options.imports ?? true, `${options.client || getDefaultClient(compiler)}?${encodeURIComponent(getFullServerUrl(options))}`, options.test);
|
|
56400
56401
|
plugin.apply(compiler);
|
|
56401
56402
|
}
|
|
56403
|
+
function readModuleIdsFromBody(req) {
|
|
56404
|
+
if (void 0 !== req.body) {
|
|
56405
|
+
if (Array.isArray(req.body)) return Promise.resolve(req.body);
|
|
56406
|
+
if ('string' == typeof req.body) return Promise.resolve(req.body.split('\n').filter(Boolean));
|
|
56407
|
+
throw new Error('Invalid body type');
|
|
56408
|
+
}
|
|
56409
|
+
return new Promise((resolve, reject)=>{
|
|
56410
|
+
if (req.aborted || req.destroyed) return void reject(new Error('Request was aborted before body could be read'));
|
|
56411
|
+
const cleanup = ()=>{
|
|
56412
|
+
req.removeListener('data', onData);
|
|
56413
|
+
req.removeListener('end', onEnd);
|
|
56414
|
+
req.removeListener('error', onError);
|
|
56415
|
+
req.removeListener('close', onClose);
|
|
56416
|
+
req.removeListener('aborted', onAborted);
|
|
56417
|
+
};
|
|
56418
|
+
const chunks = [];
|
|
56419
|
+
const onData = (chunk)=>{
|
|
56420
|
+
chunks.push(chunk);
|
|
56421
|
+
};
|
|
56422
|
+
const onEnd = ()=>{
|
|
56423
|
+
cleanup();
|
|
56424
|
+
const body = middleware_Buffer.concat(chunks).toString('utf8');
|
|
56425
|
+
resolve(body.split('\n').filter(Boolean));
|
|
56426
|
+
};
|
|
56427
|
+
const onError = (err)=>{
|
|
56428
|
+
cleanup();
|
|
56429
|
+
reject(err);
|
|
56430
|
+
};
|
|
56431
|
+
const onClose = ()=>{
|
|
56432
|
+
cleanup();
|
|
56433
|
+
reject(new Error('Request was closed before body could be read'));
|
|
56434
|
+
};
|
|
56435
|
+
const onAborted = ()=>{
|
|
56436
|
+
cleanup();
|
|
56437
|
+
reject(new Error('Request was aborted before body could be read'));
|
|
56438
|
+
};
|
|
56439
|
+
req.on('data', onData);
|
|
56440
|
+
req.on('end', onEnd);
|
|
56441
|
+
req.on('error', onError);
|
|
56442
|
+
req.on('close', onClose);
|
|
56443
|
+
req.on('aborted', onAborted);
|
|
56444
|
+
});
|
|
56445
|
+
}
|
|
56402
56446
|
const lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilationPrefix)=>{
|
|
56403
56447
|
const logger = compiler.getInfrastructureLogger('LazyCompilation');
|
|
56404
|
-
return (req, res, next)=>{
|
|
56405
|
-
if (!req.url?.startsWith(lazyCompilationPrefix)) return next?.();
|
|
56406
|
-
|
|
56407
|
-
|
|
56408
|
-
|
|
56409
|
-
|
|
56410
|
-
|
|
56448
|
+
return async (req, res, next)=>{
|
|
56449
|
+
if (!req.url?.startsWith(lazyCompilationPrefix) || 'POST' !== req.method) return next?.();
|
|
56450
|
+
let modules = [];
|
|
56451
|
+
try {
|
|
56452
|
+
modules = await readModuleIdsFromBody(req);
|
|
56453
|
+
} catch (err) {
|
|
56454
|
+
logger.error('Failed to parse request body: ' + err);
|
|
56455
|
+
res.writeHead(400);
|
|
56456
|
+
res.end('Bad Request');
|
|
56457
|
+
return;
|
|
56458
|
+
}
|
|
56411
56459
|
const moduleActivated = [];
|
|
56412
56460
|
for (const key of modules){
|
|
56413
56461
|
const activated = activeModules.has(key);
|
|
@@ -56418,6 +56466,9 @@ const lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilat
|
|
|
56418
56466
|
}
|
|
56419
56467
|
}
|
|
56420
56468
|
if (moduleActivated.length && compiler.watching) compiler.watching.invalidate();
|
|
56469
|
+
res.writeHead(200);
|
|
56470
|
+
res.write('\n');
|
|
56471
|
+
res.end();
|
|
56421
56472
|
};
|
|
56422
56473
|
};
|
|
56423
56474
|
function MangleExportsPlugin_define_property(obj, key, value) {
|
|
@@ -58216,7 +58267,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58216
58267
|
if ('object' == typeof rspackFuture) {
|
|
58217
58268
|
D(rspackFuture, 'bundlerInfo', {});
|
|
58218
58269
|
if ('object' == typeof rspackFuture.bundlerInfo) {
|
|
58219
|
-
D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-
|
|
58270
|
+
D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-ef467b46-20260115180501");
|
|
58220
58271
|
D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
|
|
58221
58272
|
D(rspackFuture.bundlerInfo, 'force', !library);
|
|
58222
58273
|
}
|
|
@@ -60486,7 +60537,7 @@ class MultiStats {
|
|
|
60486
60537
|
return obj;
|
|
60487
60538
|
});
|
|
60488
60539
|
if (childOptions.version) {
|
|
60489
|
-
obj.rspackVersion = "1.7.3-canary-
|
|
60540
|
+
obj.rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
|
|
60490
60541
|
obj.version = "5.75.0";
|
|
60491
60542
|
}
|
|
60492
60543
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
|
|
@@ -60531,10 +60582,10 @@ class MultiStats {
|
|
|
60531
60582
|
this.stats = stats;
|
|
60532
60583
|
}
|
|
60533
60584
|
}
|
|
60534
|
-
function createChildOptions(options
|
|
60585
|
+
function createChildOptions(options, context) {
|
|
60535
60586
|
const { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
|
|
60536
60587
|
preset: options
|
|
60537
|
-
} : options;
|
|
60588
|
+
} : options ?? {};
|
|
60538
60589
|
const children = this.stats.map((stat, idx)=>{
|
|
60539
60590
|
const childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
|
|
60540
60591
|
return stat.compilation.createStatsOptions({
|
|
@@ -62318,7 +62369,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
62318
62369
|
},
|
|
62319
62370
|
version: (object)=>{
|
|
62320
62371
|
object.version = "5.75.0";
|
|
62321
|
-
object.rspackVersion = "1.7.3-canary-
|
|
62372
|
+
object.rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
|
|
62322
62373
|
},
|
|
62323
62374
|
env: (object, _compilation, _context, { _env })=>{
|
|
62324
62375
|
object.env = _env;
|
|
@@ -64113,7 +64164,7 @@ function createCompiler(userOptions) {
|
|
|
64113
64164
|
function isMultiRspackOptions(o) {
|
|
64114
64165
|
return Array.isArray(o);
|
|
64115
64166
|
}
|
|
64116
|
-
function
|
|
64167
|
+
function rspack(options, callback) {
|
|
64117
64168
|
try {
|
|
64118
64169
|
if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
|
|
64119
64170
|
else validateRspackConfig(options);
|
|
@@ -65778,7 +65829,7 @@ class Compiler {
|
|
|
65778
65829
|
};
|
|
65779
65830
|
const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
|
|
65780
65831
|
const compilerFn = function(...params) {
|
|
65781
|
-
return
|
|
65832
|
+
return rspack(...params);
|
|
65782
65833
|
};
|
|
65783
65834
|
const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
|
|
65784
65835
|
RuntimeGlobals: compilerRuntimeGlobals
|
|
@@ -66280,266 +66331,10 @@ class NodeTemplatePlugin {
|
|
|
66280
66331
|
this._options = _options;
|
|
66281
66332
|
}
|
|
66282
66333
|
}
|
|
66283
|
-
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
66284
|
-
const array = (items)=>{
|
|
66285
|
-
for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
|
|
66286
|
-
else if (item && 'object' == typeof item) object(item);
|
|
66287
|
-
else throw new Error('Unexpected options format');
|
|
66288
|
-
};
|
|
66289
|
-
const object = (obj)=>{
|
|
66290
|
-
for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
66291
|
-
};
|
|
66292
|
-
if (!options) return;
|
|
66293
|
-
if (Array.isArray(options)) array(options);
|
|
66294
|
-
else if ('object' == typeof options) object(options);
|
|
66295
|
-
else throw new Error('Unexpected options format');
|
|
66296
|
-
};
|
|
66297
|
-
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
66298
|
-
const items = [];
|
|
66299
|
-
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
66300
|
-
items.push([
|
|
66301
|
-
key,
|
|
66302
|
-
value
|
|
66303
|
-
]);
|
|
66304
|
-
});
|
|
66305
|
-
return items;
|
|
66306
|
-
};
|
|
66307
|
-
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66308
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66309
|
-
value: value,
|
|
66310
|
-
enumerable: true,
|
|
66311
|
-
configurable: true,
|
|
66312
|
-
writable: true
|
|
66313
|
-
});
|
|
66314
|
-
else obj[key] = value;
|
|
66315
|
-
return obj;
|
|
66316
|
-
}
|
|
66317
|
-
const compilerSet = new WeakSet();
|
|
66318
|
-
function isSingleton(compiler) {
|
|
66319
|
-
return compilerSet.has(compiler);
|
|
66320
|
-
}
|
|
66321
|
-
function setSingleton(compiler) {
|
|
66322
|
-
compilerSet.add(compiler);
|
|
66323
|
-
}
|
|
66324
|
-
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66325
|
-
raw(compiler) {
|
|
66326
|
-
if (isSingleton(compiler)) return;
|
|
66327
|
-
setSingleton(compiler);
|
|
66328
|
-
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66329
|
-
}
|
|
66330
|
-
constructor(enhanced = false){
|
|
66331
|
-
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;
|
|
66332
|
-
}
|
|
66333
|
-
}
|
|
66334
66334
|
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
66335
66335
|
function isRequiredVersion(str) {
|
|
66336
66336
|
return VERSION_PATTERN_REGEXP.test(str);
|
|
66337
66337
|
}
|
|
66338
|
-
const encodeName = function(name, prefix = '', withExt = false) {
|
|
66339
|
-
const ext = withExt ? '.js' : '';
|
|
66340
|
-
return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
|
|
66341
|
-
};
|
|
66342
|
-
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66343
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66344
|
-
value: value,
|
|
66345
|
-
enumerable: true,
|
|
66346
|
-
configurable: true,
|
|
66347
|
-
writable: true
|
|
66348
|
-
});
|
|
66349
|
-
else obj[key] = value;
|
|
66350
|
-
return obj;
|
|
66351
|
-
}
|
|
66352
|
-
function normalizeConsumeShareOptions(consumes, shareScope) {
|
|
66353
|
-
return parseOptions(consumes, (item, key)=>{
|
|
66354
|
-
if (Array.isArray(item)) throw new Error('Unexpected array in options');
|
|
66355
|
-
const result = item !== key && isRequiredVersion(item) ? {
|
|
66356
|
-
import: key,
|
|
66357
|
-
shareScope: shareScope || 'default',
|
|
66358
|
-
shareKey: key,
|
|
66359
|
-
requiredVersion: item,
|
|
66360
|
-
strictVersion: true,
|
|
66361
|
-
packageName: void 0,
|
|
66362
|
-
singleton: false,
|
|
66363
|
-
eager: false,
|
|
66364
|
-
treeShakingMode: void 0
|
|
66365
|
-
} : {
|
|
66366
|
-
import: key,
|
|
66367
|
-
shareScope: shareScope || 'default',
|
|
66368
|
-
shareKey: key,
|
|
66369
|
-
requiredVersion: void 0,
|
|
66370
|
-
packageName: void 0,
|
|
66371
|
-
strictVersion: false,
|
|
66372
|
-
singleton: false,
|
|
66373
|
-
eager: false,
|
|
66374
|
-
treeShakingMode: void 0
|
|
66375
|
-
};
|
|
66376
|
-
return result;
|
|
66377
|
-
}, (item, key)=>({
|
|
66378
|
-
import: false === item.import ? void 0 : item.import || key,
|
|
66379
|
-
shareScope: item.shareScope || shareScope || 'default',
|
|
66380
|
-
shareKey: item.shareKey || key,
|
|
66381
|
-
requiredVersion: item.requiredVersion,
|
|
66382
|
-
strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66383
|
-
packageName: item.packageName,
|
|
66384
|
-
singleton: !!item.singleton,
|
|
66385
|
-
eager: !!item.eager,
|
|
66386
|
-
treeShakingMode: item.treeShakingMode
|
|
66387
|
-
}));
|
|
66388
|
-
}
|
|
66389
|
-
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66390
|
-
raw(compiler) {
|
|
66391
|
-
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66392
|
-
const rawOptions = {
|
|
66393
|
-
consumes: this._options.consumes.map(([key, v])=>({
|
|
66394
|
-
key,
|
|
66395
|
-
...v
|
|
66396
|
-
})),
|
|
66397
|
-
enhanced: this._options.enhanced
|
|
66398
|
-
};
|
|
66399
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66400
|
-
}
|
|
66401
|
-
constructor(options){
|
|
66402
|
-
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66403
|
-
this._options = {
|
|
66404
|
-
consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
|
|
66405
|
-
enhanced: options.enhanced ?? false
|
|
66406
|
-
};
|
|
66407
|
-
}
|
|
66408
|
-
}
|
|
66409
|
-
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66410
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66411
|
-
value: value,
|
|
66412
|
-
enumerable: true,
|
|
66413
|
-
configurable: true,
|
|
66414
|
-
writable: true
|
|
66415
|
-
});
|
|
66416
|
-
else obj[key] = value;
|
|
66417
|
-
return obj;
|
|
66418
|
-
}
|
|
66419
|
-
function normalizeProvideShareOptions(options, shareScope, enhanced) {
|
|
66420
|
-
return parseOptions(options, (item)=>{
|
|
66421
|
-
if (Array.isArray(item)) throw new Error('Unexpected array of provides');
|
|
66422
|
-
return {
|
|
66423
|
-
shareKey: item,
|
|
66424
|
-
version: void 0,
|
|
66425
|
-
shareScope: shareScope || 'default',
|
|
66426
|
-
eager: false
|
|
66427
|
-
};
|
|
66428
|
-
}, (item)=>{
|
|
66429
|
-
const raw = {
|
|
66430
|
-
shareKey: item.shareKey,
|
|
66431
|
-
version: item.version,
|
|
66432
|
-
shareScope: item.shareScope || shareScope || 'default',
|
|
66433
|
-
eager: !!item.eager
|
|
66434
|
-
};
|
|
66435
|
-
if (enhanced) {
|
|
66436
|
-
const enhancedItem = item;
|
|
66437
|
-
return {
|
|
66438
|
-
...raw,
|
|
66439
|
-
singleton: enhancedItem.singleton,
|
|
66440
|
-
requiredVersion: enhancedItem.requiredVersion,
|
|
66441
|
-
strictVersion: enhancedItem.strictVersion,
|
|
66442
|
-
treeShakingMode: enhancedItem.treeShakingMode
|
|
66443
|
-
};
|
|
66444
|
-
}
|
|
66445
|
-
return raw;
|
|
66446
|
-
});
|
|
66447
|
-
}
|
|
66448
|
-
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66449
|
-
raw(compiler) {
|
|
66450
|
-
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66451
|
-
const rawOptions = this._provides.map(([key, v])=>({
|
|
66452
|
-
key,
|
|
66453
|
-
...v
|
|
66454
|
-
}));
|
|
66455
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66456
|
-
}
|
|
66457
|
-
constructor(options){
|
|
66458
|
-
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);
|
|
66459
|
-
this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
|
|
66460
|
-
this._enhanced = options.enhanced;
|
|
66461
|
-
}
|
|
66462
|
-
}
|
|
66463
|
-
function SharePlugin_define_property(obj, key, value) {
|
|
66464
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66465
|
-
value: value,
|
|
66466
|
-
enumerable: true,
|
|
66467
|
-
configurable: true,
|
|
66468
|
-
writable: true
|
|
66469
|
-
});
|
|
66470
|
-
else obj[key] = value;
|
|
66471
|
-
return obj;
|
|
66472
|
-
}
|
|
66473
|
-
function normalizeSharedOptions(shared) {
|
|
66474
|
-
return parseOptions(shared, (item, key)=>{
|
|
66475
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66476
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
66477
|
-
import: key,
|
|
66478
|
-
requiredVersion: item
|
|
66479
|
-
} : {
|
|
66480
|
-
import: item
|
|
66481
|
-
};
|
|
66482
|
-
return config;
|
|
66483
|
-
}, (item)=>item);
|
|
66484
|
-
}
|
|
66485
|
-
function createProvideShareOptions(normalizedSharedOptions) {
|
|
66486
|
-
return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66487
|
-
[options.import || key]: {
|
|
66488
|
-
shareKey: options.shareKey || key,
|
|
66489
|
-
shareScope: options.shareScope,
|
|
66490
|
-
version: options.version,
|
|
66491
|
-
eager: options.eager,
|
|
66492
|
-
singleton: options.singleton,
|
|
66493
|
-
requiredVersion: options.requiredVersion,
|
|
66494
|
-
strictVersion: options.strictVersion,
|
|
66495
|
-
treeShakingMode: options.treeShaking?.mode
|
|
66496
|
-
}
|
|
66497
|
-
}));
|
|
66498
|
-
}
|
|
66499
|
-
function createConsumeShareOptions(normalizedSharedOptions) {
|
|
66500
|
-
return normalizedSharedOptions.map(([key, options])=>({
|
|
66501
|
-
[key]: {
|
|
66502
|
-
import: options.import,
|
|
66503
|
-
shareKey: options.shareKey || key,
|
|
66504
|
-
shareScope: options.shareScope,
|
|
66505
|
-
requiredVersion: options.requiredVersion,
|
|
66506
|
-
strictVersion: options.strictVersion,
|
|
66507
|
-
singleton: options.singleton,
|
|
66508
|
-
packageName: options.packageName,
|
|
66509
|
-
eager: options.eager,
|
|
66510
|
-
treeShakingMode: options.treeShaking?.mode
|
|
66511
|
-
}
|
|
66512
|
-
}));
|
|
66513
|
-
}
|
|
66514
|
-
class SharePlugin {
|
|
66515
|
-
apply(compiler) {
|
|
66516
|
-
new ConsumeSharedPlugin({
|
|
66517
|
-
shareScope: this._shareScope,
|
|
66518
|
-
consumes: this._consumes,
|
|
66519
|
-
enhanced: this._enhanced
|
|
66520
|
-
}).apply(compiler);
|
|
66521
|
-
new ProvideSharedPlugin({
|
|
66522
|
-
shareScope: this._shareScope,
|
|
66523
|
-
provides: this._provides,
|
|
66524
|
-
enhanced: this._enhanced
|
|
66525
|
-
}).apply(compiler);
|
|
66526
|
-
}
|
|
66527
|
-
constructor(options){
|
|
66528
|
-
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66529
|
-
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66530
|
-
SharePlugin_define_property(this, "_provides", void 0);
|
|
66531
|
-
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66532
|
-
SharePlugin_define_property(this, "_sharedOptions", void 0);
|
|
66533
|
-
const sharedOptions = normalizeSharedOptions(options.shared);
|
|
66534
|
-
const consumes = createConsumeShareOptions(sharedOptions);
|
|
66535
|
-
const provides = createProvideShareOptions(sharedOptions);
|
|
66536
|
-
this._shareScope = options.shareScope;
|
|
66537
|
-
this._consumes = consumes;
|
|
66538
|
-
this._provides = provides;
|
|
66539
|
-
this._enhanced = options.enhanced ?? false;
|
|
66540
|
-
this._sharedOptions = sharedOptions;
|
|
66541
|
-
}
|
|
66542
|
-
}
|
|
66543
66338
|
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
66544
66339
|
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
66545
66340
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -66578,29 +66373,17 @@ function readPKGJson(root) {
|
|
|
66578
66373
|
} catch {}
|
|
66579
66374
|
return {};
|
|
66580
66375
|
}
|
|
66581
|
-
function getBuildInfo(isDev,
|
|
66582
|
-
const rootPath =
|
|
66376
|
+
function getBuildInfo(isDev, root) {
|
|
66377
|
+
const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
|
|
66583
66378
|
const pkg = readPKGJson(rootPath);
|
|
66584
66379
|
const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
|
|
66585
|
-
|
|
66380
|
+
return {
|
|
66586
66381
|
buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
|
|
66587
66382
|
buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
|
|
66588
66383
|
};
|
|
66589
|
-
const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
|
|
66590
|
-
const enableTreeShaking = Object.values(normalizedShared).some((config)=>config[1].treeShaking);
|
|
66591
|
-
if (enableTreeShaking) {
|
|
66592
|
-
statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
|
|
66593
|
-
statsBuildInfo.plugins = mfConfig.treeShakingSharedPlugins || [];
|
|
66594
|
-
statsBuildInfo.excludePlugins = mfConfig.treeShakingSharedExcludePlugins || [];
|
|
66595
|
-
}
|
|
66596
|
-
return statsBuildInfo;
|
|
66597
66384
|
}
|
|
66598
66385
|
function getFileName(manifestOptions) {
|
|
66599
66386
|
if (!manifestOptions) return {
|
|
66600
|
-
statsFileName: '',
|
|
66601
|
-
manifestFileName: ''
|
|
66602
|
-
};
|
|
66603
|
-
if ('boolean' == typeof manifestOptions) return {
|
|
66604
66387
|
statsFileName: STATS_FILE_NAME,
|
|
66605
66388
|
manifestFileName: MANIFEST_FILE_NAME
|
|
66606
66389
|
};
|
|
@@ -66618,95 +66401,13 @@ function getFileName(manifestOptions) {
|
|
|
66618
66401
|
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
66619
66402
|
};
|
|
66620
66403
|
}
|
|
66621
|
-
function resolveLibraryGlobalName(library) {
|
|
66622
|
-
if (!library) return;
|
|
66623
|
-
const libName = library.name;
|
|
66624
|
-
if (!libName) return;
|
|
66625
|
-
if ('string' == typeof libName) return libName;
|
|
66626
|
-
if (Array.isArray(libName)) return libName[0];
|
|
66627
|
-
if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66628
|
-
}
|
|
66629
|
-
function collectManifestExposes(exposes) {
|
|
66630
|
-
if (!exposes) return;
|
|
66631
|
-
const parsed = parseOptions(exposes, (value)=>({
|
|
66632
|
-
import: Array.isArray(value) ? value : [
|
|
66633
|
-
value
|
|
66634
|
-
],
|
|
66635
|
-
name: void 0
|
|
66636
|
-
}), (value)=>({
|
|
66637
|
-
import: Array.isArray(value.import) ? value.import : [
|
|
66638
|
-
value.import
|
|
66639
|
-
],
|
|
66640
|
-
name: value.name ?? void 0
|
|
66641
|
-
}));
|
|
66642
|
-
const result = parsed.map(([exposeKey, info])=>{
|
|
66643
|
-
const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
|
|
66644
|
-
return {
|
|
66645
|
-
path: exposeKey,
|
|
66646
|
-
name: exposeName
|
|
66647
|
-
};
|
|
66648
|
-
});
|
|
66649
|
-
return result.length > 0 ? result : void 0;
|
|
66650
|
-
}
|
|
66651
|
-
function collectManifestShared(shared) {
|
|
66652
|
-
if (!shared) return;
|
|
66653
|
-
const parsed = parseOptions(shared, (item, key)=>{
|
|
66654
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66655
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
66656
|
-
import: key,
|
|
66657
|
-
requiredVersion: item
|
|
66658
|
-
} : {
|
|
66659
|
-
import: item
|
|
66660
|
-
};
|
|
66661
|
-
}, (item)=>item);
|
|
66662
|
-
const result = parsed.map(([key, config])=>{
|
|
66663
|
-
const name = config.shareKey || key;
|
|
66664
|
-
const version = 'string' == typeof config.version ? config.version : void 0;
|
|
66665
|
-
const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66666
|
-
return {
|
|
66667
|
-
name,
|
|
66668
|
-
version,
|
|
66669
|
-
requiredVersion,
|
|
66670
|
-
singleton: config.singleton
|
|
66671
|
-
};
|
|
66672
|
-
});
|
|
66673
|
-
return result.length > 0 ? result : void 0;
|
|
66674
|
-
}
|
|
66675
|
-
function normalizeManifestOptions(mfConfig) {
|
|
66676
|
-
const manifestOptions = true === mfConfig.manifest ? {} : {
|
|
66677
|
-
...mfConfig.manifest
|
|
66678
|
-
};
|
|
66679
|
-
const containerName = mfConfig.name;
|
|
66680
|
-
const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
|
|
66681
|
-
const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
|
|
66682
|
-
if (cur[1].length > 1) return sum;
|
|
66683
|
-
const remoteInfo = cur[1][0];
|
|
66684
|
-
const { entry, alias, name } = remoteInfo;
|
|
66685
|
-
if (entry && name) sum[alias] = {
|
|
66686
|
-
name,
|
|
66687
|
-
entry
|
|
66688
|
-
};
|
|
66689
|
-
return sum;
|
|
66690
|
-
}, {});
|
|
66691
|
-
const manifestExposes = collectManifestExposes(mfConfig.exposes);
|
|
66692
|
-
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66693
|
-
const manifestShared = collectManifestShared(mfConfig.shared);
|
|
66694
|
-
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66695
|
-
return {
|
|
66696
|
-
...manifestOptions,
|
|
66697
|
-
remoteAliasMap,
|
|
66698
|
-
globalName,
|
|
66699
|
-
name: containerName
|
|
66700
|
-
};
|
|
66701
|
-
}
|
|
66702
66404
|
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66703
66405
|
raw(compiler) {
|
|
66704
|
-
const
|
|
66705
|
-
const {
|
|
66706
|
-
const { statsFileName, manifestFileName } = getFileName(opts);
|
|
66406
|
+
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
|
|
66407
|
+
const { statsFileName, manifestFileName } = getFileName(this.opts);
|
|
66707
66408
|
const rawOptions = {
|
|
66708
|
-
name: opts.name,
|
|
66709
|
-
globalName: opts.globalName,
|
|
66409
|
+
name: this.opts.name,
|
|
66410
|
+
globalName: this.opts.globalName,
|
|
66710
66411
|
fileName,
|
|
66711
66412
|
filePath,
|
|
66712
66413
|
manifestFileName,
|
|
@@ -66715,489 +66416,40 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
|
66715
66416
|
remoteAliasMap,
|
|
66716
66417
|
exposes,
|
|
66717
66418
|
shared,
|
|
66718
|
-
buildInfo: getBuildInfo('development' === compiler.options.mode, compiler
|
|
66419
|
+
buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
|
|
66719
66420
|
};
|
|
66720
66421
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
66721
66422
|
}
|
|
66722
66423
|
constructor(opts){
|
|
66723
|
-
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "
|
|
66724
|
-
this.
|
|
66424
|
+
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
66425
|
+
this.opts = opts;
|
|
66725
66426
|
}
|
|
66726
66427
|
}
|
|
66727
|
-
|
|
66728
|
-
|
|
66729
|
-
|
|
66730
|
-
|
|
66731
|
-
|
|
66732
|
-
|
|
66733
|
-
}
|
|
66734
|
-
|
|
66735
|
-
|
|
66736
|
-
}
|
|
66737
|
-
|
|
66738
|
-
|
|
66739
|
-
|
|
66740
|
-
|
|
66741
|
-
}
|
|
66742
|
-
getFilename() {
|
|
66743
|
-
return SHARE_ENTRY_ASSET;
|
|
66744
|
-
}
|
|
66745
|
-
apply(compiler) {
|
|
66746
|
-
super.apply(compiler);
|
|
66747
|
-
compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
|
|
66748
|
-
compilation.hooks.processAssets.tap({
|
|
66749
|
-
name: 'CollectSharedEntry',
|
|
66750
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
66751
|
-
}, ()=>{
|
|
66752
|
-
compilation.getAssets().forEach((asset)=>{
|
|
66753
|
-
if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
|
|
66754
|
-
compilation.deleteAsset(asset.name);
|
|
66755
|
-
});
|
|
66756
|
-
});
|
|
66757
|
-
});
|
|
66758
|
-
}
|
|
66759
|
-
raw() {
|
|
66760
|
-
const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
|
|
66761
|
-
const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
|
|
66762
|
-
const rawOptions = {
|
|
66763
|
-
consumes: normalizedConsumeShareOptions.map(([key, v])=>({
|
|
66764
|
-
key,
|
|
66765
|
-
...v
|
|
66766
|
-
})),
|
|
66767
|
-
filename: this.getFilename()
|
|
66768
|
-
};
|
|
66769
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66770
|
-
}
|
|
66771
|
-
constructor(options){
|
|
66772
|
-
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);
|
|
66773
|
-
const { sharedOptions } = options;
|
|
66774
|
-
this.sharedOptions = sharedOptions;
|
|
66775
|
-
this._collectedEntries = {};
|
|
66776
|
-
}
|
|
66777
|
-
}
|
|
66778
|
-
function SharedContainerPlugin_define_property(obj, key, value) {
|
|
66779
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66780
|
-
value: value,
|
|
66781
|
-
enumerable: true,
|
|
66782
|
-
configurable: true,
|
|
66783
|
-
writable: true
|
|
66784
|
-
});
|
|
66785
|
-
else obj[key] = value;
|
|
66786
|
-
return obj;
|
|
66787
|
-
}
|
|
66788
|
-
function assert(condition, msg) {
|
|
66789
|
-
if (!condition) throw new Error(msg);
|
|
66790
|
-
}
|
|
66791
|
-
const HOT_UPDATE_SUFFIX = '.hot-update';
|
|
66792
|
-
class SharedContainerPlugin extends RspackBuiltinPlugin {
|
|
66793
|
-
getData() {
|
|
66794
|
-
return [
|
|
66795
|
-
this._options.fileName,
|
|
66796
|
-
this._globalName,
|
|
66797
|
-
this._options.version
|
|
66798
|
-
];
|
|
66799
|
-
}
|
|
66800
|
-
raw(compiler) {
|
|
66801
|
-
const { library } = this._options;
|
|
66802
|
-
if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
66803
|
-
return createBuiltinPlugin(this.name, this._options);
|
|
66804
|
-
}
|
|
66805
|
-
apply(compiler) {
|
|
66806
|
-
super.apply(compiler);
|
|
66807
|
-
const shareName = this._shareName;
|
|
66808
|
-
compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
|
|
66809
|
-
compilation.hooks.processAssets.tap({
|
|
66810
|
-
name: 'getShareContainerFile'
|
|
66811
|
-
}, ()=>{
|
|
66812
|
-
const remoteEntryPoint = compilation.entrypoints.get(shareName);
|
|
66813
|
-
assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
|
|
66814
|
-
const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
|
|
66815
|
-
assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
|
|
66816
|
-
const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
|
|
66817
|
-
assert(files.length > 0, `no files found for shared ${shareName} chunk`);
|
|
66818
|
-
assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
|
|
66819
|
-
this.filename = files[0];
|
|
66820
|
-
});
|
|
66821
|
-
});
|
|
66822
|
-
}
|
|
66823
|
-
constructor(options){
|
|
66824
|
-
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);
|
|
66825
|
-
const { shareName, library, request, independentShareFileName, mfName } = options;
|
|
66826
|
-
const version = options.version || '0.0.0';
|
|
66827
|
-
this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
|
|
66828
|
-
const fileName = independentShareFileName || `${version}/share-entry.js`;
|
|
66829
|
-
this._shareName = shareName;
|
|
66830
|
-
this._options = {
|
|
66831
|
-
name: shareName,
|
|
66832
|
-
request: request,
|
|
66833
|
-
library: (library ? {
|
|
66834
|
-
...library,
|
|
66835
|
-
name: this._globalName
|
|
66836
|
-
} : void 0) || {
|
|
66837
|
-
type: 'global',
|
|
66838
|
-
name: this._globalName
|
|
66839
|
-
},
|
|
66840
|
-
version,
|
|
66841
|
-
fileName
|
|
66842
|
-
};
|
|
66843
|
-
}
|
|
66844
|
-
}
|
|
66845
|
-
function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
|
|
66846
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66847
|
-
value: value,
|
|
66848
|
-
enumerable: true,
|
|
66849
|
-
configurable: true,
|
|
66850
|
-
writable: true
|
|
66851
|
-
});
|
|
66852
|
-
else obj[key] = value;
|
|
66853
|
-
return obj;
|
|
66854
|
-
}
|
|
66855
|
-
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
66856
|
-
buildOptions() {
|
|
66857
|
-
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66858
|
-
shareKey,
|
|
66859
|
-
treeShaking: !!config.treeShaking,
|
|
66860
|
-
usedExports: config.treeShaking?.usedExports
|
|
66861
|
-
}));
|
|
66862
|
-
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66863
|
-
return {
|
|
66864
|
-
shared,
|
|
66865
|
-
injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
|
|
66866
|
-
manifestFileName,
|
|
66867
|
-
statsFileName
|
|
66868
|
-
};
|
|
66869
|
-
}
|
|
66870
|
-
raw() {
|
|
66871
|
-
if (!this.sharedOptions.length) return;
|
|
66872
|
-
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66873
|
-
}
|
|
66874
|
-
constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
|
|
66875
|
-
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);
|
|
66876
|
-
this.sharedOptions = sharedOptions;
|
|
66877
|
-
this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
|
|
66878
|
-
this.manifestOptions = manifestOptions ?? {};
|
|
66879
|
-
}
|
|
66880
|
-
}
|
|
66881
|
-
function IndependentSharedPlugin_define_property(obj, key, value) {
|
|
66882
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66883
|
-
value: value,
|
|
66884
|
-
enumerable: true,
|
|
66885
|
-
configurable: true,
|
|
66886
|
-
writable: true
|
|
66887
|
-
});
|
|
66888
|
-
else obj[key] = value;
|
|
66889
|
-
return obj;
|
|
66890
|
-
}
|
|
66891
|
-
const VIRTUAL_ENTRY = './virtual-entry.js';
|
|
66892
|
-
const VIRTUAL_ENTRY_NAME = 'virtual-entry';
|
|
66893
|
-
const filterPlugin = (plugin, excludedPlugins = [])=>{
|
|
66894
|
-
if (!plugin) return true;
|
|
66895
|
-
const pluginName = plugin.name || plugin.constructor?.name;
|
|
66896
|
-
if (!pluginName) return true;
|
|
66897
|
-
return ![
|
|
66898
|
-
'TreeShakingSharedPlugin',
|
|
66899
|
-
'IndependentSharedPlugin',
|
|
66900
|
-
'ModuleFederationPlugin',
|
|
66901
|
-
'SharedUsedExportsOptimizerPlugin',
|
|
66902
|
-
'HtmlWebpackPlugin',
|
|
66903
|
-
'HtmlRspackPlugin',
|
|
66904
|
-
'RsbuildHtmlPlugin',
|
|
66905
|
-
...excludedPlugins
|
|
66906
|
-
].includes(pluginName);
|
|
66428
|
+
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
66429
|
+
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
66430
|
+
const array = (items)=>{
|
|
66431
|
+
for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
|
|
66432
|
+
else if (item && 'object' == typeof item) object(item);
|
|
66433
|
+
else throw new Error('Unexpected options format');
|
|
66434
|
+
};
|
|
66435
|
+
const object = (obj)=>{
|
|
66436
|
+
for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
|
|
66437
|
+
};
|
|
66438
|
+
if (!options) return;
|
|
66439
|
+
if (Array.isArray(options)) array(options);
|
|
66440
|
+
else if ('object' == typeof options) object(options);
|
|
66441
|
+
else throw new Error('Unexpected options format');
|
|
66907
66442
|
};
|
|
66908
|
-
|
|
66909
|
-
|
|
66910
|
-
|
|
66911
|
-
|
|
66912
|
-
|
|
66913
|
-
|
|
66914
|
-
|
|
66915
|
-
}, '');
|
|
66916
|
-
return entryContent;
|
|
66917
|
-
}
|
|
66918
|
-
static entry() {
|
|
66919
|
-
return {
|
|
66920
|
-
[VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
|
|
66921
|
-
};
|
|
66922
|
-
}
|
|
66923
|
-
apply(compiler) {
|
|
66924
|
-
new compiler.rspack.experiments.VirtualModulesPlugin({
|
|
66925
|
-
[VIRTUAL_ENTRY]: this.createEntry()
|
|
66926
|
-
}).apply(compiler);
|
|
66927
|
-
compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
|
|
66928
|
-
compilation.hooks.processAssets.tap({
|
|
66929
|
-
name: 'RemoveVirtualEntryAsset',
|
|
66930
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
66931
|
-
}, ()=>{
|
|
66932
|
-
try {
|
|
66933
|
-
const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
66934
|
-
chunk?.files.forEach((f)=>{
|
|
66935
|
-
compilation.deleteAsset(f);
|
|
66936
|
-
});
|
|
66937
|
-
} catch (_e) {
|
|
66938
|
-
console.error('Failed to remove virtual entry file!');
|
|
66939
|
-
}
|
|
66940
|
-
});
|
|
66941
|
-
});
|
|
66942
|
-
}
|
|
66943
|
-
constructor(sharedOptions, collectShared){
|
|
66944
|
-
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66945
|
-
IndependentSharedPlugin_define_property(this, "collectShared", false);
|
|
66946
|
-
this.sharedOptions = sharedOptions;
|
|
66947
|
-
this.collectShared = collectShared;
|
|
66948
|
-
}
|
|
66949
|
-
}
|
|
66950
|
-
const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
|
|
66951
|
-
class IndependentSharedPlugin {
|
|
66952
|
-
apply(compiler) {
|
|
66953
|
-
const { manifest } = this;
|
|
66954
|
-
let runCount = 0;
|
|
66955
|
-
compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
|
|
66956
|
-
if (runCount) return;
|
|
66957
|
-
await this.createIndependentCompilers(compiler);
|
|
66958
|
-
runCount++;
|
|
66959
|
-
});
|
|
66960
|
-
compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
|
|
66961
|
-
if (runCount) return;
|
|
66962
|
-
await this.createIndependentCompilers(compiler);
|
|
66963
|
-
runCount++;
|
|
66964
|
-
});
|
|
66965
|
-
compiler.hooks.shutdown.tapAsync('IndependentSharedPlugin', (callback)=>{
|
|
66966
|
-
callback();
|
|
66967
|
-
});
|
|
66968
|
-
if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
|
|
66969
|
-
compilation.hooks.processAssets.tap({
|
|
66970
|
-
name: 'injectBuildAssets',
|
|
66971
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
66972
|
-
}, ()=>{
|
|
66973
|
-
const { statsFileName, manifestFileName } = getFileName(manifest);
|
|
66974
|
-
const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
66975
|
-
const stats = compilation.getAsset(filename);
|
|
66976
|
-
if (!stats) return;
|
|
66977
|
-
const statsContent = JSON.parse(stats.source.source().toString());
|
|
66978
|
-
const { shared } = statsContent;
|
|
66979
|
-
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
66980
|
-
const targetShared = shared.find((s)=>s.name === key);
|
|
66981
|
-
if (!targetShared) return;
|
|
66982
|
-
item.forEach(([entry, version, globalName])=>{
|
|
66983
|
-
if (version === targetShared.version) {
|
|
66984
|
-
targetShared.fallback = entry;
|
|
66985
|
-
targetShared.fallbackName = globalName;
|
|
66986
|
-
}
|
|
66987
|
-
});
|
|
66988
|
-
});
|
|
66989
|
-
compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
66990
|
-
};
|
|
66991
|
-
injectBuildAssetsIntoStatsOrManifest(statsFileName);
|
|
66992
|
-
injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
66993
|
-
});
|
|
66994
|
-
});
|
|
66995
|
-
}
|
|
66996
|
-
async createIndependentCompilers(parentCompiler) {
|
|
66997
|
-
const { sharedOptions, buildAssets, outputDir } = this;
|
|
66998
|
-
console.log('Start building shared fallback resources ...');
|
|
66999
|
-
const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
|
|
67000
|
-
await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
|
|
67001
|
-
if (!shareConfig.treeShaking || false === shareConfig.import) return;
|
|
67002
|
-
const shareRequests = shareRequestsMap[shareName].requests;
|
|
67003
|
-
await Promise.all(shareRequests.map(async ([request, version])=>{
|
|
67004
|
-
const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
|
|
67005
|
-
const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
|
|
67006
|
-
shareRequestsMap,
|
|
67007
|
-
currentShare: {
|
|
67008
|
-
shareName,
|
|
67009
|
-
version,
|
|
67010
|
-
request,
|
|
67011
|
-
independentShareFileName: sharedConfig?.treeShaking?.filename
|
|
67012
|
-
}
|
|
67013
|
-
});
|
|
67014
|
-
if ('string' == typeof shareFileName) {
|
|
67015
|
-
buildAssets[shareName] ||= [];
|
|
67016
|
-
buildAssets[shareName].push([
|
|
67017
|
-
(0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
|
|
67018
|
-
sharedVersion,
|
|
67019
|
-
globalName
|
|
67020
|
-
]);
|
|
67021
|
-
}
|
|
67022
|
-
}));
|
|
67023
|
-
}));
|
|
67024
|
-
console.log('All shared fallback have been compiled successfully!');
|
|
67025
|
-
}
|
|
67026
|
-
async createIndependentCompiler(parentCompiler, extraOptions) {
|
|
67027
|
-
const { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this;
|
|
67028
|
-
const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
|
|
67029
|
-
const parentConfig = parentCompiler.options;
|
|
67030
|
-
const finalPlugins = [];
|
|
67031
|
-
const rspack = parentCompiler.rspack;
|
|
67032
|
-
let extraPlugin;
|
|
67033
|
-
extraPlugin = extraOptions ? new SharedContainerPlugin({
|
|
67034
|
-
mfName,
|
|
67035
|
-
library,
|
|
67036
|
-
...extraOptions.currentShare
|
|
67037
|
-
}) : new CollectSharedEntryPlugin({
|
|
67038
|
-
sharedOptions,
|
|
67039
|
-
shareScope: 'default'
|
|
67040
|
-
});
|
|
67041
|
-
(parentConfig.plugins || []).forEach((plugin)=>{
|
|
67042
|
-
if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeShakingSharedExcludePlugins)) finalPlugins.push(plugin);
|
|
67043
|
-
});
|
|
67044
|
-
plugins.forEach((plugin)=>{
|
|
67045
|
-
finalPlugins.push(plugin);
|
|
67046
|
-
});
|
|
67047
|
-
finalPlugins.push(extraPlugin);
|
|
67048
|
-
finalPlugins.push(new ConsumeSharedPlugin({
|
|
67049
|
-
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
67050
|
-
[key]: {
|
|
67051
|
-
import: extraOptions ? false : options.import,
|
|
67052
|
-
shareKey: options.shareKey || key,
|
|
67053
|
-
shareScope: options.shareScope,
|
|
67054
|
-
requiredVersion: options.requiredVersion,
|
|
67055
|
-
strictVersion: options.strictVersion,
|
|
67056
|
-
singleton: options.singleton,
|
|
67057
|
-
packageName: options.packageName,
|
|
67058
|
-
eager: options.eager
|
|
67059
|
-
}
|
|
67060
|
-
})),
|
|
67061
|
-
enhanced: true
|
|
67062
|
-
}));
|
|
67063
|
-
if (treeShaking) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports));
|
|
67064
|
-
finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
|
|
67065
|
-
const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
|
|
67066
|
-
const compilerConfig = {
|
|
67067
|
-
...parentConfig,
|
|
67068
|
-
module: {
|
|
67069
|
-
...parentConfig.module,
|
|
67070
|
-
rules: [
|
|
67071
|
-
{
|
|
67072
|
-
test: /virtual-entry\.js$/,
|
|
67073
|
-
type: "javascript/auto",
|
|
67074
|
-
resolve: {
|
|
67075
|
-
fullySpecified: false
|
|
67076
|
-
},
|
|
67077
|
-
use: {
|
|
67078
|
-
loader: 'builtin:swc-loader'
|
|
67079
|
-
}
|
|
67080
|
-
},
|
|
67081
|
-
...parentConfig.module?.rules || []
|
|
67082
|
-
]
|
|
67083
|
-
},
|
|
67084
|
-
mode: parentConfig.mode || 'development',
|
|
67085
|
-
entry: VirtualEntryPlugin.entry,
|
|
67086
|
-
output: {
|
|
67087
|
-
path: fullOutputDir,
|
|
67088
|
-
clean: true,
|
|
67089
|
-
publicPath: parentConfig.output?.publicPath || 'auto'
|
|
67090
|
-
},
|
|
67091
|
-
plugins: finalPlugins,
|
|
67092
|
-
optimization: {
|
|
67093
|
-
...parentConfig.optimization,
|
|
67094
|
-
splitChunks: false
|
|
67095
|
-
}
|
|
67096
|
-
};
|
|
67097
|
-
const compiler = rspack.rspack(compilerConfig);
|
|
67098
|
-
compiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
67099
|
-
compiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
67100
|
-
compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
|
|
67101
|
-
const { currentShare } = extraOptions || {};
|
|
67102
|
-
return new Promise((resolve, reject)=>{
|
|
67103
|
-
compiler.run((err, stats)=>{
|
|
67104
|
-
if (err || stats?.hasErrors()) {
|
|
67105
|
-
const target = currentShare ? currentShare.shareName : 'Collect deps';
|
|
67106
|
-
console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
|
|
67107
|
-
reject(err || new Error(`${target} Compile failed`));
|
|
67108
|
-
return;
|
|
67109
|
-
}
|
|
67110
|
-
currentShare && console.log(`${currentShare.shareName} Compile success`);
|
|
67111
|
-
resolve(extraPlugin.getData());
|
|
67112
|
-
});
|
|
67113
|
-
});
|
|
67114
|
-
}
|
|
67115
|
-
constructor(options){
|
|
67116
|
-
IndependentSharedPlugin_define_property(this, "mfName", void 0);
|
|
67117
|
-
IndependentSharedPlugin_define_property(this, "shared", void 0);
|
|
67118
|
-
IndependentSharedPlugin_define_property(this, "library", void 0);
|
|
67119
|
-
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
67120
|
-
IndependentSharedPlugin_define_property(this, "outputDir", void 0);
|
|
67121
|
-
IndependentSharedPlugin_define_property(this, "plugins", void 0);
|
|
67122
|
-
IndependentSharedPlugin_define_property(this, "treeShaking", void 0);
|
|
67123
|
-
IndependentSharedPlugin_define_property(this, "manifest", void 0);
|
|
67124
|
-
IndependentSharedPlugin_define_property(this, "buildAssets", {});
|
|
67125
|
-
IndependentSharedPlugin_define_property(this, "injectTreeShakingUsedExports", void 0);
|
|
67126
|
-
IndependentSharedPlugin_define_property(this, "treeShakingSharedExcludePlugins", void 0);
|
|
67127
|
-
IndependentSharedPlugin_define_property(this, "name", 'IndependentSharedPlugin');
|
|
67128
|
-
const { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
|
|
67129
|
-
this.shared = shared;
|
|
67130
|
-
this.mfName = name;
|
|
67131
|
-
this.outputDir = outputDir || 'independent-packages';
|
|
67132
|
-
this.plugins = plugins || [];
|
|
67133
|
-
this.treeShaking = treeShaking;
|
|
67134
|
-
this.manifest = manifest;
|
|
67135
|
-
this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
|
|
67136
|
-
this.library = library;
|
|
67137
|
-
this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [];
|
|
67138
|
-
this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
67139
|
-
if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
|
|
67140
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
67141
|
-
import: key,
|
|
67142
|
-
requiredVersion: item
|
|
67143
|
-
} : {
|
|
67144
|
-
import: item
|
|
67145
|
-
};
|
|
67146
|
-
return config;
|
|
67147
|
-
}, (item)=>item);
|
|
67148
|
-
}
|
|
67149
|
-
}
|
|
67150
|
-
function TreeShakingSharedPlugin_define_property(obj, key, value) {
|
|
67151
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
67152
|
-
value: value,
|
|
67153
|
-
enumerable: true,
|
|
67154
|
-
configurable: true,
|
|
67155
|
-
writable: true
|
|
66443
|
+
const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
66444
|
+
const items = [];
|
|
66445
|
+
options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
|
|
66446
|
+
items.push([
|
|
66447
|
+
key,
|
|
66448
|
+
value
|
|
66449
|
+
]);
|
|
67156
66450
|
});
|
|
67157
|
-
|
|
67158
|
-
|
|
67159
|
-
}
|
|
67160
|
-
class TreeShakingSharedPlugin {
|
|
67161
|
-
apply(compiler) {
|
|
67162
|
-
const { mfConfig, outputDir, secondary } = this;
|
|
67163
|
-
const { name, shared, library, treeShakingSharedPlugins } = mfConfig;
|
|
67164
|
-
if (!shared) return;
|
|
67165
|
-
const sharedOptions = normalizeSharedOptions(shared);
|
|
67166
|
-
if (!sharedOptions.length) return;
|
|
67167
|
-
if (sharedOptions.some(([_, config])=>config.treeShaking && false !== config.import)) {
|
|
67168
|
-
if (!secondary) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler);
|
|
67169
|
-
this._independentSharePlugin = new IndependentSharedPlugin({
|
|
67170
|
-
name: name,
|
|
67171
|
-
shared: shared,
|
|
67172
|
-
outputDir,
|
|
67173
|
-
plugins: treeShakingSharedPlugins?.map((p)=>{
|
|
67174
|
-
const _constructor = require(p);
|
|
67175
|
-
return new _constructor();
|
|
67176
|
-
}) || [],
|
|
67177
|
-
treeShaking: secondary,
|
|
67178
|
-
library,
|
|
67179
|
-
manifest: mfConfig.manifest,
|
|
67180
|
-
treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
|
|
67181
|
-
});
|
|
67182
|
-
this._independentSharePlugin.apply(compiler);
|
|
67183
|
-
}
|
|
67184
|
-
}
|
|
67185
|
-
get buildAssets() {
|
|
67186
|
-
return this._independentSharePlugin?.buildAssets || {};
|
|
67187
|
-
}
|
|
67188
|
-
constructor(options){
|
|
67189
|
-
TreeShakingSharedPlugin_define_property(this, "mfConfig", void 0);
|
|
67190
|
-
TreeShakingSharedPlugin_define_property(this, "outputDir", void 0);
|
|
67191
|
-
TreeShakingSharedPlugin_define_property(this, "secondary", void 0);
|
|
67192
|
-
TreeShakingSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
|
|
67193
|
-
TreeShakingSharedPlugin_define_property(this, "name", 'TreeShakingSharedPlugin');
|
|
67194
|
-
const { mfConfig, secondary } = options;
|
|
67195
|
-
this.mfConfig = mfConfig;
|
|
67196
|
-
this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages';
|
|
67197
|
-
this.secondary = Boolean(secondary);
|
|
67198
|
-
}
|
|
67199
|
-
}
|
|
67200
|
-
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
66451
|
+
return items;
|
|
66452
|
+
};
|
|
67201
66453
|
function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
67202
66454
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
67203
66455
|
value: value,
|
|
@@ -67217,50 +66469,101 @@ class ModuleFederationPlugin {
|
|
|
67217
66469
|
'@module-federation/runtime': paths.runtime,
|
|
67218
66470
|
...compiler.options.resolve.alias
|
|
67219
66471
|
};
|
|
67220
|
-
const
|
|
67221
|
-
|
|
67222
|
-
|
|
67223
|
-
|
|
67224
|
-
mfConfig: this._options,
|
|
67225
|
-
secondary: false
|
|
67226
|
-
});
|
|
67227
|
-
this._treeShakingSharedPlugin.apply(compiler);
|
|
67228
|
-
}
|
|
67229
|
-
let runtimePluginApplied = false;
|
|
67230
|
-
compiler.hooks.beforeRun.tap({
|
|
67231
|
-
name: 'ModuleFederationPlugin',
|
|
67232
|
-
stage: 100
|
|
67233
|
-
}, ()=>{
|
|
67234
|
-
if (runtimePluginApplied) return;
|
|
67235
|
-
runtimePluginApplied = true;
|
|
67236
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets);
|
|
67237
|
-
new ModuleFederationRuntimePlugin({
|
|
67238
|
-
entryRuntime
|
|
67239
|
-
}).apply(compiler);
|
|
67240
|
-
});
|
|
67241
|
-
compiler.hooks.watchRun.tap({
|
|
67242
|
-
name: 'ModuleFederationPlugin',
|
|
67243
|
-
stage: 100
|
|
67244
|
-
}, ()=>{
|
|
67245
|
-
if (runtimePluginApplied) return;
|
|
67246
|
-
runtimePluginApplied = true;
|
|
67247
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {});
|
|
67248
|
-
new ModuleFederationRuntimePlugin({
|
|
67249
|
-
entryRuntime
|
|
67250
|
-
}).apply(compiler);
|
|
67251
|
-
});
|
|
66472
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
|
|
66473
|
+
new ModuleFederationRuntimePlugin({
|
|
66474
|
+
entryRuntime
|
|
66475
|
+
}).apply(compiler);
|
|
67252
66476
|
new webpack.container.ModuleFederationPluginV1({
|
|
67253
66477
|
...this._options,
|
|
67254
66478
|
enhanced: true
|
|
67255
66479
|
}).apply(compiler);
|
|
67256
|
-
if (this._options.manifest)
|
|
66480
|
+
if (this._options.manifest) {
|
|
66481
|
+
const manifestOptions = true === this._options.manifest ? {} : {
|
|
66482
|
+
...this._options.manifest
|
|
66483
|
+
};
|
|
66484
|
+
const containerName = manifestOptions.name ?? this._options.name;
|
|
66485
|
+
const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
|
|
66486
|
+
const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
66487
|
+
if (cur[1].length > 1) return sum;
|
|
66488
|
+
const remoteInfo = cur[1][0];
|
|
66489
|
+
const { entry, alias, name } = remoteInfo;
|
|
66490
|
+
if (entry && name) sum[alias] = {
|
|
66491
|
+
name,
|
|
66492
|
+
entry
|
|
66493
|
+
};
|
|
66494
|
+
return sum;
|
|
66495
|
+
}, {});
|
|
66496
|
+
const manifestExposes = collectManifestExposes(this._options.exposes);
|
|
66497
|
+
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66498
|
+
const manifestShared = collectManifestShared(this._options.shared);
|
|
66499
|
+
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66500
|
+
new ModuleFederationManifestPlugin({
|
|
66501
|
+
...manifestOptions,
|
|
66502
|
+
name: containerName,
|
|
66503
|
+
globalName,
|
|
66504
|
+
remoteAliasMap
|
|
66505
|
+
}).apply(compiler);
|
|
66506
|
+
}
|
|
67257
66507
|
}
|
|
67258
66508
|
constructor(_options){
|
|
67259
66509
|
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
67260
|
-
ModuleFederationPlugin_define_property(this, "_treeShakingSharedPlugin", void 0);
|
|
67261
66510
|
this._options = _options;
|
|
67262
66511
|
}
|
|
67263
66512
|
}
|
|
66513
|
+
function collectManifestExposes(exposes) {
|
|
66514
|
+
if (!exposes) return;
|
|
66515
|
+
const parsed = parseOptions(exposes, (value)=>({
|
|
66516
|
+
import: Array.isArray(value) ? value : [
|
|
66517
|
+
value
|
|
66518
|
+
],
|
|
66519
|
+
name: void 0
|
|
66520
|
+
}), (value)=>({
|
|
66521
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
66522
|
+
value.import
|
|
66523
|
+
],
|
|
66524
|
+
name: value.name ?? void 0
|
|
66525
|
+
}));
|
|
66526
|
+
const result = parsed.map(([exposeKey, info])=>{
|
|
66527
|
+
const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
|
|
66528
|
+
return {
|
|
66529
|
+
path: exposeKey,
|
|
66530
|
+
name: exposeName
|
|
66531
|
+
};
|
|
66532
|
+
});
|
|
66533
|
+
return result.length > 0 ? result : void 0;
|
|
66534
|
+
}
|
|
66535
|
+
function collectManifestShared(shared) {
|
|
66536
|
+
if (!shared) return;
|
|
66537
|
+
const parsed = parseOptions(shared, (item, key)=>{
|
|
66538
|
+
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66539
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
66540
|
+
import: key,
|
|
66541
|
+
requiredVersion: item
|
|
66542
|
+
} : {
|
|
66543
|
+
import: item
|
|
66544
|
+
};
|
|
66545
|
+
}, (item)=>item);
|
|
66546
|
+
const result = parsed.map(([key, config])=>{
|
|
66547
|
+
const name = config.shareKey || key;
|
|
66548
|
+
const version = 'string' == typeof config.version ? config.version : void 0;
|
|
66549
|
+
const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66550
|
+
return {
|
|
66551
|
+
name,
|
|
66552
|
+
version,
|
|
66553
|
+
requiredVersion,
|
|
66554
|
+
singleton: config.singleton
|
|
66555
|
+
};
|
|
66556
|
+
});
|
|
66557
|
+
return result.length > 0 ? result : void 0;
|
|
66558
|
+
}
|
|
66559
|
+
function resolveLibraryGlobalName(library) {
|
|
66560
|
+
if (!library) return;
|
|
66561
|
+
const libName = library.name;
|
|
66562
|
+
if (!libName) return;
|
|
66563
|
+
if ('string' == typeof libName) return libName;
|
|
66564
|
+
if (Array.isArray(libName)) return libName[0];
|
|
66565
|
+
if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66566
|
+
}
|
|
67264
66567
|
function getRemoteInfos(options) {
|
|
67265
66568
|
if (!options.remotes) return {};
|
|
67266
66569
|
function extractUrlAndGlobal(urlAndGlobal) {
|
|
@@ -67327,18 +66630,6 @@ function getRemoteInfos(options) {
|
|
|
67327
66630
|
function getRuntimePlugins(options) {
|
|
67328
66631
|
return options.runtimePlugins ?? [];
|
|
67329
66632
|
}
|
|
67330
|
-
function getSharedOptions(options) {
|
|
67331
|
-
if (!options.shared) return [];
|
|
67332
|
-
return parseOptions(options.shared, (item, key)=>{
|
|
67333
|
-
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
67334
|
-
return item !== key && isRequiredVersion(item) ? {
|
|
67335
|
-
import: key,
|
|
67336
|
-
requiredVersion: item
|
|
67337
|
-
} : {
|
|
67338
|
-
import: item
|
|
67339
|
-
};
|
|
67340
|
-
}, (item)=>item);
|
|
67341
|
-
}
|
|
67342
66633
|
function getPaths(options) {
|
|
67343
66634
|
return {
|
|
67344
66635
|
runtimeTools: '@module-federation/runtime-tools',
|
|
@@ -67346,12 +66637,11 @@ function getPaths(options) {
|
|
|
67346
66637
|
runtime: '@module-federation/runtime'
|
|
67347
66638
|
};
|
|
67348
66639
|
}
|
|
67349
|
-
function getDefaultEntryRuntime(paths, options, compiler
|
|
66640
|
+
function getDefaultEntryRuntime(paths, options, compiler) {
|
|
67350
66641
|
const runtimePlugins = getRuntimePlugins(options);
|
|
67351
66642
|
const remoteInfos = getRemoteInfos(options);
|
|
67352
66643
|
const runtimePluginImports = [];
|
|
67353
66644
|
const runtimePluginVars = [];
|
|
67354
|
-
const libraryType = options.library?.type || 'var';
|
|
67355
66645
|
for(let i = 0; i < runtimePlugins.length; i++){
|
|
67356
66646
|
const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
|
|
67357
66647
|
const pluginSpec = runtimePlugins[i];
|
|
@@ -67368,12 +66658,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
|
|
|
67368
66658
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
67369
66659
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
67370
66660
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
|
|
67371
|
-
|
|
67372
|
-
`const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
|
|
67373
|
-
'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})}}'
|
|
66661
|
+
'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})}}'
|
|
67374
66662
|
].join(';');
|
|
67375
66663
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
67376
66664
|
}
|
|
66665
|
+
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66666
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66667
|
+
value: value,
|
|
66668
|
+
enumerable: true,
|
|
66669
|
+
configurable: true,
|
|
66670
|
+
writable: true
|
|
66671
|
+
});
|
|
66672
|
+
else obj[key] = value;
|
|
66673
|
+
return obj;
|
|
66674
|
+
}
|
|
66675
|
+
const compilerSet = new WeakSet();
|
|
66676
|
+
function isSingleton(compiler) {
|
|
66677
|
+
return compilerSet.has(compiler);
|
|
66678
|
+
}
|
|
66679
|
+
function setSingleton(compiler) {
|
|
66680
|
+
compilerSet.add(compiler);
|
|
66681
|
+
}
|
|
66682
|
+
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66683
|
+
raw(compiler) {
|
|
66684
|
+
if (isSingleton(compiler)) return;
|
|
66685
|
+
setSingleton(compiler);
|
|
66686
|
+
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66687
|
+
}
|
|
66688
|
+
constructor(enhanced = false){
|
|
66689
|
+
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;
|
|
66690
|
+
}
|
|
66691
|
+
}
|
|
66692
|
+
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66693
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66694
|
+
value: value,
|
|
66695
|
+
enumerable: true,
|
|
66696
|
+
configurable: true,
|
|
66697
|
+
writable: true
|
|
66698
|
+
});
|
|
66699
|
+
else obj[key] = value;
|
|
66700
|
+
return obj;
|
|
66701
|
+
}
|
|
66702
|
+
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66703
|
+
raw(compiler) {
|
|
66704
|
+
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66705
|
+
const rawOptions = {
|
|
66706
|
+
consumes: this._options.consumes.map(([key, v])=>({
|
|
66707
|
+
key,
|
|
66708
|
+
...v
|
|
66709
|
+
})),
|
|
66710
|
+
enhanced: this._options.enhanced
|
|
66711
|
+
};
|
|
66712
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66713
|
+
}
|
|
66714
|
+
constructor(options){
|
|
66715
|
+
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66716
|
+
this._options = {
|
|
66717
|
+
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
66718
|
+
if (Array.isArray(item)) throw new Error('Unexpected array in options');
|
|
66719
|
+
const result = item !== key && isRequiredVersion(item) ? {
|
|
66720
|
+
import: key,
|
|
66721
|
+
shareScope: options.shareScope || 'default',
|
|
66722
|
+
shareKey: key,
|
|
66723
|
+
requiredVersion: item,
|
|
66724
|
+
strictVersion: true,
|
|
66725
|
+
packageName: void 0,
|
|
66726
|
+
singleton: false,
|
|
66727
|
+
eager: false
|
|
66728
|
+
} : {
|
|
66729
|
+
import: key,
|
|
66730
|
+
shareScope: options.shareScope || 'default',
|
|
66731
|
+
shareKey: key,
|
|
66732
|
+
requiredVersion: void 0,
|
|
66733
|
+
packageName: void 0,
|
|
66734
|
+
strictVersion: false,
|
|
66735
|
+
singleton: false,
|
|
66736
|
+
eager: false
|
|
66737
|
+
};
|
|
66738
|
+
return result;
|
|
66739
|
+
}, (item, key)=>({
|
|
66740
|
+
import: false === item.import ? void 0 : item.import || key,
|
|
66741
|
+
shareScope: item.shareScope || options.shareScope || 'default',
|
|
66742
|
+
shareKey: item.shareKey || key,
|
|
66743
|
+
requiredVersion: item.requiredVersion,
|
|
66744
|
+
strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66745
|
+
packageName: item.packageName,
|
|
66746
|
+
singleton: !!item.singleton,
|
|
66747
|
+
eager: !!item.eager
|
|
66748
|
+
})),
|
|
66749
|
+
enhanced: options.enhanced ?? false
|
|
66750
|
+
};
|
|
66751
|
+
}
|
|
66752
|
+
}
|
|
66753
|
+
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66754
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66755
|
+
value: value,
|
|
66756
|
+
enumerable: true,
|
|
66757
|
+
configurable: true,
|
|
66758
|
+
writable: true
|
|
66759
|
+
});
|
|
66760
|
+
else obj[key] = value;
|
|
66761
|
+
return obj;
|
|
66762
|
+
}
|
|
66763
|
+
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66764
|
+
raw(compiler) {
|
|
66765
|
+
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66766
|
+
const rawOptions = this._provides.map(([key, v])=>({
|
|
66767
|
+
key,
|
|
66768
|
+
...v
|
|
66769
|
+
}));
|
|
66770
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66771
|
+
}
|
|
66772
|
+
constructor(options){
|
|
66773
|
+
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);
|
|
66774
|
+
this._provides = parseOptions(options.provides, (item)=>{
|
|
66775
|
+
if (Array.isArray(item)) throw new Error('Unexpected array of provides');
|
|
66776
|
+
return {
|
|
66777
|
+
shareKey: item,
|
|
66778
|
+
version: void 0,
|
|
66779
|
+
shareScope: options.shareScope || 'default',
|
|
66780
|
+
eager: false
|
|
66781
|
+
};
|
|
66782
|
+
}, (item)=>{
|
|
66783
|
+
const raw = {
|
|
66784
|
+
shareKey: item.shareKey,
|
|
66785
|
+
version: item.version,
|
|
66786
|
+
shareScope: item.shareScope || options.shareScope || 'default',
|
|
66787
|
+
eager: !!item.eager
|
|
66788
|
+
};
|
|
66789
|
+
if (options.enhanced) {
|
|
66790
|
+
const enhancedItem = item;
|
|
66791
|
+
return {
|
|
66792
|
+
...raw,
|
|
66793
|
+
singleton: enhancedItem.singleton,
|
|
66794
|
+
requiredVersion: enhancedItem.requiredVersion,
|
|
66795
|
+
strictVersion: enhancedItem.strictVersion
|
|
66796
|
+
};
|
|
66797
|
+
}
|
|
66798
|
+
return raw;
|
|
66799
|
+
});
|
|
66800
|
+
this._enhanced = options.enhanced;
|
|
66801
|
+
}
|
|
66802
|
+
}
|
|
66803
|
+
function SharePlugin_define_property(obj, key, value) {
|
|
66804
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66805
|
+
value: value,
|
|
66806
|
+
enumerable: true,
|
|
66807
|
+
configurable: true,
|
|
66808
|
+
writable: true
|
|
66809
|
+
});
|
|
66810
|
+
else obj[key] = value;
|
|
66811
|
+
return obj;
|
|
66812
|
+
}
|
|
66813
|
+
class SharePlugin {
|
|
66814
|
+
apply(compiler) {
|
|
66815
|
+
new ConsumeSharedPlugin({
|
|
66816
|
+
shareScope: this._shareScope,
|
|
66817
|
+
consumes: this._consumes,
|
|
66818
|
+
enhanced: this._enhanced
|
|
66819
|
+
}).apply(compiler);
|
|
66820
|
+
new ProvideSharedPlugin({
|
|
66821
|
+
shareScope: this._shareScope,
|
|
66822
|
+
provides: this._provides,
|
|
66823
|
+
enhanced: this._enhanced
|
|
66824
|
+
}).apply(compiler);
|
|
66825
|
+
}
|
|
66826
|
+
constructor(options){
|
|
66827
|
+
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66828
|
+
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66829
|
+
SharePlugin_define_property(this, "_provides", void 0);
|
|
66830
|
+
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66831
|
+
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
66832
|
+
if ('string' != typeof item) throw new Error('Unexpected array in shared');
|
|
66833
|
+
const config = item !== key && isRequiredVersion(item) ? {
|
|
66834
|
+
import: key,
|
|
66835
|
+
requiredVersion: item
|
|
66836
|
+
} : {
|
|
66837
|
+
import: item
|
|
66838
|
+
};
|
|
66839
|
+
return config;
|
|
66840
|
+
}, (item)=>item);
|
|
66841
|
+
const consumes = sharedOptions.map(([key, options])=>({
|
|
66842
|
+
[key]: {
|
|
66843
|
+
import: options.import,
|
|
66844
|
+
shareKey: options.shareKey || key,
|
|
66845
|
+
shareScope: options.shareScope,
|
|
66846
|
+
requiredVersion: options.requiredVersion,
|
|
66847
|
+
strictVersion: options.strictVersion,
|
|
66848
|
+
singleton: options.singleton,
|
|
66849
|
+
packageName: options.packageName,
|
|
66850
|
+
eager: options.eager
|
|
66851
|
+
}
|
|
66852
|
+
}));
|
|
66853
|
+
const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66854
|
+
[options.import || key]: {
|
|
66855
|
+
shareKey: options.shareKey || key,
|
|
66856
|
+
shareScope: options.shareScope,
|
|
66857
|
+
version: options.version,
|
|
66858
|
+
eager: options.eager,
|
|
66859
|
+
singleton: options.singleton,
|
|
66860
|
+
requiredVersion: options.requiredVersion,
|
|
66861
|
+
strictVersion: options.strictVersion
|
|
66862
|
+
}
|
|
66863
|
+
}));
|
|
66864
|
+
this._shareScope = options.shareScope;
|
|
66865
|
+
this._consumes = consumes;
|
|
66866
|
+
this._provides = provides;
|
|
66867
|
+
this._enhanced = options.enhanced ?? false;
|
|
66868
|
+
}
|
|
66869
|
+
}
|
|
67377
66870
|
function ContainerPlugin_define_property(obj, key, value) {
|
|
67378
66871
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
67379
66872
|
value: value,
|
|
@@ -67409,7 +66902,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
67409
66902
|
name: options.name,
|
|
67410
66903
|
shareScope: options.shareScope || 'default',
|
|
67411
66904
|
library: options.library || {
|
|
67412
|
-
type: '
|
|
66905
|
+
type: 'var',
|
|
67413
66906
|
name: options.name
|
|
67414
66907
|
},
|
|
67415
66908
|
runtime: options.runtime,
|
|
@@ -67546,7 +67039,7 @@ function transformSync(source, options) {
|
|
|
67546
67039
|
const _options = JSON.stringify(options || {});
|
|
67547
67040
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
67548
67041
|
}
|
|
67549
|
-
const exports_rspackVersion = "1.7.3-canary-
|
|
67042
|
+
const exports_rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
|
|
67550
67043
|
const exports_version = "5.75.0";
|
|
67551
67044
|
const exports_WebpackError = Error;
|
|
67552
67045
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -67597,7 +67090,6 @@ const container = {
|
|
|
67597
67090
|
};
|
|
67598
67091
|
const sharing = {
|
|
67599
67092
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
67600
|
-
TreeShakingSharedPlugin: TreeShakingSharedPlugin,
|
|
67601
67093
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
67602
67094
|
SharePlugin: SharePlugin
|
|
67603
67095
|
};
|
|
@@ -67637,7 +67129,7 @@ const exports_experiments = {
|
|
|
67637
67129
|
createNativePlugin: createNativePlugin,
|
|
67638
67130
|
VirtualModulesPlugin: VirtualModulesPlugin
|
|
67639
67131
|
};
|
|
67640
|
-
const src_fn = Object.assign(
|
|
67132
|
+
const src_fn = Object.assign(rspack, exports_namespaceObject);
|
|
67641
67133
|
src_fn.rspack = src_fn;
|
|
67642
67134
|
src_fn.webpack = src_fn;
|
|
67643
67135
|
const src_rspack_0 = src_fn;
|