@serwist/build 9.0.0-preview.2 → 9.0.0-preview.20
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/glob.js +3 -3
- package/dist/chunks/injectManifest.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -58
- package/dist/index.schema.d.ts +13 -0
- package/dist/index.schema.d.ts.map +1 -0
- package/dist/index.schema.js +9 -0
- package/dist/lib/additional-precache-entries-transform.d.ts +6 -8
- package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -1
- package/dist/lib/errors.d.ts +0 -3
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/get-file-details.d.ts +3 -9
- package/dist/lib/get-file-details.d.ts.map +1 -1
- package/dist/lib/get-file-hash.d.ts +1 -1
- package/dist/lib/get-file-hash.d.ts.map +1 -1
- package/dist/lib/get-file-manifest-entries.d.ts +2 -2
- package/dist/lib/get-file-manifest-entries.d.ts.map +1 -1
- package/dist/lib/get-string-details.d.ts +1 -1
- package/dist/lib/get-string-details.d.ts.map +1 -1
- package/dist/lib/get-string-hash.d.ts +1 -1
- package/dist/lib/get-string-hash.d.ts.map +1 -1
- package/dist/lib/transform-manifest.d.ts +4 -3
- package/dist/lib/transform-manifest.d.ts.map +1 -1
- package/dist/lib/validate-options.d.ts +1 -3
- package/dist/lib/validate-options.d.ts.map +1 -1
- package/dist/schema/assertType.d.ts +1 -0
- package/dist/schema/assertType.d.ts.map +1 -1
- package/dist/schema/base.d.ts +24 -24
- package/dist/schema/getManifest.d.ts +24 -24
- package/dist/schema/injectManifest.d.ts +27 -27
- package/dist/schema/injectManifest.d.ts.map +1 -1
- package/dist/schema/manifestEntry.d.ts +3 -3
- package/dist/schema/manifestTransform.d.ts +18 -18
- package/dist/{lib/serwist-config-error.d.ts → schema/serwistConfigError.d.ts} +1 -1
- package/dist/schema/serwistConfigError.d.ts.map +1 -0
- package/dist/types.d.ts +6 -156
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -23
- package/src/index.schema.ts +29 -0
- package/src/index.ts +2 -3
- package/src/inject-manifest.ts +1 -1
- package/src/lib/additional-precache-entries-transform.ts +4 -8
- package/src/lib/errors.ts +0 -6
- package/src/lib/get-composite-details.ts +2 -2
- package/src/lib/get-file-details.ts +9 -17
- package/src/lib/get-file-hash.ts +4 -4
- package/src/lib/get-file-manifest-entries.ts +9 -9
- package/src/lib/get-string-details.ts +5 -7
- package/src/lib/get-string-hash.ts +1 -1
- package/src/lib/transform-manifest.ts +28 -16
- package/src/lib/validate-options.ts +2 -23
- package/src/schema/assertType.ts +2 -0
- package/src/schema/injectManifest.ts +4 -4
- package/src/schema/manifestEntry.ts +1 -1
- package/src/types.ts +6 -188
- package/dist/chunks/vite.js +0 -7
- package/dist/chunks/webpack.js +0 -34
- package/dist/index.next.d.ts +0 -3
- package/dist/index.next.d.ts.map +0 -1
- package/dist/index.next.js +0 -38
- package/dist/lib/serwist-config-error.d.ts.map +0 -1
- package/dist/lib/validate-next-options.d.ts +0 -3
- package/dist/lib/validate-next-options.d.ts.map +0 -1
- package/dist/schema/next.d.ts +0 -243
- package/dist/schema/next.d.ts.map +0 -1
- package/dist/schema/vite.d.ts +0 -196
- package/dist/schema/vite.d.ts.map +0 -1
- package/dist/schema/webpack.d.ts +0 -231
- package/dist/schema/webpack.d.ts.map +0 -1
- package/src/_types.js +0 -112
- package/src/index.next.ts +0 -3
- package/src/lib/validate-next-options.ts +0 -14
- package/src/schema/next.ts +0 -33
- package/src/schema/vite.ts +0 -18
- package/src/schema/webpack.ts +0 -47
- package/dist/chunks/{serwist-config-error.js → validationErrorMap.js} +7 -7
- /package/src/{lib/serwist-config-error.ts → schema/serwistConfigError.ts} +0 -0
package/dist/chunks/glob.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
const manifestEntry = z.object({
|
|
4
4
|
integrity: z.string().optional(),
|
|
5
|
-
revision: z.string().nullable(),
|
|
5
|
+
revision: z.string().nullable().optional(),
|
|
6
6
|
url: z.string()
|
|
7
7
|
}).strict("Do not pass invalid properties to ManifestEntry!");
|
|
8
8
|
|
|
@@ -48,11 +48,11 @@ const globPartial = z.object({
|
|
|
48
48
|
z.array(z.string())
|
|
49
49
|
])).optional()
|
|
50
50
|
}).strict("Do not pass invalid properties to GlobPartial!");
|
|
51
|
-
z.object({
|
|
51
|
+
const optionalGlobDirectoryPartial = z.object({
|
|
52
52
|
globDirectory: z.string().optional()
|
|
53
53
|
}).strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!");
|
|
54
54
|
const requiredGlobDirectoryPartial = z.object({
|
|
55
55
|
globDirectory: z.string()
|
|
56
56
|
}).strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!");
|
|
57
57
|
|
|
58
|
-
export { basePartial as b, globPartial as g, requiredGlobDirectoryPartial as r };
|
|
58
|
+
export { manifestTransform as a, basePartial as b, manifestTransformResult as c, globPartial as g, manifestEntry as m, optionalGlobDirectoryPartial as o, requiredGlobDirectoryPartial as r };
|
|
@@ -8,16 +8,16 @@ const requiredSwDestPartial = z.object({
|
|
|
8
8
|
swDest: z.string()
|
|
9
9
|
}).strict("Do not pass invalid properties to RequiredSwDest!");
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const baseInjectPartial = z.object({
|
|
12
12
|
injectionPoint: z.string().default("self.__SW_MANIFEST"),
|
|
13
13
|
swSrc: z.string()
|
|
14
14
|
}).strict("Do not pass invalid properties to InjectPartial!");
|
|
15
|
-
const injectManifestOptions = basePartial.merge(globPartial).merge(
|
|
15
|
+
const injectManifestOptions = basePartial.merge(globPartial).merge(baseInjectPartial).merge(requiredSwDestPartial).merge(requiredGlobDirectoryPartial).strict("Do not pass invalid properties to InjectManifestOptions!");
|
|
16
16
|
|
|
17
17
|
var injectManifest = /*#__PURE__*/Object.freeze({
|
|
18
18
|
__proto__: null,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
baseInjectPartial: baseInjectPartial,
|
|
20
|
+
injectManifestOptions: injectManifestOptions
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export { injectManifest as a,
|
|
23
|
+
export { injectManifest as a, baseInjectPartial as b, injectManifestOptions as i, optionalSwDestPartial as o, requiredSwDestPartial as r };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { rebasePath } from "./lib/rebase-path.js";
|
|
|
9
9
|
import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.js";
|
|
10
10
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
11
11
|
import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
|
|
12
|
-
import {
|
|
13
|
-
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths,
|
|
12
|
+
import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
|
|
13
|
+
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions, };
|
|
14
14
|
export type * from "./types.js";
|
|
15
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,SAAS,MAAM,4BAA4B,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,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,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,SAAS,EACT,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,EAC1B,6BAA6B,GAC9B,CAAC;AAEF,mBAAmB,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import stringify from 'fast-json-stable-stringify';
|
|
2
2
|
export { default as stringify } from 'fast-json-stable-stringify';
|
|
3
|
-
import assert from 'assert';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
4
|
import { oneLine } from 'common-tags';
|
|
5
|
-
import crypto from 'crypto';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import crypto from 'node:crypto';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { globSync } from 'glob';
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
8
9
|
import fse from 'fs-extra';
|
|
9
10
|
import prettyBytes from 'pretty-bytes';
|
|
10
|
-
import { v as validationErrorMap, S as SerwistConfigError } from './chunks/
|
|
11
|
+
import { v as validationErrorMap, S as SerwistConfigError } from './chunks/validationErrorMap.js';
|
|
12
|
+
import upath from 'upath';
|
|
11
13
|
import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
|
|
12
14
|
import 'zod';
|
|
13
15
|
|
|
@@ -75,12 +77,6 @@ const errors = {
|
|
|
75
77
|
Please remove or fix the following: `,
|
|
76
78
|
"bad-template-urls-asset": oneLine`There was an issue using one of the provided
|
|
77
79
|
'templatedURLs'.`,
|
|
78
|
-
"invalid-runtime-caching": oneLine`The 'runtimeCaching' parameter must an an
|
|
79
|
-
array of objects with at least a 'urlPattern' and 'handler'.`,
|
|
80
|
-
"urlPattern-is-required": oneLine`The 'urlPattern' option is required when using
|
|
81
|
-
'runtimeCaching'.`,
|
|
82
|
-
"handler-is-required": oneLine`The 'handler' option is required when using
|
|
83
|
-
runtimeCaching.`,
|
|
84
80
|
"invalid-generate-file-manifest-arg": oneLine`The input to generateFileManifest()
|
|
85
81
|
must be an Object.`,
|
|
86
82
|
"invalid-sw-src": `The 'swSrc' file can't be read.`,
|
|
@@ -106,7 +102,7 @@ const getCompositeDetails = (compositeURL, dependencyDetails)=>{
|
|
|
106
102
|
let compositeHash = "";
|
|
107
103
|
for (const fileDetails of dependencyDetails){
|
|
108
104
|
totalSize += fileDetails.size;
|
|
109
|
-
compositeHash += fileDetails.hash;
|
|
105
|
+
compositeHash += fileDetails.hash === null ? "" : fileDetails.hash;
|
|
110
106
|
}
|
|
111
107
|
const md5 = crypto.createHash("md5");
|
|
112
108
|
md5.update(compositeHash);
|
|
@@ -124,14 +120,14 @@ function getStringHash(input) {
|
|
|
124
120
|
return md5.digest("hex");
|
|
125
121
|
}
|
|
126
122
|
|
|
127
|
-
|
|
123
|
+
const getFileHash = (file)=>{
|
|
128
124
|
try {
|
|
129
|
-
const buffer =
|
|
125
|
+
const buffer = readFileSync(file);
|
|
130
126
|
return getStringHash(buffer);
|
|
131
127
|
} catch (err) {
|
|
132
128
|
throw new Error(`${errors["unable-to-get-file-hash"]} '${err instanceof Error && err.message ? err.message : ""}'`);
|
|
133
129
|
}
|
|
134
|
-
}
|
|
130
|
+
};
|
|
135
131
|
|
|
136
132
|
function getFileSize(file) {
|
|
137
133
|
try {
|
|
@@ -145,11 +141,11 @@ function getFileSize(file) {
|
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
143
|
|
|
148
|
-
|
|
144
|
+
const getFileDetails = ({ globDirectory, globFollow, globIgnores, globPattern })=>{
|
|
149
145
|
let globbedFiles;
|
|
150
146
|
let warning = "";
|
|
151
147
|
try {
|
|
152
|
-
globbedFiles =
|
|
148
|
+
globbedFiles = globSync(globPattern, {
|
|
153
149
|
cwd: globDirectory,
|
|
154
150
|
follow: globFollow,
|
|
155
151
|
ignore: globIgnores
|
|
@@ -166,12 +162,12 @@ function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern })
|
|
|
166
162
|
}
|
|
167
163
|
const globbedFileDetails = [];
|
|
168
164
|
for (const file of globbedFiles){
|
|
169
|
-
const fullPath =
|
|
165
|
+
const fullPath = path.join(globDirectory, file);
|
|
170
166
|
const fileSize = getFileSize(fullPath);
|
|
171
167
|
if (fileSize !== null) {
|
|
172
168
|
const fileHash = getFileHash(fullPath);
|
|
173
169
|
globbedFileDetails.push({
|
|
174
|
-
file:
|
|
170
|
+
file: path.relative(globDirectory, fullPath),
|
|
175
171
|
hash: fileHash,
|
|
176
172
|
size: fileSize
|
|
177
173
|
});
|
|
@@ -181,15 +177,13 @@ function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern })
|
|
|
181
177
|
globbedFileDetails,
|
|
182
178
|
warning
|
|
183
179
|
};
|
|
184
|
-
}
|
|
180
|
+
};
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
return {
|
|
182
|
+
const getStringDetails = (url, str)=>({
|
|
188
183
|
file: url,
|
|
189
184
|
hash: getStringHash(str),
|
|
190
185
|
size: str.length
|
|
191
|
-
};
|
|
192
|
-
}
|
|
186
|
+
});
|
|
193
187
|
|
|
194
188
|
const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
|
|
195
189
|
return (manifest)=>{
|
|
@@ -204,7 +198,7 @@ const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
|
|
|
204
198
|
url: additionalEntry
|
|
205
199
|
});
|
|
206
200
|
} else {
|
|
207
|
-
if (additionalEntry && additionalEntry.revision === undefined) {
|
|
201
|
+
if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {
|
|
208
202
|
stringEntries.add(additionalEntry.url);
|
|
209
203
|
}
|
|
210
204
|
manifest.push(Object.assign({
|
|
@@ -312,13 +306,11 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
312
306
|
};
|
|
313
307
|
}
|
|
314
308
|
const allWarnings = [];
|
|
315
|
-
const normalizedManifest = fileDetails.map((fileDetails)=>{
|
|
316
|
-
return {
|
|
309
|
+
const normalizedManifest = fileDetails.map((fileDetails)=>({
|
|
317
310
|
url: fileDetails.file.replace(/\\/g, "/"),
|
|
318
311
|
revision: fileDetails.hash,
|
|
319
312
|
size: fileDetails.size
|
|
320
|
-
};
|
|
321
|
-
});
|
|
313
|
+
}));
|
|
322
314
|
const transformsToApply = [];
|
|
323
315
|
if (maximumFileSizeToCacheInBytes) {
|
|
324
316
|
transformsToApply.push(maximumSizeTransform(maximumFileSizeToCacheInBytes));
|
|
@@ -358,7 +350,7 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
358
350
|
};
|
|
359
351
|
}
|
|
360
352
|
|
|
361
|
-
async
|
|
353
|
+
const getFileManifestEntries = async ({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest })=>{
|
|
362
354
|
if (disablePrecacheManifest) {
|
|
363
355
|
return {
|
|
364
356
|
count: 0,
|
|
@@ -413,11 +405,11 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
413
405
|
} catch (error) {
|
|
414
406
|
const debugObj = {};
|
|
415
407
|
debugObj[url] = dependencies;
|
|
416
|
-
throw new Error(`${errors["bad-template-urls-asset"]}
|
|
408
|
+
throw new Error(`${errors["bad-template-urls-asset"]} '${globPattern}' from '${JSON.stringify(debugObj)}':\n${error instanceof Error ? error.toString() : ""}`);
|
|
417
409
|
}
|
|
418
410
|
}, []);
|
|
419
411
|
if (details.length === 0) {
|
|
420
|
-
throw new Error(`${errors["bad-template-urls-asset"]} The glob
|
|
412
|
+
throw new Error(`${errors["bad-template-urls-asset"]} The glob pattern '${dependencies.toString()}' did not match anything.`);
|
|
421
413
|
}
|
|
422
414
|
allFileDetails.set(url, getCompositeDetails(url, details));
|
|
423
415
|
} else if (typeof dependencies === "string") {
|
|
@@ -436,7 +428,7 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
436
428
|
});
|
|
437
429
|
transformedManifest.warnings.push(...warnings);
|
|
438
430
|
return transformedManifest;
|
|
439
|
-
}
|
|
431
|
+
};
|
|
440
432
|
|
|
441
433
|
const validateGetManifestOptions = async (input)=>{
|
|
442
434
|
const result = await (await import('./chunks/getManifest.js')).getManifestOptions.spa(input, {
|
|
@@ -462,30 +454,6 @@ const validateInjectManifestOptions = async (input)=>{
|
|
|
462
454
|
}
|
|
463
455
|
return result.data;
|
|
464
456
|
};
|
|
465
|
-
const validateWebpackInjectManifestOptions = async (input)=>{
|
|
466
|
-
const result = await (await import('./chunks/webpack.js')).webpackInjectManifestOptions.spa(input, {
|
|
467
|
-
errorMap: validationErrorMap
|
|
468
|
-
});
|
|
469
|
-
if (!result.success) {
|
|
470
|
-
throw new SerwistConfigError({
|
|
471
|
-
moduleName: "@serwist/webpack-plugin",
|
|
472
|
-
message: JSON.stringify(result.error.format(), null, 2)
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
return result.data;
|
|
476
|
-
};
|
|
477
|
-
const validateViteInjectManifestOptions = async (input)=>{
|
|
478
|
-
const result = await (await import('./chunks/vite.js')).viteInjectManifestOptions.spa(input, {
|
|
479
|
-
errorMap: validationErrorMap
|
|
480
|
-
});
|
|
481
|
-
if (!result.success) {
|
|
482
|
-
throw new SerwistConfigError({
|
|
483
|
-
moduleName: "@serwist/vite",
|
|
484
|
-
message: JSON.stringify(result.error.format(), null, 2)
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
return result.data;
|
|
488
|
-
};
|
|
489
457
|
|
|
490
458
|
const getManifest = async (config)=>{
|
|
491
459
|
const options = await validateGetManifestOptions(config);
|
|
@@ -655,4 +623,4 @@ const injectManifest = async (config)=>{
|
|
|
655
623
|
};
|
|
656
624
|
};
|
|
657
625
|
|
|
658
|
-
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths,
|
|
626
|
+
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Assignable, type Equals, assertType } from "./schema/assertType.js";
|
|
2
|
+
import { basePartial } from "./schema/base.js";
|
|
3
|
+
import { getManifestOptions } from "./schema/getManifest.js";
|
|
4
|
+
import { globPartial, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial } from "./schema/glob.js";
|
|
5
|
+
import { baseInjectPartial, injectManifestOptions } from "./schema/injectManifest.js";
|
|
6
|
+
import { manifestEntry } from "./schema/manifestEntry.js";
|
|
7
|
+
import { manifestTransform, manifestTransformResult } from "./schema/manifestTransform.js";
|
|
8
|
+
import { SerwistConfigError } from "./schema/serwistConfigError.js";
|
|
9
|
+
import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/swDest.js";
|
|
10
|
+
import { validationErrorMap } from "./schema/validationErrorMap.js";
|
|
11
|
+
export { assertType, basePartial, globPartial, baseInjectPartial as injectPartial, injectManifestOptions, getManifestOptions, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial, optionalSwDestPartial, requiredSwDestPartial, validationErrorMap, SerwistConfigError, };
|
|
12
|
+
export type { Assignable, Equals };
|
|
13
|
+
//# sourceMappingURL=index.schema.d.ts.map
|
|
@@ -0,0 +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,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EACL,UAAU,EACV,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { b as basePartial, g as globPartial, m as manifestEntry, a as manifestTransform, c as manifestTransformResult, o as optionalGlobDirectoryPartial, r as requiredGlobDirectoryPartial } from './chunks/glob.js';
|
|
2
|
+
export { getManifestOptions } from './chunks/getManifest.js';
|
|
3
|
+
export { i as injectManifestOptions, b as injectPartial, o as optionalSwDestPartial, r as requiredSwDestPartial } from './chunks/injectManifest.js';
|
|
4
|
+
export { S as SerwistConfigError, v as validationErrorMap } from './chunks/validationErrorMap.js';
|
|
5
|
+
import 'zod';
|
|
6
|
+
|
|
7
|
+
function assertType() {}
|
|
8
|
+
|
|
9
|
+
export { assertType };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { ManifestEntry } from "../types.js";
|
|
2
|
-
type AdditionalManifestEntriesTransform = {
|
|
3
|
-
|
|
2
|
+
type AdditionalManifestEntriesTransform = (manifest: (ManifestEntry & {
|
|
3
|
+
size: number;
|
|
4
|
+
})[]) => {
|
|
5
|
+
manifest: (ManifestEntry & {
|
|
4
6
|
size: number;
|
|
5
|
-
})[]
|
|
6
|
-
|
|
7
|
-
size: number;
|
|
8
|
-
})[];
|
|
9
|
-
warnings: string[];
|
|
10
|
-
};
|
|
7
|
+
})[];
|
|
8
|
+
warnings: string[];
|
|
11
9
|
};
|
|
12
10
|
export declare const additionalPrecacheEntriesTransform: (additionalPrecacheEntries: (ManifestEntry | string)[]) => AdditionalManifestEntriesTransform;
|
|
13
11
|
export {};
|
|
@@ -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;AAGjD,KAAK,kCAAkC,GAAG
|
|
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,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,8BAA+B,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,KAAG,kCAqC1G,CAAC"}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -35,9 +35,6 @@ export declare const errors: {
|
|
|
35
35
|
"multiple-injection-points": string;
|
|
36
36
|
"useless-glob-pattern": string;
|
|
37
37
|
"bad-template-urls-asset": string;
|
|
38
|
-
"invalid-runtime-caching": string;
|
|
39
|
-
"urlPattern-is-required": string;
|
|
40
|
-
"handler-is-required": string;
|
|
41
38
|
"invalid-generate-file-manifest-arg": string;
|
|
42
39
|
"invalid-sw-src": string;
|
|
43
40
|
"same-src-and-dest": string;
|
package/dist/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFlB,CAAC"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { GlobPartial } from "../types.js";
|
|
2
|
-
|
|
3
|
-
file: string;
|
|
4
|
-
hash: string;
|
|
5
|
-
size: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, "globDirectory" | "globPatterns" | "templatedURLs"> & {
|
|
1
|
+
import type { FileDetails, GlobPartial } from "../types.js";
|
|
2
|
+
export declare const getFileDetails: ({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, "globPatterns" | "templatedURLs" | "globDirectory"> & {
|
|
8
3
|
globDirectory: string;
|
|
9
4
|
globPattern: string;
|
|
10
|
-
})
|
|
5
|
+
}) => {
|
|
11
6
|
globbedFileDetails: FileDetails[];
|
|
12
7
|
warning: string;
|
|
13
8
|
};
|
|
14
|
-
export {};
|
|
15
9
|
//# sourceMappingURL=get-file-details.d.ts.map
|
|
@@ -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":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,cAAc;mBAOV,MAAM;iBACR,MAAM;;wBAEC,WAAW,EAAE;aACxB,MAAM;CAkChB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const getFileHash: (file: string) => string;
|
|
2
2
|
//# sourceMappingURL=get-file-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AAaA,
|
|
1
|
+
{"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAO1C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare
|
|
1
|
+
import type { GetManifestOptionsComplete, GetManifestResult } from "../types.js";
|
|
2
|
+
export declare const getFileManifestEntries: ({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest, }: GetManifestOptionsComplete) => Promise<GetManifestResult>;
|
|
3
3
|
//# sourceMappingURL=get-file-manifest-entries.d.ts.map
|
|
@@ -1 +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,
|
|
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,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAO9F,eAAO,MAAM,sBAAsB,4OAahC,0BAA0B,KAAG,QAAQ,iBAAiB,CA+FxD,CAAC"}
|
|
@@ -1 +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,
|
|
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,eAAO,MAAM,gBAAgB,QAAS,MAAM,OAAO,MAAM,KAAG,WAI1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-string-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-hash.ts"],"names":[],"mappings":";AAQA,OAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"get-string-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-hash.ts"],"names":[],"mappings":";AAQA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAI9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseResolved, FileDetails, ManifestEntry } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* A `ManifestTransform` function can be used to modify the modify the `url` or
|
|
4
4
|
* `revision` properties of some or all of the
|
|
@@ -53,9 +53,10 @@ interface ManifestTransformResultWithWarnings {
|
|
|
53
53
|
manifestEntries: ManifestEntry[] | undefined;
|
|
54
54
|
warnings: string[];
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
interface TransformManifestOptions extends Pick<BaseResolved, "additionalPrecacheEntries" | "dontCacheBustURLsMatching" | "manifestTransforms" | "maximumFileSizeToCacheInBytes" | "modifyURLPrefix" | "disablePrecacheManifest"> {
|
|
57
57
|
fileDetails: FileDetails[];
|
|
58
58
|
transformParam?: unknown;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
|
+
export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest, }: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings>;
|
|
60
61
|
export {};
|
|
61
62
|
//# sourceMappingURL=transform-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAO/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,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,CAuEzE"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { GetManifestOptionsComplete, InjectManifestOptionsComplete
|
|
1
|
+
import type { GetManifestOptionsComplete, InjectManifestOptionsComplete } from "../types.js";
|
|
2
2
|
export declare const validateGetManifestOptions: (input: unknown) => Promise<GetManifestOptionsComplete>;
|
|
3
3
|
export declare const validateInjectManifestOptions: (input: unknown) => Promise<InjectManifestOptionsComplete>;
|
|
4
|
-
export declare const validateWebpackInjectManifestOptions: (input: unknown) => Promise<WebpackInjectManifestOptionsComplete>;
|
|
5
|
-
export declare const validateViteInjectManifestOptions: (input: unknown) => Promise<ViteInjectManifestOptionsComplete>;
|
|
6
4
|
//# sourceMappingURL=validate-options.d.ts.map
|
|
@@ -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,UAAiB,OAAO,KAAG,QAAQ,0BAA0B,CAMnG,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAAiB,OAAO,KAAG,QAAQ,6BAA6B,CAMzG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertType.d.ts","sourceRoot":"","sources":["../../src/schema/assertType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEtF,wBAAgB,UAAU,CAAC,EAAE,SAAS,IAAI,UAEzC"}
|
|
1
|
+
{"version":3,"file":"assertType.d.ts","sourceRoot":"","sources":["../../src/schema/assertType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEtF,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAE9D,wBAAgB,UAAU,CAAC,EAAE,SAAS,IAAI,UAEzC"}
|