@rspack/core 0.5.7-canary-fcec5af-20240319092639 → 0.5.8
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/Watching.d.ts +0 -1
- package/dist/Watching.js +0 -3
- package/dist/builtin-plugin/index.d.ts +0 -1
- package/dist/builtin-plugin/index.js +0 -1
- package/dist/config/normalization.d.ts +2 -2
- package/dist/config/normalization.js +1 -2
- package/dist/config/zod.d.ts +10 -103
- package/dist/config/zod.js +1 -8
- package/dist/exports.d.ts +4 -16
- package/dist/rspackOptionsApply.js +1 -12
- package/package.json +5 -5
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +0 -52
- package/dist/builtin-plugin/lazy-compilation/backend.js +0 -143
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +0 -30
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
- package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +0 -13
- package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
package/dist/Watching.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export declare class Watching {
|
|
|
33
33
|
watch(files: Iterable<string>, dirs: Iterable<string>, missing: Iterable<string>): void;
|
|
34
34
|
close(callback?: () => void): void;
|
|
35
35
|
invalidate(callback?: Callback<Error, void>): void;
|
|
36
|
-
lazyCompilationInvalidate(files: Set<string>): void;
|
|
37
36
|
/**
|
|
38
37
|
* The reason why this is _done instead of #done, is that in Webpack,
|
|
39
38
|
* it will rewrite this function to another function
|
package/dist/Watching.js
CHANGED
|
@@ -150,9 +150,6 @@ class Watching {
|
|
|
150
150
|
this.onChange();
|
|
151
151
|
__classPrivateFieldGet(this, _Watching_instances, "m", _Watching_invalidate).call(this);
|
|
152
152
|
}
|
|
153
|
-
lazyCompilationInvalidate(files) {
|
|
154
|
-
__classPrivateFieldGet(this, _Watching_instances, "m", _Watching_invalidate).call(this, new Map(), new Map(), files, new Set());
|
|
155
|
-
}
|
|
156
153
|
_done(error, compilation) {
|
|
157
154
|
this.running = false;
|
|
158
155
|
let stats = undefined;
|
|
@@ -51,7 +51,6 @@ export * from "./CopyRspackPlugin";
|
|
|
51
51
|
export * from "./SwcJsMinimizerPlugin";
|
|
52
52
|
export * from "./SwcCssMinimizerPlugin";
|
|
53
53
|
export * from "./JsLoaderRspackPlugin";
|
|
54
|
-
export * from "./lazy-compilation/plugin";
|
|
55
54
|
import { RawBuiltins, RawCssModulesConfig } from "@rspack/binding";
|
|
56
55
|
import { RspackOptionsNormalized } from "..";
|
|
57
56
|
type BuiltinsCssConfig = {
|
|
@@ -69,7 +69,6 @@ __exportStar(require("./CopyRspackPlugin"), exports);
|
|
|
69
69
|
__exportStar(require("./SwcJsMinimizerPlugin"), exports);
|
|
70
70
|
__exportStar(require("./SwcCssMinimizerPlugin"), exports);
|
|
71
71
|
__exportStar(require("./JsLoaderRspackPlugin"), exports);
|
|
72
|
-
__exportStar(require("./lazy-compilation/plugin"), exports);
|
|
73
72
|
function resolveTreeShaking(treeShaking, production) {
|
|
74
73
|
return treeShaking !== undefined
|
|
75
74
|
? treeShaking.toString()
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import { Compilation } from "..";
|
|
11
|
-
import type { Context, Dependencies, Node, DevTool, Externals, ExternalsPresets, ExternalsType, InfrastructureLogging, LibraryOptions, Mode, Name, Resolve, RspackOptions, Target, SnapshotOptions, CacheOptions, StatsValue, Optimization, Plugins, Watch, WatchOptions, DevServer, Profile, Bail, Builtins, EntryRuntime, ChunkLoading, PublicPath, EntryFilename, Path, Clean, Filename, ChunkFilename, CrossOriginLoading, CssFilename, CssChunkFilename, HotUpdateMainFilename, HotUpdateChunkFilename, AssetModuleFilename, UniqueName, ChunkLoadingGlobal, EnabledLibraryTypes, OutputModule, StrictModuleErrorHandling, GlobalObject, ImportFunctionName, Iife, WasmLoading, EnabledWasmLoadingTypes, WebassemblyModuleFilename, TrustedTypes, SourceMapFilename, HashDigest, HashDigestLength, HashFunction, HashSalt, WorkerPublicPath, RuleSetRules, ParserOptionsByModuleType, GeneratorOptionsByModuleType, RspackFutureOptions, HotUpdateGlobal, ScriptType, NoParseOption, DevtoolNamespace, DevtoolModuleFilenameTemplate, DevtoolFallbackModuleFilenameTemplate
|
|
11
|
+
import type { Context, Dependencies, Node, DevTool, Externals, ExternalsPresets, ExternalsType, InfrastructureLogging, LibraryOptions, Mode, Name, Resolve, RspackOptions, Target, SnapshotOptions, CacheOptions, StatsValue, Optimization, Plugins, Watch, WatchOptions, DevServer, Profile, Bail, Builtins, EntryRuntime, ChunkLoading, PublicPath, EntryFilename, Path, Clean, Filename, ChunkFilename, CrossOriginLoading, CssFilename, CssChunkFilename, HotUpdateMainFilename, HotUpdateChunkFilename, AssetModuleFilename, UniqueName, ChunkLoadingGlobal, EnabledLibraryTypes, OutputModule, StrictModuleErrorHandling, GlobalObject, ImportFunctionName, Iife, WasmLoading, EnabledWasmLoadingTypes, WebassemblyModuleFilename, TrustedTypes, SourceMapFilename, HashDigest, HashDigestLength, HashFunction, HashSalt, WorkerPublicPath, RuleSetRules, ParserOptionsByModuleType, GeneratorOptionsByModuleType, RspackFutureOptions, HotUpdateGlobal, ScriptType, NoParseOption, DevtoolNamespace, DevtoolModuleFilenameTemplate, DevtoolFallbackModuleFilenameTemplate } from "./zod";
|
|
12
12
|
export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
|
|
13
13
|
export type EntryNormalized = EntryStaticNormalized;
|
|
14
14
|
export interface EntryStaticNormalized {
|
|
@@ -75,7 +75,7 @@ export interface ModuleOptionsNormalized {
|
|
|
75
75
|
noParse?: NoParseOption;
|
|
76
76
|
}
|
|
77
77
|
export interface ExperimentsNormalized {
|
|
78
|
-
lazyCompilation?:
|
|
78
|
+
lazyCompilation?: boolean;
|
|
79
79
|
asyncWebAssembly?: boolean;
|
|
80
80
|
outputModule?: boolean;
|
|
81
81
|
newSplitChunks?: boolean;
|
|
@@ -183,8 +183,7 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
183
183
|
}),
|
|
184
184
|
plugins: nestedArray(config.plugins, p => [...p]),
|
|
185
185
|
experiments: nestedConfig(config.experiments, experiments => ({
|
|
186
|
-
...experiments
|
|
187
|
-
lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, options => (options === true ? {} : options))
|
|
186
|
+
...experiments
|
|
188
187
|
})),
|
|
189
188
|
watch: config.watch,
|
|
190
189
|
watchOptions: cloneObject(config.watchOptions),
|
package/dist/config/zod.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type * as oldBuiltins from "../builtin-plugin";
|
|
|
6
6
|
import type * as webpackDevServer from "webpack-dev-server";
|
|
7
7
|
import { Module } from "../Module";
|
|
8
8
|
import { Chunk } from "../Chunk";
|
|
9
|
-
import { LazyCompilationDefaultBackendOptions } from "../builtin-plugin/lazy-compilation/backend";
|
|
10
9
|
declare const name: z.ZodString;
|
|
11
10
|
export type Name = z.infer<typeof name>;
|
|
12
11
|
declare const dependencies: z.ZodArray<z.ZodString, "many">;
|
|
@@ -3343,46 +3342,8 @@ declare const rspackFutureOptions: z.ZodObject<{
|
|
|
3343
3342
|
} | undefined;
|
|
3344
3343
|
}>;
|
|
3345
3344
|
export type RspackFutureOptions = z.infer<typeof rspackFutureOptions>;
|
|
3346
|
-
declare const lazyCompilationOptions: z.ZodObject<{
|
|
3347
|
-
cacheable: z.ZodOptional<z.ZodBoolean>;
|
|
3348
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3349
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3350
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3351
|
-
backend: z.ZodOptional<z.ZodType<LazyCompilationDefaultBackendOptions, z.ZodTypeDef, LazyCompilationDefaultBackendOptions>>;
|
|
3352
|
-
}, "strip", z.ZodTypeAny, {
|
|
3353
|
-
cacheable?: boolean | undefined;
|
|
3354
|
-
imports?: boolean | undefined;
|
|
3355
|
-
entries?: boolean | undefined;
|
|
3356
|
-
test?: RegExp | undefined;
|
|
3357
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3358
|
-
}, {
|
|
3359
|
-
cacheable?: boolean | undefined;
|
|
3360
|
-
imports?: boolean | undefined;
|
|
3361
|
-
entries?: boolean | undefined;
|
|
3362
|
-
test?: RegExp | undefined;
|
|
3363
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3364
|
-
}>;
|
|
3365
|
-
export type LazyCompilationOptions = z.infer<typeof lazyCompilationOptions>;
|
|
3366
3345
|
declare const experiments: z.ZodObject<{
|
|
3367
|
-
lazyCompilation: z.
|
|
3368
|
-
cacheable: z.ZodOptional<z.ZodBoolean>;
|
|
3369
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3370
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3371
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3372
|
-
backend: z.ZodOptional<z.ZodType<LazyCompilationDefaultBackendOptions, z.ZodTypeDef, LazyCompilationDefaultBackendOptions>>;
|
|
3373
|
-
}, "strip", z.ZodTypeAny, {
|
|
3374
|
-
cacheable?: boolean | undefined;
|
|
3375
|
-
imports?: boolean | undefined;
|
|
3376
|
-
entries?: boolean | undefined;
|
|
3377
|
-
test?: RegExp | undefined;
|
|
3378
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3379
|
-
}, {
|
|
3380
|
-
cacheable?: boolean | undefined;
|
|
3381
|
-
imports?: boolean | undefined;
|
|
3382
|
-
entries?: boolean | undefined;
|
|
3383
|
-
test?: RegExp | undefined;
|
|
3384
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3385
|
-
}>]>;
|
|
3346
|
+
lazyCompilation: z.ZodOptional<z.ZodBoolean>;
|
|
3386
3347
|
asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
|
|
3387
3348
|
outputModule: z.ZodOptional<z.ZodBoolean>;
|
|
3388
3349
|
topLevelAwait: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3418,13 +3379,7 @@ declare const experiments: z.ZodObject<{
|
|
|
3418
3379
|
} | undefined;
|
|
3419
3380
|
}>>;
|
|
3420
3381
|
}, "strict", z.ZodTypeAny, {
|
|
3421
|
-
lazyCompilation?: boolean |
|
|
3422
|
-
cacheable?: boolean | undefined;
|
|
3423
|
-
imports?: boolean | undefined;
|
|
3424
|
-
entries?: boolean | undefined;
|
|
3425
|
-
test?: RegExp | undefined;
|
|
3426
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3427
|
-
} | undefined;
|
|
3382
|
+
lazyCompilation?: boolean | undefined;
|
|
3428
3383
|
asyncWebAssembly?: boolean | undefined;
|
|
3429
3384
|
outputModule?: boolean | undefined;
|
|
3430
3385
|
topLevelAwait?: boolean | undefined;
|
|
@@ -3440,13 +3395,7 @@ declare const experiments: z.ZodObject<{
|
|
|
3440
3395
|
} | undefined;
|
|
3441
3396
|
} | undefined;
|
|
3442
3397
|
}, {
|
|
3443
|
-
lazyCompilation?: boolean |
|
|
3444
|
-
cacheable?: boolean | undefined;
|
|
3445
|
-
imports?: boolean | undefined;
|
|
3446
|
-
entries?: boolean | undefined;
|
|
3447
|
-
test?: RegExp | undefined;
|
|
3448
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3449
|
-
} | undefined;
|
|
3398
|
+
lazyCompilation?: boolean | undefined;
|
|
3450
3399
|
asyncWebAssembly?: boolean | undefined;
|
|
3451
3400
|
outputModule?: boolean | undefined;
|
|
3452
3401
|
topLevelAwait?: boolean | undefined;
|
|
@@ -3928,25 +3877,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3928
3877
|
target: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "browserslist"]>, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>]>, z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "browserslist"]>, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>, "many">]>>;
|
|
3929
3878
|
mode: z.ZodOptional<z.ZodEnum<["development", "production", "none"]>>;
|
|
3930
3879
|
experiments: z.ZodOptional<z.ZodObject<{
|
|
3931
|
-
lazyCompilation: z.
|
|
3932
|
-
cacheable: z.ZodOptional<z.ZodBoolean>;
|
|
3933
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3934
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3935
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3936
|
-
backend: z.ZodOptional<z.ZodType<LazyCompilationDefaultBackendOptions, z.ZodTypeDef, LazyCompilationDefaultBackendOptions>>;
|
|
3937
|
-
}, "strip", z.ZodTypeAny, {
|
|
3938
|
-
cacheable?: boolean | undefined;
|
|
3939
|
-
imports?: boolean | undefined;
|
|
3940
|
-
entries?: boolean | undefined;
|
|
3941
|
-
test?: RegExp | undefined;
|
|
3942
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3943
|
-
}, {
|
|
3944
|
-
cacheable?: boolean | undefined;
|
|
3945
|
-
imports?: boolean | undefined;
|
|
3946
|
-
entries?: boolean | undefined;
|
|
3947
|
-
test?: RegExp | undefined;
|
|
3948
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3949
|
-
}>]>;
|
|
3880
|
+
lazyCompilation: z.ZodOptional<z.ZodBoolean>;
|
|
3950
3881
|
asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
|
|
3951
3882
|
outputModule: z.ZodOptional<z.ZodBoolean>;
|
|
3952
3883
|
topLevelAwait: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3982,13 +3913,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3982
3913
|
} | undefined;
|
|
3983
3914
|
}>>;
|
|
3984
3915
|
}, "strict", z.ZodTypeAny, {
|
|
3985
|
-
lazyCompilation?: boolean |
|
|
3986
|
-
cacheable?: boolean | undefined;
|
|
3987
|
-
imports?: boolean | undefined;
|
|
3988
|
-
entries?: boolean | undefined;
|
|
3989
|
-
test?: RegExp | undefined;
|
|
3990
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
3991
|
-
} | undefined;
|
|
3916
|
+
lazyCompilation?: boolean | undefined;
|
|
3992
3917
|
asyncWebAssembly?: boolean | undefined;
|
|
3993
3918
|
outputModule?: boolean | undefined;
|
|
3994
3919
|
topLevelAwait?: boolean | undefined;
|
|
@@ -4004,13 +3929,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
4004
3929
|
} | undefined;
|
|
4005
3930
|
} | undefined;
|
|
4006
3931
|
}, {
|
|
4007
|
-
lazyCompilation?: boolean |
|
|
4008
|
-
cacheable?: boolean | undefined;
|
|
4009
|
-
imports?: boolean | undefined;
|
|
4010
|
-
entries?: boolean | undefined;
|
|
4011
|
-
test?: RegExp | undefined;
|
|
4012
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
4013
|
-
} | undefined;
|
|
3932
|
+
lazyCompilation?: boolean | undefined;
|
|
4014
3933
|
asyncWebAssembly?: boolean | undefined;
|
|
4015
3934
|
outputModule?: boolean | undefined;
|
|
4016
3935
|
topLevelAwait?: boolean | undefined;
|
|
@@ -5007,16 +4926,10 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5007
4926
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5008
4927
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5009
4928
|
} | undefined;
|
|
5010
|
-
target?: false | "node" | "async-node" | "
|
|
4929
|
+
target?: false | "node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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` | ("node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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`)[] | undefined;
|
|
5011
4930
|
mode?: "production" | "development" | "none" | undefined;
|
|
5012
4931
|
experiments?: {
|
|
5013
|
-
lazyCompilation?: boolean |
|
|
5014
|
-
cacheable?: boolean | undefined;
|
|
5015
|
-
imports?: boolean | undefined;
|
|
5016
|
-
entries?: boolean | undefined;
|
|
5017
|
-
test?: RegExp | undefined;
|
|
5018
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
5019
|
-
} | undefined;
|
|
4932
|
+
lazyCompilation?: boolean | undefined;
|
|
5020
4933
|
asyncWebAssembly?: boolean | undefined;
|
|
5021
4934
|
outputModule?: boolean | undefined;
|
|
5022
4935
|
topLevelAwait?: boolean | undefined;
|
|
@@ -5345,16 +5258,10 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5345
5258
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5346
5259
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5347
5260
|
} | undefined;
|
|
5348
|
-
target?: false | "node" | "async-node" | "
|
|
5261
|
+
target?: false | "node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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` | ("node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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`)[] | undefined;
|
|
5349
5262
|
mode?: "production" | "development" | "none" | undefined;
|
|
5350
5263
|
experiments?: {
|
|
5351
|
-
lazyCompilation?: boolean |
|
|
5352
|
-
cacheable?: boolean | undefined;
|
|
5353
|
-
imports?: boolean | undefined;
|
|
5354
|
-
entries?: boolean | undefined;
|
|
5355
|
-
test?: RegExp | undefined;
|
|
5356
|
-
backend?: LazyCompilationDefaultBackendOptions | undefined;
|
|
5357
|
-
} | undefined;
|
|
5264
|
+
lazyCompilation?: boolean | undefined;
|
|
5358
5265
|
asyncWebAssembly?: boolean | undefined;
|
|
5359
5266
|
outputModule?: boolean | undefined;
|
|
5360
5267
|
topLevelAwait?: boolean | undefined;
|
package/dist/config/zod.js
CHANGED
|
@@ -697,15 +697,8 @@ const rspackFutureOptions = zod_1.z.strictObject({
|
|
|
697
697
|
})
|
|
698
698
|
.optional()
|
|
699
699
|
});
|
|
700
|
-
const lazyCompilationOptions = zod_1.z.object({
|
|
701
|
-
cacheable: zod_1.z.boolean().optional(),
|
|
702
|
-
imports: zod_1.z.boolean().optional(),
|
|
703
|
-
entries: zod_1.z.boolean().optional(),
|
|
704
|
-
test: zod_1.z.instanceof(RegExp).optional(),
|
|
705
|
-
backend: zod_1.z.custom().optional()
|
|
706
|
-
});
|
|
707
700
|
const experiments = zod_1.z.strictObject({
|
|
708
|
-
lazyCompilation: zod_1.z.boolean().optional()
|
|
701
|
+
lazyCompilation: zod_1.z.boolean().optional(),
|
|
709
702
|
asyncWebAssembly: zod_1.z.boolean().optional(),
|
|
710
703
|
outputModule: zod_1.z.boolean().optional(),
|
|
711
704
|
topLevelAwait: zod_1.z.boolean().optional(),
|
package/dist/exports.d.ts
CHANGED
|
@@ -128,16 +128,10 @@ export declare const config: {
|
|
|
128
128
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
129
129
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
130
130
|
} | undefined;
|
|
131
|
-
target?: false | "node" | "async-node" | "
|
|
131
|
+
target?: false | "node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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` | ("node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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`)[] | undefined;
|
|
132
132
|
mode?: "production" | "development" | "none" | undefined;
|
|
133
133
|
experiments?: {
|
|
134
|
-
lazyCompilation?: boolean |
|
|
135
|
-
cacheable?: boolean | undefined;
|
|
136
|
-
imports?: boolean | undefined;
|
|
137
|
-
entries?: boolean | undefined;
|
|
138
|
-
test?: RegExp | undefined;
|
|
139
|
-
backend?: import("./builtin-plugin/lazy-compilation/backend").LazyCompilationDefaultBackendOptions | undefined;
|
|
140
|
-
} | undefined;
|
|
134
|
+
lazyCompilation?: boolean | undefined;
|
|
141
135
|
asyncWebAssembly?: boolean | undefined;
|
|
142
136
|
outputModule?: boolean | undefined;
|
|
143
137
|
topLevelAwait?: boolean | undefined;
|
|
@@ -468,16 +462,10 @@ export declare const config: {
|
|
|
468
462
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
469
463
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
470
464
|
} | undefined;
|
|
471
|
-
target?: false | "node" | "async-node" | "
|
|
465
|
+
target?: false | "node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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` | ("node" | "async-node" | "es5" | "web" | "webworker" | "es3" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | `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`)[] | undefined;
|
|
472
466
|
mode?: "production" | "development" | "none" | undefined;
|
|
473
467
|
experiments?: {
|
|
474
|
-
lazyCompilation?: boolean |
|
|
475
|
-
cacheable?: boolean | undefined;
|
|
476
|
-
imports?: boolean | undefined;
|
|
477
|
-
entries?: boolean | undefined;
|
|
478
|
-
test?: RegExp | undefined;
|
|
479
|
-
backend?: import("./builtin-plugin/lazy-compilation/backend").LazyCompilationDefaultBackendOptions | undefined;
|
|
480
|
-
} | undefined;
|
|
468
|
+
lazyCompilation?: boolean | undefined;
|
|
481
469
|
asyncWebAssembly?: boolean | undefined;
|
|
482
470
|
outputModule?: boolean | undefined;
|
|
483
471
|
topLevelAwait?: boolean | undefined;
|
|
@@ -30,7 +30,7 @@ exports.applyEntryOptions = applyEntryOptions;
|
|
|
30
30
|
class RspackOptionsApply {
|
|
31
31
|
constructor() { }
|
|
32
32
|
process(options, compiler) {
|
|
33
|
-
var _a
|
|
33
|
+
var _a;
|
|
34
34
|
(0, assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
|
|
35
35
|
compiler.outputPath = options.output.path;
|
|
36
36
|
compiler.name = options.name;
|
|
@@ -171,17 +171,6 @@ class RspackOptionsApply {
|
|
|
171
171
|
new builtin_plugin_1.MangleExportsPlugin(options.optimization.mangleExports !== "size").apply(compiler);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
if (options.experiments.lazyCompilation) {
|
|
175
|
-
const lazyOptions = options.experiments.lazyCompilation;
|
|
176
|
-
new builtin_plugin_1.LazyCompilationPlugin(
|
|
177
|
-
// this is only for test
|
|
178
|
-
(_b = lazyOptions.cacheable) !== null && _b !== void 0 ? _b : true, (_c = lazyOptions.entries) !== null && _c !== void 0 ? _c : true, (_d = lazyOptions.imports) !== null && _d !== void 0 ? _d : true, lazyOptions.test
|
|
179
|
-
? {
|
|
180
|
-
source: lazyOptions.test.source,
|
|
181
|
-
flags: lazyOptions.test.flags
|
|
182
|
-
}
|
|
183
|
-
: undefined, lazyOptions.backend).apply(compiler);
|
|
184
|
-
}
|
|
185
174
|
if (options.output.enabledLibraryTypes &&
|
|
186
175
|
options.output.enabledLibraryTypes.length > 0) {
|
|
187
176
|
for (const type of options.output.enabledLibraryTypes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"styled-components": "^6.0.8",
|
|
56
56
|
"terser": "5.27.2",
|
|
57
57
|
"wast-loader": "^1.11.4",
|
|
58
|
-
"@rspack/
|
|
59
|
-
"@rspack/plugin-node-polyfill": "^0.5.
|
|
60
|
-
"@rspack/
|
|
58
|
+
"@rspack/plugin-minify": "^0.5.8",
|
|
59
|
+
"@rspack/plugin-node-polyfill": "^0.5.8",
|
|
60
|
+
"@rspack/core": "0.5.8"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@module-federation/runtime-tools": "0.0.8",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"webpack-sources": "3.2.3",
|
|
73
73
|
"zod": "^3.21.4",
|
|
74
74
|
"zod-validation-error": "1.3.1",
|
|
75
|
-
"@rspack/binding": "0.5.
|
|
75
|
+
"@rspack/binding": "0.5.8"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@swc/helpers": ">=0.5.1"
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
|
-
import type { IncomingMessage, ServerResponse, ServerOptions as ServerOptionsImport } from "http";
|
|
6
|
-
import type { ListenOptions, Server } from "net";
|
|
7
|
-
import type { Compiler } from "../..";
|
|
8
|
-
import type { SecureContextOptions, TlsOptions } from "tls";
|
|
9
|
-
export interface LazyCompilationDefaultBackendOptions {
|
|
10
|
-
/**
|
|
11
|
-
* A custom client.
|
|
12
|
-
*/
|
|
13
|
-
client?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Specifies where to listen to from the server.
|
|
16
|
-
*/
|
|
17
|
-
listen?: number | ListenOptions | ((server: Server) => void);
|
|
18
|
-
/**
|
|
19
|
-
* Specifies the protocol the client should use to connect to the server.
|
|
20
|
-
*/
|
|
21
|
-
protocol?: "http" | "https";
|
|
22
|
-
/**
|
|
23
|
-
* Specifies how to create the server handling the EventSource requests.
|
|
24
|
-
*/
|
|
25
|
-
server?: ServerOptionsImport<typeof IncomingMessage> | ServerOptionsHttps<typeof IncomingMessage, typeof ServerResponse> | (() => Server);
|
|
26
|
-
}
|
|
27
|
-
export type ServerOptionsHttps<Request extends typeof IncomingMessage = typeof IncomingMessage, Response extends typeof ServerResponse = typeof ServerResponse> = SecureContextOptions & TlsOptions & ServerOptionsImport<Request, Response>;
|
|
28
|
-
/**
|
|
29
|
-
* @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>}} options additional options for the backend
|
|
30
|
-
* @returns {BackendHandler} backend
|
|
31
|
-
*/
|
|
32
|
-
declare const getBackend: (options: any) => (compiler: Compiler, callback: (err: any, obj?: {
|
|
33
|
-
dispose: (callback: (err: any) => void) => void;
|
|
34
|
-
module: (args: {
|
|
35
|
-
module: string;
|
|
36
|
-
path: string;
|
|
37
|
-
}) => {
|
|
38
|
-
data: string;
|
|
39
|
-
client: string;
|
|
40
|
-
active: boolean;
|
|
41
|
-
};
|
|
42
|
-
} | undefined) => void) => void;
|
|
43
|
-
export default getBackend;
|
|
44
|
-
export declare function dispose(callback: any): void;
|
|
45
|
-
export declare function moduleImpl(args: {
|
|
46
|
-
module: string;
|
|
47
|
-
path: string;
|
|
48
|
-
}): {
|
|
49
|
-
active: boolean;
|
|
50
|
-
data: string;
|
|
51
|
-
client: string;
|
|
52
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.moduleImpl = exports.dispose = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>}} options additional options for the backend
|
|
10
|
-
* @returns {BackendHandler} backend
|
|
11
|
-
*/
|
|
12
|
-
const getBackend = (options) => (compiler, callback) => {
|
|
13
|
-
const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
|
|
14
|
-
const activeModules = new Map();
|
|
15
|
-
const filesByKey = new Map();
|
|
16
|
-
const prefix = "/lazy-compilation-using-";
|
|
17
|
-
const isHttps = options.protocol === "https" ||
|
|
18
|
-
(typeof options.server === "object" &&
|
|
19
|
-
("key" in options.server || "pfx" in options.server));
|
|
20
|
-
const createServer = typeof options.server === "function"
|
|
21
|
-
? options.server
|
|
22
|
-
: (() => {
|
|
23
|
-
const http = isHttps ? require("https") : require("http");
|
|
24
|
-
return http.createServer.bind(http, options.server);
|
|
25
|
-
})();
|
|
26
|
-
const listen = typeof options.listen === "function"
|
|
27
|
-
? options.listen
|
|
28
|
-
: (server) => {
|
|
29
|
-
let listen = options.listen;
|
|
30
|
-
if (typeof listen === "object" && !("port" in listen))
|
|
31
|
-
listen = { ...listen, port: undefined };
|
|
32
|
-
server.listen(listen);
|
|
33
|
-
};
|
|
34
|
-
const protocol = options.protocol || (isHttps ? "https" : "http");
|
|
35
|
-
const requestListener = (req, res) => {
|
|
36
|
-
const keys = req.url.slice(prefix.length).split("@");
|
|
37
|
-
req.socket.on("close", () => {
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
for (const key of keys) {
|
|
40
|
-
const oldValue = activeModules.get(key) || 0;
|
|
41
|
-
activeModules.set(key, oldValue - 1);
|
|
42
|
-
if (oldValue === 1) {
|
|
43
|
-
logger.log(`${key} is no longer in use. Next compilation will skip this module.`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, 120000);
|
|
47
|
-
});
|
|
48
|
-
req.socket.setNoDelay(true);
|
|
49
|
-
res.writeHead(200, {
|
|
50
|
-
"content-type": "text/event-stream",
|
|
51
|
-
"Access-Control-Allow-Origin": "*",
|
|
52
|
-
"Access-Control-Allow-Methods": "*",
|
|
53
|
-
"Access-Control-Allow-Headers": "*"
|
|
54
|
-
});
|
|
55
|
-
res.write("\n");
|
|
56
|
-
const moduleActivated = [];
|
|
57
|
-
for (const key of keys) {
|
|
58
|
-
const oldValue = activeModules.get(key) || 0;
|
|
59
|
-
activeModules.set(key, oldValue + 1);
|
|
60
|
-
if (oldValue === 0) {
|
|
61
|
-
logger.log(`${key} is now in use and will be compiled.`);
|
|
62
|
-
moduleActivated.push(key);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (moduleActivated.length && compiler.watching) {
|
|
66
|
-
compiler.watching.lazyCompilationInvalidate(new Set(moduleActivated.map(key => filesByKey.get(key))));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const server = createServer();
|
|
70
|
-
server.on("request", requestListener);
|
|
71
|
-
let isClosing = false;
|
|
72
|
-
const sockets = new Set();
|
|
73
|
-
server.on("connection", socket => {
|
|
74
|
-
sockets.add(socket);
|
|
75
|
-
socket.on("close", () => {
|
|
76
|
-
sockets.delete(socket);
|
|
77
|
-
});
|
|
78
|
-
if (isClosing)
|
|
79
|
-
socket.destroy();
|
|
80
|
-
});
|
|
81
|
-
server.on("clientError", e => {
|
|
82
|
-
if (e.message !== "Server is disposing")
|
|
83
|
-
logger.warn(e);
|
|
84
|
-
});
|
|
85
|
-
server.on("listening", (err) => {
|
|
86
|
-
if (err)
|
|
87
|
-
return callback(err);
|
|
88
|
-
const addr = server.address();
|
|
89
|
-
if (typeof addr === "string")
|
|
90
|
-
throw new Error("addr must not be a string");
|
|
91
|
-
const urlBase = addr.address === "::" || addr.address === "0.0.0.0"
|
|
92
|
-
? `${protocol}://localhost:${addr.port}`
|
|
93
|
-
: addr.family === "IPv6"
|
|
94
|
-
? `${protocol}://[${addr.address}]:${addr.port}`
|
|
95
|
-
: `${protocol}://${addr.address}:${addr.port}`;
|
|
96
|
-
logger.log(`Server-Sent-Events server for lazy compilation open at ${urlBase}.`);
|
|
97
|
-
const result = {
|
|
98
|
-
dispose(callback) {
|
|
99
|
-
isClosing = true;
|
|
100
|
-
// Removing the listener is a workaround for a memory leak in node.js
|
|
101
|
-
server.off("request", requestListener);
|
|
102
|
-
server.close(err => {
|
|
103
|
-
callback(err);
|
|
104
|
-
});
|
|
105
|
-
for (const socket of sockets) {
|
|
106
|
-
socket.destroy(new Error("Server is disposing"));
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
module({ module: originalModule, path }) {
|
|
110
|
-
const key = `${encodeURIComponent(originalModule.replace(/\\/g, "/").replace(/@/g, "_")).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`;
|
|
111
|
-
filesByKey.set(key, path);
|
|
112
|
-
const active = activeModules.get(key) > 0;
|
|
113
|
-
return {
|
|
114
|
-
client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
|
|
115
|
-
data: key,
|
|
116
|
-
active
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
state.module = result.module;
|
|
121
|
-
state.dispose = result.dispose;
|
|
122
|
-
callback(null, result);
|
|
123
|
-
});
|
|
124
|
-
listen(server);
|
|
125
|
-
};
|
|
126
|
-
exports.default = getBackend;
|
|
127
|
-
function unimplemented() {
|
|
128
|
-
throw new Error("access before initialization");
|
|
129
|
-
}
|
|
130
|
-
const state = {
|
|
131
|
-
module: unimplemented,
|
|
132
|
-
dispose: unimplemented
|
|
133
|
-
};
|
|
134
|
-
function dispose(callback) {
|
|
135
|
-
state.dispose(callback);
|
|
136
|
-
state.dispose = unimplemented;
|
|
137
|
-
state.module = unimplemented;
|
|
138
|
-
}
|
|
139
|
-
exports.dispose = dispose;
|
|
140
|
-
function moduleImpl(args) {
|
|
141
|
-
return state.module(args);
|
|
142
|
-
}
|
|
143
|
-
exports.moduleImpl = moduleImpl;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BuiltinPluginName, RawRegexMatcher } from "@rspack/binding";
|
|
2
|
-
export declare const BuiltinLazyCompilationPlugin: {
|
|
3
|
-
new (module: (args: {
|
|
4
|
-
module: string;
|
|
5
|
-
path: string;
|
|
6
|
-
}) => {
|
|
7
|
-
active: boolean;
|
|
8
|
-
data: string;
|
|
9
|
-
client: string;
|
|
10
|
-
}, cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegexMatcher | undefined): {
|
|
11
|
-
name: BuiltinPluginName;
|
|
12
|
-
_options: {
|
|
13
|
-
module: (args: {
|
|
14
|
-
module: string;
|
|
15
|
-
path: string;
|
|
16
|
-
}) => {
|
|
17
|
-
active: boolean;
|
|
18
|
-
data: string;
|
|
19
|
-
client: string;
|
|
20
|
-
};
|
|
21
|
-
cacheable: boolean;
|
|
22
|
-
imports: boolean;
|
|
23
|
-
entries: boolean;
|
|
24
|
-
test: RawRegexMatcher | undefined;
|
|
25
|
-
};
|
|
26
|
-
affectedHooks: "emit" | "done" | "compilation" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishModules" | "finishMake" | "entryOption" | undefined;
|
|
27
|
-
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
28
|
-
apply(compiler: import("../../Compiler").Compiler): void;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuiltinLazyCompilationPlugin = void 0;
|
|
4
|
-
const binding_1 = require("@rspack/binding");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
exports.BuiltinLazyCompilationPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.LazyCompilation, (module, cacheable, entries, imports, test) => ({ module, cacheable, imports, entries, test }), "compilation");
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from "../..";
|
|
2
|
-
import { LazyCompilationDefaultBackendOptions } from "./backend";
|
|
3
|
-
import { RawRegexMatcher } from "@rspack/binding";
|
|
4
|
-
export default class LazyCompilationPlugin {
|
|
5
|
-
cacheable: boolean;
|
|
6
|
-
entries: boolean;
|
|
7
|
-
imports: boolean;
|
|
8
|
-
test?: RawRegexMatcher;
|
|
9
|
-
backend?: LazyCompilationDefaultBackendOptions;
|
|
10
|
-
constructor(cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegexMatcher, backend?: LazyCompilationDefaultBackendOptions);
|
|
11
|
-
apply(compiler: Compiler): void;
|
|
12
|
-
}
|
|
13
|
-
export { LazyCompilationPlugin };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.LazyCompilationPlugin = void 0;
|
|
27
|
-
const lazyCompilation_1 = require("./lazyCompilation");
|
|
28
|
-
const backend_1 = __importStar(require("./backend"));
|
|
29
|
-
class LazyCompilationPlugin {
|
|
30
|
-
constructor(cacheable, entries, imports, test, backend) {
|
|
31
|
-
this.cacheable = cacheable;
|
|
32
|
-
this.entries = entries;
|
|
33
|
-
this.imports = imports;
|
|
34
|
-
this.test = test;
|
|
35
|
-
this.backend = backend;
|
|
36
|
-
}
|
|
37
|
-
apply(compiler) {
|
|
38
|
-
const backend = (0, backend_1.default)({
|
|
39
|
-
...this.backend,
|
|
40
|
-
client: require.resolve(`../../../hot/lazy-compilation-${compiler.options.externalsPresets.node ? "node" : "web"}.js`)
|
|
41
|
-
});
|
|
42
|
-
new lazyCompilation_1.BuiltinLazyCompilationPlugin(backend_1.moduleImpl, this.cacheable, this.entries, this.imports, this.test).apply(compiler);
|
|
43
|
-
let initialized = false;
|
|
44
|
-
compiler.hooks.beforeCompile.tapAsync("LazyCompilationPlugin", (_params, callback) => {
|
|
45
|
-
if (initialized)
|
|
46
|
-
return callback();
|
|
47
|
-
backend(compiler, (err, result) => {
|
|
48
|
-
if (err)
|
|
49
|
-
return callback(err);
|
|
50
|
-
initialized = true;
|
|
51
|
-
callback();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => {
|
|
55
|
-
(0, backend_1.dispose)(callback);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.default = LazyCompilationPlugin;
|
|
60
|
-
exports.LazyCompilationPlugin = LazyCompilationPlugin;
|