1 | import { PackageJson } from 'type-fest';
|
2 | import { BroadcastCacheUpdateOptions } from 'workbox-broadcast-update/BroadcastCacheUpdate';
|
3 | import { GoogleAnalyticsInitializeOptions } from 'workbox-google-analytics/initialize';
|
4 | import { HTTPMethod } from 'workbox-routing/utils/constants';
|
5 | import { QueueOptions } from 'workbox-background-sync/Queue';
|
6 | import { RouteHandler, RouteMatchCallback } from 'workbox-core/types';
|
7 | import { CacheableResponseOptions } from 'workbox-cacheable-response/CacheableResponse';
|
8 | import { ExpirationPluginOptions } from 'workbox-expiration/ExpirationPlugin';
|
9 | import { WorkboxPlugin } from 'workbox-core/types';
|
10 | export interface ManifestEntry {
|
11 | integrity?: string;
|
12 | revision: string | null;
|
13 | url: string;
|
14 | }
|
15 | declare type StrategyName = 'CacheFirst' | 'CacheOnly' | 'NetworkFirst' | 'NetworkOnly' | 'StaleWhileRevalidate';
|
16 | export interface RuntimeCaching {
|
17 | handler: RouteHandler | StrategyName;
|
18 | method?: HTTPMethod;
|
19 | options?: {
|
20 | backgroundSync?: {
|
21 | name: string;
|
22 | options?: QueueOptions;
|
23 | };
|
24 | broadcastUpdate?: {
|
25 | channelName?: string;
|
26 | options: BroadcastCacheUpdateOptions;
|
27 | };
|
28 | cacheableResponse?: CacheableResponseOptions;
|
29 | cacheName?: string | null;
|
30 | expiration?: ExpirationPluginOptions;
|
31 | networkTimeoutSeconds?: number;
|
32 | plugins?: Array<WorkboxPlugin>;
|
33 | precacheFallback?: {
|
34 | fallbackURL: string;
|
35 | };
|
36 | rangeRequests?: boolean;
|
37 | fetchOptions?: RequestInit;
|
38 | matchOptions?: CacheQueryOptions;
|
39 | };
|
40 | urlPattern: RegExp | string | RouteMatchCallback;
|
41 | }
|
42 | export interface ManifestTransformResult {
|
43 | manifest: Array<ManifestEntry & {
|
44 | size: number;
|
45 | }>;
|
46 | warnings?: Array<string>;
|
47 | }
|
48 | export declare type ManifestTransform = (manifestEntries: Array<ManifestEntry & {
|
49 | size: number;
|
50 | }>, compilation?: unknown) => Promise<ManifestTransformResult> | ManifestTransformResult;
|
51 | export interface BasePartial {
|
52 | additionalManifestEntries?: Array<string | ManifestEntry>;
|
53 | dontCacheBustURLsMatching?: RegExp;
|
54 | manifestTransforms?: Array<ManifestTransform>;
|
55 | |
56 |
|
57 |
|
58 | maximumFileSizeToCacheInBytes?: number;
|
59 | modifyURLPrefix?: {
|
60 | [key: string]: string;
|
61 | };
|
62 | }
|
63 | export interface GeneratePartial {
|
64 | |
65 |
|
66 |
|
67 | babelPresetEnvTargets?: Array<string>;
|
68 | cacheId?: string | null;
|
69 | |
70 |
|
71 |
|
72 | cleanupOutdatedCaches?: boolean;
|
73 | |
74 |
|
75 |
|
76 | clientsClaim?: boolean;
|
77 | directoryIndex?: string | null;
|
78 | |
79 |
|
80 |
|
81 | disableDevLogs?: boolean;
|
82 | ignoreURLParametersMatching?: Array<RegExp>;
|
83 | importScripts?: Array<string>;
|
84 | |
85 |
|
86 |
|
87 | inlineWorkboxRuntime?: boolean;
|
88 | |
89 |
|
90 |
|
91 | mode?: string | null;
|
92 | |
93 |
|
94 |
|
95 | navigateFallback?: string | null;
|
96 | navigateFallbackAllowlist?: Array<RegExp>;
|
97 | navigateFallbackDenylist?: Array<RegExp>;
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 | navigationPreload?: boolean;
|
104 | |
105 |
|
106 |
|
107 | offlineGoogleAnalytics?: boolean | GoogleAnalyticsInitializeOptions;
|
108 | runtimeCaching?: Array<RuntimeCaching>;
|
109 | |
110 |
|
111 |
|
112 | skipWaiting?: boolean;
|
113 | |
114 |
|
115 |
|
116 | sourcemap?: boolean;
|
117 | }
|
118 | export interface RequiredGlobDirectoryPartial {
|
119 | globDirectory: string;
|
120 | }
|
121 | export interface OptionalGlobDirectoryPartial {
|
122 | globDirectory?: string;
|
123 | }
|
124 | export interface GlobPartial {
|
125 | |
126 |
|
127 |
|
128 | globFollow?: boolean;
|
129 | |
130 |
|
131 |
|
132 | globIgnores?: Array<string>;
|
133 | |
134 |
|
135 |
|
136 | globPatterns?: Array<string>;
|
137 | |
138 |
|
139 |
|
140 | globStrict?: boolean;
|
141 | templatedURLs?: {
|
142 | [key: string]: string | Array<string>;
|
143 | };
|
144 | }
|
145 | interface InjectPartial {
|
146 | |
147 |
|
148 |
|
149 | injectionPoint?: string;
|
150 | swSrc: string;
|
151 | }
|
152 | interface WebpackPartial {
|
153 | chunks?: Array<string>;
|
154 | exclude?: Array<string | RegExp | ((arg0: string) => boolean)>;
|
155 | excludeChunks?: Array<string>;
|
156 | include?: Array<string | RegExp | ((arg0: string) => boolean)>;
|
157 | mode?: string | null;
|
158 | }
|
159 | export interface RequiredSWDestPartial {
|
160 | swDest: string;
|
161 | }
|
162 | interface WebpackGenerateSWPartial {
|
163 | importScriptsViaChunks?: Array<string>;
|
164 | /**
|
165 | * @default "service-worker.js"
|
166 | */
|
167 | swDest?: string;
|
168 | }
|
169 | interface WebpackInjectManifestPartial {
|
170 | /**
|
171 | * @default true
|
172 | */
|
173 | compileSrc?: boolean;
|
174 | swDest?: string;
|
175 | webpackCompilationPlugins?: Array<any>;
|
176 | }
|
177 | export declare type GenerateSWOptions = BasePartial & GlobPartial & GeneratePartial & RequiredSWDestPartial & OptionalGlobDirectoryPartial;
|
178 | export declare type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
|
179 | export declare type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSWDestPartial & RequiredGlobDirectoryPartial;
|
180 | export declare type WebpackGenerateSWOptions = BasePartial & WebpackPartial & GeneratePartial & WebpackGenerateSWPartial;
|
181 | export declare type WebpackInjectManifestOptions = BasePartial & WebpackPartial & InjectPartial & WebpackInjectManifestPartial;
|
182 | export interface GetManifestResult {
|
183 | count: number;
|
184 | manifestEntries: Array<ManifestEntry>;
|
185 | size: number;
|
186 | warnings: Array<string>;
|
187 | }
|
188 | export declare type BuildResult = Omit<GetManifestResult, 'manifestEntries'> & {
|
189 | filePaths: Array<string>;
|
190 | };
|
191 | export interface FileDetails {
|
192 | file: string;
|
193 | hash: string;
|
194 | size: number;
|
195 | }
|
196 | export declare type BuildType = 'dev' | 'prod';
|
197 | export interface WorkboxPackageJSON extends PackageJson {
|
198 | workbox?: {
|
199 | browserNamespace?: string;
|
200 | packageType?: string;
|
201 | prodOnly?: boolean;
|
202 | };
|
203 | }
|
204 | export {};
|
205 |
|
\ | No newline at end of file |