mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] npm run format
This commit is contained in:
parent
3b27eaac43
commit
d267fa461b
9 changed files with 24 additions and 29 deletions
|
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 '>';
|
||||
|
|
|
@ -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] = '/';
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ Basics.before(async () => {
|
|||
dest: process.stderr,
|
||||
};
|
||||
|
||||
runtime = await createRuntime(astroConfig, {logging});
|
||||
runtime = await createRuntime(astroConfig, { logging });
|
||||
});
|
||||
|
||||
Basics.after(async () => {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,7 +16,7 @@ StylesSSR.before(async () => {
|
|||
dest: process.stderr,
|
||||
};
|
||||
|
||||
runtime = await createRuntime(astroConfig, {logging});
|
||||
runtime = await createRuntime(astroConfig, { logging });
|
||||
});
|
||||
|
||||
StylesSSR.after(async () => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue