use typescript 4.2

This commit is contained in:
Tobias Koppers 2021-01-13 16:48:25 +01:00
parent 3ef285bda9
commit a945a9b62c
5 changed files with 235 additions and 213 deletions

View File

@ -226,6 +226,7 @@ module.exports = class MultiCompiler {
} }
} }
} }
/** @type {string[]} */
const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`);
const stack = this.compilers.filter(c => !targetFound(c)); const stack = this.compilers.filter(c => !targetFound(c));
while (stack.length > 0) { while (stack.length > 0) {
@ -241,6 +242,7 @@ module.exports = class MultiCompiler {
} }
} }
if (edges.size > 0) { if (edges.size > 0) {
/** @type {string[]} */
const lines = Array.from(edges) const lines = Array.from(edges)
.sort(sortEdges) .sort(sortEdges)
.map(edge => `${edge.source.name} -> ${edge.target.name}`); .map(edge => `${edge.source.name} -> ${edge.target.name}`);

View File

@ -11,6 +11,12 @@
const plural = (n, singular, plural) => (n === 1 ? singular : plural); const plural = (n, singular, plural) => (n === 1 ? singular : plural);
/**
* @param {Record<string, number>} sizes sizes by source type
* @param {Object} options options
* @param {(number) => string=} options.formatSize size formatter
* @returns {string} text
*/
const printSizes = (sizes, { formatSize = n => `${n}` }) => { const printSizes = (sizes, { formatSize = n => `${n}` }) => {
const keys = Object.keys(sizes); const keys = Object.keys(sizes);
if (keys.length > 1) { if (keys.length > 1) {

View File

@ -13,7 +13,7 @@
"acorn": "^8.0.4", "acorn": "^8.0.4",
"browserslist": "^4.14.5", "browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.6.0", "enhanced-resolve": "^5.7.0",
"eslint-scope": "^5.1.1", "eslint-scope": "^5.1.1",
"events": "^3.2.0", "events": "^3.2.0",
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
@ -91,9 +91,9 @@
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"terser": "^5.5.0", "terser": "^5.5.0",
"toml": "^3.0.0", "toml": "^3.0.0",
"tooling": "webpack/tooling#v1.13.1", "tooling": "webpack/tooling#v1.14.0",
"ts-loader": "^8.0.2", "ts-loader": "^8.0.2",
"typescript": "^4.2.0-dev.20201130", "typescript": "^4.2.0-beta",
"url-loader": "^4.1.0", "url-loader": "^4.1.0",
"wast-loader": "^1.11.0", "wast-loader": "^1.11.0",
"webassembly-feature": "1.3.0", "webassembly-feature": "1.3.0",
@ -150,8 +150,8 @@
"type-lint": "tsc", "type-lint": "tsc",
"typings-lint": "tsc -p tsconfig.test.json", "typings-lint": "tsc -p tsconfig.test.json",
"spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"", "spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"",
"special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/generate-types", "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/generate-types --no-template-literals",
"special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/generate-types --write", "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/generate-types --no-template-literals --write",
"fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix", "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
"pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"", "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
"pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"", "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",

408
types.d.ts vendored
View File

@ -175,6 +175,15 @@ declare interface AggressiveSplittingPluginOptions {
*/ */
minSize?: number; minSize?: number;
} }
declare interface AliasOption {
alias: string | false | string[];
name: string;
onlyModule?: boolean;
}
type AliasOptionNewRequest = string | false | string[];
declare interface AliasOptions {
[index: string]: AliasOptionNewRequest;
}
declare interface Argument { declare interface Argument {
description: string; description: string;
simpleType: "string" | "number" | "boolean"; simpleType: "string" | "number" | "boolean";
@ -358,12 +367,12 @@ declare interface BannerPluginOptions {
/** /**
* Exclude all modules matching any of these conditions. * Exclude all modules matching any of these conditions.
*/ */
exclude?: string | RegExp | (string | RegExp)[]; exclude?: string | RegExp | Rule[];
/** /**
* Include all modules matching any of these conditions. * Include all modules matching any of these conditions.
*/ */
include?: string | RegExp | (string | RegExp)[]; include?: string | RegExp | Rule[];
/** /**
* If true, banner will not be wrapped in a comment. * If true, banner will not be wrapped in a comment.
@ -373,13 +382,13 @@ declare interface BannerPluginOptions {
/** /**
* Include all modules that pass test assertion. * Include all modules that pass test assertion.
*/ */
test?: string | RegExp | (string | RegExp)[]; test?: string | RegExp | Rule[];
} }
declare interface BaseResolveRequest { declare interface BaseResolveRequest {
path: DevTool; path: string | false;
descriptionFilePath?: string; descriptionFilePath?: string;
descriptionFileRoot?: string; descriptionFileRoot?: string;
descriptionFileData?: any; descriptionFileData?: object;
relativePath?: string; relativePath?: string;
ignoreSymlinks?: boolean; ignoreSymlinks?: boolean;
fullySpecified?: boolean; fullySpecified?: boolean;
@ -575,11 +584,11 @@ declare interface CacheGroupSource {
) => undefined | string; ) => undefined | string;
chunksFilter?: (chunk: Chunk) => boolean; chunksFilter?: (chunk: Chunk) => boolean;
enforce?: boolean; enforce?: boolean;
minSize: Record<string, number>; minSize: SplitChunksSizes;
minRemainingSize: Record<string, number>; minRemainingSize: SplitChunksSizes;
enforceSizeThreshold: Record<string, number>; enforceSizeThreshold: SplitChunksSizes;
maxAsyncSize: Record<string, number>; maxAsyncSize: SplitChunksSizes;
maxInitialSize: Record<string, number>; maxInitialSize: SplitChunksSizes;
minChunks?: number; minChunks?: number;
maxAsyncRequests?: number; maxAsyncRequests?: number;
maxInitialRequests?: number; maxInitialRequests?: number;
@ -1066,6 +1075,40 @@ declare abstract class CodeGenerationResults {
getData(module: Module, runtime: RuntimeSpec, key: string): any; getData(module: Module, runtime: RuntimeSpec, key: string): any;
add(module: Module, runtime: RuntimeSpec, result: CodeGenerationResult): void; add(module: Module, runtime: RuntimeSpec, result: CodeGenerationResult): void;
} }
type CodeValue =
| undefined
| null
| string
| number
| bigint
| boolean
| Function
| RegExp
| RuntimeValue
| {
[index: string]: RecursiveArrayOrRecord<
| undefined
| null
| string
| number
| bigint
| boolean
| Function
| RegExp
| RuntimeValue
>;
}
| RecursiveArrayOrRecord<
| undefined
| null
| string
| number
| bigint
| boolean
| Function
| RegExp
| RuntimeValue
>[];
declare interface Comparator<T> { declare interface Comparator<T> {
(arg0: T, arg1: T): 0 | 1 | -1; (arg0: T, arg1: T): 0 | 1 | -1;
} }
@ -1169,16 +1212,16 @@ declare class Compilation {
> >
>; >;
optimizeAssets: AsyncSeriesHook< optimizeAssets: AsyncSeriesHook<
[Record<string, Source>], [CompilationAssets],
ProcessAssetsAdditionalOptions ProcessAssetsAdditionalOptions
>; >;
afterOptimizeAssets: SyncHook<[Record<string, Source>]>; afterOptimizeAssets: SyncHook<[CompilationAssets]>;
processAssets: AsyncSeriesHook< processAssets: AsyncSeriesHook<
[Record<string, Source>], [CompilationAssets],
ProcessAssetsAdditionalOptions ProcessAssetsAdditionalOptions
>; >;
afterProcessAssets: SyncHook<[Record<string, Source>]>; afterProcessAssets: SyncHook<[CompilationAssets]>;
processAdditionalAssets: AsyncSeriesHook<[Record<string, Source>]>; processAdditionalAssets: AsyncSeriesHook<[CompilationAssets]>;
needAdditionalSeal: SyncBailHook<[], boolean>; needAdditionalSeal: SyncBailHook<[], boolean>;
afterSeal: AsyncSeriesHook<[]>; afterSeal: AsyncSeriesHook<[]>;
renderManifest: SyncWaterfallHook< renderManifest: SyncWaterfallHook<
@ -1248,7 +1291,7 @@ declare class Compilation {
modules: Set<Module>; modules: Set<Module>;
records: any; records: any;
additionalChunkAssets: string[]; additionalChunkAssets: string[];
assets: Record<string, Source>; assets: CompilationAssets;
assetsInfo: Map<string, AssetInfo>; assetsInfo: Map<string, AssetInfo>;
errors: WebpackError[]; errors: WebpackError[];
warnings: WebpackError[]; warnings: WebpackError[];
@ -1526,6 +1569,9 @@ declare class Compilation {
*/ */
static PROCESS_ASSETS_STAGE_REPORT: number; static PROCESS_ASSETS_STAGE_REPORT: number;
} }
declare interface CompilationAssets {
[index: string]: Source;
}
declare interface CompilationHooksAsyncWebAssemblyModulesPlugin { declare interface CompilationHooksAsyncWebAssemblyModulesPlugin {
renderModuleContent: SyncWaterfallHook<[Source, Module, RenderContextObject]>; renderModuleContent: SyncWaterfallHook<[Source, Module, RenderContextObject]>;
} }
@ -2162,36 +2208,8 @@ declare class DefinePlugin {
/** /**
* Create a new define plugin * Create a new define plugin
*/ */
constructor( constructor(definitions: Record<string, CodeValue>);
definitions: Record< definitions: Record<string, CodeValue>;
string,
RecursiveArrayOrRecord<
| undefined
| null
| string
| number
| bigint
| boolean
| Function
| RegExp
| RuntimeValue
>
>
);
definitions: Record<
string,
RecursiveArrayOrRecord<
| undefined
| null
| string
| number
| bigint
| boolean
| Function
| RegExp
| RuntimeValue
>
>;
/** /**
* Apply the plugin * Apply the plugin
@ -2386,8 +2404,6 @@ declare class DeterministicModuleIdsPlugin {
declare interface DevServer { declare interface DevServer {
[index: string]: any; [index: string]: any;
} }
type DevTool = string | false;
type DevtoolFallbackModuleFilenameTemplate = string | Function;
declare class DllPlugin { declare class DllPlugin {
constructor(options: DllPluginOptions); constructor(options: DllPluginOptions);
options: { options: {
@ -2789,15 +2805,9 @@ declare class EntryOptionPlugin {
desc: EntryDescriptionNormalized desc: EntryDescriptionNormalized
): EntryOptions; ): EntryOptions;
} }
type EntryOptions = { name?: string } & Pick< type EntryOptions = { name?: string } & Omit<
EntryDescriptionNormalized, EntryDescriptionNormalized,
| "filename" "import"
| "chunkLoading"
| "dependOn"
| "layer"
| "library"
| "runtime"
| "wasmLoading"
>; >;
declare class EntryPlugin { declare class EntryPlugin {
/** /**
@ -2915,7 +2925,7 @@ declare class EvalDevToolModulePlugin {
declare class EvalSourceMapDevToolPlugin { declare class EvalSourceMapDevToolPlugin {
constructor(inputOptions: string | SourceMapDevToolPluginOptions); constructor(inputOptions: string | SourceMapDevToolPluginOptions);
sourceMapComment: string; sourceMapComment: string;
moduleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate; moduleFilenameTemplate: string | Function;
namespace: string; namespace: string;
options: SourceMapDevToolPluginOptions; options: SourceMapDevToolPluginOptions;
@ -3010,7 +3020,10 @@ declare abstract class ExportInfo {
/** /**
* get used name * get used name
*/ */
getUsedName(fallbackName: undefined | string, runtime: RuntimeSpec): DevTool; getUsedName(
fallbackName: undefined | string,
runtime: RuntimeSpec
): string | false;
hasUsedName(): boolean; hasUsedName(): boolean;
/** /**
@ -3057,7 +3070,17 @@ declare abstract class ExportInfo {
| "maybe provided (runtime-defined)" | "maybe provided (runtime-defined)"
| "provided" | "provided"
| "not provided"; | "not provided";
getRenameInfo(): string; getRenameInfo():
| string
| "missing provision and use info prevents renaming"
| "usage prevents renaming (no provision info)"
| "missing provision info prevents renaming"
| "missing usage info prevents renaming"
| "usage prevents renaming"
| "could be renamed"
| "provision prevents renaming (no use info)"
| "usage and provision prevents renaming"
| "provision prevents renaming";
} }
declare interface ExportSpec { declare interface ExportSpec {
/** /**
@ -3120,11 +3143,14 @@ declare abstract class ExportsInfo {
getUsedExports(runtime: RuntimeSpec): null | boolean | SortableSet<string>; getUsedExports(runtime: RuntimeSpec): null | boolean | SortableSet<string>;
getProvidedExports(): null | true | string[]; getProvidedExports(): null | true | string[];
getRelevantExports(runtime: RuntimeSpec): ExportInfo[]; getRelevantExports(runtime: RuntimeSpec): ExportInfo[];
isExportProvided(name: EntryItem): undefined | null | boolean; isExportProvided(name: string | string[]): undefined | null | boolean;
getUsageKey(runtime: RuntimeSpec): string; getUsageKey(runtime: RuntimeSpec): string;
isEquallyUsed(runtimeA: RuntimeSpec, runtimeB: RuntimeSpec): boolean; isEquallyUsed(runtimeA: RuntimeSpec, runtimeB: RuntimeSpec): boolean;
getUsed(name: EntryItem, runtime: RuntimeSpec): UsageStateType; getUsed(name: string | string[], runtime: RuntimeSpec): UsageStateType;
getUsedName(name: EntryItem, runtime: RuntimeSpec): Target; getUsedName(
name: string | string[],
runtime: RuntimeSpec
): string | false | string[];
updateHash(hash: Hash, runtime: RuntimeSpec): void; updateHash(hash: Hash, runtime: RuntimeSpec): void;
getRestoreProvidedData(): any; getRestoreProvidedData(): any;
restoreProvided(__0: { restoreProvided(__0: {
@ -3249,7 +3275,7 @@ declare interface ExternalItemObjectUnknown {
} }
declare class ExternalModule extends Module { declare class ExternalModule extends Module {
constructor(request?: any, type?: any, userRequest?: any); constructor(request?: any, type?: any, userRequest?: any);
request: string | string[] | Record<string, EntryItem>; request: string | string[] | Record<string, string | string[]>;
externalType: string; externalType: string;
userRequest: string; userRequest: string;
getSourceData( getSourceData(
@ -3361,9 +3387,9 @@ declare interface FactorizeModuleOptions {
type FakeHook<T> = T & FakeHookMarker; type FakeHook<T> = T & FakeHookMarker;
declare interface FakeHookMarker {} declare interface FakeHookMarker {}
declare interface FallbackCacheGroup { declare interface FallbackCacheGroup {
minSize: Record<string, number>; minSize: SplitChunksSizes;
maxAsyncSize: Record<string, number>; maxAsyncSize: SplitChunksSizes;
maxInitialSize: Record<string, number>; maxInitialSize: SplitChunksSizes;
automaticNameDelimiter: string; automaticNameDelimiter: string;
} }
declare class FetchCompileAsyncWasmPlugin { declare class FetchCompileAsyncWasmPlugin {
@ -3451,7 +3477,11 @@ declare interface FileCacheOptions {
declare interface FileSystem { declare interface FileSystem {
readFile: { readFile: {
(arg0: string, arg1: FileSystemCallback<string | Buffer>): void; (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
(arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void; (
arg0: string,
arg1: object,
arg2: FileSystemCallback<string | Buffer>
): void;
}; };
readdir: { readdir: {
( (
@ -3460,25 +3490,37 @@ declare interface FileSystem {
): void; ): void;
( (
arg0: string, arg0: string,
arg1: any, arg1: object,
arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
): void; ): void;
}; };
readJson?: { readJson?: {
(arg0: string, arg1: FileSystemCallback<any>): void; (arg0: string, arg1: FileSystemCallback<object>): void;
(arg0: string, arg1: any, arg2: FileSystemCallback<any>): void; (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
}; };
readlink: { readlink: {
(arg0: string, arg1: FileSystemCallback<string | Buffer>): void; (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
(arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void; (
arg0: string,
arg1: object,
arg2: FileSystemCallback<string | Buffer>
): void;
}; };
lstat?: { lstat?: {
(arg0: string, arg1: FileSystemCallback<FileSystemStats>): void; (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
(arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void; (
arg0: string,
arg1: object,
arg2: FileSystemCallback<string | Buffer>
): void;
}; };
stat: { stat: {
(arg0: string, arg1: FileSystemCallback<FileSystemStats>): void; (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
(arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void; (
arg0: string,
arg1: object,
arg2: FileSystemCallback<string | Buffer>
): void;
}; };
} }
declare interface FileSystemCallback<T> { declare interface FileSystemCallback<T> {
@ -3665,10 +3707,10 @@ declare class GetChunkFilenameRuntimeModule extends RuntimeModule {
*/ */
static STAGE_TRIGGER: number; static STAGE_TRIGGER: number;
} }
declare interface GroupConfig<T, R> { declare interface GroupConfig {
getKeys: (arg0: T) => string[]; getKeys: (arg0?: any) => string[];
createGroup: (arg0: string, arg1: (T | R)[], arg2: T[]) => R; createGroup: (arg0: string, arg1: any[], arg2: any[]) => object;
getOptions?: (arg0: string, arg1: T[]) => GroupOptions; getOptions?: (arg0: string, arg1: any[]) => GroupOptions;
} }
declare interface GroupOptions { declare interface GroupOptions {
groupChildren?: boolean; groupChildren?: boolean;
@ -3704,7 +3746,6 @@ declare class Hash {
*/ */
digest(encoding?: string): string | Buffer; digest(encoding?: string): string | Buffer;
} }
type HashFunction = string | typeof Hash;
declare interface HashableObject { declare interface HashableObject {
updateHash: (arg0: Hash) => void; updateHash: (arg0: Hash) => void;
} }
@ -4380,7 +4421,7 @@ declare class JavascriptParser extends Parser {
expr: MemberExpression, expr: MemberExpression,
fallback: ( fallback: (
arg0: string, arg0: string,
arg1: ExportedVariableInfo, arg1: string | ScopeInfo | VariableInfo,
arg2: () => string[] arg2: () => string[]
) => any, ) => any,
defined: (arg0: string) => any, defined: (arg0: string) => any,
@ -4699,7 +4740,7 @@ declare interface KnownAssetInfo {
/** /**
* object of pointers to other assets, keyed by type of relation (only points from parent to child) * object of pointers to other assets, keyed by type of relation (only points from parent to child)
*/ */
related?: Record<string, EntryItem>; related?: Record<string, string | string[]>;
} }
declare interface KnownBuildMeta { declare interface KnownBuildMeta {
moduleArgument?: string; moduleArgument?: string;
@ -4880,6 +4921,7 @@ declare interface LibraryCustomUmdObject {
*/ */
root?: string | string[]; root?: string | string[];
} }
type LibraryExport = string | string[];
type LibraryName = string | string[] | LibraryCustomUmdObject; type LibraryName = string | string[] | LibraryCustomUmdObject;
/** /**
@ -4917,14 +4959,14 @@ declare class LibraryTemplatePlugin {
target: string, target: string,
umdNamedDefine: boolean, umdNamedDefine: boolean,
auxiliaryComment: AuxiliaryComment, auxiliaryComment: AuxiliaryComment,
exportProperty: EntryItem exportProperty: LibraryExport
); );
library: { library: {
type: string; type: string;
name: LibraryName; name: LibraryName;
umdNamedDefine: boolean; umdNamedDefine: boolean;
auxiliaryComment: AuxiliaryComment; auxiliaryComment: AuxiliaryComment;
export: EntryItem; export: LibraryExport;
}; };
/** /**
@ -5447,7 +5489,10 @@ declare class ModuleGraph {
module: Module module: Module
): (string | ((requestShortener: RequestShortener) => string))[]; ): (string | ((requestShortener: RequestShortener) => string))[];
getProvidedExports(module: Module): null | true | string[]; getProvidedExports(module: Module): null | true | string[];
isExportProvided(module: Module, exportName: EntryItem): null | boolean; isExportProvided(
module: Module,
exportName: string | string[]
): null | boolean;
getExportsInfo(module: Module): ExportsInfo; getExportsInfo(module: Module): ExportsInfo;
getExportInfo(module: Module, exportName: string): ExportInfo; getExportInfo(module: Module, exportName: string): ExportInfo;
getReadOnlyExportInfo(module: Module, exportName: string): ExportInfo; getReadOnlyExportInfo(module: Module, exportName: string): ExportInfo;
@ -7099,7 +7144,7 @@ declare interface ParsedIdentifier {
declare class Parser { declare class Parser {
constructor(); constructor();
parse( parse(
source: string | Record<string, any> | Buffer, source: string | Buffer | PreparsedAst,
state: ParserState state: ParserState
): ParserState; ): ParserState;
} }
@ -7151,8 +7196,11 @@ declare interface PerformanceOptions {
*/ */
maxEntrypointSize?: number; maxEntrypointSize?: number;
} }
type Plugin =
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void);
declare interface PnpApiImpl { declare interface PnpApiImpl {
resolveToUnqualified: (arg0: string, arg1: string, arg2?: any) => string; resolveToUnqualified: (arg0: string, arg1: string, arg2: object) => string;
} }
declare interface PossibleFileSystemError { declare interface PossibleFileSystemError {
code?: string; code?: string;
@ -7175,6 +7223,9 @@ declare class PrefixSource extends Source {
original(): Source; original(): Source;
getPrefix(): string; getPrefix(): string;
} }
declare interface PreparsedAst {
[index: string]: any;
}
declare interface PrintedElement { declare interface PrintedElement {
element: string; element: string;
content: string; content: string;
@ -7297,8 +7348,8 @@ declare interface ProgressPluginOptions {
profile?: null | boolean; profile?: null | boolean;
} }
declare class ProvidePlugin { declare class ProvidePlugin {
constructor(definitions: Record<string, EntryItem>); constructor(definitions: Record<string, string | string[]>);
definitions: Record<string, EntryItem>; definitions: Record<string, string | string[]>;
/** /**
* Apply the plugin * Apply the plugin
@ -7608,17 +7659,17 @@ declare interface ResolveBuildDependenciesResult {
* Resolve context * Resolve context
*/ */
declare interface ResolveContext { declare interface ResolveContext {
contextDependencies?: { add: (T?: any) => void }; contextDependencies?: WriteOnlySet<string>;
/** /**
* files that was found on file system * files that was found on file system
*/ */
fileDependencies?: { add: (T?: any) => void }; fileDependencies?: WriteOnlySet<string>;
/** /**
* dependencies that was not found on file system * dependencies that was not found on file system
*/ */
missingDependencies?: { add: (T?: any) => void }; missingDependencies?: WriteOnlySet<string>;
/** /**
* set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`, * set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
@ -7647,35 +7698,9 @@ declare interface ResolveData {
cacheable: boolean; cacheable: boolean;
} }
declare interface ResolveOptionsTypes { declare interface ResolveOptionsTypes {
alias: { alias: AliasOption[];
/** fallback: AliasOption[];
* New request. aliasFields: Set<string | string[]>;
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[];
fallback: {
/**
* New request.
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[];
aliasFields: Set<EntryItem>;
cachePredicate: (arg0: ResolveRequest) => boolean; cachePredicate: (arg0: ResolveRequest) => boolean;
cacheWithContext: boolean; cacheWithContext: boolean;
@ -7685,20 +7710,17 @@ declare interface ResolveOptionsTypes {
conditionNames: Set<string>; conditionNames: Set<string>;
descriptionFiles: string[]; descriptionFiles: string[];
enforceExtension: boolean; enforceExtension: boolean;
exportsFields: Set<EntryItem>; exportsFields: Set<string | string[]>;
importsFields: Set<EntryItem>; importsFields: Set<string | string[]>;
extensions: Set<string>; extensions: Set<string>;
fileSystem: FileSystem; fileSystem: FileSystem;
unsafeCache: any; unsafeCache: false | object;
symlinks: boolean; symlinks: boolean;
resolver?: Resolver; resolver?: Resolver;
modules: EntryItem[]; modules: (string | string[])[];
mainFields: { name: string[]; forceRelative: boolean }[]; mainFields: { name: string[]; forceRelative: boolean }[];
mainFiles: Set<string>; mainFiles: Set<string>;
plugins: ( plugins: Plugin[];
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void)
)[];
pnpApi: null | PnpApiImpl; pnpApi: null | PnpApiImpl;
roots: Set<string>; roots: Set<string>;
fullySpecified: boolean; fullySpecified: boolean;
@ -7720,7 +7742,7 @@ declare interface ResolveOptionsWebpackOptions {
/** /**
* New request. * New request.
*/ */
alias: Target; alias: string | false | string[];
/** /**
* Request to be redirected. * Request to be redirected.
*/ */
@ -7730,12 +7752,12 @@ declare interface ResolveOptionsWebpackOptions {
*/ */
onlyModule?: boolean; onlyModule?: boolean;
}[] }[]
| { [index: string]: Target }; | { [index: string]: string | false | string[] };
/** /**
* Fields in the description file (usually package.json) which are used to redirect requests inside the module. * Fields in the description file (usually package.json) which are used to redirect requests inside the module.
*/ */
aliasFields?: EntryItem[]; aliasFields?: (string | string[])[];
/** /**
* Extra resolve options per dependency category. Typical categories are "commonjs", "amd", "esm". * Extra resolve options per dependency category. Typical categories are "commonjs", "amd", "esm".
@ -7790,7 +7812,7 @@ declare interface ResolveOptionsWebpackOptions {
/** /**
* New request. * New request.
*/ */
alias: Target; alias: string | false | string[];
/** /**
* Request to be redirected. * Request to be redirected.
*/ */
@ -7800,7 +7822,7 @@ declare interface ResolveOptionsWebpackOptions {
*/ */
onlyModule?: boolean; onlyModule?: boolean;
}[] }[]
| { [index: string]: Target }; | { [index: string]: string | false | string[] };
/** /**
* Filesystem for the resolver. * Filesystem for the resolver.
@ -7820,7 +7842,7 @@ declare interface ResolveOptionsWebpackOptions {
/** /**
* Field names from the description file (package.json) which are used to find the default entry point. * Field names from the description file (package.json) which are used to find the default entry point.
*/ */
mainFields?: EntryItem[]; mainFields?: (string | string[])[];
/** /**
* Filenames used to find the default entry point if there is no description file or main field. * Filenames used to find the default entry point if there is no description file or main field.
@ -7936,9 +7958,9 @@ declare abstract class Resolver {
[ResolveRequest, ResolveContext], [ResolveRequest, ResolveContext],
null | ResolveRequest null | ResolveRequest
>; >;
resolveSync(context: any, path: string, request: string): DevTool; resolveSync(context: object, path: string, request: string): string | false;
resolve( resolve(
context: any, context: object,
path: string, path: string,
request: string, request: string,
resolveContext: ResolveContext, resolveContext: ResolveContext,
@ -7990,6 +8012,7 @@ declare interface ResourceDataWithData {
fragment: string; fragment: string;
data: Record<string, any>; data: Record<string, any>;
} }
type Rule = string | RegExp;
declare interface RuleSet { declare interface RuleSet {
/** /**
* map of references in the rule set (may grow over time) * map of references in the rule set (may grow over time)
@ -8039,6 +8062,25 @@ type RuleSetConditionAbsolute =
} }
| ((value: string) => boolean) | ((value: string) => boolean)
| RuleSetConditionAbsolute[]; | RuleSetConditionAbsolute[];
type RuleSetConditionOrConditions =
| string
| RegExp
| {
/**
* Logical AND.
*/
and?: RuleSetCondition[];
/**
* Logical NOT.
*/
not?: RuleSetCondition[];
/**
* Logical OR.
*/
or?: RuleSetCondition[];
}
| ((value: string) => boolean)
| RuleSetCondition[];
/** /**
* A rule description with conditions and effects for modules. * A rule description with conditions and effects for modules.
@ -8093,7 +8135,7 @@ declare interface RuleSetRule {
/** /**
* Match values of properties in the description file (usually package.json). * Match values of properties in the description file (usually package.json).
*/ */
descriptionData?: { [index: string]: RuleSetCondition }; descriptionData?: { [index: string]: RuleSetConditionOrConditions };
/** /**
* Enforce this rule as pre or post step. * Enforce this rule as pre or post step.
@ -8814,7 +8856,7 @@ declare abstract class RuntimeTemplate {
/** /**
* the export name * the export name
*/ */
exportName: EntryItem; exportName: string | string[];
/** /**
* the origin module * the origin module
*/ */
@ -9203,10 +9245,10 @@ declare interface SourceLike {
} }
declare class SourceMapDevToolPlugin { declare class SourceMapDevToolPlugin {
constructor(options?: SourceMapDevToolPluginOptions); constructor(options?: SourceMapDevToolPluginOptions);
sourceMapFilename: DevTool; sourceMapFilename: string | false;
sourceMappingURLComment: DevTool; sourceMappingURLComment: string | false;
moduleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate; moduleFilenameTemplate: string | Function;
fallbackModuleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate; fallbackModuleFilenameTemplate: string | Function;
namespace: string; namespace: string;
options: SourceMapDevToolPluginOptions; options: SourceMapDevToolPluginOptions;
@ -9229,7 +9271,7 @@ declare interface SourceMapDevToolPluginOptions {
/** /**
* Exclude modules that match the given value from source map generation. * Exclude modules that match the given value from source map generation.
*/ */
exclude?: string | RegExp | (string | RegExp)[]; exclude?: string | RegExp | Rule[];
/** /**
* Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict. * Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict.
@ -9249,7 +9291,7 @@ declare interface SourceMapDevToolPluginOptions {
/** /**
* Include source maps for module paths that match the given value. * Include source maps for module paths that match the given value.
*/ */
include?: string | RegExp | (string | RegExp)[]; include?: string | RegExp | Rule[];
/** /**
* Indicates whether SourceMaps from loaders should be used (defaults to true). * Indicates whether SourceMaps from loaders should be used (defaults to true).
@ -9284,7 +9326,7 @@ declare interface SourceMapDevToolPluginOptions {
/** /**
* Include source maps for modules based on their extension (defaults to .js and .css). * Include source maps for modules based on their extension (defaults to .js and .css).
*/ */
test?: string | RegExp | (string | RegExp)[]; test?: string | RegExp | Rule[];
} }
declare class SourceMapSource extends Source { declare class SourceMapSource extends Source {
constructor( constructor(
@ -9311,11 +9353,11 @@ declare interface SourcePosition {
declare interface SplitChunksOptions { declare interface SplitChunksOptions {
chunksFilter: (chunk: Chunk) => boolean; chunksFilter: (chunk: Chunk) => boolean;
defaultSizeTypes: string[]; defaultSizeTypes: string[];
minSize: Record<string, number>; minSize: SplitChunksSizes;
minRemainingSize: Record<string, number>; minRemainingSize: SplitChunksSizes;
enforceSizeThreshold: Record<string, number>; enforceSizeThreshold: SplitChunksSizes;
maxInitialSize: Record<string, number>; maxInitialSize: SplitChunksSizes;
maxAsyncSize: Record<string, number>; maxAsyncSize: SplitChunksSizes;
minChunks: number; minChunks: number;
maxAsyncRequests: number; maxAsyncRequests: number;
maxInitialRequests: number; maxInitialRequests: number;
@ -9343,6 +9385,9 @@ declare class SplitChunksPlugin {
*/ */
apply(compiler: Compiler): void; apply(compiler: Compiler): void;
} }
declare interface SplitChunksSizes {
[index: string]: number;
}
declare abstract class StackedMap<K, V> { declare abstract class StackedMap<K, V> {
map: Map<K, InternalCell<V>>; map: Map<K, InternalCell<V>>;
stack: Map<K, InternalCell<V>>[]; stack: Map<K, InternalCell<V>>[];
@ -9406,7 +9451,7 @@ declare abstract class StatsFactory {
SyncBailHook<[any, StatsFactoryContext, number, number], any> SyncBailHook<[any, StatsFactoryContext, number, number], any>
>; >;
groupResults: HookMap< groupResults: HookMap<
SyncBailHook<[GroupConfig<any, object>[], StatsFactoryContext], any> SyncBailHook<[GroupConfig[], StatsFactoryContext], any>
>; >;
sortResults: HookMap< sortResults: HookMap<
SyncBailHook< SyncBailHook<
@ -9425,7 +9470,7 @@ declare abstract class StatsFactory {
create( create(
type: string, type: string,
data: any, data: any,
baseContext: Pick<StatsFactoryContext, string> baseContext: Omit<StatsFactoryContext, "type">
): any; ): any;
} }
type StatsFactoryContext = KnownStatsFactoryContext & Record<string, any>; type StatsFactoryContext = KnownStatsFactoryContext & Record<string, any>;
@ -9876,7 +9921,6 @@ declare interface TagInfo {
data: any; data: any;
next?: TagInfo; next?: TagInfo;
} }
type Target = string | false | string[];
declare class Template { declare class Template {
constructor(); constructor();
static getFunctionContent(fn: Function): string; static getFunctionContent(fn: Function): string;
@ -9886,9 +9930,9 @@ declare class Template {
static toPath(str: string): string; static toPath(str: string): string;
static numberToIdentifier(n: number): string; static numberToIdentifier(n: number): string;
static numberToIdentifierContinuation(n: number): string; static numberToIdentifierContinuation(n: number): string;
static indent(s: EntryItem): string; static indent(s: string | string[]): string;
static prefix(s: EntryItem, prefix: string): string; static prefix(s: string | string[], prefix: string): string;
static asString(str: EntryItem): string; static asString(str: string | string[]): string;
static getModulesArrayBounds(modules: WithId[]): false | [number, number]; static getModulesArrayBounds(modules: WithId[]): false | [number, number];
static renderChunkModules( static renderChunkModules(
renderContext: RenderContextModuleTemplate, renderContext: RenderContextModuleTemplate,
@ -9932,47 +9976,17 @@ declare interface UserResolveOptions {
/** /**
* A list of module alias configurations or an object which maps key to value * A list of module alias configurations or an object which maps key to value
*/ */
alias?: alias?: AliasOption[] | AliasOptions;
| { [index: string]: Target }
| {
/**
* New request.
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[];
/** /**
* A list of module alias configurations or an object which maps key to value, applied only after modules option * A list of module alias configurations or an object which maps key to value, applied only after modules option
*/ */
fallback?: fallback?: AliasOption[] | AliasOptions;
| { [index: string]: Target }
| {
/**
* New request.
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[];
/** /**
* A list of alias fields in description files * A list of alias fields in description files
*/ */
aliasFields?: EntryItem[]; aliasFields?: (string | string[])[];
/** /**
* A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. * A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
@ -10002,12 +10016,12 @@ declare interface UserResolveOptions {
/** /**
* A list of exports fields in description files * A list of exports fields in description files
*/ */
exportsFields?: EntryItem[]; exportsFields?: (string | string[])[];
/** /**
* A list of imports fields in description files * A list of imports fields in description files
*/ */
importsFields?: EntryItem[]; importsFields?: (string | string[])[];
/** /**
* A list of extensions which should be tried for files * A list of extensions which should be tried for files
@ -10022,7 +10036,7 @@ declare interface UserResolveOptions {
/** /**
* Use this cache object to unsafely cache the successful requests * Use this cache object to unsafely cache the successful requests
*/ */
unsafeCache?: any; unsafeCache?: boolean | object;
/** /**
* Resolve symlinks to their symlinked location * Resolve symlinks to their symlinked location
@ -10045,7 +10059,7 @@ declare interface UserResolveOptions {
mainFields?: ( mainFields?: (
| string | string
| string[] | string[]
| { name: EntryItem; forceRelative: boolean } | { name: string | string[]; forceRelative: boolean }
)[]; )[];
/** /**
@ -10056,10 +10070,7 @@ declare interface UserResolveOptions {
/** /**
* A list of additional resolve plugins which should be applied * A list of additional resolve plugins which should be applied
*/ */
plugins?: ( plugins?: Plugin[];
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void)
)[];
/** /**
* A PnP API that should be used - null is "never", undefined is "auto" * A PnP API that should be used - null is "never", undefined is "auto"
@ -10528,6 +10539,9 @@ declare interface WithOptions {
arg0: Partial<ResolveOptionsWithDependencyType> arg0: Partial<ResolveOptionsWithDependencyType>
) => ResolverWithOptions; ) => ResolverWithOptions;
} }
declare interface WriteOnlySet<T> {
add: (T?: any) => void;
}
type __TypeWebpackOptions = ( type __TypeWebpackOptions = (
data: object data: object
) => ) =>
@ -10792,7 +10806,7 @@ declare namespace exports {
export { ProfilingPlugin }; export { ProfilingPlugin };
} }
export namespace util { export namespace util {
export const createHash: (algorithm: HashFunction) => Hash; export const createHash: (algorithm: string | typeof Hash) => Hash;
export namespace comparators { export namespace comparators {
export let compareChunksById: (a: Chunk, b: Chunk) => 0 | 1 | -1; export let compareChunksById: (a: Chunk, b: Chunk) => 0 | 1 | -1;
export let compareModulesByIdentifier: ( export let compareModulesByIdentifier: (

View File

@ -2311,10 +2311,10 @@ enhanced-resolve@^4.0.0:
memory-fs "^0.5.0" memory-fs "^0.5.0"
tapable "^1.0.0" tapable "^1.0.0"
enhanced-resolve@^5.6.0: enhanced-resolve@^5.7.0:
version "5.6.0" version "5.7.0"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.6.0.tgz#ad19a1665f230a6e384724a30acf3f7332b2b3f0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.7.0.tgz#525c5d856680fbd5052de453ac83e32049958b5c"
integrity sha512-C3GGDfFZmqUa21o10YRKbZN60DPl0HyXKXxoEnQMWso9u7KMU23L7CBHfr/rVxORddY/8YQZaU2MZ1ewTS8Pcw== integrity sha512-6njwt/NsZFUKhM6j9U8hzVyD4E4r0x7NQzhTCbcWOJ0IQjNSAoalWmb0AE51Wn+fwan5qVESWi7t2ToBxs9vrw==
dependencies: dependencies:
graceful-fs "^4.2.4" graceful-fs "^4.2.4"
tapable "^2.2.0" tapable "^2.2.0"
@ -6266,9 +6266,9 @@ toml@^3.0.0:
resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee"
integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==
tooling@webpack/tooling#v1.13.1: tooling@webpack/tooling#v1.14.0:
version "1.13.1" version "1.14.0"
resolved "https://codeload.github.com/webpack/tooling/tar.gz/bc7ef7012b4553ca447a555fce57dc0e56c6f528" resolved "https://codeload.github.com/webpack/tooling/tar.gz/f8500c02cf2a04b3a0c0c2ca38ad9df959b9d02a"
dependencies: dependencies:
"@yarnpkg/lockfile" "^1.1.0" "@yarnpkg/lockfile" "^1.1.0"
commondir "^1.0.1" commondir "^1.0.1"
@ -6396,10 +6396,10 @@ typedarray-to-buffer@^3.1.5:
dependencies: dependencies:
is-typedarray "^1.0.0" is-typedarray "^1.0.0"
typescript@^4.2.0-dev.20201130: typescript@^4.2.0-beta:
version "4.2.0-dev.20201130" version "4.2.0-beta"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.0-dev.20201130.tgz#13339af4dfd23070dcd16f28e590efe541c766c4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.0-beta.tgz#75326e43625718f4a325f5725a105a1b3f1a7b45"
integrity sha512-oMboCGPKWDJ8BFmmanPAWw3LUGlEXSkkF+MbuHu97i1iF7K4z4zjmnodoD3Dilqs2IMuVDmWBIkmget9xMrpTw== integrity sha512-0nYjpkQ6bKjHoJTQkUHcDtGLNenqc5rfTcl3ISUnJXPkGa0115FcVJABmodfMKHLyDBmzDr8IGLbDv5m7sbYgw==
uglify-js@^3.1.4: uglify-js@^3.1.4:
version "3.10.1" version "3.10.1"