@rspack-debug/core 2.0.0-beta.0 → 2.0.0-beta.2
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/compiled/@rspack/lite-tapable/dist/index.d.ts +175 -0
- package/compiled/@rspack/lite-tapable/license +22 -0
- package/compiled/@rspack/lite-tapable/package.json +1 -0
- package/dist/Compilation.d.ts +2 -1
- package/dist/Compiler.d.ts +1 -1
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/MultiCompiler.d.ts +1 -1
- package/dist/MultiWatching.d.ts +1 -1
- package/dist/NormalModule.d.ts +1 -2
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/Watching.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +1 -1
- package/dist/config/types.d.ts +31 -5
- 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 -1
- package/dist/index.js +1196 -355
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/lib/HookWebpackError.d.ts +1 -1
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/rspack.d.ts +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/stats/StatsFactory.d.ts +1 -1
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/taps/types.d.ts +1 -1
- package/dist/util/createHash.d.ts +1 -1
- package/dist/worker.js +0 -16
- package/package.json +7 -7
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
type FixedSizeArray<T extends number, U> = T extends 0 ? undefined[] : ReadonlyArray<U> & {
|
|
2
|
+
0: U;
|
|
3
|
+
length: T;
|
|
4
|
+
};
|
|
5
|
+
type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
|
|
6
|
+
type Append<T extends any[], U> = {
|
|
7
|
+
0: [U];
|
|
8
|
+
1: [T[0], U];
|
|
9
|
+
2: [T[0], T[1], U];
|
|
10
|
+
3: [T[0], T[1], T[2], U];
|
|
11
|
+
4: [T[0], T[1], T[2], T[3], U];
|
|
12
|
+
5: [T[0], T[1], T[2], T[3], T[4], U];
|
|
13
|
+
6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
|
|
14
|
+
7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
|
|
15
|
+
8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
|
|
16
|
+
}[Measure<T['length']>];
|
|
17
|
+
export type AsArray<T> = T extends any[] ? T : [T];
|
|
18
|
+
export type Fn<T, R> = (...args: AsArray<T>) => R;
|
|
19
|
+
export type FnAsync<T, R> = (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void;
|
|
20
|
+
export type FnPromise<T, R> = (...args: AsArray<T>) => Promise<R>;
|
|
21
|
+
declare class UnsetAdditionalOptions {
|
|
22
|
+
_UnsetAdditionalOptions: true;
|
|
23
|
+
}
|
|
24
|
+
type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;
|
|
25
|
+
export type Callback<E, T> = (error: E | null, result?: T) => void;
|
|
26
|
+
type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;
|
|
27
|
+
type FullTap = Tap & {
|
|
28
|
+
type: 'sync' | 'async' | 'promise';
|
|
29
|
+
fn: Function;
|
|
30
|
+
};
|
|
31
|
+
type Tap = TapOptions & {
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
type TapOptions = {
|
|
35
|
+
before?: string;
|
|
36
|
+
stage?: number;
|
|
37
|
+
};
|
|
38
|
+
export type Options<AdditionalOptions = UnsetAdditionalOptions> = string | (Tap & IfSet<AdditionalOptions>);
|
|
39
|
+
export interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
|
|
40
|
+
name?: string;
|
|
41
|
+
tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
|
|
42
|
+
call?: (...args: any[]) => void;
|
|
43
|
+
loop?: (...args: any[]) => void;
|
|
44
|
+
error?: (err: Error) => void;
|
|
45
|
+
result?: (result: R) => void;
|
|
46
|
+
done?: () => void;
|
|
47
|
+
register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
|
|
48
|
+
}
|
|
49
|
+
type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;
|
|
50
|
+
type ExtractHookArgs<H> = H extends Hook<infer T, any> ? T : never;
|
|
51
|
+
type ExtractHookReturn<H> = H extends Hook<any, infer R> ? R : never;
|
|
52
|
+
type ExtractHookAdditionalOptions<H> = H extends Hook<any, any, infer A> ? A : never;
|
|
53
|
+
export interface Hook<T = any, R = any, AdditionalOptions = UnsetAdditionalOptions> {
|
|
54
|
+
name?: string;
|
|
55
|
+
tap(opt: Options<AdditionalOptions>, fn: Fn<T, R>): void;
|
|
56
|
+
tapAsync(opt: Options<AdditionalOptions>, fn: FnAsync<T, R>): void;
|
|
57
|
+
tapPromise(opt: Options<AdditionalOptions>, fn: FnPromise<T, R>): void;
|
|
58
|
+
intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
|
|
59
|
+
isUsed(): boolean;
|
|
60
|
+
withOptions(opt: TapOptions & IfSet<AdditionalOptions>): Hook<T, R, AdditionalOptions>;
|
|
61
|
+
queryStageRange(stageRange: StageRange): QueriedHook<T, R, AdditionalOptions>;
|
|
62
|
+
}
|
|
63
|
+
export declare class HookBase<T, R, AdditionalOptions = UnsetAdditionalOptions> implements Hook<T, R, AdditionalOptions> {
|
|
64
|
+
args: ArgumentNames<AsArray<T>>;
|
|
65
|
+
name?: string;
|
|
66
|
+
taps: (FullTap & IfSet<AdditionalOptions>)[];
|
|
67
|
+
interceptors: HookInterceptor<T, R, AdditionalOptions>[];
|
|
68
|
+
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
|
|
69
|
+
intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
|
|
70
|
+
_runRegisterInterceptors(options: FullTap & IfSet<AdditionalOptions>): FullTap & IfSet<AdditionalOptions>;
|
|
71
|
+
_runCallInterceptors(...args: any[]): void;
|
|
72
|
+
_runErrorInterceptors(e: Error): void;
|
|
73
|
+
_runTapInterceptors(tap: FullTap & IfSet<AdditionalOptions>): void;
|
|
74
|
+
_runDoneInterceptors(): void;
|
|
75
|
+
_runResultInterceptors(r: R): void;
|
|
76
|
+
withOptions(options: TapOptions & IfSet<AdditionalOptions>): Hook<T, R, AdditionalOptions>;
|
|
77
|
+
isUsed(): boolean;
|
|
78
|
+
queryStageRange(stageRange: StageRange): QueriedHook<T, R, AdditionalOptions>;
|
|
79
|
+
callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
80
|
+
callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
81
|
+
promiseStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): Promise<R>;
|
|
82
|
+
promise(...args: AsArray<T>): Promise<R>;
|
|
83
|
+
tap(options: Options<AdditionalOptions>, fn: Fn<T, R>): void;
|
|
84
|
+
tapAsync(options: Options<AdditionalOptions>, fn: FnAsync<T, R>): void;
|
|
85
|
+
tapPromise(options: Options<AdditionalOptions>, fn: FnPromise<T, R>): void;
|
|
86
|
+
_tap(type: 'sync' | 'async' | 'promise', options: Options<AdditionalOptions>, fn: Function): void;
|
|
87
|
+
_insert(item: FullTap & IfSet<AdditionalOptions>): void;
|
|
88
|
+
_prepareArgs(args: AsArray<T>): (T | undefined)[];
|
|
89
|
+
}
|
|
90
|
+
export type StageRange = readonly [number, number];
|
|
91
|
+
export declare const minStage: number;
|
|
92
|
+
export declare const maxStage: number;
|
|
93
|
+
export declare const safeStage: (stage: number) => number;
|
|
94
|
+
export declare class QueriedHook<T, R, AdditionalOptions = UnsetAdditionalOptions> {
|
|
95
|
+
stageRange: StageRange;
|
|
96
|
+
hook: HookBase<T, R, AdditionalOptions>;
|
|
97
|
+
tapsInRange: (FullTap & IfSet<AdditionalOptions>)[];
|
|
98
|
+
constructor(stageRange: StageRange, hook: HookBase<T, R, AdditionalOptions>);
|
|
99
|
+
isUsed(): boolean;
|
|
100
|
+
call(...args: AsArray<T>): R;
|
|
101
|
+
callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
102
|
+
promise(...args: AsArray<T>): Promise<R>;
|
|
103
|
+
}
|
|
104
|
+
export declare class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
|
|
105
|
+
callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
106
|
+
call(...args: AsArray<T>): R;
|
|
107
|
+
callStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): R;
|
|
108
|
+
tapAsync(): never;
|
|
109
|
+
tapPromise(): never;
|
|
110
|
+
}
|
|
111
|
+
export declare class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
|
|
112
|
+
callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
113
|
+
call(...args: AsArray<T>): R;
|
|
114
|
+
callStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): R;
|
|
115
|
+
tapAsync(): never;
|
|
116
|
+
tapPromise(): never;
|
|
117
|
+
}
|
|
118
|
+
export declare class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
|
|
119
|
+
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
|
|
120
|
+
callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
|
|
121
|
+
call(...args: AsArray<T>): AsArray<T>[0];
|
|
122
|
+
callStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: AsArray<T>): AsArray<T>[0];
|
|
123
|
+
tapAsync(): never;
|
|
124
|
+
tapPromise(): never;
|
|
125
|
+
}
|
|
126
|
+
export declare class AsyncParallelHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, void, AdditionalOptions> {
|
|
127
|
+
callAsyncStageRange(queried: QueriedHook<T, void, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, void>>): void;
|
|
128
|
+
}
|
|
129
|
+
export declare class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, void, AdditionalOptions> {
|
|
130
|
+
callAsyncStageRange(queried: QueriedHook<T, void, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, void>>): void;
|
|
131
|
+
}
|
|
132
|
+
export declare class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
|
|
133
|
+
callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
134
|
+
}
|
|
135
|
+
export declare class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
|
|
136
|
+
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
|
|
137
|
+
callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
|
|
138
|
+
}
|
|
139
|
+
export type HookMapKey = any;
|
|
140
|
+
export type HookFactory<H> = (key: HookMapKey, hook?: H) => H;
|
|
141
|
+
export interface HookMapInterceptor<H> {
|
|
142
|
+
factory?: HookFactory<H>;
|
|
143
|
+
}
|
|
144
|
+
export declare class HookMap<H extends Hook> {
|
|
145
|
+
_map: Map<HookMapKey, H>;
|
|
146
|
+
_factory: HookFactory<H>;
|
|
147
|
+
name?: string;
|
|
148
|
+
_interceptors: HookMapInterceptor<H>[];
|
|
149
|
+
constructor(factory: HookFactory<H>, name?: string);
|
|
150
|
+
get(key: HookMapKey): H | undefined;
|
|
151
|
+
for(key: HookMapKey): H;
|
|
152
|
+
intercept(interceptor: HookMapInterceptor<H>): void;
|
|
153
|
+
isUsed(): boolean;
|
|
154
|
+
queryStageRange(stageRange: StageRange): QueriedHookMap<H>;
|
|
155
|
+
}
|
|
156
|
+
export declare class QueriedHookMap<H extends Hook> {
|
|
157
|
+
stageRange: StageRange;
|
|
158
|
+
hookMap: HookMap<H>;
|
|
159
|
+
constructor(stageRange: StageRange, hookMap: HookMap<H>);
|
|
160
|
+
get(key: HookMapKey): QueriedHook<any, any, UnsetAdditionalOptions> | undefined;
|
|
161
|
+
for(key: HookMapKey): QueriedHook<any, any, UnsetAdditionalOptions>;
|
|
162
|
+
isUsed(): boolean;
|
|
163
|
+
}
|
|
164
|
+
export declare class MultiHook<H extends Hook> {
|
|
165
|
+
hooks: H[];
|
|
166
|
+
name?: string;
|
|
167
|
+
constructor(hooks: H[], name?: string);
|
|
168
|
+
tap(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: Fn<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
|
|
169
|
+
tapAsync(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: FnAsync<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
|
|
170
|
+
tapPromise(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: FnPromise<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
|
|
171
|
+
isUsed(): boolean;
|
|
172
|
+
intercept(interceptor: HookInterceptor<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>, ExtractHookAdditionalOptions<Hook>>): void;
|
|
173
|
+
withOptions(options: TapOptions & IfSet<ExtractHookAdditionalOptions<Hook>>): MultiHook<Hook<any, any, UnsetAdditionalOptions>>;
|
|
174
|
+
}
|
|
175
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@rspack/lite-tapable","version":"1.1.0","license":"MIT","types":"./dist/index.d.ts","type":"module"}
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
|
|
11
11
|
import binding from '@rspack/binding';
|
|
12
12
|
export type { AssetInfo } from '@rspack/binding';
|
|
13
|
-
import * as liteTapable from '
|
|
13
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
14
14
|
import type { Source } from '../compiled/webpack-sources';
|
|
15
15
|
import type { EntryOptions, EntryPlugin } from './builtin-plugin/index.js';
|
|
16
16
|
import type { Chunk } from './Chunk.js';
|
|
@@ -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]>;
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import type binding from '@rspack/binding';
|
|
11
|
-
import * as liteTapable from '
|
|
11
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
12
12
|
import type Watchpack from '../compiled/watchpack';
|
|
13
13
|
import type { Source } from '../compiled/webpack-sources';
|
|
14
14
|
import type { Chunk } from './Chunk.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as liteTapable from '
|
|
1
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
2
2
|
import type { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from './Module.js';
|
|
3
3
|
export declare class ContextModuleFactory {
|
|
4
4
|
hooks: {
|
package/dist/MultiCompiler.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import * as liteTapable from '
|
|
10
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
11
11
|
import type { CompilationParams, Compiler, CompilerHooks, RspackOptions } from './index.js';
|
|
12
12
|
import type { WatchOptions } from './config/index.js';
|
|
13
13
|
import MultiStats from './MultiStats.js';
|
package/dist/MultiWatching.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import type { Callback } from '
|
|
10
|
+
import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
11
11
|
import type { MultiCompiler } from './MultiCompiler.js';
|
|
12
12
|
import type { Watching } from './Watching.js';
|
|
13
13
|
declare class MultiWatching {
|
package/dist/NormalModule.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as liteTapable from '
|
|
1
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
2
2
|
import type { Compilation } from './Compilation.js';
|
|
3
3
|
import type { LoaderContext } from './config/index.js';
|
|
4
4
|
import type { Module } from './Module.js';
|
|
5
5
|
export interface NormalModuleCompilationHooks {
|
|
6
6
|
loader: liteTapable.SyncHook<[LoaderContext, Module]>;
|
|
7
|
-
readResourceForScheme: any;
|
|
8
7
|
readResource: liteTapable.HookMap<liteTapable.AsyncSeriesBailHook<[LoaderContext], string | Buffer>>;
|
|
9
8
|
}
|
|
10
9
|
declare module '@rspack/binding' {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type binding from '@rspack/binding';
|
|
2
|
-
import * as liteTapable from '
|
|
2
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
3
3
|
import type { ResolveData, ResourceDataWithData } from './Module.js';
|
|
4
4
|
import type { ResolveOptionsWithDependencyType, ResolverFactory } from './ResolverFactory.js';
|
|
5
5
|
export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
|
package/dist/RuntimeGlobals.d.ts
CHANGED
|
@@ -352,5 +352,5 @@ export declare enum RuntimeVariable {
|
|
|
352
352
|
}
|
|
353
353
|
export declare function renderRuntimeVariables(variable: RuntimeVariable, _compilerOptions?: RspackOptionsNormalized): string;
|
|
354
354
|
export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
|
|
355
|
-
declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "
|
|
355
|
+
declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "exports" | "require" | "global" | "system" | "requireScope" | "thisAsExports" | "returnExportsFromRuntime" | "moduleLoaded" | "entryModuleId" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "definePropertyGetters" | "makeNamespaceObject" | "createFakeNamespaceObject" | "compatGetDefaultExport" | "harmonyModuleDecorator" | "nodeModuleDecorator" | "getFullHash" | "wasmInstances" | "instantiateWasm" | "uncaughtErrorHandler" | "scriptNonce" | "loadScript" | "createScript" | "createScriptUrl" | "getTrustedTypesPolicy" | "hasFetchPriority" | "runtimeId" | "getChunkScriptFilename" | "getChunkCssFilename" | "rspackVersion" | "hasCssModules" | "rspackUniqueId" | "getChunkUpdateScriptFilename" | "getChunkUpdateCssFilename" | "startup" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "chunkCallback" | "startupEntrypoint" | "startupChunkDependencies" | "onChunksLoaded" | "externalInstallChunk" | "interceptModuleExecution" | "shareScopeMap" | "initializeSharing" | "currentRemoteGetScope" | "getUpdateManifestFilename" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrModuleData" | "hmrInvalidateModuleHandlers" | "hmrRuntimeStatePrefix" | "amdDefine" | "amdOptions" | "hasOwnProperty" | "systemContext" | "baseURI" | "relativeUrl" | "asyncModule" | "asyncModuleExportSymbol" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol", string>;
|
|
356
356
|
export { DefaultRuntimeGlobals as RuntimeGlobals };
|
package/dist/Watching.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import type { Callback } from '
|
|
10
|
+
import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d';
|
|
11
11
|
import type { Compiler } from './index.js';
|
|
12
12
|
import { Stats } from './index.js';
|
|
13
13
|
import type { WatchOptions } from './config/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
2
|
-
import * as liteTapable from '
|
|
2
|
+
import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
|
|
3
3
|
import type { Chunk } from '../Chunk.js';
|
|
4
4
|
import { type Compilation } from '../Compilation.js';
|
|
5
5
|
import type Hash from '../util/hash/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
|
|
2
|
-
import * as liteTapable from '
|
|
2
|
+
import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
|
|
3
3
|
import { type Compilation } from '../Compilation.js';
|
|
4
4
|
import type { Compiler } from '../Compiler.js';
|
|
5
5
|
import type { CreatePartialRegisters } from '../taps/types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import binding from '@rspack/binding';
|
|
2
|
-
import * as liteTapable from '
|
|
2
|
+
import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
|
|
3
3
|
import type { Chunk } from '../Chunk.js';
|
|
4
4
|
import { type Compilation } from '../Compilation.js';
|
|
5
5
|
import type { CreatePartialRegisters } from '../taps/types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JsAfterEmitData, JsAfterTemplateExecutionData, JsAlterAssetTagGroupsData, JsAlterAssetTagsData, JsBeforeAssetTagGenerationData, JsBeforeEmitData } from '@rspack/binding';
|
|
2
|
-
import * as liteTapable from '
|
|
2
|
+
import * as liteTapable from '../../../compiled/@rspack/lite-tapable/dist/index.d';
|
|
3
3
|
import { type Compilation } from '../../Compilation.js';
|
|
4
4
|
import type { HtmlRspackPluginOptions } from './options.js';
|
|
5
5
|
type ExtraPluginHookData = {
|
|
@@ -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
|
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. */
|
|
@@ -1299,6 +1319,12 @@ export type PersistentCacheOptions = {
|
|
|
1299
1319
|
* @default false
|
|
1300
1320
|
*/
|
|
1301
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;
|
|
1302
1328
|
};
|
|
1303
1329
|
/**
|
|
1304
1330
|
* Memory cache options.
|
|
@@ -2031,7 +2057,7 @@ export type LazyCompilationOptions = {
|
|
|
2031
2057
|
serverUrl?: string;
|
|
2032
2058
|
/**
|
|
2033
2059
|
* Customize the prefix used for lazy compilation endpoint.
|
|
2034
|
-
* @default "/lazy
|
|
2060
|
+
* @default "/_rspack/lazy/trigger"
|
|
2035
2061
|
*/
|
|
2036
2062
|
prefix?: string;
|
|
2037
2063
|
};
|
|
@@ -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