From 2ace39b06117f558c0d8528cea9248253cbdf593 Mon Sep 17 00:00:00 2001 From: Alexander Krasnoyarov Date: Thu, 15 Oct 2020 00:46:08 +0300 Subject: [PATCH] fix: support array of functions and promises (#1946) --- .github/workflows/nodejs.yml | 2 +- .../webpack-cli/lib/groups/ConfigGroup.js | 122 +++++--- .../__snapshots__/index.test.ts.snap | 67 ++++ test/config-name/config-name.test.js | 39 ++- test/config/basic/basic-config.test.js | 7 +- .../empty-array.test.js} | 3 +- test/config/empty-array/src/index.js | 1 + test/config/empty-array/webpack.config.js | 1 + .../empty-function/empty-function.test.js | 12 + test/config/empty-function/src/index.js | 1 + test/config/empty-function/webpack.config.js | 3 + .../empty-promise/empty-promise.test.js | 12 + test/config/empty-promise/src/index.js | 1 + test/config/empty-promise/webpack.config.js | 3 + test/config/empty/empty.test.js | 12 + test/config/empty/src/index.js | 1 + .../invalid-export/invalid-export.test.js | 14 + test/config/invalid-export/webpack.config.js | 1 + test/config/no-config-array/a.js | 1 + .../no-config-array/no-config-array.test.js | 13 + test/config/no-config-array/webpack.config.js | 1 + .../config/type/array-function-with-argv/a.js | 1 + .../config/type/array-function-with-argv/b.js | 1 + .../function-with-argv.test.js | 15 + .../webpack.config.js | 22 ++ test/config/type/array-function-with-env/a.js | 1 + .../array-function-with-env.test.js | 17 + test/config/type/array-function-with-env/b.js | 1 + .../array-function-with-env/webpack.config.js | 22 ++ test/config/type/array-functions/a.js | 1 + .../array-functions/array-functions.test.js | 24 ++ test/config/type/array-functions/b.js | 1 + .../type/array-functions/webpack.config.js | 20 ++ test/config/type/array-promises/a.js | 1 + .../array-promises/array-promises.test.js | 23 ++ test/config/type/array-promises/b.js | 1 + .../type/array-promises/webpack.config.js | 24 ++ .../{array-config.test.js => array.test.js} | 2 +- test/config/type/function-array/a.js | 1 + test/config/type/function-array/b.js | 1 + .../function-array/function-array.test.js | 24 ++ .../type/function-array/webpack.config.js | 16 + test/config/type/function-async/a.js | 1 + .../function-async/function-async.test.js | 19 ++ .../type/function-async/webpack.config.js | 9 + test/config/type/function-promise/a.js | 1 + .../function-promise/function-promise.test.js | 19 ++ .../type/function-promise/webpack.config.js | 13 + ...nction-config.test.js => function.test.js} | 2 +- test/config/type/promise-array/a.js | 1 + test/config/type/promise-array/b.js | 1 + .../type/promise-array/promise-array.test.js | 23 ++ .../type/promise-array/webpack.config.js | 20 ++ test/config/type/promise-function/a.js | 1 + .../promise-function/promise-function.test.js | 19 ++ .../type/promise-function/webpack.config.js | 11 + ...promise-config.test.js => promise.test.js} | 2 +- test/config/type/promise/webpack.config.js | 7 +- yarn.lock | 295 ++++++++---------- 59 files changed, 762 insertions(+), 218 deletions(-) rename test/config/{empty/empty-config.test.js => empty-array/empty-array.test.js} (68%) create mode 100644 test/config/empty-array/src/index.js create mode 100644 test/config/empty-array/webpack.config.js create mode 100644 test/config/empty-function/empty-function.test.js create mode 100644 test/config/empty-function/src/index.js create mode 100644 test/config/empty-function/webpack.config.js create mode 100644 test/config/empty-promise/empty-promise.test.js create mode 100644 test/config/empty-promise/src/index.js create mode 100644 test/config/empty-promise/webpack.config.js create mode 100644 test/config/empty/empty.test.js create mode 100644 test/config/empty/src/index.js create mode 100644 test/config/invalid-export/invalid-export.test.js create mode 100644 test/config/invalid-export/webpack.config.js create mode 100644 test/config/no-config-array/a.js create mode 100644 test/config/no-config-array/no-config-array.test.js create mode 100644 test/config/no-config-array/webpack.config.js create mode 100644 test/config/type/array-function-with-argv/a.js create mode 100644 test/config/type/array-function-with-argv/b.js create mode 100644 test/config/type/array-function-with-argv/function-with-argv.test.js create mode 100644 test/config/type/array-function-with-argv/webpack.config.js create mode 100644 test/config/type/array-function-with-env/a.js create mode 100644 test/config/type/array-function-with-env/array-function-with-env.test.js create mode 100644 test/config/type/array-function-with-env/b.js create mode 100644 test/config/type/array-function-with-env/webpack.config.js create mode 100644 test/config/type/array-functions/a.js create mode 100644 test/config/type/array-functions/array-functions.test.js create mode 100644 test/config/type/array-functions/b.js create mode 100644 test/config/type/array-functions/webpack.config.js create mode 100644 test/config/type/array-promises/a.js create mode 100644 test/config/type/array-promises/array-promises.test.js create mode 100644 test/config/type/array-promises/b.js create mode 100644 test/config/type/array-promises/webpack.config.js rename test/config/type/array/{array-config.test.js => array.test.js} (94%) create mode 100644 test/config/type/function-array/a.js create mode 100644 test/config/type/function-array/b.js create mode 100644 test/config/type/function-array/function-array.test.js create mode 100644 test/config/type/function-array/webpack.config.js create mode 100644 test/config/type/function-async/a.js create mode 100644 test/config/type/function-async/function-async.test.js create mode 100644 test/config/type/function-async/webpack.config.js create mode 100644 test/config/type/function-promise/a.js create mode 100644 test/config/type/function-promise/function-promise.test.js create mode 100644 test/config/type/function-promise/webpack.config.js rename test/config/type/function/{function-config.test.js => function.test.js} (92%) create mode 100644 test/config/type/promise-array/a.js create mode 100644 test/config/type/promise-array/b.js create mode 100644 test/config/type/promise-array/promise-array.test.js create mode 100644 test/config/type/promise-array/webpack.config.js create mode 100644 test/config/type/promise-function/a.js create mode 100644 test/config/type/promise-function/promise-function.test.js create mode 100644 test/config/type/promise-function/webpack.config.js rename test/config/type/promise/{promise-config.test.js => promise.test.js} (93%) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a5ce291b14d..9a0913a2de2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -74,7 +74,7 @@ jobs: path: | node_modules */*/node_modules - key: ${{ runner.os }}-${{ matrix.webpack-version }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-${{ matrix.webpack-version }}-${{ hashFiles('**/yarn.lock', './yarn.lock') }} - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' diff --git a/packages/webpack-cli/lib/groups/ConfigGroup.js b/packages/webpack-cli/lib/groups/ConfigGroup.js index ae979207d03..58aa983d6a5 100644 --- a/packages/webpack-cli/lib/groups/ConfigGroup.js +++ b/packages/webpack-cli/lib/groups/ConfigGroup.js @@ -63,46 +63,44 @@ const getConfigInfoFromFileName = (filename) => { .filter((e) => existsSync(e.path)); }; -// Prepare rechoir environment to load multiple file formats -const requireLoader = (extension, path) => { - rechoir.prepare(extensions, path, process.cwd()); -}; - // Reads a config file given the config metadata const requireConfig = (configModule) => { const extension = Object.keys(jsVariants).find((t) => configModule.ext.endsWith(t)); if (extension) { - requireLoader(extension, configModule.path); + rechoir.prepare(extensions, configModule.path, process.cwd()); } let config = require(configModule.path); + if (config.default) { config = config.default; } - return { - content: config, - path: configModule.path, - }; + return { config, path: configModule.path }; }; // Responsible for reading user configuration files // else does a default config lookup and resolves it. const resolveConfigFiles = async (args) => { const { config, mode } = args; + if (config && config.length > 0) { const resolvedOptions = []; const finalizedConfigs = config.map(async (webpackConfig) => { const configPath = resolve(webpackConfig); const configFiles = getConfigInfoFromFileName(configPath); + if (!configFiles.length) { throw new ConfigError(`The specified config file doesn't exist in ${configPath}`); } + const foundConfig = configFiles[0]; const resolvedConfig = requireConfig(foundConfig); + return finalize(resolvedConfig, args); }); + // resolve all the configs for await (const resolvedOption of finalizedConfigs) { if (Array.isArray(resolvedOption.options)) { @@ -111,10 +109,9 @@ const resolveConfigFiles = async (args) => { resolvedOptions.push(resolvedOption.options); } } - // When the resolved configs are more than 1, then pass them as Array [{...}, {...}] else pass the first config object {...} - const finalOptions = resolvedOptions.length > 1 ? resolvedOptions : resolvedOptions[0] || {}; - opts['options'] = finalOptions; + opts['options'] = resolvedOptions.length > 1 ? resolvedOptions : resolvedOptions[0] || {}; + return; } @@ -127,12 +124,16 @@ const resolveConfigFiles = async (args) => { const configFiles = tmpConfigFiles.map(requireConfig); if (configFiles.length) { const defaultConfig = configFiles.find((p) => p.path.includes(mode) || p.path.includes(modeAlias[mode])); + if (defaultConfig) { opts = await finalize(defaultConfig, args); return; } + const foundConfig = configFiles.pop(); + opts = await finalize(foundConfig, args); + return; } }; @@ -150,49 +151,77 @@ const finalize = async (moduleObj, args) => { return newOptionsObject; } - const configOptions = moduleObj.content; + const config = moduleObj.config; - if (typeof configOptions === 'function') { - // when config is a function, pass the env from args to the config function - let formattedEnv; - if (Array.isArray(env)) { - formattedEnv = env.reduce((envObject, envOption) => { - envObject[envOption] = true; - return envObject; - }, {}); - } - const newOptions = configOptions(formattedEnv, args); - // When config function returns a promise, resolve it, if not it's resolved by default - newOptionsObject['options'] = await Promise.resolve(newOptions); - } else if (configName) { - if (Array.isArray(configOptions) && configOptions.length > 1) { - // In case of exporting multiple configurations, If you pass a name to --config-name flag, - // webpack will only build that specific configuration. - const namedOptions = configOptions.filter((opt) => configName.includes(opt.name)); - if (namedOptions.length === 0) { - logger.error(`Configuration with name "${configName}" was not found.`); - process.exit(2); - } else { - newOptionsObject['options'] = namedOptions; + const isMultiCompilerMode = Array.isArray(config); + const rawConfigs = isMultiCompilerMode ? config : [config]; + + let configs = await Promise.all( + rawConfigs.map(async (rawConfig) => { + const isPromise = typeof rawConfig.then === 'function'; + + if (isPromise) { + rawConfig = await rawConfig; } - } else { - logger.error('Multiple configurations not found. Please use "--config-name" with multiple configurations.'); + + // `Promise` may return `Function` + if (typeof rawConfig === 'function') { + // when config is a function, pass the env from args to the config function + let envs; + + if (Array.isArray(env)) { + envs = env.reduce((envObject, envOption) => { + envObject[envOption] = true; + + return envObject; + }, {}); + } + + rawConfig = await rawConfig(envs, args); + } + + return rawConfig; + }), + ); + + if (configName) { + const foundConfigNames = []; + + configs = configs.filter((options) => { + const found = configName.includes(options.name); + + if (found) { + foundConfigNames.push(options.name); + } + + return found; + }); + + if (foundConfigNames.length !== configName.length) { + // Configuration with name "test" was not found. + logger.error( + configName + .filter((name) => !foundConfigNames.includes(name)) + .map((configName) => `Configuration with name "${configName}" was not found.`) + .join('\n'), + ); process.exit(2); } - } else { - if (Array.isArray(configOptions) && !configOptions.length) { - newOptionsObject['options'] = {}; - return newOptionsObject; - } + } - newOptionsObject['options'] = configOptions; + if (configs.length === 0) { + logger.error('No configurations found'); + process.exit(2); } + newOptionsObject['options'] = isMultiCompilerMode ? configs : configs[0]; + return newOptionsObject; }; const resolveConfigMerging = async (args) => { const { merge } = args; + if (merge) { // Get the current configuration options const { options: configOptions } = opts; @@ -210,10 +239,9 @@ const resolveConfigMerging = async (args) => { } }; -const handleConfigResolution = async (args) => { +module.exports = async (args) => { await resolveConfigFiles(args); await resolveConfigMerging(args); + return opts; }; - -module.exports = handleConfigResolution; diff --git a/packages/webpack-scaffold/__tests__/__snapshots__/index.test.ts.snap b/packages/webpack-scaffold/__tests__/__snapshots__/index.test.ts.snap index 4bbb3fc9d09..126c853a068 100755 --- a/packages/webpack-scaffold/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/webpack-scaffold/__tests__/__snapshots__/index.test.ts.snap @@ -59,12 +59,17 @@ Collection { "value": Node { "end": 4, "errors": Array [], + "extra": undefined, + "innerComments": undefined, + "leadingComments": undefined, "loc": SourceLocation { "end": Object { "column": 4, "line": 1, "token": 1, }, + "filename": undefined, + "identifierName": undefined, "indent": 0, "lines": Lines { "cachedSourceMap": null, @@ -96,6 +101,8 @@ Collection { "line": 1, "token": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 4, "line": 1, @@ -122,13 +129,18 @@ Collection { "program": Node { "body": Array [], "end": 4, + "extra": undefined, + "innerComments": undefined, "interpreter": null, + "leadingComments": undefined, "loc": SourceLocation { "end": Position { "column": 4, "line": 1, "token": 1, }, + "filename": undefined, + "identifierName": undefined, "indent": 4, "lines": Lines { "cachedSourceMap": null, @@ -160,6 +172,8 @@ Collection { "line": 1, "token": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 4, "line": 1, @@ -183,10 +197,13 @@ Collection { }, ], }, + "range": undefined, "sourceType": "module", "start": 0, + "trailingComments": undefined, "type": "Program", }, + "range": undefined, "start": 0, "tokens": Array [ Token { @@ -197,6 +214,8 @@ Collection { "line": 1, "token": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 4, "line": 1, @@ -219,6 +238,7 @@ Collection { "value": "", }, ], + "trailingComments": undefined, "type": "File", }, }, @@ -242,12 +262,17 @@ Collection { "value": Node { "end": 5, "errors": Array [], + "extra": undefined, + "innerComments": undefined, + "leadingComments": undefined, "loc": SourceLocation { "end": Object { "column": 5, "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "indent": 0, "lines": Lines { "cachedSourceMap": null, @@ -279,6 +304,8 @@ Collection { "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 0, "line": 1, @@ -308,6 +335,8 @@ Collection { "column": 5, "line": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 5, "line": 1, @@ -337,12 +366,16 @@ Collection { "end": 5, "expression": Node { "end": 5, + "extra": undefined, + "innerComments": undefined, + "leadingComments": undefined, "loc": SourceLocation { "end": Position { "column": 5, "line": 1, "token": 2, }, + "filename": undefined, "identifierName": "hello", "indent": 0, "lines": Lines { @@ -375,6 +408,8 @@ Collection { "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 0, "line": 1, @@ -404,6 +439,8 @@ Collection { "column": 5, "line": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 5, "line": 1, @@ -428,15 +465,22 @@ Collection { ], }, "name": "hello", + "range": undefined, "start": 0, + "trailingComments": undefined, "type": "Identifier", }, + "extra": undefined, + "innerComments": undefined, + "leadingComments": undefined, "loc": SourceLocation { "end": Position { "column": 5, "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "indent": 0, "lines": Lines { "cachedSourceMap": null, @@ -468,6 +512,8 @@ Collection { "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 0, "line": 1, @@ -497,6 +543,8 @@ Collection { "column": 5, "line": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 5, "line": 1, @@ -520,18 +568,25 @@ Collection { }, ], }, + "range": undefined, "start": 0, + "trailingComments": undefined, "type": "ExpressionStatement", }, ], "end": 5, + "extra": undefined, + "innerComments": undefined, "interpreter": null, + "leadingComments": undefined, "loc": SourceLocation { "end": Object { "column": 5, "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "indent": 0, "lines": Lines { "cachedSourceMap": null, @@ -563,6 +618,8 @@ Collection { "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 0, "line": 1, @@ -592,6 +649,8 @@ Collection { "column": 5, "line": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 5, "line": 1, @@ -615,10 +674,13 @@ Collection { }, ], }, + "range": undefined, "sourceType": "module", "start": 0, + "trailingComments": undefined, "type": "Program", }, + "range": undefined, "start": 0, "tokens": Array [ Token { @@ -629,6 +691,8 @@ Collection { "line": 1, "token": 2, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 0, "line": 1, @@ -658,6 +722,8 @@ Collection { "column": 5, "line": 1, }, + "filename": undefined, + "identifierName": undefined, "start": Position { "column": 5, "line": 1, @@ -680,6 +746,7 @@ Collection { "value": "", }, ], + "trailingComments": undefined, "type": "File", }, }, diff --git a/test/config-name/config-name.test.js b/test/config-name/config-name.test.js index 9cdf276cb9f..de2fe509af4 100644 --- a/test/config-name/config-name.test.js +++ b/test/config-name/config-name.test.js @@ -6,11 +6,12 @@ const { resolve } = require('path'); describe('--config-name flag', () => { it('should select only the config whose name is passed with --config-name', (done) => { - const { stderr, stdout } = run(__dirname, ['--config-name', 'first'], false); + const { stderr, stdout, exitCode } = run(__dirname, ['--config-name', 'first'], false); expect(stderr).toBeFalsy(); expect(stdout).toContain('first'); expect(stdout).not.toContain('second'); expect(stdout).not.toContain('third'); + expect(exitCode).toBe(0); stat(resolve(__dirname, './dist/dist-first.js'), (err, stats) => { expect(err).toBe(null); @@ -40,14 +41,44 @@ describe('--config-name flag', () => { }); it('should log error if invalid config name is provided', () => { - const { stderr, stdout } = run(__dirname, ['--config-name', 'test'], false); + const { stderr, stdout, exitCode } = run(__dirname, ['--config-name', 'test'], false); + expect(stderr).toContain('Configuration with name "test" was not found.'); expect(stdout).toBeFalsy(); + expect(exitCode).toBe(2); }); it('should log error if multiple configurations are not found', () => { - const { stderr, stdout } = run(__dirname, ['--config-name', 'test', '-c', 'single-config.js'], false); - expect(stderr).toContain('Multiple configurations not found. Please use "--config-name" with multiple configurations'); + const { stderr, stdout, exitCode } = run(__dirname, ['--config-name', 'test', '-c', 'single-config.js'], false); + + expect(stderr).toContain('Configuration with name "test" was not found.'); + expect(stdout).toBeFalsy(); + expect(exitCode).toBe(2); + }); + + it('should log error if multiple configurations are not found #1', () => { + const { stderr, stdout, exitCode } = run( + __dirname, + ['--config-name', 'test', '--config-name', 'bar', '-c', 'single-config.js'], + false, + ); + + expect(stderr).toContain('Configuration with name "test" was not found.'); + expect(stderr).toContain('Configuration with name "bar" was not found.'); + expect(stdout).toBeFalsy(); + expect(exitCode).toBe(2); + }); + + it('should log error if multiple configurations are not found #2', () => { + const { stderr, stdout, exitCode } = run( + __dirname, + ['--config-name', 'first', '--config-name', 'bar', '-c', 'single-config.js'], + false, + ); + + expect(stderr).not.toContain('Configuration with name "first" was not found.'); + expect(stderr).toContain('Configuration with name "bar" was not found.'); expect(stdout).toBeFalsy(); + expect(exitCode).toBe(2); }); }); diff --git a/test/config/basic/basic-config.test.js b/test/config/basic/basic-config.test.js index a2d876db072..6372c65afa9 100644 --- a/test/config/basic/basic-config.test.js +++ b/test/config/basic/basic-config.test.js @@ -5,9 +5,14 @@ const { run } = require('../../utils/test-utils'); describe('basic config file', () => { it('is able to understand and parse a very basic configuration file', () => { - const { stdout, stderr } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js'), '--output-path', './binary'], false); + const { stdout, stderr, exitCode } = run( + __dirname, + ['-c', resolve(__dirname, 'webpack.config.js'), '--output-path', './binary'], + false, + ); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); expect(existsSync(resolve(__dirname, './binary/a.bundle.js'))).toBeTruthy(); }); }); diff --git a/test/config/empty/empty-config.test.js b/test/config/empty-array/empty-array.test.js similarity index 68% rename from test/config/empty/empty-config.test.js rename to test/config/empty-array/empty-array.test.js index 71625bf030b..0c34474487d 100644 --- a/test/config/empty/empty-config.test.js +++ b/test/config/empty-array/empty-array.test.js @@ -4,8 +4,9 @@ const { run } = require('../../utils/test-utils'); describe('config flag with empty config file', () => { it('should throw error with no configuration or index file', () => { - const { stdout, stderr } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); + const { stdout, stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); }); }); diff --git a/test/config/empty-array/src/index.js b/test/config/empty-array/src/index.js new file mode 100644 index 00000000000..ddcb8a97f43 --- /dev/null +++ b/test/config/empty-array/src/index.js @@ -0,0 +1 @@ +module.exports = 'empty'; \ No newline at end of file diff --git a/test/config/empty-array/webpack.config.js b/test/config/empty-array/webpack.config.js new file mode 100644 index 00000000000..6193feabfd8 --- /dev/null +++ b/test/config/empty-array/webpack.config.js @@ -0,0 +1 @@ +module.exports = [{}, {}]; diff --git a/test/config/empty-function/empty-function.test.js b/test/config/empty-function/empty-function.test.js new file mode 100644 index 00000000000..0c34474487d --- /dev/null +++ b/test/config/empty-function/empty-function.test.js @@ -0,0 +1,12 @@ +'use strict'; +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('config flag with empty config file', () => { + it('should throw error with no configuration or index file', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + }); +}); diff --git a/test/config/empty-function/src/index.js b/test/config/empty-function/src/index.js new file mode 100644 index 00000000000..4d9e3a1cf9b --- /dev/null +++ b/test/config/empty-function/src/index.js @@ -0,0 +1 @@ +module.exports = 'empty-function'; \ No newline at end of file diff --git a/test/config/empty-function/webpack.config.js b/test/config/empty-function/webpack.config.js new file mode 100644 index 00000000000..3b86b2a2eac --- /dev/null +++ b/test/config/empty-function/webpack.config.js @@ -0,0 +1,3 @@ +module.exports = () => { + return {}; +}; diff --git a/test/config/empty-promise/empty-promise.test.js b/test/config/empty-promise/empty-promise.test.js new file mode 100644 index 00000000000..0c34474487d --- /dev/null +++ b/test/config/empty-promise/empty-promise.test.js @@ -0,0 +1,12 @@ +'use strict'; +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('config flag with empty config file', () => { + it('should throw error with no configuration or index file', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + }); +}); diff --git a/test/config/empty-promise/src/index.js b/test/config/empty-promise/src/index.js new file mode 100644 index 00000000000..b6838e230eb --- /dev/null +++ b/test/config/empty-promise/src/index.js @@ -0,0 +1 @@ +module.exports = 'empty-promise'; \ No newline at end of file diff --git a/test/config/empty-promise/webpack.config.js b/test/config/empty-promise/webpack.config.js new file mode 100644 index 00000000000..c8a4865f9d6 --- /dev/null +++ b/test/config/empty-promise/webpack.config.js @@ -0,0 +1,3 @@ +module.exports = new Promise((resolve) => { + resolve({}); +}); diff --git a/test/config/empty/empty.test.js b/test/config/empty/empty.test.js new file mode 100644 index 00000000000..0c34474487d --- /dev/null +++ b/test/config/empty/empty.test.js @@ -0,0 +1,12 @@ +'use strict'; +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('config flag with empty config file', () => { + it('should throw error with no configuration or index file', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + }); +}); diff --git a/test/config/empty/src/index.js b/test/config/empty/src/index.js new file mode 100644 index 00000000000..ddcb8a97f43 --- /dev/null +++ b/test/config/empty/src/index.js @@ -0,0 +1 @@ +module.exports = 'empty'; \ No newline at end of file diff --git a/test/config/invalid-export/invalid-export.test.js b/test/config/invalid-export/invalid-export.test.js new file mode 100644 index 00000000000..ca1abec6ab5 --- /dev/null +++ b/test/config/invalid-export/invalid-export.test.js @@ -0,0 +1,14 @@ +'use strict'; +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('invalid export', () => { + it('should throw error with no configuration or index file', () => { + const { stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); + + expect(stderr).toBeTruthy(); + expect(stderr).toContain('Invalid configuration object'); + + expect(exitCode).toBe(2); + }); +}); diff --git a/test/config/invalid-export/webpack.config.js b/test/config/invalid-export/webpack.config.js new file mode 100644 index 00000000000..2651774ae60 --- /dev/null +++ b/test/config/invalid-export/webpack.config.js @@ -0,0 +1 @@ +module.exports = 'foo'; diff --git a/test/config/no-config-array/a.js b/test/config/no-config-array/a.js new file mode 100644 index 00000000000..735d820f253 --- /dev/null +++ b/test/config/no-config-array/a.js @@ -0,0 +1 @@ +module.exports = 'a.js'; diff --git a/test/config/no-config-array/no-config-array.test.js b/test/config/no-config-array/no-config-array.test.js new file mode 100644 index 00000000000..2be56276b57 --- /dev/null +++ b/test/config/no-config-array/no-config-array.test.js @@ -0,0 +1,13 @@ +'use strict'; + +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('no configs in array', () => { + it('is able to understand and parse a very basic configuration file', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); + expect(stderr).toContain('No configurations found'); + expect(stdout).toBeFalsy(); + expect(exitCode).toBe(2); + }); +}); diff --git a/test/config/no-config-array/webpack.config.js b/test/config/no-config-array/webpack.config.js new file mode 100644 index 00000000000..e0a30c5dfa3 --- /dev/null +++ b/test/config/no-config-array/webpack.config.js @@ -0,0 +1 @@ +module.exports = []; diff --git a/test/config/type/array-function-with-argv/a.js b/test/config/type/array-function-with-argv/a.js new file mode 100644 index 00000000000..8609d075540 --- /dev/null +++ b/test/config/type/array-function-with-argv/a.js @@ -0,0 +1 @@ +console.log('a'); diff --git a/test/config/type/array-function-with-argv/b.js b/test/config/type/array-function-with-argv/b.js new file mode 100644 index 00000000000..eeb313a0347 --- /dev/null +++ b/test/config/type/array-function-with-argv/b.js @@ -0,0 +1 @@ +console.log('b'); diff --git a/test/config/type/array-function-with-argv/function-with-argv.test.js b/test/config/type/array-function-with-argv/function-with-argv.test.js new file mode 100644 index 00000000000..1685a9a110c --- /dev/null +++ b/test/config/type/array-function-with-argv/function-with-argv.test.js @@ -0,0 +1,15 @@ +'use strict'; +const { existsSync } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('array of function with args', () => { + it('is able to understand a configuration file as a function', () => { + const { stderr, stdout, exitCode } = run(__dirname, ['--mode', 'development'], false); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + expect(existsSync(resolve(__dirname, './dist/a-dev.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, './dist/b-dev.js'))).toBeTruthy(); + }); +}); diff --git a/test/config/type/array-function-with-argv/webpack.config.js b/test/config/type/array-function-with-argv/webpack.config.js new file mode 100644 index 00000000000..2ced6f132a5 --- /dev/null +++ b/test/config/type/array-function-with-argv/webpack.config.js @@ -0,0 +1,22 @@ +module.exports = [ + (env, argv) => { + console.log({ argv }); + const { mode } = argv; + return { + entry: './a.js', + output: { + filename: mode === 'production' ? 'a-prod.js' : 'a-dev.js', + }, + }; + }, + (env, argv) => { + console.log({ argv }); + const { mode } = argv; + return { + entry: './b.js', + output: { + filename: mode === 'production' ? 'b-prod.js' : 'b-dev.js', + }, + }; + }, +]; diff --git a/test/config/type/array-function-with-env/a.js b/test/config/type/array-function-with-env/a.js new file mode 100644 index 00000000000..8609d075540 --- /dev/null +++ b/test/config/type/array-function-with-env/a.js @@ -0,0 +1 @@ +console.log('a'); diff --git a/test/config/type/array-function-with-env/array-function-with-env.test.js b/test/config/type/array-function-with-env/array-function-with-env.test.js new file mode 100644 index 00000000000..c51cef8e060 --- /dev/null +++ b/test/config/type/array-function-with-env/array-function-with-env.test.js @@ -0,0 +1,17 @@ +'use strict'; +const { existsSync } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('array of functions with env', () => { + it('is able to understand a configuration file as a function', () => { + const { stderr, stdout, exitCode } = run(__dirname, ['--mode', 'development'], false); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + + // Should generate the appropriate files + expect(existsSync(resolve(__dirname, './dist/a-dev.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, './dist/b-dev.js'))).toBeTruthy(); + }); +}); diff --git a/test/config/type/array-function-with-env/b.js b/test/config/type/array-function-with-env/b.js new file mode 100644 index 00000000000..eeb313a0347 --- /dev/null +++ b/test/config/type/array-function-with-env/b.js @@ -0,0 +1 @@ +console.log('b'); diff --git a/test/config/type/array-function-with-env/webpack.config.js b/test/config/type/array-function-with-env/webpack.config.js new file mode 100644 index 00000000000..2ced6f132a5 --- /dev/null +++ b/test/config/type/array-function-with-env/webpack.config.js @@ -0,0 +1,22 @@ +module.exports = [ + (env, argv) => { + console.log({ argv }); + const { mode } = argv; + return { + entry: './a.js', + output: { + filename: mode === 'production' ? 'a-prod.js' : 'a-dev.js', + }, + }; + }, + (env, argv) => { + console.log({ argv }); + const { mode } = argv; + return { + entry: './b.js', + output: { + filename: mode === 'production' ? 'b-prod.js' : 'b-dev.js', + }, + }; + }, +]; diff --git a/test/config/type/array-functions/a.js b/test/config/type/array-functions/a.js new file mode 100644 index 00000000000..ea51098c48f --- /dev/null +++ b/test/config/type/array-functions/a.js @@ -0,0 +1 @@ +module.exports = 'a-function'; diff --git a/test/config/type/array-functions/array-functions.test.js b/test/config/type/array-functions/array-functions.test.js new file mode 100644 index 00000000000..920852f4aa0 --- /dev/null +++ b/test/config/type/array-functions/array-functions.test.js @@ -0,0 +1,24 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('array of functions', () => { + it('is able to understand a configuration file as a function', (done) => { + const { stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); + + expect(stderr).toBeFalsy(); + expect(exitCode).toBe(0); + + stat(resolve(__dirname, './binary/a-functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + + stat(resolve(__dirname, './binary/b-functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); + }); +}); diff --git a/test/config/type/array-functions/b.js b/test/config/type/array-functions/b.js new file mode 100644 index 00000000000..5614cdc34c5 --- /dev/null +++ b/test/config/type/array-functions/b.js @@ -0,0 +1 @@ +module.exports = 'b-function'; diff --git a/test/config/type/array-functions/webpack.config.js b/test/config/type/array-functions/webpack.config.js new file mode 100644 index 00000000000..a10065bb402 --- /dev/null +++ b/test/config/type/array-functions/webpack.config.js @@ -0,0 +1,20 @@ +module.exports = [ + () => { + return { + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'a-functor.js', + }, + }; + }, + () => { + return { + entry: './b', + output: { + path: __dirname + '/binary', + filename: 'b-functor.js', + }, + }; + }, +]; diff --git a/test/config/type/array-promises/a.js b/test/config/type/array-promises/a.js new file mode 100644 index 00000000000..4f7f5db3d4c --- /dev/null +++ b/test/config/type/array-promises/a.js @@ -0,0 +1 @@ +module.exports = 'a-promise'; diff --git a/test/config/type/array-promises/array-promises.test.js b/test/config/type/array-promises/array-promises.test.js new file mode 100644 index 00000000000..7c831d99cff --- /dev/null +++ b/test/config/type/array-promises/array-promises.test.js @@ -0,0 +1,23 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('array of promises', () => { + it('is able to understand a configuration file as a promise', (done) => { + const { stdout, stderr } = run(__dirname, ['-c', './webpack.config.js'], false); + expect(stdout).toBeTruthy(); + expect(stderr).toBeFalsy(); + + stat(resolve(__dirname, './binary/a-promise.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + + stat(resolve(__dirname, './binary/b-promise.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); + }); +}); diff --git a/test/config/type/array-promises/b.js b/test/config/type/array-promises/b.js new file mode 100644 index 00000000000..d4280020bd2 --- /dev/null +++ b/test/config/type/array-promises/b.js @@ -0,0 +1 @@ +module.exports = 'b-promise'; diff --git a/test/config/type/array-promises/webpack.config.js b/test/config/type/array-promises/webpack.config.js new file mode 100644 index 00000000000..8d7498a200f --- /dev/null +++ b/test/config/type/array-promises/webpack.config.js @@ -0,0 +1,24 @@ +module.exports = [ + new Promise((resolve) => { + setTimeout(() => { + resolve({ + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'a-promise.js', + }, + }); + }, 0); + }), + new Promise((resolve) => { + setTimeout(() => { + resolve({ + entry: './b', + output: { + path: __dirname + '/binary', + filename: 'b-promise.js', + }, + }); + }, 0); + }), +]; diff --git a/test/config/type/array/array-config.test.js b/test/config/type/array/array.test.js similarity index 94% rename from test/config/type/array/array-config.test.js rename to test/config/type/array/array.test.js index af9e29ac07a..28149ff06dc 100644 --- a/test/config/type/array/array-config.test.js +++ b/test/config/type/array/array.test.js @@ -3,7 +3,7 @@ const { stat } = require('fs'); const { resolve } = require('path'); const { run } = require('../../../utils/test-utils'); -describe('array configuration', () => { +describe('array', () => { it('is able to understand a configuration file in array format', (done) => { run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); stat(resolve(__dirname, './dist/dist-commonjs.js'), (err, stats) => { diff --git a/test/config/type/function-array/a.js b/test/config/type/function-array/a.js new file mode 100644 index 00000000000..ea51098c48f --- /dev/null +++ b/test/config/type/function-array/a.js @@ -0,0 +1 @@ +module.exports = 'a-function'; diff --git a/test/config/type/function-array/b.js b/test/config/type/function-array/b.js new file mode 100644 index 00000000000..5614cdc34c5 --- /dev/null +++ b/test/config/type/function-array/b.js @@ -0,0 +1 @@ +module.exports = 'b-function'; diff --git a/test/config/type/function-array/function-array.test.js b/test/config/type/function-array/function-array.test.js new file mode 100644 index 00000000000..c7312b734e5 --- /dev/null +++ b/test/config/type/function-array/function-array.test.js @@ -0,0 +1,24 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('function array', () => { + it('is able to understand a configuration file as a function', (done) => { + const { stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); + + expect(stderr).toBeFalsy(); + expect(exitCode).toBe(0); + + stat(resolve(__dirname, './binary/a-functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + + stat(resolve(__dirname, './binary/b-functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); + }); +}); diff --git a/test/config/type/function-array/webpack.config.js b/test/config/type/function-array/webpack.config.js new file mode 100644 index 00000000000..5bd0287a4bb --- /dev/null +++ b/test/config/type/function-array/webpack.config.js @@ -0,0 +1,16 @@ +module.exports = () => [ + { + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'a-functor.js', + }, + }, + { + entry: './b', + output: { + path: __dirname + '/binary', + filename: 'b-functor.js', + }, + }, +]; diff --git a/test/config/type/function-async/a.js b/test/config/type/function-async/a.js new file mode 100644 index 00000000000..ea51098c48f --- /dev/null +++ b/test/config/type/function-async/a.js @@ -0,0 +1 @@ +module.exports = 'a-function'; diff --git a/test/config/type/function-async/function-async.test.js b/test/config/type/function-async/function-async.test.js new file mode 100644 index 00000000000..3b8fa277d98 --- /dev/null +++ b/test/config/type/function-async/function-async.test.js @@ -0,0 +1,19 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('function async', () => { + it('is able to understand a configuration file as a function', (done) => { + const { stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); + + expect(stderr).toBeFalsy(); + expect(exitCode).toBe(0); + + stat(resolve(__dirname, './binary/functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); +}); diff --git a/test/config/type/function-async/webpack.config.js b/test/config/type/function-async/webpack.config.js new file mode 100644 index 00000000000..6457b889f8c --- /dev/null +++ b/test/config/type/function-async/webpack.config.js @@ -0,0 +1,9 @@ +module.exports = async () => { + return { + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'functor.js', + }, + }; +}; diff --git a/test/config/type/function-promise/a.js b/test/config/type/function-promise/a.js new file mode 100644 index 00000000000..ea51098c48f --- /dev/null +++ b/test/config/type/function-promise/a.js @@ -0,0 +1 @@ +module.exports = 'a-function'; diff --git a/test/config/type/function-promise/function-promise.test.js b/test/config/type/function-promise/function-promise.test.js new file mode 100644 index 00000000000..ba42b3c57e5 --- /dev/null +++ b/test/config/type/function-promise/function-promise.test.js @@ -0,0 +1,19 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('function promise', () => { + it('is able to understand a configuration file as a function', (done) => { + const { stderr, exitCode } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); + + expect(stderr).toBeFalsy(); + expect(exitCode).toBe(0); + + stat(resolve(__dirname, './binary/functor.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); +}); diff --git a/test/config/type/function-promise/webpack.config.js b/test/config/type/function-promise/webpack.config.js new file mode 100644 index 00000000000..777459d6e0e --- /dev/null +++ b/test/config/type/function-promise/webpack.config.js @@ -0,0 +1,13 @@ +module.exports = () => { + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'functor.js', + }, + }); + }); + }, 0); +}; diff --git a/test/config/type/function/function-config.test.js b/test/config/type/function/function.test.js similarity index 92% rename from test/config/type/function/function-config.test.js rename to test/config/type/function/function.test.js index 224e2af730d..80f30ad08d1 100644 --- a/test/config/type/function/function-config.test.js +++ b/test/config/type/function/function.test.js @@ -3,7 +3,7 @@ const { stat } = require('fs'); const { resolve } = require('path'); const { run } = require('../../../utils/test-utils'); -describe('function configuration', () => { +describe('function', () => { it('is able to understand a configuration file as a function', (done) => { run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false); stat(resolve(__dirname, './binary/functor.js'), (err, stats) => { diff --git a/test/config/type/promise-array/a.js b/test/config/type/promise-array/a.js new file mode 100644 index 00000000000..4f7f5db3d4c --- /dev/null +++ b/test/config/type/promise-array/a.js @@ -0,0 +1 @@ +module.exports = 'a-promise'; diff --git a/test/config/type/promise-array/b.js b/test/config/type/promise-array/b.js new file mode 100644 index 00000000000..d4280020bd2 --- /dev/null +++ b/test/config/type/promise-array/b.js @@ -0,0 +1 @@ +module.exports = 'b-promise'; diff --git a/test/config/type/promise-array/promise-array.test.js b/test/config/type/promise-array/promise-array.test.js new file mode 100644 index 00000000000..ba99a92449b --- /dev/null +++ b/test/config/type/promise-array/promise-array.test.js @@ -0,0 +1,23 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('promise array', () => { + it('is able to understand a configuration file as a promise', (done) => { + const { stdout, stderr } = run(__dirname, ['-c', './webpack.config.js'], false); + expect(stdout).toBeTruthy(); + expect(stderr).toBeFalsy(); + + stat(resolve(__dirname, './binary/a-promise.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + + stat(resolve(__dirname, './binary/b-promise.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); + }); +}); diff --git a/test/config/type/promise-array/webpack.config.js b/test/config/type/promise-array/webpack.config.js new file mode 100644 index 00000000000..4779964e1af --- /dev/null +++ b/test/config/type/promise-array/webpack.config.js @@ -0,0 +1,20 @@ +module.exports = new Promise((resolve) => { + setTimeout(() => { + resolve([ + { + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'a-promise.js', + }, + }, + { + entry: './b', + output: { + path: __dirname + '/binary', + filename: 'b-promise.js', + }, + }, + ]); + }, 0); +}); diff --git a/test/config/type/promise-function/a.js b/test/config/type/promise-function/a.js new file mode 100644 index 00000000000..4f7f5db3d4c --- /dev/null +++ b/test/config/type/promise-function/a.js @@ -0,0 +1 @@ +module.exports = 'a-promise'; diff --git a/test/config/type/promise-function/promise-function.test.js b/test/config/type/promise-function/promise-function.test.js new file mode 100644 index 00000000000..220e908bae5 --- /dev/null +++ b/test/config/type/promise-function/promise-function.test.js @@ -0,0 +1,19 @@ +'use strict'; +const { stat } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../../utils/test-utils'); + +describe('promise function', () => { + it('is able to understand a configuration file as a promise', (done) => { + const { stdout, stderr } = run(__dirname, ['-c', './webpack.config.js'], false); + console.log(stdout); + console.log(stderr); + expect(stdout).toBeTruthy(); + expect(stderr).toBeFalsy(); + stat(resolve(__dirname, './binary/promise.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); +}); diff --git a/test/config/type/promise-function/webpack.config.js b/test/config/type/promise-function/webpack.config.js new file mode 100644 index 00000000000..f2881885ba2 --- /dev/null +++ b/test/config/type/promise-function/webpack.config.js @@ -0,0 +1,11 @@ +module.exports = new Promise((resolve) => { + setTimeout(() => { + resolve(() => ({ + entry: './a', + output: { + path: __dirname + '/binary', + filename: 'promise.js', + }, + })); + }, 0); +}); diff --git a/test/config/type/promise/promise-config.test.js b/test/config/type/promise/promise.test.js similarity index 93% rename from test/config/type/promise/promise-config.test.js rename to test/config/type/promise/promise.test.js index 061bdc92785..3938804bf66 100644 --- a/test/config/type/promise/promise-config.test.js +++ b/test/config/type/promise/promise.test.js @@ -3,7 +3,7 @@ const { stat } = require('fs'); const { resolve } = require('path'); const { run } = require('../../../utils/test-utils'); -describe('promise configuration', () => { +describe('promise', () => { it('is able to understand a configuration file as a promise', (done) => { const { stdout, stderr } = run(__dirname, ['-c', './webpack.config.js'], false); expect(stdout).toBeTruthy(); diff --git a/test/config/type/promise/webpack.config.js b/test/config/type/promise/webpack.config.js index f657e66b809..fdfbe448445 100644 --- a/test/config/type/promise/webpack.config.js +++ b/test/config/type/promise/webpack.config.js @@ -1,5 +1,5 @@ -module.exports = () => { - return new Promise((resolve) => { +module.exports = () => + new Promise((resolve) => { setTimeout(() => { resolve({ entry: './a', @@ -8,6 +8,5 @@ module.exports = () => { filename: 'promise.js', }, }); - }, 500); + }, 0); }); -}; diff --git a/yarn.lock b/yarn.lock index b38096ae911..ecf32d0fda8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,28 +9,24 @@ dependencies: "@babel/highlight" "^7.10.4" -"@babel/compat-data@^7.10.4", "@babel/compat-data@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.11.0.tgz#e9f73efe09af1355b723a7f39b11bad637d7c99c" - integrity sha512-TPSvJfv73ng0pfnEOh17bYMPQbI95+nGWc71Ss4vZdRBHTDqmM9Z8ZV4rYz8Ks7sfzc95n30k6ODIq5UGnXcYQ== - dependencies: - browserslist "^4.12.0" - invariant "^2.2.4" - semver "^5.5.0" +"@babel/compat-data@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.12.0.tgz#443aea07a5aeba7942cb067de6b8272f2ab36b9e" + integrity sha512-jAbCtMANC9ptXxbSVXIqV/3H0bkh7iyyv6JS5lu10av45bcc2QmDNJXkASZCFwbBt75Q0AEq/BB+bNa3x1QgYQ== "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.11.1", "@babel/core@^7.7.5": - version "7.11.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.11.6.tgz#3a9455dc7387ff1bac45770650bc13ba04a15651" - integrity sha512-Wpcv03AGnmkgm6uS6k8iwhIwTrcP0m17TL1n1sy7qD0qelDu4XNeW0dN0mHfa+Gei211yDaLoEe/VlbXQzM4Bg== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.0.tgz#e42e07a086e978cdd4c61f4078d8230fb817cc86" + integrity sha512-iV7Gwg0DePKvdDZZWRTkj4MW+6/AbVWd4ZCg+zk8H1RVt5xBpUZS6vLQWwb3pyLg4BFTaGiQCPoJ4Ibmbne4fA== dependencies: "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.11.6" - "@babel/helper-module-transforms" "^7.11.0" + "@babel/generator" "^7.12.0" + "@babel/helper-module-transforms" "^7.12.0" "@babel/helpers" "^7.10.4" - "@babel/parser" "^7.11.5" + "@babel/parser" "^7.12.0" "@babel/template" "^7.10.4" - "@babel/traverse" "^7.11.5" - "@babel/types" "^7.11.5" + "@babel/traverse" "^7.12.0" + "@babel/types" "^7.12.0" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" @@ -40,12 +36,12 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.11.5", "@babel/generator@^7.11.6": - version "7.11.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.11.6.tgz#b868900f81b163b4d464ea24545c61cbac4dc620" - integrity sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA== +"@babel/generator@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.0.tgz#91a45f1c18ca8d895a35a04da1a4cf7ea3f37f98" + integrity sha512-8lnf4QcyiQMf5XQp47BltuMTocsOh6P0z/vueEh8GzhmWWlDbdvOoI5Ziddg0XYhmnx35HyByUW51/9NprF8cA== dependencies: - "@babel/types" "^7.11.5" + "@babel/types" "^7.12.0" jsesc "^2.5.1" source-map "^0.5.0" @@ -64,37 +60,36 @@ "@babel/helper-explode-assignable-expression" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/helper-compilation-targets@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.4.tgz#804ae8e3f04376607cc791b9d47d540276332bd2" - integrity sha512-a3rYhlsGV0UHNDvrtOXBg8/OpfV0OKTkxKPzIplS1zpx7CygDcWWxckxZeDd3gzPzC4kUT0A4nVFDK0wGMh4MQ== +"@babel/helper-compilation-targets@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.0.tgz#c477d89a1f4d626c8149b9b88802f78d66d0c99a" + integrity sha512-NbDFJNjDgxE7IkrHp5gq2+Tr8bEdCLKYN90YDQEjMiTMUAFAcShNkaH8kydcmU0mEQTiQY0Ydy/+1xfS2OCEnw== dependencies: - "@babel/compat-data" "^7.10.4" + "@babel/compat-data" "^7.12.0" + "@babel/helper-validator-option" "^7.12.0" browserslist "^4.12.0" - invariant "^2.2.4" - levenary "^1.1.1" semver "^5.5.0" -"@babel/helper-create-class-features-plugin@^7.10.4", "@babel/helper-create-class-features-plugin@^7.10.5": - version "7.10.5" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz#9f61446ba80e8240b0a5c85c6fdac8459d6f259d" - integrity sha512-0nkdeijB7VlZoLT3r/mY3bUkw3T8WG/hNw+FATs/6+pG2039IJWjTYL0VTISqsNHMUTEnwbVnc89WIJX9Qed0A== +"@babel/helper-create-class-features-plugin@^7.10.4", "@babel/helper-create-class-features-plugin@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.0.tgz#f3f2fc77bacc89e59ce6764daeabc1fb23e79a05" + integrity sha512-9tD1r9RK928vxvxcoNK8/7uwT7Q2DJZP1dnJmyMAJPwOF0yr8PPwqdpyw33lUpCfrJ765bOs5XNa4KSfUDWFSw== dependencies: "@babel/helper-function-name" "^7.10.4" - "@babel/helper-member-expression-to-functions" "^7.10.5" + "@babel/helper-member-expression-to-functions" "^7.12.0" "@babel/helper-optimise-call-expression" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" - "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-replace-supers" "^7.12.0" "@babel/helper-split-export-declaration" "^7.10.4" "@babel/helper-create-regexp-features-plugin@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.10.4.tgz#fdd60d88524659a0b6959c0579925e425714f3b8" - integrity sha512-2/hu58IEPKeoLF45DBwx3XFqsbCXmkdAay4spVr2x0jYgRxrSNp+ePwvSsy9g6YSaNDcKIQVPXk1Ov8S2edk2g== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.0.tgz#858cef57039f3b3a9012273597288a71e1dff8ca" + integrity sha512-YBqH+3wLcom+tko8/JLgRcG8DMqORgmjqNRNI751gTioJSZHWFybO1mRoLtJtWIlYSHY+zT9LqqnbbK1c3KIVQ== dependencies: "@babel/helper-annotate-as-pure" "^7.10.4" "@babel/helper-regex" "^7.10.4" - regexpu-core "^4.7.0" + regexpu-core "^4.7.1" "@babel/helper-define-map@^7.10.4": version "7.10.5" @@ -135,12 +130,12 @@ dependencies: "@babel/types" "^7.10.4" -"@babel/helper-member-expression-to-functions@^7.10.4", "@babel/helper-member-expression-to-functions@^7.10.5": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz#ae69c83d84ee82f4b42f96e2a09410935a8f26df" - integrity sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q== +"@babel/helper-member-expression-to-functions@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.0.tgz#48f605fa801764f3e5b2e301e49d35fe1820c4f3" + integrity sha512-I0d/bgzgzgLsJMk7UZ0TN2KV3OGjC/t/9Saz8PKb9jrcEAXhgjGysOgp4PDKydIKjUv/gj2St4ae+ov8l+T9Xg== dependencies: - "@babel/types" "^7.11.0" + "@babel/types" "^7.12.0" "@babel/helper-module-imports@^7.10.4": version "7.10.4" @@ -149,17 +144,19 @@ dependencies: "@babel/types" "^7.10.4" -"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359" - integrity sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg== +"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.0.tgz#8ac7d9e8716f94549a42e577c5429391950e33f3" + integrity sha512-1ZTMoCiLSzTJLbq7mSaTHki4oIrBIf/dUbzdhwTrvtMU3ZNVKwQmGae3gSiqppo7G8HAgnXmc43rfEaD8yYLLQ== dependencies: "@babel/helper-module-imports" "^7.10.4" - "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-replace-supers" "^7.12.0" "@babel/helper-simple-access" "^7.10.4" "@babel/helper-split-export-declaration" "^7.11.0" + "@babel/helper-validator-identifier" "^7.10.4" "@babel/template" "^7.10.4" - "@babel/types" "^7.11.0" + "@babel/traverse" "^7.12.0" + "@babel/types" "^7.12.0" lodash "^4.17.19" "@babel/helper-optimise-call-expression@^7.10.4": @@ -191,15 +188,15 @@ "@babel/template" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/helper-replace-supers@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz#d585cd9388ea06e6031e4cd44b6713cbead9e6cf" - integrity sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A== +"@babel/helper-replace-supers@^7.10.4", "@babel/helper-replace-supers@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.0.tgz#98d3f3eb779752e59c7422ab387c9b444323be60" + integrity sha512-9kycFdq2c9e7PXZOr2z/ZqTFF9OzFu287iFwYS+CiDVPuoTCfY8hoTsIqNQNetQjlqoRsRyJFrMG1uhGAR4EEw== dependencies: - "@babel/helper-member-expression-to-functions" "^7.10.4" + "@babel/helper-member-expression-to-functions" "^7.12.0" "@babel/helper-optimise-call-expression" "^7.10.4" - "@babel/traverse" "^7.10.4" - "@babel/types" "^7.10.4" + "@babel/traverse" "^7.12.0" + "@babel/types" "^7.12.0" "@babel/helper-simple-access@^7.10.4": version "7.10.4" @@ -228,6 +225,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== +"@babel/helper-validator-option@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.0.tgz#1d1fc48a9b69763da61b892774b0df89aee1c969" + integrity sha512-NRfKaAQw/JCMsTFUdJI6cp4MoJGGVBRQTRSiW1nwlGldNqzjB9jqWI0SZqQksC724dJoKqwG+QqfS9ib7SoVsw== + "@babel/helper-wrap-function@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87" @@ -256,10 +258,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.10.4", "@babel/parser@^7.11.5": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037" - integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q== +"@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.10.4", "@babel/parser@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.0.tgz#2ad388f3960045b22f9b7d4bf85e80b15a1c9e3a" + integrity sha512-dYmySMYnlus2jwl7JnnajAj11obRStZoW9cG04wh4ZuhozDn11tDUrhHcUZ9iuNHqALAhh60XqNaYXpvuuE/Gg== "@babel/plugin-proposal-async-generator-functions@^7.10.4": version "7.10.5" @@ -286,10 +288,10 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/plugin-proposal-export-namespace-from@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.10.4.tgz#570d883b91031637b3e2958eea3c438e62c05f54" - integrity sha512-aNdf0LY6/3WXkhh0Fdb6Zk9j1NMD8ovj3F6r0+3j837Pn1S1PdNtcwJ5EG9WkVPNHPxyJDaxMaAOVq4eki0qbg== +"@babel/plugin-proposal-export-namespace-from@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.0.tgz#08b0f8100bbae1199a5f5294f38a1b0b8d8402fc" + integrity sha512-ao43U2ptSe+mIZAQo2nBV5Wx2Ie3i2XbLt8jCXZpv+bvLY1Twv0lak4YZ1Ps5OwbeLMAl3iOVScgGMOImBae1g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" @@ -302,26 +304,26 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.0" -"@babel/plugin-proposal-logical-assignment-operators@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.11.0.tgz#9f80e482c03083c87125dee10026b58527ea20c8" - integrity sha512-/f8p4z+Auz0Uaf+i8Ekf1iM7wUNLcViFUGiPxKeXvxTSl63B875YPiVdUDdem7hREcI0E0kSpEhS8tF5RphK7Q== +"@babel/plugin-proposal-logical-assignment-operators@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.0.tgz#830d8ff4984d800b2824e8eac0005ecb7430328e" + integrity sha512-dssjXHzdMQal4q6GCSwDTVPEbyBLdd9+7aSlzAkQbrGEKq5xG8pvhQ7u2ktUrCLRmzQphZnSzILBL5ta4xSRlA== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" -"@babel/plugin-proposal-nullish-coalescing-operator@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.4.tgz#02a7e961fc32e6d5b2db0649e01bf80ddee7e04a" - integrity sha512-wq5n1M3ZUlHl9sqT2ok1T2/MTt6AXE0e1Lz4WzWBr95LsAZ5qDXe4KnFuauYyEyLiohvXFMdbsOTMyLZs91Zlw== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.0.tgz#d82174a531305df4d7079ce3782269b35b810b82" + integrity sha512-JpNWix2VP2ue31r72fKytTE13nPX1fxl1mudfTaTwcDhl3iExz5NZjQBq012b/BQ6URWoc/onI73pZdYlAfihg== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" -"@babel/plugin-proposal-numeric-separator@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.10.4.tgz#ce1590ff0a65ad12970a609d78855e9a4c1aef06" - integrity sha512-73/G7QoRoeNkLZFxsoCCvlg4ezE4eM+57PnOqgaPOozd5myfj7p0muD1mRVJvbUWbOzD+q3No2bWbaKy+DJ8DA== +"@babel/plugin-proposal-numeric-separator@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.0.tgz#76de244152abaf2e72800ab0aebc9771f6de3e9a" + integrity sha512-iON65YmIy/IpEgteYJ4HfO2q30SLdIxiyjNNlsSjSl0tUxLhSH9PljE5r6sczwdW64ZZzznYNcezdcROB+rDDw== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-numeric-separator" "^7.10.4" @@ -343,10 +345,10 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" -"@babel/plugin-proposal-optional-chaining@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.11.0.tgz#de5866d0646f6afdaab8a566382fe3a221755076" - integrity sha512-v9fZIu3Y8562RRwhm1BbMRxtqZNFmFA2EG+pT2diuU8PT3H6T/KXoZ54KgYisfOFZHV6PfvAiBIZ9Rcz+/JCxA== +"@babel/plugin-proposal-optional-chaining@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.0.tgz#0159b549f165016fc9f284b8607a58a37a3b71fe" + integrity sha512-CXu9aw32FH/MksqdKvhpiH8pSvxnXJ33E7I7BGNE9VzNRpWgpNzvPpds/tW9E0pjmX9+D1zAHRyHbtyeTboo2g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" @@ -617,14 +619,15 @@ "@babel/helper-simple-access" "^7.10.4" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.10.4": - version "7.10.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz#6270099c854066681bae9e05f87e1b9cadbe8c85" - integrity sha512-f4RLO/OL14/FP1AEbcsWMzpbUz6tssRaeQg11RH1BP/XnPpRoVwgeYViMFacnkaw4k4wjRSjn3ip1Uw9TaXuMw== +"@babel/plugin-transform-modules-systemjs@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.0.tgz#bca842db6980cfc98ae7d0f2c907c9b1df3f874e" + integrity sha512-h2fDMnwRwBiNMmTGAWqUo404Z3oLbrPE6hyATecyIbsEsrbM5gjLbfKQLb6hjiouMlGHH+yliYBbc4NPgWKE/g== dependencies: "@babel/helper-hoist-variables" "^7.10.4" - "@babel/helper-module-transforms" "^7.10.5" + "@babel/helper-module-transforms" "^7.12.0" "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-validator-identifier" "^7.10.4" babel-plugin-dynamic-import-node "^2.3.3" "@babel/plugin-transform-modules-umd@^7.10.4": @@ -724,12 +727,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-typescript@^7.10.4": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.11.0.tgz#2b4879676af37342ebb278216dd090ac67f13abb" - integrity sha512-edJsNzTtvb3MaXQwj8403B7mZoGu9ElDJQZOKjGUnvilquxBA3IQoEIOvkX/1O8xfAsnHS/oQhe2w/IXrr+w0w== +"@babel/plugin-transform-typescript@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.0.tgz#bd6422833a56e4268d8d599238f0b3c5e170078a" + integrity sha512-gahRNAWgE76hjI3TZPVEfV7vGjOCJi5ACd4eSoAItk/ErC114i2UHnk+1ScS2dOour0p6J6kB99hNFX2vzL2Ww== dependencies: - "@babel/helper-create-class-features-plugin" "^7.10.5" + "@babel/helper-create-class-features-plugin" "^7.12.0" "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-typescript" "^7.10.4" @@ -749,25 +752,26 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/preset-env@^7.1.6", "@babel/preset-env@^7.11.0": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.11.5.tgz#18cb4b9379e3e92ffea92c07471a99a2914e4272" - integrity sha512-kXqmW1jVcnB2cdueV+fyBM8estd5mlNfaQi6lwLgRwCby4edpavgbFhiBNjmWA3JpB/yZGSISa7Srf+TwxDQoA== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.12.0.tgz#7d2d0c4f4a14ca0fd7d905a741070ab4745177b7" + integrity sha512-jSIHvHSuF+hBUIrvA2/61yIzhH+ceLOXGLTH1nwPvQlso/lNxXsoE/nvrCzY5M77KRzhKegB1CvdhWPZmYDZ5A== dependencies: - "@babel/compat-data" "^7.11.0" - "@babel/helper-compilation-targets" "^7.10.4" + "@babel/compat-data" "^7.12.0" + "@babel/helper-compilation-targets" "^7.12.0" "@babel/helper-module-imports" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-validator-option" "^7.12.0" "@babel/plugin-proposal-async-generator-functions" "^7.10.4" "@babel/plugin-proposal-class-properties" "^7.10.4" "@babel/plugin-proposal-dynamic-import" "^7.10.4" - "@babel/plugin-proposal-export-namespace-from" "^7.10.4" + "@babel/plugin-proposal-export-namespace-from" "^7.12.0" "@babel/plugin-proposal-json-strings" "^7.10.4" - "@babel/plugin-proposal-logical-assignment-operators" "^7.11.0" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.10.4" - "@babel/plugin-proposal-numeric-separator" "^7.10.4" + "@babel/plugin-proposal-logical-assignment-operators" "^7.12.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.12.0" + "@babel/plugin-proposal-numeric-separator" "^7.12.0" "@babel/plugin-proposal-object-rest-spread" "^7.11.0" "@babel/plugin-proposal-optional-catch-binding" "^7.10.4" - "@babel/plugin-proposal-optional-chaining" "^7.11.0" + "@babel/plugin-proposal-optional-chaining" "^7.12.0" "@babel/plugin-proposal-private-methods" "^7.10.4" "@babel/plugin-proposal-unicode-property-regex" "^7.10.4" "@babel/plugin-syntax-async-generators" "^7.8.0" @@ -798,7 +802,7 @@ "@babel/plugin-transform-member-expression-literals" "^7.10.4" "@babel/plugin-transform-modules-amd" "^7.10.4" "@babel/plugin-transform-modules-commonjs" "^7.10.4" - "@babel/plugin-transform-modules-systemjs" "^7.10.4" + "@babel/plugin-transform-modules-systemjs" "^7.12.0" "@babel/plugin-transform-modules-umd" "^7.10.4" "@babel/plugin-transform-named-capturing-groups-regex" "^7.10.4" "@babel/plugin-transform-new-target" "^7.10.4" @@ -815,11 +819,9 @@ "@babel/plugin-transform-unicode-escapes" "^7.10.4" "@babel/plugin-transform-unicode-regex" "^7.10.4" "@babel/preset-modules" "^0.1.3" - "@babel/types" "^7.11.5" + "@babel/types" "^7.12.0" browserslist "^4.12.0" core-js-compat "^3.6.2" - invariant "^2.2.2" - levenary "^1.1.1" semver "^5.5.0" "@babel/preset-flow@^7.0.0": @@ -842,17 +844,17 @@ esutils "^2.0.2" "@babel/preset-typescript@^7.1.0": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.10.4.tgz#7d5d052e52a682480d6e2cc5aa31be61c8c25e36" - integrity sha512-SdYnvGPv+bLlwkF2VkJnaX/ni1sMNetcGI1+nThF1gyv6Ph8Qucc4ZZAjM5yZcE/AKRXIOTZz7eSRDWOEjPyRQ== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.12.0.tgz#3fe6b4958ca6fb0e086dc5574a27d0ced99185e8" + integrity sha512-2XVy4sy/zkP4gqmXW0TzSh/QwOniN2Cy3srhsD0TRBlMTOmjaYnWCWA6aWopwpcwfYkEKD6jKLLjYMq15zDNWg== dependencies: "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-transform-typescript" "^7.10.4" + "@babel/plugin-transform-typescript" "^7.12.0" "@babel/register@^7.0.0": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.11.5.tgz#79becf89e0ddd0fba8b92bc279bc0f5d2d7ce2ea" - integrity sha512-CAml0ioKX+kOAvBQDHa/+t1fgOt3qkTIz0TrRtRAT6XY0m5qYZXR85k6/sLCNPMGhYDlCFHCYuU0ybTJbvlC6w== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.12.0.tgz#fa5fa900bd79380ff508ae963a5766172d3a9e56" + integrity sha512-2F2v0qYSAwrGyK9mZ8lIoUluHRzLTgkJ2oRXlLV9GVe/ze/sTFBiOocLRMSJYDB2lLiABlVC+pZHlZ8qihO1Xg== dependencies: find-cache-dir "^2.0.0" lodash "^4.17.19" @@ -861,9 +863,9 @@ source-map-support "^0.5.16" "@babel/runtime@^7.11.2", "@babel/runtime@^7.8.4": - version "7.11.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736" - integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw== + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.0.tgz#98bd7666186969c04be893d747cf4a6c6c8fa6b0" + integrity sha512-lS4QLXQ2Vbw2ubfQjeQcn+BZgZ5+ROHW9f+DWjEp5Y+NHYmkRGKqHSJ1tuhbUauKu2nhZNTBIvsIQ8dXfY5Gjw== dependencies: regenerator-runtime "^0.13.4" @@ -876,25 +878,25 @@ "@babel/parser" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.11.5": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.11.5.tgz#be777b93b518eb6d76ee2e1ea1d143daa11e61c3" - integrity sha512-EjiPXt+r7LiCZXEfRpSJd+jUMnBd4/9OUv7Nx3+0u9+eimMwJmG0Q98lw4/289JCoxSE8OolDMNZaaF/JZ69WQ== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.12.0": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.0.tgz#ed31953d6e708cdd34443de2fcdb55f72cdfb266" + integrity sha512-ZU9e79xpOukCNPkQ1UzR4gJKCruGckr6edd8v8lmKpSk8iakgUIvb+5ZtaKKV9f7O+x5r+xbMDDIbzVpUoiIuw== dependencies: "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.11.5" + "@babel/generator" "^7.12.0" "@babel/helper-function-name" "^7.10.4" "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.11.5" - "@babel/types" "^7.11.5" + "@babel/parser" "^7.12.0" + "@babel/types" "^7.12.0" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d" - integrity sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q== +"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.12.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.12.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.0.tgz#b6b49f425ee59043fbc89c61b11a13d5eae7b5c6" + integrity sha512-ggIyFmT2zMaYRheOfPDQ4gz7QqV3B+t2rjqjbttDJxMcb7/LukvWCmlIl1sWcOxrvwpTDd+z0OytzqsbGeb3/g== dependencies: "@babel/helper-validator-identifier" "^7.10.4" lodash "^4.17.19" @@ -4690,9 +4692,9 @@ ejs@^3.0.1: jake "^10.6.1" electron-to-chromium@^1.3.571: - version "1.3.578" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.578.tgz#e6671936f4571a874eb26e2e833aa0b2c0b776e0" - integrity sha512-z4gU6dA1CbBJsAErW5swTGAaU2TBzc2mPAonJb00zqW1rOraDo2zfBMDRvaz9cVic+0JEZiYbHWPw/fTaZlG2Q== + version "1.3.579" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.579.tgz#58bf17499de6edf697e1442017d8569bce0d301a" + integrity sha512-9HaGm4UDxCtcmIqWWdv79pGgpRZWTqr+zg6kxp0MelSHfe1PNjrI8HXy1HgTSy4p0iQETGt8/ElqKFLW008BSA== elegant-spinner@^1.0.1: version "1.0.1" @@ -4841,9 +4843,9 @@ es6-promisify@^5.0.0: es6-promise "^4.0.3" escalade@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e" - integrity sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig== + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== escape-html@~1.0.3: version "1.0.3" @@ -6492,13 +6494,6 @@ interpret@^2.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== -invariant@^2.2.2, invariant@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== - dependencies: - loose-envify "^1.0.0" - invert-kv@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" @@ -7351,7 +7346,7 @@ jest@^25.2.3: import-local "^3.0.2" jest-cli "^25.5.4" -"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: +js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== @@ -7602,13 +7597,6 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== -levenary@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/levenary/-/levenary-1.1.1.tgz#842a9ee98d2075aa7faeedbe32679e9205f46f77" - integrity sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ== - dependencies: - leven "^3.1.0" - levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -7880,13 +7868,6 @@ lolex@^5.0.0: dependencies: "@sinonjs/commons" "^1.7.0" -loose-envify@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" @@ -8457,9 +8438,9 @@ mz@^2.5.0: thenify-all "^1.0.0" nan@^2.12.1: - version "2.14.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" - integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw== + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== nanomatch@^1.2.9: version "1.2.13" @@ -9792,7 +9773,7 @@ regexpp@^3.0.0: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== -regexpu-core@^4.7.0: +regexpu-core@^4.7.1: version "4.7.1" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.1.tgz#2dea5a9a07233298fbf0db91fa9abc4c6e0f8ad6" integrity sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==