diff --git a/src/compiler/optimize/doctype.ts b/src/compiler/optimize/doctype.ts index a666876bff..fdf6c4078d 100644 --- a/src/compiler/optimize/doctype.ts +++ b/src/compiler/optimize/doctype.ts @@ -8,26 +8,27 @@ export default function (_opts: { filename: string; fileID: string }): Optimizer html: { Element: { enter(node, parent, _key, index) { - if(node.name === '!doctype') { + if (node.name === '!doctype') { hasDoctype = true; } - if(node.name === 'html' && !hasDoctype) { + if (node.name === 'html' && !hasDoctype) { const dtNode = { - start: 0, end: 0, + start: 0, + end: 0, attributes: [{ type: 'Attribute', name: 'html', value: true, start: 0, end: 0 }], children: [], name: '!doctype', - type: 'Element' + type: 'Element', }; parent.children!.splice(index, 0, dtNode); hasDoctype = true; } - } - } - } + }, + }, + }, }, async finalize() { // Nothing happening here. - } - } -} \ No newline at end of file + }, + }; +} diff --git a/src/frontend/h.ts b/src/frontend/h.ts index 70965e1350..7d26d21d2d 100644 --- a/src/frontend/h.ts +++ b/src/frontend/h.ts @@ -6,9 +6,9 @@ export type HTag = string | AstroComponent; const voidTags = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']); function* _h(tag: string, attrs: HProps, children: Array) { - if(tag === '!doctype') { + if (tag === '!doctype') { yield ''; diff --git a/src/runtime.ts b/src/runtime.ts index 1b7261dfcb..3b2cffefc6 100644 --- a/src/runtime.ts +++ b/src/runtime.ts @@ -5,11 +5,7 @@ import type { CompileError } from './parser/utils/error.js'; import { info } from './logger.js'; import { existsSync } from 'fs'; -import { - loadConfiguration, - logger as snowpackLogger, - startServer as startSnowpackServer -} from 'snowpack'; +import { loadConfiguration, logger as snowpackLogger, startServer as startSnowpackServer } from 'snowpack'; interface RuntimeConfig { astroConfig: AstroConfig; @@ -137,10 +133,10 @@ export async function createRuntime(astroConfig: AstroConfig, { logging }: Runti const mountOptions = { [astroRoot.pathname]: '/_astro', - [internalPath.pathname]: '/_astro_internal' - } + [internalPath.pathname]: '/_astro_internal', + }; - if(existsSync(astroConfig.public)) { + if (existsSync(astroConfig.public)) { mountOptions[astroConfig.public.pathname] = '/'; } diff --git a/test/astro-basic.test.js b/test/astro-basic.test.js index 606a94679b..b06cdfcd01 100644 --- a/test/astro-basic.test.js +++ b/test/astro-basic.test.js @@ -16,7 +16,7 @@ Basics.before(async () => { dest: process.stderr, }; - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); }); Basics.after(async () => { diff --git a/test/astro-doctype.test.js b/test/astro-doctype.test.js index 23188fd972..c71aee1de9 100644 --- a/test/astro-doctype.test.js +++ b/test/astro-doctype.test.js @@ -16,8 +16,7 @@ DType.before(async () => { dest: process.stderr, }; - - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); } catch (err) { console.error(err); setupError = err; @@ -47,8 +46,7 @@ DType.skip('Preserves user provided doctype', async () => { assert.equal(result.statusCode, 200); const html = result.contents.toString('utf-8'); - assert.ok(html.startsWith(''), - 'Doctype included was preserved'); + assert.ok(html.startsWith(''), 'Doctype included was preserved'); }); DType.run(); diff --git a/test/astro-markdown.test.js b/test/astro-markdown.test.js index 7f5b310e38..a07f692c07 100644 --- a/test/astro-markdown.test.js +++ b/test/astro-markdown.test.js @@ -17,7 +17,7 @@ Markdown.before(async () => { }; try { - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); } catch (err) { console.error(err); setupError = err; diff --git a/test/astro-styles-ssr.test.js b/test/astro-styles-ssr.test.js index 27da410493..9145e65a98 100644 --- a/test/astro-styles-ssr.test.js +++ b/test/astro-styles-ssr.test.js @@ -16,7 +16,7 @@ StylesSSR.before(async () => { dest: process.stderr, }; - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); }); StylesSSR.after(async () => { diff --git a/test/react-component.test.js b/test/react-component.test.js index 48608f902d..db3004be56 100644 --- a/test/react-component.test.js +++ b/test/react-component.test.js @@ -17,7 +17,7 @@ React.before(async () => { }; try { - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); } catch (err) { console.error(err); setupError = err; diff --git a/test/snowpack-integration.test.js b/test/snowpack-integration.test.js index ba2c509c03..3b260ecb4c 100644 --- a/test/snowpack-integration.test.js +++ b/test/snowpack-integration.test.js @@ -25,7 +25,7 @@ SnowpackDev.before(async () => { }; try { - runtime = await createRuntime(astroConfig, {logging}); + runtime = await createRuntime(astroConfig, { logging }); } catch (err) { console.error(err); setupError = err;