[ci] npm run format

This commit is contained in:
matthewp 2021-03-30 14:52:09 +00:00 committed by GitHub Actions
parent 3b27eaac43
commit d267fa461b
9 changed files with 24 additions and 29 deletions

View file

@ -13,21 +13,22 @@ export default function (_opts: { filename: string; fileID: string }): Optimizer
} }
if (node.name === 'html' && !hasDoctype) { if (node.name === 'html' && !hasDoctype) {
const dtNode = { const dtNode = {
start: 0, end: 0, start: 0,
end: 0,
attributes: [{ type: 'Attribute', name: 'html', value: true, start: 0, end: 0 }], attributes: [{ type: 'Attribute', name: 'html', value: true, start: 0, end: 0 }],
children: [], children: [],
name: '!doctype', name: '!doctype',
type: 'Element' type: 'Element',
}; };
parent.children!.splice(index, 0, dtNode); parent.children!.splice(index, 0, dtNode);
hasDoctype = true; hasDoctype = true;
} }
} },
} },
} },
}, },
async finalize() { async finalize() {
// Nothing happening here. // Nothing happening here.
} },
} };
} }

View file

@ -5,11 +5,7 @@ import type { CompileError } from './parser/utils/error.js';
import { info } from './logger.js'; import { info } from './logger.js';
import { existsSync } from 'fs'; import { existsSync } from 'fs';
import { import { loadConfiguration, logger as snowpackLogger, startServer as startSnowpackServer } from 'snowpack';
loadConfiguration,
logger as snowpackLogger,
startServer as startSnowpackServer
} from 'snowpack';
interface RuntimeConfig { interface RuntimeConfig {
astroConfig: AstroConfig; astroConfig: AstroConfig;
@ -137,8 +133,8 @@ export async function createRuntime(astroConfig: AstroConfig, { logging }: Runti
const mountOptions = { const mountOptions = {
[astroRoot.pathname]: '/_astro', [astroRoot.pathname]: '/_astro',
[internalPath.pathname]: '/_astro_internal' [internalPath.pathname]: '/_astro_internal',
} };
if (existsSync(astroConfig.public)) { if (existsSync(astroConfig.public)) {
mountOptions[astroConfig.public.pathname] = '/'; mountOptions[astroConfig.public.pathname] = '/';

View file

@ -16,7 +16,6 @@ DType.before(async () => {
dest: process.stderr, dest: process.stderr,
}; };
runtime = await createRuntime(astroConfig, { logging }); runtime = await createRuntime(astroConfig, { logging });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
@ -47,8 +46,7 @@ DType.skip('Preserves user provided doctype', async () => {
assert.equal(result.statusCode, 200); assert.equal(result.statusCode, 200);
const html = result.contents.toString('utf-8'); 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">'), 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');
'Doctype included was preserved');
}); });
DType.run(); DType.run();