@serwist/turbopack 9.5.6 → 9.5.8

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.
Files changed (47) hide show
  1. package/dist/chunks/index.schema-RVDaKxz4.js +189 -0
  2. package/dist/chunks/index.schema-RVDaKxz4.js.map +1 -0
  3. package/dist/index.d.mts +96 -0
  4. package/dist/index.d.mts.map +1 -0
  5. package/dist/index.mjs +166 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/index.react.d.mts +42 -0
  8. package/dist/index.react.d.mts.map +1 -0
  9. package/dist/index.react.mjs +73 -0
  10. package/dist/index.react.mjs.map +1 -0
  11. package/dist/index.schema.d.mts +311 -0
  12. package/dist/index.schema.d.mts.map +1 -0
  13. package/dist/index.schema.mjs +2 -0
  14. package/dist/index.worker.d.mts +18 -0
  15. package/dist/index.worker.d.mts.map +1 -0
  16. package/dist/index.worker.mjs +227 -0
  17. package/dist/index.worker.mjs.map +1 -0
  18. package/package.json +33 -34
  19. package/src/index.schema.ts +1 -0
  20. package/src/index.ts +11 -2
  21. package/src/lib/utils.ts +3 -3
  22. package/src/types.ts +8 -1
  23. package/dist/chunks/index.schema.js +0 -183
  24. package/dist/index.d.ts +0 -22
  25. package/dist/index.d.ts.map +0 -1
  26. package/dist/index.js +0 -180
  27. package/dist/index.react.d.ts +0 -25
  28. package/dist/index.react.d.ts.map +0 -1
  29. package/dist/index.react.js +0 -88
  30. package/dist/index.schema.d.ts +0 -297
  31. package/dist/index.schema.d.ts.map +0 -1
  32. package/dist/index.schema.js +0 -8
  33. package/dist/index.worker.d.ts +0 -14
  34. package/dist/index.worker.d.ts.map +0 -1
  35. package/dist/index.worker.js +0 -261
  36. package/dist/lib/constants.d.ts +0 -2
  37. package/dist/lib/constants.d.ts.map +0 -1
  38. package/dist/lib/context.d.ts +0 -7
  39. package/dist/lib/context.d.ts.map +0 -1
  40. package/dist/lib/index.d.ts +0 -3
  41. package/dist/lib/index.d.ts.map +0 -1
  42. package/dist/lib/logger.d.ts +0 -8
  43. package/dist/lib/logger.d.ts.map +0 -1
  44. package/dist/lib/utils.d.ts +0 -3
  45. package/dist/lib/utils.d.ts.map +0 -1
  46. package/dist/types.d.ts +0 -65
  47. package/dist/types.d.ts.map +0 -1
@@ -1,88 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Serwist } from '@serwist/window';
3
- import { isCurrentPageOutOfScope } from '@serwist/window/internal';
4
- import { createContext, useContext, useState, useEffect } from 'react';
5
-
6
- const SerwistContext = createContext(null);
7
- const useSerwist = ()=>{
8
- const context = useContext(SerwistContext);
9
- if (!context) {
10
- throw new Error("[useSerwist]: 'SerwistContext' is not available.");
11
- }
12
- return context;
13
- };
14
-
15
- function SerwistProvider({ swUrl, disable = false, register = true, cacheOnNavigation = true, reloadOnOnline = true, options, children }) {
16
- const [serwist] = useState(()=>{
17
- if (typeof window === "undefined") return null;
18
- if (disable) return null;
19
- const scope = options?.scope || "/";
20
- if (!(window.serwist && window.serwist instanceof Serwist) && "serviceWorker" in navigator) {
21
- window.serwist = new Serwist(swUrl, {
22
- ...options,
23
- scope,
24
- type: options?.type || "module"
25
- });
26
- if (register && !isCurrentPageOutOfScope(scope)) {
27
- void window.serwist.register();
28
- }
29
- }
30
- return window.serwist ?? null;
31
- });
32
- useEffect(()=>{
33
- const cacheUrls = async (url)=>{
34
- if (!window.navigator.onLine || !url) {
35
- return;
36
- }
37
- serwist?.messageSW({
38
- type: "CACHE_URLS",
39
- payload: {
40
- urlsToCache: [
41
- url
42
- ]
43
- }
44
- });
45
- };
46
- const cacheCurrentPathname = ()=>cacheUrls(window.location.pathname);
47
- const pushState = history.pushState;
48
- const replaceState = history.replaceState;
49
- if (cacheOnNavigation) {
50
- history.pushState = (...args)=>{
51
- pushState.apply(history, args);
52
- cacheUrls(args[2]);
53
- };
54
- history.replaceState = (...args)=>{
55
- replaceState.apply(history, args);
56
- cacheUrls(args[2]);
57
- };
58
- window.addEventListener("online", cacheCurrentPathname);
59
- }
60
- return ()=>{
61
- history.pushState = pushState;
62
- history.replaceState = replaceState;
63
- window.removeEventListener("online", cacheCurrentPathname);
64
- };
65
- }, [
66
- serwist,
67
- cacheOnNavigation
68
- ]);
69
- useEffect(()=>{
70
- const reload = ()=>location.reload();
71
- if (reloadOnOnline) {
72
- window.addEventListener("online", reload);
73
- }
74
- return ()=>{
75
- window.removeEventListener("online", reload);
76
- };
77
- }, [
78
- reloadOnOnline
79
- ]);
80
- return jsx(SerwistContext.Provider, {
81
- value: {
82
- serwist
83
- },
84
- children: children
85
- });
86
- }
87
-
88
- export { SerwistProvider, useSerwist };
@@ -1,297 +0,0 @@
1
- import z from "zod";
2
- export declare const turboPartial: z.ZodObject<{
3
- cwd: z.ZodPrefault<z.ZodString>;
4
- nextConfig: z.ZodOptional<z.ZodObject<{
5
- assetPrefix: z.ZodOptional<z.ZodString>;
6
- basePath: z.ZodOptional<z.ZodString>;
7
- distDir: z.ZodOptional<z.ZodString>;
8
- }, z.z.core.$strip>>;
9
- useNativeEsbuild: z.ZodPrefault<z.ZodBoolean>;
10
- 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>>;
11
- }, z.z.core.$strict>;
12
- export declare const injectManifestOptions: z.ZodPipe<z.ZodObject<{
13
- cwd: z.ZodPrefault<z.ZodString>;
14
- useNativeEsbuild: z.ZodPrefault<z.ZodBoolean>;
15
- 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>>;
16
- nextConfig: z.ZodOptional<z.ZodObject<{
17
- assetPrefix: z.ZodOptional<z.ZodString>;
18
- basePath: z.ZodOptional<z.ZodString>;
19
- distDir: z.ZodOptional<z.ZodString>;
20
- }, z.z.core.$strip>>;
21
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
22
- integrity: z.ZodOptional<z.ZodString>;
23
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
- url: z.ZodString;
25
- }, z.z.core.$strict>]>>>;
26
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
27
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
28
- size: z.ZodNumber;
29
- integrity: z.ZodOptional<z.ZodString>;
30
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
- url: z.ZodString;
32
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
33
- manifest: 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>>;
39
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
- }, z.z.core.$strict>>, z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
41
- size: z.ZodNumber;
42
- integrity: z.ZodOptional<z.ZodString>;
43
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
- url: z.ZodString;
45
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
46
- manifest: 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>>;
52
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
53
- }, z.z.core.$strict>>>, z.ZodTransform<z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
54
- size: z.ZodNumber;
55
- integrity: z.ZodOptional<z.ZodString>;
56
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
- url: z.ZodString;
58
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
59
- manifest: 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>>;
65
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
- }, z.z.core.$strict>>, z.z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
67
- size: z.ZodNumber;
68
- integrity: z.ZodOptional<z.ZodString>;
69
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
- url: z.ZodString;
71
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
72
- manifest: z.ZodArray<z.ZodObject<{
73
- size: z.ZodNumber;
74
- integrity: z.ZodOptional<z.ZodString>;
75
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
- url: z.ZodString;
77
- }, z.z.core.$strip>>;
78
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
- }, z.z.core.$strict>>>>>>;
80
- maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
81
- modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
82
- globFollow: z.ZodDefault<z.ZodBoolean>;
83
- globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
84
- globPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
- globStrict: z.ZodDefault<z.ZodBoolean>;
86
- templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
87
- injectionPoint: z.ZodDefault<z.ZodString>;
88
- swSrc: z.ZodString;
89
- globDirectory: z.ZodOptional<z.ZodString>;
90
- }, z.z.core.$strict>, z.ZodTransform<{
91
- swSrc: string;
92
- globPatterns: string[];
93
- globDirectory: string;
94
- dontCacheBustURLsMatching: RegExp;
95
- nextConfig: {
96
- distDir: string;
97
- basePath: string;
98
- assetPrefix: string;
99
- allowedDevOrigins: string[];
100
- exportPathMap: (defaultMap: import("next/dist/server/config-shared.js").ExportPathMap, ctx: {
101
- dev: boolean;
102
- dir: string;
103
- outDir: string | null;
104
- distDir: string;
105
- buildId: string;
106
- }) => Promise<import("next/dist/server/config-shared.js").ExportPathMap> | import("next/dist/server/config-shared.js").ExportPathMap;
107
- i18n: import("next/dist/server/config-shared.js").I18NConfig | null;
108
- typescript: import("next/dist/server/config-shared.js").TypeScriptConfig;
109
- typedRoutes: boolean;
110
- headers: () => Promise<import("next/dist/lib/load-custom-routes.js").Header[]> | import("next/dist/lib/load-custom-routes.js").Header[];
111
- rewrites: () => Promise<import("next/dist/lib/load-custom-routes.js").Rewrite[] | {
112
- beforeFiles?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
113
- afterFiles?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
114
- fallback?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
115
- }> | import("next/dist/lib/load-custom-routes.js").Rewrite[] | {
116
- beforeFiles?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
117
- afterFiles?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
118
- fallback?: import("next/dist/lib/load-custom-routes.js").Rewrite[];
119
- };
120
- redirects: () => Promise<import("next/dist/lib/load-custom-routes.js").Redirect[]> | import("next/dist/lib/load-custom-routes.js").Redirect[];
121
- excludeDefaultMomentLocales: boolean;
122
- webpack: import("next/dist/server/config-shared.js").NextJsWebpackConfig | null;
123
- trailingSlash: boolean;
124
- env: Record<string, string | undefined>;
125
- cleanDistDir: boolean;
126
- cacheHandler: string;
127
- cacheHandlers: {
128
- default?: string;
129
- remote?: string;
130
- static?: string;
131
- [handlerName: string]: string | undefined;
132
- };
133
- cacheMaxMemorySize: number;
134
- useFileSystemPublicRoutes: boolean;
135
- generateBuildId: () => string | null | Promise<string | null>;
136
- generateEtags: boolean;
137
- pageExtensions: string[];
138
- compress: boolean;
139
- poweredByHeader: boolean;
140
- images: Partial<import("next/dist/shared/lib/image-config.js").ImageConfigComplete> & Required<import("next/dist/shared/lib/image-config.js").ImageConfigComplete>;
141
- devIndicators: false | {
142
- position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
143
- };
144
- onDemandEntries: {
145
- maxInactiveAge?: number;
146
- pagesBufferLength?: number;
147
- };
148
- deploymentId: string;
149
- sassOptions: {
150
- implementation?: string;
151
- [key: string]: any;
152
- };
153
- productionBrowserSourceMaps: boolean;
154
- reactCompiler: boolean | import("next/dist/server/config-shared.js").ReactCompilerOptions;
155
- reactProductionProfiling: boolean;
156
- reactStrictMode: boolean | null;
157
- reactMaxHeadersLength: number;
158
- httpAgentOptions: {
159
- keepAlive?: boolean;
160
- };
161
- staticPageGenerationTimeout: number;
162
- crossOrigin: "anonymous" | "use-credentials";
163
- compiler: {
164
- reactRemoveProperties?: boolean | {
165
- properties?: string[];
166
- };
167
- relay?: {
168
- src: string;
169
- artifactDirectory?: string;
170
- language?: "typescript" | "javascript" | "flow";
171
- eagerEsModules?: boolean;
172
- };
173
- removeConsole?: boolean | {
174
- exclude?: string[];
175
- };
176
- styledComponents?: boolean | import("next/dist/server/config-shared.js").StyledComponentsConfig;
177
- emotion?: boolean | import("next/dist/server/config-shared.js").EmotionConfig;
178
- styledJsx?: boolean | {
179
- useLightningcss?: boolean;
180
- };
181
- define?: Record<string, string>;
182
- defineServer?: Record<string, string>;
183
- runAfterProductionCompile?: (metadata: {
184
- projectDir: string;
185
- distDir: string;
186
- }) => Promise<void>;
187
- };
188
- output: "standalone" | "export";
189
- transpilePackages: string[];
190
- turbopack: import("next/dist/server/config-shared.js").TurbopackOptions;
191
- skipMiddlewareUrlNormalize: boolean;
192
- skipProxyUrlNormalize: boolean;
193
- skipTrailingSlashRedirect: boolean;
194
- modularizeImports: Record<string, {
195
- transform: string | Record<string, string>;
196
- preventFullImport?: boolean;
197
- skipDefaultConversion?: boolean;
198
- }>;
199
- logging: import("next/dist/server/config-shared.js").LoggingConfig | false;
200
- enablePrerenderSourceMaps: boolean;
201
- cacheComponents: boolean;
202
- cacheLife: {
203
- [profile: string]: {
204
- stale?: number;
205
- revalidate?: number;
206
- expire?: number;
207
- };
208
- };
209
- expireTime: number;
210
- experimental: import("next/dist/server/config-shared.js").ExperimentalConfig;
211
- bundlePagesRouterDependencies: boolean;
212
- serverExternalPackages: string[];
213
- outputFileTracingRoot: string;
214
- outputFileTracingExcludes: Record<string, string[]>;
215
- outputFileTracingIncludes: Record<string, string[]>;
216
- watchOptions: {
217
- pollIntervalMs?: number;
218
- };
219
- htmlLimitedBots: RegExp & string;
220
- configFile: string | undefined;
221
- configFileName: string;
222
- distDirRoot: string;
223
- } | {
224
- distDir: string;
225
- basePath: string;
226
- assetPrefix: string;
227
- };
228
- cwd: string;
229
- useNativeEsbuild: boolean;
230
- esbuildOptions: Partial<Record<"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", any>>;
231
- maximumFileSizeToCacheInBytes: number;
232
- globFollow: boolean;
233
- globIgnores: string[];
234
- globStrict: boolean;
235
- injectionPoint: string;
236
- additionalPrecacheEntries?: (string | {
237
- url: string;
238
- integrity?: string | undefined;
239
- revision?: string | null | undefined;
240
- })[] | undefined;
241
- manifestTransforms?: z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
242
- size: z.ZodNumber;
243
- integrity: z.ZodOptional<z.ZodString>;
244
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
- url: z.ZodString;
246
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
247
- manifest: z.ZodArray<z.ZodObject<{
248
- size: z.ZodNumber;
249
- integrity: z.ZodOptional<z.ZodString>;
250
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
- url: z.ZodString;
252
- }, z.z.core.$strip>>;
253
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
- }, z.z.core.$strict>>[] | undefined;
255
- modifyURLPrefix?: Record<string, string> | undefined;
256
- templatedURLs?: Record<string, string | string[]> | undefined;
257
- }, {
258
- cwd: string;
259
- useNativeEsbuild: boolean;
260
- esbuildOptions: Partial<Record<"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", any>>;
261
- maximumFileSizeToCacheInBytes: number;
262
- globFollow: boolean;
263
- globIgnores: string[];
264
- globStrict: boolean;
265
- injectionPoint: string;
266
- swSrc: string;
267
- nextConfig?: {
268
- assetPrefix?: string | undefined;
269
- basePath?: string | undefined;
270
- distDir?: string | undefined;
271
- } | undefined;
272
- additionalPrecacheEntries?: (string | {
273
- url: string;
274
- integrity?: string | undefined;
275
- revision?: string | null | undefined;
276
- })[] | undefined;
277
- dontCacheBustURLsMatching?: RegExp | undefined;
278
- manifestTransforms?: z.z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
279
- size: z.ZodNumber;
280
- integrity: z.ZodOptional<z.ZodString>;
281
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
282
- url: z.ZodString;
283
- }, z.z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
284
- manifest: z.ZodArray<z.ZodObject<{
285
- size: z.ZodNumber;
286
- integrity: z.ZodOptional<z.ZodString>;
287
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
- url: z.ZodString;
289
- }, z.z.core.$strip>>;
290
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
291
- }, z.z.core.$strict>>[] | undefined;
292
- modifyURLPrefix?: Record<string, string> | undefined;
293
- globPatterns?: string[] | undefined;
294
- templatedURLs?: Record<string, string | string[]> | undefined;
295
- globDirectory?: string | undefined;
296
- }>>;
297
- //# sourceMappingURL=index.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,eAAO,MAAM,YAAY;;;;;;;;;oBAWvB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA8C4r0B,CAAC;sBAA+B,CAAC;oBAA6B,CAAC;;uBAAuD,CAAC;sBAA+B,CAAC;oBAA6B,CAAC;;;;;;;;;;mBAA+5E,CAAC;kBAAwB,CAAC;kBAAwB,CAAC;;;;;;;;;;;;oBAAo9D,CAAC;;;0BAAie,CAAC;6BAA4H,CAAC;;;;0BAAkiB,CAAC;;;;;;;;;qBAA4+C,CAAC;;;;;iCAA+sB,CAAC;0BAAoC,CAAC;;iBAAoC,CAAC;;iCAA0D,CAAC;wBAA8B,CAAC;8BAAkE,CAAC;;yBAA2C,CAAC;uBAAiC,CAAC;;4BAA+C,CAAC;mBAAmD,CAAC;qBAA4C,CAAC;+BAAyC,CAAC;;kBAA6L,CAAC;wBAAsO,CAAC;qCAA2R,CAAC;;;;;;;;;;;;;6BAAm0D,CAAC;iCAAwC,CAAC;;;;;;;qBAAowB,CAAC;0BAAgC,CAAC;sBAA4B,CAAC;;;;;;;;;;;0BAA21C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GANlzuC,CAAC"}
@@ -1,8 +0,0 @@
1
- import 'node:path';
2
- import '@serwist/build/schema';
3
- import 'semver';
4
- import 'zod';
5
- export { i as injectManifestOptions, t as turboPartial } from './chunks/index.schema.js';
6
- import 'node:module';
7
- import 'kolorist';
8
- import 'next/constants.js';
@@ -1,14 +0,0 @@
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
@@ -1 +0,0 @@
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,EAkQlC,CAAC"}
@@ -1,261 +0,0 @@
1
- import { NetworkOnly, CacheFirst, StaleWhileRevalidate, NetworkFirst, ExpirationPlugin, RangeRequestsPlugin } from 'serwist';
2
-
3
- const PAGES_CACHE_NAME = {
4
- rscPrefetch: "pages-rsc-prefetch",
5
- rsc: "pages-rsc",
6
- html: "pages"
7
- };
8
- const defaultCache = process.env.NODE_ENV !== "production" ? [
9
- {
10
- matcher: /.*/i,
11
- handler: new NetworkOnly()
12
- }
13
- ] : [
14
- {
15
- matcher: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
16
- handler: new CacheFirst({
17
- cacheName: "google-fonts-webfonts",
18
- plugins: [
19
- new ExpirationPlugin({
20
- maxEntries: 4,
21
- maxAgeSeconds: 365 * 24 * 60 * 60,
22
- maxAgeFrom: "last-used"
23
- })
24
- ]
25
- })
26
- },
27
- {
28
- matcher: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
29
- handler: new StaleWhileRevalidate({
30
- cacheName: "google-fonts-stylesheets",
31
- plugins: [
32
- new ExpirationPlugin({
33
- maxEntries: 4,
34
- maxAgeSeconds: 7 * 24 * 60 * 60,
35
- maxAgeFrom: "last-used"
36
- })
37
- ]
38
- })
39
- },
40
- {
41
- matcher: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
42
- handler: new StaleWhileRevalidate({
43
- cacheName: "static-font-assets",
44
- plugins: [
45
- new ExpirationPlugin({
46
- maxEntries: 4,
47
- maxAgeSeconds: 7 * 24 * 60 * 60,
48
- maxAgeFrom: "last-used"
49
- })
50
- ]
51
- })
52
- },
53
- {
54
- matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
55
- handler: new StaleWhileRevalidate({
56
- cacheName: "static-image-assets",
57
- plugins: [
58
- new ExpirationPlugin({
59
- maxEntries: 64,
60
- maxAgeSeconds: 30 * 24 * 60 * 60,
61
- maxAgeFrom: "last-used"
62
- })
63
- ]
64
- })
65
- },
66
- {
67
- matcher: /\/_next\/static.+\.js$/i,
68
- handler: new CacheFirst({
69
- cacheName: "next-static-js-assets",
70
- plugins: [
71
- new ExpirationPlugin({
72
- maxEntries: 64,
73
- maxAgeSeconds: 24 * 60 * 60,
74
- maxAgeFrom: "last-used"
75
- })
76
- ]
77
- })
78
- },
79
- {
80
- matcher: /\/_next\/image\?url=.+$/i,
81
- handler: new StaleWhileRevalidate({
82
- cacheName: "next-image",
83
- plugins: [
84
- new ExpirationPlugin({
85
- maxEntries: 64,
86
- maxAgeSeconds: 24 * 60 * 60,
87
- maxAgeFrom: "last-used"
88
- })
89
- ]
90
- })
91
- },
92
- {
93
- matcher: /\.(?:mp3|wav|ogg)$/i,
94
- handler: new CacheFirst({
95
- cacheName: "static-audio-assets",
96
- plugins: [
97
- new ExpirationPlugin({
98
- maxEntries: 32,
99
- maxAgeSeconds: 24 * 60 * 60,
100
- maxAgeFrom: "last-used"
101
- }),
102
- new RangeRequestsPlugin()
103
- ]
104
- })
105
- },
106
- {
107
- matcher: /\.(?:mp4|webm)$/i,
108
- handler: new CacheFirst({
109
- cacheName: "static-video-assets",
110
- plugins: [
111
- new ExpirationPlugin({
112
- maxEntries: 32,
113
- maxAgeSeconds: 24 * 60 * 60,
114
- maxAgeFrom: "last-used"
115
- }),
116
- new RangeRequestsPlugin()
117
- ]
118
- })
119
- },
120
- {
121
- matcher: /\.(?:js)$/i,
122
- handler: new StaleWhileRevalidate({
123
- cacheName: "static-js-assets",
124
- plugins: [
125
- new ExpirationPlugin({
126
- maxEntries: 48,
127
- maxAgeSeconds: 24 * 60 * 60,
128
- maxAgeFrom: "last-used"
129
- })
130
- ]
131
- })
132
- },
133
- {
134
- matcher: /\.(?:css|less)$/i,
135
- handler: new StaleWhileRevalidate({
136
- cacheName: "static-style-assets",
137
- plugins: [
138
- new ExpirationPlugin({
139
- maxEntries: 32,
140
- maxAgeSeconds: 24 * 60 * 60,
141
- maxAgeFrom: "last-used"
142
- })
143
- ]
144
- })
145
- },
146
- {
147
- matcher: /\/_next\/data\/.+\/.+\.json$/i,
148
- handler: new NetworkFirst({
149
- cacheName: "next-data",
150
- plugins: [
151
- new ExpirationPlugin({
152
- maxEntries: 32,
153
- maxAgeSeconds: 24 * 60 * 60,
154
- maxAgeFrom: "last-used"
155
- })
156
- ]
157
- })
158
- },
159
- {
160
- matcher: /\.(?:json|xml|csv)$/i,
161
- handler: new NetworkFirst({
162
- cacheName: "static-data-assets",
163
- plugins: [
164
- new ExpirationPlugin({
165
- maxEntries: 32,
166
- maxAgeSeconds: 24 * 60 * 60,
167
- maxAgeFrom: "last-used"
168
- })
169
- ]
170
- })
171
- },
172
- {
173
- matcher: /\/api\/auth\/.*/,
174
- handler: new NetworkOnly({
175
- networkTimeoutSeconds: 10
176
- })
177
- },
178
- {
179
- matcher: ({ sameOrigin, url: { pathname } })=>sameOrigin && pathname.startsWith("/api/"),
180
- method: "GET",
181
- handler: new NetworkFirst({
182
- cacheName: "apis",
183
- plugins: [
184
- new ExpirationPlugin({
185
- maxEntries: 16,
186
- maxAgeSeconds: 24 * 60 * 60,
187
- maxAgeFrom: "last-used"
188
- })
189
- ],
190
- networkTimeoutSeconds: 10
191
- })
192
- },
193
- {
194
- matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && request.headers.get("Next-Router-Prefetch") === "1" && sameOrigin && !pathname.startsWith("/api/"),
195
- handler: new NetworkFirst({
196
- cacheName: PAGES_CACHE_NAME.rscPrefetch,
197
- plugins: [
198
- new ExpirationPlugin({
199
- maxEntries: 32,
200
- maxAgeSeconds: 24 * 60 * 60
201
- })
202
- ]
203
- })
204
- },
205
- {
206
- matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && sameOrigin && !pathname.startsWith("/api/"),
207
- handler: new NetworkFirst({
208
- cacheName: PAGES_CACHE_NAME.rsc,
209
- plugins: [
210
- new ExpirationPlugin({
211
- maxEntries: 32,
212
- maxAgeSeconds: 24 * 60 * 60
213
- })
214
- ]
215
- })
216
- },
217
- {
218
- matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("Content-Type")?.includes("text/html") && sameOrigin && !pathname.startsWith("/api/"),
219
- handler: new NetworkFirst({
220
- cacheName: PAGES_CACHE_NAME.html,
221
- plugins: [
222
- new ExpirationPlugin({
223
- maxEntries: 32,
224
- maxAgeSeconds: 24 * 60 * 60
225
- })
226
- ]
227
- })
228
- },
229
- {
230
- matcher: ({ url: { pathname }, sameOrigin })=>sameOrigin && !pathname.startsWith("/api/"),
231
- handler: new NetworkFirst({
232
- cacheName: "others",
233
- plugins: [
234
- new ExpirationPlugin({
235
- maxEntries: 32,
236
- maxAgeSeconds: 24 * 60 * 60
237
- })
238
- ]
239
- })
240
- },
241
- {
242
- matcher: ({ sameOrigin })=>!sameOrigin,
243
- handler: new NetworkFirst({
244
- cacheName: "cross-origin",
245
- plugins: [
246
- new ExpirationPlugin({
247
- maxEntries: 32,
248
- maxAgeSeconds: 60 * 60
249
- })
250
- ],
251
- networkTimeoutSeconds: 10
252
- })
253
- },
254
- {
255
- matcher: /.*/i,
256
- method: "GET",
257
- handler: new NetworkOnly()
258
- }
259
- ];
260
-
261
- export { PAGES_CACHE_NAME, defaultCache };