@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
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName, type RawProvideOptions } from "@rspack/binding";
|
|
2
2
|
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
|
-
export type ProvideSharedPluginOptions = {
|
|
5
|
-
provides: Provides
|
|
4
|
+
export type ProvideSharedPluginOptions<Enhanced extends boolean = false> = {
|
|
5
|
+
provides: Provides<Enhanced>;
|
|
6
6
|
shareScope?: string;
|
|
7
|
-
enhanced?:
|
|
7
|
+
enhanced?: Enhanced;
|
|
8
8
|
};
|
|
9
|
-
export type Provides = (ProvidesItem | ProvidesObject)[] | ProvidesObject
|
|
9
|
+
export type Provides<Enhanced extends boolean> = (ProvidesItem | ProvidesObject<Enhanced>)[] | ProvidesObject<Enhanced>;
|
|
10
10
|
export type ProvidesItem = string;
|
|
11
|
-
export type ProvidesObject = {
|
|
12
|
-
[k: string]: ProvidesConfig | ProvidesItem;
|
|
11
|
+
export type ProvidesObject<Enhanced extends boolean> = {
|
|
12
|
+
[k: string]: ProvidesConfig<Enhanced> | ProvidesItem;
|
|
13
13
|
};
|
|
14
|
-
export type ProvidesConfig =
|
|
14
|
+
export type ProvidesConfig<Enhanced extends boolean> = Enhanced extends true ? ProvidesEnhancedConfig : ProvidesV1Config;
|
|
15
|
+
type ProvidesV1Config = {
|
|
15
16
|
eager?: boolean;
|
|
16
17
|
shareKey: string;
|
|
17
18
|
shareScope?: string;
|
|
18
19
|
version?: false | string;
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
type ProvidesEnhancedConfig = ProvidesV1Config & ProvidesEnhancedExtraConfig;
|
|
22
|
+
type ProvidesEnhancedExtraConfig = {
|
|
23
|
+
singleton?: boolean;
|
|
24
|
+
strictVersion?: boolean;
|
|
25
|
+
requiredVersion?: false | string;
|
|
26
|
+
};
|
|
27
|
+
export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
|
|
21
28
|
name: BuiltinPluginName;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
version: string | false | undefined;
|
|
26
|
-
shareScope: string;
|
|
27
|
-
eager: boolean;
|
|
28
|
-
}][];
|
|
29
|
-
enhanced: boolean;
|
|
30
|
-
};
|
|
31
|
-
constructor(options: ProvideSharedPluginOptions);
|
|
29
|
+
_provides: [string, Omit<RawProvideOptions, "key">][];
|
|
30
|
+
_enhanced?: Enhanced;
|
|
31
|
+
constructor(options: ProvideSharedPluginOptions<Enhanced>);
|
|
32
32
|
raw(compiler: Compiler): BuiltinPlugin;
|
|
33
33
|
}
|
|
34
|
+
export {};
|
|
@@ -9,29 +9,38 @@ class ProvideSharedPlugin extends base_1.RspackBuiltinPlugin {
|
|
|
9
9
|
constructor(options) {
|
|
10
10
|
super();
|
|
11
11
|
this.name = binding_1.BuiltinPluginName.ProvideSharedPlugin;
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, item => ({
|
|
12
|
+
this._provides = (0, options_1.parseOptions)(options.provides, item => {
|
|
13
|
+
if (Array.isArray(item))
|
|
14
|
+
throw new Error("Unexpected array of provides");
|
|
15
|
+
return {
|
|
16
|
+
shareKey: item,
|
|
17
|
+
version: undefined,
|
|
18
|
+
shareScope: options.shareScope || "default",
|
|
19
|
+
eager: false
|
|
20
|
+
};
|
|
21
|
+
}, item => {
|
|
22
|
+
const raw = {
|
|
24
23
|
shareKey: item.shareKey,
|
|
25
24
|
version: item.version,
|
|
26
25
|
shareScope: item.shareScope || options.shareScope || "default",
|
|
27
26
|
eager: !!item.eager
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
};
|
|
28
|
+
if (options.enhanced) {
|
|
29
|
+
const enhancedItem = item;
|
|
30
|
+
return {
|
|
31
|
+
...raw,
|
|
32
|
+
singleton: enhancedItem.singleton,
|
|
33
|
+
requiredVersion: enhancedItem.requiredVersion,
|
|
34
|
+
strictVersion: enhancedItem.strictVersion
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return raw;
|
|
38
|
+
});
|
|
39
|
+
this._enhanced = options.enhanced;
|
|
31
40
|
}
|
|
32
41
|
raw(compiler) {
|
|
33
|
-
new ShareRuntimePlugin_1.ShareRuntimePlugin(this.
|
|
34
|
-
const rawOptions = this.
|
|
42
|
+
new ShareRuntimePlugin_1.ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
43
|
+
const rawOptions = this._provides.map(([key, v]) => ({
|
|
35
44
|
key,
|
|
36
45
|
...v
|
|
37
46
|
}));
|
|
@@ -40,6 +40,9 @@ export declare class SharePlugin {
|
|
|
40
40
|
shareScope: string | undefined;
|
|
41
41
|
version: string | false | undefined;
|
|
42
42
|
eager: boolean | undefined;
|
|
43
|
+
singleton: boolean | undefined;
|
|
44
|
+
requiredVersion: string | false | undefined;
|
|
45
|
+
strictVersion: boolean | undefined;
|
|
43
46
|
};
|
|
44
47
|
}[];
|
|
45
48
|
_enhanced: boolean;
|
|
@@ -39,7 +39,10 @@ class SharePlugin {
|
|
|
39
39
|
shareKey: options.shareKey || key,
|
|
40
40
|
shareScope: options.shareScope,
|
|
41
41
|
version: options.version,
|
|
42
|
-
eager: options.eager
|
|
42
|
+
eager: options.eager,
|
|
43
|
+
singleton: options.singleton,
|
|
44
|
+
requiredVersion: options.requiredVersion,
|
|
45
|
+
strictVersion: options.strictVersion
|
|
43
46
|
}
|
|
44
47
|
}));
|
|
45
48
|
this._shareScope = options.shareScope;
|
|
@@ -120,7 +120,7 @@ const ASSETS_GROUPERS = {
|
|
|
120
120
|
? `${path.join("/")}/*${extension}`
|
|
121
121
|
: `*${extension}`);
|
|
122
122
|
while (path.length > 0) {
|
|
123
|
-
keys.push(path.join("/")
|
|
123
|
+
keys.push(`${path.join("/")}/`);
|
|
124
124
|
path.pop();
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -146,7 +146,7 @@ const ASSETS_GROUPERS = {
|
|
|
146
146
|
const groupByAssetInfoFlag = (name) => {
|
|
147
147
|
groupConfigs.push({
|
|
148
148
|
getKeys: asset => {
|
|
149
|
-
return asset.info
|
|
149
|
+
return asset.info?.[name] ? ["1"] : undefined;
|
|
150
150
|
},
|
|
151
151
|
// @ts-expect-error
|
|
152
152
|
createGroup: (key, children) => {
|
|
@@ -256,12 +256,13 @@ const MODULES_GROUPERS = (type) => ({
|
|
|
256
256
|
if (groupModulesByType || !options.runtimeModules) {
|
|
257
257
|
groupConfigs.push({
|
|
258
258
|
getKeys: (module) => {
|
|
259
|
-
|
|
259
|
+
const moduleType = module.moduleType;
|
|
260
|
+
if (!moduleType)
|
|
260
261
|
return;
|
|
261
262
|
if (groupModulesByType) {
|
|
262
|
-
return [
|
|
263
|
+
return [moduleType.split("/", 1)[0]];
|
|
263
264
|
}
|
|
264
|
-
if (
|
|
265
|
+
if (moduleType === "runtime") {
|
|
265
266
|
return ["runtime"];
|
|
266
267
|
}
|
|
267
268
|
},
|
|
@@ -305,7 +306,7 @@ const MODULES_GROUPERS = (type) => ({
|
|
|
305
306
|
? `${path.join("/")}/*${extension}`
|
|
306
307
|
: `*${extension}`);
|
|
307
308
|
while (path.length > 0) {
|
|
308
|
-
keys.push(path.join("/")
|
|
309
|
+
keys.push(`${path.join("/")}/`);
|
|
309
310
|
path.pop();
|
|
310
311
|
}
|
|
311
312
|
}
|
|
@@ -397,7 +398,7 @@ const RESULT_SORTERS = {
|
|
|
397
398
|
};
|
|
398
399
|
const MODULES_SORTER = {
|
|
399
400
|
_: comparators => {
|
|
400
|
-
comparators.push((0, comparators_1.compareSelect)((m) => m.depth, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.preOrderIndex, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.identifier, compareIds));
|
|
401
|
+
comparators.push((0, comparators_1.compareSelect)((m) => m.commonAttributes.depth, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.commonAttributes.preOrderIndex, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.commonAttributes.moduleDescriptor?.identifier, compareIds));
|
|
401
402
|
}
|
|
402
403
|
};
|
|
403
404
|
const SORTERS = {
|
|
@@ -426,16 +427,33 @@ const SORTERS = {
|
|
|
426
427
|
const EXTRACT_ERROR = {
|
|
427
428
|
_: (object, error) => {
|
|
428
429
|
object.message = error.message;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
430
|
+
if (error.chunkName) {
|
|
431
|
+
object.chunkName = error.chunkName;
|
|
432
|
+
}
|
|
433
|
+
if (error.chunkEntry) {
|
|
434
|
+
object.chunkEntry = error.chunkEntry;
|
|
435
|
+
}
|
|
436
|
+
if (error.chunkInitial) {
|
|
437
|
+
object.chunkInitial = error.chunkInitial;
|
|
438
|
+
}
|
|
439
|
+
if (error.file) {
|
|
440
|
+
object.file = error.file;
|
|
441
|
+
}
|
|
442
|
+
if (error.moduleDescriptor) {
|
|
443
|
+
object.moduleIdentifier = error.moduleDescriptor.identifier;
|
|
444
|
+
object.moduleName = error.moduleDescriptor.name;
|
|
445
|
+
}
|
|
446
|
+
if ("loc" in error) {
|
|
447
|
+
object.loc = error.loc;
|
|
448
|
+
}
|
|
435
449
|
},
|
|
436
450
|
ids: (object, error) => {
|
|
437
|
-
|
|
438
|
-
|
|
451
|
+
if (error.chunkId) {
|
|
452
|
+
object.chunkId = error.chunkId;
|
|
453
|
+
}
|
|
454
|
+
if (error.moduleDescriptor) {
|
|
455
|
+
object.moduleId = error.moduleDescriptor.id;
|
|
456
|
+
}
|
|
439
457
|
},
|
|
440
458
|
moduleTrace: (object, error, context, _, factory) => {
|
|
441
459
|
const { type } = context;
|
|
@@ -451,17 +469,18 @@ const EXTRACT_ERROR = {
|
|
|
451
469
|
const SIMPLE_EXTRACTORS = {
|
|
452
470
|
compilation: {
|
|
453
471
|
_: (object, compilation, context, options) => {
|
|
472
|
+
const statsCompilation = context.getStatsCompilation(compilation);
|
|
454
473
|
if (!context.makePathsRelative) {
|
|
455
474
|
context.makePathsRelative = identifier_1.makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root);
|
|
456
475
|
}
|
|
457
476
|
if (!context.cachedGetErrors) {
|
|
458
477
|
context.cachedGetErrors = _compilation => {
|
|
459
|
-
return
|
|
478
|
+
return statsCompilation.errors;
|
|
460
479
|
};
|
|
461
480
|
}
|
|
462
481
|
if (!context.cachedGetWarnings) {
|
|
463
482
|
context.cachedGetWarnings = _compilation => {
|
|
464
|
-
const warnings =
|
|
483
|
+
const warnings = statsCompilation.warnings;
|
|
465
484
|
return compilation.hooks.processWarnings.call(warnings);
|
|
466
485
|
};
|
|
467
486
|
}
|
|
@@ -605,7 +624,8 @@ const SIMPLE_EXTRACTORS = {
|
|
|
605
624
|
}
|
|
606
625
|
},
|
|
607
626
|
hash: (object, compilation, context) => {
|
|
608
|
-
|
|
627
|
+
const statsCompilation = context.getStatsCompilation(compilation);
|
|
628
|
+
object.hash = statsCompilation.hash;
|
|
609
629
|
},
|
|
610
630
|
version: object => {
|
|
611
631
|
const { version, webpackVersion } = require("../../package.json");
|
|
@@ -628,9 +648,10 @@ const SIMPLE_EXTRACTORS = {
|
|
|
628
648
|
object.outputPath = compilation.outputOptions.path;
|
|
629
649
|
},
|
|
630
650
|
assets: (object, compilation, context, options, factory) => {
|
|
631
|
-
const {
|
|
632
|
-
|
|
633
|
-
|
|
651
|
+
const { type, getStatsCompilation } = context;
|
|
652
|
+
const statsCompilation = getStatsCompilation(compilation);
|
|
653
|
+
const compilationAssets = statsCompilation.assets;
|
|
654
|
+
const assetsByChunkName = statsCompilation.assetsByChunkName;
|
|
634
655
|
const assetMap = new Map();
|
|
635
656
|
const assets = new Set();
|
|
636
657
|
for (const asset of compilationAssets) {
|
|
@@ -665,7 +686,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
665
686
|
acc[cur.name] = cur.files;
|
|
666
687
|
return acc;
|
|
667
688
|
}, {});
|
|
668
|
-
const groupedAssets = factory.create(`${
|
|
689
|
+
const groupedAssets = factory.create(`${type}.assets`, Array.from(assets), {
|
|
669
690
|
...context
|
|
670
691
|
// compilationFileToChunks
|
|
671
692
|
// compilationAuxiliaryFileToChunks
|
|
@@ -675,28 +696,24 @@ const SIMPLE_EXTRACTORS = {
|
|
|
675
696
|
object.filteredAssets = limited.filteredChildren;
|
|
676
697
|
},
|
|
677
698
|
chunks: (object, compilation, context, options, factory) => {
|
|
678
|
-
const { type } = context;
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
.getChunks(options.chunkModules, options.chunkRelations, options.reasons, options.moduleAssets, options.nestedModules, options.source, options.usedExports, options.providedExports);
|
|
699
|
+
const { type, getStatsCompilation } = context;
|
|
700
|
+
const statsCompilation = getStatsCompilation(compilation);
|
|
701
|
+
const chunks = statsCompilation.chunks;
|
|
682
702
|
object.chunks = factory.create(`${type}.chunks`, chunks, context);
|
|
683
703
|
},
|
|
684
704
|
modules: (object, compilation, context, options, factory) => {
|
|
685
|
-
const { type } = context;
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
.getModules(options.reasons, options.moduleAssets, options.nestedModules, options.source, options.usedExports, options.providedExports);
|
|
705
|
+
const { type, getStatsCompilation } = context;
|
|
706
|
+
const statsCompilation = getStatsCompilation(compilation);
|
|
707
|
+
const array = statsCompilation.modules;
|
|
689
708
|
const groupedModules = factory.create(`${type}.modules`, array, context);
|
|
690
709
|
const limited = (0, statsFactoryUtils_1.spaceLimited)(groupedModules, options.modulesSpace);
|
|
691
710
|
object.modules = limited.children;
|
|
692
711
|
object.filteredModules = limited.filteredChildren;
|
|
693
712
|
},
|
|
694
713
|
entrypoints: (object, compilation, context, { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, factory) => {
|
|
695
|
-
const { type } = context;
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
.getEntrypoints(chunkGroupAuxiliary, chunkGroupChildren)
|
|
699
|
-
.map(entrypoint => ({
|
|
714
|
+
const { type, getStatsCompilation } = context;
|
|
715
|
+
const statsCompilation = getStatsCompilation(compilation);
|
|
716
|
+
const array = statsCompilation.entrypoints.map(entrypoint => ({
|
|
700
717
|
name: entrypoint.name,
|
|
701
718
|
chunkGroup: entrypoint
|
|
702
719
|
}));
|
|
@@ -722,26 +739,65 @@ const SIMPLE_EXTRACTORS = {
|
|
|
722
739
|
object.entrypoints = factory.create(`${type}.entrypoints`, array, context);
|
|
723
740
|
},
|
|
724
741
|
chunkGroups: (object, compilation, context, { chunkGroupAuxiliary, chunkGroupChildren }, factory) => {
|
|
725
|
-
const { type } = context;
|
|
726
|
-
const
|
|
727
|
-
|
|
728
|
-
.getNamedChunkGroups(chunkGroupAuxiliary, chunkGroupChildren)
|
|
729
|
-
.map(cg => ({
|
|
742
|
+
const { type, getStatsCompilation } = context;
|
|
743
|
+
const statsCompilation = getStatsCompilation(compilation);
|
|
744
|
+
const namedChunkGroups = statsCompilation.namedChunkGroups.map(cg => ({
|
|
730
745
|
name: cg.name,
|
|
731
746
|
chunkGroup: cg
|
|
732
747
|
}));
|
|
733
748
|
object.namedChunkGroups = factory.create(`${type}.namedChunkGroups`, namedChunkGroups, context);
|
|
734
749
|
},
|
|
735
|
-
errors: (object, compilation, context,
|
|
736
|
-
const { cachedGetErrors } = context;
|
|
737
|
-
|
|
750
|
+
errors: (object, compilation, context, options, factory) => {
|
|
751
|
+
const { type, cachedGetErrors } = context;
|
|
752
|
+
// const rawErrors = cachedGetErrors!(compilation);
|
|
753
|
+
const factorizedErrors = factory.create(`${type}.errors`, cachedGetErrors(compilation), context);
|
|
754
|
+
// let filtered = 0;
|
|
755
|
+
// if (options.errorDetails === "auto" && rawErrors.length >= 3) {
|
|
756
|
+
// filtered = rawErrors
|
|
757
|
+
// .map(e => typeof e !== "string" && e.details)
|
|
758
|
+
// .filter(Boolean).length;
|
|
759
|
+
// }
|
|
760
|
+
// if (
|
|
761
|
+
// options.errorDetails === true ||
|
|
762
|
+
// !Number.isFinite(options.errorsSpace)
|
|
763
|
+
// ) {
|
|
764
|
+
// object.errors = factorizedErrors;
|
|
765
|
+
// if (filtered) object.filteredErrorDetailsCount = filtered;
|
|
766
|
+
// return;
|
|
767
|
+
// }
|
|
768
|
+
// const [errors, filteredBySpace] = errorsSpaceLimit(
|
|
769
|
+
// factorizedErrors,
|
|
770
|
+
// options.errorsSpace
|
|
771
|
+
// );
|
|
772
|
+
// object.filteredErrorDetailsCount = filtered + filteredBySpace;
|
|
773
|
+
object.errors = factorizedErrors;
|
|
738
774
|
},
|
|
739
775
|
errorsCount: (object, compilation, { cachedGetErrors }) => {
|
|
740
776
|
object.errorsCount = (0, statsFactoryUtils_1.countWithChildren)(compilation, c => cachedGetErrors(c));
|
|
741
777
|
},
|
|
742
|
-
warnings: (object, compilation, context,
|
|
743
|
-
const { cachedGetWarnings } = context;
|
|
744
|
-
|
|
778
|
+
warnings: (object, compilation, context, options, factory) => {
|
|
779
|
+
const { type, cachedGetWarnings } = context;
|
|
780
|
+
const rawWarnings = factory.create(`${type}.warnings`, cachedGetWarnings(compilation), context);
|
|
781
|
+
// let filtered = 0;
|
|
782
|
+
// if (options.errorDetails === "auto") {
|
|
783
|
+
// filtered = cachedGetWarnings!(compilation)
|
|
784
|
+
// .map(e => typeof e !== "string" && e.details)
|
|
785
|
+
// .filter(Boolean).length;
|
|
786
|
+
// }
|
|
787
|
+
// if (
|
|
788
|
+
// options.errorDetails === true ||
|
|
789
|
+
// !Number.isFinite(options.warningsSpace)
|
|
790
|
+
// ) {
|
|
791
|
+
// object.warnings = rawWarnings;
|
|
792
|
+
// if (filtered) object.filteredWarningDetailsCount = filtered;
|
|
793
|
+
// return;
|
|
794
|
+
// }
|
|
795
|
+
// const [warnings, filteredBySpace] = errorsSpaceLimit(
|
|
796
|
+
// rawWarnings,
|
|
797
|
+
// options.warningsSpace
|
|
798
|
+
// );
|
|
799
|
+
// object.filteredWarningDetailsCount = filtered + filteredBySpace;
|
|
800
|
+
object.warnings = rawWarnings;
|
|
745
801
|
},
|
|
746
802
|
warningsCount: (object, compilation, context) => {
|
|
747
803
|
const { cachedGetWarnings } = context;
|
|
@@ -808,21 +864,24 @@ const SIMPLE_EXTRACTORS = {
|
|
|
808
864
|
module: {
|
|
809
865
|
_: (object, module, context, options, factory) => {
|
|
810
866
|
const { type } = context;
|
|
811
|
-
|
|
812
|
-
object.
|
|
813
|
-
object.
|
|
814
|
-
object.
|
|
815
|
-
|
|
867
|
+
const { commonAttributes } = module;
|
|
868
|
+
object.type = commonAttributes.type;
|
|
869
|
+
object.moduleType = commonAttributes.moduleType;
|
|
870
|
+
object.layer = commonAttributes.layer;
|
|
871
|
+
object.size = commonAttributes.size;
|
|
872
|
+
const sizes = commonAttributes.sizes.map(({ sourceType, size }) => [
|
|
816
873
|
sourceType,
|
|
817
874
|
size
|
|
818
875
|
]);
|
|
819
876
|
sizes.sort((a, b) => -compareIds(a, b));
|
|
820
877
|
object.sizes = Object.fromEntries(sizes);
|
|
821
|
-
object.built =
|
|
822
|
-
object.codeGenerated =
|
|
823
|
-
object.buildTimeExecuted =
|
|
824
|
-
object.cached =
|
|
825
|
-
if (
|
|
878
|
+
object.built = commonAttributes.built;
|
|
879
|
+
object.codeGenerated = commonAttributes.codeGenerated;
|
|
880
|
+
object.buildTimeExecuted = commonAttributes.buildTimeExecuted;
|
|
881
|
+
object.cached = commonAttributes.cached;
|
|
882
|
+
if (commonAttributes.built ||
|
|
883
|
+
commonAttributes.codeGenerated ||
|
|
884
|
+
options.cachedModules) {
|
|
826
885
|
Object.assign(object, factory.create(`${type}$visible`, module, context));
|
|
827
886
|
}
|
|
828
887
|
}
|
|
@@ -830,43 +889,52 @@ const SIMPLE_EXTRACTORS = {
|
|
|
830
889
|
module$visible: {
|
|
831
890
|
_: (object, module, context, options, factory) => {
|
|
832
891
|
const { type } = context;
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
object.
|
|
839
|
-
object.
|
|
840
|
-
object.
|
|
841
|
-
object.
|
|
842
|
-
object.
|
|
892
|
+
const { commonAttributes } = module;
|
|
893
|
+
if (commonAttributes.moduleDescriptor) {
|
|
894
|
+
object.identifier = commonAttributes.moduleDescriptor.identifier;
|
|
895
|
+
object.name = commonAttributes.moduleDescriptor.name;
|
|
896
|
+
}
|
|
897
|
+
object.nameForCondition = commonAttributes.nameForCondition;
|
|
898
|
+
object.index = commonAttributes.preOrderIndex;
|
|
899
|
+
object.preOrderIndex = commonAttributes.preOrderIndex;
|
|
900
|
+
object.index2 = commonAttributes.postOrderIndex;
|
|
901
|
+
object.postOrderIndex = commonAttributes.postOrderIndex;
|
|
902
|
+
object.cacheable = commonAttributes.cacheable;
|
|
903
|
+
object.optional = commonAttributes.optional;
|
|
904
|
+
object.orphan = commonAttributes.orphan;
|
|
843
905
|
object.dependent = module.dependent;
|
|
844
|
-
object.issuer = module.
|
|
845
|
-
object.issuerName = module.
|
|
846
|
-
object.issuerPath =
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
object.
|
|
850
|
-
|
|
906
|
+
object.issuer = module.issuerDescriptor?.identifier;
|
|
907
|
+
object.issuerName = module.issuerDescriptor?.name;
|
|
908
|
+
object.issuerPath =
|
|
909
|
+
module.issuerDescriptor &&
|
|
910
|
+
factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context);
|
|
911
|
+
object.failed = commonAttributes.failed;
|
|
912
|
+
object.errors = commonAttributes.errors;
|
|
913
|
+
object.warnings = commonAttributes.warnings;
|
|
914
|
+
const profile = commonAttributes.profile;
|
|
851
915
|
if (profile) {
|
|
852
916
|
object.profile = factory.create(`${type}.profile`, profile, context);
|
|
853
917
|
}
|
|
854
918
|
},
|
|
855
919
|
ids: (object, module) => {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
920
|
+
const { commonAttributes } = module;
|
|
921
|
+
if (commonAttributes.moduleDescriptor) {
|
|
922
|
+
object.id = commonAttributes.moduleDescriptor.id;
|
|
923
|
+
}
|
|
924
|
+
object.issuerId = module.issuerDescriptor?.id;
|
|
925
|
+
object.chunks = commonAttributes.chunks;
|
|
859
926
|
},
|
|
860
927
|
moduleAssets: (object, module) => {
|
|
861
|
-
object.assets = module.assets;
|
|
928
|
+
object.assets = module.commonAttributes.assets;
|
|
862
929
|
},
|
|
863
930
|
reasons: (object, module, context, options, factory) => {
|
|
864
931
|
const { type } = context;
|
|
865
|
-
object.reasons = factory.create(`${type.slice(0, -8)}.reasons`, module.reasons, context);
|
|
932
|
+
object.reasons = factory.create(`${type.slice(0, -8)}.reasons`, module.commonAttributes.reasons, context);
|
|
866
933
|
// object.filteredReasons
|
|
867
934
|
},
|
|
868
935
|
source: (object, module) => {
|
|
869
|
-
|
|
936
|
+
const { commonAttributes } = module;
|
|
937
|
+
object.source = commonAttributes.source;
|
|
870
938
|
},
|
|
871
939
|
usedExports: (object, module) => {
|
|
872
940
|
if (typeof module.usedExports === "string") {
|
|
@@ -885,18 +953,20 @@ const SIMPLE_EXTRACTORS = {
|
|
|
885
953
|
}
|
|
886
954
|
},
|
|
887
955
|
providedExports: (object, module) => {
|
|
888
|
-
|
|
889
|
-
|
|
956
|
+
const { commonAttributes } = module;
|
|
957
|
+
if (Array.isArray(commonAttributes.providedExports)) {
|
|
958
|
+
object.providedExports = commonAttributes.providedExports;
|
|
890
959
|
}
|
|
891
960
|
else {
|
|
892
961
|
object.providedExports = null;
|
|
893
962
|
}
|
|
894
963
|
},
|
|
895
964
|
optimizationBailout: (object, module) => {
|
|
896
|
-
object.optimizationBailout =
|
|
965
|
+
object.optimizationBailout =
|
|
966
|
+
module.commonAttributes.optimizationBailout || null;
|
|
897
967
|
},
|
|
898
968
|
depth: (object, module) => {
|
|
899
|
-
object.depth = module.depth;
|
|
969
|
+
object.depth = module.commonAttributes.depth;
|
|
900
970
|
},
|
|
901
971
|
nestedModules: (object, module, context, options, factory) => {
|
|
902
972
|
const { type } = context;
|
|
@@ -924,22 +994,28 @@ const SIMPLE_EXTRACTORS = {
|
|
|
924
994
|
},
|
|
925
995
|
moduleIssuer: {
|
|
926
996
|
_: (object, module, context, options, factory) => {
|
|
927
|
-
|
|
928
|
-
|
|
997
|
+
if (module.moduleDescriptor) {
|
|
998
|
+
object.identifier = module.moduleDescriptor.identifier;
|
|
999
|
+
object.name = module.moduleDescriptor.name;
|
|
1000
|
+
}
|
|
929
1001
|
},
|
|
930
1002
|
ids: (object, module) => {
|
|
931
|
-
object.id = module.id;
|
|
1003
|
+
object.id = module.moduleDescriptor.id;
|
|
932
1004
|
}
|
|
933
1005
|
},
|
|
934
1006
|
moduleReason: {
|
|
935
1007
|
_: (object, reason) => {
|
|
936
|
-
|
|
937
|
-
|
|
1008
|
+
if (reason.moduleDescriptor) {
|
|
1009
|
+
object.moduleIdentifier = reason.moduleDescriptor.identifier;
|
|
1010
|
+
object.moduleName = reason.moduleDescriptor.name;
|
|
1011
|
+
}
|
|
938
1012
|
object.type = reason.type;
|
|
939
1013
|
object.userRequest = reason.userRequest;
|
|
940
1014
|
},
|
|
941
1015
|
ids: (object, reason) => {
|
|
942
|
-
object.moduleId = reason.
|
|
1016
|
+
object.moduleId = reason.moduleDescriptor
|
|
1017
|
+
? reason.moduleDescriptor.id
|
|
1018
|
+
: null;
|
|
943
1019
|
}
|
|
944
1020
|
},
|
|
945
1021
|
chunk: {
|
|
@@ -972,7 +1048,18 @@ const SIMPLE_EXTRACTORS = {
|
|
|
972
1048
|
object.modules = factory.create(`${type}.modules`, chunk.modules, context);
|
|
973
1049
|
},
|
|
974
1050
|
chunkOrigins: (object, chunk, context, options, factory) => {
|
|
975
|
-
object.origins = chunk.origins
|
|
1051
|
+
object.origins = chunk.origins.map(origin => {
|
|
1052
|
+
const { moduleDescriptor, loc, request } = origin;
|
|
1053
|
+
const statsChunkOrigin = {
|
|
1054
|
+
module: moduleDescriptor ? moduleDescriptor.identifier : "",
|
|
1055
|
+
moduleIdentifier: moduleDescriptor ? moduleDescriptor.identifier : "",
|
|
1056
|
+
moduleName: moduleDescriptor ? moduleDescriptor.name : "",
|
|
1057
|
+
moduleId: moduleDescriptor ? moduleDescriptor.id : undefined,
|
|
1058
|
+
loc,
|
|
1059
|
+
request
|
|
1060
|
+
};
|
|
1061
|
+
return statsChunkOrigin;
|
|
1062
|
+
});
|
|
976
1063
|
}
|
|
977
1064
|
},
|
|
978
1065
|
// chunkOrigin
|
|
@@ -980,14 +1067,18 @@ const SIMPLE_EXTRACTORS = {
|
|
|
980
1067
|
warning: EXTRACT_ERROR,
|
|
981
1068
|
moduleTraceItem: {
|
|
982
1069
|
_: (object, { origin, module }, context, { requestShortener }, factory) => {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1070
|
+
if (origin.moduleDescriptor) {
|
|
1071
|
+
object.originIdentifier = origin.moduleDescriptor.identifier;
|
|
1072
|
+
object.originName = origin.moduleDescriptor.name;
|
|
1073
|
+
}
|
|
1074
|
+
if (module.moduleDescriptor) {
|
|
1075
|
+
object.moduleIdentifier = module.moduleDescriptor.identifier;
|
|
1076
|
+
object.moduleName = module.moduleDescriptor.name;
|
|
1077
|
+
}
|
|
987
1078
|
},
|
|
988
1079
|
ids: (object, { origin, module }) => {
|
|
989
|
-
object.originId = origin.id;
|
|
990
|
-
object.moduleId = module.id;
|
|
1080
|
+
object.originId = origin.moduleDescriptor.id;
|
|
1081
|
+
object.moduleId = module.moduleDescriptor.id;
|
|
991
1082
|
}
|
|
992
1083
|
}
|
|
993
1084
|
// moduleTraceDependency
|
|
@@ -194,8 +194,7 @@ const DEFAULTS = {
|
|
|
194
194
|
: forToString
|
|
195
195
|
? all === true
|
|
196
196
|
: all !== false,
|
|
197
|
-
|
|
198
|
-
// cached !== undefined ? cached : forToString ? all === true : all !== false,
|
|
197
|
+
cachedModules: ({ all, cached }, { forToString }) => cached !== undefined ? cached : forToString ? all === true : all !== false,
|
|
199
198
|
moduleAssets: OFF_FOR_TO_STRING,
|
|
200
199
|
depth: OFF_FOR_TO_STRING,
|
|
201
200
|
// cachedAssets: OFF_FOR_TO_STRING,
|
|
@@ -272,9 +271,7 @@ const NORMALIZER = {
|
|
|
272
271
|
});
|
|
273
272
|
},
|
|
274
273
|
logging: (value) => {
|
|
275
|
-
|
|
276
|
-
value = "log";
|
|
277
|
-
return value;
|
|
274
|
+
return value === true ? "log" : value;
|
|
278
275
|
},
|
|
279
276
|
loggingDebug: (value) => {
|
|
280
277
|
const array = !Array.isArray(value) ? (value ? [value] : []) : value;
|