@rspack-canary/browser 1.6.5-canary-1b7f543c-20251121112112 → 1.6.5-canary-a407d226-20251124112255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container/ModuleFederationPlugin.d.ts +1 -1
- package/dist/exports.d.ts +3 -11
- package/dist/index.mjs +151 -144
- package/dist/napi-binding.d.ts +9 -9
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/sharing/{CollectShareEntryPlugin.d.ts → CollectSharedEntryPlugin.d.ts} +3 -3
- package/dist/sharing/{IndependentSharePlugin.d.ts → IndependentSharedPlugin.d.ts} +1 -1
- package/dist/sharing/{OptimizeDependencyReferencedExportsPlugin.d.ts → SharedUsedExportsOptimizerPlugin.d.ts} +1 -1
- package/dist/sharing/{TreeShakeSharePlugin.d.ts → TreeShakeSharedPlugin.d.ts} +5 -3
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
|
|
|
14
14
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
15
15
|
export declare class ModuleFederationPlugin {
|
|
16
16
|
private _options;
|
|
17
|
-
private
|
|
17
|
+
private _treeShakeSharedPlugin?;
|
|
18
18
|
constructor(_options: ModuleFederationPluginOptions);
|
|
19
19
|
apply(compiler: Compiler): void;
|
|
20
20
|
}
|
package/dist/exports.d.ts
CHANGED
|
@@ -116,25 +116,17 @@ export declare const container: {
|
|
|
116
116
|
ModuleFederationPlugin: typeof ModuleFederationPlugin;
|
|
117
117
|
ModuleFederationPluginV1: typeof ModuleFederationPluginV1;
|
|
118
118
|
};
|
|
119
|
-
import { CollectShareEntryPlugin } from "./sharing/CollectShareEntryPlugin";
|
|
120
119
|
import { ConsumeSharedPlugin } from "./sharing/ConsumeSharedPlugin";
|
|
121
|
-
import { OptimizeDependencyReferencedExportsPlugin } from "./sharing/OptimizeDependencyReferencedExportsPlugin";
|
|
122
120
|
import { ProvideSharedPlugin } from "./sharing/ProvideSharedPlugin";
|
|
123
|
-
import { ShareContainerPlugin } from "./sharing/ShareContainerPlugin";
|
|
124
121
|
import { SharePlugin } from "./sharing/SharePlugin";
|
|
125
|
-
import {
|
|
126
|
-
export type { CollectShareEntryPluginOptions } from "./sharing/CollectShareEntryPlugin";
|
|
122
|
+
import { TreeShakeSharedPlugin } from "./sharing/TreeShakeSharedPlugin";
|
|
127
123
|
export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject } from "./sharing/ConsumeSharedPlugin";
|
|
128
124
|
export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject } from "./sharing/ProvideSharedPlugin";
|
|
129
|
-
export type { ShareContainerPluginOptions } from "./sharing/ShareContainerPlugin";
|
|
130
125
|
export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions } from "./sharing/SharePlugin";
|
|
131
|
-
export type {
|
|
126
|
+
export type { TreeshakeSharedPluginOptions } from "./sharing/TreeShakeSharedPlugin";
|
|
132
127
|
export declare const sharing: {
|
|
133
128
|
ProvideSharedPlugin: typeof ProvideSharedPlugin;
|
|
134
|
-
|
|
135
|
-
TreeshakeSharePlugin: typeof TreeshakeSharePlugin;
|
|
136
|
-
ShareContainerPlugin: typeof ShareContainerPlugin;
|
|
137
|
-
OptimizeDependencyReferencedExportsPlugin: typeof OptimizeDependencyReferencedExportsPlugin;
|
|
129
|
+
TreeShakeSharedPlugin: typeof TreeShakeSharedPlugin;
|
|
138
130
|
ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
|
|
139
131
|
SharePlugin: typeof SharePlugin;
|
|
140
132
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -56803,6 +56803,10 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
|
56803
56803
|
if (tag.attributes && "integrity" in tag.attributes) return;
|
|
56804
56804
|
const tagSrc = getTagSrc(tag);
|
|
56805
56805
|
if (!tagSrc) return;
|
|
56806
|
+
try {
|
|
56807
|
+
const url = new URL(tagSrc);
|
|
56808
|
+
if (("http:" === url.protocol || "https:" === url.protocol) && (!publicPath || !tagSrc.startsWith(publicPath))) return;
|
|
56809
|
+
} catch (_) {}
|
|
56806
56810
|
const src = (0, path_browserify.relative)(publicPath, decodeURIComponent(tagSrc));
|
|
56807
56811
|
tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(this.options.hashFuncNames, (0, browser_fs.readFileSync)((0, path_browserify.join)(outputPath, src)));
|
|
56808
56812
|
tag.attributes.crossorigin = crossOriginLoading || "anonymous";
|
|
@@ -58137,7 +58141,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58137
58141
|
if ("object" == typeof rspackFuture) {
|
|
58138
58142
|
D(rspackFuture, "bundlerInfo", {});
|
|
58139
58143
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
58140
|
-
D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-
|
|
58144
|
+
D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-a407d226-20251124112255");
|
|
58141
58145
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
58142
58146
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
58143
58147
|
}
|
|
@@ -62086,7 +62090,7 @@ class MultiStats {
|
|
|
62086
62090
|
return obj;
|
|
62087
62091
|
});
|
|
62088
62092
|
if (childOptions.version) {
|
|
62089
|
-
obj.rspackVersion = "1.6.5-canary-
|
|
62093
|
+
obj.rspackVersion = "1.6.5-canary-a407d226-20251124112255";
|
|
62090
62094
|
obj.version = "5.75.0";
|
|
62091
62095
|
}
|
|
62092
62096
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -63391,7 +63395,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
63391
63395
|
},
|
|
63392
63396
|
version: (object)=>{
|
|
63393
63397
|
object.version = "5.75.0";
|
|
63394
|
-
object.rspackVersion = "1.6.5-canary-
|
|
63398
|
+
object.rspackVersion = "1.6.5-canary-a407d226-20251124112255";
|
|
63395
63399
|
},
|
|
63396
63400
|
env: (object, _compilation, _context, { _env })=>{
|
|
63397
63401
|
object.env = _env;
|
|
@@ -66114,42 +66118,6 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
|
66114
66118
|
};
|
|
66115
66119
|
}
|
|
66116
66120
|
}
|
|
66117
|
-
function OptimizeDependencyReferencedExportsPlugin_define_property(obj, key, value) {
|
|
66118
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66119
|
-
value: value,
|
|
66120
|
-
enumerable: true,
|
|
66121
|
-
configurable: true,
|
|
66122
|
-
writable: true
|
|
66123
|
-
});
|
|
66124
|
-
else obj[key] = value;
|
|
66125
|
-
return obj;
|
|
66126
|
-
}
|
|
66127
|
-
class OptimizeDependencyReferencedExportsPlugin extends RspackBuiltinPlugin {
|
|
66128
|
-
buildOptions() {
|
|
66129
|
-
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66130
|
-
shareKey,
|
|
66131
|
-
treeshake: !!config.treeshake,
|
|
66132
|
-
usedExports: config.usedExports
|
|
66133
|
-
}));
|
|
66134
|
-
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66135
|
-
return {
|
|
66136
|
-
shared,
|
|
66137
|
-
injectUsedExports: this.injectUsedExports,
|
|
66138
|
-
manifestFileName,
|
|
66139
|
-
statsFileName
|
|
66140
|
-
};
|
|
66141
|
-
}
|
|
66142
|
-
raw() {
|
|
66143
|
-
if (!this.sharedOptions.length) return;
|
|
66144
|
-
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66145
|
-
}
|
|
66146
|
-
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
66147
|
-
super(), OptimizeDependencyReferencedExportsPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.OptimizeDependencyReferencedExportsPlugin), OptimizeDependencyReferencedExportsPlugin_define_property(this, "sharedOptions", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "injectUsedExports", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "manifestOptions", void 0);
|
|
66148
|
-
this.sharedOptions = sharedOptions;
|
|
66149
|
-
this.injectUsedExports = injectUsedExports ?? true;
|
|
66150
|
-
this.manifestOptions = manifestOptions ?? {};
|
|
66151
|
-
}
|
|
66152
|
-
}
|
|
66153
66121
|
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66154
66122
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66155
66123
|
value: value,
|
|
@@ -66264,8 +66232,6 @@ class SharePlugin {
|
|
|
66264
66232
|
provides: this._provides,
|
|
66265
66233
|
enhanced: this._enhanced
|
|
66266
66234
|
}).apply(compiler);
|
|
66267
|
-
const treeshakeOptions = this._sharedOptions.filter(([, config])=>config.treeshake);
|
|
66268
|
-
if (treeshakeOptions.length > 0) new OptimizeDependencyReferencedExportsPlugin(treeshakeOptions).apply(compiler);
|
|
66269
66235
|
}
|
|
66270
66236
|
constructor(options){
|
|
66271
66237
|
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
@@ -66283,7 +66249,7 @@ class SharePlugin {
|
|
|
66283
66249
|
this._sharedOptions = sharedOptions;
|
|
66284
66250
|
}
|
|
66285
66251
|
}
|
|
66286
|
-
function
|
|
66252
|
+
function CollectSharedEntryPlugin_define_property(obj, key, value) {
|
|
66287
66253
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66288
66254
|
value: value,
|
|
66289
66255
|
enumerable: true,
|
|
@@ -66293,8 +66259,8 @@ function CollectShareEntryPlugin_define_property(obj, key, value) {
|
|
|
66293
66259
|
else obj[key] = value;
|
|
66294
66260
|
return obj;
|
|
66295
66261
|
}
|
|
66296
|
-
const SHARE_ENTRY_ASSET = "collect-
|
|
66297
|
-
class
|
|
66262
|
+
const SHARE_ENTRY_ASSET = "collect-shared-entries.json";
|
|
66263
|
+
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
66298
66264
|
getData() {
|
|
66299
66265
|
return this._collectedEntries;
|
|
66300
66266
|
}
|
|
@@ -66303,10 +66269,10 @@ class CollectShareEntryPlugin extends RspackBuiltinPlugin {
|
|
|
66303
66269
|
}
|
|
66304
66270
|
apply(compiler) {
|
|
66305
66271
|
super.apply(compiler);
|
|
66306
|
-
compiler.hooks.thisCompilation.tap("Collect
|
|
66272
|
+
compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
|
|
66307
66273
|
compilation.hooks.processAssets.tapPromise({
|
|
66308
|
-
name: "
|
|
66309
|
-
stage: compiler.webpack.Compilation.
|
|
66274
|
+
name: "CollectSharedEntry",
|
|
66275
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
66310
66276
|
}, async ()=>{
|
|
66311
66277
|
const filename = this.getFilename();
|
|
66312
66278
|
const asset = compilation.getAsset(filename);
|
|
@@ -66329,7 +66295,7 @@ class CollectShareEntryPlugin extends RspackBuiltinPlugin {
|
|
|
66329
66295
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
66330
66296
|
}
|
|
66331
66297
|
constructor(options){
|
|
66332
|
-
super(),
|
|
66298
|
+
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);
|
|
66333
66299
|
const { sharedOptions } = options;
|
|
66334
66300
|
this.sharedOptions = sharedOptions;
|
|
66335
66301
|
this._collectedEntries = {};
|
|
@@ -66401,7 +66367,43 @@ class ShareContainerPlugin extends RspackBuiltinPlugin {
|
|
|
66401
66367
|
};
|
|
66402
66368
|
}
|
|
66403
66369
|
}
|
|
66404
|
-
function
|
|
66370
|
+
function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
|
|
66371
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66372
|
+
value: value,
|
|
66373
|
+
enumerable: true,
|
|
66374
|
+
configurable: true,
|
|
66375
|
+
writable: true
|
|
66376
|
+
});
|
|
66377
|
+
else obj[key] = value;
|
|
66378
|
+
return obj;
|
|
66379
|
+
}
|
|
66380
|
+
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
66381
|
+
buildOptions() {
|
|
66382
|
+
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66383
|
+
shareKey,
|
|
66384
|
+
treeshake: !!config.treeshake,
|
|
66385
|
+
usedExports: config.usedExports
|
|
66386
|
+
}));
|
|
66387
|
+
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66388
|
+
return {
|
|
66389
|
+
shared,
|
|
66390
|
+
injectUsedExports: this.injectUsedExports,
|
|
66391
|
+
manifestFileName,
|
|
66392
|
+
statsFileName
|
|
66393
|
+
};
|
|
66394
|
+
}
|
|
66395
|
+
raw() {
|
|
66396
|
+
if (!this.sharedOptions.length) return;
|
|
66397
|
+
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66398
|
+
}
|
|
66399
|
+
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
66400
|
+
super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
|
|
66401
|
+
this.sharedOptions = sharedOptions;
|
|
66402
|
+
this.injectUsedExports = injectUsedExports ?? true;
|
|
66403
|
+
this.manifestOptions = manifestOptions ?? {};
|
|
66404
|
+
}
|
|
66405
|
+
}
|
|
66406
|
+
function IndependentSharedPlugin_define_property(obj, key, value) {
|
|
66405
66407
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66406
66408
|
value: value,
|
|
66407
66409
|
enumerable: true,
|
|
@@ -66415,13 +66417,13 @@ const VIRTUAL_ENTRY = "./virtual-entry.js";
|
|
|
66415
66417
|
const VIRTUAL_ENTRY_NAME = "virtual-entry";
|
|
66416
66418
|
const filterPlugin = (plugin)=>{
|
|
66417
66419
|
if (!plugin) return true;
|
|
66418
|
-
const pluginName = plugin
|
|
66420
|
+
const pluginName = plugin.name || plugin.constructor?.name;
|
|
66419
66421
|
if (!pluginName) return true;
|
|
66420
66422
|
return ![
|
|
66421
|
-
"
|
|
66422
|
-
"
|
|
66423
|
+
"TreeShakeSharedPlugin",
|
|
66424
|
+
"IndependentSharedPlugin",
|
|
66423
66425
|
"ModuleFederationPlugin",
|
|
66424
|
-
"
|
|
66426
|
+
"SharedUsedExportsOptimizerPlugin",
|
|
66425
66427
|
"HtmlWebpackPlugin"
|
|
66426
66428
|
].includes(pluginName);
|
|
66427
66429
|
};
|
|
@@ -66457,43 +66459,45 @@ class VirtualEntryPlugin {
|
|
|
66457
66459
|
});
|
|
66458
66460
|
}
|
|
66459
66461
|
constructor(sharedOptions){
|
|
66460
|
-
|
|
66462
|
+
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66461
66463
|
this.sharedOptions = sharedOptions;
|
|
66462
66464
|
}
|
|
66463
66465
|
}
|
|
66464
|
-
class
|
|
66466
|
+
class IndependentSharedPlugin {
|
|
66465
66467
|
apply(compiler) {
|
|
66466
|
-
compiler.hooks.beforeRun.
|
|
66468
|
+
compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async (compiler)=>{
|
|
66467
66469
|
await this.createIndependentCompilers(compiler);
|
|
66468
|
-
callback();
|
|
66469
66470
|
});
|
|
66470
|
-
compiler.hooks.shutdown.tapAsync("
|
|
66471
|
+
compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
|
|
66471
66472
|
this.cleanup();
|
|
66472
|
-
console.log("cleanup");
|
|
66473
66473
|
callback();
|
|
66474
66474
|
});
|
|
66475
|
-
compiler.hooks.compilation.tap("
|
|
66475
|
+
compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
|
|
66476
66476
|
compilation.hooks.processAssets.tapPromise({
|
|
66477
66477
|
name: "injectBuildAssets",
|
|
66478
66478
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
66479
66479
|
}, async ()=>{
|
|
66480
66480
|
if (!this.manifest) return;
|
|
66481
|
-
const { statsFileName } = getFileName(this.manifest);
|
|
66482
|
-
const
|
|
66483
|
-
|
|
66484
|
-
|
|
66485
|
-
|
|
66486
|
-
|
|
66487
|
-
|
|
66488
|
-
|
|
66489
|
-
|
|
66490
|
-
|
|
66491
|
-
targetShared.
|
|
66492
|
-
|
|
66493
|
-
|
|
66481
|
+
const { statsFileName, manifestFileName } = getFileName(this.manifest);
|
|
66482
|
+
const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
66483
|
+
const stats = compilation.getAsset(filename);
|
|
66484
|
+
if (!stats) return;
|
|
66485
|
+
const statsContent = JSON.parse(stats.source.source().toString());
|
|
66486
|
+
const { shared } = statsContent;
|
|
66487
|
+
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
66488
|
+
const targetShared = shared.find((s)=>s.name === key);
|
|
66489
|
+
if (!targetShared) return;
|
|
66490
|
+
item.forEach(([entry, version, globalName])=>{
|
|
66491
|
+
if (version === targetShared.version) {
|
|
66492
|
+
targetShared.fallback = entry;
|
|
66493
|
+
targetShared.fallbackName = globalName;
|
|
66494
|
+
}
|
|
66495
|
+
});
|
|
66494
66496
|
});
|
|
66495
|
-
|
|
66496
|
-
|
|
66497
|
+
compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
66498
|
+
};
|
|
66499
|
+
injectBuildAssetsIntoStatsOrManifest(statsFileName);
|
|
66500
|
+
injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
66497
66501
|
});
|
|
66498
66502
|
});
|
|
66499
66503
|
}
|
|
@@ -66539,7 +66543,7 @@ class IndependentSharePlugin {
|
|
|
66539
66543
|
mfName,
|
|
66540
66544
|
library,
|
|
66541
66545
|
...extraOptions.currentShare
|
|
66542
|
-
}) : new
|
|
66546
|
+
}) : new CollectSharedEntryPlugin({
|
|
66543
66547
|
sharedOptions,
|
|
66544
66548
|
shareScope: "default"
|
|
66545
66549
|
});
|
|
@@ -66553,7 +66557,7 @@ class IndependentSharePlugin {
|
|
|
66553
66557
|
finalPlugins.push(new ConsumeSharedPlugin({
|
|
66554
66558
|
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
66555
66559
|
[key]: {
|
|
66556
|
-
import: extraOptions ? options.import
|
|
66560
|
+
import: extraOptions ? false : options.import,
|
|
66557
66561
|
shareKey: options.shareKey || key,
|
|
66558
66562
|
shareScope: options.shareScope,
|
|
66559
66563
|
requiredVersion: options.requiredVersion,
|
|
@@ -66565,7 +66569,7 @@ class IndependentSharePlugin {
|
|
|
66565
66569
|
})),
|
|
66566
66570
|
enhanced: true
|
|
66567
66571
|
}));
|
|
66568
|
-
if (treeshake) finalPlugins.push(new
|
|
66572
|
+
if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
|
|
66569
66573
|
finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
|
|
66570
66574
|
const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
|
|
66571
66575
|
const compilerConfig = {
|
|
@@ -66619,19 +66623,19 @@ class IndependentSharePlugin {
|
|
|
66619
66623
|
this.compilers.clear();
|
|
66620
66624
|
}
|
|
66621
66625
|
constructor(options){
|
|
66622
|
-
|
|
66623
|
-
|
|
66624
|
-
|
|
66625
|
-
|
|
66626
|
-
|
|
66627
|
-
|
|
66628
|
-
|
|
66629
|
-
|
|
66630
|
-
|
|
66631
|
-
|
|
66632
|
-
|
|
66633
|
-
|
|
66634
|
-
|
|
66626
|
+
IndependentSharedPlugin_define_property(this, "mfName", void 0);
|
|
66627
|
+
IndependentSharedPlugin_define_property(this, "shared", void 0);
|
|
66628
|
+
IndependentSharedPlugin_define_property(this, "library", void 0);
|
|
66629
|
+
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66630
|
+
IndependentSharedPlugin_define_property(this, "outputDir", void 0);
|
|
66631
|
+
IndependentSharedPlugin_define_property(this, "outputFilePath", void 0);
|
|
66632
|
+
IndependentSharedPlugin_define_property(this, "plugins", void 0);
|
|
66633
|
+
IndependentSharedPlugin_define_property(this, "compilers", new Map());
|
|
66634
|
+
IndependentSharedPlugin_define_property(this, "treeshake", void 0);
|
|
66635
|
+
IndependentSharedPlugin_define_property(this, "manifest", void 0);
|
|
66636
|
+
IndependentSharedPlugin_define_property(this, "buildAssets", {});
|
|
66637
|
+
IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
|
|
66638
|
+
IndependentSharedPlugin_define_property(this, "name", "IndependentSharedPlugin");
|
|
66635
66639
|
const { outputDir, outputFilePath, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
|
|
66636
66640
|
this.shared = shared;
|
|
66637
66641
|
this.mfName = name;
|
|
@@ -66654,6 +66658,54 @@ class IndependentSharePlugin {
|
|
|
66654
66658
|
}, (item)=>item);
|
|
66655
66659
|
}
|
|
66656
66660
|
}
|
|
66661
|
+
function TreeShakeSharedPlugin_define_property(obj, key, value) {
|
|
66662
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66663
|
+
value: value,
|
|
66664
|
+
enumerable: true,
|
|
66665
|
+
configurable: true,
|
|
66666
|
+
writable: true
|
|
66667
|
+
});
|
|
66668
|
+
else obj[key] = value;
|
|
66669
|
+
return obj;
|
|
66670
|
+
}
|
|
66671
|
+
class TreeShakeSharedPlugin {
|
|
66672
|
+
apply(compiler) {
|
|
66673
|
+
const { mfConfig, outputDir, plugins, reshake } = this;
|
|
66674
|
+
const { name, shared, library } = mfConfig;
|
|
66675
|
+
if (!shared) return;
|
|
66676
|
+
const sharedOptions = normalizeSharedOptions(shared);
|
|
66677
|
+
if (!sharedOptions.length) return;
|
|
66678
|
+
if (!reshake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
|
|
66679
|
+
if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
|
|
66680
|
+
this._independentSharePlugin = new IndependentSharedPlugin({
|
|
66681
|
+
name: name,
|
|
66682
|
+
shared: shared,
|
|
66683
|
+
outputDir,
|
|
66684
|
+
plugins,
|
|
66685
|
+
treeshake: reshake,
|
|
66686
|
+
library,
|
|
66687
|
+
manifest: mfConfig.manifest
|
|
66688
|
+
});
|
|
66689
|
+
this._independentSharePlugin.apply(compiler);
|
|
66690
|
+
}
|
|
66691
|
+
}
|
|
66692
|
+
get buildAssets() {
|
|
66693
|
+
return this._independentSharePlugin?.buildAssets || {};
|
|
66694
|
+
}
|
|
66695
|
+
constructor(options){
|
|
66696
|
+
TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
|
|
66697
|
+
TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
|
|
66698
|
+
TreeShakeSharedPlugin_define_property(this, "plugins", void 0);
|
|
66699
|
+
TreeShakeSharedPlugin_define_property(this, "reshake", void 0);
|
|
66700
|
+
TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
|
|
66701
|
+
TreeShakeSharedPlugin_define_property(this, "name", "TreeShakeSharedPlugin");
|
|
66702
|
+
const { mfConfig, plugins, reshake } = options;
|
|
66703
|
+
this.mfConfig = mfConfig;
|
|
66704
|
+
this.outputDir = mfConfig.independentShareDir || "independent-packages";
|
|
66705
|
+
this.plugins = plugins;
|
|
66706
|
+
this.reshake = Boolean(reshake);
|
|
66707
|
+
}
|
|
66708
|
+
}
|
|
66657
66709
|
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
66658
66710
|
function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
66659
66711
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -66667,7 +66719,6 @@ function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
|
66667
66719
|
}
|
|
66668
66720
|
class ModuleFederationPlugin {
|
|
66669
66721
|
apply(compiler) {
|
|
66670
|
-
const { name, shared } = this._options;
|
|
66671
66722
|
const { webpack } = compiler;
|
|
66672
66723
|
const paths = getPaths(this._options);
|
|
66673
66724
|
compiler.options.resolve.alias = {
|
|
@@ -66678,12 +66729,11 @@ class ModuleFederationPlugin {
|
|
|
66678
66729
|
const sharedOptions = getSharedOptions(this._options);
|
|
66679
66730
|
const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
|
|
66680
66731
|
if (treeshakeEntries.length > 0) {
|
|
66681
|
-
this.
|
|
66682
|
-
|
|
66683
|
-
|
|
66684
|
-
outputFilePath: this._options.independentShareFilePath
|
|
66732
|
+
this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
|
|
66733
|
+
mfConfig: this._options,
|
|
66734
|
+
reshake: false
|
|
66685
66735
|
});
|
|
66686
|
-
this.
|
|
66736
|
+
this._treeShakeSharedPlugin.apply(compiler);
|
|
66687
66737
|
}
|
|
66688
66738
|
let runtimePluginApplied = false;
|
|
66689
66739
|
compiler.hooks.beforeRun.tapPromise({
|
|
@@ -66692,7 +66742,7 @@ class ModuleFederationPlugin {
|
|
|
66692
66742
|
}, async ()=>{
|
|
66693
66743
|
if (runtimePluginApplied) return;
|
|
66694
66744
|
runtimePluginApplied = true;
|
|
66695
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this.
|
|
66745
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
|
|
66696
66746
|
new ModuleFederationRuntimePlugin({
|
|
66697
66747
|
entryRuntime
|
|
66698
66748
|
}).apply(compiler);
|
|
@@ -66705,7 +66755,7 @@ class ModuleFederationPlugin {
|
|
|
66705
66755
|
}
|
|
66706
66756
|
constructor(_options){
|
|
66707
66757
|
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
66708
|
-
ModuleFederationPlugin_define_property(this, "
|
|
66758
|
+
ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
|
|
66709
66759
|
this._options = _options;
|
|
66710
66760
|
}
|
|
66711
66761
|
}
|
|
@@ -66976,46 +67026,6 @@ class ModuleFederationPluginV1 {
|
|
|
66976
67026
|
this._options = _options;
|
|
66977
67027
|
}
|
|
66978
67028
|
}
|
|
66979
|
-
function TreeShakeSharePlugin_define_property(obj, key, value) {
|
|
66980
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66981
|
-
value: value,
|
|
66982
|
-
enumerable: true,
|
|
66983
|
-
configurable: true,
|
|
66984
|
-
writable: true
|
|
66985
|
-
});
|
|
66986
|
-
else obj[key] = value;
|
|
66987
|
-
return obj;
|
|
66988
|
-
}
|
|
66989
|
-
class TreeshakeSharePlugin {
|
|
66990
|
-
apply(compiler) {
|
|
66991
|
-
const { mfConfig, outputDir, plugins, reshake } = this;
|
|
66992
|
-
const { name, shared, library } = mfConfig;
|
|
66993
|
-
if (!shared) return;
|
|
66994
|
-
const sharedOptions = normalizeSharedOptions(shared);
|
|
66995
|
-
if (!sharedOptions.length) return;
|
|
66996
|
-
if (!reshake) new OptimizeDependencyReferencedExportsPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
|
|
66997
|
-
if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) new IndependentSharePlugin({
|
|
66998
|
-
name: name,
|
|
66999
|
-
shared: shared,
|
|
67000
|
-
outputDir,
|
|
67001
|
-
plugins,
|
|
67002
|
-
treeshake: reshake,
|
|
67003
|
-
library
|
|
67004
|
-
}).apply(compiler);
|
|
67005
|
-
}
|
|
67006
|
-
constructor(options){
|
|
67007
|
-
TreeShakeSharePlugin_define_property(this, "mfConfig", void 0);
|
|
67008
|
-
TreeShakeSharePlugin_define_property(this, "outputDir", void 0);
|
|
67009
|
-
TreeShakeSharePlugin_define_property(this, "plugins", void 0);
|
|
67010
|
-
TreeShakeSharePlugin_define_property(this, "reshake", void 0);
|
|
67011
|
-
TreeShakeSharePlugin_define_property(this, "name", "TreeshakeSharePlugin");
|
|
67012
|
-
const { mfConfig, plugins, reshake } = options;
|
|
67013
|
-
this.mfConfig = mfConfig;
|
|
67014
|
-
this.outputDir = mfConfig.independentShareDir || "independent-packages";
|
|
67015
|
-
this.plugins = plugins;
|
|
67016
|
-
this.reshake = Boolean(reshake);
|
|
67017
|
-
}
|
|
67018
|
-
}
|
|
67019
67029
|
async function minify(source, options) {
|
|
67020
67030
|
const _options = JSON.stringify(options || {});
|
|
67021
67031
|
return external_rspack_wasi_browser_js_["default"].minify(source, _options);
|
|
@@ -67032,7 +67042,7 @@ function transformSync(source, options) {
|
|
|
67032
67042
|
const _options = JSON.stringify(options || {});
|
|
67033
67043
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
67034
67044
|
}
|
|
67035
|
-
const exports_rspackVersion = "1.6.5-canary-
|
|
67045
|
+
const exports_rspackVersion = "1.6.5-canary-a407d226-20251124112255";
|
|
67036
67046
|
const exports_version = "5.75.0";
|
|
67037
67047
|
const exports_WebpackError = Error;
|
|
67038
67048
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -67083,10 +67093,7 @@ const container = {
|
|
|
67083
67093
|
};
|
|
67084
67094
|
const sharing = {
|
|
67085
67095
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
67086
|
-
|
|
67087
|
-
TreeshakeSharePlugin: TreeshakeSharePlugin,
|
|
67088
|
-
ShareContainerPlugin: ShareContainerPlugin,
|
|
67089
|
-
OptimizeDependencyReferencedExportsPlugin: OptimizeDependencyReferencedExportsPlugin,
|
|
67096
|
+
TreeShakeSharedPlugin: TreeShakeSharedPlugin,
|
|
67090
67097
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
67091
67098
|
SharePlugin: SharePlugin
|
|
67092
67099
|
};
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -540,12 +540,12 @@ export declare enum BuiltinPluginName {
|
|
|
540
540
|
SplitChunksPlugin = 'SplitChunksPlugin',
|
|
541
541
|
RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
|
|
542
542
|
ShareRuntimePlugin = 'ShareRuntimePlugin',
|
|
543
|
-
|
|
543
|
+
SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
|
|
544
544
|
ContainerPlugin = 'ContainerPlugin',
|
|
545
545
|
ContainerReferencePlugin = 'ContainerReferencePlugin',
|
|
546
546
|
ProvideSharedPlugin = 'ProvideSharedPlugin',
|
|
547
547
|
ConsumeSharedPlugin = 'ConsumeSharedPlugin',
|
|
548
|
-
|
|
548
|
+
CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
|
|
549
549
|
ShareContainerPlugin = 'ShareContainerPlugin',
|
|
550
550
|
ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
|
|
551
551
|
ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
|
|
@@ -2592,13 +2592,6 @@ export interface RawOptimizationOptions {
|
|
|
2592
2592
|
avoidEntryIife: boolean
|
|
2593
2593
|
}
|
|
2594
2594
|
|
|
2595
|
-
export interface RawOptimizeDependencyReferencedExportsPluginOptions {
|
|
2596
|
-
shared: Array<RawOptimizeSharedConfig>
|
|
2597
|
-
injectUsedExports?: boolean
|
|
2598
|
-
manifestFileName?: string
|
|
2599
|
-
statsFileName?: string
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2602
2595
|
export interface RawOptimizeSharedConfig {
|
|
2603
2596
|
shareKey: string
|
|
2604
2597
|
treeshake: boolean
|
|
@@ -2849,6 +2842,13 @@ export interface RawShareContainerPluginOptions {
|
|
|
2849
2842
|
library: JsLibraryOptions
|
|
2850
2843
|
}
|
|
2851
2844
|
|
|
2845
|
+
export interface RawSharedUsedExportsOptimizerPluginOptions {
|
|
2846
|
+
shared: Array<RawOptimizeSharedConfig>
|
|
2847
|
+
injectUsedExports?: boolean
|
|
2848
|
+
manifestFileName?: string
|
|
2849
|
+
statsFileName?: string
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
2852
|
export interface RawSizeLimitsPluginOptions {
|
|
2853
2853
|
assetFilter?: (assetFilename: string) => boolean
|
|
2854
2854
|
hints?: "error" | "warning"
|
|
Binary file
|
|
@@ -2,7 +2,7 @@ import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
|
|
|
2
2
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
3
|
import type { Compiler } from "../Compiler";
|
|
4
4
|
import { type NormalizedSharedOptions } from "./SharePlugin";
|
|
5
|
-
export type
|
|
5
|
+
export type CollectSharedEntryPluginOptions = {
|
|
6
6
|
sharedOptions: NormalizedSharedOptions;
|
|
7
7
|
shareScope?: string;
|
|
8
8
|
};
|
|
@@ -10,11 +10,11 @@ export type ShareRequestsMap = Record<string, {
|
|
|
10
10
|
shareScope: string;
|
|
11
11
|
requests: [string, string][];
|
|
12
12
|
}>;
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
14
14
|
name: BuiltinPluginName;
|
|
15
15
|
sharedOptions: NormalizedSharedOptions;
|
|
16
16
|
private _collectedEntries;
|
|
17
|
-
constructor(options:
|
|
17
|
+
constructor(options: CollectSharedEntryPluginOptions);
|
|
18
18
|
getData(): ShareRequestsMap;
|
|
19
19
|
getFilename(): string;
|
|
20
20
|
apply(compiler: Compiler): void;
|
|
@@ -15,7 +15,7 @@ export interface IndependentSharePluginOptions {
|
|
|
15
15
|
injectUsedExports?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export type ShareFallback = Record<string, [string, string, string][]>;
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class IndependentSharedPlugin {
|
|
19
19
|
mfName: string;
|
|
20
20
|
shared: Shared;
|
|
21
21
|
library?: LibraryOptions;
|
|
@@ -3,7 +3,7 @@ import { BuiltinPluginName } from "../binding";
|
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
import { type ModuleFederationManifestPluginOptions } from "../container/ModuleFederationManifestPlugin";
|
|
5
5
|
import type { SharedConfig } from "./SharePlugin";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
7
7
|
name: BuiltinPluginName;
|
|
8
8
|
private sharedOptions;
|
|
9
9
|
private injectUsedExports;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
2
|
import type { Plugins } from "../config";
|
|
3
3
|
import type { ModuleFederationPluginOptions } from "../container/ModuleFederationPlugin";
|
|
4
|
-
export interface
|
|
4
|
+
export interface TreeshakeSharedPluginOptions {
|
|
5
5
|
mfConfig: ModuleFederationPluginOptions;
|
|
6
6
|
plugins?: Plugins;
|
|
7
7
|
reshake?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class TreeShakeSharedPlugin {
|
|
10
10
|
mfConfig: ModuleFederationPluginOptions;
|
|
11
11
|
outputDir: string;
|
|
12
12
|
plugins?: Plugins;
|
|
13
13
|
reshake?: boolean;
|
|
14
|
+
private _independentSharePlugin?;
|
|
14
15
|
name: string;
|
|
15
|
-
constructor(options:
|
|
16
|
+
constructor(options: TreeshakeSharedPluginOptions);
|
|
16
17
|
apply(compiler: Compiler): void;
|
|
18
|
+
get buildAssets(): import("./IndependentSharedPlugin").ShareFallback;
|
|
17
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/browser",
|
|
3
|
-
"version": "1.6.5-canary-
|
|
3
|
+
"version": "1.6.5-canary-a407d226-20251124112255",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
|