From becdf3e923df1cd604b9157a8d6c2d0bd0b9c24b Mon Sep 17 00:00:00 2001 From: natemoo-re Date: Wed, 20 Apr 2022 21:47:20 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/runtime/client/hmr.ts | 4 ++-- packages/astro/src/vite-plugin-astro/hmr.ts | 6 +++--- packages/astro/src/vite-plugin-astro/index.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/astro/src/runtime/client/hmr.ts b/packages/astro/src/runtime/client/hmr.ts index 119dd421f..7cd773256 100644 --- a/packages/astro/src/runtime/client/hmr.ts +++ b/packages/astro/src/runtime/client/hmr.ts @@ -1,5 +1,5 @@ if (import.meta.hot) { - import.meta.hot.accept(mod => mod); + import.meta.hot.accept((mod) => mod); const parser = new DOMParser(); async function updatePage() { const { default: diff } = await import('micromorph'); @@ -31,7 +31,7 @@ if (import.meta.hot) { } } if (hasAstroUpdate) { - return updatePage() + return updatePage(); } } import.meta.hot.on('vite:beforeUpdate', async (event) => { diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts index f63a63969..4e194993e 100644 --- a/packages/astro/src/vite-plugin-astro/hmr.ts +++ b/packages/astro/src/vite-plugin-astro/hmr.ts @@ -84,8 +84,8 @@ export async function handleHotUpdate(ctx: HmrContext, config: AstroConfig, logg // Bugfix: sometimes style URLs get normalized and end with `lang.css=` // These will cause full reloads, so filter them out here - const mods = ctx.modules.filter(m => !m.url.endsWith('=')); - const isSelfAccepting = mods.every(m => m.isSelfAccepting || m.url.endsWith('.svelte')); + const mods = ctx.modules.filter((m) => !m.url.endsWith('=')); + const isSelfAccepting = mods.every((m) => m.isSelfAccepting || m.url.endsWith('.svelte')); const file = ctx.file.replace(config.root.pathname, '/'); if (isSelfAccepting) { @@ -94,5 +94,5 @@ export async function handleHotUpdate(ctx: HmrContext, config: AstroConfig, logg info(logging, 'astro', msg.reload({ file })); } - return mods + return mods; } diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 428b70d55..ea6f17dcd 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -175,11 +175,11 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu // Add HMR handling in dev mode. if (!resolvedConfig.isProduction) { // HACK: extract dependencies from metadata until compiler static extraction handles them - const metadata = transformResult.code.split('$$createMetadata(')[1].split('});\n')[0] + const metadata = transformResult.code.split('$$createMetadata(')[1].split('});\n')[0]; const pattern = /specifier:\s*'([^']*)'/g; const deps = new Set(); let match; - while (match = pattern.exec(metadata)?.[1]) { + while ((match = pattern.exec(metadata)?.[1])) { deps.add(match); } // // import.meta.hot.accept(["${id}", "${Array.from(deps).join('","')}"], (...mods) => mods); @@ -255,7 +255,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu } } - throw err; + throw err; } }, async handleHotUpdate(context) {