@rspack-debug/core 2.0.0-alpha.1 → 2.0.0-beta.1
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/Compilation.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +1 -1
- package/dist/config/normalization.d.ts +1 -2
- package/dist/config/types.d.ts +106 -30
- package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
- package/dist/container/ModuleFederationPlugin.d.ts +17 -1
- package/dist/exports.d.ts +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1233 -332
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +13 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +19 -0
- package/dist/sharing/SharePlugin.d.ts +36 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +16 -0
- package/dist/sharing/utils.d.ts +1 -0
- package/dist/util/createHash.d.ts +1 -1
- package/dist/worker.js +0 -16
- package/package.json +8 -8
package/dist/Compilation.d.ts
CHANGED
|
@@ -162,6 +162,7 @@ export declare class Compilation {
|
|
|
162
162
|
Iterable<Chunk>,
|
|
163
163
|
Iterable<Module>
|
|
164
164
|
], void>;
|
|
165
|
+
beforeModuleIds: liteTapable.SyncHook<[Iterable<Module>]>;
|
|
165
166
|
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
166
167
|
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
167
168
|
chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Compiler, MultiCompiler } from '../../index.js';
|
|
2
2
|
import type { MiddlewareHandler } from '../../config/devServer.js';
|
|
3
|
-
export declare const LAZY_COMPILATION_PREFIX = "/lazy
|
|
3
|
+
export declare const LAZY_COMPILATION_PREFIX = "/_rspack/lazy/trigger";
|
|
4
4
|
/**
|
|
5
5
|
* Create a middleware that handles lazy compilation requests from the client.
|
|
6
6
|
* This function returns an Express-style middleware that listens for
|
|
@@ -76,7 +76,6 @@ export interface ModuleOptionsNormalized {
|
|
|
76
76
|
parser: ParserOptionsByModuleType;
|
|
77
77
|
generator: GeneratorOptionsByModuleType;
|
|
78
78
|
noParse?: NoParseOption;
|
|
79
|
-
unsafeCache?: boolean | RegExp;
|
|
80
79
|
}
|
|
81
80
|
export type CacheNormalized = boolean | {
|
|
82
81
|
type: 'memory';
|
|
@@ -93,10 +92,10 @@ export type CacheNormalized = boolean | {
|
|
|
93
92
|
type: 'filesystem';
|
|
94
93
|
directory: string;
|
|
95
94
|
};
|
|
95
|
+
portable?: boolean;
|
|
96
96
|
};
|
|
97
97
|
export interface ExperimentsNormalized {
|
|
98
98
|
asyncWebAssembly?: boolean;
|
|
99
|
-
outputModule?: boolean;
|
|
100
99
|
css?: boolean;
|
|
101
100
|
futureDefaults?: boolean;
|
|
102
101
|
buildHttp?: HttpUriPluginOptions;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -367,7 +367,6 @@ export type Output = {
|
|
|
367
367
|
library?: Library;
|
|
368
368
|
/**
|
|
369
369
|
* Output JavaScript files as module type.
|
|
370
|
-
* Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
|
|
371
370
|
* @default false
|
|
372
371
|
*/
|
|
373
372
|
module?: OutputModule;
|
|
@@ -718,6 +717,14 @@ export type AssetParserOptions = {
|
|
|
718
717
|
};
|
|
719
718
|
export type CssParserNamedExports = boolean;
|
|
720
719
|
export type CssParserUrl = boolean;
|
|
720
|
+
export type CssParserResolveImportContext = {
|
|
721
|
+
url: string;
|
|
722
|
+
media: string | undefined;
|
|
723
|
+
resourcePath: string;
|
|
724
|
+
supports: string | undefined;
|
|
725
|
+
layer: string | undefined;
|
|
726
|
+
};
|
|
727
|
+
export type CssParserResolveImport = boolean | ((context: CssParserResolveImportContext) => boolean);
|
|
721
728
|
/** Options object for `css` modules. */
|
|
722
729
|
export type CssParserOptions = {
|
|
723
730
|
/**
|
|
@@ -730,6 +737,11 @@ export type CssParserOptions = {
|
|
|
730
737
|
* @default true
|
|
731
738
|
* */
|
|
732
739
|
url?: CssParserUrl;
|
|
740
|
+
/**
|
|
741
|
+
* Allow to enable/disables `@import` at-rules handling.
|
|
742
|
+
* @default true
|
|
743
|
+
* */
|
|
744
|
+
resolveImport?: CssParserResolveImport;
|
|
733
745
|
};
|
|
734
746
|
/** Options object for `css/auto` modules. */
|
|
735
747
|
export type CssAutoParserOptions = {
|
|
@@ -743,6 +755,11 @@ export type CssAutoParserOptions = {
|
|
|
743
755
|
* @default true
|
|
744
756
|
* */
|
|
745
757
|
url?: CssParserUrl;
|
|
758
|
+
/**
|
|
759
|
+
* Allow to enable/disables `@import` at-rules handling.
|
|
760
|
+
* @default true
|
|
761
|
+
* */
|
|
762
|
+
resolveImport?: CssParserResolveImport;
|
|
746
763
|
};
|
|
747
764
|
/** Options object for `css/module` modules. */
|
|
748
765
|
export type CssModuleParserOptions = {
|
|
@@ -756,6 +773,11 @@ export type CssModuleParserOptions = {
|
|
|
756
773
|
* @default true
|
|
757
774
|
* */
|
|
758
775
|
url?: CssParserUrl;
|
|
776
|
+
/**
|
|
777
|
+
* Allow to enable/disables `@import` at-rules handling.
|
|
778
|
+
* @default true
|
|
779
|
+
* */
|
|
780
|
+
resolveImport?: CssParserResolveImport;
|
|
759
781
|
};
|
|
760
782
|
type ExportsPresence = 'error' | 'warn' | 'auto' | false;
|
|
761
783
|
export type JavascriptParserCommonjsExports = boolean | 'skipInEsm';
|
|
@@ -815,15 +837,13 @@ export type JavascriptParserOptions = {
|
|
|
815
837
|
wrappedContextRegExp?: RegExp;
|
|
816
838
|
/**
|
|
817
839
|
* Warn or error for using non-existent exports and conflicting re-exports.
|
|
818
|
-
* @default '
|
|
840
|
+
* @default 'error'
|
|
819
841
|
*/
|
|
820
842
|
exportsPresence?: ExportsPresence;
|
|
821
843
|
/** Warn or error for using non-existent exports */
|
|
822
844
|
importExportsPresence?: ExportsPresence;
|
|
823
845
|
/** Warn or error for conflicting re-exports */
|
|
824
846
|
reexportExportsPresence?: ExportsPresence;
|
|
825
|
-
/** Emit errors instead of warnings when imported names don't exist in imported module. */
|
|
826
|
-
strictExportPresence?: boolean;
|
|
827
847
|
/** Provide custom syntax for Worker parsing, commonly used to support Worklet */
|
|
828
848
|
worker?: string[] | boolean;
|
|
829
849
|
/** Override the module to strict or non-strict. */
|
|
@@ -1044,10 +1064,6 @@ export type ModuleOptions = {
|
|
|
1044
1064
|
generator?: GeneratorOptionsByModuleType;
|
|
1045
1065
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
1046
1066
|
noParse?: NoParseOption;
|
|
1047
|
-
/**
|
|
1048
|
-
* Cache the resolving of module requests.
|
|
1049
|
-
*/
|
|
1050
|
-
unsafeCache?: boolean | RegExp;
|
|
1051
1067
|
};
|
|
1052
1068
|
type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
|
|
1053
1069
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
@@ -1239,6 +1255,86 @@ export type NodeOptions = {
|
|
|
1239
1255
|
export type Node = false | NodeOptions;
|
|
1240
1256
|
export type Loader = Record<string, any>;
|
|
1241
1257
|
export type SnapshotOptions = {};
|
|
1258
|
+
/**
|
|
1259
|
+
* Snapshot options for determining which files have been modified.
|
|
1260
|
+
*/
|
|
1261
|
+
export type CacheSnapshotOptions = {
|
|
1262
|
+
/**
|
|
1263
|
+
* An array of paths to immutable files, changes to these paths will be ignored during hot restart.
|
|
1264
|
+
*/
|
|
1265
|
+
immutablePaths?: (string | RegExp)[];
|
|
1266
|
+
/**
|
|
1267
|
+
* An array of paths in managedPaths that are not managed by the package manager.
|
|
1268
|
+
*/
|
|
1269
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
1270
|
+
/**
|
|
1271
|
+
* An array of paths managed by the package manager.
|
|
1272
|
+
* @default [/[\\/]node_modules[\\/][^.]/]
|
|
1273
|
+
*/
|
|
1274
|
+
managedPaths?: (string | RegExp)[];
|
|
1275
|
+
};
|
|
1276
|
+
/**
|
|
1277
|
+
* Storage options for persistent cache.
|
|
1278
|
+
*/
|
|
1279
|
+
export type CacheStorageOptions = {
|
|
1280
|
+
/**
|
|
1281
|
+
* Storage type, currently only supports 'filesystem'.
|
|
1282
|
+
*/
|
|
1283
|
+
type: 'filesystem';
|
|
1284
|
+
/**
|
|
1285
|
+
* Cache directory path.
|
|
1286
|
+
* @default 'node_modules/.cache/rspack'
|
|
1287
|
+
*/
|
|
1288
|
+
directory?: string;
|
|
1289
|
+
};
|
|
1290
|
+
/**
|
|
1291
|
+
* Persistent cache options.
|
|
1292
|
+
*/
|
|
1293
|
+
export type PersistentCacheOptions = {
|
|
1294
|
+
/**
|
|
1295
|
+
* Cache type.
|
|
1296
|
+
*/
|
|
1297
|
+
type: 'persistent';
|
|
1298
|
+
/**
|
|
1299
|
+
* An array of files containing build dependencies, Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
1300
|
+
* @default []
|
|
1301
|
+
*/
|
|
1302
|
+
buildDependencies?: string[];
|
|
1303
|
+
/**
|
|
1304
|
+
* Cache version, different versions of caches are isolated from each other.
|
|
1305
|
+
* @default ""
|
|
1306
|
+
*/
|
|
1307
|
+
version?: string;
|
|
1308
|
+
/**
|
|
1309
|
+
* Snapshot options for determining which files have been modified.
|
|
1310
|
+
*/
|
|
1311
|
+
snapshot?: CacheSnapshotOptions;
|
|
1312
|
+
/**
|
|
1313
|
+
* Storage options for cache.
|
|
1314
|
+
*/
|
|
1315
|
+
storage?: CacheStorageOptions;
|
|
1316
|
+
/**
|
|
1317
|
+
* Enable portable cache mode. When enabled, the generated cache content can be shared across different platforms and paths within the same project.
|
|
1318
|
+
* @description Portable cache makes the cache platform-independent by converting platform-specific data (e.g., absolute paths to relative paths) during serialization and deserialization.
|
|
1319
|
+
* @default false
|
|
1320
|
+
*/
|
|
1321
|
+
portable?: boolean;
|
|
1322
|
+
/**
|
|
1323
|
+
* Enable read-only mode. When enabled, the cache will only be read from disk and never written to.
|
|
1324
|
+
* @description This is useful for CI environments where you want to use a pre-warmed cache without modifying it.
|
|
1325
|
+
* @default false
|
|
1326
|
+
*/
|
|
1327
|
+
readonly?: boolean;
|
|
1328
|
+
};
|
|
1329
|
+
/**
|
|
1330
|
+
* Memory cache options.
|
|
1331
|
+
*/
|
|
1332
|
+
export type MemoryCacheOptions = {
|
|
1333
|
+
/**
|
|
1334
|
+
* Cache type.
|
|
1335
|
+
*/
|
|
1336
|
+
type: 'memory';
|
|
1337
|
+
};
|
|
1242
1338
|
/**
|
|
1243
1339
|
* Options for caching snapshots and intermediate products during the build process.
|
|
1244
1340
|
* @description Controls whether caching is enabled or disabled.
|
|
@@ -1250,22 +1346,7 @@ export type SnapshotOptions = {};
|
|
|
1250
1346
|
* // Disable caching
|
|
1251
1347
|
* cache: false
|
|
1252
1348
|
*/
|
|
1253
|
-
export type CacheOptions = boolean |
|
|
1254
|
-
type: 'memory';
|
|
1255
|
-
} | {
|
|
1256
|
-
type: 'persistent';
|
|
1257
|
-
buildDependencies?: string[];
|
|
1258
|
-
version?: string;
|
|
1259
|
-
snapshot?: {
|
|
1260
|
-
immutablePaths?: (string | RegExp)[];
|
|
1261
|
-
unmanagedPaths?: (string | RegExp)[];
|
|
1262
|
-
managedPaths?: (string | RegExp)[];
|
|
1263
|
-
};
|
|
1264
|
-
storage?: {
|
|
1265
|
-
type: 'filesystem';
|
|
1266
|
-
directory?: string;
|
|
1267
|
-
};
|
|
1268
|
-
};
|
|
1349
|
+
export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
|
|
1269
1350
|
export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
|
|
1270
1351
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1271
1352
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
@@ -1976,7 +2057,7 @@ export type LazyCompilationOptions = {
|
|
|
1976
2057
|
serverUrl?: string;
|
|
1977
2058
|
/**
|
|
1978
2059
|
* Customize the prefix used for lazy compilation endpoint.
|
|
1979
|
-
* @default "/lazy
|
|
2060
|
+
* @default "/_rspack/lazy/trigger"
|
|
1980
2061
|
*/
|
|
1981
2062
|
prefix?: string;
|
|
1982
2063
|
};
|
|
@@ -2063,11 +2144,6 @@ export type Experiments = {
|
|
|
2063
2144
|
* @default false
|
|
2064
2145
|
*/
|
|
2065
2146
|
asyncWebAssembly?: boolean;
|
|
2066
|
-
/**
|
|
2067
|
-
* Enable output as ES module.
|
|
2068
|
-
* @default false
|
|
2069
|
-
*/
|
|
2070
|
-
outputModule?: boolean;
|
|
2071
2147
|
/**
|
|
2072
2148
|
* Enable CSS support.
|
|
2073
2149
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
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 ModuleFederationPluginOptions } from './ModuleFederationPlugin.js';
|
|
4
5
|
export type RemoteAliasMap = Record<string, {
|
|
5
6
|
name: string;
|
|
6
7
|
entry?: string;
|
|
@@ -15,7 +16,7 @@ export type ManifestSharedOption = {
|
|
|
15
16
|
requiredVersion?: string;
|
|
16
17
|
singleton?: boolean;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
type InternalManifestPluginOptions = {
|
|
19
20
|
name?: string;
|
|
20
21
|
globalName?: string;
|
|
21
22
|
filePath?: string;
|
|
@@ -25,13 +26,19 @@ export type ModuleFederationManifestPluginOptions = {
|
|
|
25
26
|
exposes?: ManifestExposeOption[];
|
|
26
27
|
shared?: ManifestSharedOption[];
|
|
27
28
|
};
|
|
29
|
+
export type ModuleFederationManifestPluginOptions = boolean | Pick<InternalManifestPluginOptions, 'disableAssetsAnalyze' | 'filePath' | 'fileName'>;
|
|
30
|
+
export declare function getFileName(manifestOptions: ModuleFederationManifestPluginOptions): {
|
|
31
|
+
statsFileName: string;
|
|
32
|
+
manifestFileName: string;
|
|
33
|
+
};
|
|
28
34
|
/**
|
|
29
35
|
* JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
|
|
30
36
|
* To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
|
|
31
37
|
*/
|
|
32
38
|
export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
33
39
|
name: BuiltinPluginName;
|
|
34
|
-
private
|
|
35
|
-
constructor(opts:
|
|
40
|
+
private rawOpts;
|
|
41
|
+
constructor(opts: ModuleFederationPluginOptions);
|
|
36
42
|
raw(compiler: Compiler): BuiltinPlugin;
|
|
37
43
|
}
|
|
44
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import type { ExternalsType } from '../config/index.js';
|
|
2
3
|
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
|
|
3
4
|
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
|
|
4
5
|
import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin.js';
|
|
@@ -6,12 +7,27 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
|
|
|
6
7
|
runtimePlugins?: RuntimePlugins;
|
|
7
8
|
implementation?: string;
|
|
8
9
|
shareStrategy?: 'version-first' | 'loaded-first';
|
|
9
|
-
manifest?:
|
|
10
|
+
manifest?: ModuleFederationManifestPluginOptions;
|
|
11
|
+
injectTreeShakingUsedExports?: boolean;
|
|
12
|
+
treeShakingSharedDir?: string;
|
|
13
|
+
treeShakingSharedExcludePlugins?: string[];
|
|
14
|
+
treeShakingSharedPlugins?: string[];
|
|
10
15
|
experiments?: ModuleFederationRuntimeExperimentsOptions;
|
|
11
16
|
}
|
|
12
17
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
13
18
|
export declare class ModuleFederationPlugin {
|
|
14
19
|
private _options;
|
|
20
|
+
private _treeShakingSharedPlugin?;
|
|
15
21
|
constructor(_options: ModuleFederationPluginOptions);
|
|
16
22
|
apply(compiler: Compiler): void;
|
|
17
23
|
}
|
|
24
|
+
interface RemoteInfo {
|
|
25
|
+
alias: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
entry?: string;
|
|
28
|
+
externalType: ExternalsType;
|
|
29
|
+
shareScope: string;
|
|
30
|
+
}
|
|
31
|
+
type RemoteInfos = Record<string, RemoteInfo[]>;
|
|
32
|
+
export declare function getRemoteInfos(options: ModuleFederationPluginOptions): RemoteInfos;
|
|
33
|
+
export {};
|
package/dist/exports.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ type Config = {
|
|
|
43
43
|
export declare const config: Config;
|
|
44
44
|
export type * from './config/index.js';
|
|
45
45
|
export declare const util: {
|
|
46
|
-
createHash: (algorithm: "
|
|
46
|
+
createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash/index.js").default)) => import("./util/hash/index.js").default;
|
|
47
47
|
cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
|
|
48
48
|
};
|
|
49
49
|
export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginArgument, ProvidePluginOptions, } from './builtin-plugin/index.js';
|
|
@@ -121,11 +121,14 @@ export declare const container: {
|
|
|
121
121
|
import { ConsumeSharedPlugin } from './sharing/ConsumeSharedPlugin.js';
|
|
122
122
|
import { ProvideSharedPlugin } from './sharing/ProvideSharedPlugin.js';
|
|
123
123
|
import { SharePlugin } from './sharing/SharePlugin.js';
|
|
124
|
+
import { TreeShakingSharedPlugin } from './sharing/TreeShakingSharedPlugin.js';
|
|
124
125
|
export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, } from './sharing/ConsumeSharedPlugin.js';
|
|
125
126
|
export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject, } from './sharing/ProvideSharedPlugin.js';
|
|
126
127
|
export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions, } from './sharing/SharePlugin.js';
|
|
128
|
+
export type { TreeshakingSharedPluginOptions } from './sharing/TreeShakingSharedPlugin.js';
|
|
127
129
|
export declare const sharing: {
|
|
128
130
|
ProvideSharedPlugin: typeof ProvideSharedPlugin;
|
|
131
|
+
TreeShakingSharedPlugin: typeof TreeShakingSharedPlugin;
|
|
129
132
|
ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
|
|
130
133
|
SharePlugin: typeof SharePlugin;
|
|
131
134
|
};
|
package/dist/index.d.ts
CHANGED