improve typings for loggingDebug and other filtering configuration options
This commit is contained in:
parent
9b448c14d9
commit
0b4506b206
|
@ -623,6 +623,51 @@ export type StatsValue =
|
|||
)
|
||||
| boolean
|
||||
| StatsOptions;
|
||||
/**
|
||||
* Filtering modules.
|
||||
*/
|
||||
export type ModuleFilterTypes = ModuleFilterItemTypes[] | ModuleFilterItemTypes;
|
||||
/**
|
||||
* Filtering value, regexp or function.
|
||||
*/
|
||||
export type ModuleFilterItemTypes =
|
||||
| RegExp
|
||||
| string
|
||||
| ((
|
||||
name: string,
|
||||
module: import("../lib/stats/DefaultStatsFactoryPlugin").StatsModule,
|
||||
type: "module" | "chunk" | "root-of-chunk" | "nested"
|
||||
) => boolean);
|
||||
/**
|
||||
* Filtering modules.
|
||||
*/
|
||||
export type AssetFilterTypes = AssetFilterItemTypes[] | AssetFilterItemTypes;
|
||||
/**
|
||||
* Filtering value, regexp or function.
|
||||
*/
|
||||
export type AssetFilterItemTypes =
|
||||
| RegExp
|
||||
| string
|
||||
| ((
|
||||
name: string,
|
||||
asset: import("../lib/stats/DefaultStatsFactoryPlugin").StatsAsset
|
||||
) => boolean);
|
||||
/**
|
||||
* Filtering warnings.
|
||||
*/
|
||||
export type WarningFilterTypes =
|
||||
| WarningFilterItemTypes[]
|
||||
| WarningFilterItemTypes;
|
||||
/**
|
||||
* Filtering value, regexp or function.
|
||||
*/
|
||||
export type WarningFilterItemTypes =
|
||||
| RegExp
|
||||
| string
|
||||
| ((
|
||||
warning: import("../lib/stats/DefaultStatsFactoryPlugin").StatsError,
|
||||
value: string
|
||||
) => boolean);
|
||||
/**
|
||||
* Environment to build for. An array of environments to build for all of them when possible.
|
||||
*/
|
||||
|
@ -2292,15 +2337,15 @@ export interface StatsOptions {
|
|||
/**
|
||||
* Please use excludeModules instead.
|
||||
*/
|
||||
exclude?: boolean | FilterTypes;
|
||||
exclude?: boolean | ModuleFilterTypes;
|
||||
/**
|
||||
* Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions.
|
||||
*/
|
||||
excludeAssets?: FilterTypes;
|
||||
excludeAssets?: AssetFilterTypes;
|
||||
/**
|
||||
* Suppress modules that match the specified filters. Filters can be Strings, RegExps, Booleans or Functions.
|
||||
*/
|
||||
excludeModules?: boolean | FilterTypes;
|
||||
excludeModules?: boolean | ModuleFilterTypes;
|
||||
/**
|
||||
* Group assets by how their are related to chunks.
|
||||
*/
|
||||
|
@ -2460,7 +2505,7 @@ export interface StatsOptions {
|
|||
/**
|
||||
* Suppress listing warnings that match the specified filters (they will still be counted). Filters can be Strings, RegExps or Functions.
|
||||
*/
|
||||
warningsFilter?: FilterTypes;
|
||||
warningsFilter?: WarningFilterTypes;
|
||||
}
|
||||
/**
|
||||
* Options for the watcher.
|
||||
|
|
|
@ -99,6 +99,9 @@ const { isSourceEqual } = require("./util/source");
|
|||
/** @typedef {import("./RuntimeModule")} RuntimeModule */
|
||||
/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */
|
||||
/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */
|
||||
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
||||
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
|
||||
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
|
||||
/** @typedef {import("./util/Hash")} Hash */
|
||||
/** @template T @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T> */
|
||||
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
@ -235,9 +238,9 @@ const { isSourceEqual } = require("./util/source");
|
|||
* @property {boolean} groupAssetsByPath
|
||||
* @property {boolean} groupAssetsByExtension
|
||||
* @property {number} assetsSpace
|
||||
* @property {Function[]} excludeAssets
|
||||
* @property {Function[]} excludeModules
|
||||
* @property {Function[]} warningsFilter
|
||||
* @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets
|
||||
* @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules
|
||||
* @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter
|
||||
* @property {boolean} cachedModules
|
||||
* @property {boolean} orphanModules
|
||||
* @property {boolean} dependentModules
|
||||
|
@ -257,7 +260,7 @@ const { isSourceEqual } = require("./util/source");
|
|||
* @property {number} chunkModulesSpace
|
||||
* @property {number} nestedModulesSpace
|
||||
* @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging
|
||||
* @property {Function[]} loggingDebug
|
||||
* @property {((value: string) => boolean)[]} loggingDebug
|
||||
* @property {boolean} loggingTrace
|
||||
* @property {any} _env
|
||||
*/
|
||||
|
|
|
@ -1904,7 +1904,7 @@ const ASSETS_GROUPERS = {
|
|||
}
|
||||
};
|
||||
|
||||
/** @type {function(string): Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
|
||||
/** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
|
||||
const MODULES_GROUPERS = type => ({
|
||||
_: (groupConfigs, context, options) => {
|
||||
const groupByFlag = (name, type, exclude) => {
|
||||
|
|
|
@ -13,6 +13,51 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"AssetFilterItemTypes": {
|
||||
"description": "Filtering value, regexp or function.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"absolutePath": false
|
||||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((name: string, asset: import('../lib/stats/DefaultStatsFactoryPlugin').StatsAsset) => boolean)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AssetFilterTypes": {
|
||||
"description": "Filtering modules.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Rule to filter.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AssetFilterItemTypes"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/AssetFilterItemTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AssetGeneratorDataUrl": {
|
||||
"description": "The options for data url generator.",
|
||||
"anyOf": [
|
||||
|
@ -1498,6 +1543,51 @@
|
|||
"description": "Enable production optimizations or development hints.",
|
||||
"enum": ["development", "production", "none"]
|
||||
},
|
||||
"ModuleFilterItemTypes": {
|
||||
"description": "Filtering value, regexp or function.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"absolutePath": false
|
||||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((name: string, module: import('../lib/stats/DefaultStatsFactoryPlugin').StatsModule, type: 'module' | 'chunk' | 'root-of-chunk' | 'nested') => boolean)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleFilterTypes": {
|
||||
"description": "Filtering modules.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Rule to filter.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ModuleFilterItemTypes"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/ModuleFilterItemTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleOptions": {
|
||||
"description": "Options affecting the normal modules (`NormalModuleFactory`).",
|
||||
"type": "object",
|
||||
|
@ -3920,7 +4010,7 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/FilterTypes"
|
||||
"$ref": "#/definitions/ModuleFilterTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -3928,7 +4018,7 @@
|
|||
"description": "Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/FilterTypes"
|
||||
"$ref": "#/definitions/AssetFilterTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -3939,7 +4029,7 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/FilterTypes"
|
||||
"$ref": "#/definitions/ModuleFilterTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -4127,7 +4217,7 @@
|
|||
"description": "Suppress listing warnings that match the specified filters (they will still be counted). Filters can be Strings, RegExps or Functions.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/FilterTypes"
|
||||
"$ref": "#/definitions/WarningFilterTypes"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -4190,6 +4280,51 @@
|
|||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"WarningFilterItemTypes": {
|
||||
"description": "Filtering value, regexp or function.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"absolutePath": false
|
||||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((warning: import('../lib/stats/DefaultStatsFactoryPlugin').StatsError, value: string) => boolean)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WarningFilterTypes": {
|
||||
"description": "Filtering warnings.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Rule to filter.",
|
||||
"cli": {
|
||||
"helper": true
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/WarningFilterItemTypes"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/WarningFilterItemTypes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WasmLoading": {
|
||||
"description": "The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).",
|
||||
"anyOf": [
|
||||
|
|
|
@ -232,6 +232,10 @@ declare interface AssetEmittedInfo {
|
|||
outputPath: string;
|
||||
targetPath: string;
|
||||
}
|
||||
type AssetFilterItemTypes =
|
||||
| string
|
||||
| RegExp
|
||||
| ((name: string, asset: StatsAsset) => boolean);
|
||||
|
||||
/**
|
||||
* Options object for data url generation.
|
||||
|
@ -5051,9 +5055,13 @@ declare interface KnownNormalizedStatsOptions {
|
|||
groupAssetsByPath: boolean;
|
||||
groupAssetsByExtension: boolean;
|
||||
assetsSpace: number;
|
||||
excludeAssets: Function[];
|
||||
excludeModules: Function[];
|
||||
warningsFilter: Function[];
|
||||
excludeAssets: ((value: string, asset: StatsAsset) => boolean)[];
|
||||
excludeModules: ((
|
||||
name: string,
|
||||
module: StatsModule,
|
||||
type: "module" | "chunk" | "root-of-chunk" | "nested"
|
||||
) => boolean)[];
|
||||
warningsFilter: ((warning: StatsError, textValue: string) => boolean)[];
|
||||
cachedModules: boolean;
|
||||
orphanModules: boolean;
|
||||
dependentModules: boolean;
|
||||
|
@ -5073,7 +5081,7 @@ declare interface KnownNormalizedStatsOptions {
|
|||
chunkModulesSpace: number;
|
||||
nestedModulesSpace: number;
|
||||
logging: false | "none" | "verbose" | "error" | "warn" | "info" | "log";
|
||||
loggingDebug: Function[];
|
||||
loggingDebug: ((value: string) => boolean)[];
|
||||
loggingTrace: boolean;
|
||||
}
|
||||
declare interface KnownStatsAsset {
|
||||
|
@ -5910,6 +5918,14 @@ declare interface ModuleFederationPluginOptions {
|
|||
*/
|
||||
shared?: (string | SharedObject)[] | SharedObject;
|
||||
}
|
||||
type ModuleFilterItemTypes =
|
||||
| string
|
||||
| RegExp
|
||||
| ((
|
||||
name: string,
|
||||
module: StatsModule,
|
||||
type: "module" | "chunk" | "root-of-chunk" | "nested"
|
||||
) => boolean);
|
||||
declare class ModuleGraph {
|
||||
constructor();
|
||||
setParents(
|
||||
|
@ -6636,7 +6652,47 @@ declare class NormalModuleReplacementPlugin {
|
|||
apply(compiler: Compiler): void;
|
||||
}
|
||||
type NormalizedStatsOptions = KnownNormalizedStatsOptions &
|
||||
StatsOptions &
|
||||
Omit<
|
||||
StatsOptions,
|
||||
| "context"
|
||||
| "requestShortener"
|
||||
| "chunkGroups"
|
||||
| "chunksSort"
|
||||
| "modulesSort"
|
||||
| "chunkModulesSort"
|
||||
| "nestedModulesSort"
|
||||
| "assetsSort"
|
||||
| "ids"
|
||||
| "cachedAssets"
|
||||
| "groupAssetsByEmitStatus"
|
||||
| "groupAssetsByPath"
|
||||
| "groupAssetsByExtension"
|
||||
| "assetsSpace"
|
||||
| "excludeAssets"
|
||||
| "excludeModules"
|
||||
| "warningsFilter"
|
||||
| "cachedModules"
|
||||
| "orphanModules"
|
||||
| "dependentModules"
|
||||
| "runtimeModules"
|
||||
| "groupModulesByCacheStatus"
|
||||
| "groupModulesByLayer"
|
||||
| "groupModulesByAttributes"
|
||||
| "groupModulesByPath"
|
||||
| "groupModulesByExtension"
|
||||
| "groupModulesByType"
|
||||
| "entrypoints"
|
||||
| "chunkGroupAuxiliary"
|
||||
| "chunkGroupChildren"
|
||||
| "chunkGroupMaxAssets"
|
||||
| "modulesSpace"
|
||||
| "chunkModulesSpace"
|
||||
| "nestedModulesSpace"
|
||||
| "logging"
|
||||
| "loggingDebug"
|
||||
| "loggingTrace"
|
||||
| "_env"
|
||||
> &
|
||||
Record<string, any>;
|
||||
declare interface ObjectDeserializerContext {
|
||||
read: () => any;
|
||||
|
@ -6830,7 +6886,7 @@ declare interface OptimizationSplitChunksCacheGroup {
|
|||
/**
|
||||
* Select chunks for determining cache group content (defaults to "initial", "initial" and "all" requires adding these chunks to the HTML).
|
||||
*/
|
||||
chunks?: "initial" | "async" | "all" | ((chunk: Chunk) => boolean);
|
||||
chunks?: "all" | "initial" | "async" | ((chunk: Chunk) => boolean);
|
||||
|
||||
/**
|
||||
* Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group.
|
||||
|
@ -6952,7 +7008,7 @@ declare interface OptimizationSplitChunksOptions {
|
|||
/**
|
||||
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
|
||||
*/
|
||||
chunks?: "initial" | "async" | "all" | ((chunk: Chunk) => boolean);
|
||||
chunks?: "all" | "initial" | "async" | ((chunk: Chunk) => boolean);
|
||||
|
||||
/**
|
||||
* Sets the size types which are used when a number is used for sizes.
|
||||
|
@ -10155,8 +10211,12 @@ declare interface StatsOptions {
|
|||
| string
|
||||
| boolean
|
||||
| RegExp
|
||||
| FilterItemTypes[]
|
||||
| ((value: string) => boolean);
|
||||
| ModuleFilterItemTypes[]
|
||||
| ((
|
||||
name: string,
|
||||
module: StatsModule,
|
||||
type: "module" | "chunk" | "root-of-chunk" | "nested"
|
||||
) => boolean);
|
||||
|
||||
/**
|
||||
* Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions.
|
||||
|
@ -10164,8 +10224,8 @@ declare interface StatsOptions {
|
|||
excludeAssets?:
|
||||
| string
|
||||
| RegExp
|
||||
| FilterItemTypes[]
|
||||
| ((value: string) => boolean);
|
||||
| AssetFilterItemTypes[]
|
||||
| ((name: string, asset: StatsAsset) => boolean);
|
||||
|
||||
/**
|
||||
* Suppress modules that match the specified filters. Filters can be Strings, RegExps, Booleans or Functions.
|
||||
|
@ -10174,8 +10234,12 @@ declare interface StatsOptions {
|
|||
| string
|
||||
| boolean
|
||||
| RegExp
|
||||
| FilterItemTypes[]
|
||||
| ((value: string) => boolean);
|
||||
| ModuleFilterItemTypes[]
|
||||
| ((
|
||||
name: string,
|
||||
module: StatsModule,
|
||||
type: "module" | "chunk" | "root-of-chunk" | "nested"
|
||||
) => boolean);
|
||||
|
||||
/**
|
||||
* Group assets by how their are related to chunks.
|
||||
|
@ -10383,8 +10447,8 @@ declare interface StatsOptions {
|
|||
warningsFilter?:
|
||||
| string
|
||||
| RegExp
|
||||
| FilterItemTypes[]
|
||||
| ((value: string) => boolean);
|
||||
| WarningFilterItemTypes[]
|
||||
| ((warning: StatsError, value: string) => boolean);
|
||||
}
|
||||
declare abstract class StatsPrinter {
|
||||
hooks: Readonly<{
|
||||
|
@ -10627,6 +10691,10 @@ declare interface VariableInfoInterface {
|
|||
freeName: string | true;
|
||||
tagInfo?: TagInfo;
|
||||
}
|
||||
type WarningFilterItemTypes =
|
||||
| string
|
||||
| RegExp
|
||||
| ((warning: StatsError, value: string) => boolean);
|
||||
declare interface WatchFileSystem {
|
||||
watch: (
|
||||
files: Iterable<string>,
|
||||
|
|
Loading…
Reference in New Issue