@serwist/next 8.4.4 → 9.0.0-preview.1

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.
Files changed (68) hide show
  1. package/dist/index.d.ts +5 -4
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +43 -716
  4. package/dist/index.worker.d.ts +5 -0
  5. package/dist/index.worker.d.ts.map +1 -0
  6. package/dist/{index.browser.cjs → index.worker.js} +53 -26
  7. package/dist/internal-types.d.ts +7 -1
  8. package/dist/internal-types.d.ts.map +1 -0
  9. package/dist/sw-entry-worker.d.ts +1 -0
  10. package/dist/sw-entry-worker.d.ts.map +1 -0
  11. package/dist/sw-entry.d.ts +1 -0
  12. package/dist/sw-entry.d.ts.map +1 -0
  13. package/dist/sw-entry.js +5 -5
  14. package/dist/utils/find-first-truthy.d.ts +1 -0
  15. package/dist/utils/find-first-truthy.d.ts.map +1 -0
  16. package/dist/utils/get-content-hash.d.ts +1 -0
  17. package/dist/utils/get-content-hash.d.ts.map +1 -0
  18. package/dist/utils/get-file-hash.d.ts +1 -0
  19. package/dist/utils/get-file-hash.d.ts.map +1 -0
  20. package/dist/utils/get-package-version.d.ts +1 -0
  21. package/dist/utils/get-package-version.d.ts.map +1 -0
  22. package/dist/utils/index.d.ts +1 -0
  23. package/dist/utils/index.d.ts.map +1 -0
  24. package/dist/utils/load-tsconfig.d.ts +1 -0
  25. package/dist/utils/load-tsconfig.d.ts.map +1 -0
  26. package/dist/utils/logger.d.ts +1 -0
  27. package/dist/utils/logger.d.ts.map +1 -0
  28. package/dist/utils.d.ts +1 -0
  29. package/dist/utils.d.ts.map +1 -0
  30. package/dist/worker/defaultCache.d.ts +3 -0
  31. package/dist/worker/defaultCache.d.ts.map +1 -0
  32. package/dist/worker/definePageRuntimeCaching.d.ts +16 -0
  33. package/dist/worker/definePageRuntimeCaching.d.ts.map +1 -0
  34. package/package.json +48 -50
  35. package/src/index.ts +241 -0
  36. package/src/index.worker.ts +5 -0
  37. package/src/internal-types.ts +17 -0
  38. package/src/sw-entry-worker.ts +46 -0
  39. package/src/sw-entry.ts +64 -0
  40. package/src/utils/find-first-truthy.ts +15 -0
  41. package/src/utils/get-content-hash.ts +10 -0
  42. package/src/utils/get-file-hash.ts +4 -0
  43. package/src/utils/get-package-version.ts +16 -0
  44. package/src/utils/load-tsconfig.ts +27 -0
  45. package/src/utils/logger.ts +57 -0
  46. package/src/utils.ts +11 -0
  47. package/src/worker/defaultCache.ts +223 -0
  48. package/src/worker/definePageRuntimeCaching.ts +36 -0
  49. package/dist/index.browser.d.cts +0 -2
  50. package/dist/index.browser.d.ts +0 -2
  51. package/dist/index.browser.js +0 -208
  52. package/dist/index.cjs +0 -928
  53. package/dist/index.d.cts +0 -5
  54. package/dist/internal-types.d.cts +0 -9
  55. package/dist/sw-entry-worker.cjs +0 -35
  56. package/dist/sw-entry-worker.d.cts +0 -7
  57. package/dist/sw-entry.cjs +0 -43
  58. package/dist/sw-entry.d.cts +0 -6
  59. package/dist/types.d.cts +0 -81
  60. package/dist/types.d.ts +0 -81
  61. package/dist/utils/find-first-truthy.d.cts +0 -7
  62. package/dist/utils/get-content-hash.d.cts +0 -3
  63. package/dist/utils/get-file-hash.d.cts +0 -3
  64. package/dist/utils/get-package-version.d.cts +0 -6
  65. package/dist/utils/load-tsconfig.d.cts +0 -2
  66. package/dist/utils/logger.d.cts +0 -5
  67. package/dist/utils.d.cts +0 -4
  68. /package/{dist/utils/index.d.cts → src/utils/index.ts} +0 -0
@@ -0,0 +1,5 @@
1
+ import { defaultCache } from "./worker/defaultCache.js";
2
+ import { type DefinePageRuntimeCachingOptions, type PageRuntimeCaching, definePageRuntimeCaching } from "./worker/definePageRuntimeCaching.js";
3
+ export { defaultCache, definePageRuntimeCaching };
4
+ export type { DefinePageRuntimeCachingOptions, PageRuntimeCaching };
5
+ //# sourceMappingURL=index.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.worker.d.ts","sourceRoot":"","sources":["../src/index.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,+BAA+B,EAAE,KAAK,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAE/I,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAClD,YAAY,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,6 +1,26 @@
1
- 'use strict';
1
+ const nonNullable = (value)=>value !== null && value !== undefined;
2
+
3
+ const definePageRuntimeCaching = ({ rscPrefetch, rsc, html })=>{
4
+ const pageRcs = [
5
+ rscPrefetch,
6
+ rsc,
7
+ html
8
+ ];
9
+ if (pageRcs[0]) {
10
+ if (!pageRcs[0].options) pageRcs[0].options = {};
11
+ pageRcs[0].options.cacheName = "pages-rsc-prefetch";
12
+ }
13
+ if (pageRcs[1]) {
14
+ if (!pageRcs[1].options) pageRcs[1].options = {};
15
+ pageRcs[1].options.cacheName = "pages-rsc";
16
+ }
17
+ if (pageRcs[2]) {
18
+ if (!pageRcs[2].options) pageRcs[2].options = {};
19
+ pageRcs[2].options.cacheName = "pages";
20
+ }
21
+ return pageRcs.filter(nonNullable);
22
+ };
2
23
 
3
- // Serwist RuntimeCaching config: https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build#.RuntimeCachingEntry
4
24
  const defaultCache = [
5
25
  {
6
26
  urlPattern: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
@@ -138,9 +158,6 @@ const defaultCache = [
138
158
  },
139
159
  {
140
160
  urlPattern: ({ sameOrigin, url: { pathname } })=>{
141
- // Exclude /api/auth/callback/* to fix OAuth workflow in Safari without having an impact on other environments
142
- // The above route is the default for next-auth, you may need to change it if your OAuth workflow has a different callback route
143
- // Issue: https://github.com/shadowwalker/next-pwa/issues/131#issuecomment-821894809
144
161
  if (!sameOrigin || pathname.startsWith("/api/auth/callback")) {
145
162
  return false;
146
163
  }
@@ -160,33 +177,43 @@ const defaultCache = [
160
177
  networkTimeoutSeconds: 10
161
178
  }
162
179
  },
163
- {
164
- urlPattern: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && request.headers.get("Next-Router-Prefetch") === "1" && sameOrigin && !pathname.startsWith("/api/"),
165
- handler: "NetworkFirst",
166
- options: {
167
- cacheName: "pages-rsc-prefetch",
168
- expiration: {
169
- maxEntries: 32,
170
- maxAgeSeconds: 24 * 60 * 60
180
+ ...definePageRuntimeCaching({
181
+ rscPrefetch: {
182
+ urlPattern: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && request.headers.get("Next-Router-Prefetch") === "1" && sameOrigin && !pathname.startsWith("/api/"),
183
+ handler: "NetworkFirst",
184
+ options: {
185
+ expiration: {
186
+ maxEntries: 32,
187
+ maxAgeSeconds: 24 * 60 * 60
188
+ }
171
189
  }
172
- }
173
- },
174
- {
175
- urlPattern: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && sameOrigin && !pathname.startsWith("/api/"),
176
- handler: "NetworkFirst",
177
- options: {
178
- cacheName: "pages-rsc",
179
- expiration: {
180
- maxEntries: 32,
181
- maxAgeSeconds: 24 * 60 * 60
190
+ },
191
+ rsc: {
192
+ urlPattern: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && sameOrigin && !pathname.startsWith("/api/"),
193
+ handler: "NetworkFirst",
194
+ options: {
195
+ expiration: {
196
+ maxEntries: 32,
197
+ maxAgeSeconds: 24 * 60 * 60
198
+ }
199
+ }
200
+ },
201
+ html: {
202
+ urlPattern: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("Content-Type")?.includes("text/html") && sameOrigin && !pathname.startsWith("/api/"),
203
+ handler: "NetworkFirst",
204
+ options: {
205
+ expiration: {
206
+ maxEntries: 32,
207
+ maxAgeSeconds: 24 * 60 * 60
208
+ }
182
209
  }
183
210
  }
184
- },
211
+ }),
185
212
  {
186
213
  urlPattern: ({ url: { pathname }, sameOrigin })=>sameOrigin && !pathname.startsWith("/api/"),
187
214
  handler: "NetworkFirst",
188
215
  options: {
189
- cacheName: "pages",
216
+ cacheName: "others",
190
217
  expiration: {
191
218
  maxEntries: 32,
192
219
  maxAgeSeconds: 24 * 60 * 60
@@ -207,4 +234,4 @@ const defaultCache = [
207
234
  }
208
235
  ];
209
236
 
210
- exports.defaultCache = defaultCache;
237
+ export { defaultCache, definePageRuntimeCaching };
@@ -1,9 +1,15 @@
1
+ import type { Asset, Compilation } from "webpack";
1
2
  export type SerwistNextOptionsKey = "self.__SERWIST_SW_ENTRY";
2
3
  export interface SerwistNextOptions {
3
4
  sw: string;
4
5
  scope: string;
5
- cacheOnFrontEndNav: boolean;
6
+ cacheOnNavigation: boolean;
6
7
  register: boolean;
7
8
  reloadOnOnline: boolean;
8
9
  swEntryWorker: string | undefined;
9
10
  }
11
+ export interface ExcludeParams {
12
+ asset: Asset;
13
+ compilation: Compilation;
14
+ }
15
+ //# sourceMappingURL=internal-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["../src/internal-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;CAC1B"}
@@ -5,3 +5,4 @@ export type MessageType = {
5
5
  type: "__START_URL_CACHE__";
6
6
  url: URL | string;
7
7
  };
8
+ //# sourceMappingURL=sw-entry-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sw-entry-worker.d.ts","sourceRoot":"","sources":["../src/sw-entry-worker.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GACnB;IACE,IAAI,EAAE,wBAAwB,CAAC;IAC/B,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;CACnB,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;CACnB,CAAC"}
@@ -4,3 +4,4 @@ declare global {
4
4
  serwist: Serwist;
5
5
  }
6
6
  }
7
+ //# sourceMappingURL=sw-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sw-entry.d.ts","sourceRoot":"","sources":["../src/sw-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAK1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,EAAE,OAAO,CAAC;KAClB;CACF"}
package/dist/sw-entry.js CHANGED
@@ -11,8 +11,8 @@ if (typeof window !== "undefined" && "serviceWorker" in navigator && typeof cach
11
11
  if (self.__SERWIST_SW_ENTRY.register) {
12
12
  window.serwist.register();
13
13
  }
14
- if (self.__SERWIST_SW_ENTRY.cacheOnFrontEndNav) {
15
- const cacheOnFrontEndNav = async (url)=>{
14
+ if (self.__SERWIST_SW_ENTRY.cacheOnNavigation) {
15
+ const cacheOnNavigation = async (url)=>{
16
16
  if (!window.navigator.onLine || !url) {
17
17
  return;
18
18
  }
@@ -24,15 +24,15 @@ if (typeof window !== "undefined" && "serviceWorker" in navigator && typeof cach
24
24
  const pushState = history.pushState;
25
25
  history.pushState = (...args)=>{
26
26
  pushState.apply(history, args);
27
- cacheOnFrontEndNav(args[2]);
27
+ cacheOnNavigation(args[2]);
28
28
  };
29
29
  const replaceState = history.replaceState;
30
30
  history.replaceState = (...args)=>{
31
31
  replaceState.apply(history, args);
32
- cacheOnFrontEndNav(args[2]);
32
+ cacheOnNavigation(args[2]);
33
33
  };
34
34
  window.addEventListener("online", ()=>{
35
- cacheOnFrontEndNav(window.location.pathname);
35
+ cacheOnNavigation(window.location.pathname);
36
36
  });
37
37
  }
38
38
  if (self.__SERWIST_SW_ENTRY.reloadOnOnline) {
@@ -5,3 +5,4 @@
5
5
  * @returns
6
6
  */
7
7
  export declare const findFirstTruthy: <T, U>(arr: T[], fn: (elm: T) => U) => NonNullable<U> | undefined;
8
+ //# sourceMappingURL=find-first-truthy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-first-truthy.d.ts","sourceRoot":"","sources":["../../src/utils/find-first-truthy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,mEAQ3B,CAAC"}
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import type fs from "node:fs";
3
3
  export declare const getContentHash: (file: fs.PathOrFileDescriptor, isDev: boolean) => string;
4
+ //# sourceMappingURL=get-content-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/utils/get-content-hash.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,eAAO,MAAM,cAAc,SAAU,GAAG,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import fs from "node:fs";
3
3
  export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
4
+ //# sourceMappingURL=get-file-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/utils/get-file-hash.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,SAAU,GAAG,oBAAoB,WAAyE,CAAC"}
@@ -4,3 +4,4 @@
4
4
  * @returns
5
5
  */
6
6
  export declare const getPackageVersion: (packageName: string) => string | undefined;
7
+ //# sourceMappingURL=get-package-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-package-version.d.ts","sourceRoot":"","sources":["../../src/utils/get-package-version.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,KAAG,MAAM,GAAG,SAMhE,CAAC"}
@@ -4,3 +4,4 @@ export { getFileHash } from "./get-file-hash.js";
4
4
  export { getPackageVersion } from "./get-package-version.js";
5
5
  export { loadTSConfig } from "./load-tsconfig.js";
6
6
  export * as logger from "./logger.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import type { TsConfigJson as TSConfigJSON } from "type-fest";
2
2
  export declare const loadTSConfig: (baseDir: string, relativeTSConfigPath: string | undefined) => TSConfigJSON | undefined;
3
+ //# sourceMappingURL=load-tsconfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-tsconfig.d.ts","sourceRoot":"","sources":["../../src/utils/load-tsconfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9D,eAAO,MAAM,YAAY,YAAa,MAAM,wBAAwB,MAAM,GAAG,SAAS,KAAG,YAAY,GAAG,SAmBvG,CAAC"}
@@ -3,3 +3,4 @@ export declare const error: (...message: any[]) => void;
3
3
  export declare const warn: (...message: any[]) => void;
4
4
  export declare const info: (...message: any[]) => void;
5
5
  export declare const event: (...message: any[]) => void;
6
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,IAAI,eAAgB,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,KAAK,eAAgB,GAAG,EAAE,SAEtC,CAAC;AAEF,eAAO,MAAM,IAAI,eAAgB,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,IAAI,eAAgB,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,KAAK,eAAgB,GAAG,EAAE,SAEtC,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -2,3 +2,4 @@
2
2
  import fs from "node:fs";
3
3
  export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
4
4
  export declare const getContentHash: (file: fs.PathOrFileDescriptor, isDev: boolean) => string;
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,SAAU,GAAG,oBAAoB,WAAyE,CAAC;AAEnI,eAAO,MAAM,cAAc,SAAU,GAAG,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RuntimeCaching } from "@serwist/sw";
2
+ export declare const defaultCache: RuntimeCaching[];
3
+ //# sourceMappingURL=defaultCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,eAAO,MAAM,YAAY,kBA0NG,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { RuntimeCaching } from "@serwist/sw";
2
+ export interface PageRuntimeCaching extends Omit<RuntimeCaching, "options"> {
3
+ options?: Omit<NonNullable<RuntimeCaching["options"]>, "cacheName">;
4
+ }
5
+ export interface DefinePageRuntimeCachingOptions {
6
+ rscPrefetch?: PageRuntimeCaching;
7
+ rsc?: PageRuntimeCaching;
8
+ html?: PageRuntimeCaching;
9
+ }
10
+ /**
11
+ * Conveniently define three `runtimeCaching` entries for Next.js pages.
12
+ * @param options
13
+ * @returns
14
+ */
15
+ export declare const definePageRuntimeCaching: ({ rscPrefetch, rsc, html }: DefinePageRuntimeCachingOptions) => RuntimeCaching[];
16
+ //# sourceMappingURL=definePageRuntimeCaching.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definePageRuntimeCaching.d.ts","sourceRoot":"","sources":["../../src/worker/definePageRuntimeCaching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC;IACzE,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,+BAA+B;IAC9C,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,+BAAgC,+BAA+B,KAAG,cAAc,EAiBpH,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "8.4.4",
3
+ "version": "9.0.0-preview.1",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
7
- "dist",
8
- "!dist/dts"
7
+ "src",
8
+ "dist"
9
9
  ],
10
10
  "keywords": [
11
11
  "serwist",
@@ -15,77 +15,75 @@
15
15
  "web",
16
16
  "service-worker"
17
17
  ],
18
+ "engines": {
19
+ "node": ">=18.0.0"
20
+ },
18
21
  "author": "Serwist's Team",
19
22
  "license": "MIT",
20
23
  "repository": "serwist/serwist",
21
24
  "bugs": "https://github.com/serwist/serwist/issues",
22
25
  "homepage": "https://serwist.pages.dev",
23
- "module": "./dist/index.js",
24
- "main": "./dist/index.cjs",
26
+ "main": "./dist/index.js",
25
27
  "types": "./dist/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "import": {
29
- "types": "./dist/index.d.ts",
30
- "default": "./dist/index.js"
31
- },
32
- "require": {
33
- "types": "./dist/index.d.cts",
34
- "default": "./dist/index.cjs"
35
- }
36
- },
37
- "./browser": {
38
- "import": {
39
- "types": "./dist/index.browser.d.ts",
40
- "default": "./dist/index.browser.js"
41
- },
42
- "require": {
43
- "types": "./dist/index.browser.d.cts",
44
- "default": "./dist/index.browser.cjs"
45
- }
46
- },
47
- "./typings": {
48
- "import": {
49
- "types": "./dist/sw-entry.d.ts"
50
- },
51
- "require": {
52
- "types": "./dist/sw-entry.d.cts"
53
- }
54
- },
55
- "./package.json": "./package.json"
56
- },
57
28
  "typesVersions": {
58
29
  "*": {
59
- "browser": [
60
- "./dist/index.browser.d.ts"
30
+ "worker": [
31
+ "./dist/index.worker.d.ts"
61
32
  ],
62
33
  "typings": [
63
34
  "./dist/sw-entry.d.ts"
64
35
  ]
65
36
  }
66
37
  },
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "default": "./dist/index.js"
42
+ },
43
+ "./worker": {
44
+ "types": "./dist/index.worker.d.ts",
45
+ "default": "./dist/index.worker.js"
46
+ },
47
+ "./typings": {
48
+ "types": "./dist/sw-entry.d.ts"
49
+ },
50
+ "./package.json": "./package.json"
51
+ },
67
52
  "dependencies": {
53
+ "chalk": "5.3.0",
68
54
  "clean-webpack-plugin": "4.0.0",
69
55
  "fast-glob": "3.3.2",
70
- "@serwist/build": "8.4.4",
71
- "@serwist/webpack-plugin": "8.4.4",
72
- "@serwist/window": "8.4.4"
56
+ "@serwist/build": "9.0.0-preview.1",
57
+ "@serwist/core": "9.0.0-preview.1",
58
+ "@serwist/webpack-plugin": "9.0.0-preview.1",
59
+ "@serwist/window": "9.0.0-preview.1"
73
60
  },
74
61
  "devDependencies": {
75
- "@types/node": "20.10.5",
76
- "chalk": "5.3.0",
77
- "next": "14.0.4",
62
+ "@types/node": "20.11.16",
63
+ "next": "14.1.0",
78
64
  "react": "18.2.0",
79
65
  "react-dom": "18.2.0",
80
- "rollup": "4.9.1",
81
- "type-fest": "4.8.3",
82
- "typescript": "5.4.0-dev.20231226",
83
- "webpack": "5.89.0",
84
- "@serwist/constants": "8.4.4"
66
+ "rollup": "4.9.6",
67
+ "type-fest": "4.10.2",
68
+ "typescript": "5.4.0-dev.20240203",
69
+ "webpack": "5.90.1",
70
+ "@serwist/constants": "9.0.0-preview.1",
71
+ "@serwist/sw": "9.0.0-preview.1",
72
+ "@serwist/utils": "9.0.0-preview.1"
85
73
  },
86
74
  "peerDependencies": {
87
75
  "next": ">=14.0.0",
88
- "webpack": ">=5.9.0"
76
+ "typescript": ">=5.0.0",
77
+ "webpack": ">=5.9.0",
78
+ "@serwist/sw": "9.0.0-preview.1"
79
+ },
80
+ "peerDependenciesMeta": {
81
+ "@serwist/sw": {
82
+ "optional": true
83
+ },
84
+ "typescript": {
85
+ "optional": true
86
+ }
89
87
  },
90
88
  "scripts": {
91
89
  "build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",