Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding types #14855

Merged
merged 1 commit into from Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/index.js
Expand Up @@ -19,6 +19,7 @@ const memoize = require("./util/memoize");
/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */
/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
Expand All @@ -27,6 +28,8 @@ const memoize = require("./util/memoize");
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./MultiStats")} MultiStats */
/** @typedef {import("./Parser").ParserState} ParserState */
/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */
/** @typedef {import("./ResolverFactory").Resolver} Resolver */
/** @typedef {import("./Watching")} Watching */
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */
Expand Down
39 changes: 21 additions & 18 deletions types.d.ts
Expand Up @@ -2141,7 +2141,7 @@ declare interface Configuration {
/**
* Enable production optimizations or development hints.
*/
mode?: "development" | "production" | "none";
mode?: "none" | "development" | "production";

/**
* Options affecting the normal modules (`NormalModuleFactory`).
Expand Down Expand Up @@ -2226,15 +2226,15 @@ declare interface Configuration {
*/
stats?:
| boolean
| StatsOptions
| "none"
| "verbose"
| "summary"
| "errors-only"
| "errors-warnings"
| "minimal"
| "normal"
| "detailed"
| "verbose"
| StatsOptions;
| "detailed";

/**
* Environment to build for. An array of environments to build for all of them when possible.
Expand Down Expand Up @@ -4557,7 +4557,7 @@ declare interface InfrastructureLogging {
/**
* Log level.
*/
level?: "none" | "verbose" | "error" | "warn" | "info" | "log";
level?: "none" | "error" | "warn" | "info" | "log" | "verbose";

/**
* Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.
Expand Down Expand Up @@ -4703,7 +4703,7 @@ declare class JavascriptModulesPlugin {
static chunkHasJs: (chunk: Chunk, chunkGraph: ChunkGraph) => boolean;
}
declare class JavascriptParser extends Parser {
constructor(sourceType?: "module" | "script" | "auto");
constructor(sourceType?: "module" | "auto" | "script");
hooks: Readonly<{
evaluateTypeof: HookMap<
SyncBailHook<
Expand Down Expand Up @@ -4973,7 +4973,7 @@ declare class JavascriptParser extends Parser {
program: SyncBailHook<[Program, Comment[]], boolean | void>;
finish: SyncBailHook<[Program, Comment[]], boolean | void>;
}>;
sourceType: "module" | "script" | "auto";
sourceType: "module" | "auto" | "script";
scope: ScopeInfo;
state: ParserState;
comments: any;
Expand Down Expand Up @@ -5313,7 +5313,7 @@ declare interface JavascriptParserOptions {
/**
* Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
*/
exportsPresence?: false | "error" | "warn" | "auto";
exportsPresence?: false | "auto" | "error" | "warn";

/**
* Enable warnings for full dynamic dependencies.
Expand Down Expand Up @@ -5348,7 +5348,7 @@ declare interface JavascriptParserOptions {
/**
* Specifies the behavior of invalid export names in "import ... from ...".
*/
importExportsPresence?: false | "error" | "warn" | "auto";
importExportsPresence?: false | "auto" | "error" | "warn";

/**
* Include polyfills or mocks for various node stuff.
Expand All @@ -5358,7 +5358,7 @@ declare interface JavascriptParserOptions {
/**
* 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.
*/
reexportExportsPresence?: false | "error" | "warn" | "auto";
reexportExportsPresence?: false | "auto" | "error" | "warn";

/**
* Enable/disable parsing of require.context syntax.
Expand Down Expand Up @@ -5595,7 +5595,7 @@ declare interface KnownNormalizedStatsOptions {
modulesSpace: number;
chunkModulesSpace: number;
nestedModulesSpace: number;
logging: false | "none" | "verbose" | "error" | "warn" | "info" | "log";
logging: false | "none" | "error" | "warn" | "info" | "log" | "verbose";
loggingDebug: ((value: string) => boolean)[];
loggingTrace: boolean;
}
Expand Down Expand Up @@ -7553,7 +7553,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
rootContext: string;
fs: InputFileSystem;
sourceMap?: boolean;
mode: "development" | "production" | "none";
mode: "none" | "development" | "production";
webpack?: boolean;
_module?: NormalModule;
_compilation?: Compilation;
Expand Down Expand Up @@ -9410,7 +9410,7 @@ declare interface ResolveOptionsWebpackOptions {
/**
* Plugins for the resolver.
*/
plugins?: ("..." | ResolvePluginInstance)[];
plugins?: (ResolvePluginInstance | "...")[];

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

/**
* Include debug logging of specified loggers (i. e. for plugins or loaders). Filters can be Strings, RegExps or Functions.
Expand Down Expand Up @@ -11421,15 +11421,15 @@ type StatsPrinterContext = KnownStatsPrinterContext & Record<string, any>;
type StatsProfile = KnownStatsProfile & Record<string, any>;
type StatsValue =
| boolean
| StatsOptions
| "none"
| "verbose"
| "summary"
| "errors-only"
| "errors-warnings"
| "minimal"
| "normal"
| "detailed"
| "verbose"
| StatsOptions;
| "detailed";
declare interface SyntheticDependencyLocation {
name: string;
index?: number;
Expand Down Expand Up @@ -12039,7 +12039,7 @@ declare interface WebpackOptionsNormalized {
/**
* Enable production optimizations or development hints.
*/
mode?: "development" | "production" | "none";
mode?: "none" | "development" | "production";

/**
* Options affecting the normal modules (`NormalModuleFactory`).
Expand Down Expand Up @@ -12711,13 +12711,16 @@ declare namespace exports {
RuleSetRule,
RuleSetUse,
RuleSetUseItem,
StatsOptions,
Configuration,
WebpackOptionsNormalized,
WebpackPluginInstance,
Asset,
AssetInfo,
MultiStats,
ParserState,
ResolvePluginInstance,
Resolver,
Watching,
StatsAsset,
StatsChunk,
Expand Down