@serwist/nuxt 10.0.0-preview.1 → 10.0.0-preview.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.d.mts +2 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +13 -128
- package/dist/runtime/plugins/client.d.ts +5 -1
- package/dist/types.d.mts +3 -1
- package/package.json +20 -20
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -34
- package/dist/types.d.ts +0 -1
package/dist/module.d.mts
CHANGED
@@ -31,4 +31,5 @@ interface ModuleOptions extends Optional<PluginOptions, "swSrc" | "swDest" | "gl
|
|
31
31
|
|
32
32
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
33
33
|
|
34
|
-
export {
|
34
|
+
export { _default as default };
|
35
|
+
export type { ClientOptions, ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -1,128 +1,19 @@
|
|
1
1
|
import path from 'node:path';
|
2
2
|
import { defineNuxtModule, createResolver, addPlugin, extendWebpackConfig } from '@nuxt/kit';
|
3
|
-
import { resolveEntry
|
3
|
+
import { resolveEntry } from '@serwist/utils/node';
|
4
|
+
import { createContext, main, dev, generateServiceWorker } from 'vite-plugin-serwist';
|
4
5
|
import { createHash } from 'node:crypto';
|
5
6
|
import { createReadStream } from 'node:fs';
|
6
7
|
import fsp from 'node:fs/promises';
|
7
8
|
|
8
|
-
const
|
9
|
-
const version = "10.0.0-preview.1";
|
10
|
-
const type = "module";
|
11
|
-
const description = "A Nuxt module that integrates Serwist into your application.";
|
12
|
-
const files = [
|
13
|
-
"dist"
|
14
|
-
];
|
15
|
-
const keywords = [
|
16
|
-
"nuxt",
|
17
|
-
"pwa",
|
18
|
-
"vite",
|
19
|
-
"vite-plugin",
|
20
|
-
"serwist",
|
21
|
-
"serwistjs",
|
22
|
-
"pwa",
|
23
|
-
"sw",
|
24
|
-
"service worker",
|
25
|
-
"web",
|
26
|
-
"service-worker",
|
27
|
-
"nuxt-module"
|
28
|
-
];
|
29
|
-
const engines = {
|
30
|
-
node: ">=18.0.0"
|
31
|
-
};
|
32
|
-
const repository = "https://github.com/serwist/serwist";
|
33
|
-
const bugs = "https://github.com/serwist/serwist/issues";
|
34
|
-
const homepage = "https://serwist.pages.dev";
|
35
|
-
const main = "./dist/module.mjs";
|
36
|
-
const types = "./dist/types.d.ts";
|
37
|
-
const exports = {
|
38
|
-
".": {
|
39
|
-
types: "./dist/types.d.mts",
|
40
|
-
"default": "./dist/module.mjs"
|
41
|
-
}
|
42
|
-
};
|
43
|
-
const build = {
|
44
|
-
externals: [
|
45
|
-
"node:child_process",
|
46
|
-
"node:fs",
|
47
|
-
"node:path",
|
48
|
-
"consola",
|
49
|
-
"esbuild",
|
50
|
-
"rollup",
|
51
|
-
"vite",
|
52
|
-
"@nuxt/kit",
|
53
|
-
"@serwist/build",
|
54
|
-
"vite-plugin-serwist",
|
55
|
-
"virtual:serwist-nuxt-configuration",
|
56
|
-
"virtual:serwist"
|
57
|
-
]
|
58
|
-
};
|
59
|
-
const scripts = {
|
60
|
-
build: "nuxt-module-build prepare && nuxt-module-build build",
|
61
|
-
dev: "nuxi dev playground --port 5173",
|
62
|
-
"dev:generate": "nuxi generate playground",
|
63
|
-
"dev:generate:netlify": "NITRO_PRESET=netlify nuxi generate playground",
|
64
|
-
"dev:generate:vercel": "NITRO_PRESET=vercel nuxi generate playground",
|
65
|
-
"dev:build": "nuxi build playground",
|
66
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
67
|
-
"dev:preview:build": "nr dev:build && node playground/.output/server/index.mjs",
|
68
|
-
"dev:preview:generate": "nr dev:generate && serve playground/dist"
|
69
|
-
};
|
70
|
-
const dependencies = {
|
71
|
-
"@nuxt/kit": "3.15.4",
|
72
|
-
"@serwist/build": "workspace:*",
|
73
|
-
"vite-plugin-serwist": "workspace:*",
|
74
|
-
"@serwist/window": "workspace:*"
|
75
|
-
};
|
76
|
-
const devDependencies = {
|
77
|
-
"@nuxt/module-builder": "0.8.4",
|
78
|
-
"@nuxt/schema": "3.15.4",
|
79
|
-
"@serwist/configs": "workspace:*",
|
80
|
-
"@types/node": "22.13.5",
|
81
|
-
eslint: "9.21.0",
|
82
|
-
nuxt: "3.15.4",
|
83
|
-
rimraf: "5.0.9",
|
84
|
-
serve: "14.2.4",
|
85
|
-
typescript: "5.7.3",
|
86
|
-
vite: "6.1.1",
|
87
|
-
"vue-tsc": "2.2.4"
|
88
|
-
};
|
89
|
-
const peerDependencies = {
|
90
|
-
typescript: ">=5.0.0",
|
91
|
-
vite: "^5.0.0"
|
92
|
-
};
|
93
|
-
const peerDependenciesMeta = {
|
94
|
-
typescript: {
|
95
|
-
optional: true
|
96
|
-
}
|
97
|
-
};
|
9
|
+
const version = "10.0.0-preview.3";
|
98
10
|
const packageJson = {
|
99
|
-
|
100
|
-
version: version,
|
101
|
-
type: type,
|
102
|
-
description: description,
|
103
|
-
files: files,
|
104
|
-
keywords: keywords,
|
105
|
-
engines: engines,
|
106
|
-
repository: repository,
|
107
|
-
bugs: bugs,
|
108
|
-
homepage: homepage,
|
109
|
-
main: main,
|
110
|
-
types: types,
|
111
|
-
exports: exports,
|
112
|
-
build: build,
|
113
|
-
scripts: scripts,
|
114
|
-
dependencies: dependencies,
|
115
|
-
devDependencies: devDependencies,
|
116
|
-
peerDependencies: peerDependencies,
|
117
|
-
peerDependenciesMeta: peerDependenciesMeta
|
118
|
-
};
|
11
|
+
version: version};
|
119
12
|
|
120
13
|
function configurePwaOptions(options, nuxt, nitroConfig) {
|
121
14
|
let buildAssetsDir = nuxt.options.app.buildAssetsDir ?? "_nuxt/";
|
122
|
-
if (buildAssetsDir[0] === "/")
|
123
|
-
|
124
|
-
if (buildAssetsDir[buildAssetsDir.length - 1] !== "/")
|
125
|
-
buildAssetsDir += "/";
|
15
|
+
if (buildAssetsDir[0] === "/") buildAssetsDir = buildAssetsDir.slice(1);
|
16
|
+
if (buildAssetsDir[buildAssetsDir.length - 1] !== "/") buildAssetsDir += "/";
|
126
17
|
if (!("dontCacheBustURLsMatching" in options)) {
|
127
18
|
options.dontCacheBustURLsMatching = new RegExp(buildAssetsDir);
|
128
19
|
}
|
@@ -178,10 +69,8 @@ function createManifestTransform(base, publicDir, appManifestFolder) {
|
|
178
69
|
});
|
179
70
|
});
|
180
71
|
const latestEntry = entries.find((e) => e.url === latest);
|
181
|
-
if (latestEntry)
|
182
|
-
|
183
|
-
else
|
184
|
-
entries.push({ url: latest, revision, size: data.size });
|
72
|
+
if (latestEntry) latestEntry.revision = revision;
|
73
|
+
else entries.push({ url: latest, revision, size: data.size });
|
185
74
|
} else {
|
186
75
|
entries = entries.filter((e) => e.url !== latest);
|
187
76
|
}
|
@@ -223,8 +112,7 @@ const module = defineNuxtModule({
|
|
223
112
|
const { client: _client, ...userOptions } = options;
|
224
113
|
const client = { registerPlugin: true, ..._client };
|
225
114
|
const runtimeDir = resolver.resolve("./runtime");
|
226
|
-
if (!nuxt.options.ssr)
|
227
|
-
nuxt.options.build.transpile.push(runtimeDir);
|
115
|
+
if (!nuxt.options.ssr) nuxt.options.build.transpile.push(runtimeDir);
|
228
116
|
if (client.registerPlugin) {
|
229
117
|
addPlugin({
|
230
118
|
src: resolver.resolve(runtimeDir, "plugins/client"),
|
@@ -244,11 +132,9 @@ const module = defineNuxtModule({
|
|
244
132
|
}
|
245
133
|
});
|
246
134
|
nuxt.hook("vite:extendConfig", async (viteInlineConfig, { isClient }) => {
|
247
|
-
if (!viteInlineConfig.plugins)
|
248
|
-
viteInlineConfig.plugins = [];
|
135
|
+
if (!viteInlineConfig.plugins) viteInlineConfig.plugins = [];
|
249
136
|
const plugin = viteInlineConfig.plugins.find((p) => p && typeof p === "object" && "name" in p && p.name === "vite-plugin-serwist");
|
250
|
-
if (plugin)
|
251
|
-
throw new Error("Remove 'vite-plugin-serwist' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
|
137
|
+
if (plugin) throw new Error("Remove 'vite-plugin-serwist' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
|
252
138
|
if (isClient) {
|
253
139
|
const configuration = "virtual:serwist-nuxt-configuration";
|
254
140
|
const resolvedConfiguration = `\0${configuration}`;
|
@@ -270,15 +156,14 @@ const module = defineNuxtModule({
|
|
270
156
|
});
|
271
157
|
}
|
272
158
|
ctx = createContext(userOptions, "nuxt");
|
273
|
-
viteInlineConfig.plugins.push(main
|
159
|
+
viteInlineConfig.plugins.push(main(ctx), dev(ctx));
|
274
160
|
});
|
275
161
|
extendWebpackConfig(() => {
|
276
162
|
throw new Error("Webpack is not supported: '@serwist/nuxt' can only be used with Vite!");
|
277
163
|
});
|
278
164
|
if (!nuxt.options.dev) {
|
279
165
|
nuxt.hook("nitro:build:public-assets", () => {
|
280
|
-
if (ctx && !ctx.options.disable)
|
281
|
-
void generateServiceWorker(ctx);
|
166
|
+
if (ctx && !ctx.options.disable) void generateServiceWorker(ctx);
|
282
167
|
});
|
283
168
|
}
|
284
169
|
}
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@serwist/nuxt",
|
3
|
-
"version": "10.0.0-preview.
|
3
|
+
"version": "10.0.0-preview.3",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A Nuxt module that integrates Serwist into your application.",
|
6
6
|
"files": [
|
@@ -8,6 +8,7 @@
|
|
8
8
|
],
|
9
9
|
"keywords": [
|
10
10
|
"nuxt",
|
11
|
+
"nuxt-module",
|
11
12
|
"pwa",
|
12
13
|
"vite",
|
13
14
|
"vite-plugin",
|
@@ -17,17 +18,15 @@
|
|
17
18
|
"sw",
|
18
19
|
"service worker",
|
19
20
|
"web",
|
20
|
-
"service-worker"
|
21
|
-
"nuxt-module"
|
21
|
+
"service-worker"
|
22
22
|
],
|
23
23
|
"engines": {
|
24
|
-
"node": ">=
|
24
|
+
"node": ">=20.0.0"
|
25
25
|
},
|
26
26
|
"repository": "https://github.com/serwist/serwist",
|
27
27
|
"bugs": "https://github.com/serwist/serwist/issues",
|
28
28
|
"homepage": "https://serwist.pages.dev",
|
29
29
|
"main": "./dist/module.mjs",
|
30
|
-
"types": "./dist/types.d.ts",
|
31
30
|
"exports": {
|
32
31
|
".": {
|
33
32
|
"types": "./dist/types.d.mts",
|
@@ -51,27 +50,28 @@
|
|
51
50
|
]
|
52
51
|
},
|
53
52
|
"dependencies": {
|
54
|
-
"@nuxt/kit": "3.
|
55
|
-
"@serwist/build": "10.0.0-preview.
|
56
|
-
"
|
57
|
-
"@serwist/window": "10.0.0-preview.
|
53
|
+
"@nuxt/kit": "3.16.2",
|
54
|
+
"@serwist/build": "10.0.0-preview.3",
|
55
|
+
"@serwist/utils": "10.0.0-preview.3",
|
56
|
+
"@serwist/window": "10.0.0-preview.3",
|
57
|
+
"vite-plugin-serwist": "10.0.0-preview.3"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
|
-
"@nuxt/module-builder": "0.
|
61
|
-
"@nuxt/schema": "3.
|
62
|
-
"@types/node": "22.
|
63
|
-
"eslint": "9.
|
64
|
-
"nuxt": "3.
|
65
|
-
"rimraf": "
|
60
|
+
"@nuxt/module-builder": "1.0.1",
|
61
|
+
"@nuxt/schema": "3.16.2",
|
62
|
+
"@types/node": "22.14.1",
|
63
|
+
"eslint": "9.25.0",
|
64
|
+
"nuxt": "3.16.2",
|
65
|
+
"rimraf": "6.0.1",
|
66
66
|
"serve": "14.2.4",
|
67
|
-
"typescript": "5.
|
68
|
-
"vite": "6.
|
69
|
-
"vue-tsc": "2.2.
|
70
|
-
"@serwist/configs": "10.0.0-preview.
|
67
|
+
"typescript": "5.8.3",
|
68
|
+
"vite": "6.3.2",
|
69
|
+
"vue-tsc": "2.2.8",
|
70
|
+
"@serwist/configs": "10.0.0-preview.3"
|
71
71
|
},
|
72
72
|
"peerDependencies": {
|
73
73
|
"typescript": ">=5.0.0",
|
74
|
-
"vite": "^5.0.0"
|
74
|
+
"vite": "^5.0.0 || ^6.0.0"
|
75
75
|
},
|
76
76
|
"peerDependenciesMeta": {
|
77
77
|
"typescript": {
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
2
|
-
import { PluginOptions } from 'vite-plugin-serwist';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Make certain fields in a object type optional
|
6
|
-
*
|
7
|
-
* @example
|
8
|
-
* interface A {
|
9
|
-
* a: string;
|
10
|
-
* b: string;
|
11
|
-
* c: string;
|
12
|
-
* }
|
13
|
-
* type B = Optional<A, "b" | "c">;
|
14
|
-
* const b: B = { a: "hehe" }; //valid
|
15
|
-
* const b: B = {}; //invalid
|
16
|
-
*/
|
17
|
-
type Optional<T, U extends keyof T> = Omit<T, U> & Partial<Pick<T, U>>;
|
18
|
-
|
19
|
-
interface ClientOptions {
|
20
|
-
/**
|
21
|
-
* Whether this plugin should be registered.
|
22
|
-
*/
|
23
|
-
registerPlugin?: boolean;
|
24
|
-
}
|
25
|
-
interface ModuleOptions extends Optional<PluginOptions, "swSrc" | "swDest" | "globDirectory"> {
|
26
|
-
/**
|
27
|
-
* Options for plugin.
|
28
|
-
*/
|
29
|
-
client?: ClientOptions;
|
30
|
-
}
|
31
|
-
|
32
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
33
|
-
|
34
|
-
export { type ClientOptions, type ModuleOptions, _default as default };
|
package/dist/types.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { type ClientOptions, type ModuleOptions, default } from './module'
|