@serwist/build 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 (98) hide show
  1. package/dist/chunks/constants-BLOVm9H2.js +6 -0
  2. package/dist/chunks/constants-BLOVm9H2.js.map +1 -0
  3. package/dist/chunks/error-Cl4d1Wf-.js +31 -0
  4. package/dist/chunks/error-Cl4d1Wf-.js.map +1 -0
  5. package/dist/chunks/get-manifest-De0D0LAJ.js +14 -0
  6. package/dist/chunks/get-manifest-De0D0LAJ.js.map +1 -0
  7. package/dist/chunks/glob-B4_meZ_o.js +67 -0
  8. package/dist/chunks/glob-B4_meZ_o.js.map +1 -0
  9. package/dist/chunks/inject-manifest-DNqDY-04.js +27 -0
  10. package/dist/chunks/inject-manifest-DNqDY-04.js.map +1 -0
  11. package/dist/chunks/manifest-transform-BCUeQ0-V.d.ts +75 -0
  12. package/dist/chunks/manifest-transform-BCUeQ0-V.d.ts.map +1 -0
  13. package/dist/chunks/rolldown-runtime-CzwdidQP.js +13 -0
  14. package/dist/index.d.mts +475 -0
  15. package/dist/index.d.mts.map +1 -0
  16. package/dist/index.mjs +594 -0
  17. package/dist/index.mjs.map +1 -0
  18. package/dist/index.schema.d.mts +278 -0
  19. package/dist/index.schema.d.mts.map +1 -0
  20. package/dist/index.schema.mjs +5 -0
  21. package/package.json +15 -16
  22. package/src/lib/replace-and-update-source-map.ts +0 -1
  23. package/dist/chunks/constants.js +0 -59
  24. package/dist/chunks/get-manifest.js +0 -11
  25. package/dist/chunks/glob.js +0 -75
  26. package/dist/chunks/inject-manifest.js +0 -29
  27. package/dist/get-manifest.d.ts +0 -19
  28. package/dist/get-manifest.d.ts.map +0 -1
  29. package/dist/index.d.ts +0 -24
  30. package/dist/index.d.ts.map +0 -1
  31. package/dist/index.js +0 -614
  32. package/dist/index.schema.d.ts +0 -13
  33. package/dist/index.schema.d.ts.map +0 -1
  34. package/dist/index.schema.js +0 -9
  35. package/dist/inject-manifest.d.ts +0 -29
  36. package/dist/inject-manifest.d.ts.map +0 -1
  37. package/dist/lib/additional-precache-entries-transform.d.ts +0 -12
  38. package/dist/lib/additional-precache-entries-transform.d.ts.map +0 -1
  39. package/dist/lib/constants.d.ts +0 -2
  40. package/dist/lib/constants.d.ts.map +0 -1
  41. package/dist/lib/errors.d.ts +0 -46
  42. package/dist/lib/errors.d.ts.map +0 -1
  43. package/dist/lib/escape-regexp.d.ts +0 -2
  44. package/dist/lib/escape-regexp.d.ts.map +0 -1
  45. package/dist/lib/get-composite-details.d.ts +0 -3
  46. package/dist/lib/get-composite-details.d.ts.map +0 -1
  47. package/dist/lib/get-file-details.d.ts +0 -9
  48. package/dist/lib/get-file-details.d.ts.map +0 -1
  49. package/dist/lib/get-file-hash.d.ts +0 -2
  50. package/dist/lib/get-file-hash.d.ts.map +0 -1
  51. package/dist/lib/get-file-manifest-entries.d.ts +0 -3
  52. package/dist/lib/get-file-manifest-entries.d.ts.map +0 -1
  53. package/dist/lib/get-file-size.d.ts +0 -2
  54. package/dist/lib/get-file-size.d.ts.map +0 -1
  55. package/dist/lib/get-source-map-url.d.ts +0 -2
  56. package/dist/lib/get-source-map-url.d.ts.map +0 -1
  57. package/dist/lib/get-string-details.d.ts +0 -3
  58. package/dist/lib/get-string-details.d.ts.map +0 -1
  59. package/dist/lib/get-string-hash.d.ts +0 -3
  60. package/dist/lib/get-string-hash.d.ts.map +0 -1
  61. package/dist/lib/maximum-size-transform.d.ts +0 -3
  62. package/dist/lib/maximum-size-transform.d.ts.map +0 -1
  63. package/dist/lib/modify-url-prefix-transform.d.ts +0 -5
  64. package/dist/lib/modify-url-prefix-transform.d.ts.map +0 -1
  65. package/dist/lib/no-revision-for-urls-matching-transform.d.ts +0 -3
  66. package/dist/lib/no-revision-for-urls-matching-transform.d.ts.map +0 -1
  67. package/dist/lib/rebase-path.d.ts +0 -5
  68. package/dist/lib/rebase-path.d.ts.map +0 -1
  69. package/dist/lib/replace-and-update-source-map.d.ts +0 -42
  70. package/dist/lib/replace-and-update-source-map.d.ts.map +0 -1
  71. package/dist/lib/transform-manifest.d.ts +0 -61
  72. package/dist/lib/transform-manifest.d.ts.map +0 -1
  73. package/dist/lib/translate-url-to-sourcemap-paths.d.ts +0 -6
  74. package/dist/lib/translate-url-to-sourcemap-paths.d.ts.map +0 -1
  75. package/dist/lib/validate-options.d.ts +0 -4
  76. package/dist/lib/validate-options.d.ts.map +0 -1
  77. package/dist/schema/assert-type.d.ts +0 -4
  78. package/dist/schema/assert-type.d.ts.map +0 -1
  79. package/dist/schema/base.d.ts +0 -66
  80. package/dist/schema/base.d.ts.map +0 -1
  81. package/dist/schema/error.d.ts +0 -9
  82. package/dist/schema/error.d.ts.map +0 -1
  83. package/dist/schema/get-manifest.d.ts +0 -72
  84. package/dist/schema/get-manifest.d.ts.map +0 -1
  85. package/dist/schema/glob.d.ts +0 -15
  86. package/dist/schema/glob.d.ts.map +0 -1
  87. package/dist/schema/inject-manifest.d.ts +0 -79
  88. package/dist/schema/inject-manifest.d.ts.map +0 -1
  89. package/dist/schema/manifest-entry.d.ts +0 -7
  90. package/dist/schema/manifest-entry.d.ts.map +0 -1
  91. package/dist/schema/manifest-transform.d.ts +0 -64
  92. package/dist/schema/manifest-transform.d.ts.map +0 -1
  93. package/dist/schema/sw-dest.d.ts +0 -8
  94. package/dist/schema/sw-dest.d.ts.map +0 -1
  95. package/dist/schema/utils.d.ts +0 -10
  96. package/dist/schema/utils.d.ts.map +0 -1
  97. package/dist/types.d.ts +0 -204
  98. package/dist/types.d.ts.map +0 -1
@@ -0,0 +1,475 @@
1
+ import { n as manifestTransformResult, r as manifestEntry } from "./chunks/manifest-transform-BCUeQ0-V.js";
2
+ import { z } from "zod";
3
+ import { MaybePromise, Require } from "@serwist/utils";
4
+ import { RawSourceMap } from "source-map";
5
+ import { PackageJson } from "type-fest";
6
+
7
+ //#region src/types.d.ts
8
+ type ManifestEntry = z.input<typeof manifestEntry>;
9
+ type ManifestTransformResult = z.input<typeof manifestTransformResult>;
10
+ type ManifestTransform = (entries: (ManifestEntry & {
11
+ size: number;
12
+ })[], params?: unknown) => MaybePromise<ManifestTransformResult>;
13
+ type ResolvedManifestTransform = (entries: (ManifestEntry & {
14
+ size: number;
15
+ })[], params?: unknown) => Promise<ManifestTransformResult>;
16
+ interface BasePartial {
17
+ /**
18
+ * A list of entries to be precached, in addition to any entries that are
19
+ * generated as part of the build configuration.
20
+ */
21
+ additionalPrecacheEntries?: (string | ManifestEntry)[];
22
+ /**
23
+ * Whether the precache manifest should be set to `undefined`. Essentially whether `@serwist/build` should
24
+ * be disabled. Mostly useful when you want it to only check if the provided options are valid.
25
+ * @default false
26
+ */
27
+ disablePrecacheManifest?: boolean;
28
+ /**
29
+ * Assets that match this will be assumed to be uniquely versioned via their
30
+ * URL, and exempted from the normal HTTP cache-busting that's done when
31
+ * populating the precache. While not required, it's recommended that if your
32
+ * existing build process already inserts a `[hash]` value into each filename,
33
+ * you provide a RegExp that will detect that, as it will reduce the bandwidth
34
+ * consumed when precaching.
35
+ */
36
+ dontCacheBustURLsMatching?: RegExp;
37
+ /**
38
+ * One or more functions which will be applied sequentially against the
39
+ * generated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are
40
+ * also specified, their corresponding transformations will be applied first.
41
+ */
42
+ manifestTransforms?: ManifestTransform[];
43
+ /**
44
+ * Determines the maximum size of files that will be precached. This prevents
45
+ * you from inadvertently precaching very large files that might have accidentally
46
+ * matched one of your patterns.
47
+ * @default 2097152
48
+ */
49
+ maximumFileSizeToCacheInBytes?: number;
50
+ /**
51
+ * An object mapping string prefixes to replacement string values. This can be
52
+ * used to, e.g., remove or add a path prefix from a manifest entry if your
53
+ * web hosting setup doesn't match your local filesystem setup. As an
54
+ * alternative with more flexibility, you can use the `manifestTransforms`
55
+ * option and provide a function that modifies the entries in the manifest
56
+ * using whatever logic you provide.
57
+ *
58
+ * Example usage:
59
+ *
60
+ * ```
61
+ * // Replace a '/dist/' prefix with '/', and also prepend
62
+ * // '/static' to every URL.
63
+ * modifyURLPrefix: {
64
+ * '/dist/': '/',
65
+ * '': '/static',
66
+ * }
67
+ * ```
68
+ */
69
+ modifyURLPrefix?: {
70
+ [key: string]: string;
71
+ };
72
+ }
73
+ interface BaseResolved extends Require<BasePartial, "disablePrecacheManifest" | "maximumFileSizeToCacheInBytes"> {
74
+ manifestTransforms?: ResolvedManifestTransform[];
75
+ }
76
+ interface RequiredGlobDirectoryPartial {
77
+ /**
78
+ * The local directory you wish to match `globPatterns` against. The path is
79
+ * relative to the current directory.
80
+ */
81
+ globDirectory: string;
82
+ }
83
+ type RequiredGlobDirectoryResolved = RequiredGlobDirectoryPartial;
84
+ interface OptionalGlobDirectoryPartial {
85
+ /**
86
+ * The local directory you wish to match `globPatterns` against. The path is
87
+ * relative to the current directory.
88
+ */
89
+ globDirectory?: string;
90
+ }
91
+ type OptionalGlobDirectoryResolved = OptionalGlobDirectoryPartial;
92
+ interface GlobPartial {
93
+ /**
94
+ * Determines whether or not symlinks are followed when generating the
95
+ * precache manifest. For more information, see the definition of `follow` in
96
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
97
+ * @default true
98
+ */
99
+ globFollow?: boolean;
100
+ /**
101
+ * A set of patterns matching files to always exclude when generating the
102
+ * precache manifest. For more information, see the definition of `ignore` in
103
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
104
+ * @default
105
+ * ```
106
+ * ["**\/node_modules\/**\/*"]
107
+ * ```
108
+ */
109
+ globIgnores?: string[];
110
+ /**
111
+ * Files matching any of these patterns will be included in the precache
112
+ * manifest. For more information, see
113
+ * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
114
+ * @default
115
+ * ```
116
+ * ["**\/*.{js,css,html}"]
117
+ * ```
118
+ */
119
+ globPatterns?: string[];
120
+ /**
121
+ * If true, an error reading a directory when generating a precache manifest
122
+ * will cause the build to fail. If false, the problematic directory will be
123
+ * skipped. For more information, see the definition of `strict` in
124
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
125
+ * @default true
126
+ */
127
+ globStrict?: boolean;
128
+ /**
129
+ * If a URL is rendered based on some server-side logic, its contents may
130
+ * depend on multiple files or on some other unique string value. The keys in
131
+ * this object are server-rendered URLs. If the values are an array of
132
+ * strings, they will be interpreted as glob patterns, and the contents of
133
+ * any files matching the patterns will be used to uniquely version the URL.
134
+ * If used with a single string, it will be interpreted as unique versioning
135
+ * information that you've generated for a given URL.
136
+ */
137
+ templatedURLs?: {
138
+ [key: string]: string | string[];
139
+ };
140
+ }
141
+ type GlobResolved = Require<GlobPartial, "globFollow" | "globIgnores" | "globPatterns" | "globStrict">;
142
+ interface InjectPartial {
143
+ /**
144
+ * The string to find inside of the `swSrc` file. Once found, it will be
145
+ * replaced by the generated precache manifest.
146
+ * @default "self.__SW_MANIFEST"
147
+ */
148
+ injectionPoint?: string;
149
+ /**
150
+ * The path to the service worker file that will be read during
151
+ * the build process, relative to the current working directory.
152
+ */
153
+ swSrc: string;
154
+ }
155
+ type InjectResolved = Require<InjectPartial, "injectionPoint">;
156
+ interface RequiredSwDestPartial {
157
+ /**
158
+ * The path and filename of the service worker file that will be created by
159
+ * the build process. It must end in '.js'.
160
+ */
161
+ swDest: string;
162
+ }
163
+ type RequiredSwDestResolved = RequiredSwDestPartial;
164
+ interface OptionalSwDestPartial {
165
+ /**
166
+ * The path and filename of the service worker file that will be created by
167
+ * the build process. It must end in '.js'. If omitted, the path will be
168
+ * based on `swSrc`.
169
+ */
170
+ swDest?: string;
171
+ }
172
+ type OptionalSwDestResolved = OptionalSwDestPartial;
173
+ type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
174
+ type GetManifestOptionsComplete = BaseResolved & GlobResolved & RequiredGlobDirectoryResolved;
175
+ type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSwDestPartial & RequiredGlobDirectoryPartial;
176
+ type InjectManifestOptionsComplete = BaseResolved & GlobResolved & InjectResolved & RequiredSwDestResolved & RequiredGlobDirectoryResolved;
177
+ interface GetManifestResult {
178
+ count: number;
179
+ manifestEntries: ManifestEntry[] | undefined;
180
+ size: number;
181
+ warnings: string[];
182
+ }
183
+ type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
184
+ filePaths: string[];
185
+ };
186
+ /**
187
+ * @private
188
+ */
189
+ interface FileDetails {
190
+ file: string;
191
+ hash: string | null;
192
+ size: number;
193
+ }
194
+ /**
195
+ * @private
196
+ */
197
+ type BuildType = "dev" | "prod";
198
+ /**
199
+ * @private
200
+ */
201
+ type SerwistPackageJSON = PackageJson;
202
+ /**
203
+ * @private
204
+ */
205
+ type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest" | "ViteInjectManifest";
206
+ //#endregion
207
+ //#region src/get-manifest.d.ts
208
+ /**
209
+ * This method returns a list of URLs to precache, referred to as a "precache
210
+ * manifest", along with details about the number of entries and their size,
211
+ * based on the options you provide.
212
+ *
213
+ * ```
214
+ * // The following lists some common options; see the rest of the documentation
215
+ * // for the full set of options and defaults.
216
+ * const {count, manifestEntries, size, warnings} = await getManifest({
217
+ * dontCacheBustURLsMatching: [new RegExp('...')],
218
+ * globDirectory: '...',
219
+ * globPatterns: ['...', '...'],
220
+ * maximumFileSizeToCacheInBytes: ...,
221
+ * });
222
+ * ```
223
+ */
224
+ declare const getManifest: (config: GetManifestOptions) => Promise<GetManifestResult>;
225
+ //#endregion
226
+ //#region src/inject-manifest.d.ts
227
+ /**
228
+ * This method creates a list of URLs to precache, referred to as a "precache
229
+ * manifest", based on the options you provide.
230
+ *
231
+ * The manifest is injected into the `swSrc` file, and the placeholder string
232
+ * `injectionPoint` determines where in the file the manifest should go.
233
+ *
234
+ * The final service worker file, with the manifest injected, is written to
235
+ * disk at `swDest`.
236
+ *
237
+ * This method will not compile or bundle your `swSrc` file; it just handles
238
+ * injecting the manifest.
239
+ *
240
+ * ```
241
+ * // The following lists some common options; see the rest of the documentation
242
+ * // for the full set of options and defaults.
243
+ * const {count, size, warnings} = await injectManifest({
244
+ * dontCacheBustURLsMatching: [new RegExp('...')],
245
+ * globDirectory: '...',
246
+ * globPatterns: ['...', '...'],
247
+ * maximumFileSizeToCacheInBytes: ...,
248
+ * swDest: '...',
249
+ * swSrc: '...',
250
+ * });
251
+ * ```
252
+ */
253
+ declare const injectManifest: (config: InjectManifestOptions) => Promise<BuildResult>;
254
+ //#endregion
255
+ //#region src/lib/constants.d.ts
256
+ declare const DEFAULT_GLOB_PATTERNS: string[];
257
+ //#endregion
258
+ //#region src/lib/errors.d.ts
259
+ declare const errors: {
260
+ "unable-to-get-rootdir": string;
261
+ "no-extension": string;
262
+ "invalid-file-manifest-name": string;
263
+ "unable-to-get-file-manifest-name": string;
264
+ "invalid-sw-dest": string;
265
+ "unable-to-get-sw-name": string;
266
+ "unable-to-get-save-config": string;
267
+ "unable-to-get-file-hash": string;
268
+ "unable-to-get-file-size": string;
269
+ "unable-to-glob-files": string;
270
+ "unable-to-make-manifest-directory": string;
271
+ "read-manifest-template-failure": string;
272
+ "populating-manifest-tmpl-failed": string;
273
+ "manifest-file-write-failure": string;
274
+ "unable-to-make-sw-directory": string;
275
+ "sw-write-failure": string;
276
+ "sw-write-failure-directory": string;
277
+ "unable-to-copy-serwist-libraries": string;
278
+ "invalid-glob-directory": string;
279
+ "invalid-dont-cache-bust": string;
280
+ "invalid-exclude-files": string;
281
+ "invalid-get-manifest-entries-input": string;
282
+ "invalid-manifest-path": string;
283
+ "invalid-manifest-entries": string;
284
+ "invalid-manifest-format": string;
285
+ "invalid-static-file-globs": string;
286
+ "invalid-templated-urls": string;
287
+ "templated-url-matches-glob": string;
288
+ "invalid-glob-ignores": string;
289
+ "manifest-entry-bad-url": string;
290
+ "modify-url-prefix-bad-prefixes": string;
291
+ "invalid-inject-manifest-arg": string;
292
+ "injection-point-not-found": string;
293
+ "multiple-injection-points": string;
294
+ "bad-template-urls-asset": string;
295
+ "invalid-generate-file-manifest-arg": string;
296
+ "invalid-sw-src": string;
297
+ "same-src-and-dest": string;
298
+ "no-module-name": string;
299
+ "bad-manifest-transforms-return-value": string;
300
+ "string-entry-warning": string;
301
+ "cant-find-sourcemap": string;
302
+ "manifest-transforms": string;
303
+ };
304
+ //#endregion
305
+ //#region src/lib/escape-regexp.d.ts
306
+ declare const escapeRegExp: (str: string) => string;
307
+ //#endregion
308
+ //#region src/lib/get-file-manifest-entries.d.ts
309
+ declare const getFileManifestEntries: ({
310
+ additionalPrecacheEntries,
311
+ dontCacheBustURLsMatching,
312
+ globDirectory,
313
+ globFollow,
314
+ globIgnores,
315
+ globPatterns,
316
+ globStrict,
317
+ manifestTransforms,
318
+ maximumFileSizeToCacheInBytes,
319
+ modifyURLPrefix,
320
+ templatedURLs,
321
+ disablePrecacheManifest
322
+ }: GetManifestOptionsComplete) => Promise<GetManifestResult>;
323
+ //#endregion
324
+ //#region src/lib/get-source-map-url.d.ts
325
+ declare function getSourceMapURL(srcContents: string): string | null;
326
+ //#endregion
327
+ //#region src/lib/rebase-path.d.ts
328
+ declare function rebasePath({
329
+ baseDirectory,
330
+ file
331
+ }: {
332
+ baseDirectory: string;
333
+ file: string;
334
+ }): string;
335
+ //#endregion
336
+ //#region src/lib/replace-and-update-source-map.d.ts
337
+ interface ReplaceAndUpdateSourceMapOptions {
338
+ /**
339
+ * The name for the file whose contents
340
+ * correspond to originalSource.
341
+ */
342
+ jsFilename: string;
343
+ /**
344
+ * The sourcemap for originalSource,
345
+ * prior to any replacements.
346
+ */
347
+ originalMap: RawSourceMap;
348
+ /**
349
+ * The source code, prior to any
350
+ * replacements.
351
+ */
352
+ originalSource: string;
353
+ /**
354
+ * A string to swap in for searchString.
355
+ */
356
+ replaceString: string;
357
+ /**
358
+ * A string in originalSource to replace.
359
+ * Only the first occurrence will be replaced.
360
+ */
361
+ searchString: string;
362
+ }
363
+ /**
364
+ * Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern
365
+ * JavaScript updates, along with additional properties copied from originalMap.
366
+ *
367
+ * @param options
368
+ * @returns An object containing both
369
+ * originalSource with the replacement applied, and the modified originalMap.
370
+ * @private
371
+ */
372
+ declare function replaceAndUpdateSourceMap({
373
+ jsFilename,
374
+ originalMap,
375
+ originalSource,
376
+ replaceString,
377
+ searchString
378
+ }: ReplaceAndUpdateSourceMapOptions): Promise<{
379
+ map: string;
380
+ source: string;
381
+ }>;
382
+ //#endregion
383
+ //#region src/lib/transform-manifest.d.ts
384
+ /**
385
+ * A `ManifestTransform` function can be used to modify the modify the `url` or
386
+ * `revision` properties of some or all of the {@linkcode ManifestEntry} in the manifest.
387
+ *
388
+ * Deleting the `revision` property of an entry will cause
389
+ * the corresponding `url` to be precached without cache-busting parameters
390
+ * applied, which is to say, it implies that the URL itself contains
391
+ * proper versioning info. If the `revision` property is present, it must be
392
+ * set to a string.
393
+ *
394
+ * @example A transformation that prepended the origin of a CDN for any
395
+ * URL starting with '/assets/' could be implemented as:
396
+ *
397
+ * const cdnTransform = async (manifestEntries) => {
398
+ * const manifest = manifestEntries.map(entry => {
399
+ * const cdnOrigin = 'https://example.com';
400
+ * if (entry.url.startsWith('/assets/')) {
401
+ * entry.url = cdnOrigin + entry.url;
402
+ * }
403
+ * return entry;
404
+ * });
405
+ * return {manifest, warnings: []};
406
+ * };
407
+ *
408
+ * @example A transformation that nulls the revision field when the
409
+ * URL contains an 8-character hash surrounded by '.', indicating that it
410
+ * already contains revision information:
411
+ *
412
+ * const removeRevisionTransform = async (manifestEntries) => {
413
+ * const manifest = manifestEntries.map(entry => {
414
+ * const hashRegExp = /\.\w{8}\./;
415
+ * if (entry.url.match(hashRegExp)) {
416
+ * entry.revision = null;
417
+ * }
418
+ * return entry;
419
+ * });
420
+ * return {manifest, warnings: []};
421
+ * };
422
+ *
423
+ * @callback ManifestTransform
424
+ * @param manifestEntries The full
425
+ * array of entries, prior to the current transformation.
426
+ * @param compilation When used in the webpack plugins, this param
427
+ * will be set to the current `compilation`.
428
+ * @returns The array of entries with the transformation applied,
429
+ * and optionally, any warnings that should be reported back to the build tool.
430
+ */
431
+ interface ManifestTransformResultWithWarnings {
432
+ count: number;
433
+ size: number;
434
+ manifestEntries: ManifestEntry[] | undefined;
435
+ warnings: string[];
436
+ }
437
+ interface TransformManifestOptions extends Pick<BaseResolved, "additionalPrecacheEntries" | "dontCacheBustURLsMatching" | "manifestTransforms" | "maximumFileSizeToCacheInBytes" | "modifyURLPrefix" | "disablePrecacheManifest"> {
438
+ fileDetails: FileDetails[];
439
+ transformParam?: unknown;
440
+ }
441
+ declare function transformManifest({
442
+ additionalPrecacheEntries,
443
+ dontCacheBustURLsMatching,
444
+ fileDetails,
445
+ manifestTransforms,
446
+ maximumFileSizeToCacheInBytes,
447
+ modifyURLPrefix,
448
+ transformParam,
449
+ disablePrecacheManifest
450
+ }: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings>;
451
+ //#endregion
452
+ //#region src/lib/translate-url-to-sourcemap-paths.d.ts
453
+ declare function translateURLToSourcemapPaths(url: string | null, swSrc: string, swDest: string): {
454
+ destPath: string | undefined;
455
+ srcPath: string | undefined;
456
+ warning: string | undefined;
457
+ };
458
+ //#endregion
459
+ //#region src/lib/validate-options.d.ts
460
+ declare const validateGetManifestOptions: (input: unknown) => Promise<GetManifestOptionsComplete>;
461
+ declare const validateInjectManifestOptions: (input: unknown) => Promise<InjectManifestOptionsComplete>;
462
+ //#endregion
463
+ //#region src/index.d.ts
464
+ /**
465
+ * Use `JSON.stringify` instead.
466
+ *
467
+ * @deprecated
468
+ */
469
+ declare const stringify: {
470
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
471
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
472
+ };
473
+ //#endregion
474
+ export { BasePartial, BaseResolved, BuildResult, BuildType, DEFAULT_GLOB_PATTERNS, FileDetails, GetManifestOptions, GetManifestOptionsComplete, GetManifestResult, GlobPartial, GlobResolved, InjectManifestOptions, InjectManifestOptionsComplete, InjectPartial, InjectResolved, ManifestEntry, ManifestTransform, ManifestTransformResult, MethodNames, OptionalGlobDirectoryPartial, OptionalGlobDirectoryResolved, OptionalSwDestPartial, OptionalSwDestResolved, RequiredGlobDirectoryPartial, RequiredGlobDirectoryResolved, RequiredSwDestPartial, RequiredSwDestResolved, ResolvedManifestTransform, SerwistPackageJSON, errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
475
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/get-manifest.ts","../src/inject-manifest.ts","../src/lib/constants.ts","../src/lib/errors.ts","../src/lib/escape-regexp.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/transform-manifest.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/lib/validate-options.ts","../src/index.ts"],"mappings":";;;;;;;KAMY,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,aAAA;AAAA,KAE/B,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,KAEzC,iBAAA,IAAqB,OAAA,GAAU,aAAA;EAAkB,IAAA;AAAA,MAAmB,MAAA,eAAqB,YAAA,CAAa,uBAAA;AAAA,KAEtG,yBAAA,IAA6B,OAAA,GAAU,aAAA;EAAkB,IAAA;AAAA,MAAmB,MAAA,eAAqB,OAAA,CAAQ,uBAAA;AAAA,UAEpG,WAAA;EARuC;;AAExD;;EAWE,yBAAA,aAAsC,aAAA;EAXK;;;;;EAiB3C,uBAAA;EAfU;;;;;;;;EAwBV,yBAAA,GAA4B,MAAA;EAxB+B;;;;;EA8B3D,kBAAA,GAAqB,iBAAA;EA9BkH;AAEzI;;;;;EAmCE,6BAAA;EAnCkH;;;;;;;;;;AAEpH;;;;;;;;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