[ci] npm run format

This commit is contained in:
matthewp 2021-04-09 18:09:44 +00:00 committed by GitHub Actions
parent ad9c3b1d8d
commit 62924b3162
5 changed files with 44 additions and 47 deletions

View file

@ -65,8 +65,8 @@ export default function (module: Script): Transformer {
type: 'Expression', type: 'Expression',
codeStart: '`' + escape(code) + '`', codeStart: '`' + escape(code) + '`',
codeEnd: '', codeEnd: '',
children: [] children: [],
} },
}, },
], ],
}, },

View file

@ -1,4 +1,3 @@
import type { BaseNode, Expression } from '../../interfaces'; import type { BaseNode, Expression } from '../../interfaces';
import { Parser } from '../index.js'; import { Parser } from '../index.js';
import parseAstro from '../index.js'; import parseAstro from '../index.js';
@ -69,9 +68,7 @@ function consume_line_comment(state: ParseState) {
} while (in_bounds(state)); } while (in_bounds(state));
} }
const voidElements = new Set(['area', 'base', 'br', 'col', 'command', 'embed', const voidElements = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source',
'track', 'wbr']);
function consume_tag(state: ParseState) { function consume_tag(state: ParseState) {
const start = state.index - 1; const start = state.index - 1;
@ -86,7 +83,7 @@ function consume_tag(state: ParseState) {
const char = next_char(state); const char = next_char(state);
switch (char) { switch (char) {
case '\'': case "'":
case '"': { case '"': {
consume_string(state, char); consume_string(state, char);
break; break;
@ -160,7 +157,6 @@ function consume_tag(state: ParseState) {
const source = state.source.substring(start, state.index); const source = state.source.substring(start, state.index);
const ast = parseAstro(source); const ast = parseAstro(source);
const fragment = ast.html; const fragment = ast.html;
@ -174,15 +170,17 @@ function consume_expression(source: string, start: number): Expression {
end: Number.NaN, end: Number.NaN,
codeStart: '', codeStart: '',
codeEnd: '', codeEnd: '',
children: [] children: [],
}; };
let codeEndStart: number = 0; let codeEndStart: number = 0;
const state: ParseState = { const state: ParseState = {
source, start, index: start, source,
start,
index: start,
curlyCount: 1, curlyCount: 1,
bracketCount: 0, bracketCount: 0,
root: expr root: expr,
}; };
do { do {
@ -204,7 +202,7 @@ function consume_expression(source: string, start: number): Expression {
codeEndStart = state.index; codeEndStart = state.index;
break; break;
} }
case '\'': case "'":
case '"': case '"':
case '`': { case '`': {
consume_string(state, char); consume_string(state, char);

View file

@ -4,7 +4,6 @@ import type { Node } from 'estree';
import { Parser } from '../index.js'; import { Parser } from '../index.js';
import { Script } from '../../interfaces.js'; import { Script } from '../../interfaces.js';
const script_closing_tag = '</script>'; const script_closing_tag = '</script>';
function get_context(parser: Parser, attributes: any[], start: number): 'runtime' | 'setup' { function get_context(parser: Parser, attributes: any[], start: number): 'runtime' | 'setup' {