@vite-pwa/nuxt 0.3.2 → 0.3.3
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.json +1 -1
- package/dist/module.mjs +14 -9
- package/dist/types.d.mts +2 -2
- package/package.json +6 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { defineNuxtModule, createResolver, getNuxtVersion, addPlugin, addCompone
|
|
|
4
4
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
5
5
|
import { resolve } from 'pathe';
|
|
6
6
|
|
|
7
|
-
const version = "0.3.
|
|
7
|
+
const version = "0.3.3";
|
|
8
8
|
|
|
9
9
|
function configurePWAOptions(nuxt3_8, options, nuxt, nitroConfig) {
|
|
10
10
|
if (!options.outDir) {
|
|
@@ -32,19 +32,24 @@ function configurePWAOptions(nuxt3_8, options, nuxt, nitroConfig) {
|
|
|
32
32
|
options.workbox.navigateFallback = nuxt.options.app.baseURL ?? "/";
|
|
33
33
|
config = options.workbox;
|
|
34
34
|
}
|
|
35
|
+
let buildAssetsDir = nuxt.options.app.buildAssetsDir ?? "_nuxt/";
|
|
36
|
+
if (buildAssetsDir[0] === "/")
|
|
37
|
+
buildAssetsDir = buildAssetsDir.slice(1);
|
|
38
|
+
if (buildAssetsDir[buildAssetsDir.length - 1] !== "/")
|
|
39
|
+
buildAssetsDir += "/";
|
|
40
|
+
if (!("dontCacheBustURLsMatching" in config))
|
|
41
|
+
config.dontCacheBustURLsMatching = new RegExp(buildAssetsDir);
|
|
35
42
|
if (nuxt.options.experimental.payloadExtraction) {
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
const enableGlobPatterns = nuxt.options._generate || (!!nitroConfig.prerender?.routes?.length || Object.values(nitroConfig.routeRules ?? {}).some((r) => r.prerender));
|
|
44
|
+
if (enableGlobPatterns) {
|
|
45
|
+
config.globPatterns = config.globPatterns ?? [];
|
|
46
|
+
config.globPatterns.push("**/_payload.json");
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
let appManifestFolder;
|
|
40
50
|
if (nuxt3_8 && nuxt.options.experimental.appManifest) {
|
|
41
51
|
config.globPatterns = config.globPatterns ?? [];
|
|
42
|
-
appManifestFolder =
|
|
43
|
-
if (appManifestFolder[0] === "/")
|
|
44
|
-
appManifestFolder = appManifestFolder.slice(1);
|
|
45
|
-
if (appManifestFolder[appManifestFolder.length - 1] !== "/")
|
|
46
|
-
appManifestFolder += "/";
|
|
47
|
-
appManifestFolder += "builds/";
|
|
52
|
+
appManifestFolder = `${buildAssetsDir}builds/`;
|
|
48
53
|
config.globPatterns.push(`${appManifestFolder}**/*.json`);
|
|
49
54
|
}
|
|
50
55
|
if (!nuxt.options.dev && !config.manifestTransforms)
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import type { ModuleOptions } from './module'
|
|
2
|
+
import type { ModuleOptions } from './module.js'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
declare module '@nuxt/schema' {
|
|
@@ -13,4 +13,4 @@ declare module 'nuxt/schema' {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export type { ClientOptions, ModuleOptions, PwaModuleOptions, default } from './module'
|
|
16
|
+
export type { ClientOptions, ModuleOptions, PwaModuleOptions, default } from './module.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-pwa/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"packageManager": "pnpm@8.11.0",
|
|
6
6
|
"description": "Zero-config PWA for Nuxt 3",
|
|
7
7
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"./*": "./*"
|
|
32
32
|
},
|
|
33
|
-
"main": "./dist/module.
|
|
33
|
+
"main": "./dist/module.mjs",
|
|
34
34
|
"types": "./dist/types.d.ts",
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
37
37
|
"*.d.ts"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"prepack": "nuxt-module-build prepare && nuxt-module-build build",
|
|
40
|
+
"prepack": "nuxt-module-build prepare && nuxt-module-build build && jiti scripts/postbuild.ts",
|
|
41
41
|
"dev": "nuxi dev playground",
|
|
42
42
|
"dev:generate": "nuxi generate playground",
|
|
43
43
|
"dev:generate:netlify": "NITRO_PRESET=netlify nuxi generate playground",
|
|
@@ -93,5 +93,8 @@
|
|
|
93
93
|
"vite",
|
|
94
94
|
"vite-plugin-pwa"
|
|
95
95
|
]
|
|
96
|
+
},
|
|
97
|
+
"stackblitz": {
|
|
98
|
+
"startCommand": "nr prepack && nr dev:prepare && nr dev"
|
|
96
99
|
}
|
|
97
100
|
}
|