From 2fe6d1f18bdb79bbfd57bf42676359623c6d9c86 Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Fri, 5 Dec 2025 14:50:31 +0300 Subject: [PATCH 1/2] fix: respect errors and warnings from minimizer without code --- package-lock.json | 18 +- src/index.js | 8 +- src/minify.js | 6 +- test/__snapshots__/minify-option.test.js.snap | 224 +++++++++++++++--- test/minify-option.test.js | 35 +++ 5 files changed, 249 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba787a0..3bd55a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4110,9 +4110,9 @@ "license": "MIT" }, "node_modules/@jest/reporters/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "dev": true, "license": "ISC", "dependencies": { @@ -13960,9 +13960,9 @@ "license": "MIT" }, "node_modules/jest-config/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "dev": true, "license": "ISC", "dependencies": { @@ -14693,9 +14693,9 @@ "license": "MIT" }, "node_modules/jest-runtime/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "dev": true, "license": "ISC", "dependencies": { diff --git a/src/index.js b/src/index.js index 0583051..7f544e4 100644 --- a/src/index.js +++ b/src/index.js @@ -622,7 +622,7 @@ class CssMinimizerPlugin { innerSourceMap, true, ); - } else { + } else if (item.code) { output.source = new RawSource(item.code); } } @@ -632,7 +632,7 @@ class CssMinimizerPlugin { inputSourceMap && CssMinimizerPlugin.isSourceMap(inputSourceMap); for (const error of result.errors) { - output.warnings.push( + output.errors.push( CssMinimizerPlugin.buildError( error, name, @@ -691,6 +691,10 @@ class CssMinimizerPlugin { } } + if (!output.source) { + return; + } + const newInfo = { minimized: true }; const { source } = output; diff --git a/src/minify.js b/src/minify.js index d97de87..77d8153 100644 --- a/src/minify.js +++ b/src/minify.js @@ -34,8 +34,10 @@ async function minify(options) { ); if (typeof minifyResult.code !== "string") { - throw new Error( - "minimizer function doesn't return the 'code' property or result is not a string value", + result.errors.push( + new Error( + "minimizer function doesn't return the 'code' property or result is not a string value", + ), ); } diff --git a/test/__snapshots__/minify-option.test.js.snap b/test/__snapshots__/minify-option.test.js.snap index c63c36b..16b5627 100644 --- a/test/__snapshots__/minify-option.test.js.snap +++ b/test/__snapshots__/minify-option.test.js.snap @@ -1,4 +1,42 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`"minify" option should work and allow to return errors and warnings from custom function without code: assets 1`] = ` +{ + "foo.css": "body { + font-weight: bold; +} + +body { + color: red; +} +body a { + text-align: center; +} +", +} +`; + +exports[`"minify" option should work and allow to return errors and warnings from custom function without code: error 1`] = ` +[ + "Error: foo.css from Css Minimizer plugin +Error 1", + "Error: foo.css from Css Minimizer plugin +Error: Error 2", + "Error: foo.css from Css Minimizer plugin +Error: minimizer function doesn't return the 'code' property or result is not a string value", +] +`; + +exports[`"minify" option should work and allow to return errors and warnings from custom function without code: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", + "Warning: foo.css from Css Minimizer plugin +Warning 1", + "Warning: foo.css from Css Minimizer plugin +Warning 2", +] +`; exports[`"minify" option should work and allow to return errors and warnings from custom function: assets 1`] = ` { @@ -6,14 +44,19 @@ exports[`"minify" option should work and allow to return errors and warnings fro } `; -exports[`"minify" option should work and allow to return errors and warnings from custom function: error 1`] = `[]`; - -exports[`"minify" option should work and allow to return errors and warnings from custom function: warning 1`] = ` +exports[`"minify" option should work and allow to return errors and warnings from custom function: error 1`] = ` [ "Error: foo.css from Css Minimizer plugin Error 1", "Error: foo.css from Css Minimizer plugin Error: Error 2", +] +`; + +exports[`"minify" option should work and allow to return errors and warnings from custom function: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", "Warning: foo.css from Css Minimizer plugin Warning 1", "Warning: foo.css from Css Minimizer plugin @@ -50,7 +93,12 @@ body a { exports[`"minify" option should work if minify is array && minimizerOptions is array: error 1`] = `[]`; -exports[`"minify" option should work if minify is array && minimizerOptions is array: warning 1`] = `[]`; +exports[`"minify" option should work if minify is array && minimizerOptions is array: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work if minify is array && minimizerOptions is object: assets 1`] = ` { @@ -80,7 +128,12 @@ body a { exports[`"minify" option should work if minify is array && minimizerOptions is object: error 1`] = `[]`; -exports[`"minify" option should work if minify is array && minimizerOptions is object: warning 1`] = `[]`; +exports[`"minify" option should work if minify is array && minimizerOptions is object: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work throw an error if minimizer function doesn't return #2: assets 1`] = ` { @@ -105,7 +158,12 @@ Error: minimizer function doesn't return the 'code' property or result is not a ] `; -exports[`"minify" option should work throw an error if minimizer function doesn't return #2: warning 1`] = `[]`; +exports[`"minify" option should work throw an error if minimizer function doesn't return #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work throw an error if minimizer function doesn't return: assets 1`] = ` { @@ -130,7 +188,12 @@ Error: minimizer function doesn't return the 'code' property or result is not a ] `; -exports[`"minify" option should work throw an error if minimizer function doesn't return: warning 1`] = `[]`; +exports[`"minify" option should work throw an error if minimizer function doesn't return: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -142,7 +205,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" mi exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -176,7 +244,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: assets 1`] = ` { @@ -188,9 +261,14 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": entry.js.map 1`] = `"{"version":3,"file":"entry.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;ACNO","sources":["webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./sugarss.js"],"sourcesContent":["// The require scope\\nvar __webpack_require__ = {};\\n\\n","// define getter functions for harmony exports\\n__webpack_require__.d = (exports, definition) => {\\n\\tfor(var key in definition) {\\n\\t\\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n\\t\\t\\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\\n\\t\\t}\\n\\t}\\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\\n__webpack_require__.r = (exports) => {\\n\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\n\\t\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\n\\t}\\n\\tObject.defineProperty(exports, '__esModule', { value: true });\\n};","export const foo = 'foo';\\n"],"names":[],"sourceRoot":""}"`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": entry.js.map 1`] = `"{"version":3,"file":"entry.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;ACNO","sources":["webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./sugarss.js"],"sourcesContent":["// The require scope\\nvar __webpack_require__ = {};\\n\\n","// define getter functions for harmony exports\\n__webpack_require__.d = (exports, definition) => {\\n\\tfor(var key in definition) {\\n\\t\\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n\\t\\t\\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\\n\\t\\t}\\n\\t}\\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\\n__webpack_require__.r = (exports) => {\\n\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\n\\t\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\n\\t}\\n\\tObject.defineProperty(exports, '__esModule', { value: true });\\n};","export const foo = 'foo';\\n"],"names":[],"sourceRoot":""}"`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": index.sss 1`] = `"a{color:#000}"`; @@ -202,7 +280,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify", "CssMinimizerPlugin.cssoMinify" and "CssMinimizerPlugin.cleanCssMinify" minifiers and generate source maps: assets 1`] = ` { @@ -236,7 +319,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -248,7 +336,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: assets 1`] = ` { @@ -258,7 +351,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and emit warnings: assets 1`] = ` { @@ -289,7 +387,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps: assets 1`] = ` { @@ -313,7 +416,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -325,7 +433,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -337,7 +450,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and options for "lightningcss": assets 1`] = ` { @@ -357,7 +475,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -369,7 +492,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -381,7 +509,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and options for "@parcel/css": assets 1`] = ` { @@ -401,7 +534,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -413,7 +551,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: assets 1`] = ` { @@ -425,7 +568,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and options for "swcMinify": assets 1`] = ` { @@ -445,7 +593,12 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with "clean-css" minifier: assets 1`] = ` { @@ -467,11 +620,24 @@ exports[`"minify" option should work with "csso" minifier: assets 1`] = ` exports[`"minify" option should work with "csso" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "csso" minifier: warning 1`] = `[]`; +exports[`"minify" option should work with "csso" minifier: warning 1`] = ` +[ + "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): +Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; exports[`"minify" option should work with empty code: assets 1`] = ` { - "foo.css": "", + "foo.css": "body { + color: red; +} +a { + color: blue; +} + +/*# sourceMappingURL=foo.css.map*/", + "foo.css.map": "{"version":3,"file":"foo.css","mappings":"AAAA;EACE,UAAU;AACZ;AACA;EACE,WAAW;AACb,C","sources":["webpack:///./foo.css"],"sourcesContent":["body {\\n color: red;\\n}\\na {\\n color: blue;\\n}"],"names":[],"sourceRoot":""}", } `; diff --git a/test/minify-option.test.js b/test/minify-option.test.js index d31e436..dca4f74 100644 --- a/test/minify-option.test.js +++ b/test/minify-option.test.js @@ -1293,4 +1293,39 @@ describe('"minify" option', () => { expect(getErrors(stats)).toMatchSnapshot("error"); expect(getWarnings(stats)).toMatchSnapshot("warning"); }); + + it("should work and allow to return errors and warnings from custom function without code", async () => { + const compiler = getCompiler({ + entry: { + foo: path.join(__dirname, "fixtures", "sourcemap", "foo.scss"), + }, + module: { + rules: [ + { + test: /.s?css$/i, + use: [ + MiniCssExtractPlugin.loader, + { loader: "css-loader", options: { sourceMap: true } }, + { loader: "sass-loader", options: { sourceMap: true } }, + ], + }, + ], + }, + }); + + new CssMinimizerPlugin({ + minify: async () => ({ + warnings: ["Warning 1", new Error("Warning 2")], + errors: ["Error 1", new Error("Error 2")], + }), + }).apply(compiler); + + const stats = await compile(compiler); + + expect(readAssets(compiler, stats, /\.css(\.map)?$/)).toMatchSnapshot( + "assets", + ); + expect(getErrors(stats)).toMatchSnapshot("error"); + expect(getWarnings(stats)).toMatchSnapshot("warning"); + }); }); From 9ba50272ac78fc02a92eeed9e3e0792a204be9d7 Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Fri, 5 Dec 2025 14:57:07 +0300 Subject: [PATCH 2/2] test: update snapshots --- test/__snapshots__/minify-option.test.js.snap | 169 +++--------------- 1 file changed, 25 insertions(+), 144 deletions(-) diff --git a/test/__snapshots__/minify-option.test.js.snap b/test/__snapshots__/minify-option.test.js.snap index 16b5627..59cca25 100644 --- a/test/__snapshots__/minify-option.test.js.snap +++ b/test/__snapshots__/minify-option.test.js.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`"minify" option should work and allow to return errors and warnings from custom function without code: assets 1`] = ` { @@ -29,8 +29,6 @@ Error: minimizer function doesn't return the 'code' property or result is not a exports[`"minify" option should work and allow to return errors and warnings from custom function without code: warning 1`] = ` [ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", "Warning: foo.css from Css Minimizer plugin Warning 1", "Warning: foo.css from Css Minimizer plugin @@ -55,8 +53,6 @@ Error: Error 2", exports[`"minify" option should work and allow to return errors and warnings from custom function: warning 1`] = ` [ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", "Warning: foo.css from Css Minimizer plugin Warning 1", "Warning: foo.css from Css Minimizer plugin @@ -93,12 +89,7 @@ body a { exports[`"minify" option should work if minify is array && minimizerOptions is array: error 1`] = `[]`; -exports[`"minify" option should work if minify is array && minimizerOptions is array: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work if minify is array && minimizerOptions is array: warning 1`] = `[]`; exports[`"minify" option should work if minify is array && minimizerOptions is object: assets 1`] = ` { @@ -128,12 +119,7 @@ body a { exports[`"minify" option should work if minify is array && minimizerOptions is object: error 1`] = `[]`; -exports[`"minify" option should work if minify is array && minimizerOptions is object: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work if minify is array && minimizerOptions is object: warning 1`] = `[]`; exports[`"minify" option should work throw an error if minimizer function doesn't return #2: assets 1`] = ` { @@ -158,12 +144,7 @@ Error: minimizer function doesn't return the 'code' property or result is not a ] `; -exports[`"minify" option should work throw an error if minimizer function doesn't return #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work throw an error if minimizer function doesn't return #2: warning 1`] = `[]`; exports[`"minify" option should work throw an error if minimizer function doesn't return: assets 1`] = ` { @@ -188,12 +169,7 @@ Error: minimizer function doesn't return the 'code' property or result is not a ] `; -exports[`"minify" option should work throw an error if minimizer function doesn't return: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work throw an error if minimizer function doesn't return: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -205,12 +181,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" mi exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cleanCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -244,12 +215,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: assets 1`] = ` { @@ -261,14 +227,9 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and generate source maps: warning 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": entry.js.map 1`] = `"{"version":3,"file":"entry.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;ACNO","sources":["webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./sugarss.js"],"sourcesContent":["// The require scope\\nvar __webpack_require__ = {};\\n\\n","// define getter functions for harmony exports\\n__webpack_require__.d = (exports, definition) => {\\n\\tfor(var key in definition) {\\n\\t\\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n\\t\\t\\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\\n\\t\\t}\\n\\t}\\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\\n__webpack_require__.r = (exports) => {\\n\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\n\\t\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\n\\t}\\n\\tObject.defineProperty(exports, '__esModule', { value: true });\\n};","export const foo = 'foo';\\n"],"names":[],"sourceRoot":""}"`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": entry.js.map 1`] = `"{"version":3,"file":"entry.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;ACNO","sources":["webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./sugarss.js"],"sourcesContent":["// The require scope\\nvar __webpack_require__ = {};\\n\\n","// define getter functions for harmony exports\\n__webpack_require__.d = (exports, definition) => {\\n\\tfor(var key in definition) {\\n\\t\\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n\\t\\t\\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\\n\\t\\t}\\n\\t}\\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\\n__webpack_require__.r = (exports) => {\\n\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\n\\t\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\n\\t}\\n\\tObject.defineProperty(exports, '__esModule', { value: true });\\n};","export const foo = 'foo';\\n"],"names":[],"sourceRoot":""}"`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier and parser option as "String": index.sss 1`] = `"a{color:#000}"`; @@ -280,12 +241,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cssnanoMinify", "CssMinimizerPlugin.cssoMinify" and "CssMinimizerPlugin.cleanCssMinify" minifiers and generate source maps: assets 1`] = ` { @@ -319,12 +275,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source map: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -336,12 +287,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: assets 1`] = ` { @@ -351,12 +297,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifi exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.cssoMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and emit warnings: assets 1`] = ` { @@ -387,12 +328,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and generate source maps: assets 1`] = ` { @@ -416,12 +352,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" min exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -433,12 +364,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -450,12 +376,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and generate source maps: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier and options for "lightningcss": assets 1`] = ` { @@ -475,12 +396,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.lightningCssMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -492,12 +408,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: assets 1`] = ` { @@ -509,12 +420,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and generate source maps: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier and options for "@parcel/css": assets 1`] = ` { @@ -534,12 +440,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" m exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.parcelCssMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: assets 1`] = ` { @@ -551,12 +452,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps #2: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: assets 1`] = ` { @@ -568,12 +464,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and generate source maps: warning 1`] = `[]`; exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier and options for "swcMinify": assets 1`] = ` { @@ -593,12 +484,7 @@ exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifie exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "CssMinimizerPlugin.swcMinify" minifier: warning 1`] = `[]`; exports[`"minify" option should work with "clean-css" minifier: assets 1`] = ` { @@ -620,12 +506,7 @@ exports[`"minify" option should work with "csso" minifier: assets 1`] = ` exports[`"minify" option should work with "csso" minifier: error 1`] = `[]`; -exports[`"minify" option should work with "csso" minifier: warning 1`] = ` -[ - "ModuleWarning: Module Warning (from ../../node_modules/sass-loader/dist/cjs.js): -Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.", -] -`; +exports[`"minify" option should work with "csso" minifier: warning 1`] = `[]`; exports[`"minify" option should work with empty code: assets 1`] = ` {