From 365972582ea06b7067157eff8195de2d763c0acd Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 13 Jan 2022 14:24:25 +0000 Subject: [PATCH] [ci] yarn format --- packages/astro/src/core/build/fs.ts | 26 +++++++++---------- packages/astro/src/core/build/static-build.ts | 22 ++++++++-------- .../test/static-build-frameworks.test.js | 4 +-- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/packages/astro/src/core/build/fs.ts b/packages/astro/src/core/build/fs.ts index f557b3cbf..badfc815d 100644 --- a/packages/astro/src/core/build/fs.ts +++ b/packages/astro/src/core/build/fs.ts @@ -5,19 +5,19 @@ import npath from 'path'; import { fileURLToPath } from 'url'; export function emptyDir(dir: string, skip?: Set): void { - for (const file of fs.readdirSync(dir)) { - if (skip?.has(file)) { - continue - } - const abs = npath.resolve(dir, file) - // baseline is Node 12 so can't use rmSync :( - if (fs.lstatSync(abs).isDirectory()) { - emptyDir(abs) - fs.rmdirSync(abs) - } else { - fs.unlinkSync(abs) - } - } + for (const file of fs.readdirSync(dir)) { + if (skip?.has(file)) { + continue; + } + const abs = npath.resolve(dir, file); + // baseline is Node 12 so can't use rmSync :( + if (fs.lstatSync(abs).isDirectory()) { + emptyDir(abs); + fs.rmdirSync(abs); + } else { + fs.unlinkSync(abs); + } + } } export function prepareOutDir(astroConfig: AstroConfig) { diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index b21c81b00..faa42cd75 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -36,8 +36,6 @@ function addPageName(pathname: string, opts: StaticBuildOptions): void { opts.pageNames.push(pathname.replace(/\/?$/, pathrepl).replace(/^\//, '')); } - - // Determines of a Rollup chunk is an entrypoint page. function chunkIsPage(output: OutputAsset | OutputChunk, internals: BuildInternals) { if (output.type !== 'chunk') { @@ -178,14 +176,16 @@ async function collectRenderers(opts: StaticBuildOptions): Promise { // we need the ESM loaded version. This creates that. const viteLoadedRenderers = pageData.preload[0]; - const renderers = await Promise.all(viteLoadedRenderers.map(async r => { - const mod = await import(r.serverEntry); - return Object.create(r, { - ssr: { - value: mod.default - } - }) as Renderer; - })); + const renderers = await Promise.all( + viteLoadedRenderers.map(async (r) => { + const mod = await import(r.serverEntry); + return Object.create(r, { + ssr: { + value: mod.default, + }, + }) as Renderer; + }) + ); return renderers; } @@ -253,7 +253,7 @@ async function generatePath(pathname: string, opts: StaticBuildOptions, gopts: G // This adds the page name to the array so it can be shown as part of stats. addPageName(pathname, opts); - const [,mod] = pageData.preload; + const [, mod] = pageData.preload; try { const [params, pageProps] = await getParamsAndProps({ diff --git a/packages/astro/test/static-build-frameworks.test.js b/packages/astro/test/static-build-frameworks.test.js index 22ba13b3c..a3706d7e7 100644 --- a/packages/astro/test/static-build-frameworks.test.js +++ b/packages/astro/test/static-build-frameworks.test.js @@ -12,9 +12,7 @@ describe('Static build - frameworks', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/static-build-frameworks/', - renderers: [ - '@astrojs/renderer-preact' - ], + renderers: ['@astrojs/renderer-preact'], buildOptions: { experimentalStaticBuild: true, },