Skip to content

Commit 791347f

Browse files
Brian-McBridesokra
authored andcommitted
Adding types
1 parent f1e9221 commit 791347f

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

lib/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const memoize = require("./util/memoize");
1919
/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
2020
/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */
2121
/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
22+
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
2223
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */
2324
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
2425
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
@@ -27,6 +28,8 @@ const memoize = require("./util/memoize");
2728
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
2829
/** @typedef {import("./MultiStats")} MultiStats */
2930
/** @typedef {import("./Parser").ParserState} ParserState */
31+
/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */
32+
/** @typedef {import("./ResolverFactory").Resolver} Resolver */
3033
/** @typedef {import("./Watching")} Watching */
3134
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
3235
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */

types.d.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,7 @@ declare interface Configuration {
21412141
/**
21422142
* Enable production optimizations or development hints.
21432143
*/
2144-
mode?: "development" | "production" | "none";
2144+
mode?: "none" | "development" | "production";
21452145

21462146
/**
21472147
* Options affecting the normal modules (`NormalModuleFactory`).
@@ -2226,15 +2226,15 @@ declare interface Configuration {
22262226
*/
22272227
stats?:
22282228
| boolean
2229+
| StatsOptions
22292230
| "none"
2231+
| "verbose"
22302232
| "summary"
22312233
| "errors-only"
22322234
| "errors-warnings"
22332235
| "minimal"
22342236
| "normal"
2235-
| "detailed"
2236-
| "verbose"
2237-
| StatsOptions;
2237+
| "detailed";
22382238

22392239
/**
22402240
* Environment to build for. An array of environments to build for all of them when possible.
@@ -4557,7 +4557,7 @@ declare interface InfrastructureLogging {
45574557
/**
45584558
* Log level.
45594559
*/
4560-
level?: "none" | "verbose" | "error" | "warn" | "info" | "log";
4560+
level?: "none" | "error" | "warn" | "info" | "log" | "verbose";
45614561

45624562
/**
45634563
* Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.
@@ -4703,7 +4703,7 @@ declare class JavascriptModulesPlugin {
47034703
static chunkHasJs: (chunk: Chunk, chunkGraph: ChunkGraph) => boolean;
47044704
}
47054705
declare class JavascriptParser extends Parser {
4706-
constructor(sourceType?: "module" | "script" | "auto");
4706+
constructor(sourceType?: "module" | "auto" | "script");
47074707
hooks: Readonly<{
47084708
evaluateTypeof: HookMap<
47094709
SyncBailHook<
@@ -4973,7 +4973,7 @@ declare class JavascriptParser extends Parser {
49734973
program: SyncBailHook<[Program, Comment[]], boolean | void>;
49744974
finish: SyncBailHook<[Program, Comment[]], boolean | void>;
49754975
}>;
4976-
sourceType: "module" | "script" | "auto";
4976+
sourceType: "module" | "auto" | "script";
49774977
scope: ScopeInfo;
49784978
state: ParserState;
49794979
comments: any;
@@ -5313,7 +5313,7 @@ declare interface JavascriptParserOptions {
53135313
/**
53145314
* Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
53155315
*/
5316-
exportsPresence?: false | "error" | "warn" | "auto";
5316+
exportsPresence?: false | "auto" | "error" | "warn";
53175317

53185318
/**
53195319
* Enable warnings for full dynamic dependencies.
@@ -5348,7 +5348,7 @@ declare interface JavascriptParserOptions {
53485348
/**
53495349
* Specifies the behavior of invalid export names in "import ... from ...".
53505350
*/
5351-
importExportsPresence?: false | "error" | "warn" | "auto";
5351+
importExportsPresence?: false | "auto" | "error" | "warn";
53525352

53535353
/**
53545354
* Include polyfills or mocks for various node stuff.
@@ -5358,7 +5358,7 @@ declare interface JavascriptParserOptions {
53585358
/**
53595359
* Specifies the behavior of invalid export names in "export ... from ...". This might be useful to disable during the migration from "export ... from ..." to "export type ... from ..." when reexporting types in TypeScript.
53605360
*/
5361-
reexportExportsPresence?: false | "error" | "warn" | "auto";
5361+
reexportExportsPresence?: false | "auto" | "error" | "warn";
53625362

53635363
/**
53645364
* Enable/disable parsing of require.context syntax.
@@ -5595,7 +5595,7 @@ declare interface KnownNormalizedStatsOptions {
55955595
modulesSpace: number;
55965596
chunkModulesSpace: number;
55975597
nestedModulesSpace: number;
5598-
logging: false | "none" | "verbose" | "error" | "warn" | "info" | "log";
5598+
logging: false | "none" | "error" | "warn" | "info" | "log" | "verbose";
55995599
loggingDebug: ((value: string) => boolean)[];
56005600
loggingTrace: boolean;
56015601
}
@@ -7553,7 +7553,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
75537553
rootContext: string;
75547554
fs: InputFileSystem;
75557555
sourceMap?: boolean;
7556-
mode: "development" | "production" | "none";
7556+
mode: "none" | "development" | "production";
75577557
webpack?: boolean;
75587558
_module?: NormalModule;
75597559
_compilation?: Compilation;
@@ -9410,7 +9410,7 @@ declare interface ResolveOptionsWebpackOptions {
94109410
/**
94119411
* Plugins for the resolver.
94129412
*/
9413-
plugins?: ("..." | ResolvePluginInstance)[];
9413+
plugins?: (ResolvePluginInstance | "...")[];
94149414

94159415
/**
94169416
* Prefer to resolve server-relative URLs (starting with '/') as absolute paths before falling back to resolve in 'resolve.roots'.
@@ -11252,7 +11252,7 @@ declare interface StatsOptions {
1125211252
/**
1125311253
* Add logging output.
1125411254
*/
11255-
logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log";
11255+
logging?: boolean | "none" | "error" | "warn" | "info" | "log" | "verbose";
1125611256

1125711257
/**
1125811258
* Include debug logging of specified loggers (i. e. for plugins or loaders). Filters can be Strings, RegExps or Functions.
@@ -11421,15 +11421,15 @@ type StatsPrinterContext = KnownStatsPrinterContext & Record<string, any>;
1142111421
type StatsProfile = KnownStatsProfile & Record<string, any>;
1142211422
type StatsValue =
1142311423
| boolean
11424+
| StatsOptions
1142411425
| "none"
11426+
| "verbose"
1142511427
| "summary"
1142611428
| "errors-only"
1142711429
| "errors-warnings"
1142811430
| "minimal"
1142911431
| "normal"
11430-
| "detailed"
11431-
| "verbose"
11432-
| StatsOptions;
11432+
| "detailed";
1143311433
declare interface SyntheticDependencyLocation {
1143411434
name: string;
1143511435
index?: number;
@@ -12039,7 +12039,7 @@ declare interface WebpackOptionsNormalized {
1203912039
/**
1204012040
* Enable production optimizations or development hints.
1204112041
*/
12042-
mode?: "development" | "production" | "none";
12042+
mode?: "none" | "development" | "production";
1204312043

1204412044
/**
1204512045
* Options affecting the normal modules (`NormalModuleFactory`).
@@ -12711,13 +12711,16 @@ declare namespace exports {
1271112711
RuleSetRule,
1271212712
RuleSetUse,
1271312713
RuleSetUseItem,
12714+
StatsOptions,
1271412715
Configuration,
1271512716
WebpackOptionsNormalized,
1271612717
WebpackPluginInstance,
1271712718
Asset,
1271812719
AssetInfo,
1271912720
MultiStats,
1272012721
ParserState,
12722+
ResolvePluginInstance,
12723+
Resolver,
1272112724
Watching,
1272212725
StatsAsset,
1272312726
StatsChunk,

0 commit comments

Comments
 (0)