forked from vite-pwa/vite-plugin-pwa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
122 lines (119 loc) · 2.36 KB
/
types.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* eslint-disable no-use-before-define */
import { GenerateSWConfig, InjectManifestConfig } from 'workbox-build'
/**
* Plugin options.
*/
export interface VitePWAOptions {
/**
* Build mode
*
* @default process.env.NODE_ENV or "production"
*/
mode?: 'development' | 'production'
/**
* @default 'public'
*/
srcDir?: string
/**
* @default 'dist'
*/
outDir?: string
/**
* @default 'sw.js'
*/
filename?: string
/**
* @default 'generateSW'
*/
strategies?: 'generateSW' | 'injectManifest'
/**
* The scope to register the Service Worker
*
* @default same as `base` of Vite's config
*/
scope?: string
/**
* Inject the service worker register inlined in the index.html
*
* @default true
*/
inlineRegister: boolean
/**
* Minify the generated manifest
*
* @default true
*/
minify: boolean
/**
* The manifest object
*/
manifest: Partial<ManifestOptions>
/**
* The workbox object for `generateSW`
*/
workbox: Partial<GenerateSWConfig>
/**
* The workbox object for `injectManifest`
*/
injectManifest: Partial<InjectManifestConfig>
}
export interface ResolvedVitePWAOptions extends Required<VitePWAOptions> {
swDest: string
workbox: GenerateSWConfig
injectManifest: InjectManifestConfig
basePath: string
}
export interface ManifestOptions {
/**
* @default _npm_package_name_
*/
name: string
/**
* @default _npm_package_name_
*/
short_name: string
/**
* @default _npm_package_description_
*/
description: string
/**
*
*/
icons: Record<string, any>[]
/**
* @default `routerBase + '?standalone=true'`
*/
start_url: string
/**
* Restricts what web pages can be viewed while the manifest is applied
*/
scope: string
/**
* Defines the default orientation for all the website's top-level
*/
orientation: 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary'
/**
* @default `standalone`
*/
display: string
/**
* @default `#ffffff`
*/
background_color: string
/**
* @default '#42b883
*/
theme_color: string
/**
* @default `ltr`
*/
dir: 'ltr' | 'rtl'
/**
* @default `en`
*/
lang: string
/**
* @default A combination of `routerBase` and `options.build.publicPath`
*/
publicPath: string
}