From 3e52969f0f6b1c9d4d16db41ebff8804b340742c Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Fri, 26 May 2023 17:57:02 +0300 Subject: [PATCH] fix: warning and error serialization (#1523) --- package-lock.json | 14 +- package.json | 2 +- src/CssSyntaxError.js | 29 - src/Warning.js | 22 - src/index.js | 8 +- src/utils.js | 53 ++ test/__snapshots__/exportType.test.js.snap | 97 ++- test/__snapshots__/import-option.test.js.snap | 416 +++++++--- test/__snapshots__/loader.test.js.snap | 6 +- test/__snapshots__/url-option.test.js.snap | 776 ++++++++++++------ 10 files changed, 934 insertions(+), 489 deletions(-) delete mode 100644 src/CssSyntaxError.js delete mode 100644 src/Warning.js diff --git a/package-lock.json b/package-lock.json index 5b460d55..2c136548 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "icss-utils": "^5.1.0", "postcss": "^8.4.21", "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.1", + "postcss-modules-local-by-default": "^4.0.3", "postcss-modules-scope": "^3.0.0", "postcss-modules-values": "^4.0.0", "postcss-value-parser": "^4.2.0", @@ -12940,9 +12940,9 @@ } }, "node_modules/postcss-modules-local-by-default": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.1.tgz", - "integrity": "sha512-Zr/dB+IlXaEqdoslLHhhqecwj73vc3rDmOpsBNBEVk7P2aqAlz+Ijy0fFbU5Ie9PtreDOIgGa9MsLWakVGl+fA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.3.tgz", + "integrity": "sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==", "dependencies": { "icss-utils": "^5.0.0", "postcss-selector-parser": "^6.0.2", @@ -25213,9 +25213,9 @@ "requires": {} }, "postcss-modules-local-by-default": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.1.tgz", - "integrity": "sha512-Zr/dB+IlXaEqdoslLHhhqecwj73vc3rDmOpsBNBEVk7P2aqAlz+Ijy0fFbU5Ie9PtreDOIgGa9MsLWakVGl+fA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.3.tgz", + "integrity": "sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==", "requires": { "icss-utils": "^5.0.0", "postcss-selector-parser": "^6.0.2", diff --git a/package.json b/package.json index aa7b5c36..fde5156b 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "icss-utils": "^5.1.0", "postcss": "^8.4.21", "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.1", + "postcss-modules-local-by-default": "^4.0.3", "postcss-modules-scope": "^3.0.0", "postcss-modules-values": "^4.0.0", "postcss-value-parser": "^4.2.0", diff --git a/src/CssSyntaxError.js b/src/CssSyntaxError.js deleted file mode 100644 index 385ef929..00000000 --- a/src/CssSyntaxError.js +++ /dev/null @@ -1,29 +0,0 @@ -export default class CssSyntaxError extends Error { - constructor(error) { - super(error); - - const { reason, line, column, file } = error; - - this.name = "CssSyntaxError"; - - // Based on https://github.com/postcss/postcss/blob/master/lib/css-syntax-error.es6#L132 - // We don't need `plugin` and `file` properties. - this.message = `${this.name}\n\n`; - - if (typeof line !== "undefined") { - this.message += `(${line}:${column}) `; - } - - this.message += file ? `${file} ` : " "; - this.message += `${reason}`; - - const code = error.showSourceCode(); - - if (code) { - this.message += `\n\n${code}\n`; - } - - // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror - this.stack = false; - } -} diff --git a/src/Warning.js b/src/Warning.js deleted file mode 100644 index ca08204d..00000000 --- a/src/Warning.js +++ /dev/null @@ -1,22 +0,0 @@ -export default class Warning extends Error { - constructor(warning) { - super(warning); - - const { text, line, column } = warning; - - this.name = "Warning"; - - // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74 - // We don't need `plugin` properties. - this.message = `${this.name}\n\n`; - - if (typeof line !== "undefined") { - this.message += `(${line}:${column}) `; - } - - this.message += `${text}`; - - // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror - this.stack = false; - } -} diff --git a/src/index.js b/src/index.js index 1502bb45..1e0bddf0 100644 --- a/src/index.js +++ b/src/index.js @@ -7,8 +7,6 @@ import postcss from "postcss"; import postcssPkg from "postcss/package.json"; import { satisfies } from "semver"; -import CssSyntaxError from "./CssSyntaxError"; -import Warning from "./Warning"; import schema from "./options.json"; import { icssParser, importParser, urlParser } from "./plugins"; import { @@ -27,6 +25,8 @@ import { sort, combineRequests, stringifyRequest, + warningFactory, + syntaxErrorFactory, } from "./utils"; export default async function loader(content, map, meta) { @@ -189,14 +189,14 @@ export default async function loader(content, map, meta) { } callback( - error.name === "CssSyntaxError" ? new CssSyntaxError(error) : error + error.name === "CssSyntaxError" ? syntaxErrorFactory(error) : error ); return; } for (const warning of result.warnings()) { - this.emitWarning(new Warning(warning)); + this.emitWarning(warningFactory(warning)); } const imports = [] diff --git a/src/utils.js b/src/utils.js index 9d6217be..02d3ef21 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1281,6 +1281,57 @@ function combineRequests(preRequest, url) { : preRequest + url; } +function warningFactory(obj) { + let message = ""; + + if (typeof obj.line !== "undefined") { + message += `(${obj.line}:${obj.column}) `; + } + + if (typeof obj.plugin !== "undefined") { + message += `from "${obj.plugin}" plugin: `; + } + + message += obj.text; + + if (obj.node) { + message += `\n\nCode:\n ${obj.node.toString()}\n`; + } + + const warning = new Error(message); + + warning.stack = null; + + return warning; +} + +function syntaxErrorFactory(obj) { + let message = "\nSyntaxError\n\n"; + + if (typeof obj.line !== "undefined") { + message += `(${obj.line}:${obj.column}) `; + } + + if (typeof obj.plugin !== "undefined") { + message += `from "${obj.plugin}" plugin: `; + } + + message += obj.file ? `${obj.file} ` : " "; + message += `${obj.reason}`; + + const code = obj.showSourceCode(); + + if (code) { + message += `\n\n${code}\n`; + } + + const error = new Error(message); + + error.stack = null; + + return error; +} + export { normalizeOptions, shouldUseModulesPlugins, @@ -1306,4 +1357,6 @@ export { stringifyRequest, isDataUrl, defaultGetLocalIdent, + warningFactory, + syntaxErrorFactory, }; diff --git a/test/__snapshots__/exportType.test.js.snap b/test/__snapshots__/exportType.test.js.snap index 42ab05bc..60b6608b 100644 --- a/test/__snapshots__/exportType.test.js.snap +++ b/test/__snapshots__/exportType.test.js.snap @@ -2202,68 +2202,101 @@ a { exports[`'exportType' option should work with 'css-style-sheet' value and urls: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; diff --git a/test/__snapshots__/import-option.test.js.snap b/test/__snapshots__/import-option.test.js.snap index a202bc3a..62acaa0f 100644 --- a/test/__snapshots__/import-option.test.js.snap +++ b/test/__snapshots__/import-option.test.js.snap @@ -1128,73 +1128,109 @@ a { exports[`"import" option should work when not specified and print correct output: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(105:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import nourl(test.css)\\" -(105:1) Unable to find uri in \\"@import nourl(test.css)\\"", +Code: + @import nourl(test.css) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(106:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import '\\\\ +\\\\ +\\\\ +'\\" -(106:1) Unable to find uri in \\"@import '\\\\ +Code: + @import '\\\\ \\\\ \\\\ -'\\"", +' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(12:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(12:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(13:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(13:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(14:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(14:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(154:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\" -(154:1) Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\"", +Code: + @import url('!!../../helpers/string-loader.js?esModule=false!') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(17:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import ''\\" -(17:1) Unable to find uri in \\"@import ''\\"", +Code: + @import '' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(18:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\"\\"\\" -(18:1) Unable to find uri in \\"@import \\"\\"\\"", +Code: + @import \\"\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(19:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" \\"\\" -(19:1) Unable to find uri in \\"@import \\" \\"\\"", +Code: + @import \\" \\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(20:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" +\\"\\" -(20:1) Unable to find uri in \\"@import \\" -\\"\\"", +Code: + @import \\" +\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(22:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(22:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(23:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(23:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(24:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(24:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(40:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" -(40:1) Unable to find uri in \\"@import \\"", +Code: + @import +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(41:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import foo-bar\\" -(41:1) Unable to find uri in \\"@import foo-bar\\"", +Code: + @import foo-bar +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(43:1) from \\"postcss-import-parser\\" plugin: It looks like you didn't end your @import statement correctly. Child nodes are attached to it. -(43:1) It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", +Code: + @import url('http://') :root {} +", ] `; @@ -1829,73 +1865,109 @@ a { exports[`"import" option should work when not specified: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(105:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import nourl(test.css)\\" -(105:1) Unable to find uri in \\"@import nourl(test.css)\\"", +Code: + @import nourl(test.css) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(106:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import '\\\\ +\\\\ +\\\\ +'\\" -(106:1) Unable to find uri in \\"@import '\\\\ +Code: + @import '\\\\ \\\\ \\\\ -'\\"", +' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(12:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(12:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(13:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(13:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(14:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(14:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(154:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\" -(154:1) Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\"", +Code: + @import url('!!../../helpers/string-loader.js?esModule=false!') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(17:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import ''\\" -(17:1) Unable to find uri in \\"@import ''\\"", +Code: + @import '' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(18:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\"\\"\\" -(18:1) Unable to find uri in \\"@import \\"\\"\\"", +Code: + @import \\"\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(19:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" \\"\\" -(19:1) Unable to find uri in \\"@import \\" \\"\\"", +Code: + @import \\" \\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(20:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" +\\"\\" -(20:1) Unable to find uri in \\"@import \\" -\\"\\"", +Code: + @import \\" +\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(22:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(22:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(23:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(23:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(24:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(24:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(40:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" -(40:1) Unable to find uri in \\"@import \\"", +Code: + @import +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(41:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import foo-bar\\" -(41:1) Unable to find uri in \\"@import foo-bar\\"", +Code: + @import foo-bar +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(43:1) from \\"postcss-import-parser\\" plugin: It looks like you didn't end your @import statement correctly. Child nodes are attached to it. -(43:1) It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", +Code: + @import url('http://') :root {} +", ] `; @@ -3124,73 +3196,109 @@ a { exports[`"import" option should work with a value equal to "true": warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(105:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import nourl(test.css)\\" -(105:1) Unable to find uri in \\"@import nourl(test.css)\\"", +Code: + @import nourl(test.css) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(106:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import '\\\\ +\\\\ +\\\\ +'\\" -(106:1) Unable to find uri in \\"@import '\\\\ +Code: + @import '\\\\ \\\\ \\\\ -'\\"", +' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(12:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(12:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(13:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(13:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(14:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(14:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(154:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\" -(154:1) Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\"", +Code: + @import url('!!../../helpers/string-loader.js?esModule=false!') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(17:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import ''\\" -(17:1) Unable to find uri in \\"@import ''\\"", +Code: + @import '' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(18:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\"\\"\\" -(18:1) Unable to find uri in \\"@import \\"\\"\\"", +Code: + @import \\"\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(19:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" \\"\\" -(19:1) Unable to find uri in \\"@import \\" \\"\\"", +Code: + @import \\" \\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(20:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" +\\"\\" -(20:1) Unable to find uri in \\"@import \\" -\\"\\"", +Code: + @import \\" +\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(22:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(22:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(23:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(23:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(24:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(24:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(40:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" -(40:1) Unable to find uri in \\"@import \\"", +Code: + @import +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(41:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import foo-bar\\" -(41:1) Unable to find uri in \\"@import foo-bar\\"", +Code: + @import foo-bar +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(43:1) from \\"postcss-import-parser\\" plugin: It looks like you didn't end your @import statement correctly. Child nodes are attached to it. -(43:1) It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", +Code: + @import url('http://') :root {} +", ] `; @@ -3695,72 +3803,108 @@ st.css'); exports[`"import" option should work with import.filter: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(105:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import nourl(test.css)\\" -(105:1) Unable to find uri in \\"@import nourl(test.css)\\"", +Code: + @import nourl(test.css) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(106:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import '\\\\ +\\\\ +\\\\ +'\\" -(106:1) Unable to find uri in \\"@import '\\\\ +Code: + @import '\\\\ \\\\ \\\\ -'\\"", +' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(12:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(12:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(13:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(13:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(14:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(14:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(154:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\" -(154:1) Unable to find uri in \\"@import url('!!../../helpers/string-loader.js?esModule=false!')\\"", +Code: + @import url('!!../../helpers/string-loader.js?esModule=false!') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(17:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import ''\\" -(17:1) Unable to find uri in \\"@import ''\\"", +Code: + @import '' +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(18:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\"\\"\\" -(18:1) Unable to find uri in \\"@import \\"\\"\\"", +Code: + @import \\"\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(19:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" \\"\\" -(19:1) Unable to find uri in \\"@import \\" \\"\\"", +Code: + @import \\" \\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(20:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" +\\"\\" -(20:1) Unable to find uri in \\"@import \\" -\\"\\"", +Code: + @import \\" +\\" +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(22:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url()\\" -(22:1) Unable to find uri in \\"@import url()\\"", +Code: + @import url() +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(23:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url('')\\" -(23:1) Unable to find uri in \\"@import url('')\\"", +Code: + @import url('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(24:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import url(\\"\\")\\" -(24:1) Unable to find uri in \\"@import url(\\"\\")\\"", +Code: + @import url(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(40:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import \\" -(40:1) Unable to find uri in \\"@import \\"", +Code: + @import +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(41:1) from \\"postcss-import-parser\\" plugin: Unable to find uri in \\"@import foo-bar\\" -(41:1) Unable to find uri in \\"@import foo-bar\\"", +Code: + @import foo-bar +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(43:1) from \\"postcss-import-parser\\" plugin: It looks like you didn't end your @import statement correctly. Child nodes are attached to it. -(43:1) It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", +Code: + @import url('http://') :root {} +", ] `; diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 961c8765..53db7461 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -193,7 +193,8 @@ exports[`loader should reuse \`ast\` from "postcss-loader": warnings 1`] = `Arra exports[`loader should throw an error on invisible spaces: errors 1`] = ` Array [ "ModuleBuildError: Module build failed (from \`replaced original path\`): -CssSyntaxError + +SyntaxError (1:8) /test/fixtures/invisible-space.css Unknown word @@ -208,7 +209,8 @@ exports[`loader should throw an error on invisible spaces: warnings 1`] = `Array exports[`loader should throw error on invalid css syntax: errors 1`] = ` Array [ "ModuleBuildError: Module build failed (from \`replaced original path\`): -CssSyntaxError + +SyntaxError (2:3) /test/fixtures/error.css Unknown word diff --git a/test/__snapshots__/url-option.test.js.snap b/test/__snapshots__/url-option.test.js.snap index b5743eea..959cb422 100644 --- a/test/__snapshots__/url-option.test.js.snap +++ b/test/__snapshots__/url-option.test.js.snap @@ -738,68 +738,101 @@ a { exports[`"url" option should work when not specified: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -1398,68 +1431,101 @@ a { exports[`"url" option should work with 'false' value of the 'esModule' option: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -2493,68 +2559,101 @@ a { exports[`"url" option should work with a value equal to "true": warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -3036,68 +3135,101 @@ export {};" exports[`"url" option should work with mini-css-extract-plugin: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -3667,68 +3799,101 @@ a { exports[`"url" option should work with the 'asset' type of asset modules: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -4298,68 +4463,101 @@ a { exports[`"url" option should work with the 'asset/inline' type of asset modules: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -4929,68 +5127,101 @@ a { exports[`"url" option should work with the 'asset/resource' type of asset modules: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `; @@ -5528,68 +5759,101 @@ a { exports[`"url" option should work with url.filter: warnings 1`] = ` Array [ "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(120:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url() xyz' -(120:3) Unable to find uri in 'background: green url() xyz'", +Code: + background: green url() xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(124:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url('') xyz' -(124:3) Unable to find uri in 'background: green url('') xyz'", +Code: + background: green url('') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(128:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(\\"\\") xyz' -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", +Code: + background: green url(\\"\\") xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(132:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url(' ') xyz' -(132:3) Unable to find uri in 'background: green url(' ') xyz'", +Code: + background: green url(' ') xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(136:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background: green url( + ) xyz' -(136:3) Unable to find uri in 'background: green url( - ) xyz'", +Code: + background: green url( + ) xyz +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(216:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: -webkit-image-set('')' -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", +Code: + background-image: -webkit-image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(218:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set('')' -(218:3) Unable to find uri in 'background-image: image-set('')'", +Code: + background-image: image-set('') +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(219:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\")' -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", +Code: + background-image: image-set(\\"\\") +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(220:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(\\"\\" 1x)' -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", +Code: + background-image: image-set(\\"\\" 1x) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(221:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url())' -(221:3) Unable to find uri in 'background-image: image-set(url())'", +Code: + background-image: image-set(url()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(222:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set( + url() + )' -(222:3) Unable to find uri in 'background-image: image-set( +Code: + background-image: image-set( url() - )'", + ) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(225:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(URL())' -(225:3) Unable to find uri in 'background-image: image-set(URL())'", +Code: + background-image: image-set(URL()) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(226:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(''))' -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", +Code: + background-image: image-set(url('')) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(227:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url(\\"\\"))' -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", +Code: + background-image: image-set(url(\\"\\")) +", "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning +(228:3) from \\"postcss-url-parser\\" plugin: Unable to find uri in 'background-image: image-set(url('') 1x)' -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", +Code: + background-image: image-set(url('') 1x) +", ] `;