swc/crates/swc_css_parser/tests/fixture/value/url/output.json
Alexander Akait 30c29a30cf
feat(css): Improve codegen where minify: true (#3414)
swc_css_codegen:
 - Improve minification.

swc_css_parser:
 - Add parsing rule for `sum`.
2022-02-01 12:30:44 +00:00

1177 lines
32 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 1022,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 0,
"end": 1021,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TypeSelector",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Identifier",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"value": "div",
"raw": "div"
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 4,
"end": 1021,
"ctxt": 0
},
"value": [
{
"type": "Declaration",
"span": {
"start": 10,
"end": 56,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 10,
"end": 20,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 22,
"end": 56,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 26,
"end": 55,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "https://example.com/image.png"
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 62,
"end": 108,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 62,
"end": 72,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 74,
"end": 108,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 74,
"end": 77,
"ctxt": 0
},
"value": "URL",
"raw": "URL"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 78,
"end": 107,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "https://example.com/image.png"
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 114,
"end": 161,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 114,
"end": 124,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 126,
"end": 161,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "URL",
"raw": "\\URL"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 130,
"end": 160,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "https://example.com/image.png"
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 167,
"end": 215,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 167,
"end": 177,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 179,
"end": 215,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 179,
"end": 182,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 183,
"end": 214,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "\"https://example.com/image.png\""
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 221,
"end": 269,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 221,
"end": 231,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 233,
"end": 269,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 233,
"end": 236,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 237,
"end": 268,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "'https://example.com/image.png'"
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 275,
"end": 323,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 275,
"end": 285,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 287,
"end": 323,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 287,
"end": 290,
"ctxt": 0
},
"value": "URL",
"raw": "URL"
},
"value": {
"type": "String",
"span": {
"start": 291,
"end": 322,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "'https://example.com/image.png'"
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 329,
"end": 378,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 329,
"end": 339,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 341,
"end": 378,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 341,
"end": 345,
"ctxt": 0
},
"value": "URL",
"raw": "\\URL"
},
"value": {
"type": "String",
"span": {
"start": 346,
"end": 377,
"ctxt": 0
},
"value": "https://example.com/image.png",
"raw": "'https://example.com/image.png'"
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 384,
"end": 429,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 384,
"end": 394,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 396,
"end": 429,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 396,
"end": 399,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 400,
"end": 428,
"ctxt": 0
},
"value": "data:image/png;base64,iRxVB0",
"raw": "data:image/png;base64,iRxVB0"
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 435,
"end": 464,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 435,
"end": 445,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 447,
"end": 464,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 447,
"end": 450,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 451,
"end": 463,
"ctxt": 0
},
"value": "#IDofSVGpath",
"raw": "#IDofSVGpath"
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 545,
"end": 589,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 545,
"end": 555,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 557,
"end": 589,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 557,
"end": 560,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 561,
"end": 579,
"ctxt": 0
},
"value": "//aa.com/img.svg",
"raw": "\"//aa.com/img.svg\""
},
"modifiers": [
{
"type": "Identifier",
"span": {
"start": 580,
"end": 588,
"ctxt": 0
},
"value": "prefetch",
"raw": "prefetch"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 595,
"end": 653,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 595,
"end": 605,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 607,
"end": 653,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 607,
"end": 610,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 611,
"end": 629,
"ctxt": 0
},
"value": "//aa.com/img.svg",
"raw": "\"//aa.com/img.svg\""
},
"modifiers": [
{
"type": "Identifier",
"span": {
"start": 630,
"end": 633,
"ctxt": 0
},
"value": "foo",
"raw": "foo"
},
{
"type": "Identifier",
"span": {
"start": 634,
"end": 637,
"ctxt": 0
},
"value": "bar",
"raw": "bar"
},
{
"type": "Identifier",
"span": {
"start": 638,
"end": 641,
"ctxt": 0
},
"value": "baz",
"raw": "baz"
},
{
"type": "Function",
"span": {
"start": 642,
"end": 652,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 642,
"end": 646,
"ctxt": 0
},
"value": "func",
"raw": "func"
},
"value": [
{
"type": "Identifier",
"span": {
"start": 647,
"end": 651,
"ctxt": 0
},
"value": "test",
"raw": "test"
}
]
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 659,
"end": 742,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 659,
"end": 669,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 671,
"end": 742,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 671,
"end": 674,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 675,
"end": 705,
"ctxt": 0
},
"value": "http://example.com/image.svg",
"raw": "\"http://example.com/image.svg\""
},
"modifiers": [
{
"type": "Function",
"span": {
"start": 706,
"end": 741,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 706,
"end": 711,
"ctxt": 0
},
"value": "param",
"raw": "param"
},
"value": [
{
"type": "DashedIdentifier",
"span": {
"start": 712,
"end": 719,
"ctxt": 0
},
"value": "--color",
"raw": "--color"
},
{
"type": "Function",
"span": {
"start": 720,
"end": 740,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 720,
"end": 723,
"ctxt": 0
},
"value": "var",
"raw": "var"
},
"value": [
{
"type": "DashedIdentifier",
"span": {
"start": 724,
"end": 739,
"ctxt": 0
},
"value": "--primary-color",
"raw": "--primary-color"
}
]
}
]
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 749,
"end": 766,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 749,
"end": 759,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 761,
"end": 766,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 761,
"end": 764,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "UrlValueRaw",
"span": {
"start": 765,
"end": 765,
"ctxt": 0
},
"value": "",
"raw": ""
},
"modifiers": null
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 772,
"end": 791,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 772,
"end": 782,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 784,
"end": 791,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 784,
"end": 787,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 788,
"end": 790,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 797,
"end": 816,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 797,
"end": 807,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 809,
"end": 816,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 809,
"end": 812,
"ctxt": 0
},
"value": "url",
"raw": "url"
},
"value": {
"type": "String",
"span": {
"start": 813,
"end": 815,
"ctxt": 0
},
"value": "",
"raw": "''"
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 823,
"end": 866,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 823,
"end": 828,
"ctxt": 0
},
"value": "--foo",
"raw": "--foo"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 830,
"end": 866,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 830,
"end": 866,
"ctxt": 0
},
"token": {
"Str": {
"value": "http://www.example.com/pinkish.gif",
"raw": "\"http://www.example.com/pinkish.gif\""
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 873,
"end": 926,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 873,
"end": 883,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 885,
"end": 926,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 885,
"end": 888,
"ctxt": 0
},
"value": "src",
"raw": "src"
},
"value": {
"type": "String",
"span": {
"start": 889,
"end": 925,
"ctxt": 0
},
"value": "http://www.example.com/pinkish.gif",
"raw": "\"http://www.example.com/pinkish.gif\""
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 932,
"end": 985,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 932,
"end": 942,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 944,
"end": 985,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 944,
"end": 947,
"ctxt": 0
},
"value": "SRC",
"raw": "SRC"
},
"value": {
"type": "String",
"span": {
"start": 948,
"end": 984,
"ctxt": 0
},
"value": "http://www.example.com/pinkish.gif",
"raw": "\"http://www.example.com/pinkish.gif\""
},
"modifiers": []
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 991,
"end": 1018,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 991,
"end": 1001,
"ctxt": 0
},
"value": "background",
"raw": "background"
},
"value": [
{
"type": "Url",
"span": {
"start": 1003,
"end": 1018,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1003,
"end": 1006,
"ctxt": 0
},
"value": "src",
"raw": "src"
},
"value": null,
"modifiers": [
{
"type": "Function",
"span": {
"start": 1007,
"end": 1017,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1007,
"end": 1010,
"ctxt": 0
},
"value": "var",
"raw": "var"
},
"value": [
{
"type": "DashedIdentifier",
"span": {
"start": 1011,
"end": 1016,
"ctxt": 0
},
"value": "--foo",
"raw": "--foo"
}
]
}
]
}
],
"important": null
}
]
}
}
]
}