@rspack/core 0.5.7-canary-dcd4782-20240312094134 → 0.5.7-canary-1f35c13-20240313091234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Compilation.d.ts +1 -1
- package/dist/Compilation.js +2 -4
- package/dist/Compiler.d.ts +4 -4
- package/dist/Compiler.js +4 -10
- package/dist/MultiCompiler.js +2 -2
- 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 +18 -80
- package/dist/config/zod.js +2 -6
- package/dist/exports.d.ts +6 -14
- package/dist/node/NodeWatchFileSystem.d.ts +2 -1
- 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/Compilation.d.ts
CHANGED
package/dist/Compilation.js
CHANGED
|
@@ -473,14 +473,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
473
473
|
const logEntry = {
|
|
474
474
|
time: Date.now(),
|
|
475
475
|
type,
|
|
476
|
-
// @ts-expect-error
|
|
477
476
|
args,
|
|
478
|
-
// @ts-expect-error
|
|
479
477
|
trace
|
|
480
478
|
};
|
|
481
479
|
if (this.hooks.log.call(name, logEntry) === undefined) {
|
|
482
480
|
if (logEntry.type === Logger_1.LogType.profileEnd) {
|
|
483
|
-
if (typeof console.profileEnd === "function") {
|
|
481
|
+
if (typeof console.profileEnd === "function" && logEntry.args) {
|
|
484
482
|
console.profileEnd(`[${name}] ${logEntry.args[0]}`);
|
|
485
483
|
}
|
|
486
484
|
}
|
|
@@ -493,7 +491,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
493
491
|
}
|
|
494
492
|
logEntries.push(logEntry);
|
|
495
493
|
if (logEntry.type === Logger_1.LogType.profile) {
|
|
496
|
-
if (typeof console.profile === "function") {
|
|
494
|
+
if (typeof console.profile === "function" && logEntry.args) {
|
|
497
495
|
console.profile(`[${name}] ${logEntry.args[0]}`);
|
|
498
496
|
}
|
|
499
497
|
}
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import * as binding from "@rspack/binding";
|
|
|
12
12
|
import * as tapable from "tapable";
|
|
13
13
|
import * as liteTapable from "./lite-tapable";
|
|
14
14
|
import { Callback } from "tapable";
|
|
15
|
-
import
|
|
15
|
+
import { WatchOptions } from "./config";
|
|
16
16
|
import { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
|
|
17
17
|
import { RuleSetCompiler } from "./RuleSetCompiler";
|
|
18
18
|
import { Stats } from "./Stats";
|
|
@@ -48,7 +48,7 @@ declare class Compiler {
|
|
|
48
48
|
ruleSet: RuleSetCompiler;
|
|
49
49
|
watchFileSystem: WatchFileSystem;
|
|
50
50
|
intermediateFileSystem: any;
|
|
51
|
-
watchMode
|
|
51
|
+
watchMode?: boolean;
|
|
52
52
|
context: string;
|
|
53
53
|
modifiedFiles?: ReadonlySet<string>;
|
|
54
54
|
cache: Cache;
|
|
@@ -67,7 +67,7 @@ declare class Compiler {
|
|
|
67
67
|
contextModuleFactory: tapable.SyncHook<ContextModuleFactory>;
|
|
68
68
|
initialize: tapable.SyncHook<[]>;
|
|
69
69
|
shouldEmit: tapable.SyncBailHook<[Compilation], boolean>;
|
|
70
|
-
infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>;
|
|
70
|
+
infrastructureLog: tapable.SyncBailHook<[string, string, any[]?], true>;
|
|
71
71
|
beforeRun: tapable.AsyncSeriesHook<[Compiler]>;
|
|
72
72
|
run: tapable.AsyncSeriesHook<[Compiler]>;
|
|
73
73
|
emit: tapable.AsyncSeriesHook<[Compilation]>;
|
|
@@ -111,7 +111,7 @@ declare class Compiler {
|
|
|
111
111
|
*/
|
|
112
112
|
rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
|
|
113
113
|
compile(callback: Callback<Error, Compilation>): void;
|
|
114
|
-
watch(watchOptions: WatchOptions, handler:
|
|
114
|
+
watch(watchOptions: WatchOptions, handler: (error?: Error, stats?: Stats) => void): Watching | void;
|
|
115
115
|
purgeInputFileSystem(): void;
|
|
116
116
|
close(callback: (error?: Error | null) => void): void;
|
|
117
117
|
getAsset(name: string): Buffer | null;
|
package/dist/Compiler.js
CHANGED
|
@@ -259,9 +259,7 @@ class Compiler {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
else {
|
|
262
|
-
if (
|
|
263
|
-
// @ts-expect-error
|
|
264
|
-
this.hooks.infrastructureLog.call(name, type, args) === undefined) {
|
|
262
|
+
if (this.hooks.infrastructureLog.call(name, type, args) === undefined) {
|
|
265
263
|
if (this.infrastructureLogger !== undefined) {
|
|
266
264
|
this.infrastructureLogger(name, type, args);
|
|
267
265
|
}
|
|
@@ -270,8 +268,7 @@ class Compiler {
|
|
|
270
268
|
}, (childName) => {
|
|
271
269
|
if (typeof name === "function") {
|
|
272
270
|
if (typeof childName === "function") {
|
|
273
|
-
|
|
274
|
-
return this.getInfrastructureLogger(_ => {
|
|
271
|
+
return this.getInfrastructureLogger(() => {
|
|
275
272
|
if (typeof name === "function") {
|
|
276
273
|
name = name();
|
|
277
274
|
if (!name) {
|
|
@@ -324,7 +321,6 @@ class Compiler {
|
|
|
324
321
|
const startTime = Date.now();
|
|
325
322
|
this.running = true;
|
|
326
323
|
const doRun = () => {
|
|
327
|
-
// @ts-expect-error
|
|
328
324
|
const finalCallback = (err, stats) => {
|
|
329
325
|
this.idle = true;
|
|
330
326
|
this.cache.beginIdle();
|
|
@@ -336,7 +332,7 @@ class Compiler {
|
|
|
336
332
|
if (callback) {
|
|
337
333
|
callback(err, stats);
|
|
338
334
|
}
|
|
339
|
-
this.hooks.afterDone.call(stats);
|
|
335
|
+
stats && this.hooks.afterDone.call(stats);
|
|
340
336
|
};
|
|
341
337
|
this.hooks.beforeRun.callAsync(this, err => {
|
|
342
338
|
if (err) {
|
|
@@ -447,12 +443,10 @@ class Compiler {
|
|
|
447
443
|
}
|
|
448
444
|
watch(watchOptions, handler) {
|
|
449
445
|
if (this.running) {
|
|
450
|
-
// @ts-expect-error
|
|
451
446
|
return handler(new ConcurrentCompilationError_1.default());
|
|
452
447
|
}
|
|
453
448
|
this.running = true;
|
|
454
449
|
this.watchMode = true;
|
|
455
|
-
// @ts-expect-error
|
|
456
450
|
this.watching = new Watching_1.Watching(this, watchOptions, handler);
|
|
457
451
|
return this.watching;
|
|
458
452
|
}
|
|
@@ -647,7 +641,7 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
647
641
|
};
|
|
648
642
|
});
|
|
649
643
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
650
|
-
return res;
|
|
644
|
+
return [res, resolveData.createData];
|
|
651
645
|
}, _Compiler_contextModuleFactoryBeforeResolve = async function _Compiler_contextModuleFactoryBeforeResolve(resourceData) {
|
|
652
646
|
var _a;
|
|
653
647
|
let res = await ((_a = this.compilation.contextModuleFactory) === null || _a === void 0 ? void 0 : _a.hooks.beforeResolve.promise(resourceData));
|
package/dist/MultiCompiler.js
CHANGED
|
@@ -240,8 +240,8 @@ class MultiCompiler {
|
|
|
240
240
|
}, (compiler, watching, _done) => {
|
|
241
241
|
if (compiler.watching !== watching)
|
|
242
242
|
return;
|
|
243
|
-
if (!watching.running)
|
|
244
|
-
watching.invalidate();
|
|
243
|
+
if (!(watching === null || watching === void 0 ? void 0 : watching.running))
|
|
244
|
+
watching === null || watching === void 0 ? void 0 : watching.invalidate();
|
|
245
245
|
}, handler);
|
|
246
246
|
// @ts-expect-error
|
|
247
247
|
return new MultiWatching_1.default(watchings, this);
|
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()
|
|
@@ -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;
|
|
@@ -3263,19 +3229,19 @@ export type Watch = z.infer<typeof watch>;
|
|
|
3263
3229
|
declare const watchOptions: z.ZodObject<{
|
|
3264
3230
|
aggregateTimeout: z.ZodOptional<z.ZodNumber>;
|
|
3265
3231
|
followSymlinks: z.ZodOptional<z.ZodBoolean>;
|
|
3266
|
-
ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>>;
|
|
3232
|
+
ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>, z.ZodFunction<z.ZodTuple<[z.ZodString], null>, z.ZodBoolean>]>>;
|
|
3267
3233
|
poll: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
|
|
3268
3234
|
stdin: z.ZodOptional<z.ZodBoolean>;
|
|
3269
3235
|
}, "strict", z.ZodTypeAny, {
|
|
3270
3236
|
aggregateTimeout?: number | undefined;
|
|
3271
3237
|
followSymlinks?: boolean | undefined;
|
|
3272
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
3238
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
3273
3239
|
poll?: number | boolean | undefined;
|
|
3274
3240
|
stdin?: boolean | undefined;
|
|
3275
3241
|
}, {
|
|
3276
3242
|
aggregateTimeout?: number | undefined;
|
|
3277
3243
|
followSymlinks?: boolean | undefined;
|
|
3278
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
3244
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
3279
3245
|
poll?: number | boolean | undefined;
|
|
3280
3246
|
stdin?: boolean | undefined;
|
|
3281
3247
|
}>;
|
|
@@ -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;
|
|
@@ -3928,19 +3874,19 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
3928
3874
|
watchOptions: z.ZodOptional<z.ZodObject<{
|
|
3929
3875
|
aggregateTimeout: z.ZodOptional<z.ZodNumber>;
|
|
3930
3876
|
followSymlinks: z.ZodOptional<z.ZodBoolean>;
|
|
3931
|
-
ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>>;
|
|
3877
|
+
ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>, z.ZodFunction<z.ZodTuple<[z.ZodString], null>, z.ZodBoolean>]>>;
|
|
3932
3878
|
poll: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
|
|
3933
3879
|
stdin: z.ZodOptional<z.ZodBoolean>;
|
|
3934
3880
|
}, "strict", z.ZodTypeAny, {
|
|
3935
3881
|
aggregateTimeout?: number | undefined;
|
|
3936
3882
|
followSymlinks?: boolean | undefined;
|
|
3937
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
3883
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
3938
3884
|
poll?: number | boolean | undefined;
|
|
3939
3885
|
stdin?: boolean | undefined;
|
|
3940
3886
|
}, {
|
|
3941
3887
|
aggregateTimeout?: number | undefined;
|
|
3942
3888
|
followSymlinks?: boolean | undefined;
|
|
3943
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
3889
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
3944
3890
|
poll?: number | boolean | undefined;
|
|
3945
3891
|
stdin?: boolean | undefined;
|
|
3946
3892
|
}>>;
|
|
@@ -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;
|
|
@@ -4808,7 +4750,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
4808
4750
|
watchOptions?: {
|
|
4809
4751
|
aggregateTimeout?: number | undefined;
|
|
4810
4752
|
followSymlinks?: boolean | undefined;
|
|
4811
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
4753
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
4812
4754
|
poll?: number | boolean | undefined;
|
|
4813
4755
|
stdin?: boolean | undefined;
|
|
4814
4756
|
} | 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;
|
|
@@ -5138,7 +5076,7 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5138
5076
|
watchOptions?: {
|
|
5139
5077
|
aggregateTimeout?: number | undefined;
|
|
5140
5078
|
followSymlinks?: boolean | undefined;
|
|
5141
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
5079
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
5142
5080
|
poll?: number | boolean | undefined;
|
|
5143
5081
|
stdin?: boolean | undefined;
|
|
5144
5082
|
} | 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(),
|
|
@@ -727,6 +722,7 @@ const watchOptions = zod_1.z.strictObject({
|
|
|
727
722
|
.array()
|
|
728
723
|
.or(zod_1.z.instanceof(RegExp))
|
|
729
724
|
.or(zod_1.z.string())
|
|
725
|
+
.or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string()])).returns(zod_1.z.boolean()))
|
|
730
726
|
.optional(),
|
|
731
727
|
poll: zod_1.z.number().or(zod_1.z.boolean()).optional(),
|
|
732
728
|
stdin: 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;
|
|
@@ -198,7 +194,7 @@ export declare const config: {
|
|
|
198
194
|
watchOptions?: {
|
|
199
195
|
aggregateTimeout?: number | undefined;
|
|
200
196
|
followSymlinks?: boolean | undefined;
|
|
201
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
197
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
202
198
|
poll?: number | boolean | undefined;
|
|
203
199
|
stdin?: boolean | undefined;
|
|
204
200
|
} | 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;
|
|
@@ -530,7 +522,7 @@ export declare const config: {
|
|
|
530
522
|
watchOptions?: {
|
|
531
523
|
aggregateTimeout?: number | undefined;
|
|
532
524
|
followSymlinks?: boolean | undefined;
|
|
533
|
-
ignored?: string | RegExp | string[] | undefined;
|
|
525
|
+
ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
|
|
534
526
|
poll?: number | boolean | undefined;
|
|
535
527
|
stdin?: boolean | undefined;
|
|
536
528
|
} | undefined;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import Watchpack
|
|
10
|
+
import Watchpack from "watchpack";
|
|
11
|
+
import { WatchOptions } from "../config";
|
|
11
12
|
import { FileSystemInfoEntry, Watcher, WatchFileSystem } from "../util/fs";
|
|
12
13
|
export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
13
14
|
inputFileSystem: any;
|
|
@@ -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.7-canary-
|
|
3
|
+
"version": "0.5.7-canary-1f35c13-20240313091234",
|
|
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-node-polyfill": "^0.5.7-canary-
|
|
58
|
+
"@rspack/core": "0.5.7-canary-1f35c13-20240313091234",
|
|
59
|
+
"@rspack/plugin-minify": "^0.5.7-canary-1f35c13-20240313091234",
|
|
60
|
+
"@rspack/plugin-node-polyfill": "^0.5.7-canary-1f35c13-20240313091234"
|
|
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.7-canary-
|
|
75
|
+
"@rspack/binding": "0.5.7-canary-1f35c13-20240313091234"
|
|
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;
|