@serwist/nuxt 9.0.9 → 9.1.0-preview.0
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.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -18
- package/package.json +12 -12
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import path from 'node:path';
|
2
2
|
import { defineNuxtModule, createResolver, addPlugin, extendWebpackConfig } from '@nuxt/kit';
|
3
|
-
import { resolveEntry, createContext,
|
3
|
+
import { resolveEntry, createContext, main, dev, generateServiceWorker } from 'vite-plugin-serwist';
|
4
4
|
import { createHash } from 'node:crypto';
|
5
5
|
import { createReadStream } from 'node:fs';
|
6
6
|
import fsp from 'node:fs/promises';
|
7
7
|
|
8
|
-
const version = "9.0.
|
8
|
+
const version = "9.1.0-preview.0";
|
9
9
|
|
10
10
|
function configurePwaOptions(options, nuxt, nitroConfig) {
|
11
11
|
let buildAssetsDir = nuxt.options.app.buildAssetsDir ?? "_nuxt/";
|
@@ -110,7 +110,6 @@ const module = defineNuxtModule({
|
|
110
110
|
async setup(options, nuxt) {
|
111
111
|
const resolver = createResolver(import.meta.url);
|
112
112
|
let ctx;
|
113
|
-
let api;
|
114
113
|
const { client: _client, ...userOptions } = options;
|
115
114
|
const client = { registerPlugin: true, ..._client };
|
116
115
|
const runtimeDir = resolver.resolve("./runtime");
|
@@ -129,19 +128,17 @@ const module = defineNuxtModule({
|
|
129
128
|
configurePwaOptions(options, nuxt, nitro.options);
|
130
129
|
});
|
131
130
|
nuxt.hook("vite:extend", ({ config }) => {
|
132
|
-
const plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "
|
131
|
+
const plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "vite-plugin-serwist");
|
133
132
|
if (plugin) {
|
134
|
-
throw new Error("Remove '
|
133
|
+
throw new Error("Remove 'vite-plugin-serwist' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
|
135
134
|
}
|
136
135
|
});
|
137
136
|
nuxt.hook("vite:extendConfig", async (viteInlineConfig, { isClient }) => {
|
138
|
-
if (!viteInlineConfig.plugins)
|
137
|
+
if (!viteInlineConfig.plugins)
|
139
138
|
viteInlineConfig.plugins = [];
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
throw new Error("Remove '@serwist/vite' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
|
144
|
-
}
|
139
|
+
const plugin = viteInlineConfig.plugins.find((p) => p && typeof p === "object" && "name" in p && p.name === "vite-plugin-serwist");
|
140
|
+
if (plugin)
|
141
|
+
throw new Error("Remove 'vite-plugin-serwist' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
|
145
142
|
if (isClient) {
|
146
143
|
const configuration = "virtual:serwist-nuxt-configuration";
|
147
144
|
const resolvedConfiguration = `\0${configuration}`;
|
@@ -163,19 +160,15 @@ const module = defineNuxtModule({
|
|
163
160
|
});
|
164
161
|
}
|
165
162
|
ctx = createContext(userOptions, "nuxt");
|
166
|
-
|
167
|
-
const plugins = [main(ctx, api), dev(ctx, api)];
|
168
|
-
viteInlineConfig.plugins.push(plugins);
|
163
|
+
viteInlineConfig.plugins.push(main(ctx), dev(ctx));
|
169
164
|
});
|
170
165
|
extendWebpackConfig(() => {
|
171
166
|
throw new Error("Webpack is not supported: '@serwist/nuxt' can only be used with Vite!");
|
172
167
|
});
|
173
168
|
if (!nuxt.options.dev) {
|
174
169
|
nuxt.hook("nitro:build:public-assets", () => {
|
175
|
-
if (
|
176
|
-
|
177
|
-
}
|
178
|
-
void api.generateSW();
|
170
|
+
if (ctx && !ctx.options.disable)
|
171
|
+
void generateServiceWorker(ctx);
|
179
172
|
});
|
180
173
|
}
|
181
174
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@serwist/nuxt",
|
3
|
-
"version": "9.0.
|
3
|
+
"version": "9.1.0-preview.0",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A Nuxt module that integrates Serwist into your application.",
|
6
6
|
"files": [
|
@@ -45,29 +45,29 @@
|
|
45
45
|
"vite",
|
46
46
|
"@nuxt/kit",
|
47
47
|
"@serwist/build",
|
48
|
-
"
|
48
|
+
"vite-plugin-serwist",
|
49
49
|
"virtual:serwist-nuxt-configuration",
|
50
50
|
"virtual:serwist"
|
51
51
|
]
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
54
|
"@nuxt/kit": "3.13.2",
|
55
|
-
"@serwist/build": "9.0.
|
56
|
-
"
|
57
|
-
"@serwist/window": "9.0.
|
55
|
+
"@serwist/build": "9.1.0-preview.0",
|
56
|
+
"vite-plugin-serwist": "9.1.0-preview.0",
|
57
|
+
"@serwist/window": "9.1.0-preview.0"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
60
|
"@nuxt/module-builder": "0.8.4",
|
61
61
|
"@nuxt/schema": "3.13.2",
|
62
|
-
"@types/node": "22.
|
63
|
-
"eslint": "
|
62
|
+
"@types/node": "22.8.6",
|
63
|
+
"eslint": "9.14.0",
|
64
64
|
"nuxt": "3.13.2",
|
65
65
|
"rimraf": "5.0.9",
|
66
|
-
"serve": "14.2.
|
67
|
-
"typescript": "5.6.
|
68
|
-
"vite": "5.4.
|
69
|
-
"vue-tsc": "2.1.
|
70
|
-
"@serwist/configs": "9.0.
|
66
|
+
"serve": "14.2.4",
|
67
|
+
"typescript": "5.6.3",
|
68
|
+
"vite": "5.4.10",
|
69
|
+
"vue-tsc": "2.1.10",
|
70
|
+
"@serwist/configs": "9.1.0-preview.0"
|
71
71
|
},
|
72
72
|
"peerDependencies": {
|
73
73
|
"typescript": ">=5.0.0",
|