From 4de0f97596d52a7182ac108a9b9865462fca54fe Mon Sep 17 00:00:00 2001 From: Alexey Lavinsky Date: Tue, 12 Jan 2021 21:40:18 +0300 Subject: [PATCH] fix: output `stats` to `stdout` instead `stdout` --- jest.config.js | 3 +- package-lock.json | 1302 ++++----- package.json | 10 +- src/utils/setupHooks.js | 96 +- .../logging.test.js.snap.webpack4 | 287 ++ .../logging.test.js.snap.webpack5 | 263 ++ test/__snapshots__/middleware.test.js.snap | 1261 --------- ... validation-options.test.js.snap.webpack4} | 0 .../validation-options.test.js.snap.webpack5 | 88 + test/api.test.js | 72 +- test/fixtures/webpack.array.config.js | 4 +- ...rror-one-warning-one-success-with-names.js | 6 +- ...array.one-error-one-warning-one-success.js | 6 +- test/fixtures/webpack.config.js | 2 +- .../webpack.stats-colors-false.config.js | 28 + .../webpack.stats-colors-true.config.js | 28 + test/fixtures/webpack.stats-false.config.js | 26 + test/fixtures/webpack.stats-minimal.config.js | 26 + test/fixtures/webpack.stats-none.config.js | 26 + test/fixtures/webpack.stats-object.config.js | 26 + test/fixtures/webpack.stats-true.config.js | 26 + test/fixtures/webpack.stats-verbose.config.js | 26 + test/helpers/GetLogsPlugin.js | 50 - test/helpers/clearDirectory.js | 26 + test/helpers/getCompilerHooks.js | 2 +- test/helpers/runner.js | 130 + test/helpers/snapshotResolver.js | 28 + test/logging.test.js | 763 ++++++ test/middleware.test.js | 2321 ++++++----------- ... handleRangeHeaders.test.js.snap.webpack4} | 0 .../handleRangeHeaders.test.js.snap.webpack5 | 61 + .../__snapshots__/setupHooks.test.js.snap | 39 - .../setupHooks.test.js.snap.webpack4 | 9 + .../setupHooks.test.js.snap.webpack5 | 9 + ...=> setupWriteToDisk.test.js.snap.webpack4} | 0 .../setupWriteToDisk.test.js.snap.webpack5 | 55 + test/utils/getFilenameFromUrl.test.js | 4 +- test/utils/getPaths.test.js | 3 + test/utils/setupHooks.test.js | 12 +- test/utils/setupOutputFileSystem.test.js | 1 + test/validation-options.test.js | 3 + 41 files changed, 3526 insertions(+), 3602 deletions(-) create mode 100644 test/__snapshots__/logging.test.js.snap.webpack4 create mode 100644 test/__snapshots__/logging.test.js.snap.webpack5 delete mode 100644 test/__snapshots__/middleware.test.js.snap rename test/__snapshots__/{validation-options.test.js.snap => validation-options.test.js.snap.webpack4} (100%) create mode 100644 test/__snapshots__/validation-options.test.js.snap.webpack5 create mode 100644 test/fixtures/webpack.stats-colors-false.config.js create mode 100644 test/fixtures/webpack.stats-colors-true.config.js create mode 100644 test/fixtures/webpack.stats-false.config.js create mode 100644 test/fixtures/webpack.stats-minimal.config.js create mode 100644 test/fixtures/webpack.stats-none.config.js create mode 100644 test/fixtures/webpack.stats-object.config.js create mode 100644 test/fixtures/webpack.stats-true.config.js create mode 100644 test/fixtures/webpack.stats-verbose.config.js delete mode 100644 test/helpers/GetLogsPlugin.js create mode 100644 test/helpers/clearDirectory.js create mode 100755 test/helpers/runner.js create mode 100644 test/helpers/snapshotResolver.js create mode 100644 test/logging.test.js rename test/utils/__snapshots__/{handleRangeHeaders.test.js.snap => handleRangeHeaders.test.js.snap.webpack4} (100%) create mode 100644 test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack5 delete mode 100644 test/utils/__snapshots__/setupHooks.test.js.snap create mode 100644 test/utils/__snapshots__/setupHooks.test.js.snap.webpack4 create mode 100644 test/utils/__snapshots__/setupHooks.test.js.snap.webpack5 rename test/utils/__snapshots__/{setupWriteToDisk.test.js.snap => setupWriteToDisk.test.js.snap.webpack4} (100%) create mode 100644 test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack5 diff --git a/jest.config.js b/jest.config.js index a891025a3..4619a0cd3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,8 @@ -'use strict'; - module.exports = { collectCoverage: false, coveragePathIgnorePatterns: ['test', '/node_modules'], moduleFileExtensions: ['js', 'json'], testMatch: ['**/test/**/*.test.js'], setupFilesAfterEnv: ['/setupTest.js'], + snapshotResolver: './test/helpers/snapshotResolver.js', }; diff --git a/package-lock.json b/package-lock.json index 26a9dfd4b..03d2594d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,9 +23,9 @@ } }, "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" @@ -60,62 +60,6 @@ "source-map": "^0.5.0" }, "dependencies": { - "@babel/generator": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.10.tgz", - "integrity": "sha512-6mCdfhWgmqLdtTkhXjnIz0LcdVCd26wS2JXRtj2XY0u5klDsXBREA/pG5NVOuVnF2LUrBGNFtQkIqqTbblg0ww==", - "dev": true, - "requires": { - "@babel/types": "^7.12.10", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/parser": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.10.tgz", - "integrity": "sha512-PJdRPwyoOqFAWfLytxrWwGrAxghCgh/yTNCYciOz8QgjflA7aZhECPZAa2VUedKg2+QMWkI0L9lynh2SNmNEgA==", - "dev": true - }, - "@babel/template": { - "version": "7.12.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz", - "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.12.7", - "@babel/types": "^7.12.7" - } - }, - "@babel/traverse": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.10.tgz", - "integrity": "sha512-6aEtf0IeRgbYWzta29lePeYSk+YAFIC3kyqESeft8o5CkFlYIMX+EQDDWEiAQ9LHOA3d0oHdgrSsID/CKqXJlg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.10", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.12.10", - "@babel/types": "^7.12.10", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - } - }, - "@babel/types": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.10.tgz", - "integrity": "sha512-sf6wboJV5mGyip2hIpDSKsr80RszPinEFjsHTalMxZAZkoQ2/2yQzxlcFN52SJqsyPfLtPmenL4g2KB3KJXPDw==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -134,12 +78,12 @@ } }, "@babel/generator": { - "version": "7.12.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz", - "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.11.tgz", + "integrity": "sha512-Ggg6WPOJtSi8yYQvLVjG8F/TlpWDlKx0OpS4Kt+xMQPs5OaGYWy+v1A+1TvxI6sAMGZpKWWoAQ1DaeQbImlItA==", "dev": true, "requires": { - "@babel/types": "^7.12.5", + "@babel/types": "^7.12.11", "jsesc": "^2.5.1", "source-map": "^0.5.0" } @@ -151,25 +95,6 @@ "dev": true, "requires": { "@babel/types": "^7.12.10" - }, - "dependencies": { - "@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", - "dev": true - }, - "@babel/types": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.11.tgz", - "integrity": "sha512-ukA9SQtKThINm++CX1CwmliMrE54J6nIYB5XTwL5f/CLFW9owfls+YSU8tVW15RQ2w+a3fSbPjC6HdQNtWZkiA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - } } }, "@babel/helper-builder-binary-assignment-operator-visitor": { @@ -238,23 +163,23 @@ } }, "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.11.tgz", + "integrity": "sha512-AtQKjtYNolKNi6nNNVLQ27CP6D9oFR6bq/HPYSizlzbp7uC1M59XJe8L+0uXjbIaZaUJF99ruHqVGiKXU/7ybA==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/helper-get-function-arity": "^7.12.10", + "@babel/template": "^7.12.7", + "@babel/types": "^7.12.11" } }, "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", + "version": "7.12.10", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.10.tgz", + "integrity": "sha512-mm0n5BPjR06wh9mPQaDdXWDoll/j5UpCAPl1x8fS71GHm7HA6Ua2V4ylG1Ju8lvcTOietbPNNPaSilKj+pj+Ag==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.12.10" } }, "@babel/helper-hoist-variables": { @@ -273,19 +198,6 @@ "dev": true, "requires": { "@babel/types": "^7.12.7" - }, - "dependencies": { - "@babel/types": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.10.tgz", - "integrity": "sha512-sf6wboJV5mGyip2hIpDSKsr80RszPinEFjsHTalMxZAZkoQ2/2yQzxlcFN52SJqsyPfLtPmenL4g2KB3KJXPDw==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - } } }, "@babel/helper-module-imports": { @@ -321,19 +233,6 @@ "dev": true, "requires": { "@babel/types": "^7.12.10" - }, - "dependencies": { - "@babel/types": { - "version": "7.12.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.10.tgz", - "integrity": "sha512-sf6wboJV5mGyip2hIpDSKsr80RszPinEFjsHTalMxZAZkoQ2/2yQzxlcFN52SJqsyPfLtPmenL4g2KB3KJXPDw==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - } } }, "@babel/helper-plugin-utils": { @@ -354,15 +253,15 @@ } }, "@babel/helper-replace-supers": { - "version": "7.12.5", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz", - "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.11.tgz", + "integrity": "sha512-q+w1cqmhL7R0FNzth/PLLp2N+scXEK/L2AHbXUyydxp828F4FEa5WcVoqui9vFRiHDQErj9Zof8azP32uGVTRA==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.12.1", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.12.5", - "@babel/types": "^7.12.5" + "@babel/helper-member-expression-to-functions": "^7.12.7", + "@babel/helper-optimise-call-expression": "^7.12.10", + "@babel/traverse": "^7.12.10", + "@babel/types": "^7.12.11" } }, "@babel/helper-simple-access": { @@ -384,18 +283,18 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.11.tgz", + "integrity": "sha512-LsIVN8j48gHgwzfocYUSkO/hjYAOJqlpJEc7tGXcIm4cubjVUf8LGW6eWRyxEu7gA25q02p0rQUWoCI33HNS5g==", "dev": true, "requires": { - "@babel/types": "^7.11.0" + "@babel/types": "^7.12.11" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", "dev": true }, "@babel/helper-validator-option": { @@ -439,15 +338,15 @@ } }, "@babel/parser": { - "version": "7.12.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.5.tgz", - "integrity": "sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.11.tgz", + "integrity": "sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg==", "dev": true }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz", - "integrity": "sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.12.tgz", + "integrity": "sha512-nrz9y0a4xmUrRq51bYkWJIO5SBZyG2ys2qinHsN0zHDHVsUaModrkpyWWWXfGqYQmOL3x9sQIcTNN/pBGpo09A==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.10.4", @@ -733,9 +632,9 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.11.tgz", - "integrity": "sha512-atR1Rxc3hM+VPg/NvNvfYw0npQEAcHuJ+MGZnFn6h3bo+1U3BWXMdFMlvVRApBTWKQMX7SOwRJZA5FBF/JQbvA==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.12.tgz", + "integrity": "sha512-VOEPQ/ExOVqbukuP7BYJtI5ZxxsmegTwzZ04j1aF0dkSypGo9XpDHuOrABsJu+ie+penpSJheDJ11x1BEZNiyQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.10.4" @@ -1088,25 +987,6 @@ "@babel/types": "^7.12.11", "core-js-compat": "^3.8.0", "semver": "^5.5.0" - }, - "dependencies": { - "@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", - "dev": true - }, - "@babel/types": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.11.tgz", - "integrity": "sha512-ukA9SQtKThINm++CX1CwmliMrE54J6nIYB5XTwL5f/CLFW9owfls+YSU8tVW15RQ2w+a3fSbPjC6HdQNtWZkiA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - } } }, "@babel/preset-modules": { @@ -1132,37 +1012,37 @@ } }, "@babel/template": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", - "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", + "version": "7.12.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz", + "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/parser": "^7.12.7", + "@babel/types": "^7.12.7" } }, "@babel/traverse": { - "version": "7.12.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.5.tgz", - "integrity": "sha512-xa15FbQnias7z9a62LwYAA5SZZPkHIXpd42C6uW68o8uTuua96FHZy1y61Va5P/i83FAAcMpW8+A/QayntzuqA==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.12.tgz", + "integrity": "sha512-s88i0X0lPy45RrLM8b9mz8RPH5FqO9G9p7ti59cToE44xFm1Q+Pjh5Gq4SXBbtb88X7Uy7pexeqRIQDDMNkL0w==", "dev": true, "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.5", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.12.5", - "@babel/types": "^7.12.5", + "@babel/code-frame": "^7.12.11", + "@babel/generator": "^7.12.11", + "@babel/helper-function-name": "^7.12.11", + "@babel/helper-split-export-declaration": "^7.12.11", + "@babel/parser": "^7.12.11", + "@babel/types": "^7.12.12", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.19" }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -1177,12 +1057,12 @@ } }, "@babel/types": { - "version": "7.12.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.6.tgz", - "integrity": "sha512-hwyjw6GvjBLiyy3W0YQf0Z5Zf4NpYejUnKFcfcUhZCSffoBBp30w6wP2Wn6pk31jMYZvcOrB/1b7cGXvEoKogA==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.12.tgz", + "integrity": "sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.12.11", "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" } @@ -1542,12 +1422,12 @@ } }, "p-limit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", - "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { - "p-try": "^2.0.0" + "yocto-queue": "^0.1.0" } }, "p-locate": { @@ -2246,28 +2126,28 @@ } }, "@nodelib/fs.scandir": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", - "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", "dev": true, "requires": { - "@nodelib/fs.stat": "2.0.3", + "@nodelib/fs.stat": "2.0.4", "run-parallel": "^1.1.9" } }, "@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", - "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", "dev": true }, "@nodelib/fs.walk": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", - "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", "dev": true, "requires": { - "@nodelib/fs.scandir": "2.1.3", + "@nodelib/fs.scandir": "2.1.4", "fastq": "^1.6.0" } }, @@ -2312,9 +2192,9 @@ } }, "@types/babel__template": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.3.tgz", - "integrity": "sha512-uCoznIPDmnickEi6D0v11SBpW0OuVqHJCa7syXqQHy5uktSCreIlt0iglsCnmvz8yCb38hGcWeseA8cWJSwv5Q==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.0.tgz", + "integrity": "sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -2322,9 +2202,9 @@ } }, "@types/babel__traverse": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.15.tgz", - "integrity": "sha512-Pzh9O3sTK8V6I1olsXpCfj2k/ygO2q1X0vhhnDrEQyYLHZesWz+zMZMVcwXLCYf0U36EtmyYaFGPfXlTtDHe3A==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.11.0.tgz", + "integrity": "sha512-kSjgDMZONiIfSH1Nxcr5JIRMwUetDki63FSQfpTCz8ogF3Ulqm8+mr5f78dUYs6vMiB6gBusQqfQmBvHZj/lwg==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -2423,9 +2303,9 @@ "dev": true }, "@types/node": { - "version": "14.14.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz", - "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw==", + "version": "14.14.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", + "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", "dev": true }, "@types/normalize-package-data": { @@ -2441,9 +2321,9 @@ "dev": true }, "@types/prettier": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.1.5.tgz", - "integrity": "sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.1.6.tgz", + "integrity": "sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA==", "dev": true }, "@types/stack-utils": { @@ -2453,192 +2333,163 @@ "dev": true }, "@types/yargs": { - "version": "15.0.9", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz", - "integrity": "sha512-HmU8SeIRhZCWcnRskCs36Q1Q00KBV6Cqh/ora8WN1+22dY07AZdn6Gel8QZ3t26XYPImtcL8WV/eqjhVmMEw4g==", + "version": "15.0.12", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.12.tgz", + "integrity": "sha512-f+fD/fQAo3BCbCDlrUpznF1A5Zp9rB0noS5vnoormHSIPFKL0Z2DcUJ3Gxp5ytH4uLRNxy7AwYUC9exZzqGMAw==", "dev": true, "requires": { "@types/yargs-parser": "*" } }, "@types/yargs-parser": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", - "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "version": "20.2.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.0.tgz", + "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, "@webassemblyjs/ast": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.1.tgz", - "integrity": "sha512-uMu1nCWn2Wxyy126LlGqRVlhdTOsO/bsBRI4dNq3+6SiSuRKRQX6ejjKgh82LoGAPSq72lDUiQ4FWVaf0PecYw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz", + "integrity": "sha512-kX2W49LWsbthrmIRMbQZuQDhGtjyqXfEmmHyEi4XWnSZtPmxY0+3anPIzsnRb45VH/J55zlOfWvZuY47aJZTJg==", "dev": true, "requires": { - "@webassemblyjs/helper-module-context": "1.9.1", - "@webassemblyjs/helper-wasm-bytecode": "1.9.1", - "@webassemblyjs/wast-parser": "1.9.1" + "@webassemblyjs/helper-numbers": "1.11.0", + "@webassemblyjs/helper-wasm-bytecode": "1.11.0" } }, "@webassemblyjs/floating-point-hex-parser": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.1.tgz", - "integrity": "sha512-5VEKu024RySmLKTTBl9q1eO/2K5jk9ZS+2HXDBLA9s9p5IjkaXxWiDb/+b7wSQp6FRdLaH1IVGIfOex58Na2pg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.0.tgz", + "integrity": "sha512-Q/aVYs/VnPDVYvsCBL/gSgwmfjeCb4LW8+TMrO3cSzJImgv8lxxEPM2JA5jMrivE7LSz3V+PFqtMbls3m1exDA==", "dev": true }, "@webassemblyjs/helper-api-error": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.1.tgz", - "integrity": "sha512-y1lGmfm38djrScwpeL37rRR9f1D6sM8RhMpvM7CYLzOlHVboouZokXK/G88BpzW0NQBSvCCOnW5BFhten4FPfA==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.0.tgz", + "integrity": "sha512-baT/va95eXiXb2QflSx95QGT5ClzWpGaa8L7JnJbgzoYeaA27FCvuBXU758l+KXWRndEmUXjP0Q5fibhavIn8w==", "dev": true }, "@webassemblyjs/helper-buffer": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.1.tgz", - "integrity": "sha512-uS6VSgieHbk/m4GSkMU5cqe/5TekdCzQso4revCIEQ3vpGZgqSSExi4jWpTWwDpAHOIAb1Jfrs0gUB9AA4n71w==", - "dev": true - }, - "@webassemblyjs/helper-code-frame": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.1.tgz", - "integrity": "sha512-ZQ2ZT6Evk4DPIfD+92AraGYaFIqGm4U20e7FpXwl7WUo2Pn1mZ1v8VGH8i+Y++IQpxPbQo/UyG0Khs7eInskzA==", - "dev": true, - "requires": { - "@webassemblyjs/wast-printer": "1.9.1" - } - }, - "@webassemblyjs/helper-fsm": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.1.tgz", - "integrity": "sha512-J32HGpveEqqcKFS0YbgicB0zAlpfIxJa5MjxDxhu3i5ltPcVfY5EPvKQ1suRguFPehxiUs+/hfkwPEXom/l0lw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.0.tgz", + "integrity": "sha512-u9HPBEl4DS+vA8qLQdEQ6N/eJQ7gT7aNvMIo8AAWvAl/xMrcOSiI2M0MAnMCy3jIFke7bEee/JwdX1nUpCtdyA==", "dev": true }, - "@webassemblyjs/helper-module-context": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.1.tgz", - "integrity": "sha512-IEH2cMmEQKt7fqelLWB5e/cMdZXf2rST1JIrzWmf4XBt3QTxGdnnLvV4DYoN8pJjOx0VYXsWg+yF16MmJtolZg==", + "@webassemblyjs/helper-numbers": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.0.tgz", + "integrity": "sha512-DhRQKelIj01s5IgdsOJMKLppI+4zpmcMQ3XboFPLwCpSNH6Hqo1ritgHgD0nqHeSYqofA6aBN/NmXuGjM1jEfQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1" + "@webassemblyjs/floating-point-hex-parser": "1.11.0", + "@webassemblyjs/helper-api-error": "1.11.0", + "@xtuc/long": "4.2.2" } }, "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.1.tgz", - "integrity": "sha512-i2rGTBqFUcSXxyjt2K4vm/3kkHwyzG6o427iCjcIKjOqpWH8SEem+xe82jUk1iydJO250/CvE5o7hzNAMZf0dQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.0.tgz", + "integrity": "sha512-MbmhvxXExm542tWREgSFnOVo07fDpsBJg3sIl6fSp9xuu75eGz5lz31q7wTLffwL3Za7XNRCMZy210+tnsUSEA==", "dev": true }, "@webassemblyjs/helper-wasm-section": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.1.tgz", - "integrity": "sha512-FetqzjtXZr2d57IECK+aId3D0IcGweeM0CbAnJHkYJkcRTHP+YcMb7Wmc0j21h5UWBpwYGb9dSkK/93SRCTrGg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.0.tgz", + "integrity": "sha512-3Eb88hcbfY/FCukrg6i3EH8H2UsD7x8Vy47iVJrP967A9JGqgBVL9aH71SETPx1JrGsOUVLo0c7vMCN22ytJew==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-buffer": "1.9.1", - "@webassemblyjs/helper-wasm-bytecode": "1.9.1", - "@webassemblyjs/wasm-gen": "1.9.1" + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/helper-buffer": "1.11.0", + "@webassemblyjs/helper-wasm-bytecode": "1.11.0", + "@webassemblyjs/wasm-gen": "1.11.0" } }, "@webassemblyjs/ieee754": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.1.tgz", - "integrity": "sha512-EvTG9M78zP1MmkBpUjGQHZc26DzPGZSLIPxYHCjQsBMo60Qy2W34qf8z0exRDtxBbRIoiKa5dFyWer/7r1aaSQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.0.tgz", + "integrity": "sha512-KXzOqpcYQwAfeQ6WbF6HXo+0udBNmw0iXDmEK5sFlmQdmND+tr773Ti8/5T/M6Tl/413ArSJErATd8In3B+WBA==", "dev": true, "requires": { "@xtuc/ieee754": "^1.2.0" } }, "@webassemblyjs/leb128": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.1.tgz", - "integrity": "sha512-Oc04ub0vFfLnF+2/+ki3AE+anmW4sv9uNBqb+79fgTaPv6xJsOT0dhphNfL3FrME84CbX/D1T9XT8tjFo0IIiw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.0.tgz", + "integrity": "sha512-aqbsHa1mSQAbeeNcl38un6qVY++hh8OpCOzxhixSYgbRfNWcxJNJQwe2rezK9XEcssJbbWIkblaJRwGMS9zp+g==", "dev": true, "requires": { "@xtuc/long": "4.2.2" } }, "@webassemblyjs/utf8": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.1.tgz", - "integrity": "sha512-llkYtppagjCodFjo0alWOUhAkfOiQPQDIc5oA6C9sFAXz7vC9QhZf/f8ijQIX+A9ToM3c9Pq85X0EX7nx9gVhg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.0.tgz", + "integrity": "sha512-A/lclGxH6SpSLSyFowMzO/+aDEPU4hvEiooCMXQPcQFPPJaYcPQNKGOCLUySJsYJ4trbpr+Fs08n4jelkVTGVw==", "dev": true }, "@webassemblyjs/wasm-edit": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.1.tgz", - "integrity": "sha512-S2IaD6+x9B2Xi8BCT0eGsrXXd8UxAh2LVJpg1ZMtHXnrDcsTtIX2bDjHi40Hio6Lc62dWHmKdvksI+MClCYbbw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.0.tgz", + "integrity": "sha512-JHQ0damXy0G6J9ucyKVXO2j08JVJ2ntkdJlq1UTiUrIgfGMmA7Ik5VdC/L8hBK46kVJgujkBIoMtT8yVr+yVOQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-buffer": "1.9.1", - "@webassemblyjs/helper-wasm-bytecode": "1.9.1", - "@webassemblyjs/helper-wasm-section": "1.9.1", - "@webassemblyjs/wasm-gen": "1.9.1", - "@webassemblyjs/wasm-opt": "1.9.1", - "@webassemblyjs/wasm-parser": "1.9.1", - "@webassemblyjs/wast-printer": "1.9.1" + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/helper-buffer": "1.11.0", + "@webassemblyjs/helper-wasm-bytecode": "1.11.0", + "@webassemblyjs/helper-wasm-section": "1.11.0", + "@webassemblyjs/wasm-gen": "1.11.0", + "@webassemblyjs/wasm-opt": "1.11.0", + "@webassemblyjs/wasm-parser": "1.11.0", + "@webassemblyjs/wast-printer": "1.11.0" } }, "@webassemblyjs/wasm-gen": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.1.tgz", - "integrity": "sha512-bqWI0S4lBQsEN5FTZ35vYzfKUJvtjNnBobB1agCALH30xNk1LToZ7Z8eiaR/Z5iVECTlBndoRQV3F6mbEqE/fg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.0.tgz", + "integrity": "sha512-BEUv1aj0WptCZ9kIS30th5ILASUnAPEvE3tVMTrItnZRT9tXCLW2LEXT8ezLw59rqPP9klh9LPmpU+WmRQmCPQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-wasm-bytecode": "1.9.1", - "@webassemblyjs/ieee754": "1.9.1", - "@webassemblyjs/leb128": "1.9.1", - "@webassemblyjs/utf8": "1.9.1" + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/helper-wasm-bytecode": "1.11.0", + "@webassemblyjs/ieee754": "1.11.0", + "@webassemblyjs/leb128": "1.11.0", + "@webassemblyjs/utf8": "1.11.0" } }, "@webassemblyjs/wasm-opt": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.1.tgz", - "integrity": "sha512-gSf7I7YWVXZ5c6XqTEqkZjVs8K1kc1k57vsB6KBQscSagDNbAdxt6MwuJoMjsE1yWY1tsuL+pga268A6u+Fdkg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.0.tgz", + "integrity": "sha512-tHUSP5F4ywyh3hZ0+fDQuWxKx3mJiPeFufg+9gwTpYp324mPCQgnuVKwzLTZVqj0duRDovnPaZqDwoyhIO8kYg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-buffer": "1.9.1", - "@webassemblyjs/wasm-gen": "1.9.1", - "@webassemblyjs/wasm-parser": "1.9.1" + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/helper-buffer": "1.11.0", + "@webassemblyjs/wasm-gen": "1.11.0", + "@webassemblyjs/wasm-parser": "1.11.0" } }, "@webassemblyjs/wasm-parser": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.1.tgz", - "integrity": "sha512-ImM4N2T1MEIond0MyE3rXvStVxEmivQrDKf/ggfh5pP6EHu3lL/YTAoSrR7shrbKNPpeKpGesW1LIK/L4kqduw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-api-error": "1.9.1", - "@webassemblyjs/helper-wasm-bytecode": "1.9.1", - "@webassemblyjs/ieee754": "1.9.1", - "@webassemblyjs/leb128": "1.9.1", - "@webassemblyjs/utf8": "1.9.1" - } - }, - "@webassemblyjs/wast-parser": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.1.tgz", - "integrity": "sha512-2xVxejXSvj3ls/o2TR/zI6p28qsGupjHhnHL6URULQRcXmryn3w7G83jQMcT7PHqUfyle65fZtWLukfdLdE7qw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.0.tgz", + "integrity": "sha512-6L285Sgu9gphrcpDXINvm0M9BskznnzJTE7gYkjDbxET28shDqp27wpruyx3C2S/dvEwiigBwLA1cz7lNUi0kw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/floating-point-hex-parser": "1.9.1", - "@webassemblyjs/helper-api-error": "1.9.1", - "@webassemblyjs/helper-code-frame": "1.9.1", - "@webassemblyjs/helper-fsm": "1.9.1", - "@xtuc/long": "4.2.2" + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/helper-api-error": "1.11.0", + "@webassemblyjs/helper-wasm-bytecode": "1.11.0", + "@webassemblyjs/ieee754": "1.11.0", + "@webassemblyjs/leb128": "1.11.0", + "@webassemblyjs/utf8": "1.11.0" } }, "@webassemblyjs/wast-printer": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.1.tgz", - "integrity": "sha512-tDV8V15wm7mmbAH6XvQRU1X+oPGmeOzYsd6h7hlRLz6QpV4Ec/KKxM8OpLtFmQPLCreGxTp+HuxtH4pRIZyL9w==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.0.tgz", + "integrity": "sha512-Fg5OX46pRdTgB7rKIUojkh9vXaVN6sGYCnEiJN1GYkb0RPwShZXp6KTDqmoMdQPKhcroOXh3fEzmkWmCYaKYhQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/wast-parser": "1.9.1", + "@webassemblyjs/ast": "1.11.0", "@xtuc/long": "4.2.2" } }, @@ -2885,13 +2736,15 @@ "dev": true }, "array-includes": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", - "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.2.tgz", + "integrity": "sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", + "es-abstract": "^1.18.0-next.1", + "get-intrinsic": "^1.0.1", "is-string": "^1.0.5" } }, @@ -2908,13 +2761,14 @@ "dev": true }, "array.prototype.flat": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", - "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" + "es-abstract": "^1.18.0-next.1" } }, "arrify": { @@ -3154,9 +3008,9 @@ } }, "babel-preset-current-node-syntax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.0.tgz", - "integrity": "sha512-mGkvkpocWJes1CmMKtgGUwCeeq0pOhALyymozzDWYomHTbDLwueDYG6p4TK1YOeYHCzBzYPsWkgTto10JubI1Q==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", "dev": true, "requires": { "@babel/plugin-syntax-async-generators": "^7.8.4", @@ -3330,16 +3184,16 @@ "dev": true }, "browserslist": { - "version": "4.14.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.7.tgz", - "integrity": "sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==", + "version": "4.16.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.1.tgz", + "integrity": "sha512-UXhDrwqsNcpTYJBTZsbGATDxZbiVDsx6UjpmRUmtnP10pr8wAYr5LgFoEFw9ixriQH2mv/NX2SfGzE/o8GndLA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001157", + "caniuse-lite": "^1.0.30001173", "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.591", + "electron-to-chromium": "^1.3.634", "escalade": "^3.1.1", - "node-releases": "^1.1.66" + "node-releases": "^1.1.69" } }, "bser": { @@ -3414,9 +3268,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001157", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001157.tgz", - "integrity": "sha512-gOerH9Wz2IRZ2ZPdMfBvyOi3cjaz4O4dgNwPGzx8EhqAs4+2IL/O+fJsbt+znSigujoZG8bVcIAUM/I/E5K3MA==", + "version": "1.0.30001173", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001173.tgz", + "integrity": "sha512-R3aqmjrICdGCTAnSXtNyvWYMK3YtV5jwudbq0T7nN9k4kmE4CBuwPqyJ+KBzepSTh0huivV2gLbSMEzTTmfeYw==", "dev": true }, "capture-exit": { @@ -3623,12 +3477,6 @@ "color-convert": "^2.0.1" } }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -3708,8 +3556,7 @@ "colorette": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", - "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", - "dev": true + "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==" }, "combined-stream": { "version": "1.0.8", @@ -3745,6 +3592,12 @@ "dot-prop": "^5.1.0" } }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -4429,52 +4282,21 @@ "dev": true }, "core-js": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.7.0.tgz", - "integrity": "sha512-NwS7fI5M5B85EwpWuIwJN4i/fbisQUwLwiSNUWeXlkAZ0sbBjLEvLvFLf1uzAUV66PcEPt4xCGCmOZSxVf3xzA==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.2.tgz", + "integrity": "sha512-FfApuSRgrR6G5s58casCBd9M2k+4ikuu4wbW6pJyYU7bd9zvFc9qf7vr5xmrZOhT9nn+8uwlH1oRR9jTnFoA3A==", "dev": true }, "core-js-compat": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.1.tgz", - "integrity": "sha512-a16TLmy9NVD1rkjUGbwuyWkiDoN0FDpAwrfLONvHFQx0D9k7J9y0srwMT8QP/Z6HE3MIFaVynEeYwZwPX1o5RQ==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.2.tgz", + "integrity": "sha512-LO8uL9lOIyRRrQmZxHZFl1RV+ZbcsAkFWTktn5SmH40WgLtSNYN4m4W2v9ONT147PxBY/XrRhrWq8TlvObyUjQ==", "dev": true, "requires": { - "browserslist": "^4.15.0", + "browserslist": "^4.16.0", "semver": "7.0.0" }, "dependencies": { - "browserslist": { - "version": "4.16.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.0.tgz", - "integrity": "sha512-/j6k8R0p3nxOC6kx5JGAxsnhc9ixaWJfYc+TNTzxg6+ARaESAvQGV7h0uNOB4t+pLQJZWzcrMxXOxjgsCj3dqQ==", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001165", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.621", - "escalade": "^3.1.1", - "node-releases": "^1.1.67" - } - }, - "caniuse-lite": { - "version": "1.0.30001168", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001168.tgz", - "integrity": "sha512-P2zmX7swIXKu+GMMR01TWa4csIKELTNnZKc+f1CjebmZJQtTAEXmpQSoKVJVVcvPGAA0TEYTOUp3VehavZSFPQ==", - "dev": true - }, - "electron-to-chromium": { - "version": "1.3.628", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.628.tgz", - "integrity": "sha512-fmhO4YGo/kapy+xL9Eq/cZwDASaTHZu3psIFYo4yc+RY1LzbZr84xjKlDImDrlrmWhOxsrDi98nX097U/xK/cQ==", - "dev": true - }, - "node-releases": { - "version": "1.1.67", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.67.tgz", - "integrity": "sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg==", - "dev": true - }, "semver": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", @@ -5065,9 +4887,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.591", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.591.tgz", - "integrity": "sha512-ol/0WzjL4NS4Kqy9VD6xXQON91xIihDT36sYCew/G/bnd1v0/4D+kahp26JauQhgFUjrdva3kRSo7URcUmQ+qw==", + "version": "1.3.634", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.634.tgz", + "integrity": "sha512-QPrWNYeE/A0xRvl/QP3E0nkaEvYUvH3gM04ZWYtIa6QlSpEetRlRI1xvQ7hiMIySHHEV+mwDSX8Kj4YZY6ZQAw==", "dev": true }, "emittery": { @@ -5104,9 +4926,9 @@ } }, "enhanced-resolve": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.4.1.tgz", - "integrity": "sha512-4GbyIMzYktTFoRSmkbgZ1LU+RXwf4AQ8Z+rSuuh1dC8plp0PPeaWvx6+G4hh4KnUJ48VoxKbNyA1QQQIUpXjYA==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.6.0.tgz", + "integrity": "sha512-C3GGDfFZmqUa21o10YRKbZN60DPl0HyXKXxoEnQMWso9u7KMU23L7CBHfr/rVxORddY/8YQZaU2MZ1ewTS8Pcw==", "dev": true, "requires": { "graceful-fs": "^4.2.4", @@ -5132,9 +4954,9 @@ } }, "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", @@ -5142,6 +4964,7 @@ "has": "^1.0.3", "has-symbols": "^1.0.1", "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", "is-regex": "^1.1.1", "object-inspect": "^1.8.0", "object-keys": "^1.1.1", @@ -5737,18 +5560,84 @@ "dev": true }, "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.0.0.tgz", + "integrity": "sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ==", "dev": true, "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "get-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz", + "integrity": "sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg==", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } } }, "exit": { @@ -6065,9 +5954,9 @@ "dev": true }, "fastq": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz", - "integrity": "sha512-i7FVWL8HhVY+CTkwFxkN2mk3h+787ixS5S63eb78diVRc1MCssarHq3W5cj0av7YDSwmaV928RNag+U1etRQ7w==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.10.0.tgz", + "integrity": "sha512-NL2Qc5L3iQEsyYzweq7qfgy5OtXCmGzGvhElGEd/SoFWEMOEczNh5s5ocaF01HDetxz+p8ecjNPA6cZxxIHmzA==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -6171,6 +6060,15 @@ "path-exists": "^4.0.0" } }, + "find-versions": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", + "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", + "dev": true, + "requires": { + "semver-regex": "^3.1.2" + } + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -6313,9 +6211,9 @@ "dev": true }, "get-intrinsic": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", - "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.2.tgz", + "integrity": "sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==", "dev": true, "requires": { "function-bind": "^1.1.1", @@ -6599,24 +6497,46 @@ } }, "git-raw-commits": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.8.tgz", - "integrity": "sha512-6Gk7tQHGMLEL1bSnrMJTCVt2AQl4EmCcJDtzs/JJacCb2+TNEyHM67Gp7Ri9faF7OcGpjGGRjHLvs/AG7QKZ2Q==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.9.tgz", + "integrity": "sha512-hSpNpxprVno7IOd4PZ93RQ+gNdzPAIrW0x8av6JQDJGV4k1mR9fE01dl8sEqi2P7aKmmwiGUn1BCPuf16Ae0Qw==", "dev": true, "requires": { "dargs": "^7.0.0", "lodash.template": "^4.0.2", "meow": "^8.0.0", - "split2": "^2.0.0", + "split2": "^3.0.0", "through2": "^4.0.0" - } - }, - "git-remote-origin-url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", - "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", - "dev": true, - "requires": { + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "requires": { + "readable-stream": "^3.0.0" + } + } + } + }, + "git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", + "dev": true, + "requires": { "gitconfiglocal": "^1.0.0", "pify": "^2.3.0" }, @@ -6725,9 +6645,9 @@ "dev": true }, "globby": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", - "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -6756,7 +6676,8 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true + "dev": true, + "optional": true }, "handlebars": { "version": "4.7.6", @@ -6937,16 +6858,131 @@ } }, "human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, "husky": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/husky/-/husky-5.0.6.tgz", - "integrity": "sha512-SM+evfvcHT3rAYJKvPlatz3L5RqzgeM6xIvDjhs8VuhKj6iKqFDOt/Ov8sPjvWuE4FDB385gJBwWXRj7G3c1hg==", - "dev": true + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.7.tgz", + "integrity": "sha512-0fQlcCDq/xypoyYSJvEuzbDPHFf8ZF9IXKJxlrnvxABTSzK1VPT2RKYQKrcgJ+YD39swgoB6sbzywUqFxUiqjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^7.0.0", + "find-versions": "^4.0.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^5.0.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "pkg-dir": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", + "dev": true, + "requires": { + "find-up": "^5.0.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } }, "iconv-lite": { "version": "0.4.24", @@ -6964,9 +7000,9 @@ "dev": true }, "import-fresh": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", - "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -7031,9 +7067,9 @@ "dev": true }, "ini": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", - "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": { @@ -7112,9 +7148,9 @@ } }, "is-core-module": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", - "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", "dev": true, "requires": { "has": "^1.0.3" @@ -7212,9 +7248,9 @@ } }, "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", "dev": true }, "is-number": { @@ -7344,6 +7380,7 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, + "optional": true, "requires": { "is-docker": "^2.0.0" } @@ -7453,9 +7490,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -7616,6 +7653,12 @@ "pump": "^3.0.0" } }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -8004,13 +8047,6 @@ "to-regex-range": "^5.0.1" } }, - "fsevents": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.2.1.tgz", - "integrity": "sha512-bTLYHSeC0UH/EFXS9KqWnXuOl/wHK5Z/d+ghd5AsFMYN7wIGkUCOJyzy88+wJKkZPGON8u4Z9f6U4FdgURE9qA==", - "dev": true, - "optional": true - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -8663,10 +8699,13 @@ "dev": true }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } }, "supports-color": { "version": "7.2.0", @@ -8959,9 +8998,9 @@ "dev": true }, "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -9212,9 +9251,9 @@ "dev": true }, "commander": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", - "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true }, "cross-spawn": { @@ -9278,6 +9317,12 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -9468,9 +9513,9 @@ } }, "loader-runner": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.1.0.tgz", - "integrity": "sha512-oR4lB4WvwFoC70ocraKhn5nkKSs23t57h9udUgw8o0iH8hMXeEoRuUgfcvgUwAJ1ZpRqBvcou4N2SMvM1DwMrA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", + "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==", "dev": true }, "loader-utils": { @@ -9617,49 +9662,6 @@ "cli-cursor": "^3.1.0", "slice-ansi": "^4.0.0", "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - } } }, "loud-rejection": { @@ -9759,9 +9761,9 @@ "dev": true }, "meow": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-8.0.0.tgz", - "integrity": "sha512-nbsTRz2fwniJBFgUkcdISq8y/q9n9VbiHYbfwklFh5V4V2uAcxtKQkDc0yCLPM/kP0d+inZBewn3zJqewHE7kg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.0.tgz", + "integrity": "sha512-fNWkgM1UVMey2kf24yLiccxLihc5W+6zVus3/N0b+VfnJgxV99E9u04X6NAiKdg6ED7DAQBX5sy36NM0QJZkWA==", "dev": true, "requires": { "@types/minimist": "^1.2.0", @@ -10059,6 +10061,7 @@ "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.1.tgz", "integrity": "sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA==", "dev": true, + "optional": true, "requires": { "growly": "^1.3.0", "is-wsl": "^2.2.0", @@ -10073,6 +10076,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", "dev": true, + "optional": true, "requires": { "lru-cache": "^6.0.0" } @@ -10082,6 +10086,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "optional": true, "requires": { "isexe": "^2.0.0" } @@ -10089,9 +10094,9 @@ } }, "node-releases": { - "version": "1.1.66", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.66.tgz", - "integrity": "sha512-JHEQ1iWPGK+38VLB2H9ef2otU4l8s3yAMt9Xf934r6+ojCYDMHPMqvCc9TnzfeFSP1QEOeU6YZEd3+De0LTCgg==", + "version": "1.1.69", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.69.tgz", + "integrity": "sha512-DGIjo79VDEyAnRlfSqYTsy+yoHd2IOjJiKUozD2MV2D85Vso6Bug56mb9tT/fY5Urt0iqk01H7x+llAruDR2zA==", "dev": true }, "normalize-package-data": { @@ -10107,10 +10112,13 @@ }, "dependencies": { "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, @@ -10276,9 +10284,9 @@ } }, "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", "dev": true }, "object-keys": { @@ -10318,14 +10326,14 @@ } }, "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz", + "integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", + "es-abstract": "^1.18.0-next.1", "has": "^1.0.3" } }, @@ -10364,6 +10372,12 @@ } } }, + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true + }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -10384,9 +10398,9 @@ "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" }, "p-each-series": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", - "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.2.0.tgz", + "integrity": "sha512-ycIL2+1V32th+8scbpTvyHNaHe02z0sjgh91XXjAk+ZeXoPN4Z46DVUnzdso0aX4KckKw0FNNFHdjZ2UsZvxiA==", "dev": true }, "p-finally": { @@ -11205,12 +11219,12 @@ "dev": true }, "resolve": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", - "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "dev": true, "requires": { - "is-core-module": "^2.0.0", + "is-core-module": "^2.1.0", "path-parse": "^1.0.6" } }, @@ -11332,6 +11346,23 @@ "micromatch": "^3.1.4", "minimist": "^1.1.1", "walker": "~1.0.5" + }, + "dependencies": { + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + } } }, "saxes": { @@ -11365,6 +11396,12 @@ "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", "dev": true }, + "semver-regex": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.2.tgz", + "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", + "dev": true + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -11486,7 +11523,8 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true + "dev": true, + "optional": true }, "sigmund": { "version": "1.0.1", @@ -11741,9 +11779,9 @@ } }, "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", "dev": true }, "split": { @@ -11815,9 +11853,9 @@ } }, "stack-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.2.tgz", - "integrity": "sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw==", "dev": true, "requires": { "escape-string-regexp": "^2.0.0" @@ -11969,77 +12007,34 @@ } }, "string.prototype.padend": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.0.tgz", - "integrity": "sha512-3aIv8Ffdp8EZj8iLwREGpQaUZiPyrWrpzMBHvkiSW/bK/EGve9np07Vwy7IJ5waydpGXzQZu/F8Oze2/IWkBaA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.1.tgz", + "integrity": "sha512-eCzTASPnoCr5Ht+Vn1YXgm8SB015hHKgEIMu9Nr9bQmLhRBxKRfmzSj/IQsxDFc8JInJDDFA0qXwK+xxI7wDkg==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" + "es-abstract": "^1.18.0-next.1" } }, "string.prototype.trimend": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", - "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", + "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" } }, "string.prototype.trimstart": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", - "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", + "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" } }, "string_decoder": { @@ -12138,9 +12133,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -12158,9 +12153,9 @@ } }, "mime": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.7.tgz", + "integrity": "sha512-dhNd1uA2u397uQk3Nv5LM4lm93WYDUXFn3Fu291FJerns4jyTudqhIWe4W04YLy7Uk1tm1Ore04NpjRvQp/NPA==", "dev": true }, "ms": { @@ -12187,10 +12182,13 @@ } }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, @@ -12247,9 +12245,9 @@ "dev": true }, "table": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.6.tgz", - "integrity": "sha512-OInCtPmDNieVBkVFi6C8RwU2S2H0h8mF3e3TQK4nreaUNCpooQUkI+A/KuEkm5FawfhWIfNqG+qfelVVR+V00g==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", "dev": true, "requires": { "ajv": "^7.0.2", @@ -12320,17 +12318,17 @@ } }, "terser-webpack-plugin": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.0.3.tgz", - "integrity": "sha512-zFdGk8Lh9ZJGPxxPE6jwysOlATWB8GMW8HcfGULWA/nPal+3VdATflQvSBSLQJRCmYZnfFJl6vkRTiwJGNgPiQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.1.tgz", + "integrity": "sha512-5XNNXZiR8YO6X6KhSGXfY0QrGrCRlSwAEjIIrlRQR4W8nP69TaJUlh3bkuac6zzgspiGPfKEHcY295MMVExl5Q==", "dev": true, "requires": { - "jest-worker": "^26.6.1", - "p-limit": "^3.0.2", + "jest-worker": "^26.6.2", + "p-limit": "^3.1.0", "schema-utils": "^3.0.0", "serialize-javascript": "^5.0.1", "source-map": "^0.6.1", - "terser": "^5.3.8" + "terser": "^5.5.1" }, "dependencies": { "p-limit": { @@ -12559,9 +12557,9 @@ "dev": true }, "type-fest": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.0.tgz", - "integrity": "sha512-fbDukFPnJBdn2eZ3RR+5mK2slHLFd6gYHY7jna1KWWy4Yr4XysHuCdXRzy+RiG/HwG4WJat00vdC2UHky5eKiQ==", + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true }, "type-is": { @@ -12737,10 +12735,11 @@ "dev": true }, "uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==", - "dev": true + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "optional": true }, "v8-compile-cache": { "version": "2.2.0", @@ -12749,9 +12748,9 @@ "dev": true }, "v8-to-istanbul": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-7.0.0.tgz", - "integrity": "sha512-fLL2rFuQpMtm9r8hrAV2apXX/WqHJ6+IC4/eQVdMDGBUgH/YMV4Gv3duk3kjmyg6uiQWBAA9nJwue4iJUOkHeA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-7.1.0.tgz", + "integrity": "sha512-uXUVqNUCLa0AH1vuVxzi+MI4RfxEOKt9pBgKwHbgH7st8Kv2P1m+jvWNnektzBh5QShF3ODgKmUFCf38LnVz1g==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.1", @@ -12838,33 +12837,32 @@ "dev": true }, "webpack": { - "version": "5.11.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.11.1.tgz", - "integrity": "sha512-tNUIdAmYJv+nupRs/U/gqmADm6fgrf5xE+rSlSsf2PgsGO7j2WG7ccU6AWNlOJlHFl+HnmXlBmHIkiLf+XA9mQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.13.0.tgz", + "integrity": "sha512-NPhMEtfhSVegp1FNPkCM1MPygDm0GHwpreG10dh//0Gr0epfB0br9nlgEfxSghxJqrQ7j9XzgO91CGGLWZiHeA==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.0", "@types/estree": "^0.0.45", - "@webassemblyjs/ast": "1.9.1", - "@webassemblyjs/helper-module-context": "1.9.1", - "@webassemblyjs/wasm-edit": "1.9.1", - "@webassemblyjs/wasm-parser": "1.9.1", + "@webassemblyjs/ast": "1.11.0", + "@webassemblyjs/wasm-edit": "1.11.0", + "@webassemblyjs/wasm-parser": "1.11.0", "acorn": "^8.0.4", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.3.1", + "enhanced-resolve": "^5.6.0", "eslint-scope": "^5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.4", "json-parse-better-errors": "^1.0.2", - "loader-runner": "^4.1.0", + "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "pkg-dir": "^5.0.0", "schema-utils": "^3.0.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.0.3", + "terser-webpack-plugin": "^5.1.1", "watchpack": "^2.0.0", "webpack-sources": "^2.1.1" }, @@ -12991,6 +12989,12 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", + "dev": true + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -13059,9 +13063,9 @@ } }, "ws": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz", - "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==", + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz", + "integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==", "dev": true }, "xml-name-validator": { @@ -13083,9 +13087,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yallist": { diff --git a/package.json b/package.json index baca4b515..248a8f7cc 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "webpack": "^4.0.0 || ^5.0.0" }, "dependencies": { + "colorette": "^1.2.1", "mem": "^8.0.0", "memfs": "^3.2.0", "mime-types": "^2.1.28", @@ -56,22 +57,25 @@ "chokidar": "^3.5.0", "connect": "^3.7.0", "cross-env": "^7.0.3", + "deepmerge": "^4.2.2", "del": "^6.0.0", "del-cli": "^3.0.1", "eslint": "^7.17.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-prettier": "^3.3.0", + "execa": "^5.0.0", "express": "^4.17.1", "file-loader": "^6.2.0", - "husky": "^5.0.6", + "husky": "^4.3.7", "jest": "^26.6.3", "lint-staged": "^10.5.3", "npm-run-all": "^4.1.5", "prettier": "^2.2.1", "standard-version": "^9.1.0", + "strip-ansi": "^6.0.0", "supertest": "^6.0.1", - "webpack": "^5.11.1" + "webpack": "^5.13.0" }, "keywords": [ "webpack", diff --git a/src/utils/setupHooks.js b/src/utils/setupHooks.js index 68bbc0e82..2fff96255 100644 --- a/src/utils/setupHooks.js +++ b/src/utils/setupHooks.js @@ -1,7 +1,10 @@ +import webpack from 'webpack'; +import colorette from 'colorette'; + export default function setupHooks(context) { function invalid() { if (context.state) { - context.logger.info('Compiling...'); + context.logger.log('Compilation starting...'); } // We are now in invalid state @@ -20,47 +23,71 @@ export default function setupHooks(context) { // Do the stuff in nextTick, because bundle may be invalidated if a change happened while compiling process.nextTick(() => { - const { state, compiler, callbacks, logger } = context; + const { compiler, logger, state, callbacks } = context; // Check if still in valid state if (!state) { return; } - // Print webpack output - const printStats = (childCompiler, childStats) => { - const statsString = childStats.toString(childCompiler.options.stats); - const name = childCompiler.options.name - ? `Child "${childCompiler.options.name}": ` - : ''; - - if (statsString.length) { - if (childStats.hasErrors()) { - logger.error(`${name}${statsString}`); - } else if (childStats.hasWarnings()) { - logger.warn(`${name}${statsString}`); - } else { - logger.info(`${name}${statsString}`); + logger.log('Compilation finished'); + + let statsOptions = compiler.compilers + ? { + children: compiler.compilers.map((child) => + // eslint-disable-next-line no-undefined + child.options ? child.options.stats : undefined + ), } - } + : compiler.options + ? compiler.options.stats + : // eslint-disable-next-line no-undefined + undefined; + + const statsForWebpack4 = webpack.Stats && webpack.Stats.presetToOptions; + + if (compiler.compilers) { + statsOptions.children = statsOptions.children.map( + (childStatsOptions) => { + if (statsForWebpack4) { + // eslint-disable-next-line no-param-reassign + childStatsOptions = webpack.Stats.presetToOptions( + childStatsOptions + ); + } - let message = `${name}Compiled successfully.`; + if (typeof childStatsOptions.colors === 'undefined') { + // eslint-disable-next-line no-param-reassign + childStatsOptions.colors = Boolean(colorette.options.enabled); + } - if (childStats.hasErrors()) { - message = `${name}Failed to compile.`; - } else if (childStats.hasWarnings()) { - message = `${name}Compiled with warnings.`; + return childStatsOptions; + } + ); + } else if ( + typeof statsOptions.colors === 'undefined' || + typeof statsOptions === 'string' + ) { + if (statsForWebpack4) { + statsOptions = webpack.Stats.presetToOptions(statsOptions); } - logger.info(message); - }; + statsOptions.colors = Boolean(colorette.options.enabled); + } - if (compiler.compilers) { - compiler.compilers.forEach((compilerFromMultiCompileMode, index) => { - printStats(compilerFromMultiCompileMode, stats.stats[index]); - }); - } else { - printStats(compiler, stats); + // TODO webpack@4 doesn't support `{ children: [{ colors: true }, { colors: true }] }` for stats + if (compiler.compilers && statsForWebpack4) { + statsOptions.colors = statsOptions.children.some( + (child) => child.colors + ); + } + + const printedStats = stats.toString(statsOptions); + + // Avoid extra empty line when `stats: 'none'` + if (printedStats) { + // eslint-disable-next-line no-console + console.log(printedStats); } // eslint-disable-next-line no-param-reassign @@ -73,7 +100,10 @@ export default function setupHooks(context) { }); } - context.compiler.hooks.watchRun.tap('DevMiddleware', invalid); - context.compiler.hooks.invalid.tap('DevMiddleware', invalid); - context.compiler.hooks.done.tap('DevMiddleware', done); + context.compiler.hooks.watchRun.tap('webpack-dev-middleware', invalid); + context.compiler.hooks.invalid.tap('webpack-dev-middleware', invalid); + (context.compiler.webpack + ? context.compiler.hooks.afterDone + : context.compiler.hooks.done + ).tap('webpack-dev-middleware', done); } diff --git a/test/__snapshots__/logging.test.js.snap.webpack4 b/test/__snapshots__/logging.test.js.snap.webpack4 new file mode 100644 index 000000000..444ff8b7d --- /dev/null +++ b/test/__snapshots__/logging.test.js.snap.webpack4 @@ -0,0 +1,287 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`logging should logging an error in "watch" method: stderr 1`] = `"Error: Watch error"`; + +exports[`logging should logging an warning: stderr 1`] = `""`; + +exports[`logging should logging an warning: stdout 1`] = ` +" +WARNING in Warning" +`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration #2: stderr 1`] = `""`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration #2: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Child broken: + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + Entrypoint main = bundle.js + [./broken.js] x bytes {main} [built] [failed] [1 error] + + ERROR in ./broken.js 1:3 + Module parse failed: Unexpected token (1:3) + You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders + > 1()2()3() + | +Child warning: + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + Entrypoint main = bundle.js + [./warning.js] x bytes {main} [built] + + WARNING in Warning +Child success: + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + index.html x bytes [emitted] + svg.svg x KiB [emitted] + Entrypoint main = bundle.js + [./foo.js] x bytes {main} [built] + [./index.html] x bytes {main} [built] + [./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration: stderr 1`] = `""`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Child + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + Entrypoint main = bundle.js + [./broken.js] x bytes {main} [built] [failed] [1 error] + + ERROR in ./broken.js 1:3 + Module parse failed: Unexpected token (1:3) + You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders + > 1()2()3() + | +Child + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + Entrypoint main = bundle.js + [./warning.js] x bytes {main} [built] + + WARNING in Warning +Child + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + index.html x bytes [emitted] + svg.svg x KiB [emitted] + Entrypoint main = bundle.js + [./foo.js] x bytes {main} [built] + [./index.html] x bytes {main} [built] + [./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build and respect colors #2: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect colors #2: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +[./foo.js] x bytes {main} [built] +[./index.html] x bytes {main} [built] +[./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build and respect colors: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect colors: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +[./foo.js] x bytes {main} [built] +[./index.html] x bytes {main} [built] +[./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with custom object value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with custom object value: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +[./foo.js] x bytes {main} [built] +[./index.html] x bytes {main} [built] +[./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "false" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "false" value: stdout 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "minimal" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "minimal" value: stdout 1`] = `" x modules"`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "none" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "none" value: stdout 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "true" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "true" value: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +[./foo.js] x bytes {main} [built] +[./index.html] x bytes {main} [built] +[./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "verbose" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "verbose" value: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +chunk {main} bundle.js (xxxx) x bytes [entry] [rendered] + > ./foo.js main + [./foo.js] x bytes {main} [depth 0] [built] + single entry ./foo.js main + [./index.html] x bytes {main} [depth 1] [built] + [exports: default] + cjs require ./index.html [./foo.js] 4:0-23 + [./svg.svg] x bytes {main} [depth 1] [built] + [exports: default] + cjs require ./svg.svg [./foo.js] 3:0-20 + +LOG from xxx" +`; + +exports[`logging should logging on successfully build in multi-compiler mode: stderr 1`] = `""`; + +exports[`logging should logging on successfully build in multi-compiler mode: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Child + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + index.html x bytes [emitted] + svg.svg x KiB [emitted] + Entrypoint main = bundle.js + [./foo.js] x bytes {main} [built] + [./index.html] x bytes {main} [built] + [./svg.svg] x bytes {main} [built] +Child + Hash: xxxx + Time: Xms + Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main + Entrypoint main = bundle.js + [./bar.js] x bytes {main} [built]" +`; + +exports[`logging should logging on successfully build: stderr 1`] = `""`; + +exports[`logging should logging on successfully build: stdout 1`] = ` +"Hash: xxxx +Version: webpack x.x.x +Time: Xms +Built at: x + Asset Size Chunks Chunk Names + bundle.js x KiB main [emitted] main +index.html x bytes [emitted] + svg.svg x KiB [emitted] +Entrypoint main = bundle.js +[./foo.js] x bytes {main} [built] +[./index.html] x bytes {main} [built] +[./svg.svg] x bytes {main} [built]" +`; + +exports[`logging should logging on unsuccessful build in multi-compiler: stderr 1`] = `""`; + +exports[`logging should logging on unsuccessful build in multi-compiler: stdout 1`] = ` +"Child + + ERROR in ./broken.js 1:3 + Module parse failed: Unexpected token (1:3) + You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders + > 1()2()3() + | +Child + + ERROR in ./broken.js 1:3 + Module parse failed: Unexpected token (1:3) + You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders + > 1()2()3() + |" +`; + +exports[`logging should logging on unsuccessful build: stderr 1`] = `""`; + +exports[`logging should logging on unsuccessful build: stdout 1`] = ` +" +ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|" +`; + +exports[`logging should logging warnings in multi-compiler mode: stderr 1`] = `""`; + +exports[`logging should logging warnings in multi-compiler mode: stdout 1`] = ` +"Child + + WARNING in Warning +Child + + WARNING in Warning" +`; diff --git a/test/__snapshots__/logging.test.js.snap.webpack5 b/test/__snapshots__/logging.test.js.snap.webpack5 new file mode 100644 index 000000000..e8e897a90 --- /dev/null +++ b/test/__snapshots__/logging.test.js.snap.webpack5 @@ -0,0 +1,263 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`logging should logging an error in "watch" method: stderr 1`] = `"Error: Watch error"`; + +exports[`logging should logging an warning: stderr 1`] = `""`; + +exports[`logging should logging an warning: stdout 1`] = ` +"WARNING in Warning + +webpack compiled with 1 warning" +`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration #2: stderr 1`] = `""`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration #2: stdout 1`] = ` +"broken: + asset bundle.js x bytes [emitted] (name: main) + ./broken.js x bytes [built] [code generated] [1 error] + + ERROR in ./broken.js 1:3 + Module parse failed: Unexpected token (1:3) + You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders + > 1()2()3() + | + + broken (webpack x.x.x) compiled with 1 error in x ms + +warning: + asset bundle.js x bytes [emitted] (name: main) + ./warning.js x bytes [built] [code generated] + + WARNING in Warning + + warning (webpack x.x.x) compiled with 1 warning in x ms + +success: + asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) + asset bundle.js x KiB [emitted] (name: main) + asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) + runtime modules x bytes x modules + cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] + success (webpack x.x.x) compiled successfully in x ms" +`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration: stderr 1`] = `""`; + +exports[`logging should logging in multi-compiler and respect the "stats" option from configuration: stdout 1`] = ` +"asset bundle.js x bytes [emitted] (name: main) +./broken.js x bytes [built] [code generated] [1 error] + +ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +| + +webpack x.x.x compiled with 1 error in x ms + +asset bundle.js x bytes [emitted] (name: main) +./warning.js x bytes [built] [code generated] + +WARNING in Warning + +webpack x.x.x compiled with 1 warning in x ms + +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset bundle.js x KiB [emitted] (name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x bytes x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build and respect colors #2: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect colors #2: stdout 1`] = ` +"asset bundle.js x KiB [emitted] (name: main) +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x KiB x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build and respect colors: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect colors: stdout 1`] = ` +"asset bundle.js x KiB [emitted] (name: main) +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x KiB x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with custom object value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with custom object value: stdout 1`] = ` +"asset bundle.js x KiB [emitted] (name: main) +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main)" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "false" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "false" value: stdout 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "minimal" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "minimal" value: stdout 1`] = ` +"x assets +x modules +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "none" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "none" value: stdout 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "true" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "true" value: stdout 1`] = ` +"asset bundle.js x KiB [emitted] (name: main) +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x KiB x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "verbose" value: stderr 1`] = `""`; + +exports[`logging should logging on successfully build and respect the "stats" option from configuration with the "verbose" value: stdout 1`] = ` +"PublicPath: auto +asset bundle.js x KiB {main} [emitted] (name: main) +asset svg.svg x KiB ({main}) [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes ({main}) [emitted] [from: index.html] (auxiliary name: main) +Entrypoint main x KiB (x KiB) = bundle.js 2 auxiliary assets +chunk {main} (runtime: main) bundle.js (xxxx) x bytes (xxxx) x KiB (xxxx) [entry] [rendered] + > ./foo.js main + runtime modules x KiB + webpack/runtime/define property getters x bytes {main} [code generated] + [no exports] + [used exports unknown] + webpack/runtime/global x bytes {main} [code generated] + [no exports] + [used exports unknown] + webpack/runtime/hasOwnProperty shorthand x bytes {main} [code generated] + [no exports] + [used exports unknown] + webpack/runtime/make namespace object x bytes {main} [code generated] + [no exports] + [used exports unknown] + webpack/runtime/publicPath x bytes {main} [code generated] + [no exports] + [used exports unknown] + cacheable modules x bytes + ./foo.js x bytes {main} [depth 0] [built] [code generated] + [used exports unknown] + entry ./foo.js main + ./index.html x bytes {main} [depth 1] [dependent] [built] [code generated] + [exports: default] + [used exports unknown] + cjs require ./index.html [./foo.js] 4:0-23 + ./svg.svg x bytes {main} [depth 1] [dependent] [built] [code generated] + [exports: default] + [used exports unknown] + cjs require ./svg.svg [./foo.js] 3:0-20 + + +LOG from xxx" +`; + +exports[`logging should logging on successfully build in multi-compiler mode: stderr 1`] = `""`; + +exports[`logging should logging on successfully build in multi-compiler mode: stdout 1`] = ` +"asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset bundle.js x KiB [emitted] (name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x bytes x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms + +asset bundle.js x bytes [emitted] (name: main) +./bar.js x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on successfully build: stderr 1`] = `""`; + +exports[`logging should logging on successfully build: stdout 1`] = ` +"asset bundle.js x KiB [emitted] (name: main) +asset svg.svg x KiB [emitted] [from: svg.svg] (auxiliary name: main) +asset index.html x bytes [emitted] [from: index.html] (auxiliary name: main) +runtime modules x KiB x modules +cacheable modules x bytes + ./foo.js x bytes [built] [code generated] + ./svg.svg x bytes [built] [code generated] + ./index.html x bytes [built] [code generated] +webpack x.x.x compiled successfully in x ms" +`; + +exports[`logging should logging on unsuccessful build in multi-compiler: stderr 1`] = `""`; + +exports[`logging should logging on unsuccessful build in multi-compiler: stdout 1`] = ` +"ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +| + +webpack compiled with 1 error + +ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +| + +webpack compiled with 1 error" +`; + +exports[`logging should logging on unsuccessful build: stderr 1`] = `""`; + +exports[`logging should logging on unsuccessful build: stdout 1`] = ` +"ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +| + +webpack compiled with 1 error" +`; + +exports[`logging should logging warnings in multi-compiler mode: stderr 1`] = `""`; + +exports[`logging should logging warnings in multi-compiler mode: stdout 1`] = ` +"WARNING in Warning + +webpack compiled with 1 warning + +WARNING in Warning + +webpack compiled with 1 warning" +`; diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap deleted file mode 100644 index a81f32a95..000000000 --- a/test/__snapshots__/middleware.test.js.snap +++ /dev/null @@ -1,1261 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`connect framework: middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"broken\\": Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"warning\\": Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"success\\": Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Entrypoint main = bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "compiled successfully", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`connect framework: middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`connect framework: middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging on successfully build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`connect framework: middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"broken\\": Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"warning\\": Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"success\\": Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Entrypoint main = bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "compiled successfully", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`express framework: middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`express framework: middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging on successfully build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`express framework: middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; diff --git a/test/__snapshots__/validation-options.test.js.snap b/test/__snapshots__/validation-options.test.js.snap.webpack4 similarity index 100% rename from test/__snapshots__/validation-options.test.js.snap rename to test/__snapshots__/validation-options.test.js.snap.webpack4 diff --git a/test/__snapshots__/validation-options.test.js.snap.webpack5 b/test/__snapshots__/validation-options.test.js.snap.webpack5 new file mode 100644 index 000000000..891567ffe --- /dev/null +++ b/test/__snapshots__/validation-options.test.js.snap.webpack5 @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`validation should throw an error on the "headers" option with "true" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.headers should be an object: + object { … }" +`; + +exports[`validation should throw an error on the "index" option with "{}" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.index should be one of these: + boolean | string + -> Allows to serve an index of the directory. + Details: + * options.index should be a boolean. + * options.index should be a string." +`; + +exports[`validation should throw an error on the "index" option with "0" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.index should be one of these: + boolean | string + -> Allows to serve an index of the directory. + Details: + * options.index should be a boolean. + * options.index should be a string." +`; + +exports[`validation should throw an error on the "methods" option with "{}" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.methods should be an array: + [string, ...] + -> Allows to pass the list of HTTP request methods accepted by the middleware." +`; + +exports[`validation should throw an error on the "methods" option with "true" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.methods should be an array: + [string, ...] + -> Allows to pass the list of HTTP request methods accepted by the middleware." +`; + +exports[`validation should throw an error on the "mimeTypes" option with "foo" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.mimeTypes should be an object: + object { … } + -> Allows a user to register custom mime types or extension mappings." +`; + +exports[`validation should throw an error on the "outputFileSystem" option with "false" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.outputFileSystem should be an object: + object { … } + -> Set the default file system which will be used by webpack as primary destination of generated files." +`; + +exports[`validation should throw an error on the "publicPath" option with "false" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.publicPath should be one of these: + \\"auto\\" | string | function + -> The \`publicPath\` specifies the public URL address of the output files when referenced in a browser. + Details: + * options.publicPath should be \\"auto\\". + * options.publicPath should be a string. + * options.publicPath should be an instance of function." +`; + +exports[`validation should throw an error on the "serverSideRender" option with "0" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.serverSideRender should be a boolean. + -> Instructs the module to enable or disable the server-side rendering mode." +`; + +exports[`validation should throw an error on the "serverSideRender" option with "foo" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.serverSideRender should be a boolean. + -> Instructs the module to enable or disable the server-side rendering mode." +`; + +exports[`validation should throw an error on the "writeToDisk" option with "{}" value 1`] = ` +"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema. + - options.writeToDisk should be one of these: + boolean | function + -> Allows to write generated files on disk. + Details: + * options.writeToDisk should be a boolean. + * options.writeToDisk should be an instance of function." +`; diff --git a/test/api.test.js b/test/api.test.js index 89601189b..bf8fec3be 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -8,6 +8,9 @@ import getCompiler from './helpers/getCompiler'; import getCompilerHooks from './helpers/getCompilerHooks'; import webpackConfig from './fixtures/webpack.config'; +// Suppress unnecessary stats output +global.console.log = jest.fn(); + describe.each([ ['express', express], ['connect', connect], @@ -58,7 +61,12 @@ describe.each([ }); it('should work', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); instance.waitUntilValid(() => { instance.close(); @@ -121,7 +129,9 @@ describe.each([ it('should work', (done) => { const doneSpy = jest.spyOn( - getCompilerHooks(compiler).done[0], + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], 'fn' ); @@ -179,7 +189,12 @@ describe.each([ }); it('should work without callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); instance.waitUntilValid(); @@ -200,7 +215,12 @@ describe.each([ }); it('should work with callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); let callbackCounter = 0; instance.waitUntilValid(() => { @@ -224,7 +244,12 @@ describe.each([ }); it('should run callback immediately when state already valid', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); let callbackCounter = 0; let validToCheck = false; @@ -293,7 +318,12 @@ describe.each([ }); it('should work without callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); instance.invalidate(); @@ -313,7 +343,12 @@ describe.each([ }); it('should work with callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); let callbackCounter = 0; instance.invalidate(() => { @@ -376,7 +411,12 @@ describe.each([ }); it('should work without callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); instance.waitUntilValid(() => { instance.close(); @@ -391,7 +431,12 @@ describe.each([ }); it('should work with callback', (done) => { - const doneSpy = jest.spyOn(getCompilerHooks(compiler).done[0], 'fn'); + const doneSpy = jest.spyOn( + (webpack.webpack + ? getCompilerHooks(compiler).afterDone + : getCompilerHooks(compiler).done)[0], + 'fn' + ); instance.waitUntilValid(() => { instance.close(() => { @@ -453,9 +498,12 @@ describe.each([ // the compilation needs to finish, as it will still be running // after the test is done if not finished, potentially impacting other tests - compiler.hooks.done.tap('wdm-test', () => { - done(); - }); + (webpack.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap( + 'wdm-test', + () => { + done(); + } + ); }); }); }); diff --git a/test/fixtures/webpack.array.config.js b/test/fixtures/webpack.array.config.js index 2c1a164ff..3c4f6fd38 100644 --- a/test/fixtures/webpack.array.config.js +++ b/test/fixtures/webpack.array.config.js @@ -24,7 +24,7 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, { mode: 'development', @@ -38,6 +38,6 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, ]; diff --git a/test/fixtures/webpack.array.one-error-one-warning-one-success-with-names.js b/test/fixtures/webpack.array.one-error-one-warning-one-success-with-names.js index c32653330..482b80c97 100644 --- a/test/fixtures/webpack.array.one-error-one-warning-one-success-with-names.js +++ b/test/fixtures/webpack.array.one-error-one-warning-one-success-with-names.js @@ -16,7 +16,7 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, { name: "warning", @@ -42,7 +42,7 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, { name: "success", @@ -66,6 +66,6 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, ]; diff --git a/test/fixtures/webpack.array.one-error-one-warning-one-success.js b/test/fixtures/webpack.array.one-error-one-warning-one-success.js index f3a378dab..180839a13 100644 --- a/test/fixtures/webpack.array.one-error-one-warning-one-success.js +++ b/test/fixtures/webpack.array.one-error-one-warning-one-success.js @@ -15,7 +15,7 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, { mode: 'development', @@ -40,7 +40,7 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, { mode: 'development', @@ -63,6 +63,6 @@ module.exports = [ infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }, ]; diff --git a/test/fixtures/webpack.config.js b/test/fixtures/webpack.config.js index ec601b6e6..41ab27dd0 100644 --- a/test/fixtures/webpack.config.js +++ b/test/fixtures/webpack.config.js @@ -22,5 +22,5 @@ module.exports = { infrastructureLogging: { level: 'none' }, - stats: 'errors-warnings' + stats: 'normal' }; diff --git a/test/fixtures/webpack.stats-colors-false.config.js b/test/fixtures/webpack.stats-colors-false.config.js new file mode 100644 index 000000000..6407a6e2a --- /dev/null +++ b/test/fixtures/webpack.stats-colors-false.config.js @@ -0,0 +1,28 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: { + colors: false + } +}; diff --git a/test/fixtures/webpack.stats-colors-true.config.js b/test/fixtures/webpack.stats-colors-true.config.js new file mode 100644 index 000000000..67274f28c --- /dev/null +++ b/test/fixtures/webpack.stats-colors-true.config.js @@ -0,0 +1,28 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: { + colors: true + } +}; diff --git a/test/fixtures/webpack.stats-false.config.js b/test/fixtures/webpack.stats-false.config.js new file mode 100644 index 000000000..bbf3256bb --- /dev/null +++ b/test/fixtures/webpack.stats-false.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: false +}; diff --git a/test/fixtures/webpack.stats-minimal.config.js b/test/fixtures/webpack.stats-minimal.config.js new file mode 100644 index 000000000..81e2ccc5c --- /dev/null +++ b/test/fixtures/webpack.stats-minimal.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: 'minimal' +}; diff --git a/test/fixtures/webpack.stats-none.config.js b/test/fixtures/webpack.stats-none.config.js new file mode 100644 index 000000000..ad0dedf12 --- /dev/null +++ b/test/fixtures/webpack.stats-none.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: 'none' +}; diff --git a/test/fixtures/webpack.stats-object.config.js b/test/fixtures/webpack.stats-object.config.js new file mode 100644 index 000000000..8f605735e --- /dev/null +++ b/test/fixtures/webpack.stats-object.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: { all: false, assets: true } +}; diff --git a/test/fixtures/webpack.stats-true.config.js b/test/fixtures/webpack.stats-true.config.js new file mode 100644 index 000000000..30a4255e5 --- /dev/null +++ b/test/fixtures/webpack.stats-true.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: true +}; diff --git a/test/fixtures/webpack.stats-verbose.config.js b/test/fixtures/webpack.stats-verbose.config.js new file mode 100644 index 000000000..30bfe6198 --- /dev/null +++ b/test/fixtures/webpack.stats-verbose.config.js @@ -0,0 +1,26 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + mode: 'development', + context: path.resolve(__dirname), + entry: './foo.js', + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, '../outputs/basic'), + }, + module: { + rules: [ + { + test: /\.(svg|html)$/, + loader: 'file-loader', + options: { name: '[name].[ext]' }, + }, + ], + }, + infrastructureLogging: { + level: 'none' + }, + stats: 'verbose' +}; diff --git a/test/helpers/GetLogsPlugin.js b/test/helpers/GetLogsPlugin.js deleted file mode 100644 index ef6c7fa6a..000000000 --- a/test/helpers/GetLogsPlugin.js +++ /dev/null @@ -1,50 +0,0 @@ -export default class GetLogsPlugin { - constructor() { - this.logs = []; - } - - static normalizeLogs(log, type) { - if (Array.isArray(log)) { - return log.map((nestedLog) => - GetLogsPlugin.normalizeLogs(nestedLog, type) - ); - } - - // TODO remove after webpack@4 dropping - if (type === 'error') { - return 'ERROR'; - } - - // TODO remove after webpack@4 dropping - if (type === 'warn') { - return 'WARNING'; - } - - // TODO remove after webpack@4 dropping - if (log.includes('modules')) { - return 'compiled successfully'; - } - - // TODO remove after webpack@4 dropping - if (log.includes('Entrypoint')) { - return 'Entrypoint main = bundle.js'; - } - - return log - .toString() - .trim() - .replace(process.cwd(), '/absolute/path/to') - .replace(/\\/g, '/'); - } - - apply(compiler) { - const hook = - compiler.hooks.infrastructurelog || compiler.hooks.infrastructureLog; - - hook.tap('GetLogsPlugin', (name, type, args) => { - this.logs.push([name, type, GetLogsPlugin.normalizeLogs(args, type)]); - - return false; - }); - } -} diff --git a/test/helpers/clearDirectory.js b/test/helpers/clearDirectory.js new file mode 100644 index 000000000..e88400a4f --- /dev/null +++ b/test/helpers/clearDirectory.js @@ -0,0 +1,26 @@ +import fs from 'fs'; + +function clearDirectory(dirPath) { + let files; + + try { + files = fs.readdirSync(dirPath); + } catch (e) { + return; + } + if (files.length > 0) { + for (let i = 0; i < files.length; i++) { + const filePath = `${dirPath}/${files[i]}`; + + if (fs.statSync(filePath).isFile()) { + fs.unlinkSync(filePath); + } else { + clearDirectory(filePath); + } + } + } + + fs.rmdirSync(dirPath); +} + +export default clearDirectory; diff --git a/test/helpers/getCompilerHooks.js b/test/helpers/getCompilerHooks.js index ba48bcc19..81376abcb 100644 --- a/test/helpers/getCompilerHooks.js +++ b/test/helpers/getCompilerHooks.js @@ -3,7 +3,7 @@ export default (compiler) => { for (const hook of Object.keys(compiler.hooks)) { for (const tap of compiler.hooks[hook].taps) { - if (tap.name === 'DevMiddleware') { + if (tap.name === 'webpack-dev-middleware') { if (!result[hook]) { result[hook] = []; } diff --git a/test/helpers/runner.js b/test/helpers/runner.js new file mode 100755 index 000000000..2fc5366d0 --- /dev/null +++ b/test/helpers/runner.js @@ -0,0 +1,130 @@ +#!/usr/bin/env node + +const express = require('express'); +const webpack = require('webpack'); +const merge = require('deepmerge'); + +const middleware = require('../../dist').default; + +const defaultConfig = require('../fixtures/webpack.config'); + +const configEntries = []; +const configMiddlewareEntries = []; + +fillConfigEntries('WCF_', configEntries); +fillConfigEntries('WMC_', configMiddlewareEntries); + +const config = createConfig(configEntries); +const unionConfig = + Object.keys(config).length > 0 + ? merge(getWebpackConfig(process.env.WEBPACK_CONFIG), config) + : getWebpackConfig(process.env.WEBPACK_CONFIG); +const configMiddleware = createConfig(configMiddlewareEntries); +const compiler = webpack(unionConfig || defaultConfig); +let instance; + +if (process.env.WEBPACK_BREAK_WATCH) { + compiler.watch = function watch() { + const error = new Error('Watch error'); + error.code = 'watch error'; + + throw error; + }; +} + +compiler.hooks.done.tap('plugin-test', () => { + process.stdout.write('compiled-for-tests'); +}); + +try { + instance = middleware(compiler, configMiddleware); +} catch (error) { + throw error; +} + +const app = express(); + +try { + app.use(instance); +} catch (error) { + throw error; +} + +app.listen((error) => { + if (error) { + throw error; + } + + let commands = []; + let incompleteCommand = ''; + + process.stdin.on('data', (chunk) => { + const entries = chunk.toString().split('|'); + + incompleteCommand += entries.shift(); + commands.push(incompleteCommand); + incompleteCommand = entries.pop(); + commands = commands.concat(entries); + + while (commands.length > 0) { + // eslint-disable-next-line default-case + switch (commands.shift()) { + // case 'invalidate': + // stdinInput = ''; + // instance.waitUntilValid(() => { + // instance.invalidate(); + // }); + // break; + case 'exit': + process.exit(); + break; + } + } + }); +}); + +function getWebpackConfig(name) { + try { + // eslint-disable-next-line global-require,import/no-dynamic-require + return require(`../fixtures/${name}`); + } catch (error) { + // eslint-disable-next-line global-require + return require(`../fixtures/webpack.config`); + } +} + +function createConfig(data) { + function getObject(entry) { + return { [entry[0]]: entry[1] }; + } + + function reduceObject(arr) { + if (arr.length > 1) { + const temp = []; + temp.push(arr.pop()); + temp.push(arr.pop()); + + return reduceObject([...arr, getObject(temp.reverse())]); + } + + return arr[0]; + } + + const result = data.map((el) => reduceObject([...el])); + + return merge.all(result); +} + +function fillConfigEntries(NSKey, accumulator) { + Object.keys(process.env) + .filter((key) => key.indexOf(NSKey) === 0) + .forEach((key) => { + let value = process.env[key]; + const keys = key.replace(NSKey, '').split('_'); + + value = value === 'true' ? true : value === 'false' ? false : value; + + keys.push(value); + accumulator.push(keys); + }); +} diff --git a/test/helpers/snapshotResolver.js b/test/helpers/snapshotResolver.js new file mode 100644 index 000000000..742ee5b60 --- /dev/null +++ b/test/helpers/snapshotResolver.js @@ -0,0 +1,28 @@ +const path = require('path'); + +const webpack = require('webpack'); + +// eslint-disable-next-line global-require +const [webpackVersion] = webpack.version; +const snapshotExtension = `.snap.webpack${webpackVersion}`; + +// eslint-disable-next-line no-console +console.log('Current webpack version:', webpackVersion); + +module.exports = { + resolveSnapshotPath: (testPath) => + path.join( + path.dirname(testPath), + '__snapshots__', + `${path.basename(testPath)}${snapshotExtension}` + ), + resolveTestPath: (snapshotPath) => + snapshotPath + .replace(`${path.sep}__snapshots__`, '') + .slice(0, -snapshotExtension.length), + testPathForConsistencyCheck: path.join( + 'consistency_check', + '__tests__', + 'example.test.js' + ), +}; diff --git a/test/logging.test.js b/test/logging.test.js new file mode 100644 index 000000000..a8fa18b76 --- /dev/null +++ b/test/logging.test.js @@ -0,0 +1,763 @@ +import fs from 'fs'; +import path from 'path'; +import os from 'os'; + +import execa from 'execa'; +import stripAnsi from 'strip-ansi'; + +function extractErrorEntry(string) { + const matches = string.match(/error:\s\D[^:||\n||\r]+/gim); + + return matches === null ? null : matches[0]; +} + +function stdoutToSnapshot(stdout) { + let cleanedStdout = stripAnsi(stdout.trim()); + + // Bugs in `strip-ansi` + cleanedStdout = cleanedStdout.replace(/null main /g, 'main'); + cleanedStdout = cleanedStdout.replace(/(\d+):(\d+)-(\d+) /g, '$1:$2-$3'); + cleanedStdout = cleanedStdout.replace(/> (.+) {2}(.+)/g, '> $1 $2'); + + cleanedStdout = cleanedStdout.replace(/\| /g, '|'); + cleanedStdout = cleanedStdout.replace(/compiled-for-tests/g, ''); + cleanedStdout = cleanedStdout.replace(/\d+.\d+ KiB/g, 'x KiB'); + cleanedStdout = cleanedStdout.replace(/\d+ bytes/g, 'x bytes'); + cleanedStdout = cleanedStdout.replace(/\d+ assets/g, 'x assets'); + + cleanedStdout = cleanedStdout.replace(/\d+ modules/g, 'x modules'); + cleanedStdout = cleanedStdout.replace(/in \d+ ms/g, 'in x ms'); + + cleanedStdout = cleanedStdout.replace( + /LOG from .+webpack/s, + 'LOG from xxx\n...\nwebpack' + ); + cleanedStdout = cleanedStdout.replace( + /webpack \d+.\d+.\d+/g, + 'webpack x.x.x' + ); + cleanedStdout = cleanedStdout.replace(/\([0-9a-z]+\)/g, '(xxxx)'); + + // webpack@4 + cleanedStdout = cleanedStdout.replace(/Hash: [0-9a-z]+/g, 'Hash: xxxx'); + cleanedStdout = cleanedStdout.replace(/Time: \d+ms/g, 'Time: Xms'); + cleanedStdout = cleanedStdout.replace(/Built at: .+/g, 'Built at: x'); + cleanedStdout = cleanedStdout.replace(/LOG from .+$/s, 'LOG from xxx'); + cleanedStdout = cleanedStdout.replace( + / {3}([a-z]+)\.([a-z]+) +x KiB +\[emitted] +/s, + ' $1.$2 x KiB [emitted]' + ); + + return cleanedStdout; +} + +function stderrToSnapshot(stderr) { + const cleanedStderr = stderr.trim(); + + const matches = stderr.match(/error:\s\D[^:||\n||\r]+/gim); + + if (matches !== null) { + return matches[0]; + } + + return cleanedStderr; +} + +const runner = path.resolve(__dirname, './helpers/runner.js'); + +describe('logging', () => { + it('should logging on successfully build', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.config', + FORCE_COLOR: true, + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdout).toContain('\u001b[1m'); + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect colors', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-colors-true.config.js', + FORCE_COLOR: true, + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdout).toContain('\u001b[1m'); + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect colors #2', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-colors-false.config.js', + FORCE_COLOR: true, + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdout).not.toContain('\u001b[1m'); + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with the "none" value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-none.config.js', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with the "minimal" value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-minimal.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with the "verbose" value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-verbose.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with the "true" value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-true.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with the "false" value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-false.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build and respect the "stats" option from configuration with custom object value', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.stats-object.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on successfully build in multi-compiler mode', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + FORCE_COLOR: true, + WEBPACK_CONFIG: 'webpack.array.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdout).toContain('\u001b[1m'); + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on unsuccessful build', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.error.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging on unsuccessful build in multi-compiler', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.array.error.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging an warning', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.warning.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging warnings in multi-compiler mode', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.array.warning.config', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging in multi-compiler and respect the "stats" option from configuration', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.array.one-error-one-warning-one-success', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging in multi-compiler and respect the "stats" option from configuration #2', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: + 'webpack.array.one-error-one-warning-one-success-with-names', + }, + }); + } catch (error) { + throw error; + } + + let stdout = ''; + let stderr = ''; + + proc.stdout.on('data', (chunk) => { + stdout += chunk.toString(); + + if (/compiled-for-tests/gi.test(stdout)) { + proc.stdin.write('|exit|'); + } + }); + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stdoutToSnapshot(stdout)).toMatchSnapshot('stdout'); + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + it('should logging an error in "watch" method', (done) => { + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_BREAK_WATCH: true, + }, + }); + } catch (error) { + throw error; + } + + let stderr = ''; + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(stderrToSnapshot(stderr)).toMatchSnapshot('stderr'); + + done(); + }); + }); + + if (os.platform() !== 'win32') { + it('should logging an error from the fs error when the "writeToDisk" option is "true"', async (done) => { + // eslint-disable-next-line global-require + const clearDirectory = require('./helpers/clearDirectory').default; + const outputDir = path.resolve( + __dirname, + './outputs/write-to-disk-mkdir-error' + ); + + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir); + } + + fs.chmodSync(outputDir, 0o400); + + let proc; + + try { + proc = execa(runner, [], { + stdio: 'pipe', + env: { + WEBPACK_CONFIG: 'webpack.simple.config', + WCF_output_filename: 'bundle.js', + WCF_output_path: outputDir, + WCF_infrastructureLogging_level: 'log', + WMC_writeToDisk: true, + }, + }); + } catch (error) { + throw error; + } + + let stderr = ''; + + proc.stderr.on('data', (chunk) => { + stderr += chunk.toString(); + proc.stdin.write('|exit|'); + }); + + proc.on('exit', () => { + expect(extractErrorEntry(stderr)).toMatch('Error: EACCES'); + + fs.chmodSync(outputDir, 0o700); + clearDirectory(outputDir); + + done(); + }); + }); + } +}); diff --git a/test/middleware.test.js b/test/middleware.test.js index cc1db074f..68debd56e 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -10,22 +10,17 @@ import del from 'del'; import middleware from '../src'; import getCompiler from './helpers/getCompiler'; -import GetLogsPlugin from './helpers/GetLogsPlugin'; import isWebpack5 from './helpers/isWebpack5'; import webpackConfig from './fixtures/webpack.config'; -import webpackSimpleConfig from './fixtures/webpack.simple.config'; import webpackMultiConfig from './fixtures/webpack.array.config'; import webpackWatchOptionsConfig from './fixtures/webpack.watch-options.config'; import webpackMultiWatchOptionsConfig from './fixtures/webpack.array.watch-options.config'; import webpackQueryStringConfig from './fixtures/webpack.querystring.config'; import webpackClientServerConfig from './fixtures/webpack.client.server.config'; -import webpackErrorConfig from './fixtures/webpack.error.config'; -import webpackMultiErrorConfig from './fixtures/webpack.array.error.config'; -import webpackWarningConfig from './fixtures/webpack.warning.config'; -import webpackMultiWarningConfig from './fixtures/webpack.array.warning.config'; -import webpackOneErrorOneWarningOneSuccessConfig from './fixtures/webpack.array.one-error-one-warning-one-success'; -import webpackOneErrorOneWarningOneSuccessWithNamesConfig from './fixtures/webpack.array.one-error-one-warning-one-success-with-names'; + +// Suppress unnecessary stats output +global.console.log = jest.fn(); describe.each([ ['express', express], @@ -1590,18 +1585,22 @@ describe.each([ }); }); - describe('should respect the "stats" option with the "false" value from the configuration', () => { - let compiler; - let getLogsPlugin; - + describe('should handle an earlier request if a change happened while compiling', () => { beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: false }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const compiler = getCompiler(webpackConfig); instance = middleware(compiler); + let invalidated = false; + + compiler.hooks.done.tap('Invalidated', () => { + if (!invalidated) { + instance.invalidate(); + + invalidated = true; + } + }); + app = framework(); app.use(instance); @@ -1611,29 +1610,22 @@ describe.each([ afterAll(close); it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); + request(app).get('/bundle.js').expect(200, done); }); }); + }); - describe('should respect the "stats" option with the "none" value from the configuration', () => { - let compiler; - let getLogsPlugin; - + describe('mimeTypes option', () => { + describe('should set the correct value for "Content-Type" header to known MIME type', () => { beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'none' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); instance = middleware(compiler); @@ -1641,123 +1633,163 @@ describe.each([ app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.html'), + 'welcome' + ); }); afterAll(close); - it('should return the "200" code for the "GET" request to the bundle file', (done) => { + it('should return the "200" code for the "GET" request to "file.html"', (done) => { request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); + .get('/file.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); }); }); - describe('should respect the "stats" option with the "minimal" value from the configuration', () => { - let compiler; - let getLogsPlugin; - + describe('should set the correct value for "Content-Type" header to specified MIME type', () => { beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { + mimeTypes: { + myhtml: 'text/html', + }, + }); app = framework(); app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.myhtml'), + 'welcome' + ); }); afterAll(close); - it('should return the "200" code for the "GET" request to the bundle file', (done) => { + it('should return the "200" code for the "GET" request "file.phtml"', (done) => { request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); + .get('/file.myhtml') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); }); }); - describe('should respect the "stats" option in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - + describe('should override value for "Content-Type" header for known MIME type', () => { beforeAll((done) => { - compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { + mimeTypes: { + jpg: 'image/vnd.test+jpeg', + }, + }); app = framework(); app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.jpg'), + 'welcome' + ); }); afterAll(close); - it('should return the "200" code for the "GET" requests to bundles file', (done) => { + it('should return the "200" code for the "GET" request "file.jpg"', (done) => { request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } + .get('/file.jpg') + .expect('Content-Type', 'image/vnd.test+jpeg') + .expect(200, done); + }); + }); - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } + describe('should not set "Content-Type" header for route not from outputFileSystem', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } + instance = middleware(compiler, { + mimeTypes: { + jpg: 'image/vnd.test+jpeg', + }, + }); - expect(getLogsPlugin.logs).toMatchSnapshot(); + app = framework(); + app.use(instance); - return done(); - }); - }); - }); + app.use('/file.jpg', (req, res) => { + // Express API + if (res.send) { + res.send('welcome'); + } + // Connect API + else { + res.setHeader('Content-Type', 'text/html'); + res.end('welcome'); + } + }); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request "file.jpg" with default content type', (done) => { + request(app) + .get('/file.jpg') + .expect('Content-Type', /text\/html/) + .expect(200, done); }); }); + }); - describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + describe('watchOptions option', () => { + describe('should work without value', () => { let compiler; - let getLogsPlugin; + let spy; beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - stats: { all: false, entrypoints: true }, - }); + compiler = getCompiler(webpackConfig); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + spy = jest.spyOn(compiler, 'watch'); instance = middleware(compiler); @@ -1767,9 +1799,13 @@ describe.each([ listen = listenShorthand(done); }); - afterAll(close); + afterAll((done) => { + spy.mockRestore(); - it('should return the "200" code for the "GET" request to the bundle file', (done) => { + close(done); + }); + + it('should pass arguments to the "watch" method', (done) => { request(app) .get('/bundle.js') .expect(200, (error) => { @@ -1777,22 +1813,22 @@ describe.each([ return done(error); } - expect(getLogsPlugin.logs).toMatchSnapshot(); + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual({}); return done(); }); }); }); - describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + describe('should respect options from the configuration', () => { let compiler; - let getLogsPlugin; + let spy; beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); + compiler = getCompiler(webpackWatchOptionsConfig); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + spy = jest.spyOn(compiler, 'watch'); instance = middleware(compiler); @@ -1802,42 +1838,39 @@ describe.each([ listen = listenShorthand(done); }); - afterAll(close); + afterAll((done) => { + spy.mockRestore(); + + close(done); + }); - it('should return the "200" code for the "GET" request to bundle files', (done) => { + it('should pass arguments to the "watch" method', (done) => { request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(done); } - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual({ + aggregateTimeout: 300, + poll: true, + }); - return done(); - }); + return done(error); }); }); }); - describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + describe('should respect options from the configuration in multi-compile mode', () => { let compiler; - let getLogsPlugin; + let spy; beforeAll((done) => { - compiler = getCompiler( - webpackOneErrorOneWarningOneSuccessWithNamesConfig - ); + compiler = getCompiler(webpackMultiWatchOptionsConfig); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + spy = jest.spyOn(compiler, 'watch'); instance = middleware(compiler); @@ -1847,9 +1880,13 @@ describe.each([ listen = listenShorthand(done); }); - afterAll(close); + afterAll((done) => { + spy.mockRestore(); + + close(done); + }); - it('should return the "200" code for "GET" requests to bundle files', (done) => { + it('should pass arguments to the "watch" method', (done) => { request(app) .get('/static-one/bundle.js') .expect(200, (firstError) => { @@ -1864,33 +1901,33 @@ describe.each([ return done(secondError); } - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual([ + { aggregateTimeout: 800, poll: false }, + { aggregateTimeout: 300, poll: true }, + ]); + + return done(); }); }); }); }); + }); - describe('should throw an error on "run" when we watching', () => { + describe('writeToDisk option', () => { + describe('should work with "true" value', () => { let compiler; - let getLogsPlugin; beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/write-to-disk-true'), + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { writeToDisk: true }); app = framework(); app.use(instance); @@ -1898,9 +1935,15 @@ describe.each([ listen = listenShorthand(done); }); - afterAll(close); + afterAll((done) => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-true') + ); + + close(done); + }); - it('should logging an error', (done) => { + it('should find the bundle file on disk', (done) => { request(app) .get('/bundle.js') .expect(200, (error) => { @@ -1908,28 +1951,49 @@ describe.each([ return done(error); } - return compiler.run((runError) => { - expect(() => { - throw runError; - }).toThrowErrorMatchingSnapshot(); + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-true/bundle.js' + ); + + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(1); + expect(fs.existsSync(bundlePath)).toBe(true); + + instance.invalidate(); - done(); - }); + return compiler.hooks.done.tap( + 'DevMiddlewareWriteToDiskTest', + () => { + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(1); + + done(); + } + ); }); }); }); - describe('should throw an error on "watch" when we watching', () => { + describe('should work with "false" value', () => { let compiler; - let getLogsPlugin; beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/write-to-disk-false'), + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { writeToDisk: false }); app = framework(); app.use(instance); @@ -1939,7 +2003,7 @@ describe.each([ afterAll(close); - it('should logging an error', (done) => { + it('should not find the bundle file on disk', (done) => { request(app) .get('/bundle.js') .expect(200, (error) => { @@ -1947,224 +2011,164 @@ describe.each([ return done(error); } - return compiler.watch({}, (watchError) => { - expect(() => { - throw watchError; - }).toThrowErrorMatchingSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should handle an earlier request if a change happened while compiling', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-false/bundle.js' + ); - let invalidated = false; + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(0); + expect(fs.existsSync(bundlePath)).toBe(false); - compiler.hooks.done.tap('Invalidated', () => { - if (!invalidated) { instance.invalidate(); - invalidated = true; - } - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); + return compiler.hooks.done.tap( + 'DevMiddlewareWriteToDiskTest', + () => { + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(0); - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); + done(); + } + ); + }); }); }); - }); - describe('mimeTypes option', () => { - describe('should set the correct value for "Content-Type" header to known MIME type', () => { + describe('should work with "Function" value when it returns "true"', () => { + let compiler; + beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ + compiler = getCompiler({ ...webpackConfig, output: { filename: 'bundle.js', - path: outputPath, + path: path.resolve( + __dirname, + './outputs/write-to-disk-function-true' + ), }, }); - instance = middleware(compiler); + instance = middleware(compiler, { + writeToDisk: (filePath) => /bundle\.js$/.test(filePath), + }); app = framework(); app.use(instance); listen = listenShorthand(done); + }); - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.html'), - 'welcome' + afterAll((done) => { + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-function-true' + ) ); - }); - afterAll(close); + close(done); + }); - it('should return the "200" code for the "GET" request to "file.html"', (done) => { + it('should find the bundle file on disk', (done) => { request(app) - .get('/file.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-function-true/bundle.js' + ); + + expect(fs.existsSync(bundlePath)).toBe(true); + + return done(); + }); }); }); - describe('should set the correct value for "Content-Type" header to specified MIME type', () => { + describe('should work with "Function" value when it returns "false"', () => { + let compiler; + beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ + compiler = getCompiler({ ...webpackConfig, output: { filename: 'bundle.js', - path: outputPath, + path: path.resolve( + __dirname, + './outputs/write-to-disk-function-false' + ), }, }); instance = middleware(compiler, { - mimeTypes: { - myhtml: 'text/html', - }, + writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), }); app = framework(); app.use(instance); listen = listenShorthand(done); + }); - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.myhtml'), - 'welcome' + afterAll((done) => { + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-function-false' + ) ); - }); - afterAll(close); + close(done); + }); - it('should return the "200" code for the "GET" request "file.phtml"', (done) => { + it('should not find the bundle file on disk', (done) => { request(app) - .get('/file.myhtml') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-function-false/bundle.js' + ); + + expect(fs.existsSync(bundlePath)).toBe(false); + + return done(); + }); }); }); - describe('should override value for "Content-Type" header for known MIME type', () => { + describe('should work when assets have query string', () => { + let compiler; + beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, + compiler = getCompiler({ + ...webpackQueryStringConfig, output: { - filename: 'bundle.js', - path: outputPath, + filename: 'bundle.js?[contenthash]', + path: path.resolve( + __dirname, + './outputs/write-to-disk-query-string' + ), }, }); - instance = middleware(compiler, { - mimeTypes: { - jpg: 'image/vnd.test+jpeg', - }, - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.jpg'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request "file.jpg"', (done) => { - request(app) - .get('/file.jpg') - .expect('Content-Type', 'image/vnd.test+jpeg') - .expect(200, done); - }); - }); - - describe('should not set "Content-Type" header for route not from outputFileSystem', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - mimeTypes: { - jpg: 'image/vnd.test+jpeg', - }, - }); - - app = framework(); - app.use(instance); - - app.use('/file.jpg', (req, res) => { - // Express API - if (res.send) { - res.send('welcome'); - } - // Connect API - else { - res.setHeader('Content-Type', 'text/html'); - res.end('welcome'); - } - }); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request "file.jpg" with default content type', (done) => { - request(app) - .get('/file.jpg') - .expect('Content-Type', /text\/html/) - .expect(200, done); - }); - }); - }); - - describe('watchOptions option', () => { - describe('should work without value', () => { - let compiler; - let spy; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - spy = jest.spyOn(compiler, 'watch'); - - instance = middleware(compiler); + instance = middleware(compiler, { writeToDisk: true }); app = framework(); app.use(instance); @@ -2173,12 +2177,17 @@ describe.each([ }); afterAll((done) => { - spy.mockRestore(); + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-query-string' + ) + ); close(done); }); - it('should pass arguments to the "watch" method', (done) => { + it('should find the bundle file on disk with no querystring', (done) => { request(app) .get('/bundle.js') .expect(200, (error) => { @@ -2186,66 +2195,48 @@ describe.each([ return done(error); } - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual({}); - - return done(); - }); - }); - }); - - describe('should respect options from the configuration', () => { - let compiler; - let spy; - - beforeAll((done) => { - compiler = getCompiler(webpackWatchOptionsConfig); - - spy = jest.spyOn(compiler, 'watch'); - - instance = middleware(compiler); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll((done) => { - spy.mockRestore(); - - close(done); - }); - - it('should pass arguments to the "watch" method', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(done); - } + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-query-string/bundle.js' + ); - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual({ - aggregateTimeout: 300, - poll: true, - }); + expect(fs.existsSync(bundlePath)).toBe(true); - return done(error); + return done(); }); }); }); - describe('should respect options from the configuration in multi-compile mode', () => { + describe('should work in multi-compiler mode', () => { let compiler; - let spy; beforeAll((done) => { - compiler = getCompiler(webpackMultiWatchOptionsConfig); - - spy = jest.spyOn(compiler, 'watch'); + compiler = getCompiler([ + { + ...webpackMultiWatchOptionsConfig[0], + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/static-one' + ), + publicPath: '/static-one/', + }, + }, + { + ...webpackMultiWatchOptionsConfig[1], + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/static-two' + ), + publicPath: '/static-two/', + }, + }, + ]); - instance = middleware(compiler); + instance = middleware(compiler, { writeToDisk: true }); app = framework(); app.use(instance); @@ -2254,12 +2245,17 @@ describe.each([ }); afterAll((done) => { - spy.mockRestore(); + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/' + ) + ); close(done); }); - it('should pass arguments to the "watch" method', (done) => { + it('should find the bundle files on disk', (done) => { request(app) .get('/static-one/bundle.js') .expect(200, (firstError) => { @@ -2273,30 +2269,48 @@ describe.each([ if (secondError) { return done(secondError); } + const bundleFiles = [ + './outputs/write-to-disk-multi-compiler/static-one/bundle.js', + './outputs/write-to-disk-multi-compiler/static-one/index.html', + './outputs/write-to-disk-multi-compiler/static-one/svg.svg', + './outputs/write-to-disk-multi-compiler/static-two/bundle.js', + ]; - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual([ - { aggregateTimeout: 800, poll: false }, - { aggregateTimeout: 300, poll: true }, - ]); + for (const bundleFile of bundleFiles) { + const bundlePath = path.resolve(__dirname, bundleFile); + + expect(fs.existsSync(bundlePath)).toBe(true); + } return done(); }); }); }); }); - }); - describe('writeToDisk option', () => { - describe('should work with "true" value', () => { + describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { let compiler; + let hash; beforeAll((done) => { compiler = getCompiler({ ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/write-to-disk-true'), + ...{ + output: { + filename: 'bundle.js', + publicPath: isWebpack5() + ? '/static/[fullhash]/' + : '/static/[hash]/', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/write-to-disk-with-hash/dist_[fullhash]' + ) + : path.resolve( + __dirname, + './outputs/write-to-disk-with-hash/dist_[hash]' + ), + }, }, }); @@ -2305,12 +2319,17 @@ describe.each([ app = framework(); app.use(instance); - listen = listenShorthand(done); + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); }); afterAll((done) => { del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-true') + path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') ); close(done); @@ -2318,7 +2337,7 @@ describe.each([ it('should find the bundle file on disk', (done) => { request(app) - .get('/bundle.js') + .get(`/static/${hash}/bundle.js`) .expect(200, (error) => { if (error) { return done(error); @@ -2326,749 +2345,98 @@ describe.each([ const bundlePath = path.resolve( __dirname, - './outputs/write-to-disk-true/bundle.js' + `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` ); - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(1); expect(fs.existsSync(bundlePath)).toBe(true); - instance.invalidate(); - - return compiler.hooks.done.tap( - 'DevMiddlewareWriteToDiskTest', - () => { - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(1); - - done(); - } - ); + return done(); }); }); }); + }); - describe('should work with "false" value', () => { - let compiler; + describe('methods option', () => { + let compiler; - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/write-to-disk-false'), - }, - }); - - instance = middleware(compiler, { writeToDisk: false }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should not find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-false/bundle.js' - ); - - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(0); - expect(fs.existsSync(bundlePath)).toBe(false); - - instance.invalidate(); - - return compiler.hooks.done.tap( - 'DevMiddlewareWriteToDiskTest', - () => { - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(0); - - done(); - } - ); - }); - }); - }); - - describe('should work with "Function" value when it returns "true"', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-function-true' - ), - }, - }); - - instance = middleware(compiler, { - writeToDisk: (filePath) => /bundle\.js$/.test(filePath), - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll((done) => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-function-true' - ) - ); - - close(done); - }); - - it('should find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-function-true/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - - describe('should work with "Function" value when it returns "false"', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-function-false' - ), - }, - }); - - instance = middleware(compiler, { - writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll((done) => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-function-false' - ) - ); - - close(done); - }); - - it('should not find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-function-false/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(false); - - return done(); - }); - }); - }); - - describe('should work when assets have query string', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackQueryStringConfig, - output: { - filename: 'bundle.js?[contenthash]', - path: path.resolve( - __dirname, - './outputs/write-to-disk-query-string' - ), - }, - }); - - instance = middleware(compiler, { writeToDisk: true }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll((done) => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-query-string' - ) - ); - - close(done); - }); - - it('should find the bundle file on disk with no querystring', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-query-string/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - - describe('should work in multi-compiler mode', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler([ - { - ...webpackMultiWatchOptionsConfig[0], - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/static-one' - ), - publicPath: '/static-one/', - }, - }, - { - ...webpackMultiWatchOptionsConfig[1], - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/static-two' - ), - publicPath: '/static-two/', - }, - }, - ]); - - instance = middleware(compiler, { writeToDisk: true }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll((done) => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/' - ) - ); - - close(done); - }); - - it('should find the bundle files on disk', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - const bundleFiles = [ - './outputs/write-to-disk-multi-compiler/static-one/bundle.js', - './outputs/write-to-disk-multi-compiler/static-one/index.html', - './outputs/write-to-disk-multi-compiler/static-one/svg.svg', - './outputs/write-to-disk-multi-compiler/static-two/bundle.js', - ]; - - for (const bundleFile of bundleFiles) { - const bundlePath = path.resolve(__dirname, bundleFile); - - expect(fs.existsSync(bundlePath)).toBe(true); - } - - return done(); - }); - }); - }); - }); - - describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { - let compiler; - let hash; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - ...{ - output: { - filename: 'bundle.js', - publicPath: isWebpack5() - ? '/static/[fullhash]/' - : '/static/[hash]/', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_[fullhash]' - ) - : path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_[hash]' - ), - }, - }, - }); - - instance = middleware(compiler, { writeToDisk: true }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - hash = h; - done(); - }); - }); - }); - - afterAll((done) => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') - ); - - close(done); - }); - - it('should find the bundle file on disk', (done) => { - request(app) - .get(`/static/${hash}/bundle.js`) - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - }); - - describe('methods option', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { - methods: ['POST'], - publicPath: '/public/', - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "POST" request to the bundle file', (done) => { - request(app).post('/public/bundle.js').expect(200, done); - }); - - it('should return the "404" code for the "GET" request to the bundle file', (done) => { - request(app).get('/public/bundle.js').expect(404, done); - }); - - it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { - request(app).head('/public/bundle.js').expect(404, done); - }); - }); - - describe('headers option', () => { - beforeEach((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { - headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterEach(close); - - it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { - request(app) - .get('/bundle.js') - .expect('X-nonsense-1', 'yes') - .expect('X-nonsense-2', 'no') - .expect(200, done); - }); - - it('should return the "200" code for the "GET" request to path not in outputFileSystem but not return headers', async () => { - app.use('/file.jpg', (req, res) => { - // Express API - if (res.send) { - res.send('welcome'); - } - // Connect API - else { - res.end('welcome'); - } - }); - - const res = await request(app).get('/file.jpg'); - expect(res.statusCode).toEqual(200); - expect(res.headers['X-nonsense-1']).toBeUndefined(); - expect(res.headers['X-nonsense-2']).toBeUndefined(); - }); - }); - - describe('publicPath option', () => { - describe('should work with "string" value', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { publicPath: '/public/' }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/public/bundle.js').expect(200, done); - }); - }); - - describe('should work with "auto" value', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { publicPath: 'auto' }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - }); - }); - - describe('serverSideRender option', () => { - let locals; - - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { serverSideRender: true }); - - app = framework(); - app.use(instance); - app.use((req, res) => { - // eslint-disable-next-line prefer-destructuring - locals = res.locals; - - // Express API - if (res.sendStatus) { - res.sendStatus(200); - } - // Connect API - else { - // eslint-disable-next-line no-param-reassign - res.statusCode = 200; - res.end(); - } - }); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request', (done) => { - request(app) - .get('/foo/bar') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(locals.webpack.devMiddleware).toBeDefined(); - - return done(); - }); - }); - }); - - describe('outputFileSystem option', () => { - describe('should work with an unspecified value', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use the "memfs" package by default', () => { - const { Stats } = memfs; - - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should work with the configured value (native fs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - const configuredFs = fs; - - configuredFs.join = path.join.bind(path); - configuredFs.mkdirp = () => {}; - - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use the configurated output filesystem', () => { - const { Stats } = fs; - - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should work with the configured value (memfs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - const configuredFs = createFsFromVolume(new Volume()); - - configuredFs.join = path.join.bind(path); - - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); - - app = framework(); - app.use(instance); + beforeAll((done) => { + compiler = getCompiler(webpackConfig); - listen = listenShorthand(done); + instance = middleware(compiler, { + methods: ['POST'], + publicPath: '/public/', }); - afterAll(close); - - it('should use the configured output filesystem', () => { - const { Stats } = memfs; + app = framework(); + app.use(instance); - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); + listen = listenShorthand(done); }); - describe('should work with the configured value in multi-compiler mode (native fs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); + afterAll(close); - const configuredFs = fs; + it('should return the "200" code for the "POST" request to the bundle file', (done) => { + request(app).post('/public/bundle.js').expect(200, done); + }); - configuredFs.join = path.join.bind(path); - configuredFs.mkdirp = () => {}; + it('should return the "404" code for the "GET" request to the bundle file', (done) => { + request(app).get('/public/bundle.js').expect(404, done); + }); - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); + it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { + request(app).head('/public/bundle.js').expect(404, done); + }); + }); - app = framework(); - app.use(instance); + describe('headers option', () => { + beforeEach((done) => { + const compiler = getCompiler(webpackConfig); - listen = listenShorthand(done); + instance = middleware(compiler, { + headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, }); - afterAll(close); - - it('should use configured output filesystems', () => { - const { Stats } = fs; - - for (const childCompiler of compiler.compilers) { - expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(childCompiler.outputFileSystem).toHaveProperty('join'); - expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); - } + app = framework(); + app.use(instance); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(instance.context.outputFileSystem).toHaveProperty('join'); - expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); - }); + listen = listenShorthand(done); }); - describe('should throw an error on the invalid fs value - no join method', () => { - it('should throw an error', () => { - expect(() => { - const compiler = getCompiler(webpackConfig); + afterEach(close); - middleware(compiler, { - outputFileSystem: { - mkdirp: () => {}, - }, - }); - }).toThrow( - 'Invalid options: options.outputFileSystem.join() method is expected' - ); - }); + it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { + request(app) + .get('/bundle.js') + .expect('X-nonsense-1', 'yes') + .expect('X-nonsense-2', 'no') + .expect(200, done); }); - describe('should throw an error on the invalid fs value - no mkdirp method', () => { - it('should throw an error', () => { - expect(() => { - const compiler = getCompiler(webpackConfig); - - middleware(compiler, { - outputFileSystem: { - join: () => {}, - }, - }); - }).toThrow( - 'Invalid options: options.outputFileSystem.mkdirp() method is expected' - ); + it('should return the "200" code for the "GET" request to path not in outputFileSystem but not return headers', async () => { + app.use('/file.jpg', (req, res) => { + // Express API + if (res.send) { + res.send('welcome'); + } + // Connect API + else { + res.end('welcome'); + } }); + + const res = await request(app).get('/file.jpg'); + expect(res.statusCode).toEqual(200); + expect(res.headers['X-nonsense-1']).toBeUndefined(); + expect(res.headers['X-nonsense-2']).toBeUndefined(); }); }); - describe('index option', () => { - describe('should work with "false" value', () => { + describe('publicPath option', () => { + describe('should work with "string" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); - instance = middleware(compiler, { index: false, publicPath: '/' }); + instance = middleware(compiler, { publicPath: '/public/' }); app = framework(); app.use(instance); @@ -3078,291 +2446,189 @@ describe.each([ afterAll(close); - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - - it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app).get('/public/bundle.js').expect(200, done); }); }); - describe('should work with "true" value', () => { + describe('should work with "auto" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); - instance = middleware(compiler, { index: true, publicPath: '/' }); - - app = framework(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with "string" value', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'default.html', - publicPath: '/', - }); + instance = middleware(compiler, { publicPath: 'auto' }); app = framework(); app.use(instance); listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'default.html'), - 'hello' - ); }); afterAll(close); - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); }); }); + }); - describe('should work with "string" value with a custom extension', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); + describe('serverSideRender option', () => { + let locals; - instance = middleware(compiler, { - index: 'index.custom', - publicPath: '/', - }); + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); - app = framework(); - app.use(instance); + instance = middleware(compiler, { serverSideRender: true }); - listen = listenShorthand(done); + app = framework(); + app.use(instance); + app.use((req, res) => { + // eslint-disable-next-line prefer-destructuring + locals = res.locals; - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'index.custom'), - 'hello' - ); + // Express API + if (res.sendStatus) { + res.sendStatus(200); + } + // Connect API + else { + // eslint-disable-next-line no-param-reassign + res.statusCode = 200; + res.end(); + } }); - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(200, done); - }); + listen = listenShorthand(done); }); - describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'index.mycustom', - mimeTypes: { - mycustom: 'text/html', - }, - publicPath: '/', - }); + afterAll(close); - app = framework(); - app.use(instance); + it('should return the "200" code for the "GET" request', (done) => { + request(app) + .get('/foo/bar') + .expect(200, (error) => { + if (error) { + return done(error); + } - listen = listenShorthand(done); + expect(locals.webpack.devMiddleware).toBeDefined(); - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, + return done(); }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'index.mycustom'), - 'hello' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); }); + }); + + describe('outputFileSystem option', () => { + describe('should work with an unspecified value', () => { + let compiler; - describe('should work with "string" value without an extension', () => { beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); + compiler = getCompiler(webpackConfig); - instance = middleware(compiler, { index: 'noextension' }); + instance = middleware(compiler); app = framework(); app.use(instance); listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'noextension'), - 'hello' - ); }); afterAll(close); - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(200, done); + it('should use the "memfs" package by default', () => { + const { Stats } = memfs; + + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); }); }); - describe('should work with "string" value but the "index" option is a directory', () => { + describe('should work with the configured value (native fs)', () => { + let compiler; + beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); + compiler = getCompiler(webpackConfig); + + const configuredFs = fs; + + configuredFs.join = path.join.bind(path); + configuredFs.mkdirp = () => {}; instance = middleware(compiler, { - index: 'custom.html', - publicPath: '/', + outputFileSystem: configuredFs, }); app = framework(); app.use(instance); listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.mkdirSync( - path.resolve(outputPath, 'custom.html') - ); }); afterAll(close); - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(404, done); + it('should use the configurated output filesystem', () => { + const { Stats } = fs; + + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); }); }); - describe('should not handle request when index is neither a file nor a directory', () => { + describe('should work with the configured value (memfs)', () => { let compiler; - let isDirectory; beforeAll((done) => { compiler = getCompiler(webpackConfig); + const configuredFs = createFsFromVolume(new Volume()); + + configuredFs.join = path.join.bind(path); + instance = middleware(compiler, { - index: 'default.html', - publicPath: '/', + outputFileSystem: configuredFs, }); - isDirectory = jest - .spyOn(instance.context.outputFileSystem, 'statSync') - .mockImplementation(() => { - return { - isFile: () => false, - isDirectory: () => false, - }; - }); - app = framework(); app.use(instance); listen = listenShorthand(done); }); - afterAll((done) => { - isDirectory.mockRestore(); + afterAll(close); - close(done); - }); + it('should use the configured output filesystem', () => { + const { Stats } = memfs; - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(404, done); + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); }); }); - }); - describe('logger', () => { - describe('should logging on successfully build', () => { + describe('should work with the configured value in multi-compiler mode (native fs)', () => { let compiler; - let getLogsPlugin; beforeAll((done) => { - compiler = getCompiler(webpackConfig); + compiler = getCompiler(webpackMultiConfig); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const configuredFs = fs; - instance = middleware(compiler); + configuredFs.join = path.join.bind(path); + configuredFs.mkdirp = () => {}; + + instance = middleware(compiler, { + outputFileSystem: configuredFs, + }); app = framework(); app.use(instance); @@ -3372,36 +2638,64 @@ describe.each([ afterAll(close); - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } + it('should use configured output filesystems', () => { + const { Stats } = fs; - instance.invalidate(); + for (const childCompiler of compiler.compilers) { + expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(childCompiler.outputFileSystem).toHaveProperty('join'); + expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); + } - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(instance.context.outputFileSystem).toHaveProperty('join'); + expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); + }); + }); - done(); - }); + describe('should throw an error on the invalid fs value - no join method', () => { + it('should throw an error', () => { + expect(() => { + const compiler = getCompiler(webpackConfig); + + middleware(compiler, { + outputFileSystem: { + mkdirp: () => {}, + }, }); + }).toThrow( + 'Invalid options: options.outputFileSystem.join() method is expected' + ); }); }); - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; + describe('should throw an error on the invalid fs value - no mkdirp method', () => { + it('should throw an error', () => { + expect(() => { + const compiler = getCompiler(webpackConfig); - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); + middleware(compiler, { + outputFileSystem: { + join: () => {}, + }, + }); + }).toThrow( + 'Invalid options: options.outputFileSystem.mkdirp() method is expected' + ); + }); + }); + }); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + describe('index option', () => { + describe('should work with "false" value', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); - instance = middleware(compiler); + instance = middleware(compiler, { index: false, publicPath: '/' }); app = framework(); app.use(instance); @@ -3411,36 +2705,26 @@ describe.each([ afterAll(close); - it('should logging', (done) => { + it('should return the "404" code for the "GET" request to the public path', (done) => { request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); - done(); - }); - }); + it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); }); }); - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - + describe('should work with "true" value', () => { beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const compiler = getCompiler(webpackConfig); - instance = middleware(compiler); + instance = middleware(compiler, { index: true, publicPath: '/' }); app = framework(); app.use(instance); @@ -3450,260 +2734,232 @@ describe.each([ afterAll(close); - it('should logging', (done) => { + it('should return the "200" code for the "GET" request to the public path', (done) => { request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); - done(); - }); - }); + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); }); }); - describe('should logging on unsuccessful build in multi-compiler ', () => { - let compiler; - let getLogsPlugin; - + describe('should work with "string" value', () => { beforeAll((done) => { - compiler = getCompiler(webpackMultiErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { + index: 'default.html', + publicPath: '/', + }); app = framework(); app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'default.html'), + 'hello' + ); }); afterAll(close); - it('should logging', (done) => { + it('should return the "200" code for the "GET" request to the public path', (done) => { request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); }); }); - describe('should logging an warning', () => { - let compiler; - let getLogsPlugin; - + describe('should work with "string" value with a custom extension', () => { beforeAll((done) => { - compiler = getCompiler(webpackWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { + index: 'index.custom', + publicPath: '/', + }); app = framework(); app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'index.custom'), + 'hello' + ); }); afterAll(close); - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(200, done); }); }); - describe('should logging warnings in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - + describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - instance = middleware(compiler); + instance = middleware(compiler, { + index: 'index.mycustom', + mimeTypes: { + mycustom: 'text/html', + }, + publicPath: '/', + }); app = framework(); app.use(instance); listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'index.mycustom'), + 'hello' + ); }); afterAll(close); - it('should logging', (done) => { + it('should return the "200" code for the "GET" request to the public path', (done) => { request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); }); }); - describe('should logging an error in "watch" method', () => { - let getLogsPlugin; - - it('should logging on startup', () => { - const compiler = getCompiler(webpackConfig); - - const watchSpy = jest - .spyOn(compiler, 'watch') - .mockImplementation((watchOptions, callback) => { - const error = new Error('Error in Watch method'); - - error.stack = ''; - - callback(error); + describe('should work with "string" value without an extension', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - return { - close: () => {}, - }; - }); + instance = middleware(compiler, { index: 'noextension' }); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); + app = framework(); + app.use(instance); - instance = middleware(compiler); + listen = listenShorthand(done); - expect(getLogsPlugin.logs).toMatchSnapshot(); + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'noextension'), + 'hello' + ); + }); - instance.close(); + afterAll(close); - watchSpy.mockRestore(); + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(200, done); }); }); - describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let mkdirSpy; - + describe('should work with "string" value but the "index" option is a directory', () => { beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, output: { filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-mkdir-error' - ), + path: outputPath, }, }); - mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.mkdir" method.')); + instance = middleware(compiler, { + index: 'custom.html', + publicPath: '/', }); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - app = framework(); app.use(instance); listen = listenShorthand(done); - }); - afterAll((done) => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.mkdirSync( + path.resolve(outputPath, 'custom.html') ); - - mkdirSpy.mockRestore(); - - close(done); }); - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); + afterAll(close); - done(); - }); - }); + it('should return the "404" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(404, done); }); }); - describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + describe('should not handle request when index is neither a file nor a directory', () => { let compiler; - let getLogsPlugin; - let writeFileSpy; + let isDirectory; beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ), - }, - }); + compiler = getCompiler(webpackConfig); - writeFileSpy = jest - .spyOn(fs, 'writeFile') - .mockImplementation((...args) => { - const callback = args[args.length - 1]; + instance = middleware(compiler, { + index: 'default.html', + publicPath: '/', + }); - return callback(new Error('Error in the "fs.writeFile" method.')); + isDirectory = jest + .spyOn(instance.context.outputFileSystem, 'statSync') + .mockImplementation(() => { + return { + isFile: () => false, + isDirectory: () => false, + }; }); - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - app = framework(); app.use(instance); @@ -3711,26 +2967,13 @@ describe.each([ }); afterAll((done) => { - writeFileSpy.mockRestore(); - - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ) - ); + isDirectory.mockRestore(); close(done); }); - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); + it('should return the "404" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(404, done); }); }); }); diff --git a/test/utils/__snapshots__/handleRangeHeaders.test.js.snap b/test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack4 similarity index 100% rename from test/utils/__snapshots__/handleRangeHeaders.test.js.snap rename to test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack4 diff --git a/test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack5 b/test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack5 new file mode 100644 index 000000000..c92ff14b0 --- /dev/null +++ b/test/utils/__snapshots__/handleRangeHeaders.test.js.snap.webpack5 @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`handleRangeHeaders should handle malformed range header 1`] = ` +Array [ + Array [ + "A malformed Range header was provided. A regular response will be sent for this request.", + ], +] +`; + +exports[`handleRangeHeaders should handle malformed range header 2`] = ` +Array [ + Array [ + "Accept-Ranges", + "bytes", + ], +] +`; + +exports[`handleRangeHeaders should handle multiple ranges 1`] = ` +Array [ + Array [ + "A Range header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request.", + ], +] +`; + +exports[`handleRangeHeaders should handle multiple ranges 2`] = ` +Array [ + Array [ + "Accept-Ranges", + "bytes", + ], +] +`; + +exports[`handleRangeHeaders should handle unsatisfiable range 1`] = ` +Array [ + Array [ + "Accept-Ranges", + "bytes", + ], + Array [ + "Content-Range", + "bytes */6", + ], +] +`; + +exports[`handleRangeHeaders should return content in range with valid range header 1`] = ` +Array [ + Array [ + "Accept-Ranges", + "bytes", + ], + Array [ + "Content-Range", + "bytes 1-4/6", + ], +] +`; diff --git a/test/utils/__snapshots__/setupHooks.test.js.snap b/test/utils/__snapshots__/setupHooks.test.js.snap deleted file mode 100644 index 26aca6e78..000000000 --- a/test/utils/__snapshots__/setupHooks.test.js.snap +++ /dev/null @@ -1,39 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`setupHooks handles multi compiler 1`] = ` -Array [ - Array [ - "Child \\"comp1\\": Failed to compile.", - ], - Array [ - "Child \\"comp2\\": Compiled with warnings.", - ], -] -`; - -exports[`setupHooks handles multi compiler 2`] = ` -Array [ - Array [ - "Child \\"comp1\\": statsString1", - ], -] -`; - -exports[`setupHooks handles multi compiler 3`] = ` -Array [ - Array [ - "Child \\"comp2\\": statsString2", - ], -] -`; - -exports[`setupHooks sets state, then logs stats and handles callbacks on nextTick from done hook 1`] = ` -Array [ - Array [ - "statsString", - ], - Array [ - "Compiled successfully.", - ], -] -`; diff --git a/test/utils/__snapshots__/setupHooks.test.js.snap.webpack4 b/test/utils/__snapshots__/setupHooks.test.js.snap.webpack4 new file mode 100644 index 000000000..a07edcdf3 --- /dev/null +++ b/test/utils/__snapshots__/setupHooks.test.js.snap.webpack4 @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`setupHooks handles multi compiler 1`] = `Array []`; + +exports[`setupHooks handles multi compiler 2`] = `Array []`; + +exports[`setupHooks handles multi compiler 3`] = `Array []`; + +exports[`setupHooks sets state, then logs stats and handles callbacks on nextTick from done hook 1`] = `Array []`; diff --git a/test/utils/__snapshots__/setupHooks.test.js.snap.webpack5 b/test/utils/__snapshots__/setupHooks.test.js.snap.webpack5 new file mode 100644 index 000000000..a07edcdf3 --- /dev/null +++ b/test/utils/__snapshots__/setupHooks.test.js.snap.webpack5 @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`setupHooks handles multi compiler 1`] = `Array []`; + +exports[`setupHooks handles multi compiler 2`] = `Array []`; + +exports[`setupHooks handles multi compiler 3`] = `Array []`; + +exports[`setupHooks sets state, then logs stats and handles callbacks on nextTick from done hook 1`] = `Array []`; diff --git a/test/utils/__snapshots__/setupWriteToDisk.test.js.snap b/test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack4 similarity index 100% rename from test/utils/__snapshots__/setupWriteToDisk.test.js.snap rename to test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack4 diff --git a/test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack5 b/test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack5 new file mode 100644 index 000000000..66e809ba9 --- /dev/null +++ b/test/utils/__snapshots__/setupWriteToDisk.test.js.snap.webpack5 @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with mkdir error 1`] = ` +Array [ + Array [ + "Child \\"name\\": Unable to write \\"/target/path\\" directory to disk: +error1", + ], +] +`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with mkdir error 2`] = `Array []`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with mkdir error 3`] = ` +Array [ + Array [ + "error1", + ], +] +`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with no write errors 1`] = `Array []`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with no write errors 2`] = ` +Array [ + Array [ + "Child \\"name\\": Asset written to disk: \\"/target/path/file\\"", + ], +] +`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with no write errors 3`] = ` +Array [ + Array [], +] +`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with writeFile error 1`] = ` +Array [ + Array [ + "Child \\"name\\": Unable to write \\"/target/path/file\\" asset to disk: +error2", + ], +] +`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with writeFile error 2`] = `Array []`; + +exports[`setupWriteToDisk tries to create directories and write file if not filtered out with writeFile error 3`] = ` +Array [ + Array [ + "error2", + ], +] +`; diff --git a/test/utils/getFilenameFromUrl.test.js b/test/utils/getFilenameFromUrl.test.js index 3ac0e0790..7d8c7c4bf 100644 --- a/test/utils/getFilenameFromUrl.test.js +++ b/test/utils/getFilenameFromUrl.test.js @@ -4,13 +4,15 @@ import express from 'express'; import middleware from '../../src'; import getFilenameFromUrl from '../../src/utils/getFilenameFromUrl'; - import getCompiler from '../helpers/getCompiler'; import listenAndCompile from '../helpers/listenAndCompile'; import webpackSimpleConfig from '../fixtures/webpack.simple.config'; import webpackPublicPathConfig from '../fixtures/webpack.public-path.config'; import webpackMultiConfig from '../fixtures/webpack.array.config'; +// Suppress unnecessary stats output +global.console.log = jest.fn(); + describe('getFilenameFromUrl', () => { const configs = [ { diff --git a/test/utils/getPaths.test.js b/test/utils/getPaths.test.js index 21059100b..55d317dd1 100644 --- a/test/utils/getPaths.test.js +++ b/test/utils/getPaths.test.js @@ -12,6 +12,9 @@ import webpackPublicPathConfig from '../fixtures/webpack.public-path.config'; import webpackMultiConfig from '../fixtures/webpack.array.config'; import isWebpack5 from '../helpers/isWebpack5'; +// Suppress unnecessary stats output +global.console.log = jest.fn(); + describe('getPaths', () => { const configs = [ { diff --git a/test/utils/setupHooks.test.js b/test/utils/setupHooks.test.js index 2e11cbd56..dca7001fb 100644 --- a/test/utils/setupHooks.test.js +++ b/test/utils/setupHooks.test.js @@ -1,10 +1,14 @@ import setupHooks from '../../src/utils/setupHooks'; +// Suppress unnecessary stats output +global.console.log = jest.fn(); + describe('setupHooks', () => { let context; const watchRunHook = jest.fn(); const invalidHook = jest.fn(); const doneHook = jest.fn(); + const loggerLog = jest.fn(); const loggerInfo = jest.fn(); const loggerWarn = jest.fn(); const loggerError = jest.fn(); @@ -28,14 +32,14 @@ describe('setupHooks', () => { tap: doneHook, }, }, - options: {}, + options: { stats: {} }, }, logger: { + log: loggerLog, info: loggerInfo, warn: loggerWarn, error: loggerError, }, - stats: {}, callbacks: [cb1, cb2], }; }); @@ -84,7 +88,7 @@ describe('setupHooks', () => { invalidHook.mock.calls[0][1](); expect(context.state).toEqual(false); expect(context.stats).toBeUndefined(); - expect(loggerInfo.mock.calls[0][0]).toEqual('Compiling...'); + expect(loggerLog.mock.calls[0][0]).toEqual('Compilation starting...'); }); it('sets state, then logs stats and handles callbacks on nextTick from done hook', () => { @@ -123,11 +127,13 @@ describe('setupHooks', () => { { options: { name: 'comp1', + stats: {}, }, }, { options: { name: 'comp2', + stats: {}, }, }, ]; diff --git a/test/utils/setupOutputFileSystem.test.js b/test/utils/setupOutputFileSystem.test.js index b1dce0ab0..0e6df1904 100644 --- a/test/utils/setupOutputFileSystem.test.js +++ b/test/utils/setupOutputFileSystem.test.js @@ -3,6 +3,7 @@ import memfs from 'memfs'; import setupOutputFileSystem from '../../src/utils/setupOutputFileSystem'; const createFsFromVolume = jest.spyOn(memfs, 'createFsFromVolume'); + createFsFromVolume.mockImplementation(() => { return { testFs: true, diff --git a/test/validation-options.test.js b/test/validation-options.test.js index e6d7a3783..719e5c895 100644 --- a/test/validation-options.test.js +++ b/test/validation-options.test.js @@ -2,6 +2,9 @@ import middleware from '../src'; import getCompiler from './helpers/getCompiler'; +// Suppress unnecessary stats output +global.console.log = jest.fn(); + describe('validation', () => { const cases = { mimeTypes: {