@rspack/core 0.5.6-canary-7b27ac8-20240311132614 → 0.5.7-canary-3320ea8-20240312032922
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/Compiler.d.ts +1 -1
- package/dist/Compiler.js +3 -3
- 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/defaults.js +1 -1
- package/dist/config/normalization.d.ts +2 -2
- package/dist/config/normalization.js +1 -2
- package/dist/config/zod.d.ts +10 -72
- package/dist/config/zod.js +1 -6
- package/dist/exports.d.ts +4 -12
- package/dist/rspackOptionsApply.js +0 -9
- package/package.json +5 -5
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +0 -27
- package/dist/builtin-plugin/lazy-compilation/backend.js +0 -144
- 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 -10
- package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -57
package/dist/Compiler.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ declare class Compiler {
|
|
|
109
109
|
* Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
|
|
110
110
|
* @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
|
|
111
111
|
*/
|
|
112
|
-
rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>,
|
|
112
|
+
rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
|
|
113
113
|
compile(callback: Callback<Error, Compilation>): void;
|
|
114
114
|
watch(watchOptions: WatchOptions, handler: Callback<Error, Stats>): Watching;
|
|
115
115
|
purgeInputFileSystem(): void;
|
package/dist/Compiler.js
CHANGED
|
@@ -387,7 +387,7 @@ class Compiler {
|
|
|
387
387
|
}
|
|
388
388
|
if (!this.first) {
|
|
389
389
|
const rebuild = instance.unsafe_rebuild.bind(instance);
|
|
390
|
-
rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []),
|
|
390
|
+
rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
|
|
391
391
|
if (error) {
|
|
392
392
|
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
393
393
|
}
|
|
@@ -409,13 +409,13 @@ class Compiler {
|
|
|
409
409
|
* Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
|
|
410
410
|
* @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
|
|
411
411
|
*/
|
|
412
|
-
rebuild(modifiedFiles, removedFiles,
|
|
412
|
+
rebuild(modifiedFiles, removedFiles, callback) {
|
|
413
413
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
414
414
|
if (error) {
|
|
415
415
|
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
416
416
|
}
|
|
417
417
|
const rebuild = instance.unsafe_rebuild.bind(instance);
|
|
418
|
-
rebuild(Array.from(modifiedFiles || []), Array.from(removedFiles || []),
|
|
418
|
+
rebuild(Array.from(modifiedFiles || []), Array.from(removedFiles || []), error => {
|
|
419
419
|
if (error) {
|
|
420
420
|
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
421
421
|
}
|
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;
|
|
@@ -50,7 +50,6 @@ export * from "./HtmlRspackPlugin";
|
|
|
50
50
|
export * from "./CopyRspackPlugin";
|
|
51
51
|
export * from "./SwcJsMinimizerPlugin";
|
|
52
52
|
export * from "./SwcCssMinimizerPlugin";
|
|
53
|
-
export * from "./lazy-compilation/plugin";
|
|
54
53
|
import { RawBuiltins, RawCssModulesConfig } from "@rspack/binding";
|
|
55
54
|
import { RspackOptionsNormalized } from "..";
|
|
56
55
|
type BuiltinsCssConfig = {
|
|
@@ -68,7 +68,6 @@ __exportStar(require("./HtmlRspackPlugin"), exports);
|
|
|
68
68
|
__exportStar(require("./CopyRspackPlugin"), exports);
|
|
69
69
|
__exportStar(require("./SwcJsMinimizerPlugin"), exports);
|
|
70
70
|
__exportStar(require("./SwcCssMinimizerPlugin"), exports);
|
|
71
|
-
__exportStar(require("./lazy-compilation/plugin"), exports);
|
|
72
71
|
function resolveTreeShaking(treeShaking, production) {
|
|
73
72
|
return treeShaking !== undefined
|
|
74
73
|
? treeShaking.toString()
|
package/dist/config/defaults.js
CHANGED
|
@@ -104,7 +104,7 @@ const applyInfrastructureLoggingDefaults = (infrastructureLogging) => {
|
|
|
104
104
|
D(infrastructureLogging, "appendOnly", !tty);
|
|
105
105
|
};
|
|
106
106
|
const applyExperimentsDefaults = (experiments, { cache }) => {
|
|
107
|
-
D(experiments, "lazyCompilation",
|
|
107
|
+
D(experiments, "lazyCompilation", false);
|
|
108
108
|
D(experiments, "asyncWebAssembly", false);
|
|
109
109
|
D(experiments, "newSplitChunks", true);
|
|
110
110
|
D(experiments, "css", true); // we not align with webpack about the default value for better DX
|
|
@@ -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
|
@@ -3154,34 +3154,8 @@ declare const rspackFutureOptions: z.ZodObject<{
|
|
|
3154
3154
|
} | undefined;
|
|
3155
3155
|
}>;
|
|
3156
3156
|
export type RspackFutureOptions = z.infer<typeof rspackFutureOptions>;
|
|
3157
|
-
declare const lazyCompilationOptions: z.ZodObject<{
|
|
3158
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3159
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3160
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3161
|
-
}, "strip", z.ZodTypeAny, {
|
|
3162
|
-
imports?: boolean | undefined;
|
|
3163
|
-
entries?: boolean | undefined;
|
|
3164
|
-
test?: RegExp | undefined;
|
|
3165
|
-
}, {
|
|
3166
|
-
imports?: boolean | undefined;
|
|
3167
|
-
entries?: boolean | undefined;
|
|
3168
|
-
test?: RegExp | undefined;
|
|
3169
|
-
}>;
|
|
3170
|
-
export type LazyCompilationOptions = z.infer<typeof lazyCompilationOptions>;
|
|
3171
3157
|
declare const experiments: z.ZodObject<{
|
|
3172
|
-
lazyCompilation: z.
|
|
3173
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3174
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3175
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3176
|
-
}, "strip", z.ZodTypeAny, {
|
|
3177
|
-
imports?: boolean | undefined;
|
|
3178
|
-
entries?: boolean | undefined;
|
|
3179
|
-
test?: RegExp | undefined;
|
|
3180
|
-
}, {
|
|
3181
|
-
imports?: boolean | undefined;
|
|
3182
|
-
entries?: boolean | undefined;
|
|
3183
|
-
test?: RegExp | undefined;
|
|
3184
|
-
}>]>;
|
|
3158
|
+
lazyCompilation: z.ZodOptional<z.ZodBoolean>;
|
|
3185
3159
|
asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
|
|
3186
3160
|
outputModule: z.ZodOptional<z.ZodBoolean>;
|
|
3187
3161
|
topLevelAwait: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3217,11 +3191,7 @@ declare const experiments: z.ZodObject<{
|
|
|
3217
3191
|
} | undefined;
|
|
3218
3192
|
}>>;
|
|
3219
3193
|
}, "strict", z.ZodTypeAny, {
|
|
3220
|
-
lazyCompilation?: boolean |
|
|
3221
|
-
imports?: boolean | undefined;
|
|
3222
|
-
entries?: boolean | undefined;
|
|
3223
|
-
test?: RegExp | undefined;
|
|
3224
|
-
} | undefined;
|
|
3194
|
+
lazyCompilation?: boolean | undefined;
|
|
3225
3195
|
asyncWebAssembly?: boolean | undefined;
|
|
3226
3196
|
outputModule?: boolean | undefined;
|
|
3227
3197
|
topLevelAwait?: boolean | undefined;
|
|
@@ -3237,11 +3207,7 @@ declare const experiments: z.ZodObject<{
|
|
|
3237
3207
|
} | undefined;
|
|
3238
3208
|
} | undefined;
|
|
3239
3209
|
}, {
|
|
3240
|
-
lazyCompilation?: boolean |
|
|
3241
|
-
imports?: boolean | undefined;
|
|
3242
|
-
entries?: boolean | undefined;
|
|
3243
|
-
test?: RegExp | undefined;
|
|
3244
|
-
} | undefined;
|
|
3210
|
+
lazyCompilation?: boolean | undefined;
|
|
3245
3211
|
asyncWebAssembly?: boolean | undefined;
|
|
3246
3212
|
outputModule?: boolean | undefined;
|
|
3247
3213
|
topLevelAwait?: boolean | undefined;
|
|
@@ -3723,19 +3689,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3723
3689
|
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">]>>;
|
|
3724
3690
|
mode: z.ZodOptional<z.ZodEnum<["development", "production", "none"]>>;
|
|
3725
3691
|
experiments: z.ZodOptional<z.ZodObject<{
|
|
3726
|
-
lazyCompilation: z.
|
|
3727
|
-
imports: z.ZodOptional<z.ZodBoolean>;
|
|
3728
|
-
entries: z.ZodOptional<z.ZodBoolean>;
|
|
3729
|
-
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
3730
|
-
}, "strip", z.ZodTypeAny, {
|
|
3731
|
-
imports?: boolean | undefined;
|
|
3732
|
-
entries?: boolean | undefined;
|
|
3733
|
-
test?: RegExp | undefined;
|
|
3734
|
-
}, {
|
|
3735
|
-
imports?: boolean | undefined;
|
|
3736
|
-
entries?: boolean | undefined;
|
|
3737
|
-
test?: RegExp | undefined;
|
|
3738
|
-
}>]>;
|
|
3692
|
+
lazyCompilation: z.ZodOptional<z.ZodBoolean>;
|
|
3739
3693
|
asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
|
|
3740
3694
|
outputModule: z.ZodOptional<z.ZodBoolean>;
|
|
3741
3695
|
topLevelAwait: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3771,11 +3725,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3771
3725
|
} | undefined;
|
|
3772
3726
|
}>>;
|
|
3773
3727
|
}, "strict", z.ZodTypeAny, {
|
|
3774
|
-
lazyCompilation?: boolean |
|
|
3775
|
-
imports?: boolean | undefined;
|
|
3776
|
-
entries?: boolean | undefined;
|
|
3777
|
-
test?: RegExp | undefined;
|
|
3778
|
-
} | undefined;
|
|
3728
|
+
lazyCompilation?: boolean | undefined;
|
|
3779
3729
|
asyncWebAssembly?: boolean | undefined;
|
|
3780
3730
|
outputModule?: boolean | undefined;
|
|
3781
3731
|
topLevelAwait?: boolean | undefined;
|
|
@@ -3791,11 +3741,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3791
3741
|
} | undefined;
|
|
3792
3742
|
} | undefined;
|
|
3793
3743
|
}, {
|
|
3794
|
-
lazyCompilation?: boolean |
|
|
3795
|
-
imports?: boolean | undefined;
|
|
3796
|
-
entries?: boolean | undefined;
|
|
3797
|
-
test?: RegExp | undefined;
|
|
3798
|
-
} | undefined;
|
|
3744
|
+
lazyCompilation?: boolean | undefined;
|
|
3799
3745
|
asyncWebAssembly?: boolean | undefined;
|
|
3800
3746
|
outputModule?: boolean | undefined;
|
|
3801
3747
|
topLevelAwait?: boolean | undefined;
|
|
@@ -4738,14 +4684,10 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
4738
4684
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
4739
4685
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
4740
4686
|
} | undefined;
|
|
4741
|
-
target?: false | "node" | "async-node" | "
|
|
4687
|
+
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;
|
|
4742
4688
|
mode?: "production" | "development" | "none" | undefined;
|
|
4743
4689
|
experiments?: {
|
|
4744
|
-
lazyCompilation?: boolean |
|
|
4745
|
-
imports?: boolean | undefined;
|
|
4746
|
-
entries?: boolean | undefined;
|
|
4747
|
-
test?: RegExp | undefined;
|
|
4748
|
-
} | undefined;
|
|
4690
|
+
lazyCompilation?: boolean | undefined;
|
|
4749
4691
|
asyncWebAssembly?: boolean | undefined;
|
|
4750
4692
|
outputModule?: boolean | undefined;
|
|
4751
4693
|
topLevelAwait?: boolean | undefined;
|
|
@@ -5068,14 +5010,10 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5068
5010
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5069
5011
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5070
5012
|
} | undefined;
|
|
5071
|
-
target?: false | "node" | "async-node" | "
|
|
5013
|
+
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;
|
|
5072
5014
|
mode?: "production" | "development" | "none" | undefined;
|
|
5073
5015
|
experiments?: {
|
|
5074
|
-
lazyCompilation?: boolean |
|
|
5075
|
-
imports?: boolean | undefined;
|
|
5076
|
-
entries?: boolean | undefined;
|
|
5077
|
-
test?: RegExp | undefined;
|
|
5078
|
-
} | undefined;
|
|
5016
|
+
lazyCompilation?: boolean | undefined;
|
|
5079
5017
|
asyncWebAssembly?: boolean | undefined;
|
|
5080
5018
|
outputModule?: boolean | undefined;
|
|
5081
5019
|
topLevelAwait?: boolean | undefined;
|
package/dist/config/zod.js
CHANGED
|
@@ -690,13 +690,8 @@ const rspackFutureOptions = zod_1.z.strictObject({
|
|
|
690
690
|
})
|
|
691
691
|
.optional()
|
|
692
692
|
});
|
|
693
|
-
const lazyCompilationOptions = zod_1.z.object({
|
|
694
|
-
imports: zod_1.z.boolean().optional(),
|
|
695
|
-
entries: zod_1.z.boolean().optional(),
|
|
696
|
-
test: zod_1.z.instanceof(RegExp).optional()
|
|
697
|
-
});
|
|
698
693
|
const experiments = zod_1.z.strictObject({
|
|
699
|
-
lazyCompilation: zod_1.z.boolean().optional()
|
|
694
|
+
lazyCompilation: zod_1.z.boolean().optional(),
|
|
700
695
|
asyncWebAssembly: zod_1.z.boolean().optional(),
|
|
701
696
|
outputModule: zod_1.z.boolean().optional(),
|
|
702
697
|
topLevelAwait: zod_1.z.boolean().optional(),
|
package/dist/exports.d.ts
CHANGED
|
@@ -128,14 +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
|
-
imports?: boolean | undefined;
|
|
136
|
-
entries?: boolean | undefined;
|
|
137
|
-
test?: RegExp | undefined;
|
|
138
|
-
} | undefined;
|
|
134
|
+
lazyCompilation?: boolean | undefined;
|
|
139
135
|
asyncWebAssembly?: boolean | undefined;
|
|
140
136
|
outputModule?: boolean | undefined;
|
|
141
137
|
topLevelAwait?: boolean | undefined;
|
|
@@ -460,14 +456,10 @@ export declare const config: {
|
|
|
460
456
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
461
457
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
462
458
|
} | undefined;
|
|
463
|
-
target?: false | "node" | "async-node" | "
|
|
459
|
+
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;
|
|
464
460
|
mode?: "production" | "development" | "none" | undefined;
|
|
465
461
|
experiments?: {
|
|
466
|
-
lazyCompilation?: boolean |
|
|
467
|
-
imports?: boolean | undefined;
|
|
468
|
-
entries?: boolean | undefined;
|
|
469
|
-
test?: RegExp | undefined;
|
|
470
|
-
} | undefined;
|
|
462
|
+
lazyCompilation?: boolean | undefined;
|
|
471
463
|
asyncWebAssembly?: boolean | undefined;
|
|
472
464
|
outputModule?: boolean | undefined;
|
|
473
465
|
topLevelAwait?: boolean | undefined;
|
|
@@ -170,15 +170,6 @@ class RspackOptionsApply {
|
|
|
170
170
|
new builtin_plugin_1.MangleExportsPlugin(options.optimization.mangleExports !== "size").apply(compiler);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
if (options.experiments.lazyCompilation) {
|
|
174
|
-
const lazyOptions = options.experiments.lazyCompilation;
|
|
175
|
-
new builtin_plugin_1.LazyCompilationPlugin(lazyOptions.entries || true, lazyOptions.imports || true, lazyOptions.test
|
|
176
|
-
? {
|
|
177
|
-
source: lazyOptions.test.source,
|
|
178
|
-
flags: lazyOptions.test.flags
|
|
179
|
-
}
|
|
180
|
-
: undefined).apply(compiler);
|
|
181
|
-
}
|
|
182
173
|
if (options.output.enabledLibraryTypes &&
|
|
183
174
|
options.output.enabledLibraryTypes.length > 0) {
|
|
184
175
|
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.7-canary-3320ea8-20240312032922",
|
|
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/
|
|
60
|
-
"@rspack/plugin-
|
|
58
|
+
"@rspack/plugin-node-polyfill": "^0.5.7-canary-3320ea8-20240312032922",
|
|
59
|
+
"@rspack/core": "0.5.7-canary-3320ea8-20240312032922",
|
|
60
|
+
"@rspack/plugin-minify": "^0.5.7-canary-3320ea8-20240312032922"
|
|
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.7-canary-3320ea8-20240312032922"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@swc/helpers": ">=0.5.1"
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Compiler } from "../..";
|
|
3
|
-
/**
|
|
4
|
-
* @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>}} options additional options for the backend
|
|
5
|
-
* @returns {BackendHandler} backend
|
|
6
|
-
*/
|
|
7
|
-
declare const getBackend: (options: any) => (compiler: Compiler, callback: (err: any, obj?: {
|
|
8
|
-
dispose: (callback: (err: any) => void) => void;
|
|
9
|
-
module: (args: {
|
|
10
|
-
module: string;
|
|
11
|
-
path: string;
|
|
12
|
-
}) => {
|
|
13
|
-
data: string;
|
|
14
|
-
client: string;
|
|
15
|
-
active: boolean;
|
|
16
|
-
};
|
|
17
|
-
} | undefined) => void) => void;
|
|
18
|
-
export default getBackend;
|
|
19
|
-
export declare function dispose(callback: any): void;
|
|
20
|
-
export declare function moduleImpl(args: {
|
|
21
|
-
module: string;
|
|
22
|
-
path: string;
|
|
23
|
-
}): {
|
|
24
|
-
active: boolean;
|
|
25
|
-
data: string;
|
|
26
|
-
client: string;
|
|
27
|
-
};
|
|
@@ -1,144 +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
|
-
console.log("server shutdown");
|
|
104
|
-
callback(err);
|
|
105
|
-
});
|
|
106
|
-
for (const socket of sockets) {
|
|
107
|
-
socket.destroy(new Error("Server is disposing"));
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
module({ module: originalModule, path }) {
|
|
111
|
-
const key = `${encodeURIComponent(originalModule.replace(/\\/g, "/").replace(/@/g, "_")).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`;
|
|
112
|
-
filesByKey.set(key, path);
|
|
113
|
-
const active = activeModules.get(key) > 0;
|
|
114
|
-
return {
|
|
115
|
-
client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
|
|
116
|
-
data: key,
|
|
117
|
-
active
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
state.module = result.module;
|
|
122
|
-
state.dispose = result.dispose;
|
|
123
|
-
callback(null, result);
|
|
124
|
-
});
|
|
125
|
-
listen(server);
|
|
126
|
-
};
|
|
127
|
-
exports.default = getBackend;
|
|
128
|
-
function unimplemented() {
|
|
129
|
-
throw new Error("access before initialization");
|
|
130
|
-
}
|
|
131
|
-
const state = {
|
|
132
|
-
module: unimplemented,
|
|
133
|
-
dispose: unimplemented
|
|
134
|
-
};
|
|
135
|
-
function dispose(callback) {
|
|
136
|
-
state.dispose(callback);
|
|
137
|
-
state.dispose = unimplemented;
|
|
138
|
-
state.module = unimplemented;
|
|
139
|
-
}
|
|
140
|
-
exports.dispose = dispose;
|
|
141
|
-
function moduleImpl(args) {
|
|
142
|
-
return state.module(args);
|
|
143
|
-
}
|
|
144
|
-
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
|
-
}, dispose: (callback: any) => void, 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
|
-
dispose: (callback: any) => void;
|
|
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, dispose, entries, imports, test) => ({ module, dispose, imports, entries, test }), "compilation");
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from "../..";
|
|
2
|
-
import { RawRegexMatcher } from "@rspack/binding";
|
|
3
|
-
export default class LazyCompilationPlugin {
|
|
4
|
-
entries: boolean;
|
|
5
|
-
imports: boolean;
|
|
6
|
-
test?: RawRegexMatcher;
|
|
7
|
-
constructor(entries: boolean, imports: boolean, test?: RawRegexMatcher);
|
|
8
|
-
apply(compiler: Compiler): void;
|
|
9
|
-
}
|
|
10
|
-
export { LazyCompilationPlugin };
|
|
@@ -1,57 +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(entries, imports, test) {
|
|
31
|
-
this.entries = entries;
|
|
32
|
-
this.imports = imports;
|
|
33
|
-
this.test = test;
|
|
34
|
-
}
|
|
35
|
-
apply(compiler) {
|
|
36
|
-
const backend = (0, backend_1.default)({
|
|
37
|
-
client: require.resolve(`../../../hot/lazy-compilation-${compiler.options.externalsPresets.node ? "node" : "web"}.js`)
|
|
38
|
-
});
|
|
39
|
-
new lazyCompilation_1.BuiltinLazyCompilationPlugin(backend_1.moduleImpl, backend_1.dispose, this.entries, this.imports, this.test).apply(compiler);
|
|
40
|
-
let initialized = false;
|
|
41
|
-
compiler.hooks.beforeCompile.tapAsync("LazyCompilationPlugin", (_params, callback) => {
|
|
42
|
-
if (initialized)
|
|
43
|
-
return callback();
|
|
44
|
-
backend(compiler, (err, result) => {
|
|
45
|
-
if (err)
|
|
46
|
-
return callback(err);
|
|
47
|
-
initialized = true;
|
|
48
|
-
callback();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => {
|
|
52
|
-
(0, backend_1.dispose)(callback);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.default = LazyCompilationPlugin;
|
|
57
|
-
exports.LazyCompilationPlugin = LazyCompilationPlugin;
|