@vite-pwa/nuxt 0.7.0 → 0.8.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.
|
@@ -3,7 +3,7 @@ import { resolve, relative, basename } from 'node:path';
|
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
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.12f9bd7b.mjs';
|
|
7
7
|
import '@nuxt/kit';
|
|
8
8
|
import 'vite-plugin-pwa';
|
|
9
9
|
import 'node:crypto';
|
|
@@ -16,7 +16,7 @@ async function preparePWAIconTypes(options, nuxt) {
|
|
|
16
16
|
const configuration = resolvePWAAssetsOptions(options);
|
|
17
17
|
if (!configuration || configuration.disabled)
|
|
18
18
|
return;
|
|
19
|
-
const root = nuxt.options.
|
|
19
|
+
const root = nuxt.options.vite.root ?? process.cwd();
|
|
20
20
|
const { config, sources } = await loadConfiguration(root, configuration);
|
|
21
21
|
if (!config.preset)
|
|
22
22
|
return;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -65,7 +65,7 @@ const plugin = defineNuxtPlugin(() => {
|
|
|
65
65
|
offlineReady.value = false;
|
|
66
66
|
needRefresh.value = false;
|
|
67
67
|
};
|
|
68
|
-
let install = () => Promise.resolve();
|
|
68
|
+
let install = () => Promise.resolve(void 0);
|
|
69
69
|
let cancelInstall = () => {
|
|
70
70
|
};
|
|
71
71
|
if (!hideInstall.value) {
|
|
@@ -90,12 +90,12 @@ const plugin = defineNuxtPlugin(() => {
|
|
|
90
90
|
install = async () => {
|
|
91
91
|
if (!showInstallPrompt.value || !deferredPrompt) {
|
|
92
92
|
showInstallPrompt.value = false;
|
|
93
|
-
return;
|
|
93
|
+
return void 0;
|
|
94
94
|
}
|
|
95
95
|
showInstallPrompt.value = false;
|
|
96
96
|
await nextTick();
|
|
97
97
|
deferredPrompt.prompt();
|
|
98
|
-
await deferredPrompt.userChoice;
|
|
98
|
+
return await deferredPrompt.userChoice;
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
return {
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import type { UnwrapNestedRefs } from 'vue'
|
|
3
3
|
|
|
4
|
+
export interface UserChoice {
|
|
5
|
+
outcome: 'accepted' | 'dismissed'
|
|
6
|
+
platform: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type BeforeInstallPromptEvent = Event & {
|
|
10
|
+
prompt: () => void
|
|
11
|
+
userChoice: Promise<UserChoice>
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
export interface PwaInjection {
|
|
5
15
|
/**
|
|
6
16
|
* @deprecated use `isPWAInstalled` instead
|
|
@@ -9,7 +19,7 @@ export interface PwaInjection {
|
|
|
9
19
|
isPWAInstalled: Ref<boolean>
|
|
10
20
|
showInstallPrompt: Ref<boolean>
|
|
11
21
|
cancelInstall: () => void
|
|
12
|
-
install: () => Promise<
|
|
22
|
+
install: () => Promise<UserChoice | undefined>
|
|
13
23
|
swActivated: Ref<boolean>
|
|
14
24
|
registrationError: Ref<boolean>
|
|
15
25
|
offlineReady: Ref<boolean>
|
|
@@ -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 = "0.
|
|
9
|
+
const version = "0.8.1";
|
|
10
10
|
|
|
11
11
|
function configurePWAOptions(nuxt3_8, options, nuxt, nitroConfig) {
|
|
12
12
|
if (!options.outDir) {
|
|
@@ -265,7 +265,11 @@ async function doSetup(options, nuxt) {
|
|
|
265
265
|
const resolveVitePluginPWAAPI = () => {
|
|
266
266
|
return vitePwaClientPlugin?.api;
|
|
267
267
|
};
|
|
268
|
-
const client = options.client ?? {
|
|
268
|
+
const client = options.client ?? {
|
|
269
|
+
registerPlugin: true,
|
|
270
|
+
installPrompt: false,
|
|
271
|
+
periodicSyncForUpdates: 0
|
|
272
|
+
};
|
|
269
273
|
const runtimeDir = resolver.resolve("../runtime");
|
|
270
274
|
if (!nuxt.options.ssr)
|
|
271
275
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
@@ -507,7 +511,7 @@ const module = defineNuxtModule({
|
|
|
507
511
|
name: "pwa",
|
|
508
512
|
configKey: "pwa",
|
|
509
513
|
compatibility: {
|
|
510
|
-
nuxt: "
|
|
514
|
+
nuxt: ">=3.6.5",
|
|
511
515
|
bridge: false
|
|
512
516
|
},
|
|
513
517
|
version
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-pwa/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@9.0
|
|
4
|
+
"version": "0.8.1",
|
|
5
|
+
"packageManager": "pnpm@9.4.0",
|
|
6
6
|
"description": "Zero-config PWA for Nuxt 3",
|
|
7
7
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -108,4 +108,4 @@
|
|
|
108
108
|
"stackblitz": {
|
|
109
109
|
"startCommand": "nr prepack && nr dev:prepare && nr dev"
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|