Merge tag 'v4.20.0' into next

4.20.0
This commit is contained in:
Tobias Koppers 2018-09-25 16:07:42 +02:00
commit 17044bf9c6
57 changed files with 2610 additions and 281 deletions

View File

@ -23,7 +23,7 @@ module.exports = {
yoda: "error", yoda: "error",
eqeqeq: "error", eqeqeq: "error",
"global-require": "off", "global-require": "off",
"brace-style": "error", "brace-style": "off",
"eol-last": "error", "eol-last": "error",
"no-extra-bind": "warn", "no-extra-bind": "warn",
"no-process-exit": "warn", "no-process-exit": "warn",

View File

@ -11,6 +11,7 @@
[![deps][deps]][deps-url] [![deps][deps]][deps-url]
[![tests][tests]][tests-url] [![tests][tests]][tests-url]
[![builds][builds]][builds-url] [![builds][builds]][builds-url]
[![builds2][builds2]][builds2-url]
[![coverage][cover]][cover-url] [![coverage][cover]][cover-url]
[![licenses][licenses]][licenses-url] [![licenses][licenses]][licenses-url]
@ -752,6 +753,9 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI"></a>
[builds-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master [builds-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master
[builds]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true [builds]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true
[builds2]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack
[builds2-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=3
[licenses-url]: https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack?ref=badge_shield [licenses-url]: https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack?ref=badge_shield
[licenses]: https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack.svg?type=shield [licenses]: https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack.svg?type=shield

View File

@ -13,21 +13,8 @@ cache:
- "..\\.yarn-cache" - "..\\.yarn-cache"
- ".jest-cache" - ".jest-cache"
# what combinations to test
environment:
matrix:
- nodejs_version: 10
job_part: unit
jest: --maxWorkers=2 --cacheDirectory .jest-cache
- nodejs_version: 10
job_part: integration
jest: --maxWorkers=2 --cacheDirectory .jest-cache
- nodejs_version: 8
job_part: integration
jest: --maxWorkers=2 --cacheDirectory .jest-cache
install: install:
- ps: Install-Product node $env:nodejs_version x64 - ps: Install-Product node 10 x64
- yarn --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache - yarn --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
- yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache || yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache - yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache || yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
- yarn link webpack --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache - yarn link webpack --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
@ -40,8 +27,8 @@ matrix:
test_script: test_script:
- node --version - node --version
- yarn --version - yarn --version
- cmd: set JEST=%jest% - cmd: set JEST=--maxWorkers=2 --cacheDirectory .jest-cache
- cmd: yarn appveyor:%job_part% - cmd: yarn appveyor:integration
- cmd: yarn istanbul report --report lcovonly - cmd: yarn istanbul report --report lcovonly
- cmd: yarn unlink webpack - cmd: yarn unlink webpack
- cmd: yarn global add codecov && codecov -F %job_part% --disable=gcov - cmd: yarn global add codecov && codecov -F %job_part% --disable=gcov

View File

@ -11,17 +11,20 @@ jobs:
curl -o- -L https://yarnpkg.com/install.sh | bash curl -o- -L https://yarnpkg.com/install.sh | bash
displayName: "Install Yarn" displayName: "Install Yarn"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v node -v
yarn -v yarn -v
displayName: "Print versions" displayName: "Print versions"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile yarn --frozen-lockfile
yarn link --frozen-lockfile || true yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile yarn link webpack --frozen-lockfile
displayName: "Install dependencies" displayName: "Install dependencies"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn test:basic --ci yarn test:basic --ci
yarn test:unit --ci yarn test:unit --ci
@ -38,17 +41,20 @@ jobs:
curl -o- -L https://yarnpkg.com/install.sh | bash curl -o- -L https://yarnpkg.com/install.sh | bash
displayName: "Install Yarn" displayName: "Install Yarn"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v node -v
yarn -v yarn -v
displayName: "Print versions" displayName: "Print versions"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile yarn --frozen-lockfile
yarn link --frozen-lockfile || true yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile yarn link webpack --frozen-lockfile
displayName: "Install dependencies" displayName: "Install dependencies"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn lint yarn lint
displayName: "Run linting" displayName: "Run linting"
@ -74,17 +80,20 @@ jobs:
curl -o- -L https://yarnpkg.com/install.sh | bash curl -o- -L https://yarnpkg.com/install.sh | bash
displayName: "Install Yarn" displayName: "Install Yarn"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v node -v
yarn -v yarn -v
displayName: "Print versions" displayName: "Print versions"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile yarn --frozen-lockfile
yarn link --frozen-lockfile || true yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile yarn link webpack --frozen-lockfile
displayName: "Install dependencies" displayName: "Install dependencies"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn cover:init yarn cover:init
yarn cover:integration "test/(?!TestCases)" --ci --maxWorkers=2 yarn cover:integration "test/(?!TestCases)" --ci --maxWorkers=2
@ -116,17 +125,20 @@ jobs:
curl -o- -L https://yarnpkg.com/install.sh | bash curl -o- -L https://yarnpkg.com/install.sh | bash
displayName: "Install Yarn" displayName: "Install Yarn"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v node -v
yarn -v yarn -v
displayName: "Print versions" displayName: "Print versions"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile yarn --frozen-lockfile
yarn link --frozen-lockfile || true yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile yarn link webpack --frozen-lockfile
displayName: "Install dependencies" displayName: "Install dependencies"
- script: | - script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn cover:init yarn cover:init
yarn cover:integration "test/(?!TestCases)" --ci yarn cover:integration "test/(?!TestCases)" --ci
@ -158,14 +170,17 @@ jobs:
npm install --global yarn npm install --global yarn
displayName: "Install Yarn" displayName: "Install Yarn"
- script: | - script: |
set -e
node -v node -v
yarn -v yarn -v
displayName: "Print versions" displayName: "Print versions"
- script: | - script: |
set -e
yarn --frozen-lockfile yarn --frozen-lockfile
yarn link --frozen-lockfile || true yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile yarn link webpack --frozen-lockfile
displayName: "Install dependencies" displayName: "Install dependencies"
- script: - script: |
set -e
yarn cover:init && yarn cover:integration "test/(?!TestCases)" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-1.json && yarn cover:integration "test/TestCasesD" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-2.json && yarn cover:integration "test/TestCases(?!D)" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-3.json yarn cover:init && yarn cover:integration "test/(?!TestCases)" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-1.json && yarn cover:integration "test/TestCasesD" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-2.json && yarn cover:integration "test/TestCases(?!D)" --ci --maxWorkers=2 && move coverage\\coverage-final.json coverage\\coverage-final-3.json
displayName: "Run tests with coverage" displayName: "Run tests with coverage"

9
declarations.d.ts vendored
View File

@ -220,6 +220,15 @@ declare module "@webassemblyjs/ast" {
export function isFuncImportDescr(n: Node): boolean; export function isFuncImportDescr(n: Node): boolean;
} }
// This "hack" is needed because typescript doesn't support recursive type definitions
// It's referenced from "ruleSet-conditions" in schemas/WebpackOptions.json
interface RuleSetConditionsRecursive
extends Array<import("./declarations/WebpackOptions").RuleSetCondition> {}
interface RuleSetConditionsAbsoluteRecursive
extends Array<
import("./declarations/WebpackOptions").RuleSetConditionAbsolute
> {}
/** /**
* Global variable declarations * Global variable declarations
* @todo Once this issue is resolved, remove these globals and add JSDoc onsite instead * @todo Once this issue is resolved, remove these globals and add JSDoc onsite instead

1386
declarations/WebpackOptions.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

51
declarations/plugins/BannerPlugin.d.ts vendored Normal file
View File

@ -0,0 +1,51 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
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 = RegExp | 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;
}

28
declarations/plugins/DllPlugin.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface DllPluginOptions {
/**
* Context of requests in the manifest file (defaults to the webpack context)
*/
context?: string;
/**
* If true, only entry points will be exposed
*/
entryOnly?: boolean;
/**
* Name of the exposed dll function (external name, use value of 'output.library')
*/
name?: string;
/**
* Absolute path to the manifest json file (output)
*/
path: string;
/**
* Type of the dll bundle (external type, use value of 'output.libraryTarget')
*/
type?: string;
}

View File

@ -0,0 +1,125 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export type DllReferencePluginOptions =
| {
/**
* (absolute path) context of requests in the manifest (or content property)
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope')
*/
extensions?: string[];
/**
* An object containing content and name or a string to the absolute path of the JSON manifest to be loaded upon compilation
*/
manifest: DllReferencePluginOptionsManifest | string;
/**
* The name where the dll is exposed (external name, defaults to manifest.name)
*/
name?: string;
/**
* Prefix which is used for accessing the content of the dll
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget, defaults to manifest.type)
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used
*/
type?: "require" | "object";
}
| {
/**
* The mappings from request to module info
*/
content: DllReferencePluginOptionsContent;
/**
* (absolute path) context of requests in the manifest (or content property)
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope')
*/
extensions?: string[];
/**
* The name where the dll is exposed (external name)
*/
name: string;
/**
* Prefix which is used for accessing the content of the dll
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget)
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used
*/
type?: "require" | "object";
};
/**
* The type how the dll is exposed (external type)
*/
export type DllReferencePluginOptionsSourceType =
| "var"
| "assign"
| "this"
| "window"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "umd"
| "umd2"
| "jsonp";
/**
* An object containing content, name and type
*/
export interface DllReferencePluginOptionsManifest {
/**
* The mappings from request to module info
*/
content: DllReferencePluginOptionsContent;
/**
* The name where the dll is exposed (external name)
*/
name?: string;
/**
* The type how the dll is exposed (external type)
*/
type?: DllReferencePluginOptionsSourceType;
}
/**
* The mappings from request to module info
*/
export interface DllReferencePluginOptionsContent {
/**
* Module info
*/
[k: string]: {
/**
* Meta information about the module
*/
buildMeta?: {
[k: string]: any;
};
/**
* Information about the provided exports of the module
*/
exports?: true | string[];
/**
* Module ID
*/
id: number | string;
};
}

View File

@ -0,0 +1,24 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
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.
*/
hashDigest?: "hex" | "latin1" | "base64";
/**
* The prefix length of the hash digest to use, defaults to 4.
*/
hashDigestLength?: number;
/**
* The hashing algorithm to use, defaults to 'md5'. All functions from Node.JS' crypto.createHash are supported.
*/
hashFunction?: string;
}

27
declarations/plugins/IgnorePlugin.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export type IgnorePluginOptions =
| {
/**
* A RegExp to test the context (directory) against
*/
contextRegExp?: RegExp;
/**
* A RegExp to test the request against
*/
resourceRegExp?: RegExp;
}
| {
/**
* A filter function for context
*/
checkContext?: ((context: string) => boolean);
/**
* A filter function for resource
*/
checkResource?: ((resource: string) => boolean);
};

View File

@ -0,0 +1,27 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface LoaderOptionsPluginOptions {
/**
* Whether loaders should be in debug mode or not. debug will be removed as of webpack 3
*/
debug?: boolean;
/**
* Where loaders can be switched to minimize mode
*/
minimize?: boolean;
/**
* A configuration object that can be used to configure older loaders
*/
options?: {
/**
* The context that can be used to configure older loaders
*/
context?: string;
[k: string]: any;
};
[k: string]: any;
}

View File

@ -0,0 +1,94 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
/**
* This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
* via the `definition` "rules".
*/
export type Rules = Rule[] | Rule;
/**
* This interface was referenced by `SourceMapDevToolPluginOptions`'s JSON-Schema
* via the `definition` "rule".
*/
export type Rule = RegExp | string;
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
*/
append?: (false | null) | string;
/**
* Indicates whether column mappings should be used (defaults to true)
*/
columns?: boolean;
/**
* Exclude modules that match the given value from source map generation
*/
exclude?: Rules;
/**
* 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?: Function | string;
/**
* Path prefix to which the [file] placeholder is relative to
*/
fileContext?: string;
/**
* Defines the output filename of the SourceMap (will be inlined if no value is provided)
*/
filename?: (false | null) | string;
/**
* Include source maps for module paths that match the given value
*/
include?: Rules;
/**
* (deprecated) try to map original files line to line to generated files
*/
lineToLine?:
| boolean
| {
/**
* Exclude modules that match the given value from source map generation
*/
exclude?: Rules;
/**
* Include source maps for module paths that match the given value
*/
include?: Rules;
/**
* Include source maps for modules based on their extension (defaults to .js and .css)
*/
test?: Rules;
};
/**
* Indicates whether SourceMaps from loaders should be used (defaults to true)
*/
module?: boolean;
/**
* Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap
*/
moduleFilenameTemplate?: Function | string;
/**
* Namespace prefix to allow multiple webpack roots in the devtools
*/
namespace?: string;
/**
* Omit the 'sourceContents' array from the SourceMap
*/
noSources?: boolean;
/**
* Provide a custom public path for the SourceMapping comment
*/
publicPath?: string;
/**
* Provide a custom value for the 'sourceRoot' property in the SourceMap
*/
sourceRoot?: string;
/**
* Include source maps for modules based on their extension (defaults to .js and .css)
*/
test?: Rules;
}

View File

@ -0,0 +1,10 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
/**
* A list of RegExps or absolute paths to directories or files that should be ignored
*/
export type WatchIgnorePluginOptions = (string | RegExp)[];

View File

@ -0,0 +1,12 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface ProfilingPluginOptions {
/**
* Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.
*/
outputPath?: string;
}

View File

@ -0,0 +1,12 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface OccurrenceChunkIdsPluginOptions {
/**
* Prioritise initial size over total size
*/
prioritiseInitial?: boolean;
}

View File

@ -0,0 +1,12 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface OccurrenceModuleIdsPluginOptions {
/**
* Prioritise initial size over total size
*/
prioritiseInitial?: boolean;
}

View File

@ -0,0 +1,24 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface AggressiveSplittingPluginOptions {
/**
* Default: 0
*/
chunkOverhead?: number;
/**
* Default: 1
*/
entryChunkMultiplicator?: number;
/**
* Byte, maxsize of per file. Default: 51200
*/
maxSize?: number;
/**
* Byte, split point. Default: 30720
*/
minSize?: number;
}

View File

@ -0,0 +1,24 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface LimitChunkCountPluginOptions {
/**
* Constant overhead for a chunk
*/
chunkOverhead?: number;
/**
* Multiplicator for initial chunks
*/
entryChunkMultiplicator?: number;
/**
* Limit the maximum number of chunks using a value greater greater than or equal to 1
*/
maxChunks?: number;
/**
* Set a minimum chunk size
*/
minChunkSize?: number;
}

View File

@ -0,0 +1,20 @@
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
export interface MinChunkSizePluginOptions {
/**
* Constant overhead for a chunk
*/
chunkOverhead?: number;
/**
* Multiplicator for initial chunks
*/
entryChunkMultiplicator?: number;
/**
* Minimum number of characters
*/
minChunkSize: number;
}

View File

@ -13,10 +13,10 @@ const Template = require("./Template");
class AmdMainTemplatePlugin { class AmdMainTemplatePlugin {
/** /**
* @param {string} name the library name * @param {string=} name the library name
*/ */
constructor(name) { constructor(name) {
/** @type {string} */ /** @type {string=} */
this.name = name; this.name = name;
} }

View File

@ -12,6 +12,8 @@ const Template = require("./Template");
const schema = require("../schemas/plugins/BannerPlugin.json"); const schema = require("../schemas/plugins/BannerPlugin.json");
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
const wrapComment = str => { const wrapComment = str => {
@ -25,7 +27,10 @@ const wrapComment = str => {
}; };
class BannerPlugin { class BannerPlugin {
constructor(options = {}) { /**
* @param {BannerPluginArgument} options options object
*/
constructor(options) {
validateOptions(schema, options, "Banner Plugin"); validateOptions(schema, options, "Banner Plugin");
if (typeof options === "string" || typeof options === "function") { if (typeof options === "string" || typeof options === "function") {
@ -36,15 +41,16 @@ class BannerPlugin {
this.options = options; this.options = options;
if (typeof options.banner === "function") { const bannerOption = options.banner;
const getBanner = this.options.banner; if (typeof bannerOption === "function") {
const getBanner = bannerOption;
this.banner = this.options.raw this.banner = this.options.raw
? getBanner ? getBanner
: data => wrapComment(getBanner(data)); : data => wrapComment(getBanner(data));
} else { } else {
const banner = this.options.raw const banner = this.options.raw
? this.options.banner ? bannerOption
: wrapComment(this.options.banner); : wrapComment(bannerOption);
this.banner = () => banner; this.banner = () => banner;
} }
} }

View File

@ -347,7 +347,8 @@ class Compilation {
this.inputFileSystem = compiler.inputFileSystem; this.inputFileSystem = compiler.inputFileSystem;
this.requestShortener = compiler.requestShortener; this.requestShortener = compiler.requestShortener;
const options = (this.options = compiler.options); const options = compiler.options;
this.options = options;
this.outputOptions = options && options.output; this.outputOptions = options && options.output;
/** @type {boolean} */ /** @type {boolean} */
this.bail = (options && options.bail) || false; this.bail = (options && options.bail) || false;
@ -1903,23 +1904,27 @@ class Compilation {
for (let i = 0; i < chunks.length; i++) { for (let i = 0; i < chunks.length; i++) {
const chunk = chunks[i]; const chunk = chunks[i];
const chunkHash = createHash(hashFunction); const chunkHash = createHash(hashFunction);
if (outputOptions.hashSalt) { try {
chunkHash.update(outputOptions.hashSalt); if (outputOptions.hashSalt) {
chunkHash.update(outputOptions.hashSalt);
}
chunk.updateHash(chunkHash, chunkGraph);
const template = chunk.hasRuntime()
? this.mainTemplate
: this.chunkTemplate;
template.updateHashForChunk(chunkHash, chunk, {
chunkGraph,
moduleGraph: this.moduleGraph,
runtimeTemplate: this.runtimeTemplate
});
this.hooks.chunkHash.call(chunk, chunkHash);
chunk.hash = chunkHash.digest(hashDigest);
hash.update(chunk.hash);
chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
this.hooks.contentHash.call(chunk);
} catch (err) {
this.errors.push(new ChunkRenderError(chunk, "", err));
} }
chunk.updateHash(chunkHash, chunkGraph);
const template = chunk.hasRuntime()
? this.mainTemplate
: this.chunkTemplate;
template.updateHashForChunk(chunkHash, chunk, {
chunkGraph,
moduleGraph: this.moduleGraph,
runtimeTemplate: this.runtimeTemplate
});
this.hooks.chunkHash.call(chunk, chunkHash);
chunk.hash = chunkHash.digest(hashDigest);
hash.update(chunk.hash);
chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
this.hooks.contentHash.call(chunk);
} }
this.fullHash = hash.digest(hashDigest); this.fullHash = hash.digest(hashDigest);
this.hash = this.fullHash.substr(0, hashDigestLength); this.hash = this.fullHash.substr(0, hashDigestLength);
@ -2056,7 +2061,7 @@ class Compilation {
} }
/** /**
* @param {string} filename used to get asset path with hash * @param {string | function(PathData): string} filename used to get asset path with hash
* @param {PathData} data context data * @param {PathData} data context data
* @returns {string} interpolated path * @returns {string} interpolated path
*/ */

View File

@ -27,6 +27,9 @@ const ConcurrentCompilationError = require("./ConcurrentCompilationError");
const RequestShortener = require("./RequestShortener"); const RequestShortener = require("./RequestShortener");
const { makePathsRelative } = require("./util/identifier"); const { makePathsRelative } = require("./util/identifier");
/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
/** /**
* @typedef {Object} CompilationParams * @typedef {Object} CompilationParams
* @property {NormalModuleFactory} normalModuleFactory * @property {NormalModuleFactory} normalModuleFactory
@ -34,16 +37,6 @@ const { makePathsRelative } = require("./util/identifier");
* @property {Set<string>} compilationDependencies * @property {Set<string>} compilationDependencies
*/ */
/** @typedef {string|string[]} EntryValues */
/** @typedef {Record<string, EntryValues>} EntryOptionValues */
/**
* @callback EntryOptionValuesFunction
* @returns {EntryOptionValues | EntryValues} the computed value
*/
/** @typedef {EntryOptionValuesFunction | EntryOptionValues | EntryValues} EntryOptions */
class Compiler { class Compiler {
constructor(context) { constructor(context) {
this.hooks = Object.freeze({ this.hooks = Object.freeze({
@ -99,7 +92,7 @@ class Compiler {
afterPlugins: new SyncHook(["compiler"]), afterPlugins: new SyncHook(["compiler"]),
/** @type {SyncHook<Compiler>} */ /** @type {SyncHook<Compiler>} */
afterResolvers: new SyncHook(["compiler"]), afterResolvers: new SyncHook(["compiler"]),
/** @type {SyncBailHook<string, EntryOptions>} */ /** @type {SyncBailHook<string, Entry>} */
entryOption: new SyncBailHook(["context", "entry"]) entryOption: new SyncBailHook(["context", "entry"])
}); });
@ -125,7 +118,8 @@ class Compiler {
/** @type {ResolverFactory} */ /** @type {ResolverFactory} */
this.resolverFactory = new ResolverFactory(); this.resolverFactory = new ResolverFactory();
this.options = {}; /** @type {WebpackOptions} */
this.options = /** @type {WebpackOptions} */ ({});
this.context = context; this.context = context;

View File

@ -12,7 +12,12 @@ const LibManifestPlugin = require("./LibManifestPlugin");
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/DllPlugin.json"); const schema = require("../schemas/plugins/DllPlugin.json");
/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */
class DllPlugin { class DllPlugin {
/**
* @param {DllPluginOptions} options options object
*/
constructor(options) { constructor(options) {
validateOptions(schema, options, "Dll Plugin"); validateOptions(schema, options, "Dll Plugin");
this.options = options; this.options = options;

View File

@ -17,7 +17,13 @@ const makePathsRelative = require("./util/identifier").makePathsRelative;
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/DllReferencePlugin.json"); const schema = require("../schemas/plugins/DllReferencePlugin.json");
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
class DllReferencePlugin { class DllReferencePlugin {
/**
* @param {DllReferencePluginOptions} options options object
*/
constructor(options) { constructor(options) {
validateOptions(schema, options, "Dll Reference Plugin"); validateOptions(schema, options, "Dll Reference Plugin");
this.options = options; this.options = options;
@ -41,55 +47,71 @@ class DllReferencePlugin {
compiler.hooks.beforeCompile.tapAsync( compiler.hooks.beforeCompile.tapAsync(
"DllReferencePlugin", "DllReferencePlugin",
(params, callback) => { (params, callback) => {
const manifest = this.options.manifest; if ("manifest" in this.options) {
if (typeof manifest === "string") { const manifest = this.options.manifest;
params.compilationDependencies.add(manifest); if (typeof manifest === "string") {
compiler.inputFileSystem.readFile(manifest, (err, result) => { params.compilationDependencies.add(manifest);
if (err) return callback(err); compiler.inputFileSystem.readFile(manifest, (err, result) => {
// Catch errors parsing the manifest so that blank if (err) return callback(err);
// or malformed manifest files don't kill the process. // Catch errors parsing the manifest so that blank
try { // or malformed manifest files don't kill the process.
params["dll reference " + manifest] = parseJson( try {
result.toString("utf-8") params["dll reference " + manifest] = parseJson(
); result.toString("utf-8")
} catch (e) { );
// Store the error in the params so that it can } catch (e) {
// be added as a compilation error later on. // Store the error in the params so that it can
const manifestPath = makePathsRelative( // be added as a compilation error later on.
compiler.options.context, const manifestPath = makePathsRelative(
manifest compiler.options.context,
); manifest
params[ );
"dll reference parse error " + manifest params[
] = new DllManifestError(manifestPath, e.message); "dll reference parse error " + manifest
} ] = new DllManifestError(manifestPath, e.message);
return callback(); }
}); return callback();
} else { });
return callback(); return;
}
} }
return callback();
} }
); );
compiler.hooks.compile.tap("DllReferencePlugin", params => { compiler.hooks.compile.tap("DllReferencePlugin", params => {
let manifest = this.options.manifest; let name = this.options.name;
if (typeof manifest === "string") { let sourceType = this.options.sourceType;
// If there was an error parsing the manifest let content =
// file, exit now because the error will be added "content" in this.options ? this.options.content : undefined;
// as a compilation error in the "compilation" hook. if ("manifest" in this.options) {
if (params["dll reference parse error " + manifest]) { let manifestParameter = this.options.manifest;
return; let manifest;
if (typeof manifestParameter === "string") {
// If there was an error parsing the manifest
// file, exit now because the error will be added
// as a compilation error in the "compilation" hook.
if (params["dll reference parse error " + manifestParameter]) {
return;
}
manifest =
/** @type {DllReferencePluginOptionsManifest} */ (params[
"dll reference " + manifestParameter
]);
} else {
manifest = manifestParameter;
}
if (manifest) {
if (!name) name = manifest.name;
if (!sourceType) sourceType = manifest.type;
if (!content) content = manifest.content;
} }
manifest = params["dll reference " + manifest];
} }
const name = this.options.name || manifest.name;
const sourceType =
this.options.sourceType || (manifest && manifest.type) || "var";
const externals = {}; const externals = {};
const source = "dll-reference " + name; const source = "dll-reference " + name;
externals[source] = name; externals[source] = name;
const normalModuleFactory = params.normalModuleFactory; const normalModuleFactory = params.normalModuleFactory;
new ExternalModuleFactoryPlugin(sourceType, externals).apply( new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply(
normalModuleFactory normalModuleFactory
); );
new DelegatedModuleFactoryPlugin({ new DelegatedModuleFactoryPlugin({
@ -97,7 +119,7 @@ class DllReferencePlugin {
type: this.options.type, type: this.options.type,
scope: this.options.scope, scope: this.options.scope,
context: this.options.context || compiler.options.context, context: this.options.context || compiler.options.context,
content: this.options.content || manifest.content, content,
extensions: this.options.extensions extensions: this.options.extensions
}).apply(normalModuleFactory); }).apply(normalModuleFactory);
}); });
@ -105,13 +127,15 @@ class DllReferencePlugin {
compiler.hooks.compilation.tap( compiler.hooks.compilation.tap(
"DllReferencePlugin", "DllReferencePlugin",
(compilation, params) => { (compilation, params) => {
let manifest = this.options.manifest; if ("manifest" in this.options) {
if (typeof manifest === "string") { let manifest = this.options.manifest;
// If there was an error parsing the manifest file, add the if (typeof manifest === "string") {
// error as a compilation error to make the compilation fail. // If there was an error parsing the manifest file, add the
let e = params["dll reference parse error " + manifest]; // error as a compilation error to make the compilation fail.
if (e) { let e = params["dll reference parse error " + manifest];
compilation.errors.push(e); if (e) {
compilation.errors.push(e);
}
} }
} }
} }

View File

@ -8,13 +8,14 @@
const EntryPlugin = require("./EntryPlugin"); const EntryPlugin = require("./EntryPlugin");
const EntryDependency = require("./dependencies/EntryDependency"); const EntryDependency = require("./dependencies/EntryDependency");
/** @typedef {import("../declarations/WebpackOptions").EntryDynamic} EntryDynamic */
/** @typedef {import("../declarations/WebpackOptions").EntryStatic} EntryStatic */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Compiler").EntryOptionValuesFunction} EntryOptionValuesFunction */
class DynamicEntryPlugin { class DynamicEntryPlugin {
/** /**
* @param {string} context the context path * @param {string} context the context path
* @param {EntryOptionValuesFunction} entry the entry value * @param {EntryDynamic} entry the entry value
*/ */
constructor(context, entry) { constructor(context, entry) {
this.context = context; this.context = context;
@ -42,7 +43,7 @@ class DynamicEntryPlugin {
/** /**
* @param {string|string[]} entry entry value or array of entry values * @param {string|string[]} entry entry value or array of entry values
* @param {string} name name of entry * @param {string} name name of entry
* @returns {Promise<void>} returns the promise resolving the Compilation#addEntry function * @returns {Promise<EntryStatic>} returns the promise resolving the Compilation#addEntry function
*/ */
const addEntry = (entry, name) => { const addEntry = (entry, name) => {
const deps = DynamicEntryPlugin.createDependencies(entry, name); const deps = DynamicEntryPlugin.createDependencies(entry, name);

View File

@ -8,6 +8,7 @@
const DynamicEntryPlugin = require("./DynamicEntryPlugin"); const DynamicEntryPlugin = require("./DynamicEntryPlugin");
const EntryPlugin = require("./EntryPlugin"); const EntryPlugin = require("./EntryPlugin");
/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
module.exports = class EntryOptionPlugin { module.exports = class EntryOptionPlugin {
@ -18,7 +19,7 @@ module.exports = class EntryOptionPlugin {
apply(compiler) { apply(compiler) {
compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => { compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => {
/** /**
* @param {string | string[]} entry entry array or single path * @param {EntryItem} entry entry array or single path
* @param {string} name entry key name * @param {string} name entry key name
* @returns {void} * @returns {void}
*/ */

View File

@ -8,15 +8,12 @@
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/IgnorePlugin.json"); const schema = require("../schemas/plugins/IgnorePlugin.json");
/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
class IgnorePlugin { class IgnorePlugin {
/** /**
* @param {object} options IgnorePlugin options * @param {IgnorePluginOptions} options IgnorePlugin options
* @param {RegExp} options.resourceRegExp - A RegExp to test the request against
* @param {RegExp} options.contextRegExp - A RegExp to test the context (directory) against
* @param {function(string): boolean=} options.checkResource - A filter function for resource
* @param {function(string): boolean=} options.checkContext - A filter function for context
*/ */
constructor(options) { constructor(options) {
// TODO webpack 5 remove this compat-layer // TODO webpack 5 remove this compat-layer
@ -40,13 +37,13 @@ class IgnorePlugin {
* and the resource given matches the regexp. * and the resource given matches the regexp.
*/ */
checkResource(resource) { checkResource(resource) {
if (this.options.checkResource) { if ("checkResource" in this.options && this.options.checkResource) {
return this.options.checkResource(resource); return this.options.checkResource(resource);
} }
if (!this.options.resourceRegExp) { if ("resourceRegExp" in this.options && this.options.resourceRegExp) {
return false; return this.options.resourceRegExp.test(resource);
} }
return this.options.resourceRegExp.test(resource); return false;
} }
/** /**
@ -55,14 +52,13 @@ class IgnorePlugin {
* or if context matches the given regexp. * or if context matches the given regexp.
*/ */
checkContext(context) { checkContext(context) {
if (this.options.checkContext) { if ("checkContext" in this.options && this.options.checkContext) {
return this.options.checkContext(context); return this.options.checkContext(context);
} }
if ("contextRegExp" in this.options && this.options.contextRegExp) {
if (!this.options.contextRegExp) { return this.options.contextRegExp.test(context);
return true;
} }
return this.options.contextRegExp.test(context); return true;
} }
/** /**

View File

@ -7,6 +7,7 @@
const SetVarMainTemplatePlugin = require("./SetVarMainTemplatePlugin"); const SetVarMainTemplatePlugin = require("./SetVarMainTemplatePlugin");
/** @typedef {import("../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
/** /**
@ -19,12 +20,17 @@ const accessorToObjectAccess = accessor => {
/** /**
* @param {string=} base the path prefix * @param {string=} base the path prefix
* @param {string|string[]} accessor the accessor * @param {string|string[]|LibraryCustomUmdObject} accessor the accessor
* @param {"amd" | "commonjs" | "root"} umdProperty property used when a custom umd object is provided
* @param {string=} joinWith the element separator * @param {string=} joinWith the element separator
* @returns {string} the path * @returns {string} the path
*/ */
const accessorAccess = (base, accessor, joinWith = "; ") => { const accessorAccess = (base, accessor, umdProperty, joinWith = "; ") => {
const accessors = Array.isArray(accessor) ? accessor : [accessor]; const normalizedAccessor =
typeof accessor === "object" ? accessor[umdProperty] : accessor;
const accessors = Array.isArray(normalizedAccessor)
? normalizedAccessor
: [normalizedAccessor];
return accessors return accessors
.map((_, idx) => { .map((_, idx) => {
const a = base const a = base
@ -41,7 +47,7 @@ const accessorAccess = (base, accessor, joinWith = "; ") => {
class LibraryTemplatePlugin { class LibraryTemplatePlugin {
/** /**
* @param {string} name name of library * @param {string|string[]|LibraryCustomUmdObject} name name of library
* @param {string} target type of library * @param {string} target type of library
* @param {boolean} umdNamedDefine setting this to true will name the UMD module * @param {boolean} umdNamedDefine setting this to true will name the UMD module
* @param {string|TODO} auxiliaryComment comment in the UMD wrapper * @param {string|TODO} auxiliaryComment comment in the UMD wrapper
@ -69,14 +75,22 @@ class LibraryTemplatePlugin {
} }
switch (this.target) { switch (this.target) {
case "var": case "var":
if (
!this.name ||
(typeof this.name === "object" && !Array.isArray(this.name))
) {
throw new Error(
"library name must be set and not an UMD custom object for non-UMD target"
);
}
new SetVarMainTemplatePlugin( new SetVarMainTemplatePlugin(
`var ${accessorAccess(undefined, this.name)}`, `var ${accessorAccess(undefined, this.name, "root")}`,
false false
).apply(compilation); ).apply(compilation);
break; break;
case "assign": case "assign":
new SetVarMainTemplatePlugin( new SetVarMainTemplatePlugin(
accessorAccess(undefined, this.name), accessorAccess(undefined, this.name, "root"),
false false
).apply(compilation); ).apply(compilation);
break; break;
@ -85,7 +99,7 @@ class LibraryTemplatePlugin {
case "window": case "window":
if (this.name) { if (this.name) {
new SetVarMainTemplatePlugin( new SetVarMainTemplatePlugin(
accessorAccess(this.target, this.name), accessorAccess(this.target, this.name, "root"),
false false
).apply(compilation); ).apply(compilation);
} else { } else {
@ -97,7 +111,8 @@ class LibraryTemplatePlugin {
new SetVarMainTemplatePlugin( new SetVarMainTemplatePlugin(
accessorAccess( accessorAccess(
compilation.runtimeTemplate.outputOptions.globalObject, compilation.runtimeTemplate.outputOptions.globalObject,
this.name this.name,
"root"
), ),
false false
).apply(compilation); ).apply(compilation);
@ -111,7 +126,7 @@ class LibraryTemplatePlugin {
case "commonjs": case "commonjs":
if (this.name) { if (this.name) {
new SetVarMainTemplatePlugin( new SetVarMainTemplatePlugin(
accessorAccess("exports", this.name), accessorAccess("exports", this.name, "commonjs"),
false false
).apply(compilation); ).apply(compilation);
} else { } else {
@ -126,7 +141,13 @@ class LibraryTemplatePlugin {
break; break;
case "amd": { case "amd": {
const AmdMainTemplatePlugin = require("./AmdMainTemplatePlugin"); const AmdMainTemplatePlugin = require("./AmdMainTemplatePlugin");
new AmdMainTemplatePlugin(this.name).apply(compilation); if (this.name) {
if (typeof this.name !== "string")
throw new Error("library name must be a string for amd target");
new AmdMainTemplatePlugin(this.name).apply(compilation);
} else {
new AmdMainTemplatePlugin().apply(compilation);
}
break; break;
} }
case "umd": case "umd":
@ -141,6 +162,8 @@ class LibraryTemplatePlugin {
} }
case "jsonp": { case "jsonp": {
const JsonpExportMainTemplatePlugin = require("./web/JsonpExportMainTemplatePlugin"); const JsonpExportMainTemplatePlugin = require("./web/JsonpExportMainTemplatePlugin");
if (typeof this.name !== "string")
throw new Error("library name must be a string for jsonp target");
new JsonpExportMainTemplatePlugin(this.name).apply(compilation); new JsonpExportMainTemplatePlugin(this.name).apply(compilation);
break; break;
} }

View File

@ -10,7 +10,12 @@ const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/LoaderOptionsPlugin.json"); const schema = require("../schemas/plugins/LoaderOptionsPlugin.json");
/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */
class LoaderOptionsPlugin { class LoaderOptionsPlugin {
/**
* @param {LoaderOptionsPluginOptions} options options object
*/
constructor(options) { constructor(options) {
validateOptions(schema, options || {}, "Loader Options Plugin"); validateOptions(schema, options || {}, "Loader Options Plugin");

View File

@ -14,6 +14,7 @@ const createHash = require("./util/createHash");
const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json"); const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json");
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
/** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Compiler")} Compiler */
@ -51,10 +52,15 @@ const getTaskForFile = (file, chunk, options, compilation) => {
}; };
class SourceMapDevToolPlugin { class SourceMapDevToolPlugin {
/**
* @param {SourceMapDevToolPluginOptions=} options options object
*/
constructor(options = {}) { constructor(options = {}) {
validateOptions(schema, options, "SourceMap DevTool Plugin"); validateOptions(schema, options, "SourceMap DevTool Plugin");
/** @type {string | false} */
this.sourceMapFilename = options.filename; this.sourceMapFilename = options.filename;
/** @type {string | false} */
this.sourceMappingURLComment = this.sourceMappingURLComment =
options.append === false options.append === false
? false ? false
@ -232,6 +238,7 @@ class SourceMapDevToolPlugin {
sourceMap.sourceRoot = options.sourceRoot || ""; sourceMap.sourceRoot = options.sourceRoot || "";
sourceMap.file = file; sourceMap.file = file;
assetsCache.set(asset, { file, assets }); assetsCache.set(asset, { file, assets });
/** @type {string | false} */
let currentSourceMappingURLComment = sourceMappingURLComment; let currentSourceMappingURLComment = sourceMappingURLComment;
if ( if (
currentSourceMappingURLComment !== false && currentSourceMappingURLComment !== false &&
@ -281,6 +288,11 @@ class SourceMapDevToolPlugin {
] = new RawSource(sourceMapString); ] = new RawSource(sourceMapString);
chunk.files.push(sourceMapFile); chunk.files.push(sourceMapFile);
} else { } else {
if (currentSourceMappingURLComment === false) {
throw new Error(
"SourceMapDevToolPlugin: append can't be false when no filename is provided"
);
}
assets[file] = compilation.assets[file] = new ConcatSource( assets[file] = compilation.assets[file] = new ConcatSource(
new RawSource(source), new RawSource(source),
currentSourceMappingURLComment currentSourceMappingURLComment

View File

@ -10,6 +10,7 @@ const ExternalModule = require("./ExternalModule");
const Template = require("./Template"); const Template = require("./Template");
/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */
/** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./Compilation")} Compilation */
@ -42,7 +43,7 @@ const accessorAccess = (base, accessor, joinWith = ", ") => {
.join(joinWith); .join(joinWith);
}; };
/** @typedef {string | string[] | Record<string, string | string[]>} UmdMainTemplatePluginName */ /** @typedef {string | string[] | LibraryCustomUmdObject} UmdMainTemplatePluginName */
/** /**
* @typedef {Object} AuxiliaryCommentObject * @typedef {Object} AuxiliaryCommentObject

View File

@ -8,6 +8,8 @@
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/WatchIgnorePlugin.json"); const schema = require("../schemas/plugins/WatchIgnorePlugin.json");
/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
class IgnoringWatchFileSystem { class IgnoringWatchFileSystem {
constructor(wfs, paths) { constructor(wfs, paths) {
this.wfs = wfs; this.wfs = wfs;
@ -83,6 +85,9 @@ class IgnoringWatchFileSystem {
} }
class WatchIgnorePlugin { class WatchIgnorePlugin {
/**
* @param {WatchIgnorePluginOptions} paths list of paths
*/
constructor(paths) { constructor(paths) {
validateOptions(schema, paths, "Watch Ignore Plugin"); validateOptions(schema, paths, "Watch Ignore Plugin");
this.paths = paths; this.paths = paths;

View File

@ -67,11 +67,19 @@ const SplitChunksPlugin = require("./optimize/SplitChunksPlugin");
const SizeLimitsPlugin = require("./performance/SizeLimitsPlugin"); const SizeLimitsPlugin = require("./performance/SizeLimitsPlugin");
const WasmFinalizeExportsPlugin = require("./wasm/WasmFinalizeExportsPlugin"); const WasmFinalizeExportsPlugin = require("./wasm/WasmFinalizeExportsPlugin");
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
/** @typedef {import("./Compiler")} Compiler */
class WebpackOptionsApply extends OptionsApply { class WebpackOptionsApply extends OptionsApply {
constructor() { constructor() {
super(); super();
} }
/**
* @param {WebpackOptions} options options object
* @param {Compiler} compiler compiler object
* @returns {WebpackOptions} options object
*/
process(options, compiler) { process(options, compiler) {
let ExternalsPlugin; let ExternalsPlugin;
compiler.outputPath = options.output.path; compiler.outputPath = options.output.path;
@ -79,6 +87,8 @@ class WebpackOptionsApply extends OptionsApply {
compiler.recordsOutputPath = compiler.recordsOutputPath =
options.recordsOutputPath || options.recordsPath; options.recordsOutputPath || options.recordsPath;
compiler.name = options.name; compiler.name = options.name;
// TODO webpack 5 refactor this to MultiCompiler.setDependencies() with a WeakMap
// @ts-ignore TODO
compiler.dependencies = options.dependencies; compiler.dependencies = options.dependencies;
if (typeof options.target === "string") { if (typeof options.target === "string") {
let JsonpTemplatePlugin; let JsonpTemplatePlugin;
@ -205,7 +215,9 @@ class WebpackOptionsApply extends OptionsApply {
default: default:
throw new Error("Unsupported target '" + options.target + "'."); throw new Error("Unsupported target '" + options.target + "'.");
} }
} else if (options.target !== false) { }
// @ts-ignore This is always true, which is good this way
else if (options.target !== false) {
options.target(compiler); options.target(compiler);
} else { } else {
throw new Error("Unsupported target '" + options.target + "'."); throw new Error("Unsupported target '" + options.target + "'.");
@ -424,7 +436,11 @@ class WebpackOptionsApply extends OptionsApply {
} }
if (options.optimization.minimize) { if (options.optimization.minimize) {
for (const minimizer of options.optimization.minimizer) { for (const minimizer of options.optimization.minimizer) {
minimizer.apply(compiler); if (typeof minimizer === "function") {
minimizer.apply(compiler);
} else {
minimizer.apply(compiler);
}
} }
} }

View File

@ -4,10 +4,13 @@
"use strict"; "use strict";
const fs = require("fs");
const { Tracer } = require("chrome-trace-event"); const { Tracer } = require("chrome-trace-event");
const fs = require("fs");
const validateOptions = require("schema-utils"); const validateOptions = require("schema-utils");
const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json"); const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */
let inspector = undefined; let inspector = undefined;
try { try {
@ -151,6 +154,9 @@ const createTrace = outputPath => {
const pluginName = "ProfilingPlugin"; const pluginName = "ProfilingPlugin";
class ProfilingPlugin { class ProfilingPlugin {
/**
* @param {ProfilingPluginOptions=} opts options object
*/
constructor(opts) { constructor(opts) {
validateOptions(schema, opts || {}, "Profiling plugin"); validateOptions(schema, opts || {}, "Profiling plugin");
opts = opts || {}; opts = opts || {};

View File

@ -67,7 +67,7 @@ class ImportParserPlugin {
) )
); );
} else { } else {
// Do not instrument `import()` is `webpackIgnore` is `true` // Do not instrument `import()` if `webpackIgnore` is `true`
if (importOptions.webpackIgnore) { if (importOptions.webpackIgnore) {
return false; return false;
} }

View File

@ -12,10 +12,16 @@ const {
} = require("../util/comparators"); } = require("../util/comparators");
const createHash = require("../util/createHash"); const createHash = require("../util/createHash");
/** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */
class HashedModuleIdsPlugin { class HashedModuleIdsPlugin {
constructor(options) { /**
* @param {HashedModuleIdsPluginOptions=} options options object
*/
constructor(options = {}) {
validateOptions(schema, options || {}, "Hashed Module Ids Plugin"); validateOptions(schema, options || {}, "Hashed Module Ids Plugin");
/** @type {HashedModuleIdsPluginOptions} */
this.options = Object.assign( this.options = Object.assign(
{ {
context: null, context: null,

View File

@ -14,11 +14,15 @@ const {
} = require("../util/comparators"); } = require("../util/comparators");
const assignAscendingChunkIds = require("./assignAscendingChunkIds"); const assignAscendingChunkIds = require("./assignAscendingChunkIds");
/** @typedef {import("../../declarations/plugins/ids/OccurrenceChunkIdsPlugin").OccurrenceChunkIdsPluginOptions} OccurrenceChunkIdsPluginOptions */
/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */ /** @typedef {import("../Module")} Module */
class OccurrenceChunkIdsPlugin { class OccurrenceChunkIdsPlugin {
/**
* @param {OccurrenceChunkIdsPluginOptions=} options options object
*/
constructor(options = {}) { constructor(options = {}) {
validateOptions(schema, options, "Occurrence Order Chunk Ids Plugin"); validateOptions(schema, options, "Occurrence Order Chunk Ids Plugin");
this.options = options; this.options = options;

View File

@ -12,10 +12,14 @@ const {
} = require("../util/comparators"); } = require("../util/comparators");
const assignAscendingModuleIds = require("./assignAscendingModuleIds"); const assignAscendingModuleIds = require("./assignAscendingModuleIds");
/** @typedef {import("../../declarations/plugins/ids/OccurrenceModuleIdsPlugin").OccurrenceModuleIdsPluginOptions} OccurrenceModuleIdsPluginOptions */
/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
class OccurrenceModuleIdsPlugin { class OccurrenceModuleIdsPlugin {
/**
* @param {OccurrenceModuleIdsPluginOptions=} options options object
*/
constructor(options = {}) { constructor(options = {}) {
validateOptions(schema, options, "Occurrence Order Module Ids Plugin"); validateOptions(schema, options, "Occurrence Order Module Ids Plugin");
this.options = options; this.options = options;

View File

@ -16,6 +16,7 @@ const {
} = require("../util/comparators"); } = require("../util/comparators");
const identifierUtils = require("../util/identifier"); const identifierUtils = require("../util/identifier");
/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */
/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Compiler")} Compiler */
@ -45,10 +46,13 @@ const isNotAEntryModule = (chunkGraph, chunk) => {
const recordedChunks = new WeakSet(); const recordedChunks = new WeakSet();
class AggressiveSplittingPlugin { class AggressiveSplittingPlugin {
constructor(options) { /**
validateOptions(schema, options || {}, "Aggressive Splitting Plugin"); * @param {AggressiveSplittingPluginOptions=} options options object
*/
constructor(options = {}) {
validateOptions(schema, options, "Aggressive Splitting Plugin");
this.options = options || {}; this.options = options;
if (typeof this.options.minSize !== "number") { if (typeof this.options.minSize !== "number") {
this.options.minSize = 30 * 1024; this.options.minSize = 30 * 1024;
} }

View File

@ -12,10 +12,15 @@ const { STAGE_ADVANCED } = require("../OptimizationStages");
/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */
class LimitChunkCountPlugin { class LimitChunkCountPlugin {
constructor(options) { /**
validateOptions(schema, options || {}, "Limit Chunk Count Plugin"); * @param {LimitChunkCountPluginOptions=} options options object
this.options = options || {}; */
constructor(options = {}) {
validateOptions(schema, options, "Limit Chunk Count Plugin");
this.options = options;
} }
/** /**

View File

@ -12,7 +12,12 @@ const { STAGE_ADVANCED } = require("../OptimizationStages");
/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */
class MinChunkSizePlugin { class MinChunkSizePlugin {
/**
* @param {MinChunkSizePluginOptions} options options object
*/
constructor(options) { constructor(options) {
validateOptions(schema, options, "Min Chunk Size Plugin"); validateOptions(schema, options, "Min Chunk Size Plugin");
this.options = options; this.options = options;

View File

@ -8,6 +8,9 @@
const { ConcatSource } = require("webpack-sources"); const { ConcatSource } = require("webpack-sources");
class JsonpExportMainTemplatePlugin { class JsonpExportMainTemplatePlugin {
/**
* @param {string} name jsonp function name
*/
constructor(name) { constructor(name) {
this.name = name; this.name = name;
} }

View File

@ -16,6 +16,13 @@ const WebpackOptionsValidationError = require("./WebpackOptionsValidationError")
const NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin"); const NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin");
const validateSchema = require("./validateSchema"); const validateSchema = require("./validateSchema");
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
/**
* @param {WebpackOptions} options options object
* @param {function(Error=, Stats=): void=} callback callback
* @returns {Compiler | MultiCompiler} the compiler object
*/
const webpack = (options, callback) => { const webpack = (options, callback) => {
const webpackOptionsValidationErrors = validateSchema( const webpackOptionsValidationErrors = validateSchema(
webpackOptionsSchema, webpackOptionsSchema,
@ -35,7 +42,11 @@ const webpack = (options, callback) => {
new NodeEnvironmentPlugin().apply(compiler); new NodeEnvironmentPlugin().apply(compiler);
if (options.plugins && Array.isArray(options.plugins)) { if (options.plugins && Array.isArray(options.plugins)) {
for (const plugin of options.plugins) { for (const plugin of options.plugins) {
plugin.apply(compiler); if (typeof plugin === "function") {
plugin.apply(compiler);
} else {
plugin.apply(compiler);
}
} }
} }
compiler.hooks.environment.call(); compiler.hooks.environment.call();

View File

@ -5,10 +5,10 @@
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@webassemblyjs/ast": "1.7.6", "@webassemblyjs/ast": "1.7.8",
"@webassemblyjs/helper-module-context": "1.7.6", "@webassemblyjs/helper-module-context": "1.7.8",
"@webassemblyjs/wasm-edit": "1.7.6", "@webassemblyjs/wasm-edit": "1.7.8",
"@webassemblyjs/wasm-parser": "1.7.6", "@webassemblyjs/wasm-parser": "1.7.8",
"acorn": "^5.6.2", "acorn": "^5.6.2",
"acorn-dynamic-import": "^3.0.0", "acorn-dynamic-import": "^3.0.0",
"ajv": "^6.1.0", "ajv": "^6.1.0",
@ -29,7 +29,7 @@
"tapable": "^1.1.0", "tapable": "^1.1.0",
"terser-webpack-plugin": "^1.1.0", "terser-webpack-plugin": "^1.1.0",
"watchpack": "^1.5.0", "watchpack": "^1.5.0",
"webpack-sources": "^1.2.0" "webpack-sources": "^1.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^9.6.4", "@types/node": "^9.6.4",
@ -55,6 +55,7 @@
"jest": "^23.4.1", "jest": "^23.4.1",
"jest-silent-reporter": "^0.0.5", "jest-silent-reporter": "^0.0.5",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"json-schema-to-typescript": "^6.0.1",
"less": "^2.5.1", "less": "^2.5.1",
"less-loader": "^4.0.3", "less-loader": "^4.0.3",
"lint-staged": "^7.2.0", "lint-staged": "^7.2.0",
@ -115,8 +116,8 @@
"lint": "yarn code-lint && yarn schema-lint && yarn type-lint && yarn special-lint", "lint": "yarn code-lint && yarn schema-lint && yarn type-lint && yarn special-lint",
"code-lint": "eslint --cache \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"", "code-lint": "eslint --cache \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"type-lint": "tsc --pretty", "type-lint": "tsc --pretty",
"special-lint": "node tooling/inherit-types && node tooling/format-schemas && node tooling/format-file-header", "special-lint": "node tooling/inherit-types && node tooling/format-schemas && node tooling/format-file-header && node tooling/compile-to-definitions",
"special-lint-fix": "node tooling/inherit-types --write --override && node tooling/format-schemas --write && node tooling/format-file-header --write", "special-lint-fix": "node tooling/inherit-types --write --override && node tooling/format-schemas --write && node tooling/format-file-header --write && node tooling/compile-to-definitions --write",
"fix": "yarn code-lint --fix && yarn special-lint-fix", "fix": "yarn code-lint --fix && yarn special-lint-fix",
"pretty": "prettier --loglevel warn --write \"*.{ts,js,json}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"", "pretty": "prettier --loglevel warn --write \"*.{ts,js,json}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose", "schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",

View File

@ -909,16 +909,8 @@
}, },
"hotUpdateChunkFilename": { "hotUpdateChunkFilename": {
"description": "The filename of the Hot Update Chunks. They are inside the output.path directory.", "description": "The filename of the Hot Update Chunks. They are inside the output.path directory.",
"anyOf": [ "type": "string",
{ "absolutePath": false
"type": "string",
"absolutePath": false
},
{
"instanceof": "Function",
"tsType": "Function"
}
]
}, },
"hotUpdateFunction": { "hotUpdateFunction": {
"description": "The JSONP function used by webpack for async loading of hot update chunks.", "description": "The JSONP function used by webpack for async loading of hot update chunks.",
@ -926,16 +918,8 @@
}, },
"hotUpdateMainFilename": { "hotUpdateMainFilename": {
"description": "The filename of the Hot Update Main File. It is inside the `output.path` directory.", "description": "The filename of the Hot Update Main File. It is inside the `output.path` directory.",
"anyOf": [ "type": "string",
{ "absolutePath": false
"type": "string",
"absolutePath": false
},
{
"instanceof": "Function",
"tsType": "Function"
}
]
}, },
"jsonpFunction": { "jsonpFunction": {
"description": "The JSONP function used by webpack for async loading of chunks.", "description": "The JSONP function used by webpack for async loading of chunks.",

View File

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

View File

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

View File

@ -3,6 +3,14 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"chunkOverhead": {
"description": "Constant overhead for a chunk",
"type": "number"
},
"entryChunkMultiplicator": {
"description": "Multiplicator for initial chunks",
"type": "number"
},
"maxChunks": { "maxChunks": {
"description": "Limit the maximum number of chunks using a value greater greater than or equal to 1", "description": "Limit the maximum number of chunks using a value greater greater than or equal to 1",
"type": "number", "type": "number",

View File

@ -3,6 +3,14 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"chunkOverhead": {
"description": "Constant overhead for a chunk",
"type": "number"
},
"entryChunkMultiplicator": {
"description": "Multiplicator for initial chunks",
"type": "number"
},
"minChunkSize": { "minChunkSize": {
"description": "Minimum number of characters", "description": "Minimum number of characters",
"type": "number" "type": "number"

View File

@ -0,0 +1,4 @@
module.exports = [
[/Test exception/],
[/Test exception/]
];

View File

@ -0,0 +1,3 @@
it("should not crash when renderer throws exception", function(done) {
done();
});

View File

@ -0,0 +1,16 @@
class ThrowsExceptionInRender {
apply(compiler) {
compiler.hooks.compilation.tap("ThrowsException", compilation => {
compilation.mainTemplate.hooks.requireExtensions.tap(
"ThrowsException",
() => {
throw new Error("Test exception");
}
);
});
}
}
module.exports = {
plugins: [new ThrowsExceptionInRender()]
};

View File

@ -0,0 +1,79 @@
const fs = require("fs");
const path = require("path");
const mkdirp = require("mkdirp");
const prettierrc = require("../.prettierrc.js"); // eslint-disable-line
const { compileFromFile } = require("json-schema-to-typescript");
const schemasDir = path.resolve(__dirname, "../schemas");
const style = {
printWidth: prettierrc.printWidth,
useTabs: prettierrc.useTabs,
tabWidth: prettierrc.tabWidth
};
// When --write is set, files will be written in place
// Elsewise it only prints outdated files
const doWrite = process.argv.includes("--write");
const makeSchemas = () => {
// include the top level folder "./schemas" by default
const dirs = new Set([schemasDir]);
// search for all nestedDirs inside of this folder
for (let dirWithSchemas of dirs) {
for (let item of fs.readdirSync(dirWithSchemas)) {
const absPath = path.resolve(dirWithSchemas, item);
if (fs.statSync(absPath).isDirectory()) {
dirs.add(absPath);
} else if (item.endsWith(".json")) {
makeDefinitionsForSchema(absPath);
}
}
}
};
const makeDefinitionsForSchema = absSchemaPath => {
const basename = path
.relative(schemasDir, absSchemaPath)
.replace(/\.json$/i, "");
const filename = path.resolve(__dirname, `../declarations/${basename}.d.ts`);
compileFromFile(absSchemaPath, {
bannerComment:
"/**\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `yarn special-lint-fix` to update\n */",
unreachableDefinitions: true,
style
}).then(
ts => {
let normalizedContent = "";
try {
const content = fs.readFileSync(filename, "utf-8");
normalizedContent = content.replace(/\r\n?/g, "\n");
} catch (e) {
// ignore
}
if (normalizedContent.trim() !== ts.trim()) {
if (doWrite) {
mkdirp.sync(path.dirname(filename));
fs.writeFileSync(filename, ts, "utf-8");
console.error(
`declarations/${basename.replace(/\\/g, "/")}.d.ts updated`
);
} else {
console.error(
`declarations/${basename.replace(
/\\/g,
"/"
)}.d.ts need to be updated`
);
process.exitCode = 1;
}
}
},
err => {
console.error(err);
process.exitCode = 1;
}
);
};
makeSchemas();

View File

@ -12,5 +12,11 @@
"types": ["node"], "types": ["node"],
"esModuleInterop": true "esModuleInterop": true
}, },
"include": ["declarations.d.ts", "bin/*.js", "lib/**/*.js", "tooling/**/*.js"] "include": [
"declarations.d.ts",
"declarations/*.d.ts",
"bin/*.js",
"lib/**/*.js",
"tooling/**/*.js"
]
} }

405
yarn.lock
View File

@ -32,14 +32,44 @@
dependencies: dependencies:
"@types/babel-types" "*" "@types/babel-types" "*"
"@types/cli-color@^0.3.29":
version "0.3.29"
resolved "https://registry.yarnpkg.com/@types/cli-color/-/cli-color-0.3.29.tgz#c83a71fe02c8c7e1ccec048dd6a2458d1f6c96ea"
"@types/json-schema@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.0.tgz#5a2b780fec9f2cf851e1b5e0a29a4cac6c9686c5"
"@types/lodash@^4.14.116":
version "4.14.116"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.116.tgz#5ccf215653e3e8c786a58390751033a9adca0eb9"
"@types/minimist@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
"@types/mz@0.0.32":
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/mz/-/mz-0.0.32.tgz#e8248b4e41424c052edc1725dd33650c313a3659"
dependencies:
"@types/node" "*"
"@types/node@*": "@types/node@*":
version "10.5.1" version "10.5.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.1.tgz#d578446f4abff5c0b49ade9b4e5274f6badaadfc" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.1.tgz#d578446f4abff5c0b49ade9b4e5274f6badaadfc"
"@types/node@^10.9.4":
version "10.10.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.10.1.tgz#d5c96ca246a418404914d180b7fdd625ad18eca6"
"@types/node@^9.6.4": "@types/node@^9.6.4":
version "9.6.30" version "9.6.30"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.30.tgz#1ecf83eaf7ac2d0dada7a9d61a1e4e7a6183ac06" resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.30.tgz#1ecf83eaf7ac2d0dada7a9d61a1e4e7a6183ac06"
"@types/prettier@^1.13.2":
version "1.13.2"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.13.2.tgz#ffe96278e712a8d4e467e367a338b05e22872646"
"@types/source-list-map@*": "@types/source-list-map@*":
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
@ -56,133 +86,129 @@
"@types/source-list-map" "*" "@types/source-list-map" "*"
source-map "^0.6.1" source-map "^0.6.1"
"@webassemblyjs/ast@1.7.6": "@webassemblyjs/ast@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.6.tgz#3ef8c45b3e5e943a153a05281317474fef63e21e" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.8.tgz#f31f480debeef957f01b623f27eabc695fa4fe8f"
dependencies: dependencies:
"@webassemblyjs/helper-module-context" "1.7.6" "@webassemblyjs/helper-module-context" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode" "1.7.6" "@webassemblyjs/helper-wasm-bytecode" "1.7.8"
"@webassemblyjs/wast-parser" "1.7.6" "@webassemblyjs/wast-parser" "1.7.8"
mamacro "^0.0.3"
"@webassemblyjs/floating-point-hex-parser@1.7.6": "@webassemblyjs/floating-point-hex-parser@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.6.tgz#7cb37d51a05c3fe09b464ae7e711d1ab3837801f" resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.8.tgz#1b3ed0e27e384032254e9322fc646dd3e70ef1b9"
"@webassemblyjs/helper-api-error@1.7.6": "@webassemblyjs/helper-api-error@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.6.tgz#99b7e30e66f550a2638299a109dda84a622070ef" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.8.tgz#a2b49c11f615e736f815ec927f035dcfa690d572"
"@webassemblyjs/helper-buffer@1.7.6": "@webassemblyjs/helper-buffer@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.6.tgz#ba0648be12bbe560c25c997e175c2018df39ca3e" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.8.tgz#3fc66bfa09c1c60e824cf3d5887826fac062877d"
"@webassemblyjs/helper-code-frame@1.7.6": "@webassemblyjs/helper-code-frame@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.6.tgz#5a94d21b0057b69a7403fca0c253c3aaca95b1a5" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.8.tgz#cc5a7e9522b70e7580df056dfd34020cf29645b0"
dependencies: dependencies:
"@webassemblyjs/wast-printer" "1.7.6" "@webassemblyjs/wast-printer" "1.7.8"
"@webassemblyjs/helper-fsm@1.7.6": "@webassemblyjs/helper-fsm@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.6.tgz#ae1741c6f6121213c7a0b587fb964fac492d3e49" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.8.tgz#fe4607430af466912797c21acafd3046080182ea"
"@webassemblyjs/helper-module-context@1.7.6": "@webassemblyjs/helper-module-context@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.6.tgz#116d19a51a6cebc8900ad53ca34ff8269c668c23" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.8.tgz#3c2e7ee93d14ff4768ba66fb1be42fdc9dc7160a"
"@webassemblyjs/helper-wasm-bytecode@1.7.8":
version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.8.tgz#89bdb78cd6dd5209ae2ed2925de78d0f0e00b6f0"
"@webassemblyjs/helper-wasm-section@1.7.8":
version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.8.tgz#c68ef7d26a6fc12421b2e6e56f9bc810dfb33e87"
dependencies: dependencies:
mamacro "^0.0.3" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/helper-buffer" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode" "1.7.8"
"@webassemblyjs/wasm-gen" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode@1.7.6": "@webassemblyjs/ieee754@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.6.tgz#98e515eaee611aa6834eb5f6a7f8f5b29fefb6f1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.7.8.tgz#1f37974b13cb486a9237e73ce04cac7a2f1265ed"
"@webassemblyjs/helper-wasm-section@1.7.6":
version "1.7.6"
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.6.tgz#783835867bdd686df7a95377ab64f51a275e8333"
dependencies:
"@webassemblyjs/ast" "1.7.6"
"@webassemblyjs/helper-buffer" "1.7.6"
"@webassemblyjs/helper-wasm-bytecode" "1.7.6"
"@webassemblyjs/wasm-gen" "1.7.6"
"@webassemblyjs/ieee754@1.7.6":
version "1.7.6"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.7.6.tgz#c34fc058f2f831fae0632a8bb9803cf2d3462eb1"
dependencies: dependencies:
"@xtuc/ieee754" "^1.2.0" "@xtuc/ieee754" "^1.2.0"
"@webassemblyjs/leb128@1.7.6": "@webassemblyjs/leb128@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.7.6.tgz#197f75376a29f6ed6ace15898a310d871d92f03b" resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.7.8.tgz#1bee83426819192db2ea1a234b84c7ebc6d34c1f"
dependencies: dependencies:
"@xtuc/long" "4.2.1" "@xtuc/long" "4.2.1"
"@webassemblyjs/utf8@1.7.6": "@webassemblyjs/utf8@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.7.6.tgz#eb62c66f906af2be70de0302e29055d25188797d" resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.7.8.tgz#2b489d5cf43e0aebb93d8e2d792aff9879c61f05"
"@webassemblyjs/wasm-edit@1.7.6": "@webassemblyjs/wasm-edit@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.6.tgz#fa41929160cd7d676d4c28ecef420eed5b3733c5" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.8.tgz#f8bdbe7088718eca27b1c349bb7c06b8a457950c"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/helper-buffer" "1.7.6" "@webassemblyjs/helper-buffer" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode" "1.7.6" "@webassemblyjs/helper-wasm-bytecode" "1.7.8"
"@webassemblyjs/helper-wasm-section" "1.7.6" "@webassemblyjs/helper-wasm-section" "1.7.8"
"@webassemblyjs/wasm-gen" "1.7.6" "@webassemblyjs/wasm-gen" "1.7.8"
"@webassemblyjs/wasm-opt" "1.7.6" "@webassemblyjs/wasm-opt" "1.7.8"
"@webassemblyjs/wasm-parser" "1.7.6" "@webassemblyjs/wasm-parser" "1.7.8"
"@webassemblyjs/wast-printer" "1.7.6" "@webassemblyjs/wast-printer" "1.7.8"
"@webassemblyjs/wasm-gen@1.7.6": "@webassemblyjs/wasm-gen@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.6.tgz#695ac38861ab3d72bf763c8c75e5f087ffabc322" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.8.tgz#7e8abf1545eae74ac6781d545c034af3cfd0c7d5"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode" "1.7.6" "@webassemblyjs/helper-wasm-bytecode" "1.7.8"
"@webassemblyjs/ieee754" "1.7.6" "@webassemblyjs/ieee754" "1.7.8"
"@webassemblyjs/leb128" "1.7.6" "@webassemblyjs/leb128" "1.7.8"
"@webassemblyjs/utf8" "1.7.6" "@webassemblyjs/utf8" "1.7.8"
"@webassemblyjs/wasm-opt@1.7.6": "@webassemblyjs/wasm-opt@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.6.tgz#fbafa78e27e1a75ab759a4b658ff3d50b4636c21" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.8.tgz#7ada6e211914728fce02ff0ff9c344edc6d41f26"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/helper-buffer" "1.7.6" "@webassemblyjs/helper-buffer" "1.7.8"
"@webassemblyjs/wasm-gen" "1.7.6" "@webassemblyjs/wasm-gen" "1.7.8"
"@webassemblyjs/wasm-parser" "1.7.6" "@webassemblyjs/wasm-parser" "1.7.8"
"@webassemblyjs/wasm-parser@1.7.6": "@webassemblyjs/wasm-parser@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.6.tgz#84eafeeff405ad6f4c4b5777d6a28ae54eed51fe" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.8.tgz#dac47c291fb6a3e63529aecd647592cd34afbf94"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/helper-api-error" "1.7.6" "@webassemblyjs/helper-api-error" "1.7.8"
"@webassemblyjs/helper-wasm-bytecode" "1.7.6" "@webassemblyjs/helper-wasm-bytecode" "1.7.8"
"@webassemblyjs/ieee754" "1.7.6" "@webassemblyjs/ieee754" "1.7.8"
"@webassemblyjs/leb128" "1.7.6" "@webassemblyjs/leb128" "1.7.8"
"@webassemblyjs/utf8" "1.7.6" "@webassemblyjs/utf8" "1.7.8"
"@webassemblyjs/wast-parser@1.7.6": "@webassemblyjs/wast-parser@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.7.6.tgz#ca4d20b1516e017c91981773bd7e819d6bd9c6a7" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.7.8.tgz#f8aab9a450c048c1f9537695c89faeb92fabfba5"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/floating-point-hex-parser" "1.7.6" "@webassemblyjs/floating-point-hex-parser" "1.7.8"
"@webassemblyjs/helper-api-error" "1.7.6" "@webassemblyjs/helper-api-error" "1.7.8"
"@webassemblyjs/helper-code-frame" "1.7.6" "@webassemblyjs/helper-code-frame" "1.7.8"
"@webassemblyjs/helper-fsm" "1.7.6" "@webassemblyjs/helper-fsm" "1.7.8"
"@xtuc/long" "4.2.1" "@xtuc/long" "4.2.1"
mamacro "^0.0.3"
"@webassemblyjs/wast-printer@1.7.6": "@webassemblyjs/wast-printer@1.7.8":
version "1.7.6" version "1.7.8"
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.7.6.tgz#a6002c526ac5fa230fe2c6d2f1bdbf4aead43a5e" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.7.8.tgz#e7e965782c1912f6a965f14a53ff43d8ad0403a5"
dependencies: dependencies:
"@webassemblyjs/ast" "1.7.6" "@webassemblyjs/ast" "1.7.8"
"@webassemblyjs/wast-parser" "1.7.6" "@webassemblyjs/wast-parser" "1.7.8"
"@xtuc/long" "4.2.1" "@xtuc/long" "4.2.1"
"@xtuc/ieee754@^1.2.0": "@xtuc/ieee754@^1.2.0":
@ -302,7 +328,7 @@ ansi-escapes@^3.0.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30"
ansi-regex@^2.0.0: ansi-regex@^2.0.0, ansi-regex@^2.1.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@ -324,6 +350,10 @@ any-observable@^0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b"
any-promise@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
anymatch@^2.0.0: anymatch@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
@ -865,6 +895,10 @@ cache-base@^1.0.1:
union-value "^1.0.0" union-value "^1.0.0"
unset-value "^1.0.0" unset-value "^1.0.0"
call-me-maybe@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"
caller-path@^0.1.0: caller-path@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
@ -1021,6 +1055,17 @@ clean-css@^4.1.11:
dependencies: dependencies:
source-map "0.5.x" source-map "0.5.x"
cli-color@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.3.0.tgz#cd2ec212efbd1a0eeb5b017f17d4e2d15e91420f"
dependencies:
ansi-regex "^2.1.1"
d "1"
es5-ext "^0.10.46"
es6-iterator "^2.0.3"
memoizee "^0.4.14"
timers-ext "^0.1.5"
cli-cursor@^1.0.2: cli-cursor@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987"
@ -1451,6 +1496,12 @@ cyclist@~0.2.2:
version "0.2.2" version "0.2.2"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"
d@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
dependencies:
es5-ext "^0.10.9"
dashdash@^1.12.0: dashdash@^1.12.0:
version "1.14.1" version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@ -1708,10 +1759,42 @@ es-to-primitive@^1.1.1:
is-date-object "^1.0.1" is-date-object "^1.0.1"
is-symbol "^1.0.1" is-symbol "^1.0.1"
es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@^0.10.9, es5-ext@~0.10.14, es5-ext@~0.10.2:
version "0.10.46"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.46.tgz#efd99f67c5a7ec789baa3daa7f79870388f7f572"
dependencies:
es6-iterator "~2.0.3"
es6-symbol "~3.1.1"
next-tick "1"
es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7"
dependencies:
d "1"
es5-ext "^0.10.35"
es6-symbol "^3.1.1"
es6-promise-polyfill@^1.1.1: es6-promise-polyfill@^1.1.1:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/es6-promise-polyfill/-/es6-promise-polyfill-1.2.0.tgz#f38925f23cb3e3e8ce6cda8ff774fcebbb090cde" resolved "https://registry.yarnpkg.com/es6-promise-polyfill/-/es6-promise-polyfill-1.2.0.tgz#f38925f23cb3e3e8ce6cda8ff774fcebbb090cde"
es6-symbol@^3.1.1, es6-symbol@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
dependencies:
d "1"
es5-ext "~0.10.14"
es6-weak-map@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f"
dependencies:
d "1"
es5-ext "^0.10.14"
es6-iterator "^2.0.1"
es6-symbol "^3.1.1"
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@ -1874,6 +1957,13 @@ esutils@^2.0.2:
version "2.0.2" version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
event-emitter@^0.3.5:
version "0.3.5"
resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39"
dependencies:
d "1"
es5-ext "~0.10.14"
events@^1.0.0: events@^1.0.0:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
@ -2198,6 +2288,10 @@ form-data@~2.3.1:
combined-stream "1.0.6" combined-stream "1.0.6"
mime-types "^2.1.12" mime-types "^2.1.12"
format-util@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.3.tgz#032dca4a116262a12c43f4c3ec8566416c5b2d95"
fragment-cache@^0.2.1: fragment-cache@^0.2.1:
version "0.2.1" version "0.2.1"
resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19"
@ -2925,7 +3019,7 @@ is-primitive@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
is-promise@^2.0.0, is-promise@^2.1.0: is-promise@^2.0.0, is-promise@^2.1, is-promise@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
@ -3450,7 +3544,7 @@ js-yaml@3.x, js-yaml@^3.9.0:
argparse "^1.0.7" argparse "^1.0.7"
esprima "^4.0.0" esprima "^4.0.0"
js-yaml@^3.11.0, js-yaml@^3.7.0: js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.7.0:
version "3.12.0" version "3.12.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
dependencies: dependencies:
@ -3515,6 +3609,35 @@ json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
json-schema-ref-parser@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/json-schema-ref-parser/-/json-schema-ref-parser-5.1.3.tgz#f86c5868f40898e69169e1bbc854725a4fd0e1ad"
dependencies:
call-me-maybe "^1.0.1"
debug "^3.1.0"
js-yaml "^3.12.0"
ono "^4.0.6"
json-schema-to-typescript@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/json-schema-to-typescript/-/json-schema-to-typescript-6.0.1.tgz#31baac45a124b586d4021d12a5ea0ec07fddf294"
dependencies:
"@types/cli-color" "^0.3.29"
"@types/json-schema" "^7.0.0"
"@types/lodash" "^4.14.116"
"@types/minimist" "^1.2.0"
"@types/mz" "0.0.32"
"@types/node" "^10.9.4"
"@types/prettier" "^1.13.2"
cli-color "^1.3.0"
json-schema-ref-parser "^5.1.3"
json-stringify-safe "^5.0.1"
lodash "^4.17.11"
minimist "^1.2.0"
mz "^2.7.0"
prettier "^1.14.2"
stdin "0.0.1"
json-schema-traverse@^0.3.0: json-schema-traverse@^0.3.0:
version "0.3.1" version "0.3.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
@ -3537,7 +3660,7 @@ json-stable-stringify@^1.0.1:
dependencies: dependencies:
jsonify "~0.0.0" jsonify "~0.0.0"
json-stringify-safe@~5.0.1: json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
@ -3787,6 +3910,10 @@ lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.10" version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
lodash@^4.17.11:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
log-driver@1.2.5: log-driver@1.2.5:
version "1.2.5" version "1.2.5"
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056"
@ -3837,6 +3964,12 @@ lru-cache@^4.0.1, lru-cache@^4.1.3:
pseudomap "^1.0.2" pseudomap "^1.0.2"
yallist "^2.1.2" yallist "^2.1.2"
lru-queue@0.1:
version "0.1.0"
resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3"
dependencies:
es5-ext "~0.10.2"
macaddress@^0.2.8: macaddress@^0.2.8:
version "0.2.8" version "0.2.8"
resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12"
@ -3853,10 +3986,6 @@ makeerror@1.0.x:
dependencies: dependencies:
tmpl "1.0.x" tmpl "1.0.x"
mamacro@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4"
map-cache@^0.2.2: map-cache@^0.2.2:
version "0.2.2" version "0.2.2"
resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf"
@ -3888,6 +4017,19 @@ mem@^1.1.0:
dependencies: dependencies:
mimic-fn "^1.0.0" mimic-fn "^1.0.0"
memoizee@^0.4.14:
version "0.4.14"
resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.14.tgz#07a00f204699f9a95c2d9e77218271c7cd610d57"
dependencies:
d "1"
es5-ext "^0.10.45"
es6-weak-map "^2.0.2"
event-emitter "^0.3.5"
is-promise "^2.1"
lru-queue "0.1"
next-tick "1"
timers-ext "^0.1.5"
memory-fs@^0.4.0, memory-fs@~0.4.1: memory-fs@^0.4.0, memory-fs@~0.4.1:
version "0.4.1" version "0.4.1"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
@ -4062,6 +4204,14 @@ mute-stream@0.0.7:
version "0.0.7" version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
mz@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
dependencies:
any-promise "^1.0.0"
object-assign "^4.0.1"
thenify-all "^1.0.0"
nan@^2.9.2: nan@^2.9.2:
version "2.10.0" version "2.10.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"
@ -4098,6 +4248,10 @@ neo-async@^2.5.0:
version "2.5.1" version "2.5.1"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.1.tgz#acb909e327b1e87ec9ef15f41b8a269512ad41ee" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.1.tgz#acb909e327b1e87ec9ef15f41b8a269512ad41ee"
next-tick@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
nice-try@^1.0.4: nice-try@^1.0.4:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
@ -4335,6 +4489,12 @@ onetime@^2.0.0:
dependencies: dependencies:
mimic-fn "^1.0.0" mimic-fn "^1.0.0"
ono@^4.0.6:
version "4.0.8"
resolved "https://registry.yarnpkg.com/ono/-/ono-4.0.8.tgz#d1b12e048cd8a9fe5d2fbf69d3ad42bf7b0feb5e"
dependencies:
format-util "^1.0.3"
optimist@^0.6.1: optimist@^0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
@ -4861,6 +5021,10 @@ prettier@^1.14.0:
version "1.14.0" version "1.14.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372"
prettier@^1.14.2:
version "1.14.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9"
pretty-format@^23.2.0: pretty-format@^23.2.0:
version "23.2.0" version "23.2.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.2.0.tgz#3b0aaa63c018a53583373c1cb3a5d96cc5e83017" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.2.0.tgz#3b0aaa63c018a53583373c1cb3a5d96cc5e83017"
@ -5829,6 +5993,10 @@ static-extend@^0.1.1:
define-property "^0.2.5" define-property "^0.2.5"
object-copy "^0.1.0" object-copy "^0.1.0"
stdin@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/stdin/-/stdin-0.0.1.tgz#d3041981aaec3dfdbc77a1b38d6372e38f5fb71e"
stealthy-require@^1.1.0: stealthy-require@^1.1.0:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
@ -6054,6 +6222,18 @@ text-table@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
thenify-all@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726"
dependencies:
thenify ">= 3.1.0 < 4"
"thenify@>= 3.1.0 < 4":
version "3.3.0"
resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839"
dependencies:
any-promise "^1.0.0"
throat@^4.0.0: throat@^4.0.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"
@ -6075,6 +6255,13 @@ timers-browserify@^2.0.4:
dependencies: dependencies:
setimmediate "^1.0.4" setimmediate "^1.0.4"
timers-ext@^0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.5.tgz#77147dd4e76b660c2abb8785db96574cbbd12922"
dependencies:
es5-ext "~0.10.14"
next-tick "1"
tmp@^0.0.33: tmp@^0.0.33:
version "0.0.33" version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
@ -6371,9 +6558,9 @@ webidl-conversions@^4.0.2:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
webpack-sources@^1.1.0, webpack-sources@^1.2.0: webpack-sources@^1.1.0, webpack-sources@^1.3.0:
version "1.2.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.2.0.tgz#18181e0d013fce096faf6f8e6d41eeffffdceac2" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85"
dependencies: dependencies:
source-list-map "^2.0.0" source-list-map "^2.0.0"
source-map "~0.6.1" source-map "~0.6.1"