@vite-pwa/nuxt 0.0.7 → 0.0.8
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/dist/module.d.ts +50 -31
- package/dist/module.json +1 -1
- package/dist/runtime/VitePwaManifest.d.ts +2 -2
- package/dist/types.d.ts +6 -1
- package/package.json +25 -16
- package/templates/pwa.client.ts +4 -3
package/dist/module.d.ts
CHANGED
|
@@ -1,38 +1,57 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { VitePWAOptions } from 'vite-plugin-pwa';
|
|
3
|
+
import { UnwrapNestedRefs, Ref } from 'vue';
|
|
3
4
|
|
|
4
|
-
interface
|
|
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
|
-
|
|
5
|
+
interface PwaInjection {
|
|
6
|
+
isInstalled: boolean;
|
|
7
|
+
showInstallPrompt: Ref<boolean>;
|
|
8
|
+
cancelInstall: () => void;
|
|
9
|
+
install: () => Promise<void>;
|
|
10
|
+
swActivated: Ref<boolean>;
|
|
11
|
+
registrationError: Ref<boolean>;
|
|
12
|
+
offlineReady: Ref<boolean>;
|
|
13
|
+
needRefresh: Ref<boolean>;
|
|
14
|
+
updateServiceWorker: (reloadPage?: boolean | undefined) => Promise<void>;
|
|
15
|
+
cancelPrompt: () => Promise<void>;
|
|
16
|
+
getSWRegistration: () => ServiceWorkerRegistration | undefined;
|
|
17
|
+
}
|
|
18
|
+
declare module '#app' {
|
|
19
|
+
interface NuxtApp {
|
|
20
|
+
$pwa: UnwrapNestedRefs<PwaInjection>;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
interface ClientOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Exposes the plugin: defaults to true.
|
|
26
|
+
*/
|
|
27
|
+
registerPlugin?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Registers a periodic sync for updates interval: value in seconds.
|
|
30
|
+
*/
|
|
31
|
+
periodicSyncForUpdates?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Will prevent showing native PWA install prompt: defaults to false.
|
|
34
|
+
*
|
|
35
|
+
* When set to true or no empty string, the native PWA install prompt will be prevented.
|
|
36
|
+
*
|
|
37
|
+
* When set to a string, it will be used as the key in `localStorage` to prevent show the PWA install prompt widget.
|
|
38
|
+
*
|
|
39
|
+
* When set to true, the key used will be `vite-pwa:hide-install`.
|
|
40
|
+
*/
|
|
41
|
+
installPrompt?: boolean | string;
|
|
42
|
+
}
|
|
43
|
+
interface ModuleOptions extends Partial<VitePWAOptions> {
|
|
44
|
+
registerWebManifestInRouteRules?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Writes the plugin to disk: defaults to false (debug).
|
|
47
|
+
*/
|
|
48
|
+
writePlugin?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Options for plugin.
|
|
51
|
+
*/
|
|
52
|
+
client?: ClientOptions;
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
37
56
|
|
|
38
|
-
export { ClientOptions, ModuleOptions, _default as default };
|
|
57
|
+
export { ClientOptions, ModuleOptions, PwaInjection, _default as default };
|
package/dist/module.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
package/dist/types.d.ts
CHANGED
|
@@ -6,5 +6,10 @@ declare module '@nuxt/schema' {
|
|
|
6
6
|
interface NuxtOptions { ['pwa']?: ModuleOptions }
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
declare module 'nuxt/schema' {
|
|
10
|
+
interface NuxtConfig { ['pwa']?: Partial<ModuleOptions> }
|
|
11
|
+
interface NuxtOptions { ['pwa']?: ModuleOptions }
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
|
|
10
|
-
export { ClientOptions, ModuleOptions, default } from './module'
|
|
15
|
+
export { ClientOptions, ModuleOptions, PwaInjection, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-pwa/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "0.0.8",
|
|
5
|
+
"packageManager": "pnpm@8.5.0",
|
|
6
6
|
"description": "Zero-config PWA for Nuxt 3",
|
|
7
7
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -41,31 +41,40 @@
|
|
|
41
41
|
"dev:generate:vercel": "NITRO_PRESET=vercel nuxi generate playground",
|
|
42
42
|
"dev:build": "nuxi build playground",
|
|
43
43
|
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
|
|
44
|
-
"dev:preview:build": "
|
|
45
|
-
"dev:preview:generate": "
|
|
44
|
+
"dev:preview:build": "nr dev:build && node playground/.output/server/index.mjs",
|
|
45
|
+
"dev:preview:generate": "nr dev:generate && serve playground/dist",
|
|
46
46
|
"prepublishOnly": "npm run prepack",
|
|
47
47
|
"release": "bumpp && npm publish",
|
|
48
48
|
"lint": "eslint .",
|
|
49
|
-
"lint-fix": "nr lint --fix"
|
|
49
|
+
"lint-fix": "nr lint --fix",
|
|
50
|
+
"test:build:serve": "PORT=4173 node playground/.output/server/index.mjs",
|
|
51
|
+
"test:generate:serve": "PORT=4173 serve playground/dist",
|
|
52
|
+
"test:build": "nr dev:build && TEST_BUILD=true vitest run && TEST_BUILD=true playwright test",
|
|
53
|
+
"test:generate": "nr dev:generate && vitest run && playwright test",
|
|
54
|
+
"test": "nr test:build && nr test:generate",
|
|
55
|
+
"test:with-build": "nr dev:prepare && nr prepack && nr test"
|
|
50
56
|
},
|
|
51
57
|
"peerDependencies": {
|
|
52
|
-
"@nuxt/kit": "^3.0.0
|
|
58
|
+
"@nuxt/kit": "^3.0.0",
|
|
53
59
|
"vite-plugin-pwa": "^0.14.0"
|
|
54
60
|
},
|
|
55
61
|
"dependencies": {
|
|
56
|
-
"@nuxt/kit": "^3.
|
|
57
|
-
"vite-plugin-pwa": "^0.14.
|
|
62
|
+
"@nuxt/kit": "^3.4.3",
|
|
63
|
+
"vite-plugin-pwa": "^0.14.7"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
|
60
|
-
"@antfu/eslint-config": "^0.
|
|
61
|
-
"@antfu/ni": "^0.
|
|
62
|
-
"@nuxt/module-builder": "^0.
|
|
63
|
-
"@nuxt/schema": "^3.
|
|
64
|
-
"@nuxt/test-utils": "^3.
|
|
66
|
+
"@antfu/eslint-config": "^0.38.6",
|
|
67
|
+
"@antfu/ni": "^0.21.3",
|
|
68
|
+
"@nuxt/module-builder": "^0.3.1",
|
|
69
|
+
"@nuxt/schema": "^3.4.3",
|
|
70
|
+
"@nuxt/test-utils": "^3.4.3",
|
|
71
|
+
"@playwright/test": "^1.33.0",
|
|
65
72
|
"bumpp": "^8.2.1",
|
|
66
|
-
"eslint": "^8.
|
|
67
|
-
"nuxt": "^3.
|
|
68
|
-
"
|
|
73
|
+
"eslint": "^8.40.0",
|
|
74
|
+
"nuxt": "^3.4.3",
|
|
75
|
+
"serve": "^14.2.0",
|
|
76
|
+
"typescript": "^5.0.4",
|
|
77
|
+
"vitest": "^0.31.0"
|
|
69
78
|
},
|
|
70
79
|
"build": {
|
|
71
80
|
"externals": [
|
package/templates/pwa.client.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ref, reactive, nextTick } from 'vue'
|
|
1
|
+
import { ref, reactive, nextTick, type UnwrapNestedRefs } from 'vue'
|
|
2
2
|
import { useRegisterSW } from 'virtual:pwa-register/vue'
|
|
3
3
|
import { defineNuxtPlugin } from '#imports'
|
|
4
4
|
|
|
5
|
+
import { type PwaInjection } from '../src/types'
|
|
6
|
+
|
|
5
7
|
// @ts-ignore
|
|
6
8
|
const options: { periodicSyncForUpdates: number; installPrompt?: string } = <%= JSON.stringify(options) %>
|
|
7
9
|
|
|
@@ -115,7 +117,6 @@ export default defineNuxtPlugin(() => {
|
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
|
|
119
120
|
return {
|
|
120
121
|
provide: {
|
|
121
122
|
pwa: reactive({
|
|
@@ -130,7 +131,7 @@ export default defineNuxtPlugin(() => {
|
|
|
130
131
|
updateServiceWorker,
|
|
131
132
|
cancelPrompt,
|
|
132
133
|
getSWRegistration,
|
|
133
|
-
})
|
|
134
|
+
}) satisfies UnwrapNestedRefs<PwaInjection>,
|
|
134
135
|
},
|
|
135
136
|
}
|
|
136
137
|
})
|