@rspack/core 1.0.0-beta.1 → 1.0.0-beta.3
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/ChunkGroup.d.ts +1 -0
- package/dist/ChunkGroup.js +3 -0
- package/dist/Compilation.d.ts +38 -1
- package/dist/Compilation.js +109 -44
- package/dist/Compiler.d.ts +1 -0
- package/dist/Compiler.js +31 -26
- package/dist/ExecuteModulePlugin.d.ts +0 -1
- package/dist/ExecuteModulePlugin.js +0 -1
- package/dist/Module.d.ts +1 -2
- package/dist/Module.js +0 -1
- package/dist/MultiCompiler.js +11 -7
- package/dist/MultiStats.d.ts +1 -1
- package/dist/MultiStats.js +19 -16
- package/dist/NormalModule.js +3 -4
- package/dist/Resolver.d.ts +1 -2
- package/dist/RspackError.js +1 -1
- package/dist/Stats.d.ts +1 -1
- package/dist/Stats.js +22 -2
- package/dist/Template.d.ts +4 -4
- package/dist/Template.js +8 -6
- package/dist/Watching.js +3 -5
- package/dist/builtin-loader/lightningcss/index.js +1 -1
- package/dist/builtin-plugin/DefinePlugin.js +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +11 -10
- package/dist/builtin-plugin/DynamicEntryPlugin.js +26 -15
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.js +1 -6
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.js +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +0 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +21 -4
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +29 -5
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +4 -6
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +17 -12
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +11 -9
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +13 -11
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +9 -7
- package/dist/builtin-plugin/css-extract/loader.js +5 -12
- package/dist/builtin-plugin/lazy-compilation/backend.js +4 -4
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/adapter.js +1 -0
- package/dist/config/adapterRuleUse.d.ts +2 -6
- package/dist/config/adapterRuleUse.js +7 -6
- package/dist/config/defaults.js +21 -32
- package/dist/config/normalization.d.ts +1 -0
- package/dist/config/normalization.js +5 -2
- package/dist/config/zod.d.ts +762 -114
- package/dist/config/zod.js +29 -6
- package/dist/container/default.runtime.js +1 -1
- package/dist/exports.d.ts +4 -3
- package/dist/exports.js +5 -2
- package/dist/lib/AbstractMethodError.js +2 -3
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/lib/Cache.js +6 -4
- package/dist/lib/CacheFacade.js +8 -9
- package/dist/lib/Dependency.d.ts +23 -0
- package/dist/lib/Dependency.js +11 -0
- package/dist/lib/EnvironmentPlugin.js +1 -3
- package/dist/lib/LoaderOptionsPlugin.d.ts +4 -2
- package/dist/lib/LoaderOptionsPlugin.js +0 -2
- package/dist/lib/ModuleFilenameHelpers.js +1 -1
- package/dist/lib/WebpackError.d.ts +0 -6
- package/dist/lib/WebpackError.js +0 -8
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/MemoryCachePlugin.js +40 -0
- package/dist/lib/cache/mergeEtags.d.ts +3 -3
- package/dist/lib/cache/mergeEtags.js +5 -3
- package/dist/lib/formatLocation.d.ts +1 -1
- package/dist/loader-runner/index.js +10 -9
- package/dist/loader-runner/loadLoader.js +8 -11
- package/dist/logging/Logger.js +3 -3
- package/dist/logging/createConsoleLogger.d.ts +26 -6
- package/dist/logging/createConsoleLogger.js +21 -58
- package/dist/logging/runtime.d.ts +4 -10
- package/dist/logging/runtime.js +8 -23
- package/dist/logging/truncateArgs.d.ts +4 -4
- package/dist/logging/truncateArgs.js +5 -10
- package/dist/node/NodeEnvironmentPlugin.js +2 -2
- package/dist/node/NodeWatchFileSystem.js +6 -6
- package/dist/node/nodeConsole.d.ts +7 -21
- package/dist/node/nodeConsole.js +31 -38
- package/dist/rspackOptionsApply.d.ts +0 -1
- package/dist/rspackOptionsApply.js +8 -7
- package/dist/sharing/ProvideSharedPlugin.d.ts +20 -19
- package/dist/sharing/ProvideSharedPlugin.js +26 -17
- package/dist/sharing/SharePlugin.d.ts +3 -0
- package/dist/sharing/SharePlugin.js +4 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +187 -96
- package/dist/stats/DefaultStatsPresetPlugin.js +2 -5
- package/dist/stats/DefaultStatsPrinterPlugin.js +18 -19
- package/dist/stats/StatsFactory.d.ts +2 -1
- package/dist/stats/StatsFactory.js +5 -10
- package/dist/stats/StatsPrinter.js +3 -4
- package/dist/stats/statsFactoryUtils.d.ts +155 -28
- package/dist/util/SizeFormatHelpers.js +1 -1
- package/dist/util/assertNotNil.d.ts +1 -1
- package/dist/util/assetCondition.d.ts +2 -0
- package/dist/util/assetCondition.js +2 -0
- package/dist/util/bindingVersionCheck.js +3 -3
- package/dist/util/cleverMerge.js +8 -6
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/comparators.js +5 -4
- package/dist/util/createHash.js +11 -6
- package/dist/util/fs.js +2 -2
- package/dist/util/hash/wasm-hash.js +5 -4
- package/dist/util/identifier.d.ts +4 -4
- package/dist/util/identifier.js +10 -10
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +4 -6
- package/dist/util/smartGrouping.js +4 -6
- package/dist/util/webpack.d.ts +1 -1
- package/dist/util/webpack.js +2 -1
- package/module.d.ts +1 -1
- package/package.json +3 -3
- package/dist/builtin-plugin/css-extract/loader-options.json +0 -37
- package/dist/builtin-plugin/css-extract/plugin-options.json +0 -79
package/dist/ChunkGroup.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class ChunkGroup {
|
|
|
6
6
|
protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
|
|
7
7
|
getFiles(): ReadonlyArray<string>;
|
|
8
8
|
getParents(): ReadonlyArray<ChunkGroup>;
|
|
9
|
+
isInitial(): boolean;
|
|
9
10
|
get chunks(): ReadonlyArray<Chunk>;
|
|
10
11
|
get index(): Readonly<number | undefined>;
|
|
11
12
|
get name(): Readonly<string | undefined>;
|
package/dist/ChunkGroup.js
CHANGED
|
@@ -40,6 +40,9 @@ class ChunkGroup {
|
|
|
40
40
|
return ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f"));
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
isInitial() {
|
|
44
|
+
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").isInitial;
|
|
45
|
+
}
|
|
43
46
|
get chunks() {
|
|
44
47
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").chunks.map(c => Chunk_1.Chunk.__from_binding(c, __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f")));
|
|
45
48
|
}
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -102,6 +102,24 @@ export interface KnownNormalizedStatsOptions {
|
|
|
102
102
|
logging: false | "none" | "error" | "warn" | "info" | "log" | "verbose";
|
|
103
103
|
loggingDebug: ((value: string) => boolean)[];
|
|
104
104
|
loggingTrace: boolean;
|
|
105
|
+
chunkModules: boolean;
|
|
106
|
+
chunkRelations: boolean;
|
|
107
|
+
reasons: boolean;
|
|
108
|
+
moduleAssets: boolean;
|
|
109
|
+
nestedModules: boolean;
|
|
110
|
+
source: boolean;
|
|
111
|
+
usedExports: boolean;
|
|
112
|
+
providedExports: boolean;
|
|
113
|
+
optimizationBailout: boolean;
|
|
114
|
+
depth: boolean;
|
|
115
|
+
assets: boolean;
|
|
116
|
+
chunks: boolean;
|
|
117
|
+
errors: boolean;
|
|
118
|
+
errorsCount: boolean;
|
|
119
|
+
hash: boolean;
|
|
120
|
+
modules: boolean;
|
|
121
|
+
warnings: boolean;
|
|
122
|
+
warningsCount: boolean;
|
|
105
123
|
}
|
|
106
124
|
export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;
|
|
107
125
|
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
|
|
@@ -149,6 +167,7 @@ export declare class Compilation {
|
|
|
149
167
|
Set<string>
|
|
150
168
|
], void>;
|
|
151
169
|
runtimeModule: RuntimeModule;
|
|
170
|
+
seal: liteTapable.SyncHook<[], void>;
|
|
152
171
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
153
172
|
}>;
|
|
154
173
|
name?: string;
|
|
@@ -192,6 +211,7 @@ export declare class Compilation {
|
|
|
192
211
|
* Note: This is a proxy for webpack internal API, only method `get` and `keys` is supported now.
|
|
193
212
|
*/
|
|
194
213
|
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
214
|
+
get entries(): Map<string, EntryData>;
|
|
195
215
|
/**
|
|
196
216
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
197
217
|
*
|
|
@@ -202,7 +222,7 @@ export declare class Compilation {
|
|
|
202
222
|
buildMeta: Record<string, unknown>;
|
|
203
223
|
};
|
|
204
224
|
getCache(name: string): import("./lib/CacheFacade").CacheFacade;
|
|
205
|
-
createStatsOptions(
|
|
225
|
+
createStatsOptions(statsValue: StatsValue | undefined, context?: CreateStatsOptionsContext): NormalizedStatsOptions;
|
|
206
226
|
createStatsFactory(options: StatsOptions): StatsFactory;
|
|
207
227
|
createStatsPrinter(options: StatsOptions): StatsPrinter;
|
|
208
228
|
/**
|
|
@@ -355,3 +375,20 @@ export declare class Compilation {
|
|
|
355
375
|
static PROCESS_ASSETS_STAGE_ANALYSE: number;
|
|
356
376
|
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
357
377
|
}
|
|
378
|
+
export type EntryData = binding.JsEntryData;
|
|
379
|
+
export declare class Entries implements Map<string, EntryData> {
|
|
380
|
+
#private;
|
|
381
|
+
constructor(data: binding.JsEntries);
|
|
382
|
+
clear(): void;
|
|
383
|
+
forEach(callback: (value: binding.JsEntryData, key: string, map: Map<string, binding.JsEntryData>) => void, thisArg?: any): void;
|
|
384
|
+
get size(): number;
|
|
385
|
+
entries(): IterableIterator<[string, binding.JsEntryData]>;
|
|
386
|
+
values(): IterableIterator<binding.JsEntryData>;
|
|
387
|
+
[Symbol.iterator](): IterableIterator<[string, binding.JsEntryData]>;
|
|
388
|
+
get [Symbol.toStringTag](): string;
|
|
389
|
+
has(key: string): boolean;
|
|
390
|
+
set(key: string, value: EntryData): this;
|
|
391
|
+
delete(key: string): boolean;
|
|
392
|
+
get(key: string): EntryData | undefined;
|
|
393
|
+
keys(): IterableIterator<string>;
|
|
394
|
+
}
|
package/dist/Compilation.js
CHANGED
|
@@ -36,9 +36,9 @@ 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 _Compilation_instances, _Compilation_inner, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
|
|
39
|
+
var _Compilation_instances, _Compilation_inner, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller, _Entries_data;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.Compilation = void 0;
|
|
41
|
+
exports.Entries = exports.Compilation = void 0;
|
|
42
42
|
const binding_1 = require("@rspack/binding");
|
|
43
43
|
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
44
44
|
const Chunk_1 = require("./Chunk");
|
|
@@ -98,12 +98,14 @@ class Compilation {
|
|
|
98
98
|
const errorMessage = (reason) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
|
99
99
|
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
|
100
100
|
const getOptions = (options) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (options.stage) {
|
|
101
|
+
const isString = typeof options === "string";
|
|
102
|
+
if (!isString && options.stage) {
|
|
104
103
|
throw new Error(errorMessage("it's using the 'stage' option"));
|
|
105
104
|
}
|
|
106
|
-
return {
|
|
105
|
+
return {
|
|
106
|
+
...(isString ? { name: options } : options),
|
|
107
|
+
stage: stage
|
|
108
|
+
};
|
|
107
109
|
};
|
|
108
110
|
return Object.freeze({
|
|
109
111
|
name,
|
|
@@ -157,6 +159,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
157
159
|
"runtimeRequirements"
|
|
158
160
|
]),
|
|
159
161
|
runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
|
|
162
|
+
seal: new liteTapable.SyncHook([]),
|
|
160
163
|
afterSeal: new liteTapable.AsyncSeriesHook([])
|
|
161
164
|
};
|
|
162
165
|
this.compiler = compiler;
|
|
@@ -237,6 +240,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
237
240
|
}
|
|
238
241
|
};
|
|
239
242
|
}
|
|
243
|
+
get entries() {
|
|
244
|
+
return new Entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entries);
|
|
245
|
+
}
|
|
240
246
|
/**
|
|
241
247
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
242
248
|
*
|
|
@@ -255,7 +261,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
255
261
|
getCache(name) {
|
|
256
262
|
return this.compiler.getCache(name);
|
|
257
263
|
}
|
|
258
|
-
createStatsOptions(
|
|
264
|
+
createStatsOptions(statsValue, context = {}) {
|
|
265
|
+
let optionsOrPreset = statsValue;
|
|
259
266
|
if (typeof optionsOrPreset === "boolean" ||
|
|
260
267
|
typeof optionsOrPreset === "string") {
|
|
261
268
|
optionsOrPreset = { preset: optionsOrPreset };
|
|
@@ -448,12 +455,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
448
455
|
{
|
|
449
456
|
method: "push",
|
|
450
457
|
handler(target, thisArg, warns) {
|
|
451
|
-
|
|
452
|
-
for (let i = 0; i < warns.length; i++) {
|
|
453
|
-
const warn = warns[i];
|
|
458
|
+
return Reflect.apply(target, thisArg, processWarningsHook.call(warns).map(warn => {
|
|
454
459
|
inner.pushDiagnostic(RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn));
|
|
455
|
-
|
|
456
|
-
|
|
460
|
+
return warn;
|
|
461
|
+
}));
|
|
457
462
|
}
|
|
458
463
|
},
|
|
459
464
|
{
|
|
@@ -473,12 +478,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
473
478
|
{
|
|
474
479
|
method: "unshift",
|
|
475
480
|
handler(target, thisArg, warns) {
|
|
476
|
-
|
|
477
|
-
|
|
481
|
+
const warnings = processWarningsHook.call(warns);
|
|
482
|
+
inner.spliceDiagnostic(0, 0, warnings.map(warn => {
|
|
478
483
|
return RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
return Reflect.apply(target, thisArg, warns);
|
|
484
|
+
}));
|
|
485
|
+
return Reflect.apply(target, thisArg, warnings);
|
|
482
486
|
}
|
|
483
487
|
},
|
|
484
488
|
{
|
|
@@ -521,11 +525,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
521
525
|
if (!name) {
|
|
522
526
|
throw new TypeError("Compilation.getLogger(name) called without a name");
|
|
523
527
|
}
|
|
528
|
+
let logName = name;
|
|
524
529
|
let logEntries;
|
|
525
530
|
return new Logger_1.Logger((type, args) => {
|
|
526
|
-
if (typeof
|
|
527
|
-
|
|
528
|
-
if (!
|
|
531
|
+
if (typeof logName === "function") {
|
|
532
|
+
logName = logName();
|
|
533
|
+
if (!logName) {
|
|
529
534
|
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
530
535
|
}
|
|
531
536
|
}
|
|
@@ -545,67 +550,68 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
545
550
|
args,
|
|
546
551
|
trace
|
|
547
552
|
};
|
|
548
|
-
if (this.hooks.log.call(
|
|
553
|
+
if (this.hooks.log.call(logName, logEntry) === undefined) {
|
|
549
554
|
if (logEntry.type === Logger_1.LogType.profileEnd) {
|
|
550
555
|
if (typeof console.profileEnd === "function") {
|
|
551
|
-
console.profileEnd(`[${
|
|
556
|
+
console.profileEnd(`[${logName}] ${logEntry.args[0]}`);
|
|
552
557
|
}
|
|
553
558
|
}
|
|
554
559
|
if (logEntries === undefined) {
|
|
555
|
-
logEntries = this.logging.get(
|
|
560
|
+
logEntries = this.logging.get(logName);
|
|
556
561
|
if (logEntries === undefined) {
|
|
557
562
|
logEntries = [];
|
|
558
|
-
this.logging.set(
|
|
563
|
+
this.logging.set(logName, logEntries);
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
566
|
logEntries.push(logEntry);
|
|
562
567
|
if (logEntry.type === Logger_1.LogType.profile) {
|
|
563
568
|
if (typeof console.profile === "function") {
|
|
564
|
-
console.profile(`[${
|
|
569
|
+
console.profile(`[${logName}] ${logEntry.args[0]}`);
|
|
565
570
|
}
|
|
566
571
|
}
|
|
567
572
|
}
|
|
568
573
|
}, (childName) => {
|
|
569
|
-
|
|
570
|
-
|
|
574
|
+
let normalizedChildName = childName;
|
|
575
|
+
if (typeof logName === "function") {
|
|
576
|
+
if (typeof normalizedChildName === "function") {
|
|
571
577
|
return this.getLogger(() => {
|
|
572
|
-
if (typeof
|
|
573
|
-
|
|
574
|
-
if (!
|
|
578
|
+
if (typeof logName === "function") {
|
|
579
|
+
logName = logName();
|
|
580
|
+
if (!logName) {
|
|
575
581
|
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
576
582
|
}
|
|
577
583
|
}
|
|
578
|
-
if (typeof
|
|
579
|
-
|
|
580
|
-
if (!
|
|
584
|
+
if (typeof normalizedChildName === "function") {
|
|
585
|
+
normalizedChildName = normalizedChildName();
|
|
586
|
+
if (!normalizedChildName) {
|
|
581
587
|
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
582
588
|
}
|
|
583
589
|
}
|
|
584
|
-
return `${
|
|
590
|
+
return `${logName}/${normalizedChildName}`;
|
|
585
591
|
});
|
|
586
592
|
}
|
|
587
593
|
return this.getLogger(() => {
|
|
588
|
-
if (typeof
|
|
589
|
-
|
|
590
|
-
if (!
|
|
594
|
+
if (typeof logName === "function") {
|
|
595
|
+
logName = logName();
|
|
596
|
+
if (!logName) {
|
|
591
597
|
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
592
598
|
}
|
|
593
599
|
}
|
|
594
|
-
return `${
|
|
600
|
+
return `${logName}/${normalizedChildName}`;
|
|
595
601
|
});
|
|
596
602
|
}
|
|
597
|
-
if (typeof
|
|
603
|
+
if (typeof normalizedChildName === "function") {
|
|
598
604
|
return this.getLogger(() => {
|
|
599
|
-
if (typeof
|
|
600
|
-
|
|
601
|
-
if (!
|
|
605
|
+
if (typeof normalizedChildName === "function") {
|
|
606
|
+
normalizedChildName = normalizedChildName();
|
|
607
|
+
if (!normalizedChildName) {
|
|
602
608
|
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
603
609
|
}
|
|
604
610
|
}
|
|
605
|
-
return `${
|
|
611
|
+
return `${logName}/${normalizedChildName}`;
|
|
606
612
|
});
|
|
607
613
|
}
|
|
608
|
-
return this.getLogger(`${
|
|
614
|
+
return this.getLogger(`${logName}/${normalizedChildName}`);
|
|
609
615
|
});
|
|
610
616
|
}
|
|
611
617
|
getStats() {
|
|
@@ -759,3 +765,62 @@ Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000;
|
|
|
759
765
|
Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000;
|
|
760
766
|
Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000;
|
|
761
767
|
exports.Compilation = Compilation;
|
|
768
|
+
class Entries {
|
|
769
|
+
constructor(data) {
|
|
770
|
+
_Entries_data.set(this, void 0);
|
|
771
|
+
__classPrivateFieldSet(this, _Entries_data, data, "f");
|
|
772
|
+
}
|
|
773
|
+
clear() {
|
|
774
|
+
__classPrivateFieldGet(this, _Entries_data, "f").clear();
|
|
775
|
+
}
|
|
776
|
+
forEach(callback, thisArg) {
|
|
777
|
+
for (const [key, value] of this) {
|
|
778
|
+
callback.call(thisArg, value, key, this);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
get size() {
|
|
782
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").size;
|
|
783
|
+
}
|
|
784
|
+
entries() {
|
|
785
|
+
const self = this;
|
|
786
|
+
const keys = this.keys();
|
|
787
|
+
return {
|
|
788
|
+
[Symbol.iterator]() {
|
|
789
|
+
return this;
|
|
790
|
+
},
|
|
791
|
+
next() {
|
|
792
|
+
const { done, value } = keys.next();
|
|
793
|
+
return {
|
|
794
|
+
done,
|
|
795
|
+
value: done ? undefined : [value, self.get(value)]
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
values() {
|
|
801
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").values()[Symbol.iterator]();
|
|
802
|
+
}
|
|
803
|
+
[(_Entries_data = new WeakMap(), Symbol.iterator)]() {
|
|
804
|
+
return this.entries();
|
|
805
|
+
}
|
|
806
|
+
get [Symbol.toStringTag]() {
|
|
807
|
+
return "Map";
|
|
808
|
+
}
|
|
809
|
+
has(key) {
|
|
810
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").has(key);
|
|
811
|
+
}
|
|
812
|
+
set(key, value) {
|
|
813
|
+
__classPrivateFieldGet(this, _Entries_data, "f").set(key, value);
|
|
814
|
+
return this;
|
|
815
|
+
}
|
|
816
|
+
delete(key) {
|
|
817
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").delete(key);
|
|
818
|
+
}
|
|
819
|
+
get(key) {
|
|
820
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").get(key);
|
|
821
|
+
}
|
|
822
|
+
keys() {
|
|
823
|
+
return __classPrivateFieldGet(this, _Entries_data, "f").keys()[Symbol.iterator]();
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
exports.Entries = Entries;
|
package/dist/Compiler.d.ts
CHANGED
package/dist/Compiler.js
CHANGED
|
@@ -137,6 +137,7 @@ class Compiler {
|
|
|
137
137
|
entryOption: new liteTapable.SyncBailHook(["context", "entry"])
|
|
138
138
|
};
|
|
139
139
|
this.webpack = index_1.rspack;
|
|
140
|
+
this.rspack = index_1.rspack;
|
|
140
141
|
this.root = this;
|
|
141
142
|
this.outputPath = "";
|
|
142
143
|
this.inputFileSystem = null;
|
|
@@ -199,62 +200,65 @@ class Compiler {
|
|
|
199
200
|
if (!name) {
|
|
200
201
|
throw new TypeError("Compiler.getInfrastructureLogger(name) called without a name");
|
|
201
202
|
}
|
|
203
|
+
let normalizedName = name;
|
|
202
204
|
return new Logger_1.Logger((type, args) => {
|
|
203
|
-
if (typeof
|
|
204
|
-
|
|
205
|
-
if (!
|
|
205
|
+
if (typeof normalizedName === "function") {
|
|
206
|
+
normalizedName = normalizedName();
|
|
207
|
+
if (!normalizedName) {
|
|
206
208
|
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
else {
|
|
210
|
-
if (this.hooks.infrastructureLog.call(
|
|
212
|
+
if (this.hooks.infrastructureLog.call(normalizedName, type, args) ===
|
|
213
|
+
undefined) {
|
|
211
214
|
if (this.infrastructureLogger !== undefined) {
|
|
212
|
-
this.infrastructureLogger(
|
|
215
|
+
this.infrastructureLogger(normalizedName, type, args);
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
219
|
}, (childName) => {
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
let normalizedChildName = childName;
|
|
221
|
+
if (typeof normalizedName === "function") {
|
|
222
|
+
if (typeof normalizedChildName === "function") {
|
|
219
223
|
// @ts-expect-error
|
|
220
224
|
return this.getInfrastructureLogger(_ => {
|
|
221
|
-
if (typeof
|
|
222
|
-
|
|
223
|
-
if (!
|
|
225
|
+
if (typeof normalizedName === "function") {
|
|
226
|
+
normalizedName = normalizedName();
|
|
227
|
+
if (!normalizedName) {
|
|
224
228
|
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
225
229
|
}
|
|
226
230
|
}
|
|
227
|
-
if (typeof
|
|
228
|
-
|
|
229
|
-
if (!
|
|
231
|
+
if (typeof normalizedChildName === "function") {
|
|
232
|
+
normalizedChildName = normalizedChildName();
|
|
233
|
+
if (!normalizedChildName) {
|
|
230
234
|
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
|
-
return `${
|
|
237
|
+
return `${normalizedName}/${normalizedChildName}`;
|
|
234
238
|
});
|
|
235
239
|
}
|
|
236
240
|
return this.getInfrastructureLogger(() => {
|
|
237
|
-
if (typeof
|
|
238
|
-
|
|
239
|
-
if (!
|
|
241
|
+
if (typeof normalizedName === "function") {
|
|
242
|
+
normalizedName = normalizedName();
|
|
243
|
+
if (!normalizedName) {
|
|
240
244
|
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
241
245
|
}
|
|
242
246
|
}
|
|
243
|
-
return `${
|
|
247
|
+
return `${normalizedName}/${normalizedChildName}`;
|
|
244
248
|
});
|
|
245
249
|
}
|
|
246
|
-
if (typeof
|
|
250
|
+
if (typeof normalizedChildName === "function") {
|
|
247
251
|
return this.getInfrastructureLogger(() => {
|
|
248
|
-
if (typeof
|
|
249
|
-
|
|
250
|
-
if (!
|
|
252
|
+
if (typeof normalizedChildName === "function") {
|
|
253
|
+
normalizedChildName = normalizedChildName();
|
|
254
|
+
if (!normalizedChildName) {
|
|
251
255
|
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
|
-
return `${
|
|
258
|
+
return `${normalizedName}/${normalizedChildName}`;
|
|
255
259
|
});
|
|
256
260
|
}
|
|
257
|
-
return this.getInfrastructureLogger(`${
|
|
261
|
+
return this.getInfrastructureLogger(`${normalizedName}/${normalizedChildName}`);
|
|
258
262
|
});
|
|
259
263
|
}
|
|
260
264
|
/**
|
|
@@ -368,7 +372,7 @@ class Compiler {
|
|
|
368
372
|
});
|
|
369
373
|
}
|
|
370
374
|
purgeInputFileSystem() {
|
|
371
|
-
if (this.inputFileSystem
|
|
375
|
+
if (this.inputFileSystem?.purge) {
|
|
372
376
|
this.inputFileSystem.purge();
|
|
373
377
|
}
|
|
374
378
|
}
|
|
@@ -614,7 +618,7 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
614
618
|
throw cached.error;
|
|
615
619
|
return cached.exports;
|
|
616
620
|
}
|
|
617
|
-
|
|
621
|
+
const execOptions = {
|
|
618
622
|
id,
|
|
619
623
|
module: {
|
|
620
624
|
id,
|
|
@@ -665,6 +669,7 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
665
669
|
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), filename)),
|
|
666
670
|
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.processAssets, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
667
671
|
registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterProcessAssets, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
672
|
+
registerCompilationSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSeal, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.seal, queried => () => queried.call()),
|
|
668
673
|
registerCompilationAfterSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterSeal, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterSeal, queried => async () => await queried.promise()),
|
|
669
674
|
registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
|
|
670
675
|
const normalizedResolveData = {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const node_vm_1 = __importDefault(require("node:vm"));
|
|
7
7
|
const _1 = require(".");
|
|
8
8
|
class ExecuteModulePlugin {
|
|
9
|
-
constructor() { }
|
|
10
9
|
apply(compiler) {
|
|
11
10
|
compiler.hooks.compilation.tap("executeModule", compilation => {
|
|
12
11
|
compilation.hooks.executeModule.tap("executeModule", (options, context) => {
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsCodegenerationResult,
|
|
1
|
+
import type { JsCodegenerationResult, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
|
|
2
2
|
import type { Source } from "../compiled/webpack-sources";
|
|
3
3
|
import type { Compilation } from "./Compilation";
|
|
4
4
|
export type ResourceData = {
|
|
@@ -68,5 +68,4 @@ export declare class CodeGenerationResult {
|
|
|
68
68
|
get(sourceType: string): string;
|
|
69
69
|
}
|
|
70
70
|
export declare class CodeGenerationResults {
|
|
71
|
-
constructor(_result: JsCodegenerationResults);
|
|
72
71
|
}
|
package/dist/Module.js
CHANGED
package/dist/MultiCompiler.js
CHANGED
|
@@ -51,21 +51,25 @@ const ArrayQueue_1 = __importDefault(require("./util/ArrayQueue"));
|
|
|
51
51
|
class MultiCompiler {
|
|
52
52
|
constructor(compilers, options) {
|
|
53
53
|
_MultiCompiler_instances.add(this);
|
|
54
|
+
let normalizedCompilers;
|
|
54
55
|
if (!Array.isArray(compilers)) {
|
|
55
|
-
|
|
56
|
+
normalizedCompilers = Object.entries(compilers).map(([name, compiler]) => {
|
|
56
57
|
compiler.name = name;
|
|
57
58
|
return compiler;
|
|
58
59
|
});
|
|
59
60
|
}
|
|
61
|
+
else {
|
|
62
|
+
normalizedCompilers = compilers;
|
|
63
|
+
}
|
|
60
64
|
this.hooks = {
|
|
61
65
|
done: new liteTapable.SyncHook(["stats"]),
|
|
62
|
-
invalid: new liteTapable.MultiHook(
|
|
63
|
-
run: new liteTapable.MultiHook(
|
|
66
|
+
invalid: new liteTapable.MultiHook(normalizedCompilers.map(c => c.hooks.invalid)),
|
|
67
|
+
run: new liteTapable.MultiHook(normalizedCompilers.map(c => c.hooks.run)),
|
|
64
68
|
watchClose: new liteTapable.SyncHook([]),
|
|
65
|
-
watchRun: new liteTapable.MultiHook(
|
|
66
|
-
infrastructureLog: new liteTapable.MultiHook(
|
|
69
|
+
watchRun: new liteTapable.MultiHook(normalizedCompilers.map(c => c.hooks.watchRun)),
|
|
70
|
+
infrastructureLog: new liteTapable.MultiHook(normalizedCompilers.map(c => c.hooks.infrastructureLog))
|
|
67
71
|
};
|
|
68
|
-
this.compilers =
|
|
72
|
+
this.compilers = normalizedCompilers;
|
|
69
73
|
this._options = {
|
|
70
74
|
parallelism: options?.parallelism || Number.POSITIVE_INFINITY
|
|
71
75
|
};
|
|
@@ -271,7 +275,7 @@ class MultiCompiler {
|
|
|
271
275
|
}
|
|
272
276
|
purgeInputFileSystem() {
|
|
273
277
|
for (const compiler of this.compilers) {
|
|
274
|
-
if (compiler.inputFileSystem
|
|
278
|
+
if (compiler.inputFileSystem?.purge) {
|
|
275
279
|
compiler.inputFileSystem.purge();
|
|
276
280
|
}
|
|
277
281
|
}
|
package/dist/MultiStats.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export default class MultiStats {
|
|
|
16
16
|
get hash(): string;
|
|
17
17
|
hasErrors(): boolean;
|
|
18
18
|
hasWarnings(): boolean;
|
|
19
|
-
toJson(options
|
|
19
|
+
toJson(options: any): StatsCompilation;
|
|
20
20
|
toString(options: any): string;
|
|
21
21
|
}
|
|
22
22
|
export { MultiStats };
|