@rspack/core 2.0.0-beta.5 → 2.0.0-beta.6
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/README.md +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +544 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/open/index.d.ts +161 -0
- package/compiled/open/package.json +1 -0
- package/dist/builtin-loader/swc/types.d.ts +9 -1
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
- package/dist/checkNodeVersion.d.ts +1 -0
- package/dist/config/devServer.d.ts +96 -224
- package/dist/config/types.d.ts +2 -2
- package/dist/container/ContainerPlugin.d.ts +3 -2
- package/dist/container/ContainerReferencePlugin.d.ts +4 -3
- package/dist/container/ModuleFederationPlugin.d.ts +2 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +66 -37
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +2 -2
- package/dist/sharing/ConsumeSharedPlugin.d.ts +5 -5
- package/dist/sharing/ProvideSharedPlugin.d.ts +6 -5
- package/dist/sharing/SharePlugin.d.ts +9 -7
- package/hot/dev-server.js +1 -1
- package/hot/emitter.js +0 -2
- package/hot/log.js +0 -2
- package/hot/only-dev-server.js +1 -1
- package/package.json +11 -10
|
@@ -2,10 +2,11 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
|
2
2
|
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
3
|
import type { Compiler } from '../Compiler.js';
|
|
4
4
|
import type { ExternalsType } from '../config/index.js';
|
|
5
|
+
import { type ShareScope } from '../sharing/SharePlugin.js';
|
|
5
6
|
export type ContainerReferencePluginOptions = {
|
|
6
7
|
remoteType: ExternalsType;
|
|
7
8
|
remotes: Remotes;
|
|
8
|
-
shareScope?:
|
|
9
|
+
shareScope?: ShareScope;
|
|
9
10
|
enhanced?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
|
|
@@ -16,7 +17,7 @@ export type RemotesObject = {
|
|
|
16
17
|
};
|
|
17
18
|
export type RemotesConfig = {
|
|
18
19
|
external: RemotesItem | RemotesItems;
|
|
19
|
-
shareScope?:
|
|
20
|
+
shareScope?: ShareScope;
|
|
20
21
|
};
|
|
21
22
|
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
22
23
|
name: BuiltinPluginName;
|
|
@@ -24,7 +25,7 @@ export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
|
24
25
|
remoteType: ExternalsType;
|
|
25
26
|
remotes: [string, {
|
|
26
27
|
external: string[];
|
|
27
|
-
shareScope:
|
|
28
|
+
shareScope: ShareScope;
|
|
28
29
|
}][];
|
|
29
30
|
enhanced: boolean;
|
|
30
31
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler.js';
|
|
2
2
|
import type { ExternalsType } from '../config/index.js';
|
|
3
|
+
import type { ShareScope } from '../sharing/SharePlugin.js';
|
|
3
4
|
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
|
|
4
5
|
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
|
|
5
6
|
import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin.js';
|
|
@@ -26,7 +27,7 @@ interface RemoteInfo {
|
|
|
26
27
|
name?: string;
|
|
27
28
|
entry?: string;
|
|
28
29
|
externalType: ExternalsType;
|
|
29
|
-
shareScope:
|
|
30
|
+
shareScope: ShareScope;
|
|
30
31
|
}
|
|
31
32
|
type RemoteInfos = Record<string, RemoteInfo[]>;
|
|
32
33
|
export declare function getRemoteInfos(options: ModuleFederationPluginOptions): RemoteInfos;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler.js';
|
|
2
2
|
import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config/index.js';
|
|
3
|
-
import { type Shared } from '../sharing/SharePlugin.js';
|
|
3
|
+
import { type Shared, type ShareScope } from '../sharing/SharePlugin.js';
|
|
4
4
|
import { type Exposes } from './ContainerPlugin.js';
|
|
5
5
|
import { type Remotes } from './ContainerReferencePlugin.js';
|
|
6
6
|
export interface ModuleFederationPluginV1Options {
|
|
@@ -11,7 +11,7 @@ export interface ModuleFederationPluginV1Options {
|
|
|
11
11
|
remoteType?: ExternalsType;
|
|
12
12
|
remotes?: Remotes;
|
|
13
13
|
runtime?: EntryRuntime;
|
|
14
|
-
shareScope?:
|
|
14
|
+
shareScope?: ShareScope;
|
|
15
15
|
shared?: Shared;
|
|
16
16
|
enhanced?: boolean;
|
|
17
17
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -298,7 +298,12 @@ __webpack_require__.r(ModuleFilenameHelpers_namespaceObject), __webpack_require_
|
|
|
298
298
|
asRegExp: ()=>asRegExp,
|
|
299
299
|
matchObject: ()=>matchObject,
|
|
300
300
|
matchPart: ()=>matchPart
|
|
301
|
-
})
|
|
301
|
+
}), !function() {
|
|
302
|
+
let { node, bun, deno } = process.versions;
|
|
303
|
+
if (!node || bun || deno) return;
|
|
304
|
+
let [majorStr, minorStr] = node.split('.'), major = parseInt(majorStr, 10), minor = parseInt(minorStr || '0', 10);
|
|
305
|
+
20 === major && minor >= 19 || 22 === major && minor >= 12 || major > 22 || console.error(`Unsupported Node.js version "${node}". Rspack requires Node.js 20.19+ or 22.12+. Please upgrade your Node.js version.\n`);
|
|
306
|
+
}();
|
|
302
307
|
let binding_namespaceObject = __rspack_createRequire_require(process.env.RSPACK_BINDING ? process.env.RSPACK_BINDING : "@rspack/binding");
|
|
303
308
|
var binding_default = __webpack_require__.n(binding_namespaceObject);
|
|
304
309
|
function _define_property(obj, key, value) {
|
|
@@ -5294,23 +5299,37 @@ let SwcJsMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPlug
|
|
|
5294
5299
|
exclude: options?.exclude,
|
|
5295
5300
|
extractComments: function(extractComments) {
|
|
5296
5301
|
let type, conditionStr = (condition)=>{
|
|
5297
|
-
if (void 0 === condition || !0 === condition) return
|
|
5302
|
+
if (void 0 === condition || !0 === condition) return {
|
|
5303
|
+
source: '@preserve|@lic|@cc_on|^\\**!',
|
|
5304
|
+
flags: ''
|
|
5305
|
+
};
|
|
5298
5306
|
if (!1 === condition) throw Error('unreachable');
|
|
5299
|
-
return
|
|
5307
|
+
return {
|
|
5308
|
+
source: condition.source,
|
|
5309
|
+
flags: condition.flags
|
|
5310
|
+
};
|
|
5300
5311
|
};
|
|
5301
5312
|
if ('boolean' == typeof extractComments) {
|
|
5302
5313
|
if (!extractComments) return;
|
|
5314
|
+
let { source, flags } = conditionStr(extractComments);
|
|
5303
5315
|
return {
|
|
5304
|
-
condition:
|
|
5316
|
+
condition: source,
|
|
5317
|
+
conditionFlags: flags
|
|
5318
|
+
};
|
|
5319
|
+
}
|
|
5320
|
+
if (extractComments instanceof RegExp) {
|
|
5321
|
+
let { source, flags } = conditionStr(extractComments);
|
|
5322
|
+
return {
|
|
5323
|
+
condition: source,
|
|
5324
|
+
conditionFlags: flags
|
|
5305
5325
|
};
|
|
5306
5326
|
}
|
|
5307
|
-
if (extractComments instanceof RegExp) return {
|
|
5308
|
-
condition: extractComments.source
|
|
5309
|
-
};
|
|
5310
5327
|
if (type = typeof extractComments, null != extractComments && ('object' === type || 'function' === type)) {
|
|
5311
5328
|
if (!1 === extractComments.condition) return;
|
|
5329
|
+
let { source, flags } = conditionStr(extractComments.condition);
|
|
5312
5330
|
return {
|
|
5313
|
-
condition:
|
|
5331
|
+
condition: source,
|
|
5332
|
+
conditionFlags: flags,
|
|
5314
5333
|
banner: extractComments.banner
|
|
5315
5334
|
};
|
|
5316
5335
|
}
|
|
@@ -6550,7 +6569,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6550
6569
|
type: "javascript/auto"
|
|
6551
6570
|
},
|
|
6552
6571
|
{
|
|
6553
|
-
test: /\.json
|
|
6572
|
+
test: /\.json$/,
|
|
6554
6573
|
type: 'json'
|
|
6555
6574
|
},
|
|
6556
6575
|
{
|
|
@@ -6558,22 +6577,22 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6558
6577
|
type: 'json'
|
|
6559
6578
|
},
|
|
6560
6579
|
{
|
|
6561
|
-
test: /\.mjs
|
|
6580
|
+
test: /\.mjs$/,
|
|
6562
6581
|
...esm
|
|
6563
6582
|
},
|
|
6564
6583
|
{
|
|
6565
|
-
test: /\.js
|
|
6584
|
+
test: /\.js$/,
|
|
6566
6585
|
descriptionData: {
|
|
6567
6586
|
type: 'module'
|
|
6568
6587
|
},
|
|
6569
6588
|
...esm
|
|
6570
6589
|
},
|
|
6571
6590
|
{
|
|
6572
|
-
test: /\.cjs
|
|
6591
|
+
test: /\.cjs$/,
|
|
6573
6592
|
...commonjs
|
|
6574
6593
|
},
|
|
6575
6594
|
{
|
|
6576
|
-
test: /\.js
|
|
6595
|
+
test: /\.js$/,
|
|
6577
6596
|
descriptionData: {
|
|
6578
6597
|
type: 'commonjs'
|
|
6579
6598
|
},
|
|
@@ -6604,7 +6623,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6604
6623
|
]
|
|
6605
6624
|
};
|
|
6606
6625
|
rules.push({
|
|
6607
|
-
test: /\.wasm
|
|
6626
|
+
test: /\.wasm$/,
|
|
6608
6627
|
...wasm
|
|
6609
6628
|
}), rules.push({
|
|
6610
6629
|
mimetype: 'application/wasm',
|
|
@@ -6791,7 +6810,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6791
6810
|
return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
|
|
6792
6811
|
desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
|
|
6793
6812
|
}), Array.from(enabledWasmLoadingTypes);
|
|
6794
|
-
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.
|
|
6813
|
+
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.6"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
|
|
6795
6814
|
}, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
|
|
6796
6815
|
let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
|
|
6797
6816
|
D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
|
|
@@ -6829,7 +6848,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6829
6848
|
})), F(cacheGroups, 'defaultVendors', ()=>({
|
|
6830
6849
|
idHint: 'vendors',
|
|
6831
6850
|
reuseExistingChunk: !0,
|
|
6832
|
-
test: /[\\/]node_modules[\\/]
|
|
6851
|
+
test: /[\\/]node_modules[\\/]/,
|
|
6833
6852
|
priority: -10
|
|
6834
6853
|
})));
|
|
6835
6854
|
}
|
|
@@ -8045,7 +8064,7 @@ class MultiStats {
|
|
|
8045
8064
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8046
8065
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8047
8066
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8048
|
-
}), childOptions.version && (obj.rspackVersion = "2.0.0-beta.
|
|
8067
|
+
}), childOptions.version && (obj.rspackVersion = "2.0.0-beta.6", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
|
|
8049
8068
|
let mapError = (j, obj)=>({
|
|
8050
8069
|
...obj,
|
|
8051
8070
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9304,7 +9323,7 @@ let iterateConfig = (config, options, fn)=>{
|
|
|
9304
9323
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
9305
9324
|
},
|
|
9306
9325
|
version: (object)=>{
|
|
9307
|
-
object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.
|
|
9326
|
+
object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.6";
|
|
9308
9327
|
},
|
|
9309
9328
|
env: (object, _compilation, _context, { _env })=>{
|
|
9310
9329
|
object.env = _env;
|
|
@@ -10969,7 +10988,7 @@ class TraceHookPlugin {
|
|
|
10969
10988
|
});
|
|
10970
10989
|
}
|
|
10971
10990
|
}
|
|
10972
|
-
let CORE_VERSION = "2.0.0-beta.
|
|
10991
|
+
let CORE_VERSION = "2.0.0-beta.6", VFILES_BY_COMPILER = new WeakMap();
|
|
10973
10992
|
class VirtualModulesPlugin {
|
|
10974
10993
|
#staticModules;
|
|
10975
10994
|
#compiler;
|
|
@@ -12550,6 +12569,9 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
|
12550
12569
|
return createBuiltinPlugin(this.name, rawOptions);
|
|
12551
12570
|
}
|
|
12552
12571
|
}
|
|
12572
|
+
function validateShareScope(shareScope, enhanced, pluginName) {
|
|
12573
|
+
if (Array.isArray(shareScope) && shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
|
|
12574
|
+
}
|
|
12553
12575
|
function normalizeSharedOptions(shared) {
|
|
12554
12576
|
return parseOptions(shared, (item, key)=>{
|
|
12555
12577
|
if ('string' != typeof item) throw Error('Unexpected array in shared');
|
|
@@ -13088,7 +13110,7 @@ function getRemoteInfos(options) {
|
|
|
13088
13110
|
external: Array.isArray(item) ? item : [
|
|
13089
13111
|
item
|
|
13090
13112
|
],
|
|
13091
|
-
shareScope: options.shareScope
|
|
13113
|
+
shareScope: options.shareScope ?? 'default'
|
|
13092
13114
|
}), (item)=>({
|
|
13093
13115
|
external: Array.isArray(item.external) ? item.external : [
|
|
13094
13116
|
item.external
|
|
@@ -13162,9 +13184,11 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
13162
13184
|
name = binding_namespaceObject.BuiltinPluginName.ContainerPlugin;
|
|
13163
13185
|
_options;
|
|
13164
13186
|
constructor(options){
|
|
13165
|
-
super()
|
|
13187
|
+
super();
|
|
13188
|
+
let shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
|
|
13189
|
+
validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
|
|
13166
13190
|
name: options.name,
|
|
13167
|
-
shareScope
|
|
13191
|
+
shareScope,
|
|
13168
13192
|
library: options.library || {
|
|
13169
13193
|
type: 'global',
|
|
13170
13194
|
name: options.name
|
|
@@ -13182,7 +13206,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
13182
13206
|
],
|
|
13183
13207
|
name: item.name || void 0
|
|
13184
13208
|
})),
|
|
13185
|
-
enhanced
|
|
13209
|
+
enhanced
|
|
13186
13210
|
};
|
|
13187
13211
|
}
|
|
13188
13212
|
raw(compiler) {
|
|
@@ -13207,20 +13231,25 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
|
13207
13231
|
name = binding_namespaceObject.BuiltinPluginName.ContainerReferencePlugin;
|
|
13208
13232
|
_options;
|
|
13209
13233
|
constructor(options){
|
|
13210
|
-
super()
|
|
13234
|
+
super();
|
|
13235
|
+
let enhanced = options.enhanced ?? !1;
|
|
13236
|
+
options.shareScope && validateShareScope(options.shareScope, enhanced, 'ContainerReferencePlugin');
|
|
13237
|
+
let remotes = parseOptions(options.remotes, (item)=>({
|
|
13238
|
+
external: Array.isArray(item) ? item : [
|
|
13239
|
+
item
|
|
13240
|
+
],
|
|
13241
|
+
shareScope: options.shareScope || 'default'
|
|
13242
|
+
}), (item)=>({
|
|
13243
|
+
external: Array.isArray(item.external) ? item.external : [
|
|
13244
|
+
item.external
|
|
13245
|
+
],
|
|
13246
|
+
shareScope: item.shareScope || options.shareScope || 'default'
|
|
13247
|
+
}));
|
|
13248
|
+
for (let [, config] of remotes)validateShareScope(config.shareScope, enhanced, 'ContainerReferencePlugin');
|
|
13249
|
+
this._options = {
|
|
13211
13250
|
remoteType: options.remoteType,
|
|
13212
|
-
remotes
|
|
13213
|
-
|
|
13214
|
-
item
|
|
13215
|
-
],
|
|
13216
|
-
shareScope: options.shareScope || 'default'
|
|
13217
|
-
}), (item)=>({
|
|
13218
|
-
external: Array.isArray(item.external) ? item.external : [
|
|
13219
|
-
item.external
|
|
13220
|
-
],
|
|
13221
|
-
shareScope: item.shareScope || options.shareScope || 'default'
|
|
13222
|
-
})),
|
|
13223
|
-
enhanced: options.enhanced ?? !1
|
|
13251
|
+
remotes,
|
|
13252
|
+
enhanced
|
|
13224
13253
|
};
|
|
13225
13254
|
}
|
|
13226
13255
|
raw(compiler) {
|
|
@@ -13253,7 +13282,7 @@ async function transform(source, options) {
|
|
|
13253
13282
|
let _options = JSON.stringify(options || {});
|
|
13254
13283
|
return binding_default().transform(source, _options);
|
|
13255
13284
|
}
|
|
13256
|
-
let exports_rspackVersion = "2.0.0-beta.
|
|
13285
|
+
let exports_rspackVersion = "2.0.0-beta.6", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
|
|
13257
13286
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
13258
13287
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
13259
13288
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
2
2
|
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
3
|
import type { Compiler } from '../Compiler.js';
|
|
4
|
-
import { type NormalizedSharedOptions } from './SharePlugin.js';
|
|
4
|
+
import { type NormalizedSharedOptions, type ShareScope } from './SharePlugin.js';
|
|
5
5
|
export type CollectSharedEntryPluginOptions = {
|
|
6
6
|
sharedOptions: NormalizedSharedOptions;
|
|
7
|
-
shareScope?:
|
|
7
|
+
shareScope?: ShareScope;
|
|
8
8
|
};
|
|
9
9
|
export type ShareRequestsMap = Record<string, {
|
|
10
10
|
shareScope: string;
|
|
@@ -3,7 +3,7 @@ import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
|
3
3
|
import type { Compiler } from '../Compiler.js';
|
|
4
4
|
export type ConsumeSharedPluginOptions = {
|
|
5
5
|
consumes: Consumes;
|
|
6
|
-
shareScope?: string;
|
|
6
|
+
shareScope?: string | string[];
|
|
7
7
|
enhanced?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject;
|
|
@@ -17,14 +17,14 @@ export type ConsumesConfig = {
|
|
|
17
17
|
packageName?: string;
|
|
18
18
|
requiredVersion?: false | string;
|
|
19
19
|
shareKey?: string;
|
|
20
|
-
shareScope?: string;
|
|
20
|
+
shareScope?: string | string[];
|
|
21
21
|
singleton?: boolean;
|
|
22
22
|
strictVersion?: boolean;
|
|
23
23
|
treeShakingMode?: 'server-calc' | 'runtime-infer';
|
|
24
24
|
};
|
|
25
|
-
export declare function normalizeConsumeShareOptions(consumes: Consumes, shareScope?: string): [string, {
|
|
25
|
+
export declare function normalizeConsumeShareOptions(consumes: Consumes, shareScope?: string | string[]): [string, {
|
|
26
26
|
import: string | undefined;
|
|
27
|
-
shareScope: string;
|
|
27
|
+
shareScope: string | string[];
|
|
28
28
|
shareKey: string;
|
|
29
29
|
requiredVersion: string | false | undefined;
|
|
30
30
|
strictVersion: boolean;
|
|
@@ -38,7 +38,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
|
38
38
|
_options: {
|
|
39
39
|
consumes: [string, {
|
|
40
40
|
import: string | undefined;
|
|
41
|
-
shareScope: string;
|
|
41
|
+
shareScope: string | string[];
|
|
42
42
|
shareKey: string;
|
|
43
43
|
requiredVersion: string | false | undefined;
|
|
44
44
|
strictVersion: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName, type RawProvideOptions } from '@rspack/binding';
|
|
2
2
|
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
3
|
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { ShareScope } from './SharePlugin.js';
|
|
4
5
|
export type ProvideSharedPluginOptions<Enhanced extends boolean = false> = {
|
|
5
6
|
provides: Provides<Enhanced>;
|
|
6
|
-
shareScope?:
|
|
7
|
+
shareScope?: ShareScope;
|
|
7
8
|
enhanced?: Enhanced;
|
|
8
9
|
};
|
|
9
10
|
export type Provides<Enhanced extends boolean> = (ProvidesItem | ProvidesObject<Enhanced>)[] | ProvidesObject<Enhanced>;
|
|
@@ -15,7 +16,7 @@ export type ProvidesConfig<Enhanced extends boolean> = Enhanced extends true ? P
|
|
|
15
16
|
type ProvidesV1Config = {
|
|
16
17
|
eager?: boolean;
|
|
17
18
|
shareKey: string;
|
|
18
|
-
shareScope?:
|
|
19
|
+
shareScope?: ShareScope;
|
|
19
20
|
version?: false | string;
|
|
20
21
|
};
|
|
21
22
|
type ProvidesEnhancedConfig = ProvidesV1Config & ProvidesEnhancedExtraConfig;
|
|
@@ -28,10 +29,10 @@ type ProvidesEnhancedExtraConfig = {
|
|
|
28
29
|
*/
|
|
29
30
|
treeShakingMode?: 'server-calc' | 'runtime-infer';
|
|
30
31
|
};
|
|
31
|
-
export declare function normalizeProvideShareOptions<Enhanced extends boolean = false>(options: Provides<Enhanced>, shareScope?:
|
|
32
|
+
export declare function normalizeProvideShareOptions<Enhanced extends boolean = false>(options: Provides<Enhanced>, shareScope?: ShareScope, enhanced?: boolean): [string, {
|
|
32
33
|
shareKey: string;
|
|
33
34
|
version: string | false | undefined;
|
|
34
|
-
shareScope:
|
|
35
|
+
shareScope: ShareScope;
|
|
35
36
|
eager: boolean;
|
|
36
37
|
} | {
|
|
37
38
|
singleton: boolean | undefined;
|
|
@@ -40,7 +41,7 @@ export declare function normalizeProvideShareOptions<Enhanced extends boolean =
|
|
|
40
41
|
treeShakingMode: "server-calc" | "runtime-infer" | undefined;
|
|
41
42
|
shareKey: string;
|
|
42
43
|
version: string | false | undefined;
|
|
43
|
-
shareScope:
|
|
44
|
+
shareScope: ShareScope;
|
|
44
45
|
eager: boolean;
|
|
45
46
|
}][];
|
|
46
47
|
export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
export type ShareScope = string | string[];
|
|
3
|
+
export declare function validateShareScope(shareScope: ShareScope, enhanced: boolean, pluginName: string): void;
|
|
2
4
|
export type SharePluginOptions = {
|
|
3
|
-
shareScope?:
|
|
5
|
+
shareScope?: ShareScope;
|
|
4
6
|
shared: Shared;
|
|
5
7
|
enhanced: boolean;
|
|
6
8
|
};
|
|
@@ -20,7 +22,7 @@ export type SharedConfig = {
|
|
|
20
22
|
packageName?: string;
|
|
21
23
|
requiredVersion?: false | string;
|
|
22
24
|
shareKey?: string;
|
|
23
|
-
shareScope?:
|
|
25
|
+
shareScope?: ShareScope;
|
|
24
26
|
singleton?: boolean;
|
|
25
27
|
strictVersion?: boolean;
|
|
26
28
|
version?: false | string;
|
|
@@ -31,7 +33,7 @@ export declare function normalizeSharedOptions(shared: Shared): NormalizedShared
|
|
|
31
33
|
export declare function createProvideShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
|
|
32
34
|
[x: string]: {
|
|
33
35
|
shareKey: string;
|
|
34
|
-
shareScope:
|
|
36
|
+
shareScope: ShareScope | undefined;
|
|
35
37
|
version: string | false | undefined;
|
|
36
38
|
eager: boolean | undefined;
|
|
37
39
|
singleton: boolean | undefined;
|
|
@@ -44,7 +46,7 @@ export declare function createConsumeShareOptions(normalizedSharedOptions: Norma
|
|
|
44
46
|
[x: string]: {
|
|
45
47
|
import: string | false | undefined;
|
|
46
48
|
shareKey: string;
|
|
47
|
-
shareScope:
|
|
49
|
+
shareScope: ShareScope | undefined;
|
|
48
50
|
requiredVersion: string | false | undefined;
|
|
49
51
|
strictVersion: boolean | undefined;
|
|
50
52
|
singleton: boolean | undefined;
|
|
@@ -54,12 +56,12 @@ export declare function createConsumeShareOptions(normalizedSharedOptions: Norma
|
|
|
54
56
|
};
|
|
55
57
|
}[];
|
|
56
58
|
export declare class SharePlugin {
|
|
57
|
-
_shareScope:
|
|
59
|
+
_shareScope: ShareScope | undefined;
|
|
58
60
|
_consumes: {
|
|
59
61
|
[x: string]: {
|
|
60
62
|
import: string | false | undefined;
|
|
61
63
|
shareKey: string;
|
|
62
|
-
shareScope:
|
|
64
|
+
shareScope: ShareScope | undefined;
|
|
63
65
|
requiredVersion: string | false | undefined;
|
|
64
66
|
strictVersion: boolean | undefined;
|
|
65
67
|
singleton: boolean | undefined;
|
|
@@ -71,7 +73,7 @@ export declare class SharePlugin {
|
|
|
71
73
|
_provides: {
|
|
72
74
|
[x: string]: {
|
|
73
75
|
shareKey: string;
|
|
74
|
-
shareScope:
|
|
76
|
+
shareScope: ShareScope | undefined;
|
|
75
77
|
version: string | false | undefined;
|
|
76
78
|
eager: boolean | undefined;
|
|
77
79
|
singleton: boolean | undefined;
|
package/hot/dev-server.js
CHANGED
|
@@ -28,7 +28,7 @@ if (import.meta.webpackHot) {
|
|
|
28
28
|
);
|
|
29
29
|
log(
|
|
30
30
|
'warning',
|
|
31
|
-
'[HMR] (Probably because of restarting the
|
|
31
|
+
'[HMR] (Probably because of restarting the rspack-dev-server)',
|
|
32
32
|
);
|
|
33
33
|
if (typeof window !== 'undefined') {
|
|
34
34
|
window.location.reload();
|
package/hot/emitter.js
CHANGED
package/hot/log.js
CHANGED
package/hot/only-dev-server.js
CHANGED
|
@@ -22,7 +22,7 @@ if (import.meta.webpackHot) {
|
|
|
22
22
|
log('warning', '[HMR] Cannot find update. Need to do a full reload!');
|
|
23
23
|
log(
|
|
24
24
|
'warning',
|
|
25
|
-
'[HMR] (Probably because of restarting the
|
|
25
|
+
'[HMR] (Probably because of restarting the rspack-dev-server)',
|
|
26
26
|
);
|
|
27
27
|
return;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.6",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Fast Rust-based bundler for the web with a modernized webpack API",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public",
|
|
@@ -37,28 +37,29 @@
|
|
|
37
37
|
"directory": "packages/rspack"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@ast-grep/napi": "^0.
|
|
40
|
+
"@ast-grep/napi": "^0.41.0",
|
|
41
41
|
"@napi-rs/wasm-runtime": "1.0.7",
|
|
42
42
|
"@rsbuild/plugin-node-polyfill": "^1.4.4",
|
|
43
|
-
"@rspack/lite-tapable": "1.1.0",
|
|
44
43
|
"@rslib/core": "0.19.6",
|
|
44
|
+
"@rspack/lite-tapable": "1.1.0",
|
|
45
45
|
"@swc/types": "0.1.25",
|
|
46
|
-
"@types/node": "^20.19.
|
|
46
|
+
"@types/node": "^20.19.35",
|
|
47
47
|
"@types/watchpack": "^2.4.5",
|
|
48
48
|
"browserslist-load-config": "^1.0.1",
|
|
49
49
|
"browserslist-to-es-version": "^1.4.1",
|
|
50
|
+
"connect-next": "^4.0.0",
|
|
50
51
|
"enhanced-resolve": "5.19.0",
|
|
51
|
-
"
|
|
52
|
+
"http-proxy-middleware": "^3.0.5",
|
|
52
53
|
"memfs": "4.53.0",
|
|
53
|
-
"
|
|
54
|
+
"open": "^11.0.0",
|
|
55
|
+
"prebundle": "^1.6.4",
|
|
54
56
|
"tinypool": "^1.1.1",
|
|
55
|
-
"tsx": "^4.21.0",
|
|
56
57
|
"typescript": "^5.9.3",
|
|
57
|
-
"watchpack": "
|
|
58
|
+
"watchpack": "2.4.4",
|
|
58
59
|
"webpack-sources": "3.3.4"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"@rspack/binding": "2.0.0-beta.
|
|
62
|
+
"@rspack/binding": "2.0.0-beta.6"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",
|