@serwist/build 9.1.1 → 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/dist/chunks/{error.js → constants.js} +5 -1
- package/dist/chunks/get-manifest.js +1 -0
- package/dist/chunks/glob.js +2 -3
- package/dist/chunks/inject-manifest.js +1 -1
- package/dist/index.d.ts +3 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -145
- package/dist/index.schema.d.ts +3 -3
- package/dist/index.schema.d.ts.map +1 -1
- package/dist/index.schema.js +1 -1
- package/dist/inject-manifest.d.ts.map +1 -1
- package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/get-file-details.d.ts +2 -1
- package/dist/lib/get-file-details.d.ts.map +1 -1
- package/dist/lib/get-file-manifest-entries.d.ts.map +1 -1
- package/dist/lib/modify-url-prefix-transform.d.ts.map +1 -1
- package/dist/lib/no-revision-for-urls-matching-transform.d.ts.map +1 -1
- package/dist/lib/transform-manifest.d.ts +2 -1
- package/dist/lib/transform-manifest.d.ts.map +1 -1
- package/dist/lib/validate-options.d.ts.map +1 -1
- package/dist/schema/glob.d.ts.map +1 -1
- package/dist/schema/inject-manifest.d.ts +2 -2
- package/dist/types.d.ts +14 -22
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -8
- package/src/index.schema.ts +3 -3
- package/src/index.ts +5 -11
- package/src/inject-manifest.ts +2 -1
- package/src/lib/additional-precache-entries-transform.ts +1 -2
- package/src/lib/constants.ts +1 -0
- package/src/lib/get-file-details.ts +3 -4
- package/src/lib/get-file-manifest-entries.ts +3 -4
- package/src/lib/modify-url-prefix-transform.ts +1 -1
- package/src/lib/no-revision-for-urls-matching-transform.ts +1 -1
- package/src/lib/rebase-path.ts +1 -1
- package/src/lib/transform-manifest.ts +3 -2
- package/src/lib/translate-url-to-sourcemap-paths.ts +1 -1
- package/src/lib/validate-options.ts +1 -2
- package/src/schema/base.ts +1 -1
- package/src/schema/get-manifest.ts +1 -1
- package/src/schema/glob.ts +3 -2
- package/src/schema/inject-manifest.ts +2 -2
- package/src/schema/sw-dest.ts +1 -1
- package/src/types.ts +16 -23
- package/dist/lib/errors.d.ts +0 -47
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/get-composite-details.d.ts +0 -3
- package/dist/lib/get-composite-details.d.ts.map +0 -1
- package/dist/lib/get-file-hash.d.ts +0 -2
- package/dist/lib/get-file-hash.d.ts.map +0 -1
- package/dist/lib/get-file-size.d.ts +0 -2
- package/dist/lib/get-file-size.d.ts.map +0 -1
- package/dist/lib/get-string-details.d.ts +0 -3
- package/dist/lib/get-string-details.d.ts.map +0 -1
- package/dist/lib/get-string-hash.d.ts +0 -3
- package/dist/lib/get-string-hash.d.ts.map +0 -1
- package/src/lib/errors.ts +0 -93
- package/src/lib/get-composite-details.ts +0 -31
- package/src/lib/get-file-hash.ts +0 -21
- package/src/lib/get-file-size.ts +0 -22
- package/src/lib/get-string-details.ts +0 -16
- package/src/lib/get-string-hash.ts +0 -15
|
@@ -52,4 +52,8 @@ const validationErrorMap = (error)=>{
|
|
|
52
52
|
return undefined;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
const DEFAULT_GLOB_PATTERNS = [
|
|
56
|
+
"**/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
export { DEFAULT_GLOB_PATTERNS as D, SerwistConfigError as S, validationErrorMap as v };
|
package/dist/chunks/glob.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { D as DEFAULT_GLOB_PATTERNS } from './constants.js';
|
|
2
3
|
|
|
3
4
|
const manifestEntry = z.strictObject({
|
|
4
5
|
integrity: z.string().optional(),
|
|
@@ -57,9 +58,7 @@ const globPartial = z.strictObject({
|
|
|
57
58
|
globIgnores: z.array(z.string()).default([
|
|
58
59
|
"**/node_modules/**/*"
|
|
59
60
|
]),
|
|
60
|
-
globPatterns: z.array(z.string()).default(
|
|
61
|
-
"**/*.{js,css,html}"
|
|
62
|
-
]),
|
|
61
|
+
globPatterns: z.array(z.string()).default(DEFAULT_GLOB_PATTERNS),
|
|
63
62
|
globStrict: z.boolean().default(true),
|
|
64
63
|
templatedURLs: z.record(z.string(), z.union([
|
|
65
64
|
z.string(),
|
|
@@ -9,7 +9,7 @@ const requiredSwDestPartial = z.strictObject({
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const baseInjectPartial = z.strictObject({
|
|
12
|
-
injectionPoint: z.string().
|
|
12
|
+
injectionPoint: z.string().prefault("self.__SW_MANIFEST"),
|
|
13
13
|
swSrc: z.string()
|
|
14
14
|
});
|
|
15
15
|
const injectManifestOptions = z.strictObject({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { errors } from "@serwist/utils/node";
|
|
1
2
|
import { getManifest } from "./get-manifest.js";
|
|
2
3
|
import { injectManifest } from "./inject-manifest.js";
|
|
3
|
-
import {
|
|
4
|
+
import { DEFAULT_GLOB_PATTERNS } from "./lib/constants.js";
|
|
4
5
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
5
6
|
import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
|
|
6
7
|
import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
@@ -9,15 +10,6 @@ import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.j
|
|
|
9
10
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
10
11
|
import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
|
|
11
12
|
import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
|
|
12
|
-
|
|
13
|
-
* Use `JSON.stringify` instead.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
declare const stringify: {
|
|
18
|
-
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
19
|
-
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
20
|
-
};
|
|
21
|
-
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions, };
|
|
13
|
+
export { errors, DEFAULT_GLOB_PATTERNS, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions, };
|
|
22
14
|
export type * from "./types.js";
|
|
23
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAEtG,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,EAC1B,6BAA6B,GAC9B,CAAC;AAEF,mBAAmB,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,142 +1,16 @@
|
|
|
1
|
+
import { errors, getFileSize, getFileHash, getCompositeDetails, getStringDetails } from '@serwist/utils/node';
|
|
2
|
+
export { errors } from '@serwist/utils/node';
|
|
1
3
|
import assert from 'node:assert';
|
|
2
|
-
import { oneLine } from 'common-tags';
|
|
3
|
-
import crypto from 'node:crypto';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { globSync } from 'glob';
|
|
6
|
-
import fs, { readFileSync } from 'node:fs';
|
|
7
6
|
import prettyBytes from 'pretty-bytes';
|
|
8
7
|
import { z } from 'zod';
|
|
9
|
-
import { v as validationErrorMap, S as SerwistConfigError } from './chunks/
|
|
8
|
+
import { v as validationErrorMap, S as SerwistConfigError } from './chunks/constants.js';
|
|
9
|
+
export { D as DEFAULT_GLOB_PATTERNS } from './chunks/constants.js';
|
|
10
10
|
import fsp from 'node:fs/promises';
|
|
11
|
+
import { toUnix } from '@serwist/utils';
|
|
11
12
|
import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
|
|
12
|
-
|
|
13
|
-
const errors = {
|
|
14
|
-
"unable-to-get-rootdir": "Unable to get the root directory of your web app.",
|
|
15
|
-
"no-extension": oneLine`Unable to detect a usable extension for a file in your web
|
|
16
|
-
app directory.`,
|
|
17
|
-
"invalid-file-manifest-name": oneLine`The File Manifest Name must have at least one
|
|
18
|
-
character.`,
|
|
19
|
-
"unable-to-get-file-manifest-name": "Unable to get a file manifest name.",
|
|
20
|
-
"invalid-sw-dest": `The 'swDest' value must be a valid path.`,
|
|
21
|
-
"unable-to-get-sw-name": "Unable to get a service worker file name.",
|
|
22
|
-
"unable-to-get-save-config": oneLine`An error occurred when asking to save details
|
|
23
|
-
in a config file.`,
|
|
24
|
-
"unable-to-get-file-hash": oneLine`An error occurred when attempting to create a
|
|
25
|
-
file hash.`,
|
|
26
|
-
"unable-to-get-file-size": oneLine`An error occurred when attempting to get a file
|
|
27
|
-
size.`,
|
|
28
|
-
"unable-to-glob-files": "An error occurred when globbing for files.",
|
|
29
|
-
"unable-to-make-manifest-directory": oneLine`Unable to make output directory for
|
|
30
|
-
file manifest.`,
|
|
31
|
-
"read-manifest-template-failure": "Unable to read template for file manifest",
|
|
32
|
-
"populating-manifest-tmpl-failed": oneLine`An error occurred when populating the
|
|
33
|
-
file manifest template.`,
|
|
34
|
-
"manifest-file-write-failure": "Unable to write the file manifest.",
|
|
35
|
-
"unable-to-make-sw-directory": oneLine`Unable to make the directories to output
|
|
36
|
-
the service worker path.`,
|
|
37
|
-
"sw-write-failure": "Unable to write the service worker file.",
|
|
38
|
-
"sw-write-failure-directory": oneLine`Unable to write the service worker file;
|
|
39
|
-
'swDest' should be a full path to the file, not a path to a directory.`,
|
|
40
|
-
"unable-to-copy-serwist-libraries": oneLine`One or more of the Serwist libraries
|
|
41
|
-
could not be copied over to the destination directory: `,
|
|
42
|
-
"invalid-glob-directory": oneLine`The supplied globDirectory must be a path as a
|
|
43
|
-
string.`,
|
|
44
|
-
"invalid-dont-cache-bust": oneLine`The supplied 'dontCacheBustURLsMatching'
|
|
45
|
-
parameter must be a RegExp.`,
|
|
46
|
-
"invalid-exclude-files": "The excluded files should be an array of strings.",
|
|
47
|
-
"invalid-get-manifest-entries-input": oneLine`The input to
|
|
48
|
-
'getFileManifestEntries()' must be an object.`,
|
|
49
|
-
"invalid-manifest-path": oneLine`The supplied manifest path is not a string with
|
|
50
|
-
at least one character.`,
|
|
51
|
-
"invalid-manifest-entries": oneLine`The manifest entries must be an array of
|
|
52
|
-
strings or JavaScript objects containing a url parameter.`,
|
|
53
|
-
"invalid-manifest-format": oneLine`The value of the 'format' option passed to
|
|
54
|
-
generateFileManifest() must be either 'iife' (the default) or 'es'.`,
|
|
55
|
-
"invalid-static-file-globs": oneLine`The 'globPatterns' value must be an array
|
|
56
|
-
of strings.`,
|
|
57
|
-
"invalid-templated-urls": oneLine`The 'templatedURLs' value should be an object
|
|
58
|
-
that maps URLs to either a string, or to an array of glob patterns.`,
|
|
59
|
-
"templated-url-matches-glob": oneLine`One of the 'templatedURLs' URLs is already
|
|
60
|
-
being tracked via 'globPatterns': `,
|
|
61
|
-
"invalid-glob-ignores": oneLine`The 'globIgnores' parameter must be an array of
|
|
62
|
-
glob pattern strings.`,
|
|
63
|
-
"manifest-entry-bad-url": oneLine`The generated manifest contains an entry without
|
|
64
|
-
a URL string. This is likely an error with @serwist/build.`,
|
|
65
|
-
"modify-url-prefix-bad-prefixes": oneLine`The 'modifyURLPrefix' parameter must be
|
|
66
|
-
an object with string key value pairs.`,
|
|
67
|
-
"invalid-inject-manifest-arg": oneLine`The input to 'injectManifest()' must be an
|
|
68
|
-
object.`,
|
|
69
|
-
"injection-point-not-found": oneLine`Unable to find a place to inject the manifest.
|
|
70
|
-
Please ensure that your service worker file contains the following: `,
|
|
71
|
-
"multiple-injection-points": oneLine`Please ensure that your 'swSrc' file contains
|
|
72
|
-
only one match for the following: `,
|
|
73
|
-
"useless-glob-pattern": oneLine`One of the glob patterns doesn't match any files.
|
|
74
|
-
Please remove or fix the following: `,
|
|
75
|
-
"bad-template-urls-asset": oneLine`There was an issue using one of the provided
|
|
76
|
-
'templatedURLs'.`,
|
|
77
|
-
"invalid-generate-file-manifest-arg": oneLine`The input to generateFileManifest()
|
|
78
|
-
must be an Object.`,
|
|
79
|
-
"invalid-sw-src": `The 'swSrc' file can't be read.`,
|
|
80
|
-
"same-src-and-dest": oneLine`Unable to find a place to inject the manifest. This is
|
|
81
|
-
likely because swSrc and swDest are configured to the same file.
|
|
82
|
-
Please ensure that your swSrc file contains the following:`,
|
|
83
|
-
"no-module-name": oneLine`You must provide a moduleName parameter when calling
|
|
84
|
-
getModuleURL().`,
|
|
85
|
-
"bad-manifest-transforms-return-value": oneLine`The return value from a
|
|
86
|
-
manifestTransform should be an object with 'manifest' and optionally
|
|
87
|
-
'warnings' properties.`,
|
|
88
|
-
"string-entry-warning": oneLine`Some items were passed to additionalPrecacheEntries
|
|
89
|
-
without revisioning info. This is generally NOT safe. Learn more at
|
|
90
|
-
https://bit.ly/wb-precache.`,
|
|
91
|
-
"cant-find-sourcemap": oneLine`The swSrc file refers to a sourcemap that can't be
|
|
92
|
-
opened:`,
|
|
93
|
-
"manifest-transforms": oneLine`When using manifestTransforms, you must provide
|
|
94
|
-
an array of functions.`
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const getCompositeDetails = (compositeURL, dependencyDetails)=>{
|
|
98
|
-
let totalSize = 0;
|
|
99
|
-
let compositeHash = "";
|
|
100
|
-
for (const fileDetails of dependencyDetails){
|
|
101
|
-
totalSize += fileDetails.size;
|
|
102
|
-
compositeHash += fileDetails.hash === null ? "" : fileDetails.hash;
|
|
103
|
-
}
|
|
104
|
-
const md5 = crypto.createHash("md5");
|
|
105
|
-
md5.update(compositeHash);
|
|
106
|
-
const hashOfHashes = md5.digest("hex");
|
|
107
|
-
return {
|
|
108
|
-
file: compositeURL,
|
|
109
|
-
hash: hashOfHashes,
|
|
110
|
-
size: totalSize
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
function getStringHash(input) {
|
|
115
|
-
const md5 = crypto.createHash("md5");
|
|
116
|
-
md5.update(input);
|
|
117
|
-
return md5.digest("hex");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const getFileHash = (file)=>{
|
|
121
|
-
try {
|
|
122
|
-
const buffer = readFileSync(file);
|
|
123
|
-
return getStringHash(buffer);
|
|
124
|
-
} catch (err) {
|
|
125
|
-
throw new Error(`${errors["unable-to-get-file-hash"]} '${err instanceof Error && err.message ? err.message : ""}'`);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const getFileSize = (file)=>{
|
|
130
|
-
try {
|
|
131
|
-
const stat = fs.statSync(file);
|
|
132
|
-
if (!stat.isFile()) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
return stat.size;
|
|
136
|
-
} catch (err) {
|
|
137
|
-
throw new Error(`${errors["unable-to-get-file-size"]} '${err instanceof Error && err.message ? err.message : ""}'`);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
13
|
+
import fs from 'node:fs';
|
|
140
14
|
|
|
141
15
|
const getFileDetails = ({ globDirectory, globFollow, globIgnores, globPattern })=>{
|
|
142
16
|
let globbedFiles;
|
|
@@ -176,12 +50,6 @@ const getFileDetails = ({ globDirectory, globFollow, globIgnores, globPattern })
|
|
|
176
50
|
};
|
|
177
51
|
};
|
|
178
52
|
|
|
179
|
-
const getStringDetails = (url, str)=>({
|
|
180
|
-
file: url,
|
|
181
|
-
hash: getStringHash(str),
|
|
182
|
-
size: str.length
|
|
183
|
-
});
|
|
184
|
-
|
|
185
53
|
const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
|
|
186
54
|
return (manifest)=>{
|
|
187
55
|
const warnings = [];
|
|
@@ -457,10 +325,6 @@ const getManifest = async (config)=>{
|
|
|
457
325
|
return await getFileManifestEntries(options);
|
|
458
326
|
};
|
|
459
327
|
|
|
460
|
-
const toUnix = (p)=>{
|
|
461
|
-
return p.replace(/\\/g, "/").replace(/(?<!^)\/+/g, "/");
|
|
462
|
-
};
|
|
463
|
-
|
|
464
328
|
const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
|
|
465
329
|
const regex = RegExp(`(?:/\\*(?:\\s*\r?\n(?://)?)?(?:${innerRegex.source})\\s*\\*/|//(?:${innerRegex.source}))\\s*`);
|
|
466
330
|
function getSourceMapURL(srcContents) {
|
|
@@ -624,6 +488,4 @@ const injectManifest = async (config)=>{
|
|
|
624
488
|
};
|
|
625
489
|
};
|
|
626
490
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
|
|
491
|
+
export { escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
|
package/dist/index.schema.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type Assignable, type Equals
|
|
1
|
+
import { type Assignable, assertType, type Equals } from "./schema/assert-type.js";
|
|
2
2
|
import { basePartial } from "./schema/base.js";
|
|
3
|
+
import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
|
|
3
4
|
import { getManifestOptions } from "./schema/get-manifest.js";
|
|
4
5
|
import { globPartial, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial } from "./schema/glob.js";
|
|
5
6
|
import { baseInjectPartial, injectManifestOptions } from "./schema/inject-manifest.js";
|
|
6
7
|
import { manifestEntry } from "./schema/manifest-entry.js";
|
|
7
8
|
import { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
|
|
8
|
-
import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
|
|
9
9
|
import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/sw-dest.js";
|
|
10
|
-
import {
|
|
10
|
+
import { asyncFn, fn } from "./schema/utils.js";
|
|
11
11
|
export { assertType, fn, asyncFn, basePartial, globPartial, baseInjectPartial as injectPartial, injectManifestOptions, getManifestOptions, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial, optionalSwDestPartial, requiredSwDestPartial, validationErrorMap, SerwistConfigError, };
|
|
12
12
|
export type { Assignable, Equals };
|
|
13
13
|
//# sourceMappingURL=index.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,EAAE,EACF,OAAO,EACP,WAAW,EACX,WAAW,EACX,iBAAiB,IAAI,aAAa,EAClC,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC;AACF,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/index.schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { a as asyncFn, b as basePartial, f as fn, g as globPartial, m as manifestEntry, c as manifestTransform, d as manifestTransformResult, o as optionalGlobDirectoryPartial, r as requiredGlobDirectoryPartial } from './chunks/glob.js';
|
|
2
|
+
export { S as SerwistConfigError, v as validationErrorMap } from './chunks/constants.js';
|
|
2
3
|
export { getManifestOptions } from './chunks/get-manifest.js';
|
|
3
4
|
export { i as injectManifestOptions, b as injectPartial, o as optionalSwDestPartial, r as requiredSwDestPartial } from './chunks/inject-manifest.js';
|
|
4
|
-
export { S as SerwistConfigError, v as validationErrorMap } from './chunks/error.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
7
7
|
function assertType() {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,GAAU,QAAQ,qBAAqB,KAAG,OAAO,CAAC,WAAW,CAwFvF,CAAC"}
|
|
@@ -1 +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;
|
|
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;AAEjD,KAAK,kCAAkC,GAAG,CAAC,QAAQ,EAAE,CAAC,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,KAAK;IAC5F,QAAQ,EAAE,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC/C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,2BAA2B,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,KAAG,kCAqC1G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAiG,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FileDetails
|
|
1
|
+
import type { FileDetails } from "@serwist/utils";
|
|
2
|
+
import type { GlobPartial } from "../types.js";
|
|
2
3
|
export declare const getFileDetails: ({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, "globDirectory" | "globPatterns" | "templatedURLs"> & {
|
|
3
4
|
globDirectory: string;
|
|
4
5
|
globPattern: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-details.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,cAAc,GAAI,0DAK5B,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,GAAG;IAEzE,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG;IACF,kBAAkB,EAAE,WAAW,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;CAkCjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-manifest-entries.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-manifest-entries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-manifest-entries.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-manifest-entries.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIjF,eAAO,MAAM,sBAAsB,GAAU,yOAa1C,0BAA0B,KAAG,OAAO,CAAC,iBAAiB,CA+FxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modify-url-prefix-transform.d.ts","sourceRoot":"","sources":["../../src/lib/modify-url-prefix-transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modify-url-prefix-transform.d.ts","sourceRoot":"","sources":["../../src/lib/modify-url-prefix-transform.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,wBAAgB,wBAAwB,CAAC,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,iBAAiB,CA0CtG"}
|
|
@@ -1 +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":"
|
|
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":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAoBpF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FileDetails } from "@serwist/utils";
|
|
2
|
+
import type { BaseResolved, ManifestEntry } from "../types.js";
|
|
2
3
|
/**
|
|
3
4
|
* A `ManifestTransform` function can be used to modify the modify the `url` or
|
|
4
5
|
* `revision` properties of some or all of the {@linkcode ManifestEntry} in the manifest.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAMlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,UAAU,mCAAmC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAID,UAAU,wBACR,SAAQ,IAAI,CACV,YAAY,EACV,2BAA2B,GAC3B,2BAA2B,GAC3B,oBAAoB,GACpB,+BAA+B,GAC/B,iBAAiB,GACjB,yBAAyB,CAC5B;IACD,WAAW,EAAE,WAAW,EAAE,CAAC;IAG3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,cAAc,EACd,uBAAuB,GACxB,EAAE,wBAAwB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAsEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../src/lib/validate-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../src/lib/validate-options.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE7F,eAAO,MAAM,0BAA0B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,0BAA0B,CASnG,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,6BAA6B,CASzG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/schema/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/schema/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,WAAW;;;;;;kBAMtB,CAAC;AAEH,eAAO,MAAM,4BAA4B;;kBAEvC,CAAC;AAIH,eAAO,MAAM,4BAA4B;;kBAEvC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const baseInjectPartial: z.ZodObject<{
|
|
3
|
-
injectionPoint: z.
|
|
3
|
+
injectionPoint: z.ZodPrefault<z.ZodString>;
|
|
4
4
|
swSrc: z.ZodString;
|
|
5
5
|
}, z.core.$strict>;
|
|
6
6
|
export declare const injectManifestOptions: z.ZodObject<{
|
|
7
7
|
globDirectory: z.ZodString;
|
|
8
8
|
swDest: z.ZodString;
|
|
9
|
-
injectionPoint: z.
|
|
9
|
+
injectionPoint: z.ZodPrefault<z.ZodString>;
|
|
10
10
|
swSrc: z.ZodString;
|
|
11
11
|
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
12
12
|
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaybePromise, Require } from "@serwist/utils";
|
|
1
|
+
import type { MaybePromise, Prettify, Require } from "@serwist/utils";
|
|
2
2
|
import type { PackageJson } from "type-fest";
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { manifestEntry } from "./schema/manifest-entry.js";
|
|
@@ -70,7 +70,7 @@ export interface BasePartial {
|
|
|
70
70
|
[key: string]: string;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
export type BaseResolved = Require<BasePartial, "disablePrecacheManifest" | "maximumFileSizeToCacheInBytes"
|
|
73
|
+
export type BaseResolved = Prettify<Require<BasePartial, "disablePrecacheManifest" | "maximumFileSizeToCacheInBytes">>;
|
|
74
74
|
export interface RequiredGlobDirectoryPartial {
|
|
75
75
|
/**
|
|
76
76
|
* The local directory you wish to match `globPatterns` against. The path is
|
|
@@ -78,7 +78,7 @@ export interface RequiredGlobDirectoryPartial {
|
|
|
78
78
|
*/
|
|
79
79
|
globDirectory: string;
|
|
80
80
|
}
|
|
81
|
-
export type RequiredGlobDirectoryResolved = RequiredGlobDirectoryPartial
|
|
81
|
+
export type RequiredGlobDirectoryResolved = Prettify<RequiredGlobDirectoryPartial>;
|
|
82
82
|
export interface OptionalGlobDirectoryPartial {
|
|
83
83
|
/**
|
|
84
84
|
* The local directory you wish to match `globPatterns` against. The path is
|
|
@@ -86,7 +86,7 @@ export interface OptionalGlobDirectoryPartial {
|
|
|
86
86
|
*/
|
|
87
87
|
globDirectory?: string;
|
|
88
88
|
}
|
|
89
|
-
export type OptionalGlobDirectoryResolved = OptionalGlobDirectoryPartial
|
|
89
|
+
export type OptionalGlobDirectoryResolved = Prettify<OptionalGlobDirectoryPartial>;
|
|
90
90
|
export interface GlobPartial {
|
|
91
91
|
/**
|
|
92
92
|
* Determines whether or not symlinks are followed when generating the
|
|
@@ -111,7 +111,7 @@ export interface GlobPartial {
|
|
|
111
111
|
* [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
|
|
112
112
|
* @default
|
|
113
113
|
* ```
|
|
114
|
-
* ["**\/*.{js,css,html}"]
|
|
114
|
+
* ["**\/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"]
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
117
|
globPatterns?: string[];
|
|
@@ -136,7 +136,7 @@ export interface GlobPartial {
|
|
|
136
136
|
[key: string]: string | string[];
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
export type GlobResolved = Require<GlobPartial, "globFollow" | "globIgnores" | "globPatterns" | "globStrict"
|
|
139
|
+
export type GlobResolved = Prettify<Require<GlobPartial, "globFollow" | "globIgnores" | "globPatterns" | "globStrict">>;
|
|
140
140
|
export interface InjectPartial {
|
|
141
141
|
/**
|
|
142
142
|
* The string to find inside of the `swSrc` file. Once found, it will be
|
|
@@ -150,7 +150,7 @@ export interface InjectPartial {
|
|
|
150
150
|
*/
|
|
151
151
|
swSrc: string;
|
|
152
152
|
}
|
|
153
|
-
export type InjectResolved = Require<InjectPartial, "injectionPoint"
|
|
153
|
+
export type InjectResolved = Prettify<Require<InjectPartial, "injectionPoint">>;
|
|
154
154
|
export interface RequiredSwDestPartial {
|
|
155
155
|
/**
|
|
156
156
|
* The path and filename of the service worker file that will be created by
|
|
@@ -158,7 +158,7 @@ export interface RequiredSwDestPartial {
|
|
|
158
158
|
*/
|
|
159
159
|
swDest: string;
|
|
160
160
|
}
|
|
161
|
-
export type RequiredSwDestResolved = RequiredSwDestPartial
|
|
161
|
+
export type RequiredSwDestResolved = Prettify<RequiredSwDestPartial>;
|
|
162
162
|
export interface OptionalSwDestPartial {
|
|
163
163
|
/**
|
|
164
164
|
* The path and filename of the service worker file that will be created by
|
|
@@ -167,11 +167,11 @@ export interface OptionalSwDestPartial {
|
|
|
167
167
|
*/
|
|
168
168
|
swDest?: string;
|
|
169
169
|
}
|
|
170
|
-
export type OptionalSwDestResolved = OptionalSwDestPartial
|
|
171
|
-
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial
|
|
172
|
-
export type GetManifestOptionsComplete = BaseResolved & GlobResolved & RequiredGlobDirectoryResolved
|
|
173
|
-
export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSwDestPartial & RequiredGlobDirectoryPartial
|
|
174
|
-
export type InjectManifestOptionsComplete = BaseResolved & GlobResolved & InjectResolved & RequiredSwDestResolved & RequiredGlobDirectoryResolved
|
|
170
|
+
export type OptionalSwDestResolved = Prettify<OptionalSwDestPartial>;
|
|
171
|
+
export type GetManifestOptions = Prettify<BasePartial & GlobPartial & RequiredGlobDirectoryPartial>;
|
|
172
|
+
export type GetManifestOptionsComplete = Prettify<BaseResolved & GlobResolved & RequiredGlobDirectoryResolved>;
|
|
173
|
+
export type InjectManifestOptions = Prettify<BasePartial & GlobPartial & InjectPartial & RequiredSwDestPartial & RequiredGlobDirectoryPartial>;
|
|
174
|
+
export type InjectManifestOptionsComplete = Prettify<BaseResolved & GlobResolved & InjectResolved & RequiredSwDestResolved & RequiredGlobDirectoryResolved>;
|
|
175
175
|
export interface GetManifestResult {
|
|
176
176
|
count: number;
|
|
177
177
|
manifestEntries: ManifestEntry[] | undefined;
|
|
@@ -181,14 +181,6 @@ export interface GetManifestResult {
|
|
|
181
181
|
export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
|
|
182
182
|
filePaths: string[];
|
|
183
183
|
};
|
|
184
|
-
/**
|
|
185
|
-
* @private
|
|
186
|
-
*/
|
|
187
|
-
export interface FileDetails {
|
|
188
|
-
file: string;
|
|
189
|
-
hash: string | null;
|
|
190
|
-
size: number;
|
|
191
|
-
}
|
|
192
184
|
/**
|
|
193
185
|
* @private
|
|
194
186
|
*/
|
|
@@ -196,7 +188,7 @@ export type BuildType = "dev" | "prod";
|
|
|
196
188
|
/**
|
|
197
189
|
* @private
|
|
198
190
|
*/
|
|
199
|
-
export type SerwistPackageJSON = PackageJson
|
|
191
|
+
export type SerwistPackageJSON = Prettify<PackageJson>;
|
|
200
192
|
/**
|
|
201
193
|
* @private
|
|
202
194
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,CAAC,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,EAC7C,MAAM,CAAC,EAAE,OAAO,KACb,YAAY,CAAC;IAChB,QAAQ,EAAE,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC;IACvD;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;OAOG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAAe,CAAC,EAAE;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,yBAAyB,GAAG,+BAA+B,CAAC,CAAC,CAAC;AAIvH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC,4BAA4B,CAAC,CAAC;AAEnF,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC,4BAA4B,CAAC,CAAC;AAEnF,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;KAClC,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC,CAAC,CAAC;AAExH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEhF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,WAAW,GAAG,WAAW,GAAG,4BAA4B,CAAC,CAAC;AAEpG,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC,YAAY,GAAG,YAAY,GAAG,6BAA6B,CAAC,CAAC;AAE/G,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,qBAAqB,GAAG,4BAA4B,CAAC,CAAC;AAE/I,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAClD,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,sBAAsB,GAAG,6BAA6B,CACtG,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-preview.10",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"file manifest"
|
|
18
19
|
],
|
|
19
20
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
21
|
+
"node": ">=20.0.0"
|
|
21
22
|
},
|
|
22
23
|
"author": "Google's Web DevRel Team",
|
|
23
24
|
"contributors": [
|
|
@@ -48,11 +49,11 @@
|
|
|
48
49
|
"./package.json": "./package.json"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"pretty-bytes": "6.1.1",
|
|
52
|
+
"glob": "11.0.3",
|
|
53
|
+
"pretty-bytes": "7.0.0",
|
|
54
54
|
"source-map": "0.8.0-beta.0",
|
|
55
|
-
"zod": "4.0.5"
|
|
55
|
+
"zod": "4.0.5",
|
|
56
|
+
"@serwist/utils": "10.0.0-preview.10"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/common-tags": "1.8.4",
|
|
@@ -60,8 +61,8 @@
|
|
|
60
61
|
"rollup": "4.45.1",
|
|
61
62
|
"type-fest": "4.41.0",
|
|
62
63
|
"typescript": "5.8.3",
|
|
63
|
-
"@serwist/
|
|
64
|
-
"@serwist/
|
|
64
|
+
"@serwist/utils": "10.0.0-preview.10",
|
|
65
|
+
"@serwist/configs": "10.0.0-preview.10"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
68
|
"typescript": ">=5.0.0"
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"build": "rimraf dist && NODE_OPTIONS='--max-old-space-size=4096' NODE_ENV=production rollup --config rollup.config.js",
|
|
76
77
|
"dev": "rollup --config rollup.config.js --watch",
|
|
77
78
|
"lint": "biome lint ./src",
|
|
79
|
+
"qcheck": "biome check ./src",
|
|
78
80
|
"typecheck": "tsc"
|
|
79
81
|
}
|
|
80
82
|
}
|
package/src/index.schema.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type Assignable, type Equals
|
|
1
|
+
import { type Assignable, assertType, type Equals } from "./schema/assert-type.js";
|
|
2
2
|
import { basePartial } from "./schema/base.js";
|
|
3
|
+
import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
|
|
3
4
|
import { getManifestOptions } from "./schema/get-manifest.js";
|
|
4
5
|
import { globPartial, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial } from "./schema/glob.js";
|
|
5
6
|
import { baseInjectPartial, injectManifestOptions } from "./schema/inject-manifest.js";
|
|
6
7
|
import { manifestEntry } from "./schema/manifest-entry.js";
|
|
7
8
|
import { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
|
|
8
|
-
import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
|
|
9
9
|
import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/sw-dest.js";
|
|
10
|
-
import {
|
|
10
|
+
import { asyncFn, fn } from "./schema/utils.js";
|
|
11
11
|
|
|
12
12
|
export {
|
|
13
13
|
assertType,
|
package/src/index.ts
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
Use of this source code is governed by an MIT-style
|
|
5
5
|
license that can be found in the LICENSE file or at
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
import { errors } from "@serwist/utils/node";
|
|
9
|
+
|
|
8
10
|
import { getManifest } from "./get-manifest.js";
|
|
9
11
|
import { injectManifest } from "./inject-manifest.js";
|
|
10
|
-
import {
|
|
12
|
+
import { DEFAULT_GLOB_PATTERNS } from "./lib/constants.js";
|
|
11
13
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
12
14
|
import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
|
|
13
15
|
import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
@@ -17,16 +19,9 @@ import { transformManifest } from "./lib/transform-manifest.js";
|
|
|
17
19
|
import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
|
|
18
20
|
import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
|
|
19
21
|
|
|
20
|
-
// TODO: remove in v10.
|
|
21
|
-
/**
|
|
22
|
-
* Use `JSON.stringify` instead.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated
|
|
25
|
-
*/
|
|
26
|
-
const stringify = JSON.stringify;
|
|
27
|
-
|
|
28
22
|
export {
|
|
29
23
|
errors,
|
|
24
|
+
DEFAULT_GLOB_PATTERNS,
|
|
30
25
|
escapeRegExp,
|
|
31
26
|
getFileManifestEntries,
|
|
32
27
|
getManifest,
|
|
@@ -34,7 +29,6 @@ export {
|
|
|
34
29
|
injectManifest,
|
|
35
30
|
rebasePath,
|
|
36
31
|
replaceAndUpdateSourceMap,
|
|
37
|
-
stringify,
|
|
38
32
|
transformManifest,
|
|
39
33
|
translateURLToSourcemapPaths,
|
|
40
34
|
validateGetManifestOptions,
|