@serwist/next 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/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.worker.js +1 -1
- package/dist/lib/find-first-truthy.d.ts.map +1 -1
- package/dist/lib/get-content-hash.d.ts.map +1 -1
- package/dist/lib/get-file-hash.d.ts.map +1 -1
- package/dist/lib/get-package-version.d.ts.map +1 -1
- package/dist/lib/load-tsconfig.d.ts.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +14 -20
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/types.d.ts +4 -4
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/validator.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/index.ts +14 -2
- package/src/lib/types.ts +7 -6
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAMnE;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,aAAa,qBAAqB,KAAG,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,KAAK,UAAU,CA8NrG,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
|
@@ -98,7 +98,12 @@ const validateInjectManifestOptions = (input)=>{
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
const dirname = "__dirname" in globalThis ? __dirname : fileURLToPath(new URL(".", import.meta.url));
|
|
101
|
+
let warnedTurbopack = false;
|
|
101
102
|
const withSerwistInit = (userOptions)=>{
|
|
103
|
+
if (!warnedTurbopack && process.env.TURBOPACK && !userOptions.disable && !process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING) {
|
|
104
|
+
warnedTurbopack = true;
|
|
105
|
+
console.warn(`[@serwist/next] WARNING: You are using '@serwist/next' with \`next dev --turbopack\`, but Serwist doesn't support Turbopack at the moment. It is recommended that you set \`disable\` to \`process.env.NODE_ENV !== \"production\"\`. Follow https://github.com/serwist/serwist/issues/54 for progress on Serwist + Turbopack. You can also suppress this warning by setting SERWIST_SUPPRESS_TURBOPACK_WARNING=1.`);
|
|
106
|
+
}
|
|
102
107
|
return (nextConfig = {})=>({
|
|
103
108
|
...nextConfig,
|
|
104
109
|
webpack (config, options) {
|
|
@@ -231,7 +236,7 @@ const withSerwistInit = (userOptions)=>{
|
|
|
231
236
|
({ asset, compilation })=>{
|
|
232
237
|
const swDestRelativeOutput = relativeToOutputPath(compilation, swDest);
|
|
233
238
|
const swAsset = compilation.getAsset(swDestRelativeOutput);
|
|
234
|
-
return asset.name === swAsset?.name || asset.name.startsWith("server/") || /^
|
|
239
|
+
return asset.name === swAsset?.name || asset.name.startsWith("server/") || /^[^\/]*\.json$/.test(asset.name) || dev && !asset.name.startsWith("static/runtime/");
|
|
235
240
|
}
|
|
236
241
|
],
|
|
237
242
|
manifestTransforms: [
|
|
@@ -244,7 +249,7 @@ const withSerwistInit = (userOptions)=>{
|
|
|
244
249
|
if (m.url.startsWith(publicFilesPrefix)) {
|
|
245
250
|
m.url = path.posix.join(basePath, m.url.replace(publicFilesPrefix, ""));
|
|
246
251
|
}
|
|
247
|
-
m.url = m.url.replace(/\[/g, "%5B").replace(/\]/g, "%5D");
|
|
252
|
+
m.url = m.url.replace(/\[/g, "%5B").replace(/\]/g, "%5D").replace(/@/g, "%40");
|
|
248
253
|
return m;
|
|
249
254
|
});
|
|
250
255
|
return {
|
package/dist/index.worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkOnly, CacheFirst,
|
|
1
|
+
import { NetworkOnly, CacheFirst, StaleWhileRevalidate, NetworkFirst, ExpirationPlugin, RangeRequestsPlugin } from 'serwist';
|
|
2
2
|
|
|
3
3
|
const PAGES_CACHE_NAME = {
|
|
4
4
|
rscPrefetch: "pages-rsc-prefetch",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-first-truthy.d.ts","sourceRoot":"","sources":["../../src/lib/find-first-truthy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"find-first-truthy.d.ts","sourceRoot":"","sources":["../../src/lib/find-first-truthy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,+BAQhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,GAAI,MAAM,EAAE,CAAC,oBAAoB,WAAyE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-package-version.d.ts","sourceRoot":"","sources":["../../src/lib/get-package-version.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"get-package-version.d.ts","sourceRoot":"","sources":["../../src/lib/get-package-version.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MAAM,GAAG,SAMhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-tsconfig.d.ts","sourceRoot":"","sources":["../../src/lib/load-tsconfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9D,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"load-tsconfig.d.ts","sourceRoot":"","sources":["../../src/lib/load-tsconfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9D,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,YAAY,GAAG,SAevG,CAAC"}
|
package/dist/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,GAAG,SAAS,GAAG,EAAE,SAEtC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAErC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,GAAG,SAAS,GAAG,EAAE,SAEtC,CAAC"}
|
package/dist/lib/schema.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const injectPartial: z.ZodObject<{
|
|
|
24
24
|
swUrl?: string | undefined;
|
|
25
25
|
globPublicPatterns?: string[] | undefined;
|
|
26
26
|
}>;
|
|
27
|
-
export declare const injectManifestOptions: z.ZodObject<Omit<
|
|
27
|
+
export declare const injectManifestOptions: z.ZodObject<Omit<{
|
|
28
28
|
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
29
29
|
integrity: z.ZodOptional<z.ZodString>;
|
|
30
30
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -40,13 +40,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
40
40
|
}>]>, "many">>;
|
|
41
41
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
42
42
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
43
|
-
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<
|
|
43
|
+
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
44
44
|
integrity: z.ZodOptional<z.ZodString>;
|
|
45
45
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
46
|
url: z.ZodString;
|
|
47
|
-
}
|
|
47
|
+
} & {
|
|
48
48
|
size: z.ZodNumber;
|
|
49
|
-
}
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
50
|
url: string;
|
|
51
51
|
size: number;
|
|
52
52
|
integrity?: string | undefined;
|
|
@@ -57,13 +57,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
57
57
|
integrity?: string | undefined;
|
|
58
58
|
revision?: string | null | undefined;
|
|
59
59
|
}>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
|
|
60
|
-
manifest: z.ZodArray<z.ZodObject<
|
|
60
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
61
61
|
integrity: z.ZodOptional<z.ZodString>;
|
|
62
62
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
63
|
url: z.ZodString;
|
|
64
|
-
}
|
|
64
|
+
} & {
|
|
65
65
|
size: z.ZodNumber;
|
|
66
|
-
}
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
67
|
url: string;
|
|
68
68
|
size: number;
|
|
69
69
|
integrity?: string | undefined;
|
|
@@ -92,13 +92,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
92
92
|
}[];
|
|
93
93
|
warnings?: string[] | undefined;
|
|
94
94
|
}>>, z.ZodObject<{
|
|
95
|
-
manifest: z.ZodArray<z.ZodObject<
|
|
95
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
96
96
|
integrity: z.ZodOptional<z.ZodString>;
|
|
97
97
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
98
|
url: z.ZodString;
|
|
99
|
-
}
|
|
99
|
+
} & {
|
|
100
100
|
size: z.ZodNumber;
|
|
101
|
-
}
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
102
|
url: string;
|
|
103
103
|
size: number;
|
|
104
104
|
integrity?: string | undefined;
|
|
@@ -129,23 +129,17 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
129
129
|
}>]>>, "many">>;
|
|
130
130
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
131
131
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
132
|
-
}, {
|
|
133
132
|
chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
134
133
|
exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
|
|
135
134
|
excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
136
135
|
include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
|
|
137
|
-
}>, {
|
|
138
136
|
injectionPoint: z.ZodDefault<z.ZodString>;
|
|
139
137
|
swSrc: z.ZodString;
|
|
140
|
-
}>, {
|
|
141
|
-
swDest: z.ZodOptional<z.ZodString>;
|
|
142
|
-
}>, {
|
|
143
138
|
compileSrc: z.ZodDefault<z.ZodBoolean>;
|
|
144
|
-
swDest: z.ZodOptional<z.ZodString>;
|
|
145
139
|
webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
146
|
-
}
|
|
140
|
+
} & {
|
|
147
141
|
swDest: z.ZodString;
|
|
148
|
-
}
|
|
142
|
+
} & {
|
|
149
143
|
cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
|
|
150
144
|
disable: z.ZodDefault<z.ZodBoolean>;
|
|
151
145
|
register: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -153,7 +147,7 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
153
147
|
scope: z.ZodOptional<z.ZodString>;
|
|
154
148
|
swUrl: z.ZodDefault<z.ZodString>;
|
|
155
149
|
globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
156
|
-
}
|
|
150
|
+
}, "disablePrecacheManifest">, "strict", z.ZodTypeAny, {
|
|
157
151
|
cacheOnNavigation: boolean;
|
|
158
152
|
disable: boolean;
|
|
159
153
|
register: boolean;
|
|
@@ -164,8 +158,8 @@ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
164
158
|
exclude: (string | RegExp | ((args_0: any) => boolean))[];
|
|
165
159
|
injectionPoint: string;
|
|
166
160
|
swSrc: string;
|
|
167
|
-
swDest: string;
|
|
168
161
|
compileSrc: boolean;
|
|
162
|
+
swDest: string;
|
|
169
163
|
scope?: string | undefined;
|
|
170
164
|
additionalPrecacheEntries?: (string | {
|
|
171
165
|
url: string;
|
package/dist/lib/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAU+C,CAAC;AAE1E,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAU+C,CAAC;AAE1E,eAAO,MAAM,qBAAqB;;;;;;;iBAKm8B,CAAC;gBAAsC,CAAC;;;iBAA4E,CAAC;gBAAsC,CAAC;;;;;;;;;;;;;iBAA4iB,CAAC;gBAAsC,CAAC;;;;iBAAkG,CAAC;gBAAsC,CAAC;;;;;;;;;;;qBAAgd,CAAC;oBAA0C,CAAC;;;;qBAAkH,CAAC;oBAA0C,CAAC;;;;;;;qBAAiP,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;qBAA6H,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;;;;;;;qBAAqY,CAAC;oBAA0C,CAAC;;;;qBAAkH,CAAC;oBAA0C,CAAC;;;;;;;qBAAiP,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;qBAA6H,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAA3U,CAAC;oBAA0C,CAAC;;;;;;;qBAAvrC,CAAC;oBAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAm0C,CAAC;oBAA0C,CAAC;;;;;;;qBAAvrC,CAAC;oBAA0C,CAAC;;;;;;;;;;;;;EADj7F,CAAC"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequiredSwDestPartial, RequiredSwDestResolved } from "@serwist/build";
|
|
2
|
-
import type { Require } from "@serwist/utils";
|
|
2
|
+
import type { Prettify, Require } from "@serwist/utils";
|
|
3
3
|
import type { InjectManifestOptions as WebpackInjectManifestOptions, InjectManifestOptionsComplete as WebpackInjectManifestOptionsComplete } from "@serwist/webpack-plugin";
|
|
4
4
|
export interface InjectPartial {
|
|
5
5
|
/**
|
|
@@ -89,7 +89,7 @@ export interface InjectPartial {
|
|
|
89
89
|
*/
|
|
90
90
|
globPublicPatterns?: string[];
|
|
91
91
|
}
|
|
92
|
-
export type InjectResolved = Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns"
|
|
93
|
-
export type InjectManifestOptions = Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest"
|
|
94
|
-
export type InjectManifestOptionsComplete = Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest"
|
|
92
|
+
export type InjectResolved = Prettify<Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">>;
|
|
93
|
+
export type InjectManifestOptions = Prettify<Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest">>;
|
|
94
|
+
export type InjectManifestOptionsComplete = Prettify<Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest">>;
|
|
95
95
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EACV,qBAAqB,IAAI,4BAA4B,EACrD,6BAA6B,IAAI,oCAAoC,EACtE,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,OAAO,CAAC,aAAa,EAAE,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,GAAG,oBAAoB,CAAC,CACzH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,IAAI,CAAC,4BAA4B,GAAG,qBAAqB,GAAG,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAEpJ,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAClD,IAAI,CAAC,oCAAoC,GAAG,sBAAsB,GAAG,cAAc,EAAE,yBAAyB,CAAC,CAChH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,KAAG,6BAQ9D,CAAC"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,GAAI,MAAM,EAAE,CAAC,oBAAoB,WAAyE,CAAC;AAEnI,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-preview.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Next.js application.",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"pwa"
|
|
22
22
|
],
|
|
23
23
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
24
|
+
"node": ">=20.0.0"
|
|
25
25
|
},
|
|
26
26
|
"author": "Serwist <ducanh2912.rusty@gmail.com> (https://serwist.pages.dev/)",
|
|
27
27
|
"license": "MIT",
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
"./package.json": "./package.json"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"chalk": "5.
|
|
66
|
-
"glob": "
|
|
67
|
-
"zod": "3.
|
|
68
|
-
"@serwist/build": "
|
|
69
|
-
"@serwist/
|
|
70
|
-
"@serwist/
|
|
71
|
-
"serwist": "
|
|
65
|
+
"chalk": "5.4.1",
|
|
66
|
+
"glob": "11.0.1",
|
|
67
|
+
"zod": "3.24.3",
|
|
68
|
+
"@serwist/build": "10.0.0-preview.2",
|
|
69
|
+
"@serwist/utils": "10.0.0-preview.2",
|
|
70
|
+
"@serwist/webpack-plugin": "10.0.0-preview.2",
|
|
71
|
+
"@serwist/window": "10.0.0-preview.2",
|
|
72
|
+
"serwist": "10.0.0-preview.2"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
|
-
"@types/node": "22.
|
|
75
|
-
"next": "15.
|
|
76
|
-
"react": "
|
|
77
|
-
"react-dom": "
|
|
78
|
-
"rollup": "4.
|
|
79
|
-
"type-fest": "4.
|
|
80
|
-
"typescript": "5.
|
|
81
|
-
"webpack": "5.
|
|
82
|
-
"@serwist/configs": "
|
|
83
|
-
"@serwist/utils": "9.1.0-preview.0"
|
|
75
|
+
"@types/node": "22.14.1",
|
|
76
|
+
"next": "15.3.1",
|
|
77
|
+
"react": "19.1.0",
|
|
78
|
+
"react-dom": "19.1.0",
|
|
79
|
+
"rollup": "4.40.0",
|
|
80
|
+
"type-fest": "4.40.0",
|
|
81
|
+
"typescript": "5.8.3",
|
|
82
|
+
"webpack": "5.99.6",
|
|
83
|
+
"@serwist/configs": "10.0.0-preview.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"next": ">=14.0.0",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|
|
96
96
|
"dev": "rollup --config rollup.config.js --watch",
|
|
97
97
|
"lint": "biome lint ./src",
|
|
98
|
+
"qcheck": "biome check ./src",
|
|
98
99
|
"typecheck": "tsc"
|
|
99
100
|
}
|
|
100
101
|
}
|
package/src/index.ts
CHANGED
|
@@ -13,12 +13,20 @@ import { validateInjectManifestOptions } from "./lib/validator.js";
|
|
|
13
13
|
|
|
14
14
|
const dirname = "__dirname" in globalThis ? __dirname : fileURLToPath(new URL(".", import.meta.url));
|
|
15
15
|
|
|
16
|
+
let warnedTurbopack = false;
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Integrates Serwist into your Next.js app.
|
|
18
20
|
* @param userOptions
|
|
19
21
|
* @returns
|
|
20
22
|
*/
|
|
21
23
|
const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: NextConfig) => NextConfig) => {
|
|
24
|
+
if (!warnedTurbopack && process.env.TURBOPACK && !userOptions.disable && !process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING) {
|
|
25
|
+
warnedTurbopack = true;
|
|
26
|
+
console.warn(
|
|
27
|
+
`[@serwist/next] WARNING: You are using '@serwist/next' with \`next dev --turbopack\`, but Serwist doesn't support Turbopack at the moment. It is recommended that you set \`disable\` to \`process.env.NODE_ENV !== \"production\"\`. Follow https://github.com/serwist/serwist/issues/54 for progress on Serwist + Turbopack. You can also suppress this warning by setting SERWIST_SUPPRESS_TURBOPACK_WARNING=1.`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
22
30
|
return (nextConfig = {}) => ({
|
|
23
31
|
...nextConfig,
|
|
24
32
|
webpack(config: Configuration, options) {
|
|
@@ -195,12 +203,16 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
|
|
|
195
203
|
// We don't need the service worker to be cached.
|
|
196
204
|
asset.name === swAsset?.name ||
|
|
197
205
|
asset.name.startsWith("server/") ||
|
|
198
|
-
|
|
206
|
+
// This excludes all JSON files in the compilation directory by filtering
|
|
207
|
+
// out paths that have slashes or don't end with `.json`. Only said files
|
|
208
|
+
// match this criterion.
|
|
209
|
+
/^[^\/]*\.json$/.test(asset.name) ||
|
|
199
210
|
(dev && !asset.name.startsWith("static/runtime/"))
|
|
200
211
|
);
|
|
201
212
|
},
|
|
202
213
|
],
|
|
203
214
|
manifestTransforms: [
|
|
215
|
+
// TODO(ducanhgh): move this spread to below our transform function?
|
|
204
216
|
...manifestTransforms,
|
|
205
217
|
async (manifestEntries, compilation) => {
|
|
206
218
|
// This path always uses forward slashes, so it is safe to use it in the following string replace.
|
|
@@ -216,7 +228,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
|
|
|
216
228
|
if (m.url.startsWith(publicFilesPrefix)) {
|
|
217
229
|
m.url = path.posix.join(basePath, m.url.replace(publicFilesPrefix, ""));
|
|
218
230
|
}
|
|
219
|
-
m.url = m.url.replace(/\[/g, "%5B").replace(/\]/g, "%5D");
|
|
231
|
+
m.url = m.url.replace(/\[/g, "%5B").replace(/\]/g, "%5D").replace(/@/g, "%40");
|
|
220
232
|
return m;
|
|
221
233
|
});
|
|
222
234
|
return { manifest, warnings: [] };
|
package/src/lib/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequiredSwDestPartial, RequiredSwDestResolved } from "@serwist/build";
|
|
2
|
-
import type { Require } from "@serwist/utils";
|
|
2
|
+
import type { Prettify, Require } from "@serwist/utils";
|
|
3
3
|
import type {
|
|
4
4
|
InjectManifestOptions as WebpackInjectManifestOptions,
|
|
5
5
|
InjectManifestOptionsComplete as WebpackInjectManifestOptionsComplete,
|
|
@@ -94,11 +94,12 @@ export interface InjectPartial {
|
|
|
94
94
|
globPublicPatterns?: string[];
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export type InjectResolved =
|
|
97
|
+
export type InjectResolved = Prettify<
|
|
98
|
+
Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">
|
|
99
|
+
>;
|
|
98
100
|
|
|
99
|
-
export type InjectManifestOptions = Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest"
|
|
101
|
+
export type InjectManifestOptions = Prettify<Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest">>;
|
|
100
102
|
|
|
101
|
-
export type InjectManifestOptionsComplete =
|
|
102
|
-
WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved,
|
|
103
|
-
"disablePrecacheManifest"
|
|
103
|
+
export type InjectManifestOptionsComplete = Prettify<
|
|
104
|
+
Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest">
|
|
104
105
|
>;
|