@serwist/turbopack 10.0.0-preview.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2023 Google LLC, 2019-2023 ShadowWalker w@weiw.io https://weiw.io, 2020-2023 Anthony Fu <https://github.com/antfu>, 2023-PRESENT Serwist
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ This module's documentation can be found at https://serwist.pages.dev/docs/next/turbo.
@@ -0,0 +1,20 @@
1
+ import { NextResponse } from "next/server.js";
2
+ import type { InjectManifestOptions } from "./types.js";
3
+ /**
4
+ * Creates a Route Handler that returns the precache manifest.
5
+ * @param options Options for {@linkcode getFileManifestEntries}.
6
+ */
7
+ export declare const createSerwistRoute: (options: InjectManifestOptions) => {
8
+ dynamic: string;
9
+ dynamicParams: boolean;
10
+ revalidate: boolean;
11
+ generateStaticParams: () => {
12
+ path: string;
13
+ }[];
14
+ GET: (_: Request, { params }: {
15
+ params: Promise<{
16
+ path: string;
17
+ }>;
18
+ }) => Promise<NextResponse<unknown>>;
19
+ };
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,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;;;;;;;aA8DzC,OAAO,cAAc;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CAYjF,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,182 @@
1
+ import path from 'node:path';
2
+ import { rebasePath, getFileManifestEntries } from '@serwist/build';
3
+ import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
4
+ import { green, bold, white, yellow, red, cyan, dim } from 'kolorist';
5
+ import { NextResponse } from 'next/server.js';
6
+ import { z } from 'zod';
7
+ import { injectManifestOptions } from './index.schema.js';
8
+
9
+ const mapLoggingMethodToConsole = {
10
+ wait: "log",
11
+ error: "error",
12
+ warn: "warn",
13
+ info: "log",
14
+ event: "log"
15
+ };
16
+ const prefixes = {
17
+ wait: `${white(bold("○"))} (serwist)`,
18
+ error: `${red(bold("X"))} (serwist)`,
19
+ warn: `${yellow(bold("⚠"))} (serwist)`,
20
+ info: `${white(bold("○"))} (serwist)`,
21
+ event: `${green(bold("✓"))} (serwist)`
22
+ };
23
+ const prefixedLog = (prefixType, ...message)=>{
24
+ const consoleMethod = mapLoggingMethodToConsole[prefixType];
25
+ const prefix = prefixes[prefixType];
26
+ if ((message[0] === "" || message[0] === undefined) && message.length === 1) {
27
+ message.shift();
28
+ }
29
+ if (message.length === 0) {
30
+ console[consoleMethod]("");
31
+ } else {
32
+ console[consoleMethod](` ${prefix}`, ...message);
33
+ }
34
+ };
35
+ const wait = (...message)=>{
36
+ prefixedLog("wait", ...message);
37
+ };
38
+ const error = (...message)=>{
39
+ prefixedLog("error", ...message);
40
+ };
41
+ const warn = (...message)=>{
42
+ prefixedLog("warn", ...message);
43
+ };
44
+ const info = (...message)=>{
45
+ prefixedLog("info", ...message);
46
+ };
47
+ const event = (...message)=>{
48
+ prefixedLog("event", ...message);
49
+ };
50
+
51
+ var logger = /*#__PURE__*/Object.freeze({
52
+ __proto__: null,
53
+ error: error,
54
+ event: event,
55
+ info: info,
56
+ wait: wait,
57
+ warn: warn
58
+ });
59
+
60
+ const esbuild = import('esbuild-wasm');
61
+ const logSerwistResult = (filePath, buildResult)=>{
62
+ const { count, size, warnings } = buildResult;
63
+ const hasWarnings = warnings && warnings.length > 0;
64
+ if (filePath === "sw.js") {
65
+ logger[hasWarnings ? "warn" : "event"](`${cyan(count)} precache entries ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}${hasWarnings ? `\n${yellow([
66
+ "⚠ warnings",
67
+ ...warnings.map((w)=>` ${w}`),
68
+ ""
69
+ ].join("\n"))}` : ""}`);
70
+ }
71
+ };
72
+ const validateGetManifestOptions = async (input)=>{
73
+ const result = await injectManifestOptions.spa(input, {
74
+ error: validationErrorMap
75
+ });
76
+ if (!result.success) {
77
+ throw new SerwistConfigError({
78
+ moduleName: "@serwist/turbopack",
79
+ message: z.prettifyError(result.error)
80
+ });
81
+ }
82
+ return result.data;
83
+ };
84
+ const isDev = process.env.NODE_ENV === "development";
85
+ const contentTypeMap = {
86
+ ".js": "application/javascript",
87
+ ".map": "application/json; charset=UTF-8"
88
+ };
89
+ const createSerwistRoute = (options)=>{
90
+ const dynamic = "force-static", dynamicParams = false, revalidate = false;
91
+ const validation = validateGetManifestOptions(options).then((config)=>{
92
+ config.globIgnores.push(rebasePath({
93
+ file: config.swSrc,
94
+ baseDirectory: config.globDirectory
95
+ }));
96
+ if (!config.manifestTransforms) {
97
+ config.manifestTransforms = [];
98
+ }
99
+ config.manifestTransforms.push((manifestEntries)=>{
100
+ const manifest = manifestEntries.map((m)=>{
101
+ if (m.url.startsWith(".next/")) m.url = `/_next/${m.url.slice(6)}`;
102
+ if (m.url.startsWith("public/")) m.url = path.posix.join(config.basePath, m.url.slice(7));
103
+ return m;
104
+ });
105
+ return {
106
+ manifest,
107
+ warnings: []
108
+ };
109
+ });
110
+ return config;
111
+ });
112
+ const generateStaticParams = ()=>{
113
+ return [
114
+ {
115
+ path: "sw.js"
116
+ },
117
+ {
118
+ path: "sw.js.map"
119
+ }
120
+ ];
121
+ };
122
+ let map = null;
123
+ const loadMap = async (filePath)=>{
124
+ const config = await validation;
125
+ const { count, size, manifestEntries, warnings } = await getFileManifestEntries(config);
126
+ const injectionPoint = config.injectionPoint ? config.injectionPoint : "";
127
+ const manifestString = manifestEntries === undefined ? "undefined" : JSON.stringify(manifestEntries, null, 2);
128
+ logSerwistResult(filePath, {
129
+ count,
130
+ size,
131
+ warnings
132
+ });
133
+ const result = await (await esbuild).build({
134
+ entryPoints: [
135
+ {
136
+ in: config.swSrc,
137
+ out: "sw"
138
+ }
139
+ ],
140
+ format: "esm",
141
+ sourcemap: true,
142
+ bundle: true,
143
+ write: false,
144
+ minify: !isDev,
145
+ define: injectionPoint ? {
146
+ [injectionPoint]: manifestString
147
+ } : undefined,
148
+ outdir: process.cwd(),
149
+ entryNames: "[name]"
150
+ });
151
+ if (result.errors.length) {
152
+ console.error("Failed to build the service worker.", result.errors);
153
+ throw new Error();
154
+ }
155
+ if (result.warnings.length) {
156
+ console.warn(result.warnings);
157
+ }
158
+ return new Map(result.outputFiles.map((e)=>[
159
+ e.path,
160
+ e.text
161
+ ]));
162
+ };
163
+ const GET = async (_, { params })=>{
164
+ const { path: filePath } = await params;
165
+ if (!map) map = await loadMap(filePath);
166
+ return new NextResponse(map.get(path.join(process.cwd(), filePath)), {
167
+ headers: {
168
+ "Content-Type": contentTypeMap[path.extname(filePath)] || "text/plain",
169
+ "Service-Worker-Allowed": "/"
170
+ }
171
+ });
172
+ };
173
+ return {
174
+ dynamic,
175
+ dynamicParams,
176
+ revalidate,
177
+ generateStaticParams,
178
+ GET
179
+ };
180
+ };
181
+
182
+ export { createSerwistRoute };
@@ -0,0 +1,16 @@
1
+ import { Serwist } from "@serwist/window";
2
+ import { type ReactNode } from "react";
3
+ export interface SerwistProviderProps {
4
+ swUrl: string;
5
+ register?: boolean;
6
+ reloadOnOnline?: boolean;
7
+ options?: RegistrationOptions;
8
+ children?: ReactNode;
9
+ }
10
+ declare global {
11
+ interface Window {
12
+ serwist: Serwist;
13
+ }
14
+ }
15
+ export declare function SerwistProvider({ swUrl, register, reloadOnOnline, options, children }: SerwistProviderProps): import("react").JSX.Element;
16
+ //# sourceMappingURL=index.react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.react.d.ts","sourceRoot":"","sources":["../src/index.react.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAG5D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,EAAE,OAAO,CAAC;KAClB;CACF;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,QAAe,EAAE,cAAqB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BAwBzH"}
@@ -0,0 +1,48 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Serwist } from '@serwist/window';
3
+ import { isCurrentPageOutOfScope } from '@serwist/window/internal';
4
+ import { createContext, useState, useEffect } from 'react';
5
+
6
+ const SerwistContext = createContext(null);
7
+
8
+ function SerwistProvider({ swUrl, register = true, reloadOnOnline = true, options, children }) {
9
+ const [serwist] = useState(()=>{
10
+ if (typeof window === "undefined") return null;
11
+ if (!(window.serwist && window.serwist instanceof Serwist) && "serviceWorker" in navigator) {
12
+ window.serwist = new Serwist(swUrl, {
13
+ ...options,
14
+ scope: options?.scope || "/"
15
+ });
16
+ }
17
+ return window.serwist ?? null;
18
+ });
19
+ useEffect(()=>{
20
+ const scope = options?.scope || "/";
21
+ if (register && !isCurrentPageOutOfScope(scope)) {
22
+ void serwist?.register();
23
+ }
24
+ }, [
25
+ register,
26
+ options?.scope,
27
+ serwist?.register
28
+ ]);
29
+ useEffect(()=>{
30
+ const reload = ()=>location.reload();
31
+ if (reloadOnOnline) {
32
+ window.addEventListener("online", reload);
33
+ }
34
+ return ()=>{
35
+ window.removeEventListener("online", reload);
36
+ };
37
+ }, [
38
+ reloadOnOnline
39
+ ]);
40
+ return jsx(SerwistContext.Provider, {
41
+ value: {
42
+ serwist
43
+ },
44
+ children: children
45
+ });
46
+ }
47
+
48
+ export { SerwistProvider };
@@ -0,0 +1,144 @@
1
+ import z from "zod";
2
+ export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
3
+ cwd: z.ZodPrefault<z.ZodString>;
4
+ basePath: z.ZodString;
5
+ globPatterns: z.ZodPrefault<z.ZodArray<z.ZodString>>;
6
+ globDirectory: z.ZodOptional<z.ZodString>;
7
+ injectionPoint: z.ZodPrefault<z.ZodString>;
8
+ swSrc: z.ZodString;
9
+ globFollow: z.ZodDefault<z.ZodBoolean>;
10
+ globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
11
+ globStrict: z.ZodDefault<z.ZodBoolean>;
12
+ templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
13
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
14
+ integrity: z.ZodOptional<z.ZodString>;
15
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ url: z.ZodString;
17
+ }, z.z.core.$strict>]>>>;
18
+ disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
19
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
20
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
21
+ size: z.ZodNumber;
22
+ integrity: z.ZodOptional<z.ZodString>;
23
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ url: z.ZodString;
25
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
26
+ manifest: z.ZodArray<z.ZodObject<{
27
+ size: z.ZodNumber;
28
+ integrity: z.ZodOptional<z.ZodString>;
29
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ url: z.ZodString;
31
+ }, z.z.core.$strip>>;
32
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ }, z.z.core.$strict>>, z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
34
+ size: z.ZodNumber;
35
+ integrity: z.ZodOptional<z.ZodString>;
36
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ url: z.ZodString;
38
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
39
+ manifest: z.ZodArray<z.ZodObject<{
40
+ size: z.ZodNumber;
41
+ integrity: z.ZodOptional<z.ZodString>;
42
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ url: z.ZodString;
44
+ }, z.z.core.$strip>>;
45
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
+ }, z.z.core.$strict>>>, z.ZodTransform<z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
47
+ size: z.ZodNumber;
48
+ integrity: z.ZodOptional<z.ZodString>;
49
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ url: z.ZodString;
51
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
52
+ manifest: z.ZodArray<z.ZodObject<{
53
+ size: z.ZodNumber;
54
+ integrity: z.ZodOptional<z.ZodString>;
55
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ url: z.ZodString;
57
+ }, z.z.core.$strip>>;
58
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ }, z.z.core.$strict>>, z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
60
+ size: z.ZodNumber;
61
+ integrity: z.ZodOptional<z.ZodString>;
62
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ url: z.ZodString;
64
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
65
+ manifest: z.ZodArray<z.ZodObject<{
66
+ size: z.ZodNumber;
67
+ integrity: z.ZodOptional<z.ZodString>;
68
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ url: z.ZodString;
70
+ }, z.z.core.$strip>>;
71
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ }, z.z.core.$strict>>>>>>;
73
+ maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
74
+ modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
75
+ }, z.z.core.$strict>, z.ZodTransform<{
76
+ swSrc: string;
77
+ globDirectory: string;
78
+ cwd: string;
79
+ basePath: string;
80
+ globPatterns: string[];
81
+ injectionPoint: string;
82
+ globFollow: boolean;
83
+ globIgnores: string[];
84
+ globStrict: boolean;
85
+ disablePrecacheManifest: boolean;
86
+ maximumFileSizeToCacheInBytes: number;
87
+ templatedURLs?: Record<string, string | string[]> | undefined;
88
+ additionalPrecacheEntries?: (string | {
89
+ url: string;
90
+ integrity?: string | undefined;
91
+ revision?: string | null | undefined;
92
+ })[] | undefined;
93
+ dontCacheBustURLsMatching?: RegExp | undefined;
94
+ manifestTransforms?: z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
95
+ size: z.ZodNumber;
96
+ integrity: z.ZodOptional<z.ZodString>;
97
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
+ url: z.ZodString;
99
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
100
+ manifest: z.ZodArray<z.ZodObject<{
101
+ size: z.ZodNumber;
102
+ integrity: z.ZodOptional<z.ZodString>;
103
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ url: z.ZodString;
105
+ }, z.z.core.$strip>>;
106
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ }, z.z.core.$strict>>[] | undefined;
108
+ modifyURLPrefix?: Record<string, string> | undefined;
109
+ }, {
110
+ cwd: string;
111
+ basePath: string;
112
+ globPatterns: string[];
113
+ injectionPoint: string;
114
+ swSrc: string;
115
+ globFollow: boolean;
116
+ globIgnores: string[];
117
+ globStrict: boolean;
118
+ disablePrecacheManifest: boolean;
119
+ maximumFileSizeToCacheInBytes: number;
120
+ globDirectory?: string | undefined;
121
+ templatedURLs?: Record<string, string | string[]> | undefined;
122
+ additionalPrecacheEntries?: (string | {
123
+ url: string;
124
+ integrity?: string | undefined;
125
+ revision?: string | null | undefined;
126
+ })[] | undefined;
127
+ dontCacheBustURLsMatching?: RegExp | undefined;
128
+ manifestTransforms?: z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
129
+ size: z.ZodNumber;
130
+ integrity: z.ZodOptional<z.ZodString>;
131
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ url: z.ZodString;
133
+ }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
134
+ manifest: z.ZodArray<z.ZodObject<{
135
+ size: z.ZodNumber;
136
+ integrity: z.ZodOptional<z.ZodString>;
137
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ url: z.ZodString;
139
+ }, z.z.core.$strip>>;
140
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ }, z.z.core.$strict>>[] | undefined;
142
+ modifyURLPrefix?: Record<string, string> | undefined;
143
+ }>>;
144
+ //# sourceMappingURL=index.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgB9B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import path from 'node:path';
2
+ import { injectPartial, globPartial, basePartial } from '@serwist/build/schema';
3
+ import z from 'zod';
4
+
5
+ const DEFAULT_GLOB_PATTERNS = [
6
+ ".next/static/**/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}",
7
+ "public/**/*"
8
+ ];
9
+
10
+ const injectManifestOptions = z.strictObject({
11
+ ...basePartial.shape,
12
+ ...globPartial.shape,
13
+ ...injectPartial.shape,
14
+ cwd: z.string().prefault(process.cwd()),
15
+ basePath: z.string(),
16
+ globPatterns: z.array(z.string()).prefault(DEFAULT_GLOB_PATTERNS),
17
+ globDirectory: z.string().optional()
18
+ }).transform((input)=>{
19
+ return {
20
+ ...input,
21
+ swSrc: path.isAbsolute(input.swSrc) ? input.swSrc : path.join(input.cwd, input.swSrc),
22
+ globDirectory: input.globDirectory ?? input.cwd
23
+ };
24
+ });
25
+
26
+ export { injectManifestOptions };
@@ -0,0 +1,14 @@
1
+ import type { RuntimeCaching } from "serwist";
2
+ export declare const PAGES_CACHE_NAME: {
3
+ readonly rscPrefetch: "pages-rsc-prefetch";
4
+ readonly rsc: "pages-rsc";
5
+ readonly html: "pages";
6
+ };
7
+ /**
8
+ * The default, recommended list of caching strategies for applications
9
+ * built with Next.js.
10
+ *
11
+ * @see https://serwist.pages.dev/docs/next/worker-exports#default-cache
12
+ */
13
+ export declare const defaultCache: RuntimeCaching[];
14
+ //# 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,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAsQlC,CAAC"}