@rspack/browser 1.7.3 → 1.7.4
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.
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler';
|
|
2
2
|
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin';
|
|
3
3
|
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1';
|
|
4
|
+
import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin';
|
|
4
5
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, 'enhanced'> {
|
|
5
6
|
runtimePlugins?: RuntimePlugins;
|
|
6
7
|
implementation?: string;
|
|
7
8
|
shareStrategy?: 'version-first' | 'loaded-first';
|
|
8
9
|
manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, 'remoteAliasMap' | 'globalName' | 'name' | 'exposes' | 'shared'>;
|
|
10
|
+
experiments?: ModuleFederationRuntimeExperimentsOptions;
|
|
9
11
|
}
|
|
10
12
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
11
13
|
export declare class ModuleFederationPlugin {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export interface ModuleFederationRuntimeExperimentsOptions {
|
|
2
|
+
asyncStartup?: boolean;
|
|
3
|
+
}
|
|
1
4
|
export interface ModuleFederationRuntimeOptions {
|
|
2
5
|
entryRuntime?: string;
|
|
6
|
+
experiments?: ModuleFederationRuntimeExperimentsOptions;
|
|
3
7
|
}
|
|
4
8
|
export declare const ModuleFederationRuntimePlugin: {
|
|
5
9
|
new (options?: ModuleFederationRuntimeOptions | undefined): {
|
package/dist/index.mjs
CHANGED
|
@@ -51061,6 +51061,17 @@ class Stats {
|
|
|
51061
51061
|
compilation: this.compilation,
|
|
51062
51062
|
getStatsCompilation: (compilation)=>{
|
|
51063
51063
|
if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
|
|
51064
|
+
if (this.compilation !== this.compilation.compiler._lastCompilation) return {
|
|
51065
|
+
assets: [],
|
|
51066
|
+
assetsByChunkName: [],
|
|
51067
|
+
chunks: [],
|
|
51068
|
+
entrypoints: [],
|
|
51069
|
+
errors: [],
|
|
51070
|
+
hash: 'XXXX',
|
|
51071
|
+
modules: [],
|
|
51072
|
+
namedChunkGroups: [],
|
|
51073
|
+
warnings: []
|
|
51074
|
+
};
|
|
51064
51075
|
const innerStats = _class_private_method_get(this, _getInnerByCompilation, getInnerByCompilation).call(this, compilation);
|
|
51065
51076
|
options.warnings = false;
|
|
51066
51077
|
const innerStatsCompilation = innerStats.toJson(options);
|
|
@@ -51082,6 +51093,17 @@ class Stats {
|
|
|
51082
51093
|
compilation: this.compilation,
|
|
51083
51094
|
getStatsCompilation: (compilation)=>{
|
|
51084
51095
|
if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
|
|
51096
|
+
if (this.compilation !== this.compilation.compiler._lastCompilation) return {
|
|
51097
|
+
assets: [],
|
|
51098
|
+
assetsByChunkName: [],
|
|
51099
|
+
chunks: [],
|
|
51100
|
+
entrypoints: [],
|
|
51101
|
+
errors: [],
|
|
51102
|
+
hash: 'XXXX',
|
|
51103
|
+
modules: [],
|
|
51104
|
+
namedChunkGroups: [],
|
|
51105
|
+
warnings: []
|
|
51106
|
+
};
|
|
51085
51107
|
const innerStats = _class_private_method_get(this, _getInnerByCompilation, getInnerByCompilation).call(this, compilation);
|
|
51086
51108
|
const innerStatsCompilation = innerStats.toJson(options);
|
|
51087
51109
|
statsCompilationMap.set(compilation, innerStatsCompilation);
|
|
@@ -58128,7 +58150,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58128
58150
|
if ('object' == typeof rspackFuture) {
|
|
58129
58151
|
D(rspackFuture, 'bundlerInfo', {});
|
|
58130
58152
|
if ('object' == typeof rspackFuture.bundlerInfo) {
|
|
58131
|
-
D(rspackFuture.bundlerInfo, 'version', "1.7.
|
|
58153
|
+
D(rspackFuture.bundlerInfo, 'version', "1.7.4");
|
|
58132
58154
|
D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
|
|
58133
58155
|
D(rspackFuture.bundlerInfo, 'force', !library);
|
|
58134
58156
|
}
|
|
@@ -60398,7 +60420,7 @@ class MultiStats {
|
|
|
60398
60420
|
return obj;
|
|
60399
60421
|
});
|
|
60400
60422
|
if (childOptions.version) {
|
|
60401
|
-
obj.rspackVersion = "1.7.
|
|
60423
|
+
obj.rspackVersion = "1.7.4";
|
|
60402
60424
|
obj.version = "5.75.0";
|
|
60403
60425
|
}
|
|
60404
60426
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
|
|
@@ -62106,17 +62128,25 @@ const SIMPLE_EXTRACTORS = {
|
|
|
62106
62128
|
if (!context.makePathsRelative) context.makePathsRelative = makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root);
|
|
62107
62129
|
if (!context.cachedGetErrors) {
|
|
62108
62130
|
const map = new WeakMap();
|
|
62109
|
-
context.cachedGetErrors = (compilation)=>
|
|
62110
|
-
|
|
62111
|
-
|
|
62112
|
-
|
|
62131
|
+
context.cachedGetErrors = (compilation)=>{
|
|
62132
|
+
if (compilation.compiler._lastCompilation !== compilation) return [];
|
|
62133
|
+
const cache = map.get(compilation);
|
|
62134
|
+
if (cache) return cache;
|
|
62135
|
+
const errors = statsCompilation.errors;
|
|
62136
|
+
map.set(compilation, errors);
|
|
62137
|
+
return errors;
|
|
62138
|
+
};
|
|
62113
62139
|
}
|
|
62114
62140
|
if (!context.cachedGetWarnings) {
|
|
62115
62141
|
const map = new WeakMap();
|
|
62116
|
-
context.cachedGetWarnings = (compilation)=>
|
|
62117
|
-
|
|
62118
|
-
|
|
62119
|
-
|
|
62142
|
+
context.cachedGetWarnings = (compilation)=>{
|
|
62143
|
+
if (compilation.compiler._lastCompilation !== compilation) return [];
|
|
62144
|
+
const cache = map.get(compilation);
|
|
62145
|
+
if (cache) return cache;
|
|
62146
|
+
const warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors);
|
|
62147
|
+
map.set(compilation, warnings);
|
|
62148
|
+
return warnings;
|
|
62149
|
+
};
|
|
62120
62150
|
}
|
|
62121
62151
|
if (compilation.name) object.name = compilation.name;
|
|
62122
62152
|
const logging = options.logging;
|
|
@@ -62230,7 +62260,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
62230
62260
|
},
|
|
62231
62261
|
version: (object)=>{
|
|
62232
62262
|
object.version = "5.75.0";
|
|
62233
|
-
object.rspackVersion = "1.7.
|
|
62263
|
+
object.rspackVersion = "1.7.4";
|
|
62234
62264
|
},
|
|
62235
62265
|
env: (object, _compilation, _context, { _env })=>{
|
|
62236
62266
|
object.env = _env;
|
|
@@ -66331,13 +66361,27 @@ class ModuleFederationPlugin {
|
|
|
66331
66361
|
...compiler.options.resolve.alias
|
|
66332
66362
|
};
|
|
66333
66363
|
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
|
|
66364
|
+
const asyncStartup = this._options.experiments?.asyncStartup ?? false;
|
|
66365
|
+
const runtimeExperiments = {
|
|
66366
|
+
asyncStartup
|
|
66367
|
+
};
|
|
66334
66368
|
new ModuleFederationRuntimePlugin({
|
|
66335
|
-
entryRuntime
|
|
66369
|
+
entryRuntime,
|
|
66370
|
+
experiments: runtimeExperiments
|
|
66336
66371
|
}).apply(compiler);
|
|
66337
|
-
|
|
66338
|
-
|
|
66372
|
+
const v1Options = {
|
|
66373
|
+
name: this._options.name,
|
|
66374
|
+
exposes: this._options.exposes,
|
|
66375
|
+
filename: this._options.filename,
|
|
66376
|
+
library: this._options.library,
|
|
66377
|
+
remoteType: this._options.remoteType,
|
|
66378
|
+
remotes: this._options.remotes,
|
|
66379
|
+
runtime: this._options.runtime,
|
|
66380
|
+
shareScope: this._options.shareScope,
|
|
66381
|
+
shared: this._options.shared,
|
|
66339
66382
|
enhanced: true
|
|
66340
|
-
}
|
|
66383
|
+
};
|
|
66384
|
+
new webpack.container.ModuleFederationPluginV1(v1Options).apply(compiler);
|
|
66341
66385
|
if (this._options.manifest) {
|
|
66342
66386
|
const manifestOptions = true === this._options.manifest ? {} : {
|
|
66343
66387
|
...this._options.manifest
|
|
@@ -66510,12 +66554,12 @@ function getDefaultEntryRuntime(paths, options, compiler) {
|
|
|
66510
66554
|
const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
|
|
66511
66555
|
runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
|
|
66512
66556
|
const paramsCode = void 0 === pluginParams ? 'undefined' : JSON.stringify(pluginParams);
|
|
66513
|
-
runtimePluginVars.push(
|
|
66557
|
+
runtimePluginVars.push(`{ plugin: ${runtimePluginVar}, params: ${paramsCode} }`);
|
|
66514
66558
|
}
|
|
66515
66559
|
const content = [
|
|
66516
66560
|
`import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
|
|
66517
66561
|
...runtimePluginImports,
|
|
66518
|
-
`const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(', ')}]`,
|
|
66562
|
+
`const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(', ')}].filter(({ plugin }) => plugin).map(({ plugin, params }) => plugin(params))`,
|
|
66519
66563
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
66520
66564
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
66521
66565
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
|
|
@@ -66797,14 +66841,19 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
|
66797
66841
|
raw(compiler) {
|
|
66798
66842
|
const { remoteType, remotes } = this._options;
|
|
66799
66843
|
const remoteExternals = {};
|
|
66844
|
+
const importExternals = {};
|
|
66800
66845
|
for (const [key, config] of remotes){
|
|
66801
66846
|
let i = 0;
|
|
66802
|
-
for (const external of config.external)
|
|
66803
|
-
|
|
66847
|
+
for (const external of config.external){
|
|
66848
|
+
if (external.startsWith('internal ')) continue;
|
|
66849
|
+
const request = `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`;
|
|
66850
|
+
if (('module' === remoteType || 'module-import' === remoteType) && external.startsWith('.')) importExternals[request] = external;
|
|
66851
|
+
else remoteExternals[request] = external;
|
|
66804
66852
|
i++;
|
|
66805
66853
|
}
|
|
66806
66854
|
}
|
|
66807
66855
|
new ExternalsPlugin(remoteType, remoteExternals, true).apply(compiler);
|
|
66856
|
+
if (Object.keys(importExternals).length > 0) new ExternalsPlugin('import', importExternals, true).apply(compiler);
|
|
66808
66857
|
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66809
66858
|
const rawOptions = {
|
|
66810
66859
|
remoteType: this._options.remoteType,
|
|
@@ -66900,7 +66949,7 @@ function transformSync(source, options) {
|
|
|
66900
66949
|
const _options = JSON.stringify(options || {});
|
|
66901
66950
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
66902
66951
|
}
|
|
66903
|
-
const exports_rspackVersion = "1.7.
|
|
66952
|
+
const exports_rspackVersion = "1.7.4";
|
|
66904
66953
|
const exports_version = "5.75.0";
|
|
66905
66954
|
const exports_WebpackError = Error;
|
|
66906
66955
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -2477,8 +2477,13 @@ export interface RawModuleFederationManifestPluginOptions {
|
|
|
2477
2477
|
buildInfo?: RawStatsBuildInfo
|
|
2478
2478
|
}
|
|
2479
2479
|
|
|
2480
|
+
export interface RawModuleFederationRuntimeExperimentsOptions {
|
|
2481
|
+
asyncStartup?: boolean
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2480
2484
|
export interface RawModuleFederationRuntimePluginOptions {
|
|
2481
2485
|
entryRuntime?: string | undefined
|
|
2486
|
+
experiments?: RawModuleFederationRuntimeExperimentsOptions
|
|
2482
2487
|
}
|
|
2483
2488
|
|
|
2484
2489
|
export interface RawModuleFilenameTemplateFnCtx {
|
|
Binary file
|
package/package.json
CHANGED