fix plugin schemas and give them names

This commit is contained in:
Tobias Koppers 2018-09-20 10:13:38 +02:00
parent d064fbe79f
commit a91f7366dc
28 changed files with 111 additions and 85 deletions

View File

@ -4,44 +4,52 @@
* Run `yarn special-lint-fix` to update
*/
export type BannerPlugin =
| {
/**
* Specifies the banner
*/
banner:
| {
[k: string]: any;
}
| string;
/**
* If true, the banner will only be added to the entry chunks
*/
entryOnly?: boolean;
/**
* Exclude all modules matching any of these conditions
*/
exclude?: Rules;
/**
* Include all modules matching any of these conditions
*/
include?: Rules;
/**
* If true, banner will not be wrapped in a comment
*/
raw?: boolean;
/**
* Include all modules that pass test assertion
*/
test?: Rules;
}
| {
[k: string]: any;
}
export type BannerPluginArgument =
| BannerPluginOptions
| BannerFunction
| string;
/**
* The banner as function, it will be wrapped in a comment
*/
export type BannerFunction = (
data: {
hash: string;
chunk: import("../../lib/Chunk");
filename: string;
basename: string;
query: string;
}
) => string;
export type Rules = Rule[] | Rule;
export type Rule =
| {
[k: string]: any;
}
| string;
export interface BannerPluginOptions {
/**
* Specifies the banner
*/
banner: BannerFunction | string;
/**
* If true, the banner will only be added to the entry chunks
*/
entryOnly?: boolean;
/**
* Exclude all modules matching any of these conditions
*/
exclude?: Rules;
/**
* Include all modules matching any of these conditions
*/
include?: Rules;
/**
* If true, banner will not be wrapped in a comment
*/
raw?: boolean;
/**
* Include all modules that pass test assertion
*/
test?: Rules;
}

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface DllPlugin {
export interface DllPluginOptions {
/**
* Context of requests in the manifest file (defaults to the webpack context)
*/

View File

@ -4,6 +4,6 @@
* Run `yarn special-lint-fix` to update
*/
export type DllReferencePlugin = {
export type DllReferencePluginOptions = {
[k: string]: any;
};

View File

@ -4,7 +4,11 @@
* Run `yarn special-lint-fix` to update
*/
export interface HashedModuleIdsPlugin {
export interface HashedModuleIdsPluginOptions {
/**
* The context directory for creating names.
*/
context?: string;
/**
* The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export type IgnorePlugin =
export type IgnorePluginOptions =
| {
/**
* A RegExp to test the context (directory) against
@ -23,13 +23,9 @@ export type IgnorePlugin =
/**
* A filter function for context
*/
checkContext?: {
[k: string]: any;
};
checkContext?: ((context: string) => boolean);
/**
* A filter function for resource
*/
checkResource?: {
[k: string]: any;
};
checkResource?: ((resource: string) => boolean);
};

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface LoaderOptionsPlugin {
export interface LoaderOptionsPluginOptions {
/**
* Whether loaders should be in debug mode or not. debug will be removed as of webpack 3
*/

View File

@ -5,12 +5,12 @@
*/
/**
* This interface was referenced by `SourceMapDevToolPlugin`'s JSON-Schema
* This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
* via the `definition` "rules".
*/
export type Rules = Rule[] | Rule;
/**
* This interface was referenced by `SourceMapDevToolPlugin`'s JSON-Schema
* This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
* via the `definition` "rule".
*/
export type Rule =
@ -19,7 +19,7 @@ export type Rule =
}
| string;
export interface SourceMapDevToolPlugin {
export interface SourceMapDevToolPluginOptions {
/**
* Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending
*/
@ -35,11 +35,7 @@ export interface SourceMapDevToolPlugin {
/**
* 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
*/
fallbackModuleFilenameTemplate?:
| {
[k: string]: any;
}
| string;
fallbackModuleFilenameTemplate?: Function | string;
/**
* Path prefix to which the [file] placeholder is relative to
*/
@ -78,11 +74,7 @@ export interface SourceMapDevToolPlugin {
/**
* Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap
*/
moduleFilenameTemplate?:
| {
[k: string]: any;
}
| string;
moduleFilenameTemplate?: Function | string;
/**
* Namespace prefix to allow multiple webpack roots in the devtools
*/

View File

@ -7,8 +7,4 @@
/**
* A list of RegExps or absolute paths to directories or files that should be ignored
*/
export type WatchIgnorePlugin = (
| string
| {
[k: string]: any;
})[];
export type WatchIgnorePluginOptions = (string | RegExp)[];

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface ProfilingPlugin {
export interface ProfilingPluginOptions {
/**
* Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface AggressiveSplittingPlugin {
export interface AggressiveSplittingPluginOptions {
/**
* Default: 0
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface LimitChunkCountPlugin {
export interface LimitChunkCountPluginOptions {
/**
* Limit the maximum number of chunks using a value greater greater than or equal to 1
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface MinChunkSizePlugin {
export interface MinChunkSizePluginOptions {
/**
* Minimum number of characters
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface OccurrenceOrderChunkIdsPlugin {
export interface OccurrenceOrderChunkIdsPluginOptions {
/**
* Prioritise initial size over total size
*/

View File

@ -4,7 +4,7 @@
* Run `yarn special-lint-fix` to update
*/
export interface OccurrenceOrderModuleIdsPlugin {
export interface OccurrenceOrderModuleIdsPluginOptions {
/**
* Prioritise initial size over total size
*/

View File

@ -1,6 +1,11 @@
{
"definitions": {
"rule": {
"BannerFunction": {
"description": "The banner as function, it will be wrapped in a comment",
"instanceof": "Function",
"tsType": "(data: { hash: string, chunk: import('../../lib/Chunk'), filename: string, basename: string, query: string}) => string"
},
"Rule": {
"oneOf": [
{
"instanceof": "RegExp"
@ -11,7 +16,7 @@
}
]
},
"rules": {
"Rules": {
"oneOf": [
{
"type": "array",
@ -19,19 +24,21 @@
"description": "A rule condition",
"anyOf": [
{
"$ref": "#/definitions/rule"
"$ref": "#/definitions/Rule"
}
]
}
},
{
"$ref": "#/definitions/rule"
"$ref": "#/definitions/Rule"
}
]
}
},
"title": "BannerPluginArgument",
"oneOf": [
{
"title": "BannerPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {
@ -39,7 +46,7 @@
"description": "Specifies the banner",
"anyOf": [
{
"instanceof": "Function"
"$ref": "#/definitions/BannerFunction"
},
{
"type": "string"
@ -54,7 +61,7 @@
"description": "Exclude all modules matching any of these conditions",
"anyOf": [
{
"$ref": "#/definitions/rules"
"$ref": "#/definitions/Rules"
}
]
},
@ -62,7 +69,7 @@
"description": "Include all modules matching any of these conditions",
"anyOf": [
{
"$ref": "#/definitions/rules"
"$ref": "#/definitions/Rules"
}
]
},
@ -74,7 +81,7 @@
"description": "Include all modules that pass test assertion",
"anyOf": [
{
"$ref": "#/definitions/rules"
"$ref": "#/definitions/Rules"
}
]
}
@ -82,8 +89,7 @@
"required": ["banner"]
},
{
"description": "The banner as function, it will be wrapped in a comment",
"instanceof": "Function"
"$ref": "#/definitions/BannerFunction"
},
{
"description": "The banner as string, it will be wrapped in a comment",

View File

@ -1,4 +1,5 @@
{
"title": "DllPluginOptions",
"additionalProperties": false,
"properties": {
"context": {

View File

@ -1,4 +1,5 @@
{
"title": "DllReferencePluginOptions",
"additionalProperties": false,
"properties": {
"content": {

View File

@ -1,7 +1,13 @@
{
"title": "HashedModuleIdsPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {
"context": {
"description": "The context directory for creating names.",
"type": "string",
"absolutePath": true
},
"hashDigest": {
"description": "The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.",
"enum": ["hex", "latin1", "base64"]

View File

@ -1,7 +1,8 @@
{
"type": "object",
"title": "IgnorePluginOptions",
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"contextRegExp": {
@ -15,15 +16,18 @@
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"checkContext": {
"description": "A filter function for context",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "((context: string) => boolean)"
},
"checkResource": {
"description": "A filter function for resource",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "((resource: string) => boolean)"
}
}
}

View File

@ -1,4 +1,5 @@
{
"title": "LoaderOptionsPluginOptions",
"type": "object",
"additionalProperties": true,
"properties": {

View File

@ -30,6 +30,7 @@
]
}
},
"title": "SourceMapDevToolPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {
@ -63,7 +64,8 @@
"oneOf": [
{
"description": "Custom function generating the identifer",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string",
@ -145,7 +147,8 @@
"oneOf": [
{
"description": "Custom function generating the identifer",
"instanceof": "Function"
"instanceof": "Function",
"tsType": "Function"
},
{
"type": "string",

View File

@ -1,4 +1,5 @@
{
"title": "WatchIgnorePluginOptions",
"description": "A list of RegExps or absolute paths to directories or files that should be ignored",
"type": "array",
"items": {
@ -8,7 +9,8 @@
"type": "string"
},
{
"instanceof": "RegExp"
"instanceof": "RegExp",
"tsType": "RegExp"
}
]
},

View File

@ -1,4 +1,5 @@
{
"title": "ProfilingPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {

View File

@ -1,4 +1,5 @@
{
"title": "AggressiveSplittingPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {

View File

@ -1,4 +1,5 @@
{
"title": "LimitChunkCountPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {

View File

@ -1,4 +1,5 @@
{
"title": "MinChunkSizePluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {

View File

@ -1,4 +1,5 @@
{
"title": "OccurrenceOrderChunkIdsPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {

View File

@ -1,4 +1,5 @@
{
"title": "OccurrenceOrderModuleIdsPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {