@vite-pwa/nuxt 1.0.3 โ 1.0.5
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.
- package/LICENSE +21 -21
- package/README.md +113 -113
- package/configuration.d.ts +6 -6
- package/dist/chunks/pwa-icons.mjs +1 -1
- package/dist/module.json +2 -3
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/PwaAppleImage.vue +12 -12
- package/dist/runtime/components/PwaAppleImage.vue.d.ts +2 -2
- package/dist/runtime/components/PwaAppleSplashScreenImage.vue +12 -12
- package/dist/runtime/components/PwaAppleSplashScreenImage.vue.d.ts +2 -2
- package/dist/runtime/components/PwaFaviconImage.vue +12 -12
- package/dist/runtime/components/PwaFaviconImage.vue.d.ts +2 -2
- package/dist/runtime/components/PwaMaskableImage.vue +12 -12
- package/dist/runtime/components/PwaMaskableImage.vue.d.ts +2 -2
- package/dist/runtime/components/PwaTransparentImage.vue +12 -12
- package/dist/runtime/components/PwaTransparentImage.vue.d.ts +2 -2
- package/dist/runtime/plugins/types.d.ts +149 -65
- package/dist/shared/{nuxt.73bdad2b.mjs โ nuxt.2a6b4a95.mjs} +4 -5
- package/package.json +25 -27
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
<p align='center'>
|
|
2
|
-
<img src='https://raw.githubusercontent.com/vite-pwa/nuxt/main/hero.png' alt="@vite-pwa/nuxt - Zero-config PWA for Nuxt 3"><br>
|
|
3
|
-
Zero-config PWA Plugin for Nuxt 3
|
|
4
|
-
</p>
|
|
5
|
-
|
|
6
|
-
<p align='center'>
|
|
7
|
-
<a href='https://www.npmjs.com/package/@vite-pwa/nuxt' target="__blank">
|
|
8
|
-
<img src='https://img.shields.io/npm/v/@vite-pwa/nuxt?color=33A6B8&label=' alt="NPM version">
|
|
9
|
-
</a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@vite-pwa/nuxt" target="__blank">
|
|
11
|
-
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vite-pwa/nuxt?color=476582&label=">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://vite-pwa-org.netlify.app/frameworks/nuxt" target="__blank">
|
|
14
|
-
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
15
|
-
</a>
|
|
16
|
-
<br>
|
|
17
|
-
<a href="https://github.com/vite-pwa/nuxt" target="__blank">
|
|
18
|
-
<img alt="GitHub stars" src="https://img.shields.io/github/stars/vite-pwa/nuxt?style=social">
|
|
19
|
-
</a>
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
<br>
|
|
23
|
-
|
|
24
|
-
<p align="center">
|
|
25
|
-
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
|
26
|
-
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
|
27
|
-
</a>
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
## ๐ Features
|
|
31
|
-
|
|
32
|
-
- ๐ [**Documentation & guides**](https://vite-pwa-org.netlify.app/)
|
|
33
|
-
- ๐ **Zero-Config**: sensible built-in default configs for common use cases
|
|
34
|
-
- ๐ฉ **Extensible**: expose the full ability to customize the behavior of the plugin
|
|
35
|
-
- ๐ฆพ **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
36
|
-
- ๐ **Offline Support**: generate service worker with offline support (via Workbox)
|
|
37
|
-
- โก **Fully tree shakable**: auto inject Web App Manifest
|
|
38
|
-
- ๐ฌ **Prompt for new content**: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
|
|
39
|
-
- โ๏ธ **Stale-while-revalidate**: automatic reload when new content is available
|
|
40
|
-
- โจ **Static assets handling**: configure static assets for offline support
|
|
41
|
-
- ๐ **Development Support**: debug your custom service worker logic as you develop your application
|
|
42
|
-
- ๐ ๏ธ **Versatile**: integration with meta frameworks: [รฎles](https://github.com/ElMassimo/iles), [SvelteKit](https://github.com/sveltejs/kit), [VitePress](https://github.com/vuejs/vitepress), [Astro](https://github.com/withastro/astro), [Nuxt 3](https://github.com/nuxt/nuxt) and [Remix](https://github.com/remix-run/remix)
|
|
43
|
-
- ๐ฅ **PWA Assets Generator**: generate all the PWA assets from a single command and a single source image
|
|
44
|
-
- ๐ **PWA Assets Integration**: serving, generating and injecting PWA Assets on the fly in your application
|
|
45
|
-
|
|
46
|
-
## ๐ฆ Install
|
|
47
|
-
|
|
48
|
-
> From v0.4.0, `@vite-pwa/nuxt` requires Vite 5 and Nuxt 3.9.0+.
|
|
49
|
-
|
|
50
|
-
> For older versions, `@vite-pwa/nuxt` requires Vite 3.2.0+ and Nuxt 3.0.0+.
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
npx nuxi@latest module add @vite-pwa/nuxt
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## ๐ฆ Usage
|
|
57
|
-
|
|
58
|
-
Add `@vite-pwa/nuxt` module to `nuxt.config.ts` and configure it:
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
// nuxt.config.ts
|
|
62
|
-
import { defineNuxtConfig } from 'nuxt/config'
|
|
63
|
-
|
|
64
|
-
export default defineNuxtConfig({
|
|
65
|
-
modules: [
|
|
66
|
-
'@vite-pwa/nuxt'
|
|
67
|
-
],
|
|
68
|
-
pwa: {
|
|
69
|
-
/* PWA options */
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Read the [๐ documentation](https://vite-pwa-org.netlify.app/frameworks/nuxt) for a complete guide on how to configure and use
|
|
75
|
-
this plugin.
|
|
76
|
-
|
|
77
|
-
## โก๏ธ Examples
|
|
78
|
-
|
|
79
|
-
You need to stop the dev server once started and then to see the PWA in action run:
|
|
80
|
-
- `nr dev:preview:build`: Nuxt build command + start server
|
|
81
|
-
- `nr dev:preview:generate`: Nuxt generate command + start server
|
|
82
|
-
|
|
83
|
-
<table>
|
|
84
|
-
<thead>
|
|
85
|
-
<tr>
|
|
86
|
-
<th>Example</th>
|
|
87
|
-
<th>Source</th>
|
|
88
|
-
<th>Playground</th>
|
|
89
|
-
</tr>
|
|
90
|
-
</thead>
|
|
91
|
-
<tbody>
|
|
92
|
-
<tr>
|
|
93
|
-
<td><code>Auto Update PWA</code></td>
|
|
94
|
-
<td><a href="https://github.com/vite-pwa/nuxt/tree/main/playground">GitHub</a></td>
|
|
95
|
-
<td>
|
|
96
|
-
<a href="https://stackblitz.com/fork/github/vite-pwa/nuxt" target="_blank" rel="noopener noreferrer">
|
|
97
|
-
<img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" alt="Open in StackBlitz" width="162" height="32">
|
|
98
|
-
</a>
|
|
99
|
-
</td>
|
|
100
|
-
</tr>
|
|
101
|
-
</tbody>
|
|
102
|
-
</table>
|
|
103
|
-
|
|
104
|
-
## ๐ Full config
|
|
105
|
-
|
|
106
|
-
Check out the type declaration [src/types.ts](./src/types.ts) and the following links for more details.
|
|
107
|
-
|
|
108
|
-
- [Web app manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest)
|
|
109
|
-
- [Workbox](https://developers.google.com/web/tools/workbox)
|
|
110
|
-
|
|
111
|
-
## ๐ License
|
|
112
|
-
|
|
113
|
-
[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
|
|
1
|
+
<p align='center'>
|
|
2
|
+
<img src='https://raw.githubusercontent.com/vite-pwa/nuxt/main/hero.png' alt="@vite-pwa/nuxt - Zero-config PWA for Nuxt 3"><br>
|
|
3
|
+
Zero-config PWA Plugin for Nuxt 3
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align='center'>
|
|
7
|
+
<a href='https://www.npmjs.com/package/@vite-pwa/nuxt' target="__blank">
|
|
8
|
+
<img src='https://img.shields.io/npm/v/@vite-pwa/nuxt?color=33A6B8&label=' alt="NPM version">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@vite-pwa/nuxt" target="__blank">
|
|
11
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vite-pwa/nuxt?color=476582&label=">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://vite-pwa-org.netlify.app/frameworks/nuxt" target="__blank">
|
|
14
|
+
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
15
|
+
</a>
|
|
16
|
+
<br>
|
|
17
|
+
<a href="https://github.com/vite-pwa/nuxt" target="__blank">
|
|
18
|
+
<img alt="GitHub stars" src="https://img.shields.io/github/stars/vite-pwa/nuxt?style=social">
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<br>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
|
26
|
+
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
|
27
|
+
</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
## ๐ Features
|
|
31
|
+
|
|
32
|
+
- ๐ [**Documentation & guides**](https://vite-pwa-org.netlify.app/)
|
|
33
|
+
- ๐ **Zero-Config**: sensible built-in default configs for common use cases
|
|
34
|
+
- ๐ฉ **Extensible**: expose the full ability to customize the behavior of the plugin
|
|
35
|
+
- ๐ฆพ **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
36
|
+
- ๐ **Offline Support**: generate service worker with offline support (via Workbox)
|
|
37
|
+
- โก **Fully tree shakable**: auto inject Web App Manifest
|
|
38
|
+
- ๐ฌ **Prompt for new content**: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
|
|
39
|
+
- โ๏ธ **Stale-while-revalidate**: automatic reload when new content is available
|
|
40
|
+
- โจ **Static assets handling**: configure static assets for offline support
|
|
41
|
+
- ๐ **Development Support**: debug your custom service worker logic as you develop your application
|
|
42
|
+
- ๐ ๏ธ **Versatile**: integration with meta frameworks: [รฎles](https://github.com/ElMassimo/iles), [SvelteKit](https://github.com/sveltejs/kit), [VitePress](https://github.com/vuejs/vitepress), [Astro](https://github.com/withastro/astro), [Nuxt 3](https://github.com/nuxt/nuxt) and [Remix](https://github.com/remix-run/remix)
|
|
43
|
+
- ๐ฅ **PWA Assets Generator**: generate all the PWA assets from a single command and a single source image
|
|
44
|
+
- ๐ **PWA Assets Integration**: serving, generating and injecting PWA Assets on the fly in your application
|
|
45
|
+
|
|
46
|
+
## ๐ฆ Install
|
|
47
|
+
|
|
48
|
+
> From v0.4.0, `@vite-pwa/nuxt` requires Vite 5 and Nuxt 3.9.0+.
|
|
49
|
+
|
|
50
|
+
> For older versions, `@vite-pwa/nuxt` requires Vite 3.2.0+ and Nuxt 3.0.0+.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx nuxi@latest module add @vite-pwa/nuxt
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## ๐ฆ Usage
|
|
57
|
+
|
|
58
|
+
Add `@vite-pwa/nuxt` module to `nuxt.config.ts` and configure it:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// nuxt.config.ts
|
|
62
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
63
|
+
|
|
64
|
+
export default defineNuxtConfig({
|
|
65
|
+
modules: [
|
|
66
|
+
'@vite-pwa/nuxt'
|
|
67
|
+
],
|
|
68
|
+
pwa: {
|
|
69
|
+
/* PWA options */
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Read the [๐ documentation](https://vite-pwa-org.netlify.app/frameworks/nuxt) for a complete guide on how to configure and use
|
|
75
|
+
this plugin.
|
|
76
|
+
|
|
77
|
+
## โก๏ธ Examples
|
|
78
|
+
|
|
79
|
+
You need to stop the dev server once started and then to see the PWA in action run:
|
|
80
|
+
- `nr dev:preview:build`: Nuxt build command + start server
|
|
81
|
+
- `nr dev:preview:generate`: Nuxt generate command + start server
|
|
82
|
+
|
|
83
|
+
<table>
|
|
84
|
+
<thead>
|
|
85
|
+
<tr>
|
|
86
|
+
<th>Example</th>
|
|
87
|
+
<th>Source</th>
|
|
88
|
+
<th>Playground</th>
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody>
|
|
92
|
+
<tr>
|
|
93
|
+
<td><code>Auto Update PWA</code></td>
|
|
94
|
+
<td><a href="https://github.com/vite-pwa/nuxt/tree/main/playground">GitHub</a></td>
|
|
95
|
+
<td>
|
|
96
|
+
<a href="https://stackblitz.com/fork/github/vite-pwa/nuxt" target="_blank" rel="noopener noreferrer">
|
|
97
|
+
<img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" alt="Open in StackBlitz" width="162" height="32">
|
|
98
|
+
</a>
|
|
99
|
+
</td>
|
|
100
|
+
</tr>
|
|
101
|
+
</tbody>
|
|
102
|
+
</table>
|
|
103
|
+
|
|
104
|
+
## ๐ Full config
|
|
105
|
+
|
|
106
|
+
Check out the type declaration [src/types.ts](./src/types.ts) and the following links for more details.
|
|
107
|
+
|
|
108
|
+
- [Web app manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest)
|
|
109
|
+
- [Workbox](https://developers.google.com/web/tools/workbox)
|
|
110
|
+
|
|
111
|
+
## ๐ License
|
|
112
|
+
|
|
113
|
+
[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
|
package/configuration.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare module 'virtual:nuxt-pwa-configuration' {
|
|
2
|
-
export const enabled: boolean
|
|
3
|
-
export const display: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser'
|
|
4
|
-
export const installPrompt: string | undefined
|
|
5
|
-
export const periodicSyncForUpdates: number
|
|
6
|
-
}
|
|
1
|
+
declare module 'virtual:nuxt-pwa-configuration' {
|
|
2
|
+
export const enabled: boolean
|
|
3
|
+
export const display: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser'
|
|
4
|
+
export const installPrompt: string | undefined
|
|
5
|
+
export const periodicSyncForUpdates: number
|
|
6
|
+
}
|
|
@@ -3,7 +3,7 @@ import { resolve, relative, basename } from 'node:path';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { instructions } from '@vite-pwa/assets-generator/api/instructions';
|
|
5
5
|
import { loadConfig } from '@vite-pwa/assets-generator/config';
|
|
6
|
-
import { p as pwaIcons, g as generatePwaImageType } from '../shared/nuxt.
|
|
6
|
+
import { p as pwaIcons, g as generatePwaImageType } from '../shared/nuxt.2a6b4a95.mjs';
|
|
7
7
|
import '@nuxt/kit';
|
|
8
8
|
import 'vite-plugin-pwa';
|
|
9
9
|
import 'node:crypto';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PwaAppleImageProps } from '#build/pwa-icons/PwaAppleImage'
|
|
3
|
-
import { useApplePwaIcon } from '#pwa'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<PwaAppleImageProps>()
|
|
6
|
-
|
|
7
|
-
const { icon } = useApplePwaIcon(props)
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<img v-if="icon" v-bind="icon">
|
|
12
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PwaAppleImageProps } from '#build/pwa-icons/PwaAppleImage'
|
|
3
|
+
import { useApplePwaIcon } from '#pwa'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PwaAppleImageProps>()
|
|
6
|
+
|
|
7
|
+
const { icon } = useApplePwaIcon(props)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<img v-if="icon" v-bind="icon">
|
|
12
|
+
</template>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const _default: typeof import('#build/pwa-icons/PwaAppleImage')['default']
|
|
2
|
-
export default _default
|
|
1
|
+
const _default: typeof import('#build/pwa-icons/PwaAppleImage')['default']
|
|
2
|
+
export default _default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PwaAppleSplashScreenImageProps } from '#build/pwa-icons/PwaAppleSplashScreenImage'
|
|
3
|
-
import { useAppleSplashScreenPwaIcon } from '#pwa'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<PwaAppleSplashScreenImageProps>()
|
|
6
|
-
|
|
7
|
-
const { icon } = useAppleSplashScreenPwaIcon(props)
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<img v-if="icon" v-bind="icon">
|
|
12
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PwaAppleSplashScreenImageProps } from '#build/pwa-icons/PwaAppleSplashScreenImage'
|
|
3
|
+
import { useAppleSplashScreenPwaIcon } from '#pwa'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PwaAppleSplashScreenImageProps>()
|
|
6
|
+
|
|
7
|
+
const { icon } = useAppleSplashScreenPwaIcon(props)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<img v-if="icon" v-bind="icon">
|
|
12
|
+
</template>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const _default: typeof import('#build/pwa-icons/PwaAppleSplashScreenImage')['default']
|
|
2
|
-
export default _default
|
|
1
|
+
const _default: typeof import('#build/pwa-icons/PwaAppleSplashScreenImage')['default']
|
|
2
|
+
export default _default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PwaFaviconImageProps } from '#build/pwa-icons/PwaFaviconImage'
|
|
3
|
-
import { useFaviconPwaIcon } from '#pwa'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<PwaFaviconImageProps>()
|
|
6
|
-
|
|
7
|
-
const { icon } = useFaviconPwaIcon(props)
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<img v-if="icon" v-bind="icon">
|
|
12
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PwaFaviconImageProps } from '#build/pwa-icons/PwaFaviconImage'
|
|
3
|
+
import { useFaviconPwaIcon } from '#pwa'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PwaFaviconImageProps>()
|
|
6
|
+
|
|
7
|
+
const { icon } = useFaviconPwaIcon(props)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<img v-if="icon" v-bind="icon">
|
|
12
|
+
</template>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const _default: typeof import('#build/pwa-icons/PwaFaviconImage')['default']
|
|
2
|
-
export default _default
|
|
1
|
+
const _default: typeof import('#build/pwa-icons/PwaFaviconImage')['default']
|
|
2
|
+
export default _default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PwaMaskableImageProps } from '#build/pwa-icons/PwaMaskableImage'
|
|
3
|
-
import { useMaskablePwaIcon } from '#pwa'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<PwaMaskableImageProps>()
|
|
6
|
-
|
|
7
|
-
const { icon } = useMaskablePwaIcon(props)
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<img v-if="icon" v-bind="icon">
|
|
12
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PwaMaskableImageProps } from '#build/pwa-icons/PwaMaskableImage'
|
|
3
|
+
import { useMaskablePwaIcon } from '#pwa'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PwaMaskableImageProps>()
|
|
6
|
+
|
|
7
|
+
const { icon } = useMaskablePwaIcon(props)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<img v-if="icon" v-bind="icon">
|
|
12
|
+
</template>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const _default: typeof import('#build/pwa-icons/PwaMaskableImage')['default']
|
|
2
|
-
export default _default
|
|
1
|
+
const _default: typeof import('#build/pwa-icons/PwaMaskableImage')['default']
|
|
2
|
+
export default _default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PwaTransparentImageProps } from '#build/pwa-icons/PwaTransparentImage'
|
|
3
|
-
import { useTransparentPwaIcon } from '#pwa'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<PwaTransparentImageProps>()
|
|
6
|
-
|
|
7
|
-
const { icon } = useTransparentPwaIcon(props)
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<img v-if="icon" v-bind="icon">
|
|
12
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PwaTransparentImageProps } from '#build/pwa-icons/PwaTransparentImage'
|
|
3
|
+
import { useTransparentPwaIcon } from '#pwa'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PwaTransparentImageProps>()
|
|
6
|
+
|
|
7
|
+
const { icon } = useTransparentPwaIcon(props)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<img v-if="icon" v-bind="icon">
|
|
12
|
+
</template>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const _default: typeof import('#build/pwa-icons/PwaTransparentImage')['default']
|
|
2
|
-
export default _default
|
|
1
|
+
const _default: typeof import('#build/pwa-icons/PwaTransparentImage')['default']
|
|
2
|
+
export default _default
|
|
@@ -1,65 +1,149 @@
|
|
|
1
|
-
import type { Ref } from 'vue'
|
|
2
|
-
import type { UnwrapNestedRefs } from 'vue'
|
|
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
|
-
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
import type { UnwrapNestedRefs } from 'vue'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Result of the native PWA installation prompt.
|
|
6
|
+
*/
|
|
7
|
+
export interface UserChoice {
|
|
8
|
+
/**
|
|
9
|
+
* The user's selection on the install prompt.
|
|
10
|
+
*/
|
|
11
|
+
outcome: 'accepted' | 'dismissed'
|
|
12
|
+
/**
|
|
13
|
+
* Platform identifier provided by the browser for where the prompt was shown
|
|
14
|
+
* (for example, 'web' or a store-specific value). The exact values are
|
|
15
|
+
* browser-dependent and not standardized.
|
|
16
|
+
*/
|
|
17
|
+
platform: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Browser event fired before showing the native PWA install prompt.
|
|
22
|
+
*
|
|
23
|
+
* This event allows delaying the native prompt and showing a custom UI first.
|
|
24
|
+
*/
|
|
25
|
+
export type BeforeInstallPromptEvent = Event & {
|
|
26
|
+
/**
|
|
27
|
+
* Triggers the browser's native install prompt.
|
|
28
|
+
*/
|
|
29
|
+
prompt: () => void
|
|
30
|
+
/**
|
|
31
|
+
* Resolves with the user's selection once they interact with the prompt.
|
|
32
|
+
*/
|
|
33
|
+
userChoice: Promise<UserChoice>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Reactive PWA state and helpers injected into Nuxt as `$pwa`.
|
|
38
|
+
*/
|
|
39
|
+
export interface PwaInjection {
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `isPWAInstalled` instead. Legacy boolean computed from
|
|
42
|
+
* browser heuristics to detect if the app is installed.
|
|
43
|
+
*/
|
|
44
|
+
isInstalled: boolean
|
|
45
|
+
/**
|
|
46
|
+
* Whether the app is currently installed as a PWA.
|
|
47
|
+
* This value updates as installation state changes (e.g. display-mode changes).
|
|
48
|
+
*/
|
|
49
|
+
isPWAInstalled: Ref<boolean>
|
|
50
|
+
/**
|
|
51
|
+
* When `true`, your UI should show a custom install prompt. This flag is set
|
|
52
|
+
* after the `beforeinstallprompt` event is captured and cleared when the user
|
|
53
|
+
* proceeds or cancels.
|
|
54
|
+
*/
|
|
55
|
+
showInstallPrompt: Ref<boolean>
|
|
56
|
+
/**
|
|
57
|
+
* Cancels the custom install flow and hides future prompts by setting an
|
|
58
|
+
* opt-out flag (stored in `localStorage` when configured via `installPrompt`).
|
|
59
|
+
*/
|
|
60
|
+
cancelInstall: () => void
|
|
61
|
+
/**
|
|
62
|
+
* Shows the native install prompt if available and returns the user's choice.
|
|
63
|
+
* Returns `undefined` when the prompt is not available or not currently shown.
|
|
64
|
+
*/
|
|
65
|
+
install: () => Promise<UserChoice | undefined>
|
|
66
|
+
/**
|
|
67
|
+
* Whether the service worker has reached the `activated` state.
|
|
68
|
+
*/
|
|
69
|
+
swActivated: Ref<boolean>
|
|
70
|
+
/**
|
|
71
|
+
* Indicates that registering the service worker failed.
|
|
72
|
+
*/
|
|
73
|
+
registrationError: Ref<boolean>
|
|
74
|
+
/**
|
|
75
|
+
* Becomes `true` when the app is ready to work offline (precache completed).
|
|
76
|
+
* This flag is activated only once, when the service worker is registered and activated for first time.
|
|
77
|
+
*/
|
|
78
|
+
offlineReady: Ref<boolean>
|
|
79
|
+
/**
|
|
80
|
+
* Becomes `true` when a new service worker is waiting to activate and a
|
|
81
|
+
* refresh is recommended to apply updates.
|
|
82
|
+
*/
|
|
83
|
+
needRefresh: Ref<boolean>
|
|
84
|
+
/**
|
|
85
|
+
* Applies the waiting service worker. When `reloadPage` is `true`, reloads
|
|
86
|
+
* the page after activating the new service worker.
|
|
87
|
+
*/
|
|
88
|
+
updateServiceWorker: (reloadPage?: boolean | undefined) => Promise<void>
|
|
89
|
+
/**
|
|
90
|
+
* Dismisses update/install notifications by resetting `offlineReady` and
|
|
91
|
+
* `needRefresh` to `false`.
|
|
92
|
+
*/
|
|
93
|
+
cancelPrompt: () => Promise<void>
|
|
94
|
+
/**
|
|
95
|
+
* From version 0.10.8 it is deprecated, use a plugin instead with the new Nuxt Runtime Client Hooks:
|
|
96
|
+
* ```ts
|
|
97
|
+
* // plugins/pwa.client.ts
|
|
98
|
+
* export default defineNuxtPlugin((nuxtApp) => {
|
|
99
|
+
* nuxtApp.hook('service-worker:registered', ({ url, registration }) => {
|
|
100
|
+
* // eslint-disable-next-line no-console
|
|
101
|
+
* console.log(`service worker registered at ${url}`, registration)
|
|
102
|
+
* })
|
|
103
|
+
* nuxtApp.hook('service-worker:registration-failed', ({ error }) => {
|
|
104
|
+
* console.error(`service worker registration failed`, error)
|
|
105
|
+
* })
|
|
106
|
+
* nuxtApp.hook('service-worker:activated', ({ url, registration }) => {
|
|
107
|
+
* // eslint-disable-next-line no-console
|
|
108
|
+
* console.log(`service worker activated at ${url}`, registration)
|
|
109
|
+
* })
|
|
110
|
+
* })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @deprecated Directly access the registration in your own plugin via the
|
|
114
|
+
* runtime client hooks instead.
|
|
115
|
+
*/
|
|
116
|
+
getSWRegistration: () => ServiceWorkerRegistration | undefined
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare module '#app' {
|
|
120
|
+
interface NuxtApp {
|
|
121
|
+
/**
|
|
122
|
+
* Reactive PWA state and controls provided by @vite-pwa/nuxt.
|
|
123
|
+
*
|
|
124
|
+
* Example:
|
|
125
|
+
* ```ts
|
|
126
|
+
* const { $pwa } = useNuxtApp()
|
|
127
|
+
* if ($pwa?.needRefresh) await $pwa.updateServiceWorker(true)
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
$pwa?: UnwrapNestedRefs<PwaInjection>
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare module 'vue' {
|
|
135
|
+
interface ComponentCustomProperties {
|
|
136
|
+
/**
|
|
137
|
+
* Reactive PWA state and controls provided by @vite-pwa/nuxt.
|
|
138
|
+
*
|
|
139
|
+
* Example:
|
|
140
|
+
* ```ts
|
|
141
|
+
* const { $pwa } = useNuxtApp()
|
|
142
|
+
* if ($pwa?.needRefresh) await $pwa.updateServiceWorker(true)
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
$pwa?: UnwrapNestedRefs<PwaInjection>
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export {}
|
|
@@ -6,7 +6,7 @@ import { createHash } from 'node:crypto';
|
|
|
6
6
|
import { createReadStream } from 'node:fs';
|
|
7
7
|
import { resolve } from 'pathe';
|
|
8
8
|
|
|
9
|
-
const version = "1.0.
|
|
9
|
+
const version = "1.0.5";
|
|
10
10
|
|
|
11
11
|
function configurePWAOptions(nuxt3_8, options, nuxt, nitroConfig) {
|
|
12
12
|
if (!options.outDir) {
|
|
@@ -43,7 +43,7 @@ function configurePWAOptions(nuxt3_8, options, nuxt, nitroConfig) {
|
|
|
43
43
|
if (!("dontCacheBustURLsMatching" in config))
|
|
44
44
|
config.dontCacheBustURLsMatching = new RegExp(buildAssetsDir);
|
|
45
45
|
if (nuxt.options.experimental.payloadExtraction) {
|
|
46
|
-
const enableGlobPatterns = nuxt.options._generate || (!!nitroConfig.prerender?.routes?.length || Object.values(nitroConfig.routeRules ?? {}).some((r) => r.prerender));
|
|
46
|
+
const enableGlobPatterns = nuxt.options.nitro.static || nuxt.options._generate || (!!nitroConfig.prerender?.routes?.length || Object.values(nitroConfig.routeRules ?? {}).some((r) => r.prerender));
|
|
47
47
|
if (enableGlobPatterns) {
|
|
48
48
|
config.globPatterns = config.globPatterns ?? [];
|
|
49
49
|
config.globPatterns.push("**/_payload.json");
|
|
@@ -614,7 +614,7 @@ export const periodicSyncForUpdates = ${typeof client.periodicSyncForUpdates ===
|
|
|
614
614
|
);
|
|
615
615
|
});
|
|
616
616
|
});
|
|
617
|
-
if (nuxt.options._generate) {
|
|
617
|
+
if (nuxt.options.nitro.static || nuxt.options._generate) {
|
|
618
618
|
nuxt.hook("close", async () => {
|
|
619
619
|
await regeneratePWA(
|
|
620
620
|
options.outDir,
|
|
@@ -632,8 +632,7 @@ const module = defineNuxtModule({
|
|
|
632
632
|
name: "pwa",
|
|
633
633
|
configKey: "pwa",
|
|
634
634
|
compatibility: {
|
|
635
|
-
nuxt: ">=3.6.5"
|
|
636
|
-
bridge: false
|
|
635
|
+
nuxt: ">=3.6.5"
|
|
637
636
|
},
|
|
638
637
|
version
|
|
639
638
|
},
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-pwa/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"packageManager": "pnpm@10.11.0",
|
|
4
|
+
"version": "1.0.5",
|
|
6
5
|
"description": "Zero-config PWA for Nuxt 3",
|
|
7
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -37,29 +36,6 @@
|
|
|
37
36
|
"*.d.ts",
|
|
38
37
|
"dist"
|
|
39
38
|
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"prepack": "nuxt-module-build prepare && nuxt-module-build build",
|
|
42
|
-
"dev": "nuxi dev playground",
|
|
43
|
-
"dev:generate": "nuxi generate playground",
|
|
44
|
-
"dev:generate:netlify": "NITRO_PRESET=netlify nuxi generate playground",
|
|
45
|
-
"dev:generate:vercel": "NITRO_PRESET=vercel nuxi generate playground",
|
|
46
|
-
"dev:build": "nuxi build playground",
|
|
47
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
48
|
-
"dev:preview:build": "nr dev:build && node playground/.output/server/index.mjs",
|
|
49
|
-
"dev:preview:generate": "nr dev:generate && serve playground/dist",
|
|
50
|
-
"release": "bumpp && npm publish",
|
|
51
|
-
"lint": "eslint .",
|
|
52
|
-
"lint:fix": "nr lint --fix",
|
|
53
|
-
"test:build:serve": "PORT=4173 node playground/.output/server/index.mjs",
|
|
54
|
-
"test:generate:serve": "PORT=4173 serve playground/dist",
|
|
55
|
-
"test:build": "nr dev:build && NUXT_ECOSYSTEM_CI=true TEST_BUILD=true vitest run && TEST_BUILD=true playwright test",
|
|
56
|
-
"test:generate": "nr dev:generate && NUXT_ECOSYSTEM_CI=true vitest run && playwright test",
|
|
57
|
-
"test:build:local": "nr dev:build && TEST_BUILD=true vitest run && TEST_BUILD=true playwright test",
|
|
58
|
-
"test:generate:local": "nr dev:generate && vitest run && playwright test",
|
|
59
|
-
"test:local": "nr test:build:local && nr test:generate:local",
|
|
60
|
-
"test": "nr test:build && nr test:generate",
|
|
61
|
-
"test:with-build": "nr dev:prepare && nr prepack && nr test"
|
|
62
|
-
},
|
|
63
39
|
"peerDependencies": {
|
|
64
40
|
"@vite-pwa/assets-generator": "^1.0.0"
|
|
65
41
|
},
|
|
@@ -72,7 +48,7 @@
|
|
|
72
48
|
"@nuxt/kit": "^3.9.0",
|
|
73
49
|
"pathe": "^1.1.1",
|
|
74
50
|
"ufo": "^1.3.2",
|
|
75
|
-
"vite-plugin-pwa": "^1.
|
|
51
|
+
"vite-plugin-pwa": "^1.1.0"
|
|
76
52
|
},
|
|
77
53
|
"devDependencies": {
|
|
78
54
|
"@antfu/eslint-config": "^4.11.0",
|
|
@@ -112,5 +88,27 @@
|
|
|
112
88
|
},
|
|
113
89
|
"stackblitz": {
|
|
114
90
|
"startCommand": "nr prepack && nr dev:prepare && nr dev"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"dev": "nuxi dev playground",
|
|
94
|
+
"dev:generate": "nuxi generate playground",
|
|
95
|
+
"dev:generate:netlify": "NITRO_PRESET=netlify nuxi generate playground",
|
|
96
|
+
"dev:generate:vercel": "NITRO_PRESET=vercel nuxi generate playground",
|
|
97
|
+
"dev:build": "nuxi build playground",
|
|
98
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
99
|
+
"dev:preview:build": "nr dev:build && node playground/.output/server/index.mjs",
|
|
100
|
+
"dev:preview:generate": "nr dev:generate && serve playground/dist",
|
|
101
|
+
"release": "bumpp",
|
|
102
|
+
"lint": "eslint .",
|
|
103
|
+
"lint:fix": "nr lint --fix",
|
|
104
|
+
"test:build:serve": "PORT=4173 node playground/.output/server/index.mjs",
|
|
105
|
+
"test:generate:serve": "PORT=4173 serve playground/dist",
|
|
106
|
+
"test:build": "nr dev:build && NUXT_ECOSYSTEM_CI=true TEST_BUILD=true vitest run && TEST_BUILD=true playwright test",
|
|
107
|
+
"test:generate": "nr dev:generate && NUXT_ECOSYSTEM_CI=true vitest run && playwright test",
|
|
108
|
+
"test:build:local": "nr dev:build && TEST_BUILD=true vitest run && TEST_BUILD=true playwright test",
|
|
109
|
+
"test:generate:local": "nr dev:generate && vitest run && playwright test",
|
|
110
|
+
"test:local": "nr test:build:local && nr test:generate:local",
|
|
111
|
+
"test": "nr test:build && nr test:generate",
|
|
112
|
+
"test:with-build": "nr dev:prepare && nr prepack && nr test"
|
|
115
113
|
}
|
|
116
|
-
}
|
|
114
|
+
}
|