improve schema

This commit is contained in:
Tobias Koppers 2018-09-19 12:59:48 +02:00
parent 49a271d9a8
commit b6e81cd00e
2 changed files with 216 additions and 189 deletions

View File

@ -8,28 +8,47 @@
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "Entry".
*/
export type Entry =
| {
/**
* An entry point with name
*/
[k: string]: string | NonEmptyArrayOfUniqueStringValues;
}
| string
| NonEmptyArrayOfUniqueStringValues
| {
[k: string]: any;
};
export type Entry = EntryDynamic | EntryStatic;
/**
* A Function returning an entry object, an entry string, an entry array or a promise to these things.
*
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "EntryDynamic".
*/
export type EntryDynamic = (() => EntryStatic | Promise<EntryStatic>);
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "EntryStatic".
*/
export type EntryStatic = EntryObject | EntryItem;
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "NonEmptyArrayOfUniqueStringValues".
*/
export type NonEmptyArrayOfUniqueStringValues = string[];
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "EntryItem".
*/
export type EntryItem = string | NonEmptyArrayOfUniqueStringValues;
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "Externals".
*/
export type Externals = ExternalItem | ExternalItem[];
export type Externals =
| ((
context: string,
request: string,
callback: (err?: Error, result?: string) => void
) => void)
| ExternalItem
| (
| ((
context: string,
request: string,
callback: (err?: Error, result?: string) => void
) => void)
| ExternalItem)[];
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "ExternalItem".
@ -72,7 +91,7 @@ export type RuleSetCondition =
[k: string]: any;
}
| string
| RuleSetConditions
| Function
| {
/**
* Logical AND
@ -113,21 +132,14 @@ export type RuleSetLoader = string;
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "RuleSetUse".
*/
export type RuleSetUse =
| RuleSetUseItem
| {
[k: string]: any;
}
| RuleSetUseItem[];
export type RuleSetUse = RuleSetUseItem | Function | RuleSetUseItem[];
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "RuleSetUseItem".
*/
export type RuleSetUseItem =
| RuleSetLoader
| {
[k: string]: any;
}
| Function
| {
/**
* Unique loader identifier
@ -187,7 +199,8 @@ export type FilterItemTypes =
| {
[k: string]: any;
}
| string;
| string
| Function;
export interface WebpackOptions {
/**
@ -325,9 +338,7 @@ export interface WebpackOptions {
| "node-webkit"
| "electron-main"
| "electron-renderer")
| {
[k: string]: any;
};
| ((compiler: import("../lib/Compiler")) => void);
/**
* Enter watch mode, which rebuilds on file change.
*/
@ -356,6 +367,18 @@ export interface WebpackOptions {
stdin?: boolean;
};
}
/**
* Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
*
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "EntryObject".
*/
export interface EntryObject {
/**
* An entry point with name
*/
[k: string]: string | NonEmptyArrayOfUniqueStringValues;
}
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "ModuleOptions".
@ -395,6 +418,7 @@ export interface ModuleOptions {
| {
[k: string]: any;
}
| Function
| string[]
| string;
/**
@ -432,11 +456,7 @@ export interface ModuleOptions {
/**
* Cache the resolving of module requests
*/
unsafeCache?:
| boolean
| {
[k: string]: any;
};
unsafeCache?: boolean | Function;
/**
* Enable warnings for partial dynamic dependencies
*/
@ -587,9 +607,7 @@ export interface ResolveOptions {
/**
* Predicate function to decide which requests should be cached
*/
cachePredicate?: {
[k: string]: any;
};
cachePredicate?: Function;
/**
* Include the context information in the cache identifier when caching
*/
@ -803,11 +821,7 @@ export interface OptimizationOptions {
/**
* The name or name factory for the runtime chunks
*/
name?:
| string
| {
[k: string]: any;
};
name?: string | Function;
};
/**
* Skip over modules which are flagged to contain no side effects when exports are not used
@ -840,10 +854,11 @@ export interface OptimizationSplitChunksOptions {
*/
[k: string]:
| false
| Function
| string
| {
[k: string]: any;
}
| string
| {
/**
* Sets the name delimiter for created chunks
@ -856,11 +871,7 @@ export interface OptimizationSplitChunksOptions {
/**
* Select chunks for determining cache group content (defaults to "initial", "initial" and "all" requires adding these chunks to the HTML)
*/
chunks?:
| ("initial" | "async" | "all")
| {
[k: string]: any;
};
chunks?: ("initial" | "async" | "all") | Function;
/**
* Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group
*/
@ -892,12 +903,7 @@ export interface OptimizationSplitChunksOptions {
/**
* Give chunks for this cache group a name (chunks with equal name are merged)
*/
name?:
| boolean
| {
[k: string]: any;
}
| string;
name?: boolean | Function | string;
/**
* Priority of this cache group
*/
@ -910,20 +916,17 @@ export interface OptimizationSplitChunksOptions {
* Assign modules to a cache group
*/
test?:
| Function
| string
| {
[k: string]: any;
}
| string;
};
};
};
/**
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML)
*/
chunks?:
| ("initial" | "async" | "all")
| {
[k: string]: any;
};
chunks?: ("initial" | "async" | "all") | Function;
/**
* Options for modules not selected by any other cache group
*/
@ -972,12 +975,7 @@ export interface OptimizationSplitChunksOptions {
/**
* Give chunks created a name (chunks with equal name are merged)
*/
name?:
| boolean
| {
[k: string]: any;
}
| string;
name?: boolean | Function | string;
}
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
@ -1026,11 +1024,7 @@ export interface OutputOptions {
/**
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
*/
devtoolFallbackModuleFilenameTemplate?:
| string
| {
[k: string]: any;
};
devtoolFallbackModuleFilenameTemplate?: string | Function;
/**
* Enable line to line mapped mode for all/specified modules. Line to line mapped mode uses a simple SourceMap where each line of the generated source is mapped to the same line of the original source. Its a performance optimization. Only use it if your performance need to be better and you are sure that input lines match which generated lines.
*/
@ -1042,11 +1036,7 @@ export interface OutputOptions {
/**
* Filename template string of function for the sources array in a generated SourceMap.
*/
devtoolModuleFilenameTemplate?:
| string
| {
[k: string]: any;
};
devtoolModuleFilenameTemplate?: string | Function;
/**
* Module namespace to use when interpolating filename template string for the sources array in a generated SourceMap. Defaults to `output.library` if not set. It's useful for avoiding runtime collisions in sourcemaps from multiple webpack projects built as libraries.
*/
@ -1054,11 +1044,7 @@ export interface OutputOptions {
/**
* Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
*/
filename?:
| string
| {
[k: string]: any;
};
filename?: string | Function;
/**
* An expression which is used to address the global object/scope in runtime code
*/
@ -1082,11 +1068,7 @@ export interface OutputOptions {
/**
* The filename of the Hot Update Chunks. They are inside the output.path directory.
*/
hotUpdateChunkFilename?:
| string
| {
[k: string]: any;
};
hotUpdateChunkFilename?: string | Function;
/**
* The JSONP function used by webpack for async loading of hot update chunks.
*/
@ -1094,11 +1076,7 @@ export interface OutputOptions {
/**
* The filename of the Hot Update Main File. It is inside the `output.path` directory.
*/
hotUpdateMainFilename?:
| string
| {
[k: string]: any;
};
hotUpdateMainFilename?: string | Function;
/**
* The JSONP function used by webpack for async loading of chunks.
*/
@ -1110,23 +1088,7 @@ export interface OutputOptions {
/**
* If set, export the bundle as library. `output.library` is the name.
*/
library?:
| string
| string[]
| {
/**
* Name of the exposed AMD library in the UMD
*/
amd?: string;
/**
* Name of the exposed commonjs export in the UMD
*/
commonjs?: string;
/**
* Name of the property exposed globally by a UMD library
*/
root?: string | ArrayOfStringValues;
};
library?: string | string[] | LibraryCustomUmdObject;
/**
* Specify which export should be exposed as library
*/
@ -1159,11 +1121,7 @@ export interface OutputOptions {
/**
* The `publicPath` specifies the public URL address of the output files when referenced in a browser.
*/
publicPath?:
| string
| {
[k: string]: any;
};
publicPath?: string | Function;
/**
* The filename of the SourceMaps for the JavaScript files. They are inside the `output.path` directory.
*/
@ -1185,6 +1143,24 @@ export interface OutputOptions {
*/
webassemblyModuleFilename?: string;
}
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "LibraryCustomUmdObject".
*/
export interface LibraryCustomUmdObject {
/**
* Name of the exposed AMD library in the UMD
*/
amd?: string;
/**
* Name of the exposed commonjs export in the UMD
*/
commonjs?: string;
/**
* Name of the property exposed globally by a UMD library
*/
root?: string | ArrayOfStringValues;
}
/**
* This interface was referenced by `WebpackOptions`'s JSON-Schema
* via the `definition` "PerformanceOptions".
@ -1193,9 +1169,7 @@ export interface PerformanceOptions {
/**
* Filter function to select assets that are checked
*/
assetFilter?: {
[k: string]: any;
};
assetFilter?: Function;
/**
* Sets the format of the hints: warnings, errors or nothing at all
*/

View File

@ -29,30 +29,22 @@
}
},
"Entry": {
"oneOf": [
"anyOf": [
{
"description": "Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.",
"type": "object",
"additionalProperties": {
"description": "An entry point with name",
"oneOf": [
{
"description": "The string is resolved to a module which is loaded upon startup.",
"type": "string",
"minLength": 1
},
{
"description": "All modules are loaded upon startup. The last one is exported.",
"anyOf": [
{
"$ref": "#/definitions/NonEmptyArrayOfUniqueStringValues"
}
]
}
]
},
"minProperties": 1
"$ref": "#/definitions/EntryDynamic"
},
{
"$ref": "#/definitions/EntryStatic"
}
]
},
"EntryDynamic": {
"description": "A Function returning an entry object, an entry string, an entry array or a promise to these things.",
"instanceof": "Function",
"tsType": "(() => EntryStatic | Promise<EntryStatic>)"
},
"EntryItem": {
"oneOf": [
{
"description": "An entry point without name. The string is resolved to a module which is loaded upon startup.",
"type": "string",
@ -65,10 +57,39 @@
"$ref": "#/definitions/NonEmptyArrayOfUniqueStringValues"
}
]
}
]
},
"EntryObject": {
"description": "Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.",
"type": "object",
"additionalProperties": {
"description": "An entry point with name",
"oneOf": [
{
"description": "The string is resolved to a module which is loaded upon startup.",
"type": "string",
"minLength": 1
},
{
"description": "All modules are loaded upon startup. The last one is exported.",
"anyOf": [
{
"$ref": "#/definitions/NonEmptyArrayOfUniqueStringValues"
}
]
}
]
},
"minProperties": 1
},
"EntryStatic": {
"oneOf": [
{
"$ref": "#/definitions/EntryObject"
},
{
"description": "A Function returning an entry object, an entry string, an entry array or a promise to these things.",
"instanceof": "Function"
"$ref": "#/definitions/EntryItem"
}
]
},
@ -99,10 +120,6 @@
]
}
},
{
"description": "`function(context, request, callback(err, result))` The function is called on each dependency.",
"instanceof": "Function"
},
{
"description": "Every matched dependency becomes external.",
"instanceof": "RegExp"
@ -111,6 +128,11 @@
},
"Externals": {
"anyOf": [
{
"description": "`function(context, request, callback(err, result))` The function is called on each dependency.",
"instanceof": "Function",
"tsType": "((context: string, request: string, callback: (err?: Error, result?: string) => void) => void)"
},
{
"$ref": "#/definitions/ExternalItem"
},
@ -119,6 +141,11 @@
"items": {
"description": "External configuration",
"anyOf": [
{
"description": "`function(context, request, callback(err, result))` The function is called on each dependency.",
"instanceof": "Function",
"tsType": "((context: string, request: string, callback: (err?: Error, result?: string) => void) => void)"
},
{
"$ref": "#/definitions/ExternalItem"
}
@ -136,7 +163,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -158,6 +186,31 @@
}
]
},
"LibraryCustomUmdObject": {
"type": "object",
"additionalProperties": false,
"properties": {
"amd": {
"description": "Name of the exposed AMD library in the UMD",
"type": "string"
},
"commonjs": {
"description": "Name of the exposed commonjs export in the UMD",
"type": "string"
},
"root": {
"description": "Name of the property exposed globally by a UMD library",
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/ArrayOfStringValues"
}
]
}
}
},
"ModuleOptions": {
"type": "object",
"additionalProperties": false,
@ -208,7 +261,8 @@
"instanceof": "RegExp"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "array",
@ -271,7 +325,8 @@
"type": "boolean"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -451,7 +506,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
}
@ -499,7 +555,8 @@
"enum": [false]
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string"
@ -527,7 +584,8 @@
"enum": ["initial", "async", "all"]
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -572,7 +630,8 @@
"type": "boolean"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string"
@ -591,7 +650,8 @@
"description": "Assign modules to a cache group",
"oneOf": [
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string"
@ -613,7 +673,8 @@
"enum": ["initial", "async", "all"]
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -680,7 +741,8 @@
"type": "boolean"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string"
@ -749,7 +811,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -773,7 +836,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -788,7 +852,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
],
"absolutePath": false
@ -832,7 +897,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
],
"absolutePath": false
@ -848,7 +914,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
],
"absolutePath": false
@ -875,29 +942,7 @@
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"amd": {
"description": "Name of the exposed AMD library in the UMD",
"type": "string"
},
"commonjs": {
"description": "Name of the exposed commonjs export in the UMD",
"type": "string"
},
"root": {
"description": "Name of the property exposed globally by a UMD library",
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/ArrayOfStringValues"
}
]
}
}
"$ref": "#/definitions/LibraryCustomUmdObject"
}
]
},
@ -946,7 +991,8 @@
"type": "string"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
]
},
@ -980,7 +1026,8 @@
"properties": {
"assetFilter": {
"description": "Filter function to select assets that are checked",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
"hints": {
"description": "Sets the format of the hints: warnings, errors or nothing at all",
@ -1044,7 +1091,8 @@
},
"cachePredicate": {
"description": "Predicate function to decide which requests should be cached",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
"cacheWithContext": {
"description": "Include the context information in the cache identifier when caching",
@ -1163,7 +1211,8 @@
"minLength": 1
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"$ref": "#/definitions/RuleSetConditions"
@ -1446,7 +1495,8 @@
"$ref": "#/definitions/RuleSetUseItem"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "array",
@ -1467,7 +1517,8 @@
"$ref": "#/definitions/RuleSetLoader"
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "object",
@ -1739,7 +1790,8 @@
"properties": {
"apply": {
"description": "The run point of the plugin, required method.",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
}
},
"required": ["apply"],
@ -1980,7 +2032,8 @@
]
},
{
"instanceof": "Function"
"instanceof": "Function",
"tsType": "((compiler: import('../lib/Compiler')) => void)"
}
]
},