diff --git a/packages/svelte/src/compiler/parse/read/css-tree-cq/css_tree_parse.js b/packages/svelte/src/compiler/parse/read/css-tree-cq/css_tree_parse.js index f3c9bbd394..ff821d8533 100644 --- a/packages/svelte/src/compiler/parse/read/css-tree-cq/css_tree_parse.js +++ b/packages/svelte/src/compiler/parse/read/css-tree-cq/css_tree_parse.js @@ -1,6 +1,6 @@ // @ts-nocheck import { fork } from 'css-tree'; -import { String, Url, Function, RightParenthesis, Ident, Semicolon } from 'css-tree/tokenizer'; +import { String, Url, Function, Ident, Semicolon } from 'css-tree/tokenizer'; import * as node from './node/index.js'; @@ -44,31 +44,41 @@ const cqSyntax = fork({ this.skipSC(); if (this.tokenType == Function && this.cmpStr(this.tokenStart, this.tokenEnd, 'layer(')) { - children.push(this.Function(() => { - const children = this.createList(); - this.skipSC(); - children.push(this.LayerName()); - this.skipSC(); - return children; - }, this.scope.AtrulePrelude)); - } else if (this.tokenType == Ident && this.cmpStr(this.tokenStart, this.tokenEnd, 'layer')) { + children.push( + this.Function(() => { + const children = this.createList(); + this.skipSC(); + children.push(this.LayerName()); + this.skipSC(); + return children; + }, this.scope.AtrulePrelude) + ); + } else if ( + this.tokenType == Ident && + this.cmpStr(this.tokenStart, this.tokenEnd, 'layer') + ) { children.push(this.Identifier()); } this.skipSC(); - if (this.tokenType == Function && this.cmpStr(this.tokenStart, this.tokenEnd, 'supports(')) { - children.push(this.Function(() => { - const children = this.createList(); - this.skipSC(); - children.push(this.SupportsCondition()); - this.skipSC(); - return children; - }, this.scope.AtrulePrelude)); + if ( + this.tokenType == Function && + this.cmpStr(this.tokenStart, this.tokenEnd, 'supports(') + ) { + children.push( + this.Function(() => { + const children = this.createList(); + this.skipSC(); + children.push(this.SupportsCondition()); + this.skipSC(); + return children; + }, this.scope.AtrulePrelude) + ); } this.skipSC(); - + if (this.tokenType !== Semicolon) { children.push(this.MediaQueryList()); } @@ -77,7 +87,7 @@ const cqSyntax = fork({ }, block: null } - }, + } }, node }); diff --git a/packages/svelte/src/compiler/parse/read/css-tree-cq/node/layer_name.js b/packages/svelte/src/compiler/parse/read/css-tree-cq/node/layer_name.js index 15ef84c49a..d1c7b78974 100644 --- a/packages/svelte/src/compiler/parse/read/css-tree-cq/node/layer_name.js +++ b/packages/svelte/src/compiler/parse/read/css-tree-cq/node/layer_name.js @@ -1,12 +1,12 @@ // @ts-nocheck import { Delim } from 'css-tree/tokenizer'; -const FULLSTOP = 0x002E; // U+002E FULL STOP (.) +const FULLSTOP = 0x002e; // U+002E FULL STOP (.) export const name = 'LayerName'; export const structure = { name: 'Identifier', - sublayer: ['LayerName', null], + sublayer: ['LayerName', null] }; // TODO: Wait for css-tree to support a layer name AST and remove this file @@ -18,8 +18,8 @@ export function parse() { const char_code = this.charCodeAt(char_idx); let sublayer; - if (char_code === FULLSTOP) { - this.next(); + if (char_code === FULLSTOP) { + this.next(); sublayer = parse.call(this); } else { sublayer = null; @@ -29,14 +29,14 @@ export function parse() { type: 'LayerName', name, sublayer, - loc: this.getLocation(start, this.tokenStart), - } + loc: this.getLocation(start, this.tokenStart) + }; } export function generate(node) { this.token(Ident, node.name); - this.token(Delim, "."); + this.token(Delim, '.'); if (node.sublayer !== null) { - generate.call(this, node.sublayer); + generate.call(this, node.sublayer); } } diff --git a/packages/svelte/src/compiler/parse/read/css-tree-cq/node/supports_condition.js b/packages/svelte/src/compiler/parse/read/css-tree-cq/node/supports_condition.js index b0e50423f3..afbcc95459 100644 --- a/packages/svelte/src/compiler/parse/read/css-tree-cq/node/supports_condition.js +++ b/packages/svelte/src/compiler/parse/read/css-tree-cq/node/supports_condition.js @@ -1,7 +1,7 @@ // @ts-nocheck export const name = 'SupportsCondition'; export const structure = { - children: [[]], + children: [[]] }; // TODO: Wait until css-tree has better @supports condition AST and remove this file @@ -19,4 +19,3 @@ export function parse() { export function generate(node) { this.children(node); } -