@vite-pwa/tanstack 0.0.1 → 0.0.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/README.md +1 -1
- package/dist/vite/nitro/config.mjs +7 -8
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ This package provides two different plugins depending on your setup: a standard
|
|
|
74
74
|
If you are using TanStack Start, use the `TanStackNitroPWAPlugin` variant.
|
|
75
75
|
|
|
76
76
|
**⚠️ Important Requirements:**
|
|
77
|
-
* **Nitro v3 RC:** You must use the latest Nitro v3 Release Candidate `3.0.
|
|
77
|
+
* **Nitro v3 RC:** You must use the latest Nitro v3 Release Candidate `3.0.261103-rc` (or newer) which includes the necessary lifecycle hook for the correct Service Worker pre-cache manifest generation.
|
|
78
78
|
* **Prerendering:** You **must** explicitly enable prerendering for your routes in the `nitro` configuration (`routeRules`) and in the `tanstackStart` plugin to add offline support. Without pre-rendering (e.g., generating the `index.html`), offline support will not work as the entry points will be missing from the SW precache manifest.
|
|
79
79
|
|
|
80
80
|
```ts
|
|
@@ -51,7 +51,7 @@ function prepareNitroModule(ctx, dev) {
|
|
|
51
51
|
return { setup(nitro) {
|
|
52
52
|
if (dev) {
|
|
53
53
|
if (!nitro.options.dev || ctx.tanstack.nitro) return;
|
|
54
|
-
nitro.hooks.hook("
|
|
54
|
+
nitro.hooks.hook("build:config", () => {
|
|
55
55
|
ctx.tanstack.buildSWAlias = nitro.options.alias;
|
|
56
56
|
});
|
|
57
57
|
ctx.tanstack.nitro = nitro;
|
|
@@ -61,12 +61,11 @@ function prepareNitroModule(ctx, dev) {
|
|
|
61
61
|
ctx.externalConfigurationLoader = true;
|
|
62
62
|
ctx.tanstack.nitro = nitro;
|
|
63
63
|
nitro.hooks.hook("build:before", async () => {
|
|
64
|
-
const [loadExternalConfiguration, createManifestTransform, normalizeManifest, {
|
|
64
|
+
const [loadExternalConfiguration, createManifestTransform, normalizeManifest, { normalizePath, resolveSWNames }] = await Promise.all([
|
|
65
65
|
import("../../load-external-configuration-CSA2DKhO.mjs").then(({ loadExternalConfiguration }) => loadExternalConfiguration),
|
|
66
66
|
import("../../create-manifest-transform-DJ5fnDyE.mjs").then(({ createManifestTransform }) => createManifestTransform),
|
|
67
67
|
import("@unplugin-pwa/core/helpers").then(({ normalizeManifest }) => normalizeManifest),
|
|
68
|
-
import("@vite-pwa/workbox-build/utils/resolve-sw-names").then(({
|
|
69
|
-
extractSwDestNameFromSource,
|
|
68
|
+
import("@vite-pwa/workbox-build/utils/resolve-sw-names").then(({ normalizePath, resolveSWNames }) => ({
|
|
70
69
|
normalizePath,
|
|
71
70
|
resolveSWNames
|
|
72
71
|
}))
|
|
@@ -93,20 +92,20 @@ function prepareNitroModule(ctx, dev) {
|
|
|
93
92
|
ctx.resolvedOptions.generateSW ??= {};
|
|
94
93
|
options = ctx.resolvedOptions.generateSW;
|
|
95
94
|
swSrc = "x";
|
|
96
|
-
filename = ctx.resolvedOptions.generateSW.swDest;
|
|
95
|
+
filename = ctx.consumerOptions.filename = normalizePath(path.resolve(ctx.outDir, ctx.resolvedOptions.generateSW.swDest));
|
|
97
96
|
break;
|
|
98
97
|
case "inject-manifest":
|
|
99
98
|
ctx.resolvedOptions.injectManifest ??= {};
|
|
100
99
|
options = ctx.resolvedOptions.injectManifest;
|
|
101
100
|
swSrc = ctx.resolvedOptions.injectManifest.swSrc;
|
|
102
|
-
filename = ctx.consumerOptions.filename
|
|
101
|
+
filename = ctx.consumerOptions.filename = normalizePath(path.resolve(ctx.outDir, ctx.resolvedOptions.injectManifest.swDest));
|
|
103
102
|
ctx.resolvedOptions.injectManifest.swDest = filename;
|
|
104
103
|
break;
|
|
105
104
|
case "build-sw":
|
|
106
105
|
ctx.resolvedOptions.buildSW ??= {};
|
|
107
106
|
options = ctx.resolvedOptions.buildSW;
|
|
108
107
|
swSrc = ctx.resolvedOptions.buildSW.swSrc;
|
|
109
|
-
filename = ctx.consumerOptions.filename
|
|
108
|
+
filename = ctx.consumerOptions.filename = normalizePath(path.resolve(ctx.outDir, ctx.resolvedOptions.buildSW.swDest));
|
|
110
109
|
ctx.resolvedOptions.buildSW.swDest = filename;
|
|
111
110
|
}
|
|
112
111
|
nitro.options.routeRules = nitro.options.routeRules || {};
|
|
@@ -136,7 +135,7 @@ function prepareNitroModule(ctx, dev) {
|
|
|
136
135
|
} };
|
|
137
136
|
normalizeManifest(ctx);
|
|
138
137
|
});
|
|
139
|
-
nitro.hooks.hook("
|
|
138
|
+
nitro.hooks.hook("build:config", () => {
|
|
140
139
|
ctx.tanstack.buildSWAlias = nitro.options.alias;
|
|
141
140
|
if (ctx.strategy === "build-sw") ctx.resolvedOptions.buildSW.alias = nitro.options.alias;
|
|
142
141
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-pwa/tanstack",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"description": "Zero-config PWA for TanStack",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@unplugin-pwa/core": "^0.0.
|
|
72
|
-
"@unplugin-pwa/inspector": "^0.0.
|
|
73
|
-
"@unplugin-pwa/vite": "^0.0.
|
|
74
|
-
"@vite-pwa/workbox-build": "^8.0.
|
|
75
|
-
"@vite-pwa/workbox-swkit": "^8.0.
|
|
76
|
-
"@vite-pwa/workbox-window": "^8.0.
|
|
71
|
+
"@unplugin-pwa/core": "^0.0.5",
|
|
72
|
+
"@unplugin-pwa/inspector": "^0.0.5",
|
|
73
|
+
"@unplugin-pwa/vite": "^0.0.5",
|
|
74
|
+
"@vite-pwa/workbox-build": "^8.0.15",
|
|
75
|
+
"@vite-pwa/workbox-swkit": "^8.0.15",
|
|
76
|
+
"@vite-pwa/workbox-window": "^8.0.15"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@antfu/eslint-config": "^10.0.0",
|
|
@@ -81,19 +81,19 @@
|
|
|
81
81
|
"@arethetypeswrong/core": "^0.18.5",
|
|
82
82
|
"@types/debug": "^4.1.13",
|
|
83
83
|
"@types/node": "24.19.2",
|
|
84
|
-
"@types/react": "^19.
|
|
84
|
+
"@types/react": "^19.3.0",
|
|
85
85
|
"@vite-pwa/assets-generator": "^2.0.0",
|
|
86
86
|
"@vitejs/devtools": "^0.7.6",
|
|
87
|
-
"eslint": "^10.
|
|
88
|
-
"eslint-plugin-antfu": "^3.
|
|
87
|
+
"eslint": "^10.14.0",
|
|
88
|
+
"eslint-plugin-antfu": "^3.3.1",
|
|
89
89
|
"https-localhost": "4.7.2",
|
|
90
|
-
"nitro": "^3.0.
|
|
90
|
+
"nitro": "^3.0.261103-rc",
|
|
91
91
|
"publint": "^0.3.25",
|
|
92
|
-
"react": "^19.
|
|
92
|
+
"react": "^19.3.1",
|
|
93
93
|
"taze": "21.1.0",
|
|
94
|
-
"tsdown": "^0.23.
|
|
94
|
+
"tsdown": "^0.23.4",
|
|
95
95
|
"typescript": "~6.0.3",
|
|
96
|
-
"vite": "^8.3.
|
|
96
|
+
"vite": "^8.3.7"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public",
|