[ci] format

This commit is contained in:
matthewp 2022-08-23 17:28:38 +00:00 committed by fredkbot
parent 27ac6a03a1
commit 77f9afa44a
4 changed files with 32 additions and 29 deletions

View file

@ -189,7 +189,8 @@ export function* eachPageData(internals: BuildInternals) {
* and page-level CSS on bottom.
*/
export function sortedCSS(pageData: PageBuildData) {
return Array.from(pageData.css).sort((a, b) => {
return Array.from(pageData.css)
.sort((a, b) => {
let depthA = a[1].depth,
depthB = b[1].depth;
@ -200,5 +201,6 @@ export function sortedCSS(pageData: PageBuildData) {
} else {
return depthA > depthB ? -1 : 1;
}
}).map(([id]) => id);
})
.map(([id]) => id);
}

View file

@ -43,7 +43,10 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[]
function createNameForParentPages(id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
const parents = Array.from(getTopLevelPages(id, ctx));
const proposedName = parents.map(([page]) => nameifyPage(page.id)).sort().join('-');
const proposedName = parents
.map(([page]) => nameifyPage(page.id))
.sort()
.join('-');
// We don't want absurdedly long chunk names, so if this is too long create a hashed version instead.
if (proposedName.length <= MAX_NAME_LENGTH) {

View file

@ -32,14 +32,12 @@ describe('CSS production ordering', () => {
root: './fixtures/css-order/',
});
before(async () => {
let fixture = await loadFixture({ ...commonConfig });
await fixture.build();
staticHTML = await fixture.readFile('/one/index.html');
staticCSS = await Promise.all(
getLinks(staticHTML).map(href => getLinkContent(fixture, href))
getLinks(staticHTML).map((href) => getLinkContent(fixture, href))
);
});
@ -85,7 +83,7 @@ describe('CSS production ordering', () => {
let html = await fixture.readFile('/two/index.html');
const content = await Promise.all(
getLinks(html).map(href => getLinkContent(fixture, href))
getLinks(html).map((href) => getLinkContent(fixture, href))
);
expect(content).to.have.a.lengthOf(2, 'there are 2 stylesheets');

View file

@ -34,7 +34,7 @@ describe('MDX Page', () => {
const stylesheet = document.querySelector('link[rel="stylesheet"]');
expect(stylesheet).to.not.be.null;
})
});
});
describe('dev', () => {