From e5d0a5e65c5eebd613ece5ac57a6c9ef018dcf4c Mon Sep 17 00:00:00 2001 From: ayoayco Date: Sun, 25 Aug 2024 13:45:38 +0200 Subject: [PATCH] chore: format code --- astro-sw.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/astro-sw.js b/astro-sw.js index 7ec6ddc..7ede52a 100644 --- a/astro-sw.js +++ b/astro-sw.js @@ -57,12 +57,12 @@ export default function serviceWorker(options) { } = options || {}; const { - installing: installingFn = () => {}, - waiting: waitingFn = () => {}, - active: activeFn = () => {}, - error: errorFn = () => {}, - unsupported: unsupportedFn = () => {}, - afterRegistration: afterRegistrationFn = () => {}, + installing: installingFn = () => { }, + waiting: waitingFn = () => { }, + active: activeFn = () => { }, + error: errorFn = () => { }, + unsupported: unsupportedFn = () => { }, + afterRegistration: afterRegistrationFn = () => { }, } = registrationHooks; /** @@ -114,15 +114,14 @@ export default function serviceWorker(options) { injectScript('page', registrationScript); } }, - 'astro:config:done': async ({injectTypes, logger}) => { + 'astro:config:done': async ({ injectTypes, logger }) => { let injectedTypes = ` declare const __assets: string[]; declare const __version: string; declare const __prefix: string;` - injectTypes({filename: 'caching.d.ts', content: injectedTypes}) + injectTypes({ filename: 'caching.d.ts', content: injectedTypes }) }, 'astro:build:ssr': ({ manifest }) => { - if (output !== 'static') { assets = manifest.assets } @@ -194,7 +193,7 @@ declare const __prefix: string;` logger.error(`Service worker script not found! ${swPath}`) if (!swPath) { - logger.error(` + logger.error(` [${ASTROSW}] ERR: The 'path' option is required! [${ASTROSW}] INFO: Please see service worker options in https://ayco.io/gh/astro-sw#readme @@ -206,10 +205,6 @@ declare const __prefix: string;` const versionDeclaration = `const __version = ${JSON.stringify(assetCacheVersionID)};\n`; const prefixDeclaration = `const __prefix = ${JSON.stringify(assetCachePrefix)};\n`; - /** - * TODO: allow importing in dev's sw.js by resolving imports - */ - const tempFile = `${swPath}.tmp.ts`; try {