swc/crates/swc_css_parser/tests/fixture/rome/custom-properties/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

1161 lines
30 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 508,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 0,
"end": 507,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"text": {
"type": "Identifier",
"span": {
"start": 1,
"end": 6,
"ctxt": 0
},
"value": "style",
"raw": "style"
}
}
]
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 7,
"end": 507,
"ctxt": 0
},
"value": [
{
"type": "Declaration",
"span": {
"start": 10,
"end": 22,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 10,
"end": 15,
"ctxt": 0
},
"value": "--foo",
"raw": "--foo"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 17,
"end": 22,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 17,
"end": 22,
"ctxt": 0
},
"token": {
"Str": {
"value": "bar",
"raw": "'bar'"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 25,
"end": 44,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 25,
"end": 37,
"ctxt": 0
},
"value": "--lore-ipsum",
"raw": "--lore-ipsum"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 39,
"end": 44,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 39,
"end": 44,
"ctxt": 0
},
"token": {
"Str": {
"value": "foo",
"raw": "\"foo\""
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 47,
"end": 63,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 47,
"end": 54,
"ctxt": 0
},
"value": "--FANCY",
"raw": "--FANCY"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"token": {
"Str": {
"value": "abort",
"raw": "\"abort\""
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 66,
"end": 78,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 66,
"end": 72,
"ctxt": 0
},
"value": "--test",
"raw": "--test"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 74,
"end": 78,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 74,
"end": 78,
"ctxt": 0
},
"token": {
"Num": {
"value": 1987.0,
"raw": "1987",
"type": "integer"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 81,
"end": 98,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 81,
"end": 93,
"ctxt": 0
},
"value": "--percentage",
"raw": "--percentage"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"token": {
"Percent": {
"value": 25.0,
"raw": "25"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 101,
"end": 113,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 101,
"end": 109,
"ctxt": 0
},
"value": "--number",
"raw": "--number"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 111,
"end": 113,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 111,
"end": 113,
"ctxt": 0
},
"token": {
"Num": {
"value": 37.0,
"raw": "37",
"type": "integer"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 116,
"end": 130,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 116,
"end": 124,
"ctxt": 0
},
"value": "--length",
"raw": "--length"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"token": {
"Dimension": {
"value": 12.0,
"raw_value": "12",
"unit": "em",
"raw_unit": "em",
"type": "integer"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 133,
"end": 145,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"value": "--time",
"raw": "--time"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 141,
"end": 145,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 141,
"end": 145,
"ctxt": 0
},
"token": {
"Dimension": {
"value": 75.0,
"raw_value": "75",
"unit": "ms",
"raw_unit": "ms",
"type": "integer"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 148,
"end": 164,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 148,
"end": 158,
"ctxt": 0
},
"value": "--function",
"raw": "--function"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 160,
"end": 165,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 160,
"end": 164,
"ctxt": 0
},
"token": {
"Function": {
"value": "foo",
"raw": "foo"
}
}
},
{
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"token": "RParen"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 168,
"end": 191,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 168,
"end": 185,
"ctxt": 0
},
"value": "--nested-function",
"raw": "--nested-function"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 187,
"end": 197,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 187,
"end": 191,
"ctxt": 0
},
"token": {
"Function": {
"value": "foo",
"raw": "foo"
}
}
},
{
"span": {
"start": 191,
"end": 195,
"ctxt": 0
},
"token": {
"Function": {
"value": "bar",
"raw": "bar"
}
}
},
{
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"token": "RParen"
},
{
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"token": "RParen"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 200,
"end": 216,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 200,
"end": 213,
"ctxt": 0
},
"value": "--parentheses",
"raw": "--parentheses"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 215,
"end": 218,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"token": "LParen"
},
{
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"token": "RParen"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 221,
"end": 232,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 221,
"end": 229,
"ctxt": 0
},
"value": "--braces",
"raw": "--braces"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"token": "LBrace"
},
{
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"token": "RBrace"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 237,
"end": 250,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 237,
"end": 247,
"ctxt": 0
},
"value": "--brackets",
"raw": "--brackets"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 249,
"end": 252,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"token": "LBracket"
},
{
"span": {
"start": 250,
"end": 251,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"token": "RBracket"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 255,
"end": 284,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 255,
"end": 275,
"ctxt": 0
},
"value": "--at-keyword-unknown",
"raw": "--at-keyword-unknown"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 277,
"end": 284,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 277,
"end": 284,
"ctxt": 0
},
"token": {
"AtKeyword": {
"value": "foobar",
"raw": "foobar"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 287,
"end": 313,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 287,
"end": 305,
"ctxt": 0
},
"value": "--at-keyword-known",
"raw": "--at-keyword-known"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 307,
"end": 313,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 307,
"end": 313,
"ctxt": 0
},
"token": {
"AtKeyword": {
"value": "media",
"raw": "media"
}
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 316,
"end": 351,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 316,
"end": 342,
"ctxt": 0
},
"value": "--at-keyword-unknown-block",
"raw": "--at-keyword-unknown-block"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 344,
"end": 354,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 344,
"end": 351,
"ctxt": 0
},
"token": {
"AtKeyword": {
"value": "foobar",
"raw": "foobar"
}
}
},
{
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"token": "LBrace"
},
{
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"token": "RBrace"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 357,
"end": 389,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 357,
"end": 381,
"ctxt": 0
},
"value": "--at-keyword-known-block",
"raw": "--at-keyword-known-block"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 383,
"end": 392,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 383,
"end": 389,
"ctxt": 0
},
"token": {
"AtKeyword": {
"value": "media",
"raw": "media"
}
}
},
{
"span": {
"start": 389,
"end": 390,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"token": "LBrace"
},
{
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"token": "RBrace"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 395,
"end": 419,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 395,
"end": 413,
"ctxt": 0
},
"value": "--cdo-at-top-level",
"raw": "--cdo-at-top-level"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 415,
"end": 419,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 415,
"end": 419,
"ctxt": 0
},
"token": "CDO"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 422,
"end": 445,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 422,
"end": 440,
"ctxt": 0
},
"value": "--cdc-at-top-level",
"raw": "--cdc-at-top-level"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 442,
"end": 445,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 442,
"end": 445,
"ctxt": 0
},
"token": "CDC"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 448,
"end": 470,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 448,
"end": 467,
"ctxt": 0
},
"value": "--cdo-not-top-level",
"raw": "--cdo-not-top-level"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 469,
"end": 475,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 469,
"end": 470,
"ctxt": 0
},
"token": "LParen"
},
{
"span": {
"start": 470,
"end": 474,
"ctxt": 0
},
"token": "CDO"
},
{
"span": {
"start": 474,
"end": 475,
"ctxt": 0
},
"token": "RParen"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 478,
"end": 500,
"ctxt": 0
},
"name": {
"type": "DashedIdentifier",
"span": {
"start": 478,
"end": 497,
"ctxt": 0
},
"value": "--cdc-not-top-level",
"raw": "--cdc-not-top-level"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 499,
"end": 504,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 499,
"end": 500,
"ctxt": 0
},
"token": "LParen"
},
{
"span": {
"start": 500,
"end": 503,
"ctxt": 0
},
"token": "CDC"
},
{
"span": {
"start": 503,
"end": 504,
"ctxt": 0
},
"token": "RParen"
}
]
}
],
"important": null
}
]
}
}
]
}