-
-
Notifications
You must be signed in to change notification settings - Fork 209
/
info.d.ts
66 lines (66 loc) · 2.25 KB
/
info.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
declare module 'virtual:pwa-info' {
export interface PwaInfo {
pwaInDevEnvironment: boolean
/**
* The web manifest will be always here.
*/
webManifest: {
href: string
useCredentials: boolean
/**
* The link tag with or without `crossorigin`:
* - `<link rel="manifest" href="<webManifestUrl>" />`.
* - `<link rel="manifest" href="<webManifestUrl>" crossorigin="use-credentials" />`.
*/
linkTag: string
}
/**
* The service worker data will be exposed only if required, that's, will **NOT** be exposed if:
* - not using `pwaPluginOptions.injectRegister` with `script`, `script-defer` or `inline` values
* - if using `pwaPluginOptions.injectRegister` with `auto` (default) and importing any of the virtual modules
*/
registerSW?: {
/**
* When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
*
* @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
*/
inline: boolean
/**
* When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
*/
mode: 'inline' | 'script' | 'script-defer'
/**
* The path for the inline script: will contain the service worker url.
*/
inlinePath: string
/**
* The path for the src script for `registerSW.js`.
*/
registerPath: string
/**
* The scope for the service worker: only required for `inline: true`.
*/
scope: string
/**
* The type for the service worker: only required for `inline: true`.
*/
type: 'classic' | 'module'
/**
* The script tag if `shouldRegisterSW` returns `true`.
*/
scriptTag?: string
}
}
/**
* Return the PWA information if available.
*
* This property will be `undefined` if:
* - SSR build
* - PWA is disabled: `pwaPluginOptions.disable = true`
* - running `Dev Server` and `pwaPluginOptions.devOptions.enabled = false` (default).
*
* @returns The PWA information.
*/
export const pwaInfo: PwaInfo | undefined
}