@serwist/turbopack 9.4.4 → 9.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,qBAAqB,EAAiC,MAAM,YAAY,CAAC;AAuCvF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,qBAAqB;;;;;;;aAoFzC,OAAO,cAAc;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CAajF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,qBAAqB,EAAiC,MAAM,YAAY,CAAC;AAuCvF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,qBAAqB;;;;;;;aAoFzC,OAAO,cAAc;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CAajF,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { rebasePath, getFileManifestEntries } from '@serwist/build';
3
3
  import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
4
+ import { toUnix } from '@serwist/utils';
4
5
  import { green, bold, white, yellow, red, cyan, dim } from 'kolorist';
5
6
  import { NextResponse } from 'next/server.js';
6
7
  import { z } from 'zod';
@@ -104,7 +105,7 @@ const createSerwistRoute = (options)=>{
104
105
  ],
105
106
  manifestTransforms: [
106
107
  ...config.manifestTransforms ?? [],
107
- (manifestEntries)=>{
108
+ async (manifestEntries)=>{
108
109
  const manifest = manifestEntries.map((m)=>{
109
110
  if (m.url.startsWith(config.nextConfig.distDir)) {
110
111
  m.url = `${config.nextConfig.assetPrefix ?? ""}/_next/${m.url.slice(config.nextConfig.distDir.length)}`;
@@ -154,14 +155,14 @@ const createSerwistRoute = (options)=>{
154
155
  [injectionPoint]: manifestString
155
156
  } : {}
156
157
  },
157
- outdir: config.cwd,
158
+ outdir: toUnix(config.cwd),
158
159
  write: false,
159
160
  entryNames: "[name]",
160
161
  assetNames: "[name]-[hash]",
161
162
  chunkNames: "[name]-[hash]",
162
163
  entryPoints: [
163
164
  {
164
- in: config.swSrc,
165
+ in: toUnix(config.swSrc),
165
166
  out: "sw"
166
167
  }
167
168
  ]
@@ -182,10 +183,10 @@ const createSerwistRoute = (options)=>{
182
183
  const config = await validation;
183
184
  if (!map) map = await loadMap("root");
184
185
  return [
185
- ...map.keys().map((e)=>({
186
- path: path.relative(config.cwd, e)
187
- }))
188
- ];
186
+ ...map.keys()
187
+ ].map((e)=>({
188
+ path: path.relative(config.cwd, e)
189
+ }));
189
190
  };
190
191
  const GET = async (_, { params })=>{
191
192
  const { path: filePath } = await params;
@@ -5,7 +5,7 @@ export declare const turboPartial: z.ZodObject<{
5
5
  assetPrefix: z.ZodOptional<z.ZodString>;
6
6
  basePath: z.ZodPrefault<z.ZodString>;
7
7
  distDir: z.ZodPrefault<z.ZodString>;
8
- }, z.z.core.$strict>;
8
+ }, z.z.core.$strip>;
9
9
  esbuildOptions: z.ZodPrefault<z.ZodRecord<z.ZodLiteral<"bundle" | "splitting" | "preserveSymlinks" | "external" | "packages" | "alias" | "loader" | "resolveExtensions" | "mainFields" | "conditions" | "allowOverwrite" | "tsconfig" | "outExtension" | "publicPath" | "inject" | "banner" | "footer" | "plugins" | "sourcemap" | "legalComments" | "sourceRoot" | "sourcesContent" | "format" | "globalName" | "target" | "supported" | "mangleProps" | "reserveProps" | "mangleQuoted" | "mangleCache" | "drop" | "dropLabels" | "minify" | "minifyWhitespace" | "minifyIdentifiers" | "minifySyntax" | "lineLimit" | "charset" | "treeShaking" | "ignoreAnnotations" | "jsx" | "jsxFactory" | "jsxFragment" | "jsxImportSource" | "jsxDev" | "jsxSideEffects" | "define" | "pure" | "keepNames" | "absPaths" | "color" | "logLevel" | "logLimit" | "logOverride" | "tsconfigRaw"> & z.z.core.$partial, z.ZodAny>>;
10
10
  }, z.z.core.$strict>;
11
11
  export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
@@ -15,7 +15,7 @@ export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
15
15
  assetPrefix: z.ZodOptional<z.ZodString>;
16
16
  basePath: z.ZodPrefault<z.ZodString>;
17
17
  distDir: z.ZodPrefault<z.ZodString>;
18
- }, z.z.core.$strict>;
18
+ }, z.z.core.$strip>;
19
19
  additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
20
20
  integrity: z.ZodOptional<z.ZodString>;
21
21
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -48,7 +48,7 @@ export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
48
48
  url: z.ZodString;
49
49
  }, z.z.core.$strip>>;
50
50
  warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
51
- }, z.z.core.$strict>>>, z.ZodTransform<z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
51
+ }, z.z.core.$strict>>>, z.ZodTransform<z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
52
52
  size: z.ZodNumber;
53
53
  integrity: z.ZodOptional<z.ZodString>;
54
54
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -107,7 +107,7 @@ export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
107
107
  integrity?: string | undefined;
108
108
  revision?: string | null | undefined;
109
109
  })[] | undefined;
110
- manifestTransforms?: z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
110
+ manifestTransforms?: z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
111
111
  size: z.ZodNumber;
112
112
  integrity: z.ZodOptional<z.ZodString>;
113
113
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -143,7 +143,7 @@ export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
143
143
  revision?: string | null | undefined;
144
144
  })[] | undefined;
145
145
  dontCacheBustURLsMatching?: RegExp | undefined;
146
- manifestTransforms?: z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
146
+ manifestTransforms?: z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
147
147
  size: z.ZodNumber;
148
148
  integrity: z.ZodOptional<z.ZodString>;
149
149
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -67,7 +67,7 @@ const generateGlobPatterns = (distDir)=>[
67
67
 
68
68
  const turboPartial = z.strictObject({
69
69
  cwd: z.string().prefault(process.cwd()),
70
- nextConfig: z.strictObject({
70
+ nextConfig: z.object({
71
71
  assetPrefix: z.string().optional(),
72
72
  basePath: z.string().prefault("/"),
73
73
  distDir: z.string().prefault(".next")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/turbopack",
3
- "version": "9.4.4",
3
+ "version": "9.5.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "A module that integrates Serwist into your Next.js / Turbopack application.",
@@ -63,27 +63,27 @@
63
63
  "./package.json": "./package.json"
64
64
  },
65
65
  "dependencies": {
66
- "@swc/core": "1.15.7",
66
+ "@swc/core": "1.15.11",
67
67
  "kolorist": "1.8.0",
68
68
  "semver": "7.7.3",
69
- "zod": "4.2.1",
70
- "@serwist/build": "9.4.4",
71
- "@serwist/window": "9.4.4",
72
- "@serwist/utils": "9.4.4",
73
- "serwist": "9.4.4"
69
+ "zod": "4.3.6",
70
+ "@serwist/utils": "9.5.1",
71
+ "@serwist/window": "9.5.1",
72
+ "serwist": "9.5.1",
73
+ "@serwist/build": "9.5.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@types/node": "25.0.3",
77
- "@types/react": "19.2.7",
76
+ "@types/node": "25.1.0",
77
+ "@types/react": "19.2.10",
78
78
  "@types/semver": "7.7.1",
79
79
  "esbuild-wasm": "0.27.2",
80
- "next": "16.1.0",
81
- "react": "19.2.3",
82
- "react-dom": "19.2.3",
83
- "rollup": "4.54.0",
84
- "type-fest": "5.3.1",
80
+ "next": "16.1.6",
81
+ "react": "19.2.4",
82
+ "react-dom": "19.2.4",
83
+ "rollup": "4.57.0",
84
+ "type-fest": "5.4.2",
85
85
  "typescript": "5.9.3",
86
- "@serwist/configs": "9.4.4"
86
+ "@serwist/configs": "9.5.1"
87
87
  },
88
88
  "peerDependencies": {
89
89
  "esbuild-wasm": ">=0.25.0 <1.0.0",
@@ -7,7 +7,7 @@ import type { InjectManifestOptions, InjectManifestOptionsComplete, TurboPartial
7
7
 
8
8
  export const turboPartial = z.strictObject({
9
9
  cwd: z.string().prefault(process.cwd()),
10
- nextConfig: z.strictObject({
10
+ nextConfig: z.object({
11
11
  assetPrefix: z.string().optional(),
12
12
  basePath: z.string().prefault("/"),
13
13
  distDir: z.string().prefault(".next"),
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  import path from "node:path";
5
5
  import { type BuildResult, getFileManifestEntries, rebasePath } from "@serwist/build";
6
6
  import { SerwistConfigError, validationErrorMap } from "@serwist/build/schema";
7
+ import { toUnix } from "@serwist/utils";
7
8
  import { cyan, dim, yellow } from "kolorist";
8
9
  import { NextResponse } from "next/server.js";
9
10
  import { z } from "zod";
@@ -11,7 +12,7 @@ import { injectManifestOptions } from "./index.schema.js";
11
12
  import { logger } from "./lib/index.js";
12
13
  import type { InjectManifestOptions, InjectManifestOptionsComplete } from "./types.js";
13
14
 
14
- // TODO(workarond): `esbuild` doesn't load when in Turbopack production
15
+ // TODO(workaround): `esbuild` doesn't load when in Turbopack production
15
16
  const esbuild = import("esbuild-wasm");
16
17
 
17
18
  const logSerwistResult = (filePath: string, buildResult: Pick<BuildResult, "count" | "size" | "warnings">) => {
@@ -71,7 +72,7 @@ export const createSerwistRoute = (options: InjectManifestOptions) => {
71
72
  ],
72
73
  manifestTransforms: [
73
74
  ...(config.manifestTransforms ?? []),
74
- (manifestEntries) => {
75
+ async (manifestEntries) => {
75
76
  const manifest = manifestEntries.map((m) => {
76
77
  // Replace all references to "$(distDir)" with "$(assetPrefix)/_next/".
77
78
  if (m.url.startsWith(config.nextConfig.distDir)) {
@@ -112,7 +113,7 @@ export const createSerwistRoute = (options: InjectManifestOptions) => {
112
113
  ...config.esbuildOptions.define,
113
114
  ...(injectionPoint ? { [injectionPoint]: manifestString } : {}),
114
115
  },
115
- outdir: config.cwd,
116
+ outdir: toUnix(config.cwd),
116
117
  write: false,
117
118
  entryNames: "[name]",
118
119
  // Asset and chunk names must be at the top, as our path is `/serwist/[path]`,
@@ -120,7 +121,7 @@ export const createSerwistRoute = (options: InjectManifestOptions) => {
120
121
  // than one level.
121
122
  assetNames: "[name]-[hash]",
122
123
  chunkNames: "[name]-[hash]",
123
- entryPoints: [{ in: config.swSrc, out: "sw" }],
124
+ entryPoints: [{ in: toUnix(config.swSrc), out: "sw" }],
124
125
  });
125
126
  if (result.errors.length) {
126
127
  console.error("Failed to build the service worker.", result.errors);
@@ -134,7 +135,7 @@ export const createSerwistRoute = (options: InjectManifestOptions) => {
134
135
  const generateStaticParams = async () => {
135
136
  const config = await validation;
136
137
  if (!map) map = await loadMap("root");
137
- return [...map.keys().map((e) => ({ path: path.relative(config.cwd, e) }))];
138
+ return [...map.keys()].map((e) => ({ path: path.relative(config.cwd, e) }));
138
139
  };
139
140
  const GET = async (_: Request, { params }: { params: Promise<{ path: string }> }) => {
140
141
  // TODO: obviously, files get stale in development when we pull this off.