@serwist/nuxt 9.1.0-preview.0 → 10.0.0-preview.2

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 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 { type ClientOptions, type ModuleOptions, _default as default };
34
+ export { _default as default };
35
+ export type { ClientOptions, ModuleOptions };
package/dist/module.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "nuxt": "^3.8.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "9.1.0-preview.0",
8
+ "version": "10.0.0-preview.2",
9
9
  "builder": {
10
- "@nuxt/module-builder": "0.8.4",
10
+ "@nuxt/module-builder": "1.0.1",
11
11
  "unbuild": "unknown"
12
12
  }
13
13
  }
package/dist/module.mjs CHANGED
@@ -1,18 +1,19 @@
1
1
  import path from 'node:path';
2
2
  import { defineNuxtModule, createResolver, addPlugin, extendWebpackConfig } from '@nuxt/kit';
3
- import { resolveEntry, createContext, main, dev, generateServiceWorker } from 'vite-plugin-serwist';
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 version = "9.1.0-preview.0";
9
+ const version = "10.0.0-preview.2";
10
+ const packageJson = {
11
+ version: version};
9
12
 
10
13
  function configurePwaOptions(options, nuxt, nitroConfig) {
11
14
  let buildAssetsDir = nuxt.options.app.buildAssetsDir ?? "_nuxt/";
12
- if (buildAssetsDir[0] === "/")
13
- buildAssetsDir = buildAssetsDir.slice(1);
14
- if (buildAssetsDir[buildAssetsDir.length - 1] !== "/")
15
- buildAssetsDir += "/";
15
+ if (buildAssetsDir[0] === "/") buildAssetsDir = buildAssetsDir.slice(1);
16
+ if (buildAssetsDir[buildAssetsDir.length - 1] !== "/") buildAssetsDir += "/";
16
17
  if (!("dontCacheBustURLsMatching" in options)) {
17
18
  options.dontCacheBustURLsMatching = new RegExp(buildAssetsDir);
18
19
  }
@@ -68,10 +69,8 @@ function createManifestTransform(base, publicDir, appManifestFolder) {
68
69
  });
69
70
  });
70
71
  const latestEntry = entries.find((e) => e.url === latest);
71
- if (latestEntry)
72
- latestEntry.revision = revision;
73
- else
74
- entries.push({ url: latest, revision, size: data.size });
72
+ if (latestEntry) latestEntry.revision = revision;
73
+ else entries.push({ url: latest, revision, size: data.size });
75
74
  } else {
76
75
  entries = entries.filter((e) => e.url !== latest);
77
76
  }
@@ -88,7 +87,7 @@ const module = defineNuxtModule({
88
87
  nuxt: "^3.8.0",
89
88
  bridge: false
90
89
  },
91
- version
90
+ version: packageJson.version
92
91
  },
93
92
  defaults(nuxt) {
94
93
  const publicDir = nuxt.options.nitro?.output?.publicDir ? path.resolve(nuxt.options.nitro.output.publicDir) : path.resolve(nuxt.options.buildDir, "../.output/public");
@@ -113,8 +112,7 @@ const module = defineNuxtModule({
113
112
  const { client: _client, ...userOptions } = options;
114
113
  const client = { registerPlugin: true, ..._client };
115
114
  const runtimeDir = resolver.resolve("./runtime");
116
- if (!nuxt.options.ssr)
117
- nuxt.options.build.transpile.push(runtimeDir);
115
+ if (!nuxt.options.ssr) nuxt.options.build.transpile.push(runtimeDir);
118
116
  if (client.registerPlugin) {
119
117
  addPlugin({
120
118
  src: resolver.resolve(runtimeDir, "plugins/client"),
@@ -134,11 +132,9 @@ const module = defineNuxtModule({
134
132
  }
135
133
  });
136
134
  nuxt.hook("vite:extendConfig", async (viteInlineConfig, { isClient }) => {
137
- if (!viteInlineConfig.plugins)
138
- viteInlineConfig.plugins = [];
135
+ if (!viteInlineConfig.plugins) viteInlineConfig.plugins = [];
139
136
  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'.");
137
+ if (plugin) throw new Error("Remove 'vite-plugin-serwist' from your Vite configuration! Do not use it alongside '@serwist/nuxt'.");
142
138
  if (isClient) {
143
139
  const configuration = "virtual:serwist-nuxt-configuration";
144
140
  const resolvedConfiguration = `\0${configuration}`;
@@ -167,8 +163,7 @@ const module = defineNuxtModule({
167
163
  });
168
164
  if (!nuxt.options.dev) {
169
165
  nuxt.hook("nitro:build:public-assets", () => {
170
- if (ctx && !ctx.options.disable)
171
- void generateServiceWorker(ctx);
166
+ if (ctx && !ctx.options.disable) void generateServiceWorker(ctx);
172
167
  });
173
168
  }
174
169
  }
@@ -1,2 +1,6 @@
1
- declare const plugin: any;
1
+ import type { Serwist } from "@serwist/window";
2
+ import type { Plugin } from "#app";
3
+ declare const plugin: Plugin<{
4
+ serwist: Serwist | undefined;
5
+ }>;
2
6
  export default plugin;
package/dist/types.d.mts CHANGED
@@ -1 +1,3 @@
1
- export { type ClientOptions, type ModuleOptions, default } from './module.js'
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ClientOptions, type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/nuxt",
3
- "version": "9.1.0-preview.0",
3
+ "version": "10.0.0-preview.2",
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": ">=18.0.0"
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.13.2",
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"
53
+ "@nuxt/kit": "3.16.2",
54
+ "@serwist/build": "10.0.0-preview.2",
55
+ "@serwist/utils": "10.0.0-preview.2",
56
+ "@serwist/window": "10.0.0-preview.2",
57
+ "vite-plugin-serwist": "10.0.0-preview.2"
58
58
  },
59
59
  "devDependencies": {
60
- "@nuxt/module-builder": "0.8.4",
61
- "@nuxt/schema": "3.13.2",
62
- "@types/node": "22.8.6",
63
- "eslint": "9.14.0",
64
- "nuxt": "3.13.2",
65
- "rimraf": "5.0.9",
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.6.3",
68
- "vite": "5.4.10",
69
- "vue-tsc": "2.1.10",
70
- "@serwist/configs": "9.1.0-preview.0"
67
+ "typescript": "5.8.3",
68
+ "vite": "6.3.2",
69
+ "vue-tsc": "2.2.8",
70
+ "@serwist/configs": "10.0.0-preview.2"
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
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
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'