feat: initial undefined options handling
This commit is contained in:
parent
6e64d75b1c
commit
15a8becfe4
1 changed files with 3 additions and 1 deletions
|
@ -13,10 +13,12 @@ import type { AstroIntegration } from 'astro'
|
||||||
const ASTROSW = '@ayco/astro-sw'
|
const ASTROSW = '@ayco/astro-sw'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO: update JSDoc
|
||||||
* Accepts configuration options with service worker path
|
* Accepts configuration options with service worker path
|
||||||
* and injects needed variables such as `__assets` generated by Astro
|
* and injects needed variables such as `__assets` generated by Astro
|
||||||
*/
|
*/
|
||||||
export default function serviceWorker(
|
export default function serviceWorker(
|
||||||
|
// TODO handle options undefined
|
||||||
options?: AstroServiceWorkerConfig
|
options?: AstroServiceWorkerConfig
|
||||||
): AstroIntegration {
|
): AstroIntegration {
|
||||||
const {
|
const {
|
||||||
|
@ -29,7 +31,7 @@ export default function serviceWorker(
|
||||||
logAssets = false,
|
logAssets = false,
|
||||||
esbuild = {},
|
esbuild = {},
|
||||||
registrationHooks = {},
|
registrationHooks = {},
|
||||||
} = options || {}
|
} = options ?? {}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
installing: installingFn = () => {},
|
installing: installingFn = () => {},
|
||||||
|
|
Loading…
Reference in a new issue