From e351d1d0d3a63731b64aa0f4de44bf7861960018 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2019 12:54:58 +0000 Subject: [PATCH 1/2] chore(deps-dev): bump prettier from 1.18.2 to 1.19.1 Bumps [prettier](https://github.com/prettier/prettier) from 1.18.2 to 1.19.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/1.18.2...1.19.1) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 781a8b165..cad9efa99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4892,9 +4892,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@^1.14.3, prettier@^1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== pretty-format@^24.8.0, pretty-format@^24.9.0: version "24.9.0" From 497b65e122b24c93e5f0c84049de7c698678172b Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 15 Nov 2019 10:20:45 +0100 Subject: [PATCH 2/2] run prettier --- declarations/WebpackOptions.d.ts | 15 +++--- declarations/plugins/WatchIgnorePlugin.d.ts | 2 +- lib/CommonJsStuffPlugin.js | 49 +++++++++---------- lib/CompatibilityPlugin.js | 4 +- lib/HotModuleReplacementPlugin.js | 4 +- lib/TemplatedPathPlugin.js | 4 +- lib/dependencies/HarmonyImportDependency.js | 3 +- lib/optimize/MangleExportsPlugin.js | 5 +- lib/runtime/EnsureChunkRuntimeModule.js | 17 +++---- .../AsyncWebAssemblyJavascriptGenerator.js | 4 +- open-bot.yaml | 4 +- setup/setup.js | 5 +- 12 files changed, 59 insertions(+), 57 deletions(-) diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 5fc44cedc..9b29e2ef2 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -27,7 +27,7 @@ export type EntryStatic = EntryObject | EntryItem; * This interface was referenced by `WebpackOptions`'s JSON-Schema * via the `definition` "NonEmptyArrayOfUniqueStringValues". */ -export type NonEmptyArrayOfUniqueStringValues = [string, ...(string)[]]; +export type NonEmptyArrayOfUniqueStringValues = [string, ...string[]]; /** * This interface was referenced by `WebpackOptions`'s JSON-Schema * via the `definition` "EntryItem". @@ -50,7 +50,8 @@ export type Externals = request: string, callback: (err?: Error, result?: string) => void ) => void) - | ExternalItem)[]; + | ExternalItem + )[]; /** * This interface was referenced by `WebpackOptions`'s JSON-Schema * via the `definition` "ExternalItem". @@ -412,7 +413,8 @@ export interface WebpackOptions { | "normal" | "detailed" | "verbose" - | "errors-warnings"); + | "errors-warnings" + ); /** * Environment to build for */ @@ -425,7 +427,8 @@ export interface WebpackOptions { | "node-webkit" | "electron-main" | "electron-renderer" - | "electron-preload") + | "electron-preload" + ) | ((compiler: import("../lib/Compiler")) => void); /** * Enter watch mode, which rebuilds on file change. @@ -594,10 +597,10 @@ export interface ModuleOptions { * Don't parse files matching. It's matched against the full resolved request. */ noParse?: - | [RegExp, ...(RegExp)[]] + | [RegExp, ...RegExp[]] | RegExp | Function - | [string, ...(string)[]] + | [string, ...string[]] | string; /** * An array of rules applied for modules. diff --git a/declarations/plugins/WatchIgnorePlugin.d.ts b/declarations/plugins/WatchIgnorePlugin.d.ts index 5b11c3cfe..b57c1a20b 100644 --- a/declarations/plugins/WatchIgnorePlugin.d.ts +++ b/declarations/plugins/WatchIgnorePlugin.d.ts @@ -8,5 +8,5 @@ export interface WatchIgnorePluginOptions { /** * A list of RegExps or absolute paths to directories or files that should be ignored */ - paths: [(string | RegExp), ...(string | RegExp)[]]; + paths: [string | RegExp, ...(string | RegExp)[]]; } diff --git a/lib/CommonJsStuffPlugin.js b/lib/CommonJsStuffPlugin.js index cc168c7fc..b1601cc79 100644 --- a/lib/CommonJsStuffPlugin.js +++ b/lib/CommonJsStuffPlugin.js @@ -149,12 +149,10 @@ class CommonJsStuffPlugin { ])(expr); } }); - parser.hooks.evaluateIdentifier - .for("module.hot") - .tap( - "CommonJsStuffPlugin", - evaluateToIdentifier("module.hot", "module", () => ["hot"], false) - ); + parser.hooks.evaluateIdentifier.for("module.hot").tap( + "CommonJsStuffPlugin", + evaluateToIdentifier("module.hot", "module", () => ["hot"], false) + ); parser.hooks.expression .for("module") .tap("CommonJsStuffPlugin", expr => { @@ -236,26 +234,25 @@ class NodeModuleDecoratorRuntimeModule extends RuntimeModule { generate() { const { runtimeTemplate } = this.compilation; return Template.asString([ - `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction( - "module", - [ - "module.paths = [];", - "if (!module.children) module.children = [];", - "Object.defineProperty(module, 'loaded', {", - Template.indent([ - "enumerable: true,", - `get: ${runtimeTemplate.returningFunction("module.l")}` - ]), - "});", - "Object.defineProperty(module, 'id', {", - Template.indent([ - "enumerable: true,", - `get: ${runtimeTemplate.returningFunction("module.i")}` - ]), - "});", - "return module;" - ] - )};` + `${ + RuntimeGlobals.nodeModuleDecorator + } = ${runtimeTemplate.basicFunction("module", [ + "module.paths = [];", + "if (!module.children) module.children = [];", + "Object.defineProperty(module, 'loaded', {", + Template.indent([ + "enumerable: true,", + `get: ${runtimeTemplate.returningFunction("module.l")}` + ]), + "});", + "Object.defineProperty(module, 'id', {", + Template.indent([ + "enumerable: true,", + `get: ${runtimeTemplate.returningFunction("module.i")}` + ]), + "});", + "return module;" + ])};` ]); } } diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js index 86ab92b56..529e7f71b 100644 --- a/lib/CompatibilityPlugin.js +++ b/lib/CompatibilityPlugin.js @@ -76,9 +76,7 @@ class CompatibilityPlugin { statement.id && statement.id.name === "__webpack_require__" ) { - const newName = `__nested_webpack_require_${ - statement.range[0] - }__`; + const newName = `__nested_webpack_require_${statement.range[0]}__`; const dep = new ConstDependency(newName, statement.id.range); dep.loc = statement.id.loc; parser.state.module.addPresentationalDependency(dep); diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 146cca645..6d51b0e34 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -234,7 +234,9 @@ class HotModuleReplacementPlugin { } records.chunkModuleIds = {}; for (const chunk of compilation.chunks) { - records.chunkModuleIds[chunk.id] = Array.from( + records.chunkModuleIds[ + chunk.id + ] = Array.from( chunkGraph.getOrderedChunkModulesIterable( chunk, compareModulesById(chunkGraph) diff --git a/lib/TemplatedPathPlugin.js b/lib/TemplatedPathPlugin.js index ff74075a5..28572e031 100644 --- a/lib/TemplatedPathPlugin.js +++ b/lib/TemplatedPathPlugin.js @@ -22,9 +22,7 @@ const prepareId = id => { if (/^"\s\+*.*\+\s*"$/.test(id)) { const match = /^"\s\+*\s*(.*)\s*\+\s*"$/.exec(id); - return `" + (${ - match[1] - } + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; + return `" + (${match[1]} + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; } return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index ad62db4c4..0176afec0 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -100,7 +100,8 @@ class HarmonyImportDependency extends ModuleDependency { // It's not an harmony module if ( moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule && - (ids.length > 0 && ids[0] !== "default") + ids.length > 0 && + ids[0] !== "default" ) { // In strict harmony modules we only support the default export return [ diff --git a/lib/optimize/MangleExportsPlugin.js b/lib/optimize/MangleExportsPlugin.js index 3e746e5ca..d0669f60a 100644 --- a/lib/optimize/MangleExportsPlugin.js +++ b/lib/optimize/MangleExportsPlugin.js @@ -42,7 +42,10 @@ const canMangle = (exportsInfo, canBeArray) => { const comparator = concatComparators( // Sort used before unused fields - compareSelect(e => e.used !== false, (a, b) => (a === b ? 0 : a ? -1 : 1)), + compareSelect( + e => e.used !== false, + (a, b) => (a === b ? 0 : a ? -1 : 1) + ), // Sort by name compareSelect(e => e.name, compareStringsNumeric) ); diff --git a/lib/runtime/EnsureChunkRuntimeModule.js b/lib/runtime/EnsureChunkRuntimeModule.js index 16320c327..f18836f22 100644 --- a/lib/runtime/EnsureChunkRuntimeModule.js +++ b/lib/runtime/EnsureChunkRuntimeModule.js @@ -26,15 +26,14 @@ class EnsureChunkRuntimeModule extends RuntimeModule { `${handlers} = {};`, "// This file contains only the entry chunk.", "// The chunk loading function for additional chunks", - `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.basicFunction( - "chunkId", - [ - `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( - "promises, key", - [`${handlers}[key](chunkId, promises);`, "return promises;"] - )}, []));` - ] - )};` + `${ + RuntimeGlobals.ensureChunk + } = ${runtimeTemplate.basicFunction("chunkId", [ + `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( + "promises, key", + [`${handlers}[key](chunkId, promises);`, "return promises;"] + )}, []));` + ])};` ]); } else { // There ensureChunk is used somewhere in the tree, so we need an empty requireEnsure diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index 00b63bac7..5a2b43bcd 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -154,9 +154,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { ", " )}]) { return ${instantiateCall}; })` : promises.length === 1 - ? `${module.moduleArgument}.exports = Promise.resolve(${ - promises[0] - }).then(function(${promises[0]}) { return ${instantiateCall}; })` + ? `${module.moduleArgument}.exports = Promise.resolve(${promises[0]}).then(function(${promises[0]}) { return ${instantiateCall}; })` : `${module.moduleArgument}.exports = ${instantiateCall}` ]) ); diff --git a/open-bot.yaml b/open-bot.yaml index af714d979..c548214a8 100644 --- a/open-bot.yaml +++ b/open-bot.yaml @@ -660,9 +660,9 @@ rules: title: "Backport to webpack 4: {{{pull_request.title}}}" body: |- {{{pull_request.html_url}}} needs to be backported to webpack 4. - + Send a PR. - + cc @{{pull_request.user.login}} comment: identifier: admin-action-webpack-4-backport-executed diff --git a/setup/setup.js b/setup/setup.js index eeb17422c..f4e062c08 100644 --- a/setup/setup.js +++ b/setup/setup.js @@ -49,7 +49,10 @@ function checkSymlinkExistsAsync() { function ensureYarnInstalledAsync() { const semverPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/; return execGetOutput("yarn", ["-v"], "Check yarn version") - .then(stdout => semverPattern.test(stdout), () => false) + .then( + stdout => semverPattern.test(stdout), + () => false + ) .then(hasYarn => hasYarn || installYarnAsync()); }