@serwist/next 9.0.9 → 9.0.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAInE;;;;GAIG;AACH,QAAA,MAAM,eAAe,gBAAiB,qBAAqB,KAAG,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,KAAK,UAAU,CAoNrG,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAInE;;;;GAIG;AACH,QAAA,MAAM,eAAe,gBAAiB,qBAAqB,KAAG,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,KAAK,UAAU,CAqNrG,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -97,7 +97,7 @@ const validateInjectManifestOptions = (input)=>{
97
97
  return result.data;
98
98
  };
99
99
 
100
- const __dirname = fileURLToPath(new URL(".", import.meta.url));
100
+ const dirname = "__dirname" in globalThis ? __dirname : fileURLToPath(new URL(".", import.meta.url));
101
101
  const withSerwistInit = (userOptions)=>{
102
102
  return (nextConfig = {})=>({
103
103
  ...nextConfig,
@@ -126,7 +126,7 @@ const withSerwistInit = (userOptions)=>{
126
126
  "self.__SERWIST_SW_ENTRY.register": `${register}`,
127
127
  "self.__SERWIST_SW_ENTRY.reloadOnOnline": `${reloadOnOnline}`
128
128
  }));
129
- const swEntryJs = path.join(__dirname, "sw-entry.js");
129
+ const swEntryJs = path.join(dirname, "sw-entry.js");
130
130
  const entry = config.entry;
131
131
  config.entry = async ()=>{
132
132
  const entries = await entry();
@@ -191,7 +191,7 @@ const withSerwistInit = (userOptions)=>{
191
191
  let swEntryPublicPath = undefined;
192
192
  let swEntryWorkerDest = undefined;
193
193
  if (shouldBuildSWEntryWorker) {
194
- const swEntryWorkerSrc = path.join(__dirname, "sw-entry-worker.js");
194
+ const swEntryWorkerSrc = path.join(dirname, "sw-entry-worker.js");
195
195
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
196
196
  swEntryPublicPath = path.posix.join(basePath, swEntryName);
197
197
  swEntryWorkerDest = path.join(destDir, swEntryName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "9.0.9",
3
+ "version": "9.0.10",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
@@ -65,22 +65,22 @@
65
65
  "chalk": "5.3.0",
66
66
  "glob": "10.4.5",
67
67
  "zod": "3.23.8",
68
- "@serwist/build": "9.0.9",
69
- "@serwist/webpack-plugin": "9.0.9",
70
- "@serwist/window": "9.0.9",
71
- "serwist": "9.0.9"
68
+ "@serwist/build": "9.0.10",
69
+ "@serwist/webpack-plugin": "9.0.10",
70
+ "@serwist/window": "9.0.10",
71
+ "serwist": "9.0.10"
72
72
  },
73
73
  "devDependencies": {
74
- "@types/node": "22.7.4",
75
- "next": "14.2.13",
74
+ "@types/node": "22.8.6",
75
+ "next": "15.0.2",
76
76
  "react": "18.3.1",
77
77
  "react-dom": "18.3.1",
78
- "rollup": "4.22.5",
78
+ "rollup": "4.24.3",
79
79
  "type-fest": "4.26.1",
80
- "typescript": "5.6.2",
81
- "webpack": "5.95.0",
82
- "@serwist/configs": "9.0.9",
83
- "@serwist/utils": "9.0.9"
80
+ "typescript": "5.6.3",
81
+ "webpack": "5.96.1",
82
+ "@serwist/configs": "9.0.10",
83
+ "@serwist/utils": "9.0.10"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "next": ">=14.0.0",
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ import { getContentHash, getFileHash, loadTSConfig, logger } from "./lib/index.j
11
11
  import type { InjectManifestOptions, InjectManifestOptionsComplete } from "./lib/types.js";
12
12
  import { validateInjectManifestOptions } from "./lib/validator.js";
13
13
 
14
- const __dirname = fileURLToPath(new URL(".", import.meta.url));
14
+ const dirname = "__dirname" in globalThis ? __dirname : fileURLToPath(new URL(".", import.meta.url));
15
15
 
16
16
  /**
17
17
  * Integrates Serwist into your Next.js app.
@@ -19,6 +19,7 @@ const __dirname = fileURLToPath(new URL(".", import.meta.url));
19
19
  * @returns
20
20
  */
21
21
  const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: NextConfig) => NextConfig) => {
22
+
22
23
  return (nextConfig = {}) => ({
23
24
  ...nextConfig,
24
25
  webpack(config: Configuration, options) {
@@ -66,7 +67,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
66
67
  } satisfies Record<`${SerwistNextOptionsKey}.${Exclude<keyof SerwistNextOptions, "swEntryWorker">}`, string | undefined>),
67
68
  );
68
69
 
69
- const swEntryJs = path.join(__dirname, "sw-entry.js");
70
+ const swEntryJs = path.join(dirname, "sw-entry.js");
70
71
  const entry = config.entry as () => Promise<Record<string, string[] | string>>;
71
72
  config.entry = async () => {
72
73
  const entries = await entry();
@@ -142,7 +143,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
142
143
  let swEntryWorkerDest: string | undefined = undefined;
143
144
 
144
145
  if (shouldBuildSWEntryWorker) {
145
- const swEntryWorkerSrc = path.join(__dirname, "sw-entry-worker.js");
146
+ const swEntryWorkerSrc = path.join(dirname, "sw-entry-worker.js");
146
147
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
147
148
  swEntryPublicPath = path.posix.join(basePath, swEntryName);
148
149
  swEntryWorkerDest = path.join(destDir, swEntryName);