diff --git a/cspell.json b/cspell.json index 7de82870f15..cebd8f9bd2d 100644 --- a/cspell.json +++ b/cspell.json @@ -193,6 +193,7 @@ "queryloader", "querystrings", "RBDT", + "reconsume", "recurse", "redeclaration", "reexecuted", diff --git a/lib/WarnCaseSensitiveModulesPlugin.js b/lib/WarnCaseSensitiveModulesPlugin.js index 77bfbb94567..11af42a590f 100644 --- a/lib/WarnCaseSensitiveModulesPlugin.js +++ b/lib/WarnCaseSensitiveModulesPlugin.js @@ -9,6 +9,7 @@ const CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning"); /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./NormalModule")} NormalModule */ class WarnCaseSensitiveModulesPlugin { /** @@ -25,6 +26,17 @@ class WarnCaseSensitiveModulesPlugin { const moduleWithoutCase = new Map(); for (const module of compilation.modules) { const identifier = module.identifier(); + + // Ignore `data:` URLs, because it's not a real path + if ( + /** @type {NormalModule} */ + (module).resourceResolveData !== undefined && + /** @type {NormalModule} */ + (module).resourceResolveData.encodedContent !== undefined + ) { + continue; + } + const lowerIdentifier = identifier.toLowerCase(); let map = moduleWithoutCase.get(lowerIdentifier); if (map === undefined) { diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js index 7b778e96443..80e6ddba316 100644 --- a/lib/asset/AssetGenerator.js +++ b/lib/asset/AssetGenerator.js @@ -108,9 +108,17 @@ const encodeDataUri = (encoding, source) => { const decodeDataUriContent = (encoding, content) => { const isBase64 = encoding === "base64"; - return isBase64 - ? Buffer.from(content, "base64") - : Buffer.from(decodeURIComponent(content), "ascii"); + + if (isBase64) { + return Buffer.from(content, "base64"); + } + + // If we can't decode return the original body + try { + return Buffer.from(decodeURIComponent(content), "ascii"); + } catch (_) { + return Buffer.from(content, "ascii"); + } }; const JS_TYPES = new Set(["javascript"]); diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index 2e6a0878183..7fb4311909c 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -17,21 +17,54 @@ const walkCssTokens = require("./walkCssTokens"); /** @typedef {import("../Parser").ParserState} ParserState */ /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - const CC_LEFT_CURLY = "{".charCodeAt(0); const CC_RIGHT_CURLY = "}".charCodeAt(0); const CC_COLON = ":".charCodeAt(0); const CC_SLASH = "/".charCodeAt(0); const CC_SEMICOLON = ";".charCodeAt(0); -const cssUnescape = str => { - return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => { - if (match.length > 2) { - return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); - } else { - return match[1]; +// https://www.w3.org/TR/css-syntax-3/#newline +// We don't have `preprocessing` stage, so we need specify all of them +const STRING_MULTILINE = /\\[\n\r\f]/g; +// https://www.w3.org/TR/css-syntax-3/#whitespace +const TRIM_WHITE_SPACES = /(^[ \t\n\r\f]*|[ \t\n\r\f]*$)/g; +const UNESCAPE = /\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g; +const IMAGE_SET_FUNCTION = /^(-\w+-)?image-set$/i; + +const normalizeUrl = (str, isString) => { + // Remove extra spaces and newlines: + // `url("im\ + // g.png")` + if (isString) { + str = str.replace(STRING_MULTILINE, ""); + } + + str = str + // Remove unnecessary spaces from `url(" img.png ")` + .replace(TRIM_WHITE_SPACES, "") + // Unescape + .replace(UNESCAPE, match => { + if (match.length > 2) { + return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); + } else { + return match[1]; + } + }); + + if (/^data:/i.test(str)) { + return str; + } + + if (str.includes("%")) { + // Convert `url('%2E/img.png')` -> `url('./img.png')` + try { + str = decodeURIComponent(str); + } catch (error) { + // Ignore } - }); + } + + return str; }; class LocConverter { @@ -137,8 +170,11 @@ class CssParser extends Parser { let modeData = undefined; let singleClassSelector = undefined; let lastIdentifier = undefined; - const modeStack = []; let awaitRightParenthesis = false; + /** @type [string, number, number][] */ + const functionStack = []; + const modeStack = []; + const isTopLevelLocal = () => modeData === "local" || (this.defaultMode === "local" && modeData === undefined); @@ -304,8 +340,11 @@ class CssParser extends Parser { isSelector: () => { return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE; }, - url: (input, start, end, contentStart, contentEnd) => { - const value = cssUnescape(input.slice(contentStart, contentEnd)); + url: (input, start, end, contentStart, contentEnd, isString) => { + let value = normalizeUrl( + input.slice(contentStart, contentEnd), + isString + ); switch (mode) { case CSS_MODE_AT_IMPORT_EXPECT_URL: { modeData.url = value; @@ -321,6 +360,15 @@ class CssParser extends Parser { )} at ${start} during ${explainMode(mode)}` ); default: { + if ( + // Ignore `url(#highlight)` URLs + /^#/.test(value) || + // Ignore `url()`, `url('')` and `url("")`, they are valid by spec + value.length === 0 + ) { + break; + } + const dep = new CssUrlDependency(value, [start, end], "url"); const { line: sl, column: sc } = locConverter.get(start); const { line: el, column: ec } = locConverter.get(end); @@ -335,10 +383,44 @@ class CssParser extends Parser { string: (input, start, end) => { switch (mode) { case CSS_MODE_AT_IMPORT_EXPECT_URL: { - modeData.url = cssUnescape(input.slice(start + 1, end - 1)); + modeData.url = normalizeUrl(input.slice(start + 1, end - 1), true); mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; break; } + default: { + // TODO move escaped parsing to tokenizer + const lastFunction = functionStack[functionStack.length - 1]; + + if ( + lastFunction && + (lastFunction[0].replace(/\\/g, "").toLowerCase() === "url" || + IMAGE_SET_FUNCTION.test(lastFunction[0].replace(/\\/g, ""))) + ) { + let value = normalizeUrl(input.slice(start + 1, end - 1), true); + + if ( + // Ignore `url(#highlight)` URLs + /^#/.test(value) || + // Ignore `url()`, `url('')` and `url("")`, they are valid by spec + value.length === 0 + ) { + break; + } + + const isUrl = + lastFunction[0].replace(/\\/g, "").toLowerCase() === "url"; + const dep = new CssUrlDependency( + value, + [start, end], + isUrl ? "string" : "url" + ); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + module.addCodeGenerationDependency(dep); + } + } } return end; }, @@ -523,6 +605,8 @@ class CssParser extends Parser { return end; }, rightParenthesis: (input, start, end) => { + functionStack.pop(); + switch (mode) { case CSS_MODE_TOP_LEVEL: { if (awaitRightParenthesis) { @@ -537,6 +621,7 @@ class CssParser extends Parser { break; } } + return end; }, pseudoClass: (input, start, end) => { @@ -564,9 +649,14 @@ class CssParser extends Parser { return end; }, pseudoFunction: (input, start, end) => { + let name = input.slice(start, end - 1); + + functionStack.push([name, start, end]); + switch (mode) { case CSS_MODE_TOP_LEVEL: { - const name = input.slice(start, end - 1).toLowerCase(); + name = name.toLowerCase(); + if (this.allowModeSwitch && name === ":global") { modeStack.push(modeData); modeData = "global"; @@ -587,9 +677,14 @@ class CssParser extends Parser { return end; }, function: (input, start, end) => { + let name = input.slice(start, end - 1); + + functionStack.push([name, start, end]); + switch (mode) { case CSS_MODE_IN_LOCAL_RULE: { - const name = input.slice(start, end - 1).toLowerCase(); + name = name.toLowerCase(); + if (name === "var") { let pos = walkCssTokens.eatWhitespaceAndComments(input, end); if (pos === input.length) return pos; diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index 26276b10a43..9c31029b02f 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -36,14 +36,16 @@ const CC_FORM_FEED = "\f".charCodeAt(0); const CC_TAB = "\t".charCodeAt(0); const CC_SPACE = " ".charCodeAt(0); -const CC_SLASH = "/".charCodeAt(0); -const CC_BACK_SLASH = "\\".charCodeAt(0); +const CC_SOLIDUS = "/".charCodeAt(0); +const CC_REVERSE_SOLIDUS = "\\".charCodeAt(0); const CC_ASTERISK = "*".charCodeAt(0); const CC_LEFT_PARENTHESIS = "(".charCodeAt(0); const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0); const CC_LEFT_CURLY = "{".charCodeAt(0); const CC_RIGHT_CURLY = "}".charCodeAt(0); +const CC_LEFT_SQUARE = "[".charCodeAt(0); +const CC_RIGHT_SQUARE = "]".charCodeAt(0); const CC_QUOTATION_MARK = '"'.charCodeAt(0); const CC_APOSTROPHE = "'".charCodeAt(0); @@ -100,28 +102,46 @@ const _isWhiteSpace = cc => { ); }; +const _isIdentStartCodePoint = cc => { + return ( + (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || + (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || + cc === CC_LOW_LINE || + cc >= 0x80 + ); +}; + /** @type {CharHandler} */ -const consumeSingleCharToken = (input, pos, callbacks) => { +const consumeDelimToken = (input, pos, callbacks) => { return pos + 1; }; /** @type {CharHandler} */ -const consumePotentialComment = (input, pos, callbacks) => { - pos++; - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos); - if (cc !== CC_ASTERISK) return pos; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { +const consumeComments = (input, pos, callbacks) => { + // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A + // ASTERISK (*), consume them and all following code points up to and including + // the first U+002A ASTERISK (*) followed by a U+002F SOLIDUS (/), or up to an + // EOF code point. Return to the start of this step. + // + // If the preceding paragraph ended by consuming an EOF code point, this is a parse error. + // But we are silent on errors. + if ( + input.charCodeAt(pos) === CC_SOLIDUS && + input.charCodeAt(pos + 1) === CC_ASTERISK + ) { + pos += 1; + while (pos < input.length) { + if ( + input.charCodeAt(pos) === CC_ASTERISK && + input.charCodeAt(pos + 1) === CC_SOLIDUS + ) { + pos += 2; + break; + } pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) return pos + 1; } } + return pos; }; /** @type {function(number): CharHandler} */ @@ -144,7 +164,7 @@ const _consumeString = (input, pos, end) => { // bad string return pos; } - if (cc === CC_BACK_SLASH) { + if (cc === CC_REVERSE_SOLIDUS) { // we don't need to fully parse the escaped code point // just skip over a potential new line pos++; @@ -165,6 +185,12 @@ const _isIdentifierStartCode = cc => { ); }; +const _isTwoCodePointsAreValidEscape = (first, second) => { + if (first !== CC_REVERSE_SOLIDUS) return false; + if (_isNewLine(second)) return false; + return true; +}; + const _isDigit = cc => { return cc >= CC_0 && cc <= CC_9; }; @@ -175,13 +201,13 @@ const _startsIdentifier = (input, pos) => { if (pos === input.length) return false; const cc = input.charCodeAt(pos + 1); if (cc === CC_HYPHEN_MINUS) return true; - if (cc === CC_BACK_SLASH) { + if (cc === CC_REVERSE_SOLIDUS) { const cc = input.charCodeAt(pos + 2); return !_isNewLine(cc); } return _isIdentifierStartCode(cc); } - if (cc === CC_BACK_SLASH) { + if (cc === CC_REVERSE_SOLIDUS) { const cc = input.charCodeAt(pos + 1); return !_isNewLine(cc); } @@ -208,6 +234,7 @@ const consumeMinus = (input, pos, callbacks) => { pos++; if (pos === input.length) return pos; const cc = input.charCodeAt(pos); + // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it. if (cc === CC_FULL_STOP || _isDigit(cc)) { return consumeNumericToken(input, pos, callbacks); } else if (cc === CC_HYPHEN_MINUS) { @@ -222,7 +249,7 @@ const consumeMinus = (input, pos, callbacks) => { return callbacks.identifier(input, start, pos); } } - } else if (cc === CC_BACK_SLASH) { + } else if (cc === CC_REVERSE_SOLIDUS) { if (pos + 1 === input.length) return pos; const cc = input.charCodeAt(pos + 1); if (_isNewLine(cc)) return pos; @@ -231,11 +258,7 @@ const consumeMinus = (input, pos, callbacks) => { return callbacks.identifier(input, start, pos); } } else if (_isIdentifierStartCode(cc)) { - pos++; - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } + pos = consumeOtherIdentifier(input, pos - 1, callbacks); } return pos; }; @@ -289,9 +312,10 @@ const consumeOtherIdentifier = (input, pos, callbacks) => { const consumePotentialUrl = (input, pos, callbacks) => { const start = pos; pos = _consumeIdentifier(input, pos); + const nextPos = pos + 1; if ( pos === start + 3 && - input.slice(start, pos + 1).toLowerCase() === "url(" + input.slice(start, nextPos).toLowerCase() === "url(" ) { pos++; let cc = input.charCodeAt(pos); @@ -301,26 +325,15 @@ const consumePotentialUrl = (input, pos, callbacks) => { cc = input.charCodeAt(pos); } if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) { - pos++; - const contentStart = pos; - pos = _consumeString(input, pos, cc); - const contentEnd = pos - 1; - cc = input.charCodeAt(pos); - while (_isWhiteSpace(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); + if (callbacks.function !== undefined) { + return callbacks.function(input, start, nextPos); } - if (cc !== CC_RIGHT_PARENTHESIS) return pos; - pos++; - if (callbacks.url !== undefined) - return callbacks.url(input, start, pos, contentStart, contentEnd); - return pos; + return nextPos; } else { const contentStart = pos; let contentEnd; for (;;) { - if (cc === CC_BACK_SLASH) { + if (cc === CC_REVERSE_SOLIDUS) { pos++; if (pos === input.length) return pos; pos++; @@ -439,7 +452,7 @@ const consumeComma = (input, pos, callbacks) => { const _consumeIdentifier = (input, pos) => { for (;;) { const cc = input.charCodeAt(pos); - if (cc === CC_BACK_SLASH) { + if (cc === CC_REVERSE_SOLIDUS) { pos++; if (pos === input.length) return pos; pos++; @@ -513,7 +526,6 @@ const consumeLessThan = (input, pos, callbacks) => { return pos + 1; }; -/** @type {CharHandler} */ const consumeAt = (input, pos, callbacks) => { const start = pos; pos++; @@ -527,65 +539,102 @@ const consumeAt = (input, pos, callbacks) => { return pos; }; +/** @type {CharHandler} */ +const consumeReverseSolidus = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + // If the input stream starts with a valid escape, reconsume the current input code point, consume an ident-like token, and return it. + if ( + _isTwoCodePointsAreValidEscape( + input.charCodeAt(start), + input.charCodeAt(pos) + ) + ) { + return consumeOtherIdentifier(input, pos - 1, callbacks); + } + // Otherwise, this is a parse error. Return a with its value set to the current input code point. + return pos; +}; + const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { // https://drafts.csswg.org/css-syntax/#consume-token switch (cc) { + // whitespace case CC_LINE_FEED: case CC_CARRIAGE_RETURN: case CC_FORM_FEED: case CC_TAB: case CC_SPACE: return consumeSpace; + // U+0022 QUOTATION MARK (") case CC_QUOTATION_MARK: - case CC_APOSTROPHE: return consumeString(cc); + // U+0023 NUMBER SIGN (#) case CC_NUMBER_SIGN: return consumeNumberSign; - case CC_SLASH: - return consumePotentialComment; - // case CC_LEFT_SQUARE: - // case CC_RIGHT_SQUARE: - // case CC_COMMA: - // case CC_COLON: - // return consumeSingleCharToken; - case CC_COMMA: - return consumeComma; - case CC_SEMICOLON: - return consumeSemicolon; + // U+0027 APOSTROPHE (') + case CC_APOSTROPHE: + return consumeString(cc); + // U+0028 LEFT PARENTHESIS (() case CC_LEFT_PARENTHESIS: return consumeLeftParenthesis; + // U+0029 RIGHT PARENTHESIS ()) case CC_RIGHT_PARENTHESIS: return consumeRightParenthesis; - case CC_LEFT_CURLY: - return consumeLeftCurlyBracket; - case CC_RIGHT_CURLY: - return consumeRightCurlyBracket; - case CC_COLON: - return consumePotentialPseudo; + // U+002B PLUS SIGN (+) case CC_PLUS_SIGN: return consumeNumericToken; - case CC_FULL_STOP: - return consumeDot; + // U+002C COMMA (,) + case CC_COMMA: + return consumeComma; + // U+002D HYPHEN-MINUS (-) case CC_HYPHEN_MINUS: return consumeMinus; + // U+002E FULL STOP (.) + case CC_FULL_STOP: + return consumeDot; + // U+003A COLON (:) + case CC_COLON: + return consumePotentialPseudo; + // U+003B SEMICOLON (;) + case CC_SEMICOLON: + return consumeSemicolon; + // U+003C LESS-THAN SIGN (<) case CC_LESS_THAN_SIGN: return consumeLessThan; + // U+0040 COMMERCIAL AT (@) case CC_AT_SIGN: return consumeAt; + // U+005B LEFT SQUARE BRACKET ([) + case CC_LEFT_SQUARE: + return consumeDelimToken; + // U+005C REVERSE SOLIDUS (\) + case CC_REVERSE_SOLIDUS: + return consumeReverseSolidus; + // U+005D RIGHT SQUARE BRACKET (]) + case CC_RIGHT_SQUARE: + return consumeDelimToken; + // U+007B LEFT CURLY BRACKET ({) + case CC_LEFT_CURLY: + return consumeLeftCurlyBracket; + // U+007D RIGHT CURLY BRACKET (}) + case CC_RIGHT_CURLY: + return consumeRightCurlyBracket; + // Optimization case CC_LOWER_U: case CC_UPPER_U: return consumePotentialUrl; - case CC_LOW_LINE: - return consumeOtherIdentifier; default: + // digit if (_isDigit(cc)) return consumeNumericToken; - if ( - (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || - (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) - ) { + // ident-start code point + if (_isIdentStartCodePoint(cc)) { return consumeOtherIdentifier; } - return consumeSingleCharToken; + // EOF, but we don't have it + // anything else + return consumeDelimToken; } }); @@ -595,9 +644,15 @@ const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { * @returns {void} */ module.exports = (input, callbacks) => { + // This section describes how to consume a token from a stream of code points. It will return a single token of any type. let pos = 0; while (pos < input.length) { + // Consume comments. + pos = consumeComments(input, pos, callbacks); + const cc = input.charCodeAt(pos); + + // Consume the next input code point. if (cc < 0x80) { pos = CHAR_MAP[cc](input, pos, callbacks); } else { @@ -609,7 +664,7 @@ module.exports = (input, callbacks) => { module.exports.eatComments = (input, pos) => { loop: for (;;) { const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { + if (cc === CC_SOLIDUS) { if (pos === input.length) return pos; let cc = input.charCodeAt(pos + 1); if (cc !== CC_ASTERISK) return pos; @@ -622,7 +677,7 @@ module.exports.eatComments = (input, pos) => { pos++; if (pos === input.length) return pos; cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { + if (cc === CC_SOLIDUS) { pos++; continue loop; } @@ -636,7 +691,7 @@ module.exports.eatComments = (input, pos) => { module.exports.eatWhitespaceAndComments = (input, pos) => { loop: for (;;) { const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { + if (cc === CC_SOLIDUS) { if (pos === input.length) return pos; let cc = input.charCodeAt(pos + 1); if (cc !== CC_ASTERISK) return pos; @@ -649,7 +704,7 @@ module.exports.eatWhitespaceAndComments = (input, pos) => { pos++; if (pos === input.length) return pos; cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { + if (cc === CC_SOLIDUS) { pos++; continue loop; } diff --git a/lib/dependencies/CssUrlDependency.js b/lib/dependencies/CssUrlDependency.js index 8c16310f35a..ea48d1280e2 100644 --- a/lib/dependencies/CssUrlDependency.js +++ b/lib/dependencies/CssUrlDependency.js @@ -27,12 +27,12 @@ class CssUrlDependency extends ModuleDependency { /** * @param {string} request request * @param {[number, number]} range range of the argument - * @param {string} cssFunctionKind kind of css function, e. g. url(), image() + * @param {"string" | "url"} urlType dependency type e.g. url() or string */ - constructor(request, range, cssFunctionKind) { + constructor(request, range, urlType) { super(request); this.range = range; - this.cssFunctionKind = cssFunctionKind; + this.urlType = urlType; } get type() { @@ -54,13 +54,13 @@ class CssUrlDependency extends ModuleDependency { serialize(context) { const { write } = context; - write(this.cssFunctionKind); + write(this.urlType); super.serialize(context); } deserialize(context) { const { read } = context; - this.cssFunctionKind = read(); + this.urlType = read(); super.deserialize(context); } } @@ -112,18 +112,32 @@ CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( ) { const dep = /** @type {CssUrlDependency} */ (dependency); - source.replace( - dep.range[0], - dep.range[1] - 1, - `${dep.cssFunctionKind}(${cssEscapeString( - runtimeTemplate.assetUrl({ - publicPath: "", - runtime, - module: moduleGraph.getModule(dep), - codeGenerationResults - }) - )})` - ); + let newValue; + + switch (dep.urlType) { + case "string": + newValue = cssEscapeString( + runtimeTemplate.assetUrl({ + publicPath: "", + runtime, + module: moduleGraph.getModule(dep), + codeGenerationResults + }) + ); + break; + case "url": + newValue = `url(${cssEscapeString( + runtimeTemplate.assetUrl({ + publicPath: "", + runtime, + module: moduleGraph.getModule(dep), + codeGenerationResults + }) + )})`; + break; + } + + source.replace(dep.range[0], dep.range[1] - 1, newValue); } }; diff --git a/lib/schemes/DataUriPlugin.js b/lib/schemes/DataUriPlugin.js index 8ca09e20aca..6ef1038fb7a 100644 --- a/lib/schemes/DataUriPlugin.js +++ b/lib/schemes/DataUriPlugin.js @@ -19,9 +19,18 @@ const decodeDataURI = uri => { const isBase64 = match[3]; const body = match[4]; - return isBase64 - ? Buffer.from(body, "base64") - : Buffer.from(decodeURIComponent(body), "ascii"); + + if (isBase64) { + return Buffer.from(body, "base64"); + } + + // CSS allows to use `data:image/svg+xml;utf8,` + // so we return original body if we can't `decodeURIComponent` + try { + return Buffer.from(decodeURIComponent(body), "ascii"); + } catch (_) { + return Buffer.from(body, "ascii"); + } }; class DataUriPlugin { diff --git a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap index af7e390a3dc..1864b090871 100644 --- a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap +++ b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap @@ -1,19 +1,263 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ConfigCacheTestCases css urls exported tests should be able to handle styles in spacing.css 1`] = ` +exports[`ConfigCacheTestCases css urls exported tests should be able to handle styles in div.css 1`] = ` Object { + "--foo": " url(img.09a1a1112c577c279435.png)", + "--foo-bar": " \\"http://www.example.com/pinkish.gif\\"", + "/* TODO fix me */ + /*a146": " url('./img.png', 'foo', './img.png', url('./img.png'));*/ + /*a147: image-set(url('./img.png', 'foo', './img.png', url('./img.png')) 1x, url(\\"./img2x.png\\") 2x);*/ +", "a": " url(img.09a1a1112c577c279435.png)", + "a1": " url(img.09a1a1112c577c279435.png)", + "a10": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "a100": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a101": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a102": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a103": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a104": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a105": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a106": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a107": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a108": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a109": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a11": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "a110": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a111": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a112": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a113": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a114": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a115": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a116": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a117": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a118": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a119": " url(img.09a1a1112c577c279435.png)", + "a12": " green url(img.09a1a1112c577c279435.png) xyz", + "a120": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a121": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a122": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a123": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a124": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a125": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a126": " url(img.09a1a1112c577c279435.png)", + "a127": " url(img.09a1a1112c577c279435.png)", + "a128": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a129": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a13": " green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz", + "a130": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a131": " url(img.09a1a1112c577c279435.png)", + "a132": " url(img.09a1a1112c577c279435.png)", + "a133": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a134": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a135": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a136": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a137": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a138": " url(img.09a1a1112c577c279435.png?bar=foo)", + "a139": " url(img.09a1a1112c577c279435.png?foo=bar#foo)", + "a14": " url(\\"data:image/svg+xml;charset=utf-8,\\")", + "a140": " url(img.09a1a1112c577c279435.png?bar=foo#bar)", + "a141": " url(img.09a1a1112c577c279435.png?foo=1&bar=2)", + "a142": " url(img.09a1a1112c577c279435.png?foo=2&bar=1)", + "a143": " url(data:image/svg+xml;charset=UTF-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20width%3D%22191px%22%20height%3D%22191px%22%20viewBox%3D%220%200%20191%20191%22%20enable-background%3D%22new%200%200%20191%20191%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M95.5%2C0C42.8%2C0%2C0%2C42.8%2C0%2C95.5S42.8%2C191%2C95.5%2C191S191%2C148.2%2C191%2C95.5S148.2%2C0%2C95.5%2C0z%20M95.5%2C187.6%0A%09c-50.848%2C0-92.1-41.25-92.1-92.1c0-50.848%2C41.252-92.1%2C92.1-92.1c50.85%2C0%2C92.1%2C41.252%2C92.1%2C92.1%0A%09C187.6%2C146.35%2C146.35%2C187.6%2C95.5%2C187.6z%22%2F%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M92.9%2C10v8.6H91v-6.5c-0.1%2C0.1-0.2%2C0.2-0.4%2C0.3c-0.2%2C0.1-0.3%2C0.2-0.4%2C0.2c-0.1%2C0-0.3%2C0.1-0.5%2C0.2%0A%09%09c-0.2%2C0.1-0.3%2C0.1-0.5%2C0.1v-1.6c0.5-0.1%2C0.9-0.3%2C1.4-0.5c0.5-0.2%2C0.8-0.5%2C1.2-0.7h1.1V10z%22%2F%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M97.1%2C17.1h3.602v1.5h-5.6V18c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.6%2C0.5-0.9c0.2-0.3%2C0.5-0.5%2C0.7-0.7%0A%09%09c0.2-0.2%2C0.5-0.4%2C0.7-0.6c0.199-0.2%2C0.5-0.3%2C0.6-0.5c0.102-0.2%2C0.301-0.3%2C0.5-0.5c0.2-0.2%2C0.2-0.3%2C0.301-0.5%0A%09%09c0.101-0.2%2C0.101-0.3%2C0.101-0.5c0-0.4-0.101-0.6-0.3-0.8c-0.2-0.2-0.4-0.3-0.801-0.3c-0.699%2C0-1.399%2C0.3-2.101%2C0.9v-1.6%0A%09%09c0.7-0.5%2C1.5-0.7%2C2.5-0.7c0.399%2C0%2C0.8%2C0.1%2C1.101%2C0.2c0.301%2C0.1%2C0.601%2C0.3%2C0.899%2C0.5c0.3%2C0.2%2C0.399%2C0.5%2C0.5%2C0.8%0A%09%09c0.101%2C0.3%2C0.2%2C0.6%2C0.2%2C1s-0.102%2C0.7-0.2%2C1c-0.099%2C0.3-0.3%2C0.6-0.5%2C0.8c-0.2%2C0.2-0.399%2C0.5-0.7%2C0.7c-0.3%2C0.2-0.5%2C0.4-0.8%2C0.6%0A%09%09c-0.2%2C0.1-0.399%2C0.3-0.5%2C0.4s-0.3%2C0.3-0.5%2C0.4s-0.2%2C0.3-0.3%2C0.4C97.1%2C17%2C97.1%2C17%2C97.1%2C17.1z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M15%2C95.4c0%2C0.7-0.1%2C1.4-0.2%2C2c-0.1%2C0.6-0.4%2C1.1-0.7%2C1.5C13.8%2C99.3%2C13.4%2C99.6%2C12.9%2C99.8s-1%2C0.3-1.5%2C0.3%0A%09%09c-0.7%2C0-1.3-0.1-1.8-0.3v-1.5c0.4%2C0.3%2C1%2C0.4%2C1.6%2C0.4c0.6%2C0%2C1.1-0.2%2C1.5-0.7c0.4-0.5%2C0.5-1.1%2C0.5-1.9l0%2C0%0A%09%09C12.8%2C96.7%2C12.3%2C96.9%2C11.5%2C96.9c-0.3%2C0-0.7-0.102-1-0.2c-0.3-0.101-0.5-0.3-0.8-0.5c-0.3-0.2-0.4-0.5-0.5-0.8%0A%09%09c-0.1-0.3-0.2-0.7-0.2-1c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.7%2C0.6-0.9c0.3-0.2%2C0.6-0.5%2C0.9-0.6c0.3-0.1%2C0.8-0.2%2C1.2-0.2%0A%09%09c0.5%2C0%2C0.9%2C0.1%2C1.2%2C0.3c0.3%2C0.2%2C0.7%2C0.4%2C0.9%2C0.8s0.5%2C0.7%2C0.6%2C1.2S15%2C94.8%2C15%2C95.4z%20M13.1%2C94.4c0-0.2%2C0-0.4-0.1-0.6%0A%09%09c-0.1-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.3-0.1-0.5-0.1c-0.2%2C0-0.3%2C0-0.4%2C0.1s-0.3%2C0.2-0.3%2C0.3%0A%09%09c0%2C0.1-0.2%2C0.3-0.2%2C0.4c0%2C0.1-0.1%2C0.4-0.1%2C0.6c0%2C0.2%2C0%2C0.4%2C0.1%2C0.6c0.1%2C0.2%2C0.1%2C0.3%2C0.2%2C0.4c0.1%2C0.1%2C0.2%2C0.2%2C0.4%2C0.3%0A%09%09c0.2%2C0.1%2C0.3%2C0.1%2C0.5%2C0.1c0.2%2C0%2C0.3%2C0%2C0.4-0.1s0.2-0.2%2C0.3-0.3c0.1-0.1%2C0.2-0.2%2C0.2-0.4C13%2C94.7%2C13.1%2C94.6%2C13.1%2C94.4z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M176%2C99.7V98.1c0.6%2C0.4%2C1.2%2C0.602%2C2%2C0.602c0.5%2C0%2C0.8-0.102%2C1.1-0.301c0.301-0.199%2C0.4-0.5%2C0.4-0.801%0A%09%09c0-0.398-0.2-0.699-0.5-0.898c-0.3-0.2-0.8-0.301-1.3-0.301h-0.802V95h0.701c1.101%2C0%2C1.601-0.4%2C1.601-1.1c0-0.7-0.4-1-1.302-1%0A%09%09c-0.6%2C0-1.1%2C0.2-1.6%2C0.5v-1.5c0.6-0.3%2C1.301-0.4%2C2.1-0.4c0.9%2C0%2C1.5%2C0.2%2C2%2C0.6s0.701%2C0.9%2C0.701%2C1.5c0%2C1.1-0.601%2C1.8-1.701%2C2.1l0%2C0%0A%09%09c0.602%2C0.1%2C1.102%2C0.3%2C1.4%2C0.6s0.5%2C0.8%2C0.5%2C1.3c0%2C0.801-0.3%2C1.4-0.9%2C1.9c-0.6%2C0.5-1.398%2C0.7-2.398%2C0.7%0A%09%09C177.2%2C100.1%2C176.5%2C100%2C176%2C99.7z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M98.5%2C179.102c0%2C0.398-0.1%2C0.799-0.2%2C1.199C98.2%2C180.7%2C98%2C181%2C97.7%2C181.2s-0.601%2C0.5-0.9%2C0.601%0A%09%09c-0.3%2C0.1-0.7%2C0.199-1.2%2C0.199c-0.5%2C0-0.9-0.1-1.3-0.3c-0.4-0.2-0.7-0.399-0.9-0.8c-0.2-0.4-0.5-0.7-0.6-1.2%0A%09%09c-0.1-0.5-0.2-1-0.2-1.601c0-0.699%2C0.1-1.399%2C0.3-2c0.2-0.601%2C0.4-1.101%2C0.8-1.5c0.4-0.399%2C0.7-0.699%2C1.2-1c0.5-0.3%2C1-0.3%2C1.6-0.3%0A%09%09c0.6%2C0%2C1.2%2C0.101%2C1.5%2C0.199v1.5c-0.4-0.199-0.9-0.399-1.4-0.399c-0.3%2C0-0.6%2C0.101-0.8%2C0.2c-0.2%2C0.101-0.5%2C0.3-0.7%2C0.5%0A%09%09c-0.2%2C0.199-0.3%2C0.5-0.4%2C0.8c-0.1%2C0.301-0.2%2C0.7-0.2%2C1.101l0%2C0c0.4-0.601%2C1-0.8%2C1.8-0.8c0.3%2C0%2C0.7%2C0.1%2C0.9%2C0.199%0A%09%09c0.2%2C0.101%2C0.5%2C0.301%2C0.7%2C0.5c0.199%2C0.2%2C0.398%2C0.5%2C0.5%2C0.801C98.5%2C178.2%2C98.5%2C178.7%2C98.5%2C179.102z%20M96.7%2C179.2%0A%09%09c0-0.899-0.4-1.399-1.1-1.399c-0.2%2C0-0.3%2C0-0.5%2C0.1c-0.2%2C0.101-0.3%2C0.201-0.4%2C0.301c-0.1%2C0.101-0.2%2C0.199-0.2%2C0.4%0A%09%09c0%2C0.199-0.1%2C0.299-0.1%2C0.5c0%2C0.199%2C0%2C0.398%2C0.1%2C0.6s0.1%2C0.3%2C0.2%2C0.5c0.1%2C0.199%2C0.2%2C0.199%2C0.4%2C0.3c0.2%2C0.101%2C0.3%2C0.101%2C0.5%2C0.101%0A%09%09c0.2%2C0%2C0.3%2C0%2C0.5-0.101c0.2-0.101%2C0.301-0.199%2C0.301-0.3c0-0.1%2C0.199-0.301%2C0.199-0.399C96.6%2C179.7%2C96.7%2C179.4%2C96.7%2C179.2z%22%2F%3E%0A%3C%2Fg%3E%0A%3Ccircle%20fill%3D%22%23636363%22%20cx%3D%2295%22%20cy%3D%2295%22%20r%3D%227%22%2F%3E%0A%3C%2Fsvg%3E%0A) 50% 50%/191px no-repeat", + "a144": " url(img.09a1a1112c577c279435.png)", + "a145": " url(img.09a1a1112c577c279435.png)", + "a148": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a149": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a15": " url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E)", + "a150": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a151": " url('data:image/svg+xml;utf8,')", + "a152": " url(img.09a1a1112c577c279435.png)", + "a153": " url(img.09a1a1112c577c279435.png)", + "a154": " url(other.09a1a1112c577c279435.png)", + "a155": " url(img.09a1a1112c577c279435.png)", + "a156": " url(\\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e\\")", + "a157": " url('data:image/svg+xml;utf8,')", + "a158": " src(\\"http://www.example.com/pinkish.gif\\")", + "a159": " src(var(--foo))", + "a16": " url('data:image/svg+xml;charset=utf-8,#filter')", + "a160": " url(img.09a1a1112c577c279435.png param(--color var(--primary-color)))", + "a161": " src(\\"img.png\\" param(--color var(--primary-color)))", + "a162": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a163": " url(img.09a1a1112c577c279435.png)", + "a164": " url( img.png bug)", + "a165": " url(imgn.09a1a1112c577c279435.png)", + "a166": " url('data:image/svg+xml;utf8,')", + "a167": " url(http://example.com/image.jpg)", + "a168": " url(http://example.com/image.jpg)", + "a169": " url(data:,)", + "a17": " url(\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter\\")", + "a170": " url(data:,)", + "a171": " image(ltr 'img.png#xywh=0,0,16,16', red)", + "a172": " image-set( + linear-gradient(blue, white) 1x, + linear-gradient(blue, green) 2x + )", + "a173": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") + )", + "a174": " image-set( + url(img.09a1a1112c577c279435.png) 1x, + url(img.09a1a1112c577c279435.png) 2x + )", + "a175": " image-set( + url(img.09a1a1112c577c279435.png) 1x, + url(img.09a1a1112c577c279435.png) 2x, + url(img.09a1a1112c577c279435.png) 3x + )", + "a176": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") + ) \\"img.png\\"", + "a177": " image-set( + url(img.09a1a1112c577c279435.png) 1x type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) 2x type(\\"image/png\\") + )", + "a178": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") 1x, + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") 2x + )", + "a179": " -webkit-image-set( + url(img.09a1a1112c577c279435.png) 1x + )", + "a18": " url(#highlight)", + "a180": " -webkit-image-set( + url(img.09a1a1112c577c279435.png var(--foo, \\"test.png\\")) 1x + )", + "a181": " src( \\"img.png\\" )", + "a182": " src('img.png')", + "a183": " src('img.png' var(--foo, \\"test.png\\"))", + "a184": " src(var(--foo, \\"test.png\\"))", + "a185": " src(\\" img.png \\")", + "a186": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a187": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a188": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a189": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a19": " url('#line-marker')", + "a190": " image-set(url(img.09a1a1112c577c279435.png)1x)", + "a191": " image-set(url(img.09a1a1112c577c279435.png)1x/* test*/,/* test*/url(img.09a1a1112c577c279435.png)2x)", + "a197": " \\\\u\\\\r\\\\l(img.09a1a1112c577c279435.png)", + "a198": " \\\\image-\\\\set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a199": " \\\\-webk\\\\it-image-set(url(img.09a1a1112c577c279435.png)1x)", + "a2": " url(img.09a1a1112c577c279435.png)", + "a200": "-webkit-image-set(url(img.09a1a1112c577c279435.png)1x)", + "a22": " \\"do not use url(path)\\"", + "a23": " 'do not \\"use\\" url(path)'", + "a24": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x) +", + "a25": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x) +", + "a26": " green url() xyz", + "a27": " green url('') xyz", + "a28": " green url(\\"\\") xyz", + "a29": " green url(' ') xyz", + "a3": " url(img.09a1a1112c577c279435.png)", + "a30": " green url( + ) xyz", + "a4": " url(img.09a1a1112c577c279435.png#hash)", + "a40": " green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz", + "a41": " green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz", + "a42": " url(img.09a1a1112c577c279435.png?foo)", + "a43": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a44": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a45": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a46": " url(img.09a1a1112c577c279435.png?)", + "a47": " url(img.09a1a1112c577c279435.png) url(\\"data:image/svg+xml;charset=utf-8,\\") url(img.09a1a1112c577c279435.png)", + "a48": " __URL__()", + "a49": " url(img-simple.09a1a1112c577c279435.png)", + "a5": " url( + img.09a1a1112c577c279435.png + )", + "a50": " url(img-simple.09a1a1112c577c279435.png)", + "a51": " url(img-simple.09a1a1112c577c279435.png)", + "a52": " url(img.09a1a1112c577c279435.png)", + "a53": " url(img.09a1a1112c577c279435.png)", + "a55": " -webkit-image-set()", + "a56": " image-set()", + "a58": " image-set('')", + "a59": " image-set(\\"\\")", + "a6": " green url( img.09a1a1112c577c279435.png ) xyz", + "a60": " image-set(\\"\\" 1x)", + "a61": " image-set(url())", + "a62": " image-set( + url() + )", + "a63": " image-set(URL())", + "a64": " image-set(url(''))", + "a65": " image-set(url(\\"\\"))", + "a66": " image-set(url('') 1x)", + "a67": " image-set(1x)", + "a68": " image-set( + 1x + )", + "a69": " image-set(calc(1rem + 1px) 1x)", + "a7": " green url( img.09a1a1112c577c279435.png ) xyz", + "a70": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a71": " image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a72": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a73": " image-set(url(img\\\\ img.09a1a1112c577c279435.png) 1x, url(img\\\\ img.09a1a1112c577c279435.png) 2x)", + "a74": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x), + image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a75": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x, + url(img2x.09a1a1112c577c279435.png) 2x, + url(img3x.09a1a1112c577c279435.png) 600dpi + )", + "a76": " image-set(url(img1x.09a1a1112c577c279435.png?foo=bar) 1x)", + "a77": " image-set(url(img1x.09a1a1112c577c279435.png#hash) 1x)", + "a78": " image-set(url(img1x.09a1a1112c577c279435.png?#iefix) 1x)", + "a79": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a8": " green url(img.09a1a1112c577c279435.png) xyz", + "a80": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a81": " -webkit-image-set( + url(img1x.09a1a1112c577c279435.png) 1x + )", + "a82": " image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a83": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x + )", + "a84": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a85": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x, + url(img2x.09a1a1112c577c279435.png) 2x, + url(img3x.09a1a1112c577c279435.png) 600dpi + )", + "a86": " image-set(url(img\\\\ img.09a1a1112c577c279435.png) 1x, url(img\\\\ img.09a1a1112c577c279435.png) 2x)", + "a87": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a88": " url(imgimg.09a1a1112c577c279435.png)", + "a89": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a9": " green url(img.09a1a1112c577c279435.png) url(other-img.09a1a1112c577c279435.png) xyz", + "a90": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a91": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a92": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a93": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a94": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a95": " image-set( + url(imgimg.09a1a1112c577c279435.png) 1x, + url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png) 2x, + url(img\\\\'img.09a1a1112c577c279435.png) 3x, + url(img\\\\(img.09a1a1112c577c279435.png) 4x, + url(img\\\\)img.09a1a1112c577c279435.png) 5x, + url(img\\\\ img.09a1a1112c577c279435.png) 6x, + url(\\"img'() img.09a1a1112c577c279435.png\\") 7x + )", + "a96": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a97": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a98": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a99": " url(img\\\\(img.09a1a1112c577c279435.png)", "b": " url(img.09a1a1112c577c279435.png)", "c": " url(img.09a1a1112c577c279435.png)", "d": " url(img.09a1a1112c577c279435.png#hash)", - "e": " url(img.09a1a1112c577c279435.png)", - "f": " green url(img.09a1a1112c577c279435.png) xyz", - "g": " green url(img.09a1a1112c577c279435.png) xyz", + "e": " url( + img.09a1a1112c577c279435.png + )", + "f": " green url( img.09a1a1112c577c279435.png ) xyz", + "g": " green url( img.09a1a1112c577c279435.png ) xyz", "getPropertyValue": [Function], "h": " green url(img.09a1a1112c577c279435.png) xyz", "i": " green url(img.09a1a1112c577c279435.png) url(img.09a1a1112c577c279435.png) xyz", - "j": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz", - "k": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz", + "j": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "k": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", "l": " green url(img.09a1a1112c577c279435.png) xyz", "m": " green url(img.09a1a1112c577c279435.png) xyz", "n": " green url(img.09a1a1112c577c279435.png) xyz", diff --git a/test/__snapshots__/ConfigTestCases.basictest.js.snap b/test/__snapshots__/ConfigTestCases.basictest.js.snap index 55b67fa8c54..1370850dc32 100644 --- a/test/__snapshots__/ConfigTestCases.basictest.js.snap +++ b/test/__snapshots__/ConfigTestCases.basictest.js.snap @@ -1,19 +1,263 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ConfigTestCases css urls exported tests should be able to handle styles in spacing.css 1`] = ` +exports[`ConfigTestCases css urls exported tests should be able to handle styles in div.css 1`] = ` Object { + "--foo": " url(img.09a1a1112c577c279435.png)", + "--foo-bar": " \\"http://www.example.com/pinkish.gif\\"", + "/* TODO fix me */ + /*a146": " url('./img.png', 'foo', './img.png', url('./img.png'));*/ + /*a147: image-set(url('./img.png', 'foo', './img.png', url('./img.png')) 1x, url(\\"./img2x.png\\") 2x);*/ +", "a": " url(img.09a1a1112c577c279435.png)", + "a1": " url(img.09a1a1112c577c279435.png)", + "a10": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "a100": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a101": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a102": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a103": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a104": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a105": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a106": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a107": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a108": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a109": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a11": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "a110": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a111": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a112": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a113": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a114": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a115": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a116": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a117": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a118": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a119": " url(img.09a1a1112c577c279435.png)", + "a12": " green url(img.09a1a1112c577c279435.png) xyz", + "a120": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a121": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a122": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a123": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a124": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a125": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a126": " url(img.09a1a1112c577c279435.png)", + "a127": " url(img.09a1a1112c577c279435.png)", + "a128": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a129": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a13": " green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz", + "a130": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a131": " url(img.09a1a1112c577c279435.png)", + "a132": " url(img.09a1a1112c577c279435.png)", + "a133": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a134": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a135": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a136": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a137": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a138": " url(img.09a1a1112c577c279435.png?bar=foo)", + "a139": " url(img.09a1a1112c577c279435.png?foo=bar#foo)", + "a14": " url(\\"data:image/svg+xml;charset=utf-8,\\")", + "a140": " url(img.09a1a1112c577c279435.png?bar=foo#bar)", + "a141": " url(img.09a1a1112c577c279435.png?foo=1&bar=2)", + "a142": " url(img.09a1a1112c577c279435.png?foo=2&bar=1)", + "a143": " url(data:image/svg+xml;charset=UTF-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20width%3D%22191px%22%20height%3D%22191px%22%20viewBox%3D%220%200%20191%20191%22%20enable-background%3D%22new%200%200%20191%20191%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M95.5%2C0C42.8%2C0%2C0%2C42.8%2C0%2C95.5S42.8%2C191%2C95.5%2C191S191%2C148.2%2C191%2C95.5S148.2%2C0%2C95.5%2C0z%20M95.5%2C187.6%0A%09c-50.848%2C0-92.1-41.25-92.1-92.1c0-50.848%2C41.252-92.1%2C92.1-92.1c50.85%2C0%2C92.1%2C41.252%2C92.1%2C92.1%0A%09C187.6%2C146.35%2C146.35%2C187.6%2C95.5%2C187.6z%22%2F%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M92.9%2C10v8.6H91v-6.5c-0.1%2C0.1-0.2%2C0.2-0.4%2C0.3c-0.2%2C0.1-0.3%2C0.2-0.4%2C0.2c-0.1%2C0-0.3%2C0.1-0.5%2C0.2%0A%09%09c-0.2%2C0.1-0.3%2C0.1-0.5%2C0.1v-1.6c0.5-0.1%2C0.9-0.3%2C1.4-0.5c0.5-0.2%2C0.8-0.5%2C1.2-0.7h1.1V10z%22%2F%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M97.1%2C17.1h3.602v1.5h-5.6V18c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.6%2C0.5-0.9c0.2-0.3%2C0.5-0.5%2C0.7-0.7%0A%09%09c0.2-0.2%2C0.5-0.4%2C0.7-0.6c0.199-0.2%2C0.5-0.3%2C0.6-0.5c0.102-0.2%2C0.301-0.3%2C0.5-0.5c0.2-0.2%2C0.2-0.3%2C0.301-0.5%0A%09%09c0.101-0.2%2C0.101-0.3%2C0.101-0.5c0-0.4-0.101-0.6-0.3-0.8c-0.2-0.2-0.4-0.3-0.801-0.3c-0.699%2C0-1.399%2C0.3-2.101%2C0.9v-1.6%0A%09%09c0.7-0.5%2C1.5-0.7%2C2.5-0.7c0.399%2C0%2C0.8%2C0.1%2C1.101%2C0.2c0.301%2C0.1%2C0.601%2C0.3%2C0.899%2C0.5c0.3%2C0.2%2C0.399%2C0.5%2C0.5%2C0.8%0A%09%09c0.101%2C0.3%2C0.2%2C0.6%2C0.2%2C1s-0.102%2C0.7-0.2%2C1c-0.099%2C0.3-0.3%2C0.6-0.5%2C0.8c-0.2%2C0.2-0.399%2C0.5-0.7%2C0.7c-0.3%2C0.2-0.5%2C0.4-0.8%2C0.6%0A%09%09c-0.2%2C0.1-0.399%2C0.3-0.5%2C0.4s-0.3%2C0.3-0.5%2C0.4s-0.2%2C0.3-0.3%2C0.4C97.1%2C17%2C97.1%2C17%2C97.1%2C17.1z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M15%2C95.4c0%2C0.7-0.1%2C1.4-0.2%2C2c-0.1%2C0.6-0.4%2C1.1-0.7%2C1.5C13.8%2C99.3%2C13.4%2C99.6%2C12.9%2C99.8s-1%2C0.3-1.5%2C0.3%0A%09%09c-0.7%2C0-1.3-0.1-1.8-0.3v-1.5c0.4%2C0.3%2C1%2C0.4%2C1.6%2C0.4c0.6%2C0%2C1.1-0.2%2C1.5-0.7c0.4-0.5%2C0.5-1.1%2C0.5-1.9l0%2C0%0A%09%09C12.8%2C96.7%2C12.3%2C96.9%2C11.5%2C96.9c-0.3%2C0-0.7-0.102-1-0.2c-0.3-0.101-0.5-0.3-0.8-0.5c-0.3-0.2-0.4-0.5-0.5-0.8%0A%09%09c-0.1-0.3-0.2-0.7-0.2-1c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.7%2C0.6-0.9c0.3-0.2%2C0.6-0.5%2C0.9-0.6c0.3-0.1%2C0.8-0.2%2C1.2-0.2%0A%09%09c0.5%2C0%2C0.9%2C0.1%2C1.2%2C0.3c0.3%2C0.2%2C0.7%2C0.4%2C0.9%2C0.8s0.5%2C0.7%2C0.6%2C1.2S15%2C94.8%2C15%2C95.4z%20M13.1%2C94.4c0-0.2%2C0-0.4-0.1-0.6%0A%09%09c-0.1-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.3-0.1-0.5-0.1c-0.2%2C0-0.3%2C0-0.4%2C0.1s-0.3%2C0.2-0.3%2C0.3%0A%09%09c0%2C0.1-0.2%2C0.3-0.2%2C0.4c0%2C0.1-0.1%2C0.4-0.1%2C0.6c0%2C0.2%2C0%2C0.4%2C0.1%2C0.6c0.1%2C0.2%2C0.1%2C0.3%2C0.2%2C0.4c0.1%2C0.1%2C0.2%2C0.2%2C0.4%2C0.3%0A%09%09c0.2%2C0.1%2C0.3%2C0.1%2C0.5%2C0.1c0.2%2C0%2C0.3%2C0%2C0.4-0.1s0.2-0.2%2C0.3-0.3c0.1-0.1%2C0.2-0.2%2C0.2-0.4C13%2C94.7%2C13.1%2C94.6%2C13.1%2C94.4z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M176%2C99.7V98.1c0.6%2C0.4%2C1.2%2C0.602%2C2%2C0.602c0.5%2C0%2C0.8-0.102%2C1.1-0.301c0.301-0.199%2C0.4-0.5%2C0.4-0.801%0A%09%09c0-0.398-0.2-0.699-0.5-0.898c-0.3-0.2-0.8-0.301-1.3-0.301h-0.802V95h0.701c1.101%2C0%2C1.601-0.4%2C1.601-1.1c0-0.7-0.4-1-1.302-1%0A%09%09c-0.6%2C0-1.1%2C0.2-1.6%2C0.5v-1.5c0.6-0.3%2C1.301-0.4%2C2.1-0.4c0.9%2C0%2C1.5%2C0.2%2C2%2C0.6s0.701%2C0.9%2C0.701%2C1.5c0%2C1.1-0.601%2C1.8-1.701%2C2.1l0%2C0%0A%09%09c0.602%2C0.1%2C1.102%2C0.3%2C1.4%2C0.6s0.5%2C0.8%2C0.5%2C1.3c0%2C0.801-0.3%2C1.4-0.9%2C1.9c-0.6%2C0.5-1.398%2C0.7-2.398%2C0.7%0A%09%09C177.2%2C100.1%2C176.5%2C100%2C176%2C99.7z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M98.5%2C179.102c0%2C0.398-0.1%2C0.799-0.2%2C1.199C98.2%2C180.7%2C98%2C181%2C97.7%2C181.2s-0.601%2C0.5-0.9%2C0.601%0A%09%09c-0.3%2C0.1-0.7%2C0.199-1.2%2C0.199c-0.5%2C0-0.9-0.1-1.3-0.3c-0.4-0.2-0.7-0.399-0.9-0.8c-0.2-0.4-0.5-0.7-0.6-1.2%0A%09%09c-0.1-0.5-0.2-1-0.2-1.601c0-0.699%2C0.1-1.399%2C0.3-2c0.2-0.601%2C0.4-1.101%2C0.8-1.5c0.4-0.399%2C0.7-0.699%2C1.2-1c0.5-0.3%2C1-0.3%2C1.6-0.3%0A%09%09c0.6%2C0%2C1.2%2C0.101%2C1.5%2C0.199v1.5c-0.4-0.199-0.9-0.399-1.4-0.399c-0.3%2C0-0.6%2C0.101-0.8%2C0.2c-0.2%2C0.101-0.5%2C0.3-0.7%2C0.5%0A%09%09c-0.2%2C0.199-0.3%2C0.5-0.4%2C0.8c-0.1%2C0.301-0.2%2C0.7-0.2%2C1.101l0%2C0c0.4-0.601%2C1-0.8%2C1.8-0.8c0.3%2C0%2C0.7%2C0.1%2C0.9%2C0.199%0A%09%09c0.2%2C0.101%2C0.5%2C0.301%2C0.7%2C0.5c0.199%2C0.2%2C0.398%2C0.5%2C0.5%2C0.801C98.5%2C178.2%2C98.5%2C178.7%2C98.5%2C179.102z%20M96.7%2C179.2%0A%09%09c0-0.899-0.4-1.399-1.1-1.399c-0.2%2C0-0.3%2C0-0.5%2C0.1c-0.2%2C0.101-0.3%2C0.201-0.4%2C0.301c-0.1%2C0.101-0.2%2C0.199-0.2%2C0.4%0A%09%09c0%2C0.199-0.1%2C0.299-0.1%2C0.5c0%2C0.199%2C0%2C0.398%2C0.1%2C0.6s0.1%2C0.3%2C0.2%2C0.5c0.1%2C0.199%2C0.2%2C0.199%2C0.4%2C0.3c0.2%2C0.101%2C0.3%2C0.101%2C0.5%2C0.101%0A%09%09c0.2%2C0%2C0.3%2C0%2C0.5-0.101c0.2-0.101%2C0.301-0.199%2C0.301-0.3c0-0.1%2C0.199-0.301%2C0.199-0.399C96.6%2C179.7%2C96.7%2C179.4%2C96.7%2C179.2z%22%2F%3E%0A%3C%2Fg%3E%0A%3Ccircle%20fill%3D%22%23636363%22%20cx%3D%2295%22%20cy%3D%2295%22%20r%3D%227%22%2F%3E%0A%3C%2Fsvg%3E%0A) 50% 50%/191px no-repeat", + "a144": " url(img.09a1a1112c577c279435.png)", + "a145": " url(img.09a1a1112c577c279435.png)", + "a148": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a149": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a15": " url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E)", + "a150": " url('data:image/svg+xml,%3Csvg xmlns=\\"http://www.w3.org/2000/svg\\"%3E%3Crect width=\\"100%25\\" height=\\"100%25\\" style=\\"stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px\\" /%3E%3C/svg%3E')", + "a151": " url('data:image/svg+xml;utf8,')", + "a152": " url(img.09a1a1112c577c279435.png)", + "a153": " url(img.09a1a1112c577c279435.png)", + "a154": " url(other.09a1a1112c577c279435.png)", + "a155": " url(img.09a1a1112c577c279435.png)", + "a156": " url(\\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e\\")", + "a157": " url('data:image/svg+xml;utf8,')", + "a158": " src(\\"http://www.example.com/pinkish.gif\\")", + "a159": " src(var(--foo))", + "a16": " url('data:image/svg+xml;charset=utf-8,#filter')", + "a160": " url(img.09a1a1112c577c279435.png param(--color var(--primary-color)))", + "a161": " src(\\"img.png\\" param(--color var(--primary-color)))", + "a162": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a163": " url(img.09a1a1112c577c279435.png)", + "a164": " url( img.png bug)", + "a165": " url(imgn.09a1a1112c577c279435.png)", + "a166": " url('data:image/svg+xml;utf8,')", + "a167": " url(http://example.com/image.jpg)", + "a168": " url(http://example.com/image.jpg)", + "a169": " url(data:,)", + "a17": " url(\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter\\")", + "a170": " url(data:,)", + "a171": " image(ltr 'img.png#xywh=0,0,16,16', red)", + "a172": " image-set( + linear-gradient(blue, white) 1x, + linear-gradient(blue, green) 2x + )", + "a173": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") + )", + "a174": " image-set( + url(img.09a1a1112c577c279435.png) 1x, + url(img.09a1a1112c577c279435.png) 2x + )", + "a175": " image-set( + url(img.09a1a1112c577c279435.png) 1x, + url(img.09a1a1112c577c279435.png) 2x, + url(img.09a1a1112c577c279435.png) 3x + )", + "a176": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") + ) \\"img.png\\"", + "a177": " image-set( + url(img.09a1a1112c577c279435.png) 1x type(\\"image/png\\"), + url(img.09a1a1112c577c279435.png) 2x type(\\"image/png\\") + )", + "a178": " image-set( + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") 1x, + url(img.09a1a1112c577c279435.png) type(\\"image/png\\") 2x + )", + "a179": " -webkit-image-set( + url(img.09a1a1112c577c279435.png) 1x + )", + "a18": " url(#highlight)", + "a180": " -webkit-image-set( + url(img.09a1a1112c577c279435.png var(--foo, \\"test.png\\")) 1x + )", + "a181": " src( \\"img.png\\" )", + "a182": " src('img.png')", + "a183": " src('img.png' var(--foo, \\"test.png\\"))", + "a184": " src(var(--foo, \\"test.png\\"))", + "a185": " src(\\" img.png \\")", + "a186": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a187": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a188": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a189": " image-set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a19": " url('#line-marker')", + "a190": " image-set(url(img.09a1a1112c577c279435.png)1x)", + "a191": " image-set(url(img.09a1a1112c577c279435.png)1x/* test*/,/* test*/url(img.09a1a1112c577c279435.png)2x)", + "a197": " \\\\u\\\\r\\\\l(img.09a1a1112c577c279435.png)", + "a198": " \\\\image-\\\\set(url(img.09a1a1112c577c279435.png)1x,url(img.09a1a1112c577c279435.png)2x,url(img.09a1a1112c577c279435.png)3x)", + "a199": " \\\\-webk\\\\it-image-set(url(img.09a1a1112c577c279435.png)1x)", + "a2": " url(img.09a1a1112c577c279435.png)", + "a200": "-webkit-image-set(url(img.09a1a1112c577c279435.png)1x)", + "a22": " \\"do not use url(path)\\"", + "a23": " 'do not \\"use\\" url(path)'", + "a24": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x) +", + "a25": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x) +", + "a26": " green url() xyz", + "a27": " green url('') xyz", + "a28": " green url(\\"\\") xyz", + "a29": " green url(' ') xyz", + "a3": " url(img.09a1a1112c577c279435.png)", + "a30": " green url( + ) xyz", + "a4": " url(img.09a1a1112c577c279435.png#hash)", + "a40": " green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz", + "a41": " green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz", + "a42": " url(img.09a1a1112c577c279435.png?foo)", + "a43": " url(img.09a1a1112c577c279435.png?foo=bar)", + "a44": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a45": " url(img.09a1a1112c577c279435.png?foo=bar#hash)", + "a46": " url(img.09a1a1112c577c279435.png?)", + "a47": " url(img.09a1a1112c577c279435.png) url(\\"data:image/svg+xml;charset=utf-8,\\") url(img.09a1a1112c577c279435.png)", + "a48": " __URL__()", + "a49": " url(img-simple.09a1a1112c577c279435.png)", + "a5": " url( + img.09a1a1112c577c279435.png + )", + "a50": " url(img-simple.09a1a1112c577c279435.png)", + "a51": " url(img-simple.09a1a1112c577c279435.png)", + "a52": " url(img.09a1a1112c577c279435.png)", + "a53": " url(img.09a1a1112c577c279435.png)", + "a55": " -webkit-image-set()", + "a56": " image-set()", + "a58": " image-set('')", + "a59": " image-set(\\"\\")", + "a6": " green url( img.09a1a1112c577c279435.png ) xyz", + "a60": " image-set(\\"\\" 1x)", + "a61": " image-set(url())", + "a62": " image-set( + url() + )", + "a63": " image-set(URL())", + "a64": " image-set(url(''))", + "a65": " image-set(url(\\"\\"))", + "a66": " image-set(url('') 1x)", + "a67": " image-set(1x)", + "a68": " image-set( + 1x + )", + "a69": " image-set(calc(1rem + 1px) 1x)", + "a7": " green url( img.09a1a1112c577c279435.png ) xyz", + "a70": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a71": " image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a72": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a73": " image-set(url(img\\\\ img.09a1a1112c577c279435.png) 1x, url(img\\\\ img.09a1a1112c577c279435.png) 2x)", + "a74": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x), + image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a75": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x, + url(img2x.09a1a1112c577c279435.png) 2x, + url(img3x.09a1a1112c577c279435.png) 600dpi + )", + "a76": " image-set(url(img1x.09a1a1112c577c279435.png?foo=bar) 1x)", + "a77": " image-set(url(img1x.09a1a1112c577c279435.png#hash) 1x)", + "a78": " image-set(url(img1x.09a1a1112c577c279435.png?#iefix) 1x)", + "a79": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a8": " green url(img.09a1a1112c577c279435.png) xyz", + "a80": " -webkit-image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a81": " -webkit-image-set( + url(img1x.09a1a1112c577c279435.png) 1x + )", + "a82": " image-set(url(img1x.09a1a1112c577c279435.png) 1x)", + "a83": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x + )", + "a84": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a85": " image-set( + url(img1x.09a1a1112c577c279435.png) 1x, + url(img2x.09a1a1112c577c279435.png) 2x, + url(img3x.09a1a1112c577c279435.png) 600dpi + )", + "a86": " image-set(url(img\\\\ img.09a1a1112c577c279435.png) 1x, url(img\\\\ img.09a1a1112c577c279435.png) 2x)", + "a87": " image-set(url(img1x.09a1a1112c577c279435.png) 1x, url(img2x.09a1a1112c577c279435.png) 2x)", + "a88": " url(imgimg.09a1a1112c577c279435.png)", + "a89": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a9": " green url(img.09a1a1112c577c279435.png) url(other-img.09a1a1112c577c279435.png) xyz", + "a90": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a91": " url(img\\\\(img.09a1a1112c577c279435.png)", + "a92": " url(img\\\\)img.09a1a1112c577c279435.png)", + "a93": " url(img\\\\ img.09a1a1112c577c279435.png)", + "a94": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a95": " image-set( + url(imgimg.09a1a1112c577c279435.png) 1x, + url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png) 2x, + url(img\\\\'img.09a1a1112c577c279435.png) 3x, + url(img\\\\(img.09a1a1112c577c279435.png) 4x, + url(img\\\\)img.09a1a1112c577c279435.png) 5x, + url(img\\\\ img.09a1a1112c577c279435.png) 6x, + url(\\"img'() img.09a1a1112c577c279435.png\\") 7x + )", + "a96": " url(img\\\\'\\\\'\\\\'img.09a1a1112c577c279435.png)", + "a97": " url(\\"img'() img.09a1a1112c577c279435.png\\")", + "a98": " url(img\\\\'img.09a1a1112c577c279435.png)", + "a99": " url(img\\\\(img.09a1a1112c577c279435.png)", "b": " url(img.09a1a1112c577c279435.png)", "c": " url(img.09a1a1112c577c279435.png)", "d": " url(img.09a1a1112c577c279435.png#hash)", - "e": " url(img.09a1a1112c577c279435.png)", - "f": " green url(img.09a1a1112c577c279435.png) xyz", - "g": " green url(img.09a1a1112c577c279435.png) xyz", + "e": " url( + img.09a1a1112c577c279435.png + )", + "f": " green url( img.09a1a1112c577c279435.png ) xyz", + "g": " green url( img.09a1a1112c577c279435.png ) xyz", "getPropertyValue": [Function], "h": " green url(img.09a1a1112c577c279435.png) xyz", "i": " green url(img.09a1a1112c577c279435.png) url(img.09a1a1112c577c279435.png) xyz", - "j": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz", - "k": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz", + "j": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", + "k": " green url( img\\\\ img.09a1a1112c577c279435.png ) xyz", "l": " green url(img.09a1a1112c577c279435.png) xyz", "m": " green url(img.09a1a1112c577c279435.png) xyz", "n": " green url(img.09a1a1112c577c279435.png) xyz", diff --git a/test/configCases/css/urls/font with spaces.eot b/test/configCases/css/urls/font with spaces.eot new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/font.eot b/test/configCases/css/urls/font.eot new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/font.svg b/test/configCases/css/urls/font.svg new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/font.ttf b/test/configCases/css/urls/font.ttf new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/font.woff b/test/configCases/css/urls/font.woff new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/font.woff2 b/test/configCases/css/urls/font.woff2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/css/urls/img'''img.png b/test/configCases/css/urls/img'''img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img'''img.png differ diff --git a/test/configCases/css/urls/img'() img.png b/test/configCases/css/urls/img'() img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img'() img.png differ diff --git a/test/configCases/css/urls/img'img.png b/test/configCases/css/urls/img'img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img'img.png differ diff --git a/test/configCases/css/urls/img(img.png b/test/configCases/css/urls/img(img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img(img.png differ diff --git a/test/configCases/css/urls/img)img.png b/test/configCases/css/urls/img)img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img)img.png differ diff --git a/test/configCases/css/urls/img1x.png b/test/configCases/css/urls/img1x.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img1x.png differ diff --git a/test/configCases/css/urls/img2x.png b/test/configCases/css/urls/img2x.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img2x.png differ diff --git a/test/configCases/css/urls/img3x.png b/test/configCases/css/urls/img3x.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/img3x.png differ diff --git a/test/configCases/css/urls/imgimg.png b/test/configCases/css/urls/imgimg.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/imgimg.png differ diff --git a/test/configCases/css/urls/imgn.png b/test/configCases/css/urls/imgn.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/imgn.png differ diff --git a/test/configCases/css/urls/index.js b/test/configCases/css/urls/index.js index 4466709d60c..ccf0e5d4083 100644 --- a/test/configCases/css/urls/index.js +++ b/test/configCases/css/urls/index.js @@ -15,4 +15,4 @@ const testCase = (tagName, impFn) => { }); }; -testCase("spacing", () => import("./spacing.css")); +testCase("div", () => import("./spacing.css")); diff --git a/test/configCases/css/urls/nested/img-simple.png b/test/configCases/css/urls/nested/img-simple.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/nested/img-simple.png differ diff --git a/test/configCases/css/urls/nested/img.png b/test/configCases/css/urls/nested/img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/nested/img.png differ diff --git a/test/configCases/css/urls/nested/other.png b/test/configCases/css/urls/nested/other.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/nested/other.png differ diff --git a/test/configCases/css/urls/other-img.png b/test/configCases/css/urls/other-img.png new file mode 100644 index 00000000000..b74b839e2b8 Binary files /dev/null and b/test/configCases/css/urls/other-img.png differ diff --git a/test/configCases/css/urls/spacing.css b/test/configCases/css/urls/spacing.css index 21f5c3e982a..ff6418dfe3d 100644 --- a/test/configCases/css/urls/spacing.css +++ b/test/configCases/css/urls/spacing.css @@ -1,57 +1,601 @@ -spacing { +div { a: url('./img.png'); } -spacing { +div { b: url("./img.png"); } -spacing { +div { c: url(./img.png); } -spacing { +div { d: url("./img.png#hash"); } -spacing { +div { e: url( "./img.png" ); } -spacing { +div { f: green url( './img.png' ) xyz; } -spacing { +div { g: green url( "./img.png" ) xyz; } -spacing { +div { h: green url( ./img.png ) xyz; } -spacing { +div { i: green url(package/img.png) url(./img.png) xyz; } -spacing { +div { j: green url( "./img img.png" ) xyz; } -spacing { +div { k: green url( './img img.png' ) xyz; } -spacing { +div { l: green url(/img.png) xyz; } -spacing { +div { m: green URL(/img.png) xyz; } -spacing { +div { n: green uRl(/img.png) xyz; } + +div { + --foo: url('./img.png'); +} + +div { + a1: url('./img.png'); +} + +div { + a2: url("./img.png"); +} + +div { + a3: url(./img.png); +} + +div { + a4: url("./img.png#hash"); +} + +div { + a5: url( + "./img.png" + ); +} + +div { + a6: green url( './img.png' ) xyz; +} + +div { + a7: green url( "./img.png" ) xyz; +} + +div { + a8: green url( ./img.png ) xyz; +} + +div { + a9: green url(package/img.png) url(./other-img.png) xyz; +} + +div { + a10: green url( "./img img.png" ) xyz; +} + +div { + a11: green url( './img img.png' ) xyz; +} + +div { + a12: green url(/img.png) xyz; +} + +div { + a13: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz; +} + +div { + a14: url("data:image/svg+xml;charset=utf-8,"); +} + +div { + a15: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E"); +} + +div { + a16: url('data:image/svg+xml;charset=utf-8,#filter'); +} + +div { + a17: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter'); +} + +div { + a18: url(#highlight); +} + +div { + a19: url('#line-marker'); +} + +@font-face { + a20: url(./font.woff) format('woff'), + url('./font.woff2') format('woff2'), + url("./font.eot") format('eot'), + url(./font.ttf) format('truetype'), + url("./font with spaces.eot") format("embedded-opentype"), + url('./font.svg#svgFontName') format('svg'), + url('./font.woff2?foo=bar') format('woff2'), + url("./font.eot?#iefix") format('embedded-opentype'), + url("./font with spaces.eot?#iefix") format('embedded-opentype'); +} + +@media (min-width: 500px) { + div { + a21: url("./img.png"); + } +} + +div { + a22: "do not use url(path)"; +} + +div { + a23: 'do not "use" url(path)'; +} + +div { + a24: -webkit-image-set(url('./img1x.png') 1x, url('./img2x.png') 2x) +} + +div { + a25: image-set(url('./img1x.png') 1x, url('./img2x.png') 2x) +} + +div { + a26: green url() xyz; +} + +div { + a27: green url('') xyz; +} + +div { + a28: green url("") xyz; +} + +div { + a29: green url(' ') xyz; +} + +div { + a30: green url( + ) xyz; +} + +div { + a40: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; +} + +div { + a41: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; +} + +div { + a42: url("./img.png?foo"); +} + +div { + a43: url("./img.png?foo=bar"); +} + +div { + a44: url("./img.png?foo=bar#hash"); +} + +div { + a45: url("./img.png?foo=bar#hash"); +} + +div { + a46: url("./img.png?"); +} + +div { + a47: url('./img.png') url("data:image/svg+xml;charset=utf-8,") url('./img.png'); +} + +div { + a48: __URL__(); +} + +div { + a49: url('./nested/../nested/img-simple.png'); +} + +div { + a50: url('/nested/img-simple.png'); +} + +div { + a51: url('../urls/nested/img-simple.png'); +} + +div { + a52: url(./nested/img.png); +} + +div { + a53: url(nested/img.png); +} + +@font-face { + a54: url("//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot"); +} + +div { + a55: -webkit-image-set(); + a56: -webkit-image-set(''); + a56: image-set(); + a58: image-set(''); + a59: image-set(""); + a60: image-set("" 1x); + a61: image-set(url()); + a62: image-set( + url() + ); + a63: image-set(URL()); + a64: image-set(url('')); + a65: image-set(url("")); + a66: image-set(url('') 1x); + a67: image-set(1x); + a68: image-set( + 1x + ); + a69: image-set(calc(1rem + 1px) 1x); + + a70: -webkit-image-set("./img1x.png" 1x, "./img2x.png" 2x); + a71: image-set("./img1x.png" 1x); + a72: image-set("./img1x.png" 1x, "./img2x.png" 2x); + a73: image-set("./img img.png" 1x, "./img img.png" 2x); + a74: image-set("./img1x.png" 1x, "./img2x.png" 2x), + image-set("./img1x.png" 1x, "./img2x.png" 2x); + a75: image-set( + "./img1x.png" 1x, + "./img2x.png" 2x, + "./img3x.png" 600dpi + ); + a76: image-set("./img1x.png?foo=bar" 1x); + a77: image-set("./img1x.png#hash" 1x); + a78: image-set("./img1x.png?#iefix" 1x); + + a79: -webkit-image-set(url("./img1x.png") 1x, url("./img2x.png") 2x); + a80: -webkit-image-set(url("./img1x.png") 1x); + a81: -webkit-image-set( + url("./img1x.png") 1x + ); + a82: image-set(url(./img1x.png) 1x); + a83: image-set( + url(./img1x.png) 1x + ); + a84: image-set(url("./img1x.png") 1x, url("./img2x.png") 2x); + a85: image-set( + url(./img1x.png) 1x, + url(./img2x.png) 2x, + url(./img3x.png) 600dpi + ); + a86: image-set(url("./img img.png") 1x, url("./img img.png") 2x); + + a87: image-set(url("./img1x.png") 1x, "./img2x.png" 2x); +} + +div { + a88: url(./img\img.png); + a89: url(./img\'img.png); + a90: url(./img\'\'\'img.png); + a91: url(./img\(img.png); + a92: url(./img\)img.png); + a93: url(./img\ img.png); + a94: url(./img\'\(\)\ img.png); + + a95: image-set( + url(./img\img.png) 1x, + url(./img\'\'\'img.png) 2x, + url(./img\'img.png) 3x, + url(./img\(img.png) 4x, + url(./img\)img.png) 5x, + url(./img\ img.png) 6x, + url(./img\'\(\)\ img.png) 7x + ); +} + +div { + a96: url("./img'''img.png"); + a97: url("./img'() img.png"); + a98: url("./img'img.png"); + a99: url("./img(img.png"); + a100: url("./img)img.png"); + a101: url('./img img.png'); + a102: url("./img img.png"); +} + +div { + a103: url('./img\ +(img.png'); + a104: url('./img\ +(img.png'); + a105: url('./img\ +(img.png'); + a106: url('./img\ +\ +\ +\ +(img.png'); +} + +div { + a107: url("./img%27%27%27img.png"); + a108: url("./img%27%28%29%20img.png"); + a109: url("./img%27img.png"); + a110: url("./img%28img.png"); + a111: url("./img%29img.png"); + a112: url("./img%20img.png"); + a113: url(./img%27%27%27img.png); + a114: url(./img%27%28%29%20img.png); + a115: url(./img%27img.png); + a116: url(./img%28img.png); + a117: url(./img%29img.png); + a118: url(./img%20img.png); +} + +div { + a119: url('img.png'); +} + +div { + a120: url("./img\'\'\'img.png"); + a121: url("./img\'\(\)\ img.png"); + a122: url("./img\'img.png"); + a123: url("./img\(img.png"); + a124: url("./img\)img.png"); + a125: url("./img\ img.png"); + a126: url("./\69\6D\67.png"); + a127: url(./\69\6D\67.png); + a128: url("./img\27img.png"); + a129: url("./img\'\28%29 img.png"); + a130: url(./img\'\28%29\ img.png); +} + +div { + a131: url('./img.png'); + a132: url('./img.png'); + + a133: url('./img.png?foo=bar'); + a134: url('./img.png?foo=bar'); + + a135: url('./img.png?foo=bar#hash'); + a136: url('./img.png?foo=bar#hash'); + + a137: url('./img.png?foo=bar'); + a138: url('./img.png?bar=foo'); + + a139: url('./img.png?foo=bar#foo'); + a140: url('./img.png?bar=foo#bar'); + + a141: url('./img.png?foo=1&bar=2'); + a142: url('./img.png?foo=2&bar=1'); +} + +div { + a143: url("data:image/svg+xml;charset=UTF-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20width%3D%22191px%22%20height%3D%22191px%22%20viewBox%3D%220%200%20191%20191%22%20enable-background%3D%22new%200%200%20191%20191%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M95.5%2C0C42.8%2C0%2C0%2C42.8%2C0%2C95.5S42.8%2C191%2C95.5%2C191S191%2C148.2%2C191%2C95.5S148.2%2C0%2C95.5%2C0z%20M95.5%2C187.6%0A%09c-50.848%2C0-92.1-41.25-92.1-92.1c0-50.848%2C41.252-92.1%2C92.1-92.1c50.85%2C0%2C92.1%2C41.252%2C92.1%2C92.1%0A%09C187.6%2C146.35%2C146.35%2C187.6%2C95.5%2C187.6z%22%2F%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M92.9%2C10v8.6H91v-6.5c-0.1%2C0.1-0.2%2C0.2-0.4%2C0.3c-0.2%2C0.1-0.3%2C0.2-0.4%2C0.2c-0.1%2C0-0.3%2C0.1-0.5%2C0.2%0A%09%09c-0.2%2C0.1-0.3%2C0.1-0.5%2C0.1v-1.6c0.5-0.1%2C0.9-0.3%2C1.4-0.5c0.5-0.2%2C0.8-0.5%2C1.2-0.7h1.1V10z%22%2F%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M97.1%2C17.1h3.602v1.5h-5.6V18c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.6%2C0.5-0.9c0.2-0.3%2C0.5-0.5%2C0.7-0.7%0A%09%09c0.2-0.2%2C0.5-0.4%2C0.7-0.6c0.199-0.2%2C0.5-0.3%2C0.6-0.5c0.102-0.2%2C0.301-0.3%2C0.5-0.5c0.2-0.2%2C0.2-0.3%2C0.301-0.5%0A%09%09c0.101-0.2%2C0.101-0.3%2C0.101-0.5c0-0.4-0.101-0.6-0.3-0.8c-0.2-0.2-0.4-0.3-0.801-0.3c-0.699%2C0-1.399%2C0.3-2.101%2C0.9v-1.6%0A%09%09c0.7-0.5%2C1.5-0.7%2C2.5-0.7c0.399%2C0%2C0.8%2C0.1%2C1.101%2C0.2c0.301%2C0.1%2C0.601%2C0.3%2C0.899%2C0.5c0.3%2C0.2%2C0.399%2C0.5%2C0.5%2C0.8%0A%09%09c0.101%2C0.3%2C0.2%2C0.6%2C0.2%2C1s-0.102%2C0.7-0.2%2C1c-0.099%2C0.3-0.3%2C0.6-0.5%2C0.8c-0.2%2C0.2-0.399%2C0.5-0.7%2C0.7c-0.3%2C0.2-0.5%2C0.4-0.8%2C0.6%0A%09%09c-0.2%2C0.1-0.399%2C0.3-0.5%2C0.4s-0.3%2C0.3-0.5%2C0.4s-0.2%2C0.3-0.3%2C0.4C97.1%2C17%2C97.1%2C17%2C97.1%2C17.1z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M15%2C95.4c0%2C0.7-0.1%2C1.4-0.2%2C2c-0.1%2C0.6-0.4%2C1.1-0.7%2C1.5C13.8%2C99.3%2C13.4%2C99.6%2C12.9%2C99.8s-1%2C0.3-1.5%2C0.3%0A%09%09c-0.7%2C0-1.3-0.1-1.8-0.3v-1.5c0.4%2C0.3%2C1%2C0.4%2C1.6%2C0.4c0.6%2C0%2C1.1-0.2%2C1.5-0.7c0.4-0.5%2C0.5-1.1%2C0.5-1.9l0%2C0%0A%09%09C12.8%2C96.7%2C12.3%2C96.9%2C11.5%2C96.9c-0.3%2C0-0.7-0.102-1-0.2c-0.3-0.101-0.5-0.3-0.8-0.5c-0.3-0.2-0.4-0.5-0.5-0.8%0A%09%09c-0.1-0.3-0.2-0.7-0.2-1c0-0.4%2C0.1-0.8%2C0.2-1.2c0.1-0.4%2C0.3-0.7%2C0.6-0.9c0.3-0.2%2C0.6-0.5%2C0.9-0.6c0.3-0.1%2C0.8-0.2%2C1.2-0.2%0A%09%09c0.5%2C0%2C0.9%2C0.1%2C1.2%2C0.3c0.3%2C0.2%2C0.7%2C0.4%2C0.9%2C0.8s0.5%2C0.7%2C0.6%2C1.2S15%2C94.8%2C15%2C95.4z%20M13.1%2C94.4c0-0.2%2C0-0.4-0.1-0.6%0A%09%09c-0.1-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.3-0.1-0.5-0.1c-0.2%2C0-0.3%2C0-0.4%2C0.1s-0.3%2C0.2-0.3%2C0.3%0A%09%09c0%2C0.1-0.2%2C0.3-0.2%2C0.4c0%2C0.1-0.1%2C0.4-0.1%2C0.6c0%2C0.2%2C0%2C0.4%2C0.1%2C0.6c0.1%2C0.2%2C0.1%2C0.3%2C0.2%2C0.4c0.1%2C0.1%2C0.2%2C0.2%2C0.4%2C0.3%0A%09%09c0.2%2C0.1%2C0.3%2C0.1%2C0.5%2C0.1c0.2%2C0%2C0.3%2C0%2C0.4-0.1s0.2-0.2%2C0.3-0.3c0.1-0.1%2C0.2-0.2%2C0.2-0.4C13%2C94.7%2C13.1%2C94.6%2C13.1%2C94.4z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M176%2C99.7V98.1c0.6%2C0.4%2C1.2%2C0.602%2C2%2C0.602c0.5%2C0%2C0.8-0.102%2C1.1-0.301c0.301-0.199%2C0.4-0.5%2C0.4-0.801%0A%09%09c0-0.398-0.2-0.699-0.5-0.898c-0.3-0.2-0.8-0.301-1.3-0.301h-0.802V95h0.701c1.101%2C0%2C1.601-0.4%2C1.601-1.1c0-0.7-0.4-1-1.302-1%0A%09%09c-0.6%2C0-1.1%2C0.2-1.6%2C0.5v-1.5c0.6-0.3%2C1.301-0.4%2C2.1-0.4c0.9%2C0%2C1.5%2C0.2%2C2%2C0.6s0.701%2C0.9%2C0.701%2C1.5c0%2C1.1-0.601%2C1.8-1.701%2C2.1l0%2C0%0A%09%09c0.602%2C0.1%2C1.102%2C0.3%2C1.4%2C0.6s0.5%2C0.8%2C0.5%2C1.3c0%2C0.801-0.3%2C1.4-0.9%2C1.9c-0.6%2C0.5-1.398%2C0.7-2.398%2C0.7%0A%09%09C177.2%2C100.1%2C176.5%2C100%2C176%2C99.7z%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%3E%0A%09%3Cpath%20fill%3D%22%23636363%22%20d%3D%22M98.5%2C179.102c0%2C0.398-0.1%2C0.799-0.2%2C1.199C98.2%2C180.7%2C98%2C181%2C97.7%2C181.2s-0.601%2C0.5-0.9%2C0.601%0A%09%09c-0.3%2C0.1-0.7%2C0.199-1.2%2C0.199c-0.5%2C0-0.9-0.1-1.3-0.3c-0.4-0.2-0.7-0.399-0.9-0.8c-0.2-0.4-0.5-0.7-0.6-1.2%0A%09%09c-0.1-0.5-0.2-1-0.2-1.601c0-0.699%2C0.1-1.399%2C0.3-2c0.2-0.601%2C0.4-1.101%2C0.8-1.5c0.4-0.399%2C0.7-0.699%2C1.2-1c0.5-0.3%2C1-0.3%2C1.6-0.3%0A%09%09c0.6%2C0%2C1.2%2C0.101%2C1.5%2C0.199v1.5c-0.4-0.199-0.9-0.399-1.4-0.399c-0.3%2C0-0.6%2C0.101-0.8%2C0.2c-0.2%2C0.101-0.5%2C0.3-0.7%2C0.5%0A%09%09c-0.2%2C0.199-0.3%2C0.5-0.4%2C0.8c-0.1%2C0.301-0.2%2C0.7-0.2%2C1.101l0%2C0c0.4-0.601%2C1-0.8%2C1.8-0.8c0.3%2C0%2C0.7%2C0.1%2C0.9%2C0.199%0A%09%09c0.2%2C0.101%2C0.5%2C0.301%2C0.7%2C0.5c0.199%2C0.2%2C0.398%2C0.5%2C0.5%2C0.801C98.5%2C178.2%2C98.5%2C178.7%2C98.5%2C179.102z%20M96.7%2C179.2%0A%09%09c0-0.899-0.4-1.399-1.1-1.399c-0.2%2C0-0.3%2C0-0.5%2C0.1c-0.2%2C0.101-0.3%2C0.201-0.4%2C0.301c-0.1%2C0.101-0.2%2C0.199-0.2%2C0.4%0A%09%09c0%2C0.199-0.1%2C0.299-0.1%2C0.5c0%2C0.199%2C0%2C0.398%2C0.1%2C0.6s0.1%2C0.3%2C0.2%2C0.5c0.1%2C0.199%2C0.2%2C0.199%2C0.4%2C0.3c0.2%2C0.101%2C0.3%2C0.101%2C0.5%2C0.101%0A%09%09c0.2%2C0%2C0.3%2C0%2C0.5-0.101c0.2-0.101%2C0.301-0.199%2C0.301-0.3c0-0.1%2C0.199-0.301%2C0.199-0.399C96.6%2C179.7%2C96.7%2C179.4%2C96.7%2C179.2z%22%2F%3E%0A%3C%2Fg%3E%0A%3Ccircle%20fill%3D%22%23636363%22%20cx%3D%2295%22%20cy%3D%2295%22%20r%3D%227%22%2F%3E%0A%3C%2Fsvg%3E%0A") 50% 50%/191px no-repeat; +} + +div { + a144: url('%2E/img.png'); +} + +div { + a145: url("/img.png"); +} + +div { + /* TODO fix me */ + /*a146: url('./img.png', 'foo', './img.png', url('./img.png'));*/ + /*a147: image-set(url('./img.png', 'foo', './img.png', url('./img.png')) 1x, url("./img2x.png") 2x);*/ +} + +div { + a148: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="100%25" height="100%25" style="stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px" /%3E%3C/svg%3E'); + a149: url('DATA:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="100%25" height="100%25" style="stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px" /%3E%3C/svg%3E'); + a150: url('DATA:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="100%25" height="100%25" style="stroke: rgb(223,224,225); stroke-width: 2px; fill: none; stroke-dasharray: 6px 3px" /%3E%3C/svg%3E'); + a151: url('data:image/svg+xml;utf8,'); + a152: url('DATA:image/svg+xml;utf8,'); +} + +div { + a152: url("img.png"); +} + +div { + a153: url("nested/img.png"); +} + +div { + a154: url("nested/other.png"); +} + +div { + a155: url("package/img.png"); +} + +div { + a156: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); +} + +div { + a157: url('data:image/svg+xml;utf8,'); +} + +div { + a158: src("http://www.example.com/pinkish.gif"); + --foo-bar: "http://www.example.com/pinkish.gif"; + a159: src(var(--foo)); +} + +div { + a160: url("img.png" param(--color var(--primary-color))); + a161: src("img.png" param(--color var(--primary-color))); +} + +div { + a162: url('img\ + i\ +mg.png\ + '); + +} + +div { + a163: url(" img.png "); +} + + +div { + a164: url( img.png bug); +} + +div { + a165: url(img\n.png); +} + +div { + a166: url(' data:image/svg+xml;utf8, '); +} + +div { + a167: url(http://example.com/image.jpg); + a168: url(http://example.com/image.jpg); +} + +div { + a169: url('data:,'); + a170: url('data:,'); +} + +div { + a171: image(ltr 'img.png#xywh=0,0,16,16', red); + a172: cross-fade(20% url(img.png), url(img.png)) +} + +div { + a172: image-set( + linear-gradient(blue, white) 1x, + linear-gradient(blue, green) 2x + ); + a173: image-set( + url("img.png") type("image/png"), + url("img.png") type("image/png") + ); + a174: image-set( + "img.png" 1x, + "img.png" 2x + ); + a175: image-set( + url("img.png") 1x, + url("img.png") 2x, + url("img.png") 3x + ); + a176: image-set( + "img.png" type("image/png"), + "img.png" type("image/png") + ) "img.png"; + a177: image-set( + "img.png" 1x type("image/png"), + "img.png" 2x type("image/png") + ); + a178: image-set( + "img.png" type("image/png") 1x, + "img.png" type("image/png") 2x + ); + a179: -webkit-image-set( + "img.png" 1x + ); + a180: -webkit-image-set( + url("img.png" var(--foo, "test.png")) 1x + ); +} + +div { + a181: src("img.png"); + a181: src( "img.png" ); + a182: src('img.png'); + a183: src('img.png' var(--foo, "test.png")); + a184: src(var(--foo, "test.png")); + a185: src(" img.png "); +} + +div { + a186: image-set("img.png"1x,"img.png"2x,"img.png"3x); + a187: image-set("img.png"1x,url("img.png")2x,"img.png"3x); + a188: image-set("img.png"1x,"img.png"2x,url("img.png")3x); + a189: image-set(url("img.png")1x,"img.png"2x,"img.png"3x); + a190: image-set("img.png"1x); + a191: image-set("img.png"1x/* test*/,/* test*/"img.png"2x); +} + +@supports (background-image: image-set("unknown.png"1x,"unknown.png"2x,"unknown.png"3x)) { + div { + a192: url("img.png"); + a193: image-set("img.png"1x); + } +} + +@supports (background-image: url("unknown.png" param(--test))) { + div { + a194: url("img.png"); + } +} + +@supports (background-image: url("unknown.png")) { + div { + a195: url("img.png"); + } +} + +@supports (display: grid) { + @media (min-width: 100px) { + @layer special { + div { + a196: url("img.png"); + } + } + } +} + +div { + a197: \u\r\l("img.png"); + a198: \image-\set("img.png"1x,"img.png"2x,"img.png"3x); + a199: \-webk\it-image-set("img.png"1x); + a200:-webkit-image-set("img.png"1x); +} diff --git a/test/configCases/css/urls/webpack.config.js b/test/configCases/css/urls/webpack.config.js index 20de82681d4..51a1701f6eb 100644 --- a/test/configCases/css/urls/webpack.config.js +++ b/test/configCases/css/urls/webpack.config.js @@ -17,6 +17,12 @@ module.exports = { chunks: "all", name: "main", enforce: true + }, + assetFixHack1: { + type: "asset/inline", + chunks: "all", + name: "main", + enforce: true } } } diff --git a/test/walkCssTokens.unittest.js b/test/walkCssTokens.unittest.js index 75f0b04acd7..caa38be315b 100644 --- a/test/walkCssTokens.unittest.js +++ b/test/walkCssTokens.unittest.js @@ -120,14 +120,12 @@ describe("walkCssTokens", () => { "background", ], Array [ - "url", - "url( \\"https://example.com/some url \\\\\\"with\\\\\\" 'spaces'.png\\" )", - "https://example.com/some url \\\\\\"with\\\\\\" 'spaces'.png", + "rightParenthesis", + ")", ], Array [ - "url", - "url('https://example.com/\\\\'\\"quotes\\"\\\\'.png')", - "https://example.com/\\\\'\\"quotes\\"\\\\'.png", + "rightParenthesis", + ")", ], Array [ "semicolon",