@unplugin-pwa/core 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -2
  3. package/client.d.ts +6 -0
  4. package/dist/additional-manifest-entries.d.mts +10 -0
  5. package/dist/additional-manifest-entries.mjs +60 -0
  6. package/dist/build-pwa-asset.d.mts +18 -0
  7. package/dist/build-pwa-asset.mjs +87 -0
  8. package/dist/config.d.mts +75 -0
  9. package/dist/config.mjs +293 -0
  10. package/dist/constants.d.mts +31 -0
  11. package/dist/constants.mjs +41 -0
  12. package/dist/context-types.d.mts +155 -0
  13. package/dist/context.d.mts +15 -0
  14. package/dist/context.mjs +58 -0
  15. package/dist/create-generate-register-sw-script.d.mts +15 -0
  16. package/dist/create-generate-register-sw-script.mjs +27 -0
  17. package/dist/create-web-manifest-html-link.d.mts +13 -0
  18. package/dist/create-web-manifest-html-link.mjs +21 -0
  19. package/dist/dev/prepare-sw-names-and-glob-directory.d.mts +18 -0
  20. package/dist/dev/prepare-sw-names-and-glob-directory.mjs +75 -0
  21. package/dist/dev/prepare-temp-folder.d.mts +9 -0
  22. package/dist/dev/prepare-temp-folder.mjs +44 -0
  23. package/dist/dual-sw-utilities.d.mts +9 -0
  24. package/dist/dual-sw-utilities.mjs +16 -0
  25. package/dist/generate-register-sw.d.mts +14 -0
  26. package/dist/generate-register-sw.mjs +22 -0
  27. package/dist/generate-web-manifest.d.mts +9 -0
  28. package/dist/generate-web-manifest.mjs +12 -0
  29. package/dist/helpers.d.mts +33 -0
  30. package/dist/helpers.mjs +132 -0
  31. package/dist/html.d.mts +8 -0
  32. package/dist/html.mjs +28 -0
  33. package/dist/index.d.mts +9 -0
  34. package/dist/inject-generate-register-sw.d.mts +16 -0
  35. package/dist/inject-generate-register-sw.mjs +22 -0
  36. package/dist/inject-web-manifest-html-link.d.mts +14 -0
  37. package/dist/inject-web-manifest-html-link.mjs +20 -0
  38. package/dist/inspector-utils.d.mts +26 -0
  39. package/dist/inspector-utils.mjs +47 -0
  40. package/dist/logs.d.mts +8 -0
  41. package/dist/logs.mjs +19 -0
  42. package/dist/package-DpKc2x3j.mjs +10 -0
  43. package/dist/prepare-pwa-context.d.mts +11 -0
  44. package/dist/prepare-pwa-context.mjs +135 -0
  45. package/dist/prepare-sw-names.d.mts +11 -0
  46. package/dist/prepare-sw-names.mjs +45 -0
  47. package/dist/pwa-assets/build.d.mts +9 -0
  48. package/dist/pwa-assets/build.mjs +15 -0
  49. package/dist/pwa-assets/config.d.mts +10 -0
  50. package/dist/pwa-assets/config.mjs +136 -0
  51. package/dist/pwa-assets/dev.d.mts +11 -0
  52. package/dist/pwa-assets/dev.mjs +35 -0
  53. package/dist/pwa-assets/generator.d.mts +20 -0
  54. package/dist/pwa-assets/generator.mjs +31 -0
  55. package/dist/pwa-assets/html.d.mts +11 -0
  56. package/dist/pwa-assets/html.mjs +47 -0
  57. package/dist/pwa-assets/manifest.d.mts +10 -0
  58. package/dist/pwa-assets/manifest.mjs +15 -0
  59. package/dist/pwa-assets/options.d.mts +9 -0
  60. package/dist/pwa-assets/options.mjs +34 -0
  61. package/dist/pwa-assets/types.d.mts +9 -0
  62. package/dist/pwa-assets/utils.d.mts +11 -0
  63. package/dist/pwa-assets/utils.mjs +48 -0
  64. package/dist/resolve-inspector-dist.d.mts +11 -0
  65. package/dist/resolve-inspector-dist.mjs +25 -0
  66. package/dist/types-B60e7Nq4.d.mts +67 -0
  67. package/dist/types-BhwjnGLn.d.mts +703 -0
  68. package/info.d.ts +71 -0
  69. package/package.json +133 -7
  70. package/preact.d.ts +17 -0
  71. package/pwa-assets.d.ts +40 -0
  72. package/react-legacy.d.ts +22 -0
  73. package/react.d.ts +17 -0
  74. package/solid.d.ts +17 -0
  75. package/svelte.d.ts +17 -0
  76. package/types/index.d.ts +43 -0
  77. package/types/package.json +3 -0
  78. package/vanillajs.d.ts +13 -0
  79. package/vue.d.ts +17 -0
  80. package/index.js +0 -1
@@ -0,0 +1,703 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { BuiltInPreset, Preset } from "@vite-pwa/assets-generator/config";
9
+ import { InjectManifestOptions, ManifestEntry, SWType, SelfDestroyingOptions } from "@vite-pwa/workbox-build/types";
10
+ import { BuildGenerateSWOptions, BuildSWOptions } from "@vite-pwa/workbox-build/build/types";
11
+ import { Strategy } from "@vite-pwa/workbox-build/config/types";
12
+ import { HtmlLinkPreset } from "@vite-pwa/assets-generator/api";
13
+ import { BuildServiceWorkerOptions } from "@vite-pwa/workbox-build/build/rolldown/types";
14
+ import { LegacyBuildServiceWorkerOptions } from "@vite-pwa/workbox-build/build/vite/legacy-types";
15
+ import { BuildServiceWorkerOptions as BuildServiceWorkerOptions$1 } from "@vite-pwa/workbox-build/build/vite/types";
16
+ interface PWAAssetsIntegrationOptions {
17
+ /**
18
+ * The base url for the PWA assets.
19
+ *
20
+ * @default `vite.base`
21
+ */
22
+ baseUrl?: string;
23
+ /**
24
+ * The public directory to resolve the image: should be an absolute path.
25
+ *
26
+ * @default `vite.root/vite.publicDir`
27
+ */
28
+ publicDir?: string;
29
+ /**
30
+ * The output directory: should be an absolute path.
31
+ *
32
+ * @default `vite.root/vite.build.outDir`
33
+ */
34
+ outDir?: string;
35
+ /**
36
+ * Resolves the image: should return absolute path.
37
+ */
38
+ resolveImage?: (image: string) => string | Promise<string>;
39
+ }
40
+ /**
41
+ * PWA assets generation and injection options.
42
+ */
43
+ interface PWAAssetsOptions {
44
+ disabled?: boolean;
45
+ /**
46
+ * PWA assets generation and injection.
47
+ *
48
+ * By default, the plugin will search for the pwa assets generator configuration file in the root directory of your project:
49
+ * - pwa-assets.config.js
50
+ * - pwa-assets.config.mjs
51
+ * - pwa-assets.config.cjs
52
+ * - pwa-assets.config.ts
53
+ * - pwa-assets.config.cts
54
+ * - pwa-assets.config.mts
55
+ *
56
+ * If using a string path, it should be relative to the root directory of your project.
57
+ *
58
+ * Setting to `false` will disable config resolving.
59
+ *
60
+ * **WARNING**: You can use only one image in the configuration file.
61
+ *
62
+ * @default false
63
+ * @see https://vite-pwa-org.netlify.app/assets-generator/cli.html#configurations
64
+ */
65
+ config?: string | boolean;
66
+ /**
67
+ * Preset to use.
68
+ *
69
+ * If the `config` option is enabled, this option will be ignored.
70
+ *
71
+ * Setting this option `false` will disable PWA assets generation (if the `config` option is also disabled).
72
+ *
73
+ * @default 'minimal-2023'
74
+ */
75
+ preset?: false | BuiltInPreset | Preset;
76
+ /**
77
+ * Path relative to `root` folder where to find the image to use for generating PWA assets.
78
+ *
79
+ * Can be also relative to any of the PWA Assets configuration files.
80
+ *
81
+ * If the `config` option is enabled, this option will be ignored.
82
+ *
83
+ * @default `public/favicon.svg`
84
+ */
85
+ image?: string;
86
+ /**
87
+ * The preset to use for head links (favicon links).
88
+ *
89
+ * If the `config` option is enabled, this option will be ignored.
90
+ *
91
+ * @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal-2023
92
+ * @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal
93
+ * @default '2023'
94
+ */
95
+ htmlPreset?: HtmlLinkPreset;
96
+ /**
97
+ * Should the plugin include html head links?
98
+ *
99
+ * @default true
100
+ */
101
+ includeHtmlHeadLinks?: boolean;
102
+ /**
103
+ * Should the plugin override the PWA web manifest icons' entry?
104
+ *
105
+ * The plugin will auto-detect the icons from the manifest, if missing, then the plugin will ignore this option and will include the icons.
106
+ *
107
+ * @default false
108
+ */
109
+ overrideManifestIcons?: boolean;
110
+ /**
111
+ * Should the PWA web manifest `theme_color` be injected in the html head?
112
+ *
113
+ * @default true
114
+ */
115
+ injectThemeColor?: boolean;
116
+ /**
117
+ * PWA Assets integration support.
118
+ *
119
+ * This option should be only used by integrations, it is not meant to be used by end users.
120
+ */
121
+ integration?: PWAAssetsIntegrationOptions;
122
+ }
123
+ interface ResolvedPWAAssetsOptions extends Required<Omit<PWAAssetsOptions, 'image' | 'integration'>> {
124
+ integration?: PWAAssetsOptions['integration'];
125
+ images: string[];
126
+ }
127
+ type VitePWAStrategy = 'generateSW' | 'buildSW' | 'injectManifest' | 'selfDestroySW' | Strategy;
128
+ interface ExternalVitePWAOptions {
129
+ /**
130
+ * Current working directory to load external configuration options.
131
+ *
132
+ * @default process.cwd()
133
+ */
134
+ cwd?: string;
135
+ /**
136
+ * `path` to load external configuration options:
137
+ * - can be an absolute path
138
+ * - can be a relative path, which will be resolved relative to `cwd` (or process.cwd() if `cwd` is not specified)
139
+ */
140
+ path?: string;
141
+ /**
142
+ * When `path` is specified, should merge inlined options and the configuration?
143
+ *
144
+ * **NOTE**: inlined options will override external configuration options.
145
+ *
146
+ * @default false
147
+ */
148
+ mergeOptions?: boolean;
149
+ }
150
+ /**
151
+ * Plugin options.
152
+ */
153
+ interface VitePWAOptions<S extends VitePWAStrategy = 'generateSW', T extends SWType = 'classic'> extends ExternalVitePWAOptions {
154
+ /**
155
+ * Should minify the output?
156
+ * - when specified it is preserved
157
+ * - true when sourcemap is not set to false or mode is set to production
158
+ * - otherwise false
159
+ */
160
+ minify?: boolean;
161
+ /**
162
+ * This value can be used to determine the maximum size of files that will be
163
+ * precached. This prevents you from inadvertently precaching very large files
164
+ * that might have accidentally matched one of your patterns.
165
+ * @default 2097152
166
+ */
167
+ maximumFileSizeToCacheInBytes?: number;
168
+ /**
169
+ * Should `maximumFileSizeToCacheInBytes` exceeded throw an error?.
170
+ * @default true
171
+ */
172
+ throwMaximumFileSizeToCacheInBytes?: boolean;
173
+ /**
174
+ * A list of entries to be precached, in addition to any entries that are
175
+ * generated as part of the build configuration.
176
+ */
177
+ additionalManifestEntries?: Array<string | ManifestEntry>;
178
+ /**
179
+ * Async generator that yields additional entries to be preached.
180
+ */
181
+ additionalManifestEntriesGenerator?: () => AsyncGenerator<string | ManifestEntry, undefined, void>;
182
+ /**
183
+ * Service worker type.
184
+ */
185
+ swType?: T;
186
+ /**
187
+ * @default 'dist'
188
+ */
189
+ outDir?: string;
190
+ /**
191
+ * @default 'sw.js'
192
+ */
193
+ filename?: string;
194
+ /**
195
+ * @default 'manifest.webmanifest'
196
+ */
197
+ manifestFilename?: string;
198
+ /**
199
+ * @default 'generateSW'
200
+ */
201
+ strategies?: S;
202
+ /**
203
+ * The scope to register the Service Worker
204
+ *
205
+ * @default same as `base` of Vite's config
206
+ */
207
+ scope?: string;
208
+ /**
209
+ * The update via cache
210
+ */
211
+ updateViaCache?: ServiceWorkerUpdateViaCache;
212
+ /**
213
+ * Inject the service worker register inlined in the index.html
214
+ *
215
+ * With `auto` set, depends on whether you used the `import { registerSW } from 'virtual:pwa-register'`
216
+ * it will do nothing or use the `script` mode
217
+ *
218
+ * `inline` - inject a simple register, inlined with the generated html
219
+ *
220
+ * `script` - inject `<script/>` in `<head>` with `src` attribute to a generated script to register the service worker
221
+ *
222
+ * `script-defer` - inject `<script defer />` in `<head>`, with `src` attribute to a generated script to register the service worker
223
+ *
224
+ * `null` - deprecated, use `false` instead
225
+ *
226
+ * `false` - do nothing, you will need to register the sw you self, or imports from `virtual:pwa-register`
227
+ *
228
+ * @default 'auto'
229
+ */
230
+ injectRegister: 'inline' | 'script' | 'script-defer' | 'auto' | null | false;
231
+ /**
232
+ * Mode for the virtual register.
233
+ * Is NOT available for strategy `injectRegister`, only use for strategy `generateSW`
234
+ *
235
+ * `prompt` - you will need to show a popup/dialog to the user to confirm the reload.
236
+ *
237
+ * `autoUpdate` - when new content is available, the new service worker will update caches and reload all browser
238
+ * windows/tabs with the application open automatically, it must take the control for the application to work
239
+ * properly.
240
+ *
241
+ * @default 'prompt'
242
+ */
243
+ registerType?: 'prompt' | 'autoUpdate';
244
+ /**
245
+ * The manifest object
246
+ */
247
+ manifest: Partial<ManifestOptions> | false;
248
+ /**
249
+ * Whether to add the `crossorigin="use-credentials"` attribute to `<link rel="manifest">`
250
+ * @default false
251
+ */
252
+ useCredentials?: boolean;
253
+ /**
254
+ * The workbox object for `generateSW`
255
+ * @deprecated use `generateSW` instead
256
+ */
257
+ workbox: Partial<Omit<BuildGenerateSWOptions<T>, 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>>;
258
+ /**
259
+ * The workbox object for `generateSW` strategy
260
+ */
261
+ generateSW: Partial<Omit<BuildGenerateSWOptions<T>, 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>>;
262
+ /**
263
+ * The workbox object for `buildSW` strategy
264
+ */
265
+ buildSW: Partial<Omit<BuildServiceWorkerOptions$1<T>, 'swSrc' | 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<LegacyBuildServiceWorkerOptions<T>, 'swSrc' | 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<BuildServiceWorkerOptions<T>, 'swSrc' | 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>> & Pick<InjectManifestOptions, 'swSrc'>;
266
+ /**
267
+ * The workbox object for `injectManifest` strategy
268
+ */
269
+ injectManifest: Partial<Omit<BuildSWOptions<T>, 'swType' | 'swDest' | 'minify' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'additionalManifestEntries' | 'additionalManifestEntriesGenerator'>>;
270
+ /**
271
+ * The workbox object for `selfDestroying` strategy.
272
+ */
273
+ selfDestroying?: SelfDestroyingOptions;
274
+ /**
275
+ * The base for your app.
276
+ *
277
+ * @default "base" options from Vite or the corresponding bundler or framework integration.
278
+ */
279
+ base?: string;
280
+ /**
281
+ * `public` resources to be added to the PWA manifest.
282
+ *
283
+ * You don't need to add `manifest` icons here, it will be auto included.
284
+ *
285
+ * The `public` directory will be resolved from Vite's `publicDir` option directory.
286
+ */
287
+ includeAssets: string | string[] | undefined;
288
+ /**
289
+ * By default, the shortcut icons listed on `manifest` option will be included
290
+ * on the service worker *precache* if present under Vite's `publicDir`
291
+ * option directory.
292
+ *
293
+ * @default true
294
+ */
295
+ includeManifestShortcutIcons: boolean;
296
+ /**
297
+ * By default, the manifest will be included on the service worker *precache* manifest.
298
+ *
299
+ * @default true
300
+ */
301
+ includeManifest: boolean;
302
+ /**
303
+ * By default, the icons listed on `manifest` option will be included
304
+ * on the service worker *precache* if present under Vite's `publicDir`
305
+ * option directory.
306
+ *
307
+ * @default true
308
+ */
309
+ includeManifestIcons: boolean;
310
+ /**
311
+ * By default, the screenshots listed on `manifest` option won't be included
312
+ * on the service worker *precache* if present under Vite's `publicDir`
313
+ * option directory.
314
+ *
315
+ * @default false
316
+ */
317
+ includeManifestScreenshots: boolean;
318
+ /**
319
+ * Disable service worker registration and generation on `build`?
320
+ *
321
+ * @default false
322
+ */
323
+ disable: boolean;
324
+ /**
325
+ * Vite PWA Integration.
326
+ */
327
+ /**
328
+ * Development options.
329
+ */
330
+ devOptions?: DevOptions;
331
+ /**
332
+ * When Vite's build folder is not the same as your base root folder, configure it here.
333
+ *
334
+ * This option will be useful for integrations like `vite-plugin-laravel` where Vite's build folder is `public/build` but Laravel's base path is `public`.
335
+ *
336
+ * This option will be used to configure the path for the `service worker`, `registerSW.js` and the web manifest assets.
337
+ *
338
+ * For example, if your base path is `/`, then, in your Laravel PWA configuration use `buildPath: '/build/'`.
339
+ *
340
+ * @default `vite.base`.
341
+ */
342
+ buildBase?: string;
343
+ /**
344
+ * PWA assets generation and injection.
345
+ *
346
+ * @experimental
347
+ */
348
+ pwaAssets?: PWAAssetsOptions;
349
+ }
350
+ type ResolvedGenerateSW<S extends Strategy, T extends SWType> = S extends 'generate-sw' ? NonNullable<Partial<BuildGenerateSWOptions<T>>> : Partial<BuildGenerateSWOptions<T>> | undefined;
351
+ type ResolvedBuildSW<S extends Strategy, T extends SWType> = S extends 'build-sw' ? NonNullable<Partial<Omit<BuildServiceWorkerOptions$1<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<LegacyBuildServiceWorkerOptions<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<BuildServiceWorkerOptions<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'>> : Partial<Omit<BuildServiceWorkerOptions$1<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<LegacyBuildServiceWorkerOptions<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'> | Partial<Omit<BuildServiceWorkerOptions<T>, 'swSrc'>> & Pick<InjectManifestOptions, 'swSrc'> | undefined;
352
+ type ResolvedInjectManifest<S extends Strategy, T extends SWType> = S extends 'generate-sw' ? NonNullable<Partial<BuildSWOptions<T>>> : Partial<BuildSWOptions<T>> | undefined;
353
+ interface ResolvedVitePWAOptions<S extends Strategy, T extends SWType> extends Required<Omit<VitePWAOptions<S, T>, 'pwaAssets' | 'strategies' | 'maximumFileSizeToCacheInBytes' | 'throwMaximumFileSizeToCacheInBytes' | 'sourcemap' | 'filename' | 'workbox' | 'generateSW' | 'buildSW' | 'injectManifest'>> {
354
+ strategy: S;
355
+ swSrc: string;
356
+ swDest: string;
357
+ /**
358
+ * The workbox object for `generateSW` strategy
359
+ */
360
+ generateSW: ResolvedGenerateSW<S, T>;
361
+ /**
362
+ * The workbox object for `buildSW` strategy
363
+ */
364
+ buildSW: ResolvedBuildSW<S, T>;
365
+ /**
366
+ * The workbox object for `injectManifest` strategy
367
+ */
368
+ injectManifest: ResolvedInjectManifest<S, T>;
369
+ pwaAssets?: ResolvedPWAAssetsOptions;
370
+ }
371
+ interface ShareTargetFiles {
372
+ name: string;
373
+ accept: string | string[];
374
+ }
375
+ /**
376
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
377
+ * @see https://w3c.github.io/web-share-target/level-2/#share_target-member
378
+ */
379
+ interface ManifestShareTarget {
380
+ action: string;
381
+ method?: 'GET' | 'POST';
382
+ enctype?: string;
383
+ params: {
384
+ title?: string;
385
+ text?: string;
386
+ url?: string;
387
+ files?: ShareTargetFiles | ShareTargetFiles[];
388
+ };
389
+ }
390
+ /**
391
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
392
+ */
393
+ type LaunchHandlerClientMode = 'auto' | 'focus-existing' | 'navigate-existing' | 'navigate-new';
394
+ type Display = 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser';
395
+ type DisplayOverride = Display | 'window-controls-overlay';
396
+ type IconPurpose = 'monochrome' | 'maskable' | 'any';
397
+ interface Nothing {}
398
+ /**
399
+ * type StringLiteralUnion<'maskable'> = 'maskable' | string
400
+ * This has auto completion whereas `'maskable' | string` doesn't
401
+ * Adapted from https://github.com/microsoft/TypeScript/issues/29729
402
+ */
403
+ type StringLiteralUnion<T extends U, U = string> = T | (U & Nothing);
404
+ type ScopeExtensionsType = 'origin';
405
+ /**
406
+ * @see https://w3c.github.io/manifest/#manifest-image-resources
407
+ */
408
+ interface IconResource {
409
+ sizes?: string;
410
+ src: string;
411
+ type?: string;
412
+ /**
413
+ * **NOTE**: string values for backward compatibility with the old type.
414
+ */
415
+ purpose?: StringLiteralUnion<IconPurpose> | IconPurpose[];
416
+ }
417
+ /**
418
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts
419
+ * @see https://w3c.github.io/manifest/#shortcuts-member
420
+ */
421
+ interface ManifestShortcut {
422
+ name: string;
423
+ short_name?: string;
424
+ url: string;
425
+ description?: string;
426
+ icons?: IconResource[];
427
+ }
428
+ /**
429
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/screenshots
430
+ */
431
+ interface ManifestScreenshot {
432
+ src: string;
433
+ sizes: string;
434
+ label?: string;
435
+ platform?: 'android' | 'ios' | 'kaios' | 'macos' | 'windows' | 'windows10x' | 'chrome_web_store' | 'play' | 'itunes' | 'microsoft-inbox' | 'microsoft-store' | string;
436
+ form_factor?: 'narrow' | 'wide';
437
+ type?: string;
438
+ }
439
+ interface ManifestOptions {
440
+ /**
441
+ * @default _npm_package_name_
442
+ */
443
+ name: string;
444
+ /**
445
+ * @default _npm_package_name_
446
+ */
447
+ short_name: string;
448
+ /**
449
+ * @default _npm_package_description_
450
+ */
451
+ description: string;
452
+ /**
453
+ * @default []
454
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/icons
455
+ * @see https://w3c.github.io/manifest/#icons-member
456
+ */
457
+ icons: IconResource[];
458
+ /**
459
+ * @default []
460
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/file_handlers
461
+ * @see https://wicg.github.io/manifest-incubations/#file_handlers-member
462
+ */
463
+ file_handlers: {
464
+ action: string;
465
+ accept: Record<string, string[]>;
466
+ }[];
467
+ /**
468
+ * @default `routerBase`
469
+ */
470
+ start_url: string;
471
+ /**
472
+ * Restricts what web pages can be viewed while the manifest is applied
473
+ */
474
+ scope: string;
475
+ /**
476
+ * A string that represents the identity for the application
477
+ */
478
+ id: string;
479
+ /**
480
+ * Defines the default orientation for all the website's top-level
481
+ */
482
+ orientation: 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary';
483
+ /**
484
+ * @default `standalone`
485
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display
486
+ * @see https://w3c.github.io/manifest/#display-member
487
+ */
488
+ display: Display;
489
+ /**
490
+ * @default []
491
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override
492
+ * @see https://wicg.github.io/manifest-incubations/#display_override-member
493
+ */
494
+ display_override: DisplayOverride[];
495
+ /**
496
+ * @default `#ffffff`
497
+ */
498
+ background_color: string;
499
+ /**
500
+ * @default `#42b883`
501
+ */
502
+ theme_color: string;
503
+ /**
504
+ * @default `ltr`
505
+ */
506
+ dir: 'ltr' | 'rtl';
507
+ /**
508
+ * @default `en`
509
+ */
510
+ lang: string;
511
+ /**
512
+ * @default A combination of `routerBase` and `options.build.publicPath`
513
+ */
514
+ publicPath: string;
515
+ /**
516
+ * @default []
517
+ */
518
+ related_applications: {
519
+ platform: string;
520
+ url: string;
521
+ id?: string;
522
+ }[];
523
+ /**
524
+ * @default false
525
+ */
526
+ prefer_related_applications: boolean;
527
+ /**
528
+ * @default []
529
+ */
530
+ protocol_handlers: {
531
+ protocol: string;
532
+ url: string;
533
+ }[];
534
+ /**
535
+ * @default []
536
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts
537
+ * @see https://w3c.github.io/manifest/#shortcuts-member
538
+ */
539
+ shortcuts: ManifestShortcut[];
540
+ /**
541
+ * @default []
542
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/screenshots
543
+ */
544
+ screenshots: ManifestScreenshot[];
545
+ /**
546
+ * @default []
547
+ */
548
+ categories: string[];
549
+ /**
550
+ * @default ''
551
+ */
552
+ iarc_rating_id: string;
553
+ /**
554
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
555
+ * @see https://w3c.github.io/web-share-target/level-2/#share_target-member
556
+ */
557
+ share_target: ManifestShareTarget;
558
+ /**
559
+ * @see https://github.com/WICG/pwa-url-handler/blob/main/handle_links/explainer.md#handle_links-manifest-member
560
+ */
561
+ handle_links?: 'auto' | 'preferred' | 'not-preferred';
562
+ /**
563
+ * @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
564
+ */
565
+ launch_handler?: {
566
+ client_mode: LaunchHandlerClientMode | LaunchHandlerClientMode[];
567
+ };
568
+ /**
569
+ * @see https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/sidebar#enable-sidebar-support-in-your-pwa
570
+ */
571
+ edge_side_panel?: {
572
+ preferred_width?: number;
573
+ };
574
+ /**
575
+ * @see https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
576
+ * @see https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/scope_extensions
577
+ * @default []
578
+ */
579
+ scope_extensions: {
580
+ origin: string;
581
+ /**
582
+ * @default 'origin'
583
+ */
584
+ type?: StringLiteralUnion<ScopeExtensionsType>;
585
+ }[];
586
+ }
587
+ interface WebManifestData {
588
+ href: string;
589
+ useCredentials: boolean;
590
+ /**
591
+ * Returns the corresponding link tag: `<link rel="manifest" href="<webManifestUrl>" />`.
592
+ */
593
+ toLinkTag: () => string;
594
+ }
595
+ interface RegisterSWData {
596
+ shouldRegisterSW: boolean;
597
+ /**
598
+ * When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
599
+ *
600
+ * @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
601
+ */
602
+ inline: boolean;
603
+ /**
604
+ * When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
605
+ */
606
+ mode: 'inline' | 'script' | 'script-defer';
607
+ /**
608
+ * The path for the inline script: will contain the service worker url.
609
+ */
610
+ inlinePath: string;
611
+ /**
612
+ * The path for the src script for `registerSW.js`.
613
+ */
614
+ registerPath: string;
615
+ /**
616
+ * The scope for the service worker: only required for `inline: true`.
617
+ */
618
+ scope: string;
619
+ /**
620
+ * The type for the service worker: only required for `inline: true`.
621
+ */
622
+ type: WorkerType;
623
+ /**
624
+ * Returns the corresponding script tag if `shouldRegisterSW` returns `true`.
625
+ */
626
+ toScriptTag: () => string | undefined;
627
+ }
628
+ /**
629
+ * Development options.
630
+ */
631
+ interface DevOptions {
632
+ /**
633
+ * Should the service worker be available on development?.
634
+ *
635
+ * @default false
636
+ */
637
+ enabled?: boolean;
638
+ /**
639
+ * When using dual service worker build, enable UI switcher?
640
+ *
641
+ * @default true
642
+ */
643
+ enableUISwitcher?: boolean;
644
+ /**
645
+ * Enable Vite PWA inspector?
646
+ *
647
+ * @default undefined
648
+ */
649
+ inspector?: 'standalone' | 'vite-devtools';
650
+ /**
651
+ * The service worker type.
652
+ *
653
+ * @default 'classic'
654
+ */
655
+ type?: WorkerType;
656
+ /**
657
+ * This option will enable you to not use the `runtimeConfig` configured on `workbox.runtimeConfig` plugin option.
658
+ *
659
+ * **WARNING**: this option will only be used when using `generateSW` strategy.
660
+ *
661
+ * @default false
662
+ */
663
+ disableRuntimeConfig?: boolean;
664
+ /**
665
+ * This option will allow you to configure the `navigateFallback` when using `registerRoute` for `offline` support:
666
+ * configure here the corresponding `url`, for example `navigateFallback: 'index.html'`.
667
+ *
668
+ * **WARNING**: this option will only be used when using `injectManifest/buildSW` strategies.
669
+ *
670
+ * @default 'index.html'
671
+ */
672
+ navigateFallback?: string;
673
+ /**
674
+ * This option will allow you to configure the `navigateFallbackAllowlist`: new option from version `v0.12.4`.
675
+ *
676
+ * Since we need at least the entry point in the service worker's precache manifest, we don't want the rest of the assets to be intercepted by the service worker.
677
+ *
678
+ * If you configure this option, the plugin will use it instead the default.
679
+ *
680
+ * **WARNING**: this option will only be used when using `generateSW` strategy.
681
+ *
682
+ * @default [/^\/$/]
683
+ */
684
+ navigateFallbackAllowlist?: RegExp[];
685
+ /**
686
+ * Where to store generated service worker in development when using `generateSW` strategy.
687
+ *
688
+ * Use it with caution, it should be used only by framework integrations.
689
+ *
690
+ * @default resolve(viteConfig.root, 'node_modules/.pwa-dev-dist')
691
+ */
692
+ resolveTempFolder?: () => string | Promise<string>;
693
+ /**
694
+ * Suppress workbox-build warnings?.
695
+ *
696
+ * **WARNING**: this option will only be used when using `generateSW/injectManifest/buildSW` strategy.
697
+ * If enabled, `globPatterns` will be changed to `[*.js]` and a new empty `suppress-warnings.js` file will be created in `dev-dist` folder.
698
+ *
699
+ * @default true
700
+ */
701
+ suppressWarnings?: boolean;
702
+ }
703
+ export { VitePWAOptions as C, StringLiteralUnion as S, WebManifestData as T, ResolvedInjectManifest as _, IconPurpose as a, ScopeExtensionsType as b, ManifestOptions as c, ManifestShortcut as d, PWAAssetsIntegrationOptions as f, ResolvedGenerateSW as g, ResolvedBuildSW as h, ExternalVitePWAOptions as i, ManifestScreenshot as l, RegisterSWData as m, Display as n, IconResource as o, PWAAssetsOptions as p, DisplayOverride as r, LaunchHandlerClientMode as s, DevOptions as t, ManifestShareTarget as u, ResolvedPWAAssetsOptions as v, VitePWAStrategy as w, ShareTargetFiles as x, ResolvedVitePWAOptions as y };