[ci] yarn format
This commit is contained in:
parent
b547892411
commit
b2a72ccac4
5 changed files with 34 additions and 55 deletions
|
@ -102,13 +102,10 @@ async function transformFromSource(
|
|||
interface CompileComponentOptions {
|
||||
compileOptions: CompileOptions;
|
||||
filename: string;
|
||||
projectRoot: string,
|
||||
projectRoot: string;
|
||||
isPage?: boolean;
|
||||
}
|
||||
export async function compileComponent(
|
||||
source: string,
|
||||
{ compileOptions, filename, projectRoot, isPage }: CompileComponentOptions
|
||||
): Promise<CompileResult> {
|
||||
export async function compileComponent(source: string, { compileOptions, filename, projectRoot, isPage }: CompileComponentOptions): Promise<CompileResult> {
|
||||
const result = await transformFromSource(source, { compileOptions, filename, projectRoot });
|
||||
const site = compileOptions.astroConfig.buildOptions.site || `http://localhost:${compileOptions.astroConfig.devOptions.port}`;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export default function (opts: TransformOptions): Transformer {
|
|||
},
|
||||
leave(node) {
|
||||
eoh.leave(node);
|
||||
}
|
||||
},
|
||||
},
|
||||
InlineComponent: {
|
||||
enter(node) {
|
||||
|
@ -33,7 +33,7 @@ export default function (opts: TransformOptions): Transformer {
|
|||
},
|
||||
leave(node) {
|
||||
eoh.leave(node);
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -59,10 +59,7 @@ export default function (opts: TransformOptions): Transformer {
|
|||
start: 0,
|
||||
end: 0,
|
||||
type: 'Expression',
|
||||
codeChunks: [
|
||||
'Astro.css.map(css => (',
|
||||
'))'
|
||||
],
|
||||
codeChunks: ['Astro.css.map(css => (', '))'],
|
||||
children: [
|
||||
{
|
||||
type: 'Element',
|
||||
|
@ -75,9 +72,9 @@ export default function (opts: TransformOptions): Transformer {
|
|||
{
|
||||
type: 'Text',
|
||||
raw: 'stylesheet',
|
||||
data: 'stylesheet'
|
||||
}
|
||||
]
|
||||
data: 'stylesheet',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'href',
|
||||
|
@ -91,22 +88,20 @@ export default function (opts: TransformOptions): Transformer {
|
|||
start: 0,
|
||||
end: 0,
|
||||
type: 'Expression',
|
||||
codeChunks: [
|
||||
'css'
|
||||
codeChunks: ['css'],
|
||||
children: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
children: []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
],
|
||||
start: 0,
|
||||
end: 0,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (hasComponents) {
|
||||
|
@ -157,19 +152,16 @@ export default function (opts: TransformOptions): Transformer {
|
|||
start: 0,
|
||||
end: 0,
|
||||
type: 'Expression',
|
||||
codeChunks: [
|
||||
'Astro.isPage ? (',
|
||||
') : null'
|
||||
],
|
||||
codeChunks: ['Astro.isPage ? (', ') : null'],
|
||||
children: [
|
||||
{
|
||||
start: 0,
|
||||
end: 0,
|
||||
type: 'Fragment',
|
||||
children
|
||||
}
|
||||
]
|
||||
}
|
||||
children,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
eoh.append(conditionalNode);
|
||||
},
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
import type { TemplateNode } from '@astrojs/parser';
|
||||
|
||||
const validHeadElements = new Set([
|
||||
'!doctype',
|
||||
'title',
|
||||
'meta',
|
||||
'link',
|
||||
'style',
|
||||
'script',
|
||||
'noscript',
|
||||
'base'
|
||||
]);
|
||||
const validHeadElements = new Set(['!doctype', 'title', 'meta', 'link', 'style', 'script', 'noscript', 'base']);
|
||||
|
||||
export class EndOfHead {
|
||||
private head: TemplateNode | null = null;
|
||||
|
|
|
@ -228,7 +228,7 @@ async function load(config: RuntimeConfig, rawPathname: string | undefined): Pro
|
|||
},
|
||||
children: [],
|
||||
props: { collection },
|
||||
css: Array.isArray(mod.css) ? mod.css : typeof mod.css === 'string' ? [mod.css] : []
|
||||
css: Array.isArray(mod.css) ? mod.css : typeof mod.css === 'string' ? [mod.css] : [],
|
||||
})) as string;
|
||||
|
||||
return {
|
||||
|
|
|
@ -7,8 +7,8 @@ const NoHeadEl = suite('Documents without a head');
|
|||
|
||||
setup(NoHeadEl, './fixtures/no-head-el', {
|
||||
runtimeOptions: {
|
||||
mode: 'development'
|
||||
}
|
||||
mode: 'development',
|
||||
},
|
||||
});
|
||||
|
||||
NoHeadEl('Places style and scripts before the first non-head element', async ({ runtime }) => {
|
||||
|
@ -25,5 +25,4 @@ NoHeadEl('Places style and scripts before the first non-head element', async ({
|
|||
assert.equal($('script[src="/_snowpack/hmr-client.js"]').length, 1, 'Only the hmr client for the page');
|
||||
});
|
||||
|
||||
|
||||
NoHeadEl.run();
|
||||
|
|
Loading…
Reference in a new issue