summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/optimize/doctype.ts21
-rw-r--r--src/frontend/h.ts4
-rw-r--r--src/runtime.ts12
-rw-r--r--test/astro-basic.test.js2
-rw-r--r--test/astro-doctype.test.js6
-rw-r--r--test/astro-markdown.test.js2
-rw-r--r--test/astro-styles-ssr.test.js2
-rw-r--r--test/react-component.test.js2
-rw-r--r--test/snowpack-integration.test.js2
9 files changed, 24 insertions, 29 deletions
diff --git a/src/compiler/optimize/doctype.ts b/src/compiler/optimize/doctype.ts
index a666876bf..fdf6c4078 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 70965e135..7d26d21d2 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<HChild>) {
- if(tag === '!doctype') {
+ if (tag === '!doctype') {
yield '<!doctype ';
- if(attrs) {
+ if (attrs) {
yield Object.keys(attrs).join(' ');
}
yield '>';
diff --git a/src/runtime.ts b/src/runtime.ts
index 1b7261dfc..3b2cffefc 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 606a94679..b06cdfcd0 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 23188fd97..c71aee1de 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 HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'),
- 'Doctype included was preserved');
+ assert.ok(html.startsWith('<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'), 'Doctype included was preserved');
});
DType.run();
diff --git a/test/astro-markdown.test.js b/test/astro-markdown.test.js
index 7f5b310e3..a07f692c0 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 27da41049..9145e65a9 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 48608f902..db3004be5 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 ba2c509c0..3b260ecb4 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;