@rspack/core 0.5.9-canary-4297cec-20240402080759 → 0.5.9-canary-89c5dce-20240402093536
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Compilation.d.ts +1 -0
- package/dist/Compilation.js +2 -1
- package/dist/Compiler.d.ts +3 -8
- package/dist/Compiler.js +31 -34
- package/dist/Stats.js +2 -2
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -0
- package/dist/builtin-plugin/EntryPlugin.js +2 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +3 -3
- package/dist/builtin-plugin/index.d.ts +0 -2
- package/dist/builtin-plugin/index.js +0 -2
- package/dist/config/normalization.d.ts +1 -0
- package/dist/config/normalization.js +6 -1
- package/dist/config/zod.d.ts +103 -76
- package/dist/config/zod.js +3 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/exports.d.ts +26 -24
- package/dist/exports.js +1 -5
- package/dist/lib/EntryOptionPlugin.js +1 -1
- package/dist/rspackOptionsApply.js +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/package.json +4 -4
- package/dist/builtin-plugin/RSCClientEntryPlugin.d.ts +0 -10
- package/dist/builtin-plugin/RSCClientEntryPlugin.js +0 -6
- package/dist/builtin-plugin/RSCClientReferenceManifestRspackPlugin.d.ts +0 -10
- package/dist/builtin-plugin/RSCClientReferenceManifestRspackPlugin.js +0 -6
package/dist/Compilation.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare class Compilation {
|
|
|
90
90
|
ExecuteModuleContext
|
|
91
91
|
]>;
|
|
92
92
|
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
|
|
93
|
+
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
93
94
|
};
|
|
94
95
|
options: RspackOptionsNormalized;
|
|
95
96
|
outputOptions: OutputNormalized;
|
package/dist/Compilation.js
CHANGED
|
@@ -154,7 +154,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
154
154
|
statsPrinter: new tapable.SyncHook(["statsPrinter", "options"]),
|
|
155
155
|
buildModule: new liteTapable.SyncHook(["module"]),
|
|
156
156
|
executeModule: new liteTapable.SyncHook(["options", "context"]),
|
|
157
|
-
runtimeModule: new liteTapable.SyncHook(["module", "chunk"])
|
|
157
|
+
runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
|
|
158
|
+
afterSeal: new liteTapable.AsyncSeriesHook([])
|
|
158
159
|
};
|
|
159
160
|
this.compiler = compiler;
|
|
160
161
|
this.resolverFactory = compiler.resolverFactory;
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -42,7 +42,6 @@ declare class Compiler {
|
|
|
42
42
|
};
|
|
43
43
|
compilation?: Compilation;
|
|
44
44
|
compilationParams?: CompilationParams;
|
|
45
|
-
first: boolean;
|
|
46
45
|
builtinPlugins: binding.BuiltinPlugin[];
|
|
47
46
|
root: Compiler;
|
|
48
47
|
running: boolean;
|
|
@@ -110,14 +109,10 @@ declare class Compiler {
|
|
|
110
109
|
getInfrastructureLogger(name: string | Function): Logger;
|
|
111
110
|
run(callback: Callback<Error, Stats>): void;
|
|
112
111
|
/**
|
|
113
|
-
*
|
|
112
|
+
* * Note: This is not a webpack public API, maybe removed in future.
|
|
113
|
+
* @internal
|
|
114
114
|
*/
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
|
|
118
|
-
* @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
|
|
119
|
-
*/
|
|
120
|
-
rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
|
|
115
|
+
__internal__rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
|
|
121
116
|
compile(callback: Callback<Error, Compilation>): void;
|
|
122
117
|
watch(watchOptions: WatchOptions, handler: Callback<Error, Stats>): Watching;
|
|
123
118
|
purgeInputFileSystem(): void;
|
package/dist/Compiler.js
CHANGED
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
|
|
39
|
+
var _Compiler_instances, _Compiler_instance, _Compiler_initial, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_build, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compiler = void 0;
|
|
42
42
|
/**
|
|
@@ -84,7 +84,7 @@ class Compiler {
|
|
|
84
84
|
_Compiler_instance.set(this, void 0);
|
|
85
85
|
this.webpack = index_1.rspack;
|
|
86
86
|
// TODO: remove this after remove rebuild on the rust side.
|
|
87
|
-
this
|
|
87
|
+
_Compiler_initial.set(this, true);
|
|
88
88
|
_Compiler_disabledHooks.set(this, void 0);
|
|
89
89
|
_Compiler_nonSkippableRegisters.set(this, void 0);
|
|
90
90
|
_Compiler_registers.set(this, void 0);
|
|
@@ -386,36 +386,10 @@ class Compiler {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
-
*
|
|
389
|
+
* * Note: This is not a webpack public API, maybe removed in future.
|
|
390
|
+
* @internal
|
|
390
391
|
*/
|
|
391
|
-
|
|
392
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
393
|
-
if (error) {
|
|
394
|
-
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
395
|
-
}
|
|
396
|
-
if (!this.first) {
|
|
397
|
-
instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
|
|
398
|
-
if (error) {
|
|
399
|
-
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
400
|
-
}
|
|
401
|
-
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
402
|
-
});
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
this.first = false;
|
|
406
|
-
instance.build(error => {
|
|
407
|
-
if (error) {
|
|
408
|
-
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
409
|
-
}
|
|
410
|
-
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
|
|
416
|
-
* @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
|
|
417
|
-
*/
|
|
418
|
-
rebuild(modifiedFiles, removedFiles, callback) {
|
|
392
|
+
__internal__rebuild(modifiedFiles, removedFiles, callback) {
|
|
419
393
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
420
394
|
if (error) {
|
|
421
395
|
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
@@ -437,7 +411,7 @@ class Compiler {
|
|
|
437
411
|
}
|
|
438
412
|
this.hooks.compile.call(params);
|
|
439
413
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_resetThisCompilation).call(this);
|
|
440
|
-
this.
|
|
414
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_build).call(this, err => {
|
|
441
415
|
if (err) {
|
|
442
416
|
return callback(err);
|
|
443
417
|
}
|
|
@@ -470,7 +444,7 @@ class Compiler {
|
|
|
470
444
|
}
|
|
471
445
|
close(callback) {
|
|
472
446
|
if (this.watching) {
|
|
473
|
-
// When there is still an active watching, close this
|
|
447
|
+
// When there is still an active watching, close this #initial
|
|
474
448
|
this.watching.close(() => {
|
|
475
449
|
this.close(callback);
|
|
476
450
|
});
|
|
@@ -497,7 +471,7 @@ class Compiler {
|
|
|
497
471
|
}
|
|
498
472
|
}
|
|
499
473
|
exports.Compiler = Compiler;
|
|
500
|
-
_Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
|
|
474
|
+
_Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
|
|
501
475
|
const error = (0, bindingVersionCheck_1.checkVersion)();
|
|
502
476
|
if (error) {
|
|
503
477
|
return callback(error);
|
|
@@ -599,6 +573,7 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
599
573
|
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => this.compilation.hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, this.compilation), filename)),
|
|
600
574
|
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => this.compilation.hooks.processAssets, queried => async () => await queried.promise(this.compilation.assets)),
|
|
601
575
|
registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => this.compilation.hooks.afterProcessAssets, queried => () => queried.call(this.compilation.assets)),
|
|
576
|
+
registerCompilationAfterSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterSeal, () => this.compilation.hooks.afterSeal, queried => async () => await queried.promise()),
|
|
602
577
|
registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => this.compilationParams.normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
|
|
603
578
|
const normalizedResolveData = {
|
|
604
579
|
request: resolveData.request,
|
|
@@ -751,6 +726,28 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
751
726
|
getTaps.registerKind = registerKind;
|
|
752
727
|
getTaps.getHookMap = getHookMap;
|
|
753
728
|
return getTaps;
|
|
729
|
+
}, _Compiler_build = function _Compiler_build(callback) {
|
|
730
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
731
|
+
if (error) {
|
|
732
|
+
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
733
|
+
}
|
|
734
|
+
if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
|
|
735
|
+
instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
|
|
736
|
+
if (error) {
|
|
737
|
+
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
738
|
+
}
|
|
739
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
740
|
+
});
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
__classPrivateFieldSet(this, _Compiler_initial, false, "f");
|
|
744
|
+
instance.build(error => {
|
|
745
|
+
if (error) {
|
|
746
|
+
return callback === null || callback === void 0 ? void 0 : callback(error);
|
|
747
|
+
}
|
|
748
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
749
|
+
});
|
|
750
|
+
});
|
|
754
751
|
}, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
|
|
755
752
|
const compilation = new Compilation_1.Compilation(this, native);
|
|
756
753
|
compilation.name = this.name;
|
package/dist/Stats.js
CHANGED
|
@@ -103,8 +103,8 @@ function normalizeStatsPreset(options) {
|
|
|
103
103
|
}
|
|
104
104
|
exports.normalizeStatsPreset = normalizeStatsPreset;
|
|
105
105
|
function presetToOptions(name) {
|
|
106
|
-
const
|
|
107
|
-
switch (
|
|
106
|
+
const preset = (typeof name === "string" && name.toLowerCase()) || name;
|
|
107
|
+
switch (preset) {
|
|
108
108
|
case "none":
|
|
109
109
|
return {
|
|
110
110
|
all: false
|
|
@@ -9,6 +9,7 @@ export type EntryOptions = {
|
|
|
9
9
|
baseUri?: string;
|
|
10
10
|
filename?: FilenameTemplate;
|
|
11
11
|
library?: LibraryOptions;
|
|
12
|
+
dependOn?: string[];
|
|
12
13
|
};
|
|
13
14
|
export declare const EntryPlugin: {
|
|
14
15
|
new (context: string, entry: string, options?: string | EntryOptions | undefined): {
|
|
@@ -26,6 +26,7 @@ function getRawEntryOptions(entry) {
|
|
|
26
26
|
: undefined,
|
|
27
27
|
asyncChunks: entry.asyncChunks,
|
|
28
28
|
filename: entry.filename,
|
|
29
|
-
library: entry.library && (0, config_1.getRawLibrary)(entry.library)
|
|
29
|
+
library: entry.library && (0, config_1.getRawLibrary)(entry.library),
|
|
30
|
+
dependOn: entry.dependOn
|
|
30
31
|
};
|
|
31
32
|
}
|
|
@@ -4,7 +4,7 @@ export declare const ExternalsPlugin: {
|
|
|
4
4
|
context?: string | undefined;
|
|
5
5
|
dependencyType?: string | undefined;
|
|
6
6
|
request?: string | undefined;
|
|
7
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "
|
|
7
|
+
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "promise" | "script" | "commonjs" | "jsonp" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
8
8
|
context?: string | undefined;
|
|
9
9
|
dependencyType?: string | undefined;
|
|
10
10
|
request?: string | undefined;
|
|
@@ -12,7 +12,7 @@ export declare const ExternalsPlugin: {
|
|
|
12
12
|
context?: string | undefined;
|
|
13
13
|
dependencyType?: string | undefined;
|
|
14
14
|
request?: string | undefined;
|
|
15
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "
|
|
15
|
+
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "promise" | "script" | "commonjs" | "jsonp" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
16
16
|
context?: string | undefined;
|
|
17
17
|
dependencyType?: string | undefined;
|
|
18
18
|
request?: string | undefined;
|
|
@@ -22,7 +22,7 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
22
22
|
templateParameters?: Record<string, string> | undefined;
|
|
23
23
|
inject?: boolean | "head" | "body" | undefined;
|
|
24
24
|
publicPath?: string | undefined;
|
|
25
|
-
scriptLoading?: "
|
|
25
|
+
scriptLoading?: "blocking" | "defer" | "module" | undefined;
|
|
26
26
|
chunks?: string[] | undefined;
|
|
27
27
|
excludedChunks?: string[] | undefined;
|
|
28
28
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -37,7 +37,7 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
37
37
|
templateParameters?: Record<string, string> | undefined;
|
|
38
38
|
inject?: boolean | "head" | "body" | undefined;
|
|
39
39
|
publicPath?: string | undefined;
|
|
40
|
-
scriptLoading?: "
|
|
40
|
+
scriptLoading?: "blocking" | "defer" | "module" | undefined;
|
|
41
41
|
chunks?: string[] | undefined;
|
|
42
42
|
excludedChunks?: string[] | undefined;
|
|
43
43
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -55,7 +55,7 @@ export declare const HtmlRspackPlugin: {
|
|
|
55
55
|
templateParameters?: Record<string, string> | undefined;
|
|
56
56
|
inject?: boolean | "head" | "body" | undefined;
|
|
57
57
|
publicPath?: string | undefined;
|
|
58
|
-
scriptLoading?: "
|
|
58
|
+
scriptLoading?: "blocking" | "defer" | "module" | undefined;
|
|
59
59
|
chunks?: string[] | undefined;
|
|
60
60
|
excludedChunks?: string[] | undefined;
|
|
61
61
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -50,8 +50,6 @@ export * from "./HtmlRspackPlugin";
|
|
|
50
50
|
export * from "./CopyRspackPlugin";
|
|
51
51
|
export * from "./SwcJsMinimizerPlugin";
|
|
52
52
|
export * from "./SwcCssMinimizerPlugin";
|
|
53
|
-
export * from "./RSCClientEntryPlugin";
|
|
54
|
-
export * from "./RSCClientReferenceManifestRspackPlugin";
|
|
55
53
|
export * from "./JsLoaderRspackPlugin";
|
|
56
54
|
import { RawBuiltins, RawCssModulesConfig } from "@rspack/binding";
|
|
57
55
|
import { RspackOptionsNormalized } from "..";
|
|
@@ -68,8 +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("./RSCClientEntryPlugin"), exports);
|
|
72
|
-
__exportStar(require("./RSCClientReferenceManifestRspackPlugin"), exports);
|
|
73
71
|
__exportStar(require("./JsLoaderRspackPlugin"), exports);
|
|
74
72
|
function resolveTreeShaking(treeShaking, production) {
|
|
75
73
|
return treeShaking !== undefined
|
|
@@ -233,7 +233,12 @@ const getNormalizedEntryStatic = (entry) => {
|
|
|
233
233
|
chunkLoading: value.chunkLoading,
|
|
234
234
|
asyncChunks: value.asyncChunks,
|
|
235
235
|
filename: value.filename,
|
|
236
|
-
library: value.library
|
|
236
|
+
library: value.library,
|
|
237
|
+
dependOn: Array.isArray(value.dependOn)
|
|
238
|
+
? value.dependOn
|
|
239
|
+
: value.dependOn
|
|
240
|
+
? [value.dependOn]
|
|
241
|
+
: undefined
|
|
237
242
|
};
|
|
238
243
|
}
|
|
239
244
|
}
|