@vite-pwa/nuxt 1.1.1 → 2.0.1
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/README.md +28 -59
- package/config/index.d.mts +1 -0
- package/config/index.mjs +3 -0
- package/configuration.d.ts +3 -0
- package/dist/chunks/create-nuxt-pwa-context.mjs +27 -0
- package/dist/chunks/prepare-module.mjs +871 -0
- package/dist/chunks/prepare-pwa-icons.mjs +161 -0
- package/dist/module.d.mts +42 -89
- package/dist/module.json +4 -4
- package/dist/module.mjs +40 -8
- package/dist/runtime/components/NuxtPwaAssets.d.ts +1 -1
- package/dist/runtime/components/NuxtPwaAssets.js +8 -4
- package/dist/runtime/components/{VitePwaManifest.d.ts → NuxtPwaManifest.d.ts} +1 -1
- package/dist/runtime/components/{VitePwaManifest.js → NuxtPwaManifest.js} +2 -2
- package/dist/runtime/{composables/index.d.ts → composables.d.ts} +12 -28
- package/dist/runtime/{composables/index.js → composables.js} +1 -11
- package/dist/runtime/plugins/pwa-install.client.d.ts +6 -0
- package/dist/runtime/plugins/pwa-install.client.js +70 -0
- package/dist/runtime/plugins/pwa.client.d.ts +1 -1
- package/dist/runtime/plugins/pwa.client.js +90 -77
- package/dist/runtime/plugins/types.d.ts +70 -129
- package/dist/runtime/plugins/types.js +0 -0
- package/dist/types.d.mts +5 -5
- package/package.json +40 -59
- package/dist/chunks/dev.mjs +0 -37
- package/dist/chunks/pwa-icons.mjs +0 -155
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -110
- package/dist/runtime/components/PwaAppleImage.vue +0 -12
- package/dist/runtime/components/PwaAppleImage.vue.d.ts +0 -2
- package/dist/runtime/components/PwaAppleSplashScreenImage.vue +0 -12
- package/dist/runtime/components/PwaAppleSplashScreenImage.vue.d.ts +0 -2
- package/dist/runtime/components/PwaFaviconImage.vue +0 -12
- package/dist/runtime/components/PwaFaviconImage.vue.d.ts +0 -2
- package/dist/runtime/components/PwaMaskableImage.vue +0 -12
- package/dist/runtime/components/PwaMaskableImage.vue.d.ts +0 -2
- package/dist/runtime/components/PwaTransparentImage.vue +0 -12
- package/dist/runtime/components/PwaTransparentImage.vue.d.ts +0 -2
- package/dist/runtime/components/nuxt4/PwaAppleImage.d.ts +0 -4
- package/dist/runtime/components/nuxt4/PwaAppleImage.js +0 -15
- package/dist/runtime/components/nuxt4/PwaAppleSplashScreenImage.d.ts +0 -4
- package/dist/runtime/components/nuxt4/PwaAppleSplashScreenImage.js +0 -15
- package/dist/runtime/components/nuxt4/PwaFaviconImage.d.ts +0 -4
- package/dist/runtime/components/nuxt4/PwaFaviconImage.js +0 -15
- package/dist/runtime/components/nuxt4/PwaMaskableImage.d.ts +0 -4
- package/dist/runtime/components/nuxt4/PwaMaskableImage.js +0 -15
- package/dist/runtime/components/nuxt4/PwaTransparentImage.d.ts +0 -4
- package/dist/runtime/components/nuxt4/PwaTransparentImage.js +0 -15
- package/dist/shared/nuxt.9518178d.mjs +0 -734
- package/dist/types.d.ts +0 -15
package/README.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
<p align='center'>
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vite-pwa/.github/main/nuxt-module-hero-dark.svg" />
|
|
4
|
+
<img src="https://raw.githubusercontent.com/vite-pwa/.github/main/nuxt-module-hero.svg" alt="@vite-pwa/nuxt-module - PWA for Nuxt Module logo">
|
|
5
|
+
</picture>
|
|
4
6
|
</p>
|
|
5
7
|
|
|
8
|
+
<h1 align='center'>
|
|
9
|
+
PWA for Nuxt Module
|
|
10
|
+
</h1>
|
|
11
|
+
|
|
6
12
|
<p align='center'>
|
|
7
|
-
<a href='https://
|
|
13
|
+
<a href='https://npmx.dev/package/@vite-pwa/nuxt' target="_blank" rel="noopener noreferrer">
|
|
8
14
|
<img src='https://img.shields.io/npm/v/@vite-pwa/nuxt?color=33A6B8&label=' alt="NPM version">
|
|
9
15
|
</a>
|
|
10
|
-
<a href="https://
|
|
16
|
+
<a href="https://npmx.dev/package/@vite-pwa/nuxt" target="_blank" rel="noopener noreferrer">
|
|
11
17
|
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vite-pwa/nuxt?color=476582&label=">
|
|
12
18
|
</a>
|
|
13
|
-
<a href="https://
|
|
19
|
+
<a href="https://unplugin-pwa.netlify.app/frameworks/nuxt" target="__blank">
|
|
14
20
|
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
15
21
|
</a>
|
|
16
22
|
<br>
|
|
@@ -23,91 +29,54 @@ Zero-config PWA Plugin for Nuxt 3
|
|
|
23
29
|
|
|
24
30
|
<p align="center">
|
|
25
31
|
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
|
26
|
-
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
|
32
|
+
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg' alt="Anthony Fu SVG sponsors image"/>
|
|
27
33
|
</a>
|
|
28
34
|
</p>
|
|
29
35
|
|
|
30
36
|
## 🚀 Features
|
|
31
37
|
|
|
32
|
-
- 📖 [**Documentation & guides**](https://
|
|
38
|
+
- 📖 [**Documentation & guides**](https://unplugin-pwa.netlify.app/)
|
|
33
39
|
- 👌 **Zero-Config**: sensible built-in default configs for common use cases
|
|
34
40
|
- 🔩 **Extensible**: expose the full ability to customize the behavior of the plugin
|
|
35
41
|
- 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
36
42
|
- 🔌 **Offline Support**: generate service worker with offline support (via Workbox)
|
|
37
|
-
- ⚡ **Fully tree shakable**:
|
|
43
|
+
- ⚡ **Fully tree shakable**: client virtual modules are strictly optimized for Dead Code Elimination.
|
|
44
|
+
- 📄 **Web Manifest**: auto-inject Web App Manifest and PWA assets seamlessly.
|
|
38
45
|
- 💬 **Prompt for new content**: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
|
|
39
46
|
- ⚙️ **Stale-while-revalidate**: automatic reload when new content is available
|
|
40
47
|
- ✨ **Static assets handling**: configure static assets for offline support
|
|
41
48
|
- 🐞 **Development Support**: debug your custom service worker logic as you develop your application
|
|
42
|
-
-
|
|
49
|
+
- 🔍 **Inspector**: visually inspect your resolved configuration, web manifest and service worker during development, via middleware or [DevFrame](https://github.com/devframes/devframe)
|
|
50
|
+
- 🧩 **Modular**: use the ready-to-use plugins or compose your own integration from the building blocks in `@unplugin-pwa/core` and `@unplugin-pwa/vite`
|
|
51
|
+
- 📦 **Universal Bundlers**: native integration with Vite, Rolldown, Webpack (WIP), Rspack (WIP), and Rsbuild (WIP).
|
|
52
|
+
- 🛠️ **Meta-Frameworks**: seamless integration with [î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/4/5](https://github.com/nuxt/nuxt), [React Router](https://github.com/remix-run/react-router/), [TanStack](https://github.com/TanStack) and [Next](https://github.com/vercel/next.js/) (WIP).
|
|
43
53
|
- 💥 **PWA Assets Generator**: generate all the PWA assets from a single command and a single source image
|
|
44
54
|
- 🚀 **PWA Assets Integration**: serving, generating and injecting PWA Assets on the fly in your application
|
|
45
55
|
|
|
46
|
-
##
|
|
56
|
+
## 🔌 What is `@vite-pwa/nuxt`?
|
|
47
57
|
|
|
48
|
-
|
|
58
|
+
`@vite-pwa/nuxt` is the new for Nuxt PWA module, powered by [`unplugin-pwa`](https://github.com/vite-pwa/unplugin-pwa).
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
## 📦 Install
|
|
51
61
|
|
|
52
62
|
```bash
|
|
53
|
-
npx
|
|
63
|
+
npx nuxt module add @vite-pwa/nuxt
|
|
54
64
|
```
|
|
55
65
|
|
|
56
66
|
## 🦄 Usage
|
|
57
67
|
|
|
58
|
-
Add `@vite-pwa/nuxt` module to `nuxt.config.ts` and configure it:
|
|
59
|
-
|
|
60
68
|
```ts
|
|
61
69
|
// nuxt.config.ts
|
|
62
|
-
import { defineNuxtConfig } from 'nuxt/config'
|
|
63
|
-
|
|
64
70
|
export default defineNuxtConfig({
|
|
65
|
-
modules: [
|
|
66
|
-
'@vite-pwa/nuxt'
|
|
67
|
-
],
|
|
71
|
+
modules: ['@vite-pwa/nuxt'],
|
|
68
72
|
pwa: {
|
|
69
73
|
/* PWA options */
|
|
70
|
-
}
|
|
74
|
+
},
|
|
71
75
|
})
|
|
72
76
|
```
|
|
73
77
|
|
|
74
|
-
Read the [
|
|
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)
|
|
78
|
+
Read the [documentation](https://unplugin-pwa.netlify.app/frameworks/nuxt) and the [repository README](https://github.com/vite-pwa/nuxt#readme) for more details.
|
|
110
79
|
|
|
111
|
-
##
|
|
80
|
+
## License
|
|
112
81
|
|
|
113
|
-
[MIT](
|
|
82
|
+
[MIT](https://github.com/vite-pwa/nuxt/blob/main/LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-pwa/nuxt-core/config";
|
package/config/index.mjs
ADDED
package/configuration.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
declare module 'virtual:nuxt-pwa-configuration' {
|
|
2
|
+
export const callBeforeRegisterHook: boolean
|
|
3
|
+
export function initializeDev(): void
|
|
4
|
+
export function activateSWSwitcherDev(): void
|
|
2
5
|
export const enabled: boolean
|
|
3
6
|
export const display: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser'
|
|
4
7
|
export const installPrompt: string | undefined
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getNuxtVersion, useLogger } from '@nuxt/kit';
|
|
2
|
+
|
|
3
|
+
async function createNuxtPwaContext(options, nuxt, moduleResolver) {
|
|
4
|
+
const nuxtVersion = getNuxtVersion(nuxt);
|
|
5
|
+
let buildAssetsDir = nuxt.options.app.buildAssetsDir ?? "_nuxt/";
|
|
6
|
+
if (buildAssetsDir[0] === "/") {
|
|
7
|
+
buildAssetsDir = buildAssetsDir.slice(1);
|
|
8
|
+
}
|
|
9
|
+
if (buildAssetsDir[buildAssetsDir.length - 1] !== "/") {
|
|
10
|
+
buildAssetsDir += "/";
|
|
11
|
+
}
|
|
12
|
+
const builder = options.builder ?? (nuxt.options.builder === "@nuxt/vite-builder" ? await import('@vite-pwa/nuxt-vite').then((m) => m.builder) : void 0);
|
|
13
|
+
if (!builder) {
|
|
14
|
+
const name = typeof nuxt.options.builder === "string" ? nuxt.options.builder : "custom";
|
|
15
|
+
useLogger("@vite-pwa/nuxt").warn(`Builder \`${name}\` is not supported yet, PWA support is disabled.`);
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
return await builder.build(
|
|
19
|
+
nuxtVersion,
|
|
20
|
+
buildAssetsDir,
|
|
21
|
+
options,
|
|
22
|
+
nuxt,
|
|
23
|
+
moduleResolver
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { createNuxtPwaContext };
|