@serwist/build 8.0.0

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/get-manifest.d.ts +19 -0
  4. package/dist/get-manifest.d.ts.map +1 -0
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +1295 -0
  8. package/dist/index.old.cjs +1303 -0
  9. package/dist/inject-manifest.d.ts +29 -0
  10. package/dist/inject-manifest.d.ts.map +1 -0
  11. package/dist/lib/.swcrc.d.ts +7 -0
  12. package/dist/lib/.swcrc.d.ts.map +1 -0
  13. package/dist/lib/additional-precache-entries-transform.d.ts +14 -0
  14. package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -0
  15. package/dist/lib/bundle.d.ts +12 -0
  16. package/dist/lib/bundle.d.ts.map +1 -0
  17. package/dist/lib/cdn-utils.d.ts +2 -0
  18. package/dist/lib/cdn-utils.d.ts.map +1 -0
  19. package/dist/lib/copy-serwist-libraries.d.ts +17 -0
  20. package/dist/lib/copy-serwist-libraries.d.ts.map +1 -0
  21. package/dist/lib/errors.d.ts +52 -0
  22. package/dist/lib/errors.d.ts.map +1 -0
  23. package/dist/lib/escape-regexp.d.ts +2 -0
  24. package/dist/lib/escape-regexp.d.ts.map +1 -0
  25. package/dist/lib/get-composite-details.d.ts +3 -0
  26. package/dist/lib/get-composite-details.d.ts.map +1 -0
  27. package/dist/lib/get-file-details.d.ts +15 -0
  28. package/dist/lib/get-file-details.d.ts.map +1 -0
  29. package/dist/lib/get-file-hash.d.ts +2 -0
  30. package/dist/lib/get-file-hash.d.ts.map +1 -0
  31. package/dist/lib/get-file-manifest-entries.d.ts +3 -0
  32. package/dist/lib/get-file-manifest-entries.d.ts.map +1 -0
  33. package/dist/lib/get-file-size.d.ts +2 -0
  34. package/dist/lib/get-file-size.d.ts.map +1 -0
  35. package/dist/lib/get-source-map-url.d.ts +2 -0
  36. package/dist/lib/get-source-map-url.d.ts.map +1 -0
  37. package/dist/lib/get-string-details.d.ts +3 -0
  38. package/dist/lib/get-string-details.d.ts.map +1 -0
  39. package/dist/lib/get-string-hash.d.ts +4 -0
  40. package/dist/lib/get-string-hash.d.ts.map +1 -0
  41. package/dist/lib/maximum-size-transform.d.ts +3 -0
  42. package/dist/lib/maximum-size-transform.d.ts.map +1 -0
  43. package/dist/lib/modify-url-prefix-transform.d.ts +5 -0
  44. package/dist/lib/modify-url-prefix-transform.d.ts.map +1 -0
  45. package/dist/lib/no-revision-for-urls-matching-transform.d.ts +3 -0
  46. package/dist/lib/no-revision-for-urls-matching-transform.d.ts.map +1 -0
  47. package/dist/lib/rebase-path.d.ts +5 -0
  48. package/dist/lib/rebase-path.d.ts.map +1 -0
  49. package/dist/lib/replace-and-update-source-map.d.ts +42 -0
  50. package/dist/lib/replace-and-update-source-map.d.ts.map +1 -0
  51. package/dist/lib/stringify-without-comments.d.ts +4 -0
  52. package/dist/lib/stringify-without-comments.d.ts.map +1 -0
  53. package/dist/lib/transform-manifest.d.ts +61 -0
  54. package/dist/lib/transform-manifest.d.ts.map +1 -0
  55. package/dist/lib/translate-url-to-sourcemap-paths.d.ts +6 -0
  56. package/dist/lib/translate-url-to-sourcemap-paths.d.ts.map +1 -0
  57. package/dist/lib/validate-options.d.ts +8 -0
  58. package/dist/lib/validate-options.d.ts.map +1 -0
  59. package/dist/schema/index.d.ts +444 -0
  60. package/dist/schema/index.d.ts.map +1 -0
  61. package/dist/types.d.ts +530 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/package.json +89 -0
@@ -0,0 +1,29 @@
1
+ import type { BuildResult, InjectManifestOptions } from "./types.js";
2
+ /**
3
+ * This method creates a list of URLs to precache, referred to as a "precache
4
+ * manifest", based on the options you provide.
5
+ *
6
+ * The manifest is injected into the `swSrc` file, and the placeholder string
7
+ * `injectionPoint` determines where in the file the manifest should go.
8
+ *
9
+ * The final service worker file, with the manifest injected, is written to
10
+ * disk at `swDest`.
11
+ *
12
+ * This method will not compile or bundle your `swSrc` file; it just handles
13
+ * injecting the manifest.
14
+ *
15
+ * ```
16
+ * // The following lists some common options; see the rest of the documentation
17
+ * // for the full set of options and defaults.
18
+ * const {count, size, warnings} = await injectManifest({
19
+ * dontCacheBustURLsMatching: [new RegExp('...')],
20
+ * globDirectory: '...',
21
+ * globPatterns: ['...', '...'],
22
+ * maximumFileSizeToCacheInBytes: ...,
23
+ * swDest: '...',
24
+ * swSrc: '...',
25
+ * });
26
+ * ```
27
+ */
28
+ export declare function injectManifest(config: InjectManifestOptions): Promise<BuildResult>;
29
+ //# sourceMappingURL=inject-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAyFxF"}
@@ -0,0 +1,7 @@
1
+ import type { Options } from "@swc/core";
2
+ /**
3
+ * Our default `.swcrc`. Manually inject `env.targets` before use (this is done
4
+ * automatically if you use `getSharedWebpackConfig`).
5
+ */
6
+ export declare const defaultSwcRc: Options;
7
+ //# sourceMappingURL=.swcrc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":".swcrc.d.ts","sourceRoot":"","sources":["../../src/lib/.swcrc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,OA8B1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ManifestEntry } from "../types.js";
2
+ type AdditionalManifestEntriesTransform = {
3
+ (manifest: Array<ManifestEntry & {
4
+ size: number;
5
+ }>): {
6
+ manifest: Array<ManifestEntry & {
7
+ size: number;
8
+ }>;
9
+ warnings: string[];
10
+ };
11
+ };
12
+ export declare function additionalPrecacheEntriesTransform(additionalPrecacheEntries: Array<ManifestEntry | string>): AdditionalManifestEntriesTransform;
13
+ export {};
14
+ //# sourceMappingURL=additional-precache-entries-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"additional-precache-entries-transform.d.ts","sourceRoot":"","sources":["../../src/lib/additional-precache-entries-transform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,kCAAkC,GAAG;IACxC,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACnD,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClD,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,wBAAgB,kCAAkC,CAAC,yBAAyB,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,kCAAkC,CAqC/I"}
@@ -0,0 +1,12 @@
1
+ import { type Replacement } from "@rollup/plugin-replace";
2
+ import type { GeneratePartial, RequiredSWDestPartial } from "../types.js";
3
+ interface NameAndContents {
4
+ contents: string | Uint8Array;
5
+ name: string;
6
+ }
7
+ export declare function bundle({ mode, sourcemap, swDest, unbundledCode, replaceValues, }: Omit<GeneratePartial, "runtimeCaching"> & RequiredSWDestPartial & {
8
+ unbundledCode: string;
9
+ replaceValues?: Record<string, Replacement>;
10
+ }): Promise<Array<NameAndContents>>;
11
+ export {};
12
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/lib/bundle.ts"],"names":[],"mappings":"AAUA,OAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOnE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAG1E,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,MAAM,CAAC,EAE3B,IAAI,EACJ,SAAS,EACT,MAAM,EACN,aAAa,EACb,aAAa,GACd,EAAE,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,GACxC,qBAAqB,GAAG;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAC7C,GAAG,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAkFpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cdn-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdn-utils.d.ts","sourceRoot":"","sources":["../../src/lib/cdn-utils.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This copies over a set of runtime libraries used by Serwist into a
3
+ * local directory, which should be deployed alongside your service worker file.
4
+ *
5
+ * As an alternative to deploying these local copies, you could instead use
6
+ * Serwist from its official CDN URL.
7
+ *
8
+ * This method is exposed for the benefit of developers using
9
+ * `@serwist/build.injectManifest` who would
10
+ * prefer not to use the CDN copies of Serwist.
11
+ *
12
+ * @param destDirectory The path to the parent directory under which
13
+ * the new directory of libraries will be created.
14
+ * @returns The name of the newly created directory.
15
+ */
16
+ export declare function copySerwistLibraries(destDirectory: string): Promise<string>;
17
+ //# sourceMappingURL=copy-serwist-libraries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-serwist-libraries.d.ts","sourceRoot":"","sources":["../../src/lib/copy-serwist-libraries.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BjF"}
@@ -0,0 +1,52 @@
1
+ export declare const errors: {
2
+ "unable-to-get-rootdir": string;
3
+ "no-extension": string;
4
+ "invalid-file-manifest-name": string;
5
+ "unable-to-get-file-manifest-name": string;
6
+ "invalid-sw-dest": string;
7
+ "unable-to-get-sw-name": string;
8
+ "unable-to-get-save-config": string;
9
+ "unable-to-get-file-hash": string;
10
+ "unable-to-get-file-size": string;
11
+ "unable-to-glob-files": string;
12
+ "unable-to-make-manifest-directory": string;
13
+ "read-manifest-template-failure": string;
14
+ "populating-manifest-tmpl-failed": string;
15
+ "manifest-file-write-failure": string;
16
+ "unable-to-make-sw-directory": string;
17
+ "sw-write-failure": string;
18
+ "sw-write-failure-directory": string;
19
+ "unable-to-copy-serwist-libraries": string;
20
+ "invalid-glob-directory": string;
21
+ "invalid-dont-cache-bust": string;
22
+ "invalid-exclude-files": string;
23
+ "invalid-get-manifest-entries-input": string;
24
+ "invalid-manifest-path": string;
25
+ "invalid-manifest-entries": string;
26
+ "invalid-manifest-format": string;
27
+ "invalid-static-file-globs": string;
28
+ "invalid-templated-urls": string;
29
+ "templated-url-matches-glob": string;
30
+ "invalid-glob-ignores": string;
31
+ "manifest-entry-bad-url": string;
32
+ "modify-url-prefix-bad-prefixes": string;
33
+ "invalid-inject-manifest-arg": string;
34
+ "injection-point-not-found": string;
35
+ "multiple-injection-points": string;
36
+ "useless-glob-pattern": string;
37
+ "bad-template-urls-asset": string;
38
+ "invalid-runtime-caching": string;
39
+ "static-file-globs-deprecated": string;
40
+ "dynamic-url-deprecated": string;
41
+ "urlPattern-is-required": string;
42
+ "handler-is-required": string;
43
+ "invalid-generate-file-manifest-arg": string;
44
+ "invalid-sw-src": string;
45
+ "same-src-and-dest": string;
46
+ "no-module-name": string;
47
+ "bad-manifest-transforms-return-value": string;
48
+ "string-entry-warning": string;
49
+ "cant-find-sourcemap": string;
50
+ "manifest-transforms": string;
51
+ };
52
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FlB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function escapeRegExp(str: string): string;
2
+ //# sourceMappingURL=escape-regexp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-regexp.d.ts","sourceRoot":"","sources":["../../src/lib/escape-regexp.ts"],"names":[],"mappings":"AASA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,3 @@
1
+ import type { FileDetails } from "../types.js";
2
+ export declare function getCompositeDetails(compositeURL: string, dependencyDetails: Array<FileDetails>): FileDetails;
3
+ //# sourceMappingURL=get-composite-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-composite-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-composite-details.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,WAAW,CAkB5G"}
@@ -0,0 +1,15 @@
1
+ import type { GlobPartial } from "../types.js";
2
+ interface FileDetails {
3
+ file: string;
4
+ hash: string;
5
+ size: number;
6
+ }
7
+ export declare function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, "globDirectory" | "globPatterns" | "templatedURLs"> & {
8
+ globDirectory: string;
9
+ globPattern: string;
10
+ }): {
11
+ globbedFileDetails: Array<FileDetails>;
12
+ warning: string;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=get-file-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-details.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,GACZ,EAAE,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,GAAG;IAEzE,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG;IACF,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB,CAiCA"}
@@ -0,0 +1,2 @@
1
+ export declare function getFileHash(file: string): string;
2
+ //# sourceMappingURL=get-file-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOhD"}
@@ -0,0 +1,3 @@
1
+ import type { GetManifestOptions, GetManifestResult } from "../types.js";
2
+ export declare function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, }: GetManifestOptions): Promise<GetManifestResult>;
3
+ //# sourceMappingURL=get-file-manifest-entries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-manifest-entries.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-manifest-entries.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOtF,wBAAsB,sBAAsB,CAAC,EAC3C,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,aAAa,GACd,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqFjD"}
@@ -0,0 +1,2 @@
1
+ export declare function getFileSize(file: string): number | null;
2
+ //# sourceMappingURL=get-file-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-size.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-size.ts"],"names":[],"mappings":"AAYA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUvD"}
@@ -0,0 +1,2 @@
1
+ export declare function getSourceMapURL(srcContents: string): string | null;
2
+ //# sourceMappingURL=get-source-map-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-source-map-url.d.ts","sourceRoot":"","sources":["../../src/lib/get-source-map-url.ts"],"names":[],"mappings":"AA4BA,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGlE"}
@@ -0,0 +1,3 @@
1
+ import type { FileDetails } from "../types.js";
2
+ export declare function getStringDetails(url: string, str: string): FileDetails;
3
+ //# sourceMappingURL=get-string-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-string-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-details.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAMtE"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import crypto from "crypto";
3
+ export declare function getStringHash(input: crypto.BinaryLike): string;
4
+ //# sourceMappingURL=get-string-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-string-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-hash.ts"],"names":[],"mappings":";AAQA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAI9D"}
@@ -0,0 +1,3 @@
1
+ import type { ManifestTransform } from "../types.js";
2
+ export declare function maximumSizeTransform(maximumFileSizeToCacheInBytes: number): ManifestTransform;
3
+ //# sourceMappingURL=maximum-size-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maximum-size-transform.d.ts","sourceRoot":"","sources":["../../src/lib/maximum-size-transform.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,6BAA6B,EAAE,MAAM,GAAG,iBAAiB,CAgB7F"}
@@ -0,0 +1,5 @@
1
+ import type { ManifestTransform } from "../types.js";
2
+ export declare function modifyURLPrefixTransform(modifyURLPrefix: {
3
+ [key: string]: string;
4
+ }): ManifestTransform;
5
+ //# sourceMappingURL=modify-url-prefix-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-url-prefix-transform.d.ts","sourceRoot":"","sources":["../../src/lib/modify-url-prefix-transform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD,wBAAgB,wBAAwB,CAAC,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,iBAAiB,CA0CtG"}
@@ -0,0 +1,3 @@
1
+ import type { ManifestTransform } from "../types.js";
2
+ export declare function noRevisionForURLsMatchingTransform(regexp: RegExp): ManifestTransform;
3
+ //# sourceMappingURL=no-revision-for-urls-matching-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-revision-for-urls-matching-transform.d.ts","sourceRoot":"","sources":["../../src/lib/no-revision-for-urls-matching-transform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAoBpF"}
@@ -0,0 +1,5 @@
1
+ export declare function rebasePath({ baseDirectory, file }: {
2
+ baseDirectory: string;
3
+ file: string;
4
+ }): string;
5
+ //# sourceMappingURL=rebase-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebase-path.d.ts","sourceRoot":"","sources":["../../src/lib/rebase-path.ts"],"names":[],"mappings":"AAUA,wBAAgB,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAWnG"}
@@ -0,0 +1,42 @@
1
+ import type { RawSourceMap } from "source-map";
2
+ interface ReplaceAndUpdateSourceMapOptions {
3
+ /**
4
+ * The name for the file whose contents
5
+ * correspond to originalSource.
6
+ */
7
+ jsFilename: string;
8
+ /**
9
+ * The sourcemap for originalSource,
10
+ * prior to any replacements.
11
+ */
12
+ originalMap: RawSourceMap;
13
+ /**
14
+ * The source code, prior to any
15
+ * replacements.
16
+ */
17
+ originalSource: string;
18
+ /**
19
+ * A string to swap in for searchString.
20
+ */
21
+ replaceString: string;
22
+ /**
23
+ * A string in originalSource to replace.
24
+ * Only the first occurrence will be replaced.
25
+ */
26
+ searchString: string;
27
+ }
28
+ /**
29
+ * Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern
30
+ * JavaScript updates, along with additional properties copied from originalMap.
31
+ *
32
+ * @param options
33
+ * @returns An object containing both
34
+ * originalSource with the replacement applied, and the modified originalMap.
35
+ * @private
36
+ */
37
+ export declare function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString, }: ReplaceAndUpdateSourceMapOptions): Promise<{
38
+ map: string;
39
+ source: string;
40
+ }>;
41
+ export {};
42
+ //# sourceMappingURL=replace-and-update-source-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-and-update-source-map.d.ts","sourceRoot":"","sources":["../../src/lib/replace-and-update-source-map.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,UAAU,gCAAgC;IACxC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,EAC9C,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,EAAE,gCAAgC,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoE7E"}
@@ -0,0 +1,4 @@
1
+ export declare function stringifyWithoutComments(obj: {
2
+ [key: string]: any;
3
+ }): string;
4
+ //# sourceMappingURL=stringify-without-comments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify-without-comments.d.ts","sourceRoot":"","sources":["../../src/lib/stringify-without-comments.ts"],"names":[],"mappings":"AAWA,wBAAgB,wBAAwB,CAAC,GAAG,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,MAAM,CAW5E"}
@@ -0,0 +1,61 @@
1
+ import type { BasePartial, FileDetails, ManifestEntry } from "../types.js";
2
+ /**
3
+ * A `ManifestTransform` function can be used to modify the modify the `url` or
4
+ * `revision` properties of some or all of the
5
+ * `@serwist/build.ManifestEntry` in the manifest.
6
+ *
7
+ * Deleting the `revision` property of an entry will cause
8
+ * the corresponding `url` to be precached without cache-busting parameters
9
+ * applied, which is to say, it implies that the URL itself contains
10
+ * proper versioning info. If the `revision` property is present, it must be
11
+ * set to a string.
12
+ *
13
+ * @example A transformation that prepended the origin of a CDN for any
14
+ * URL starting with '/assets/' could be implemented as:
15
+ *
16
+ * const cdnTransform = async (manifestEntries) => {
17
+ * const manifest = manifestEntries.map(entry => {
18
+ * const cdnOrigin = 'https://example.com';
19
+ * if (entry.url.startsWith('/assets/')) {
20
+ * entry.url = cdnOrigin + entry.url;
21
+ * }
22
+ * return entry;
23
+ * });
24
+ * return {manifest, warnings: []};
25
+ * };
26
+ *
27
+ * @example A transformation that nulls the revision field when the
28
+ * URL contains an 8-character hash surrounded by '.', indicating that it
29
+ * already contains revision information:
30
+ *
31
+ * const removeRevisionTransform = async (manifestEntries) => {
32
+ * const manifest = manifestEntries.map(entry => {
33
+ * const hashRegExp = /\.\w{8}\./;
34
+ * if (entry.url.match(hashRegExp)) {
35
+ * entry.revision = null;
36
+ * }
37
+ * return entry;
38
+ * });
39
+ * return {manifest, warnings: []};
40
+ * };
41
+ *
42
+ * @callback ManifestTransform
43
+ * @param manifestEntries The full
44
+ * array of entries, prior to the current transformation.
45
+ * @param compilation When used in the webpack plugins, this param
46
+ * will be set to the current `compilation`.
47
+ * @returns The array of entries with the transformation applied,
48
+ * and optionally, any warnings that should be reported back to the build tool.
49
+ */
50
+ interface ManifestTransformResultWithWarnings {
51
+ count: number;
52
+ size: number;
53
+ manifestEntries: ManifestEntry[];
54
+ warnings: string[];
55
+ }
56
+ export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, }: BasePartial & {
57
+ fileDetails: Array<FileDetails>;
58
+ transformParam?: unknown;
59
+ }): Promise<ManifestTransformResultWithWarnings>;
60
+ export {};
61
+ //# sourceMappingURL=transform-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAO9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,UAAU,mCAAmC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,wBAAsB,iBAAiB,CAAC,EACtC,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,cAAc,GACf,EAAE,WAAW,GAAG;IACf,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAGhC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,mCAAmC,CAAC,CA+D/C"}
@@ -0,0 +1,6 @@
1
+ export declare function translateURLToSourcemapPaths(url: string | null, swSrc: string, swDest: string): {
2
+ destPath: string | undefined;
3
+ srcPath: string | undefined;
4
+ warning: string | undefined;
5
+ };
6
+ //# sourceMappingURL=translate-url-to-sourcemap-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate-url-to-sourcemap-paths.d.ts","sourceRoot":"","sources":["../../src/lib/translate-url-to-sourcemap-paths.ts"],"names":[],"mappings":"AAaA,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb;IACD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAgBA"}
@@ -0,0 +1,8 @@
1
+ import type { GetManifestOptions, InjectManifestOptions, WebpackInjectManifestOptions } from "../types.js";
2
+ export declare class SerwistConfigError extends Error {
3
+ constructor(message?: string);
4
+ }
5
+ export declare function validateGetManifestOptions(input: unknown): GetManifestOptions;
6
+ export declare function validateInjectManifestOptions(input: unknown): InjectManifestOptions;
7
+ export declare function validateWebpackInjectManifestOptions(input: unknown): WebpackInjectManifestOptions;
8
+ //# sourceMappingURL=validate-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../src/lib/validate-options.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAe,4BAA4B,EAAE,MAAM,aAAa,CAAC;AASxH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAI7B;AAwCD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAI7E;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAInF;AAED,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CAWjG"}