@serwist/next 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/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.1.0-preview.0",
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.1.0-preview.0",
69
+ "@serwist/webpack-plugin": "9.1.0-preview.0",
70
+ "@serwist/window": "9.1.0-preview.0",
71
+ "serwist": "9.1.0-preview.0"
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.1.0-preview.0",
83
+ "@serwist/utils": "9.1.0-preview.0"
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.
@@ -66,7 +66,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
66
66
  } satisfies Record<`${SerwistNextOptionsKey}.${Exclude<keyof SerwistNextOptions, "swEntryWorker">}`, string | undefined>),
67
67
  );
68
68
 
69
- const swEntryJs = path.join(__dirname, "sw-entry.js");
69
+ const swEntryJs = path.join(dirname, "sw-entry.js");
70
70
  const entry = config.entry as () => Promise<Record<string, string[] | string>>;
71
71
  config.entry = async () => {
72
72
  const entries = await entry();
@@ -142,7 +142,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
142
142
  let swEntryWorkerDest: string | undefined = undefined;
143
143
 
144
144
  if (shouldBuildSWEntryWorker) {
145
- const swEntryWorkerSrc = path.join(__dirname, "sw-entry-worker.js");
145
+ const swEntryWorkerSrc = path.join(dirname, "sw-entry-worker.js");
146
146
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
147
147
  swEntryPublicPath = path.posix.join(basePath, swEntryName);
148
148
  swEntryWorkerDest = path.join(destDir, swEntryName);