feat: initial undefined options handling

This commit is contained in:
Ayo Ayco 2025-04-07 23:52:24 +01:00
parent 6e64d75b1c
commit 15a8becfe4

View file

@ -13,10 +13,12 @@ import type { AstroIntegration } from 'astro'
const ASTROSW = '@ayco/astro-sw'
/**
* TODO: update JSDoc
* Accepts configuration options with service worker path
* and injects needed variables such as `__assets` generated by Astro
*/
export default function serviceWorker(
// TODO handle options undefined
options?: AstroServiceWorkerConfig
): AstroIntegration {
const {
@ -29,7 +31,7 @@ export default function serviceWorker(
logAssets = false,
esbuild = {},
registrationHooks = {},
} = options || {}
} = options ?? {}
const {
installing: installingFn = () => {},