@serwist/build 9.0.0-preview.0 → 9.0.0-preview.1
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 +0 -2
- package/dist/chunks/serwist-config-error.js +1 -4
- package/dist/index.js +4 -204
- package/dist/index.next.js +5 -2
- package/dist/schema/assertType.d.ts +3 -0
- package/dist/schema/assertType.d.ts.map +1 -0
- package/dist/schema/base.d.ts.map +1 -1
- package/dist/schema/getManifest.d.ts.map +1 -1
- package/dist/schema/glob.d.ts.map +1 -1
- package/dist/schema/injectManifest.d.ts.map +1 -1
- package/dist/schema/next.d.ts +12 -12
- package/dist/schema/next.d.ts.map +1 -1
- package/dist/schema/swDest.d.ts.map +1 -1
- package/dist/schema/vite.d.ts.map +1 -1
- package/dist/schema/webpack.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/schema/assertType.ts +5 -0
- package/src/schema/base.ts +5 -1
- package/src/schema/getManifest.ts +5 -6
- package/src/schema/glob.ts +11 -11
- package/src/schema/injectManifest.ts +8 -6
- package/src/schema/next.ts +10 -12
- package/src/schema/swDest.ts +8 -2
- package/src/schema/vite.ts +5 -5
- package/src/schema/webpack.ts +11 -11
- package/src/types.ts +2 -2
package/dist/chunks/glob.js
CHANGED
|
@@ -51,8 +51,6 @@ const globPartial = z.object({
|
|
|
51
51
|
z.object({
|
|
52
52
|
globDirectory: z.string().optional()
|
|
53
53
|
}).strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!");
|
|
54
|
-
// This needs to be set when using GetManifest or InjectManifest. This is
|
|
55
|
-
// enforced via runtime validation, and needs to be documented.
|
|
56
54
|
const requiredGlobDirectoryPartial = z.object({
|
|
57
55
|
globDirectory: z.string()
|
|
58
56
|
}).strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
const validationErrorMap = (error, ctx)=>{
|
|
4
|
-
|
|
5
|
-
This is where you override the various error codes
|
|
6
|
-
*/ switch(error.code){
|
|
4
|
+
switch(error.code){
|
|
7
5
|
case z.ZodIssueCode.invalid_type:
|
|
8
6
|
{
|
|
9
7
|
return {
|
|
@@ -41,7 +39,6 @@ const validationErrorMap = (error, ctx)=>{
|
|
|
41
39
|
};
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
|
-
// Fallback to the default message.
|
|
45
42
|
return {
|
|
46
43
|
message: ctx.defaultError
|
|
47
44
|
};
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import crypto from 'crypto';
|
|
|
6
6
|
import { glob } from 'glob';
|
|
7
7
|
import upath from 'upath';
|
|
8
8
|
import fse from 'fs-extra';
|
|
9
|
+
import prettyBytes from 'pretty-bytes';
|
|
9
10
|
import { v as validationErrorMap, S as SerwistConfigError } from './chunks/serwist-config-error.js';
|
|
10
11
|
import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
|
|
11
12
|
import 'zod';
|
|
@@ -195,8 +196,6 @@ const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
|
|
|
195
196
|
const warnings = [];
|
|
196
197
|
const stringEntries = new Set();
|
|
197
198
|
for (const additionalEntry of additionalPrecacheEntries){
|
|
198
|
-
// Warn about either a string or an object that lacks a revision property.
|
|
199
|
-
// (An object with a revision property set to null is okay.)
|
|
200
199
|
if (typeof additionalEntry === "string") {
|
|
201
200
|
stringEntries.add(additionalEntry);
|
|
202
201
|
manifest.push({
|
|
@@ -227,110 +226,6 @@ const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
|
|
|
227
226
|
};
|
|
228
227
|
};
|
|
229
228
|
|
|
230
|
-
const BYTE_UNITS = [
|
|
231
|
-
'B',
|
|
232
|
-
'kB',
|
|
233
|
-
'MB',
|
|
234
|
-
'GB',
|
|
235
|
-
'TB',
|
|
236
|
-
'PB',
|
|
237
|
-
'EB',
|
|
238
|
-
'ZB',
|
|
239
|
-
'YB'
|
|
240
|
-
];
|
|
241
|
-
const BIBYTE_UNITS = [
|
|
242
|
-
'B',
|
|
243
|
-
'KiB',
|
|
244
|
-
'MiB',
|
|
245
|
-
'GiB',
|
|
246
|
-
'TiB',
|
|
247
|
-
'PiB',
|
|
248
|
-
'EiB',
|
|
249
|
-
'ZiB',
|
|
250
|
-
'YiB'
|
|
251
|
-
];
|
|
252
|
-
const BIT_UNITS = [
|
|
253
|
-
'b',
|
|
254
|
-
'kbit',
|
|
255
|
-
'Mbit',
|
|
256
|
-
'Gbit',
|
|
257
|
-
'Tbit',
|
|
258
|
-
'Pbit',
|
|
259
|
-
'Ebit',
|
|
260
|
-
'Zbit',
|
|
261
|
-
'Ybit'
|
|
262
|
-
];
|
|
263
|
-
const BIBIT_UNITS = [
|
|
264
|
-
'b',
|
|
265
|
-
'kibit',
|
|
266
|
-
'Mibit',
|
|
267
|
-
'Gibit',
|
|
268
|
-
'Tibit',
|
|
269
|
-
'Pibit',
|
|
270
|
-
'Eibit',
|
|
271
|
-
'Zibit',
|
|
272
|
-
'Yibit'
|
|
273
|
-
];
|
|
274
|
-
/*
|
|
275
|
-
Formats the given number using `Number#toLocaleString`.
|
|
276
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
277
|
-
- If locale is true, the system default locale is used for translation.
|
|
278
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
279
|
-
*/ const toLocaleString = (number, locale, options)=>{
|
|
280
|
-
let result = number;
|
|
281
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
282
|
-
result = number.toLocaleString(locale, options);
|
|
283
|
-
} else if (locale === true || options !== undefined) {
|
|
284
|
-
result = number.toLocaleString(undefined, options);
|
|
285
|
-
}
|
|
286
|
-
return result;
|
|
287
|
-
};
|
|
288
|
-
function prettyBytes(number, options) {
|
|
289
|
-
if (!Number.isFinite(number)) {
|
|
290
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
291
|
-
}
|
|
292
|
-
options = {
|
|
293
|
-
bits: false,
|
|
294
|
-
binary: false,
|
|
295
|
-
space: true,
|
|
296
|
-
...options
|
|
297
|
-
};
|
|
298
|
-
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
299
|
-
const separator = options.space ? ' ' : '';
|
|
300
|
-
if (options.signed && number === 0) {
|
|
301
|
-
return ` 0${separator}${UNITS[0]}`;
|
|
302
|
-
}
|
|
303
|
-
const isNegative = number < 0;
|
|
304
|
-
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
305
|
-
if (isNegative) {
|
|
306
|
-
number = -number;
|
|
307
|
-
}
|
|
308
|
-
let localeOptions;
|
|
309
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
310
|
-
localeOptions = {
|
|
311
|
-
minimumFractionDigits: options.minimumFractionDigits
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
315
|
-
localeOptions = {
|
|
316
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
|
317
|
-
...localeOptions
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
if (number < 1) {
|
|
321
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
322
|
-
return prefix + numberString + separator + UNITS[0];
|
|
323
|
-
}
|
|
324
|
-
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
325
|
-
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
326
|
-
if (!localeOptions) {
|
|
327
|
-
number = number.toPrecision(3);
|
|
328
|
-
}
|
|
329
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
330
|
-
const unit = UNITS[exponent];
|
|
331
|
-
return prefix + numberString + separator + unit;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
229
|
function maximumSizeTransform(maximumFileSizeToCacheInBytes) {
|
|
335
230
|
return (originalManifest)=>{
|
|
336
231
|
const warnings = [];
|
|
@@ -348,13 +243,6 @@ function maximumSizeTransform(maximumFileSizeToCacheInBytes) {
|
|
|
348
243
|
};
|
|
349
244
|
}
|
|
350
245
|
|
|
351
|
-
/*
|
|
352
|
-
Copyright 2019 Google LLC
|
|
353
|
-
|
|
354
|
-
Use of this source code is governed by an MIT-style
|
|
355
|
-
license that can be found in the LICENSE file or at
|
|
356
|
-
https://opensource.org/licenses/MIT.
|
|
357
|
-
*/ // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
358
246
|
const escapeRegExp = (str)=>{
|
|
359
247
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
360
248
|
};
|
|
@@ -363,8 +251,6 @@ function modifyURLPrefixTransform(modifyURLPrefix) {
|
|
|
363
251
|
if (!modifyURLPrefix || typeof modifyURLPrefix !== "object" || Array.isArray(modifyURLPrefix)) {
|
|
364
252
|
throw new Error(errors["modify-url-prefix-bad-prefixes"]);
|
|
365
253
|
}
|
|
366
|
-
// If there are no entries in modifyURLPrefix, just return an identity
|
|
367
|
-
// function as a shortcut.
|
|
368
254
|
if (Object.keys(modifyURLPrefix).length === 0) {
|
|
369
255
|
return (manifest)=>{
|
|
370
256
|
return {
|
|
@@ -377,12 +263,8 @@ function modifyURLPrefixTransform(modifyURLPrefix) {
|
|
|
377
263
|
throw new Error(errors["modify-url-prefix-bad-prefixes"]);
|
|
378
264
|
}
|
|
379
265
|
}
|
|
380
|
-
// Escape the user input so it's safe to use in a regex.
|
|
381
266
|
const safeModifyURLPrefixes = Object.keys(modifyURLPrefix).map(escapeRegExp);
|
|
382
|
-
// Join all the `modifyURLPrefix` keys so a single regex can be used.
|
|
383
267
|
const prefixMatchesStrings = safeModifyURLPrefixes.join("|");
|
|
384
|
-
// Add `^` to the front the prefix matches so it only matches the start of
|
|
385
|
-
// a string.
|
|
386
268
|
const modifyRegex = new RegExp(`^(${prefixMatchesStrings})`);
|
|
387
269
|
return (originalManifest)=>{
|
|
388
270
|
const manifest = originalManifest.map((entry)=>{
|
|
@@ -430,8 +312,6 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
430
312
|
};
|
|
431
313
|
}
|
|
432
314
|
const allWarnings = [];
|
|
433
|
-
// Take the array of fileDetail objects and convert it into an array of
|
|
434
|
-
// {url, revision, size} objects, with \ replaced with /.
|
|
435
315
|
const normalizedManifest = fileDetails.map((fileDetails)=>{
|
|
436
316
|
return {
|
|
437
317
|
url: fileDetails.file.replace(/\\/g, "/"),
|
|
@@ -449,11 +329,9 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
449
329
|
if (dontCacheBustURLsMatching) {
|
|
450
330
|
transformsToApply.push(noRevisionForURLsMatchingTransform(dontCacheBustURLsMatching));
|
|
451
331
|
}
|
|
452
|
-
// Run any manifestTransforms functions second-to-last.
|
|
453
332
|
if (manifestTransforms) {
|
|
454
333
|
transformsToApply.push(...manifestTransforms);
|
|
455
334
|
}
|
|
456
|
-
// Run additionalPrecacheEntriesTransform last.
|
|
457
335
|
if (additionalPrecacheEntries) {
|
|
458
336
|
transformsToApply.push(additionalPrecacheEntriesTransform(additionalPrecacheEntries));
|
|
459
337
|
}
|
|
@@ -466,13 +344,10 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
466
344
|
transformedManifest = result.manifest;
|
|
467
345
|
allWarnings.push(...result.warnings || []);
|
|
468
346
|
}
|
|
469
|
-
// Generate some metadata about the manifest before we clear out the size
|
|
470
|
-
// properties from each entry.
|
|
471
347
|
const count = transformedManifest.length;
|
|
472
348
|
let size = 0;
|
|
473
349
|
for (const manifestEntry of transformedManifest){
|
|
474
350
|
size += manifestEntry.size || 0;
|
|
475
|
-
// biome-ignore lint/performance/noDelete: I don't understand this part yet.
|
|
476
351
|
delete manifestEntry.size;
|
|
477
352
|
}
|
|
478
353
|
return {
|
|
@@ -513,8 +388,6 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
513
388
|
}
|
|
514
389
|
}
|
|
515
390
|
} catch (error) {
|
|
516
|
-
// If there's an exception thrown while globbing, then report
|
|
517
|
-
// it back as a warning, and don't consider it fatal.
|
|
518
391
|
if (error instanceof Error && error.message) {
|
|
519
392
|
warnings.push(error.message);
|
|
520
393
|
}
|
|
@@ -614,34 +487,11 @@ const validateViteInjectManifestOptions = async (input)=>{
|
|
|
614
487
|
return result.data;
|
|
615
488
|
};
|
|
616
489
|
|
|
617
|
-
|
|
618
|
-
* This method returns a list of URLs to precache, referred to as a "precache
|
|
619
|
-
* manifest", along with details about the number of entries and their size,
|
|
620
|
-
* based on the options you provide.
|
|
621
|
-
*
|
|
622
|
-
* ```
|
|
623
|
-
* // The following lists some common options; see the rest of the documentation
|
|
624
|
-
* // for the full set of options and defaults.
|
|
625
|
-
* const {count, manifestEntries, size, warnings} = await getManifest({
|
|
626
|
-
* dontCacheBustURLsMatching: [new RegExp('...')],
|
|
627
|
-
* globDirectory: '...',
|
|
628
|
-
* globPatterns: ['...', '...'],
|
|
629
|
-
* maximumFileSizeToCacheInBytes: ...,
|
|
630
|
-
* });
|
|
631
|
-
* ```
|
|
632
|
-
*/ const getManifest = async (config)=>{
|
|
490
|
+
const getManifest = async (config)=>{
|
|
633
491
|
const options = await validateGetManifestOptions(config);
|
|
634
492
|
return await getFileManifestEntries(options);
|
|
635
493
|
};
|
|
636
494
|
|
|
637
|
-
/*
|
|
638
|
-
Copyright 2022 Google LLC
|
|
639
|
-
|
|
640
|
-
Use of this source code is governed by an MIT-style
|
|
641
|
-
license that can be found in the LICENSE file or at
|
|
642
|
-
https://opensource.org/licenses/MIT.
|
|
643
|
-
*/ // Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js
|
|
644
|
-
// See https://github.com/GoogleChrome/workbox/issues/3019
|
|
645
495
|
const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
|
|
646
496
|
const regex = RegExp(`(?:/\\*(?:\\s*\r?\n(?://)?)?(?:${innerRegex.source})\\s*\\*/|//(?:${innerRegex.source}))\\s*`);
|
|
647
497
|
function getSourceMapURL(srcContents) {
|
|
@@ -650,24 +500,13 @@ function getSourceMapURL(srcContents) {
|
|
|
650
500
|
}
|
|
651
501
|
|
|
652
502
|
function rebasePath({ baseDirectory, file }) {
|
|
653
|
-
// The initial path is relative to the current directory, so make it absolute.
|
|
654
503
|
const absolutePath = upath.resolve(file);
|
|
655
|
-
// Convert the absolute path so that it's relative to the baseDirectory.
|
|
656
504
|
const relativePath = upath.relative(baseDirectory, absolutePath);
|
|
657
|
-
// Remove any leading ./ as it won't work in a glob pattern.
|
|
658
505
|
const normalizedPath = upath.normalize(relativePath);
|
|
659
506
|
return normalizedPath;
|
|
660
507
|
}
|
|
661
508
|
|
|
662
|
-
|
|
663
|
-
* Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern
|
|
664
|
-
* JavaScript updates, along with additional properties copied from originalMap.
|
|
665
|
-
*
|
|
666
|
-
* @param options
|
|
667
|
-
* @returns An object containing both
|
|
668
|
-
* originalSource with the replacement applied, and the modified originalMap.
|
|
669
|
-
* @private
|
|
670
|
-
*/ async function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString }) {
|
|
509
|
+
async function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString }) {
|
|
671
510
|
const generator = new SourceMapGenerator({
|
|
672
511
|
file: jsFilename
|
|
673
512
|
});
|
|
@@ -717,8 +556,6 @@ function rebasePath({ baseDirectory, file }) {
|
|
|
717
556
|
return mapping;
|
|
718
557
|
});
|
|
719
558
|
consumer.destroy();
|
|
720
|
-
// JSON.parse returns any.
|
|
721
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
722
559
|
const updatedSourceMap = Object.assign(JSON.parse(generator.toString()), {
|
|
723
560
|
names: originalMap.names,
|
|
724
561
|
sourceRoot: originalMap.sourceRoot,
|
|
@@ -751,34 +588,8 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
751
588
|
};
|
|
752
589
|
}
|
|
753
590
|
|
|
754
|
-
|
|
755
|
-
* This method creates a list of URLs to precache, referred to as a "precache
|
|
756
|
-
* manifest", based on the options you provide.
|
|
757
|
-
*
|
|
758
|
-
* The manifest is injected into the `swSrc` file, and the placeholder string
|
|
759
|
-
* `injectionPoint` determines where in the file the manifest should go.
|
|
760
|
-
*
|
|
761
|
-
* The final service worker file, with the manifest injected, is written to
|
|
762
|
-
* disk at `swDest`.
|
|
763
|
-
*
|
|
764
|
-
* This method will not compile or bundle your `swSrc` file; it just handles
|
|
765
|
-
* injecting the manifest.
|
|
766
|
-
*
|
|
767
|
-
* ```
|
|
768
|
-
* // The following lists some common options; see the rest of the documentation
|
|
769
|
-
* // for the full set of options and defaults.
|
|
770
|
-
* const {count, size, warnings} = await injectManifest({
|
|
771
|
-
* dontCacheBustURLsMatching: [new RegExp('...')],
|
|
772
|
-
* globDirectory: '...',
|
|
773
|
-
* globPatterns: ['...', '...'],
|
|
774
|
-
* maximumFileSizeToCacheInBytes: ...,
|
|
775
|
-
* swDest: '...',
|
|
776
|
-
* swSrc: '...',
|
|
777
|
-
* });
|
|
778
|
-
* ```
|
|
779
|
-
*/ const injectManifest = async (config)=>{
|
|
591
|
+
const injectManifest = async (config)=>{
|
|
780
592
|
const options = await validateInjectManifestOptions(config);
|
|
781
|
-
// Make sure we leave swSrc and swDest out of the precache manifest.
|
|
782
593
|
for (const file of [
|
|
783
594
|
options.swSrc,
|
|
784
595
|
options.swDest
|
|
@@ -797,7 +608,6 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
797
608
|
throw new Error(`${errors["invalid-sw-src"]} ${error instanceof Error && error.message ? error.message : ""}`);
|
|
798
609
|
}
|
|
799
610
|
const injectionResults = swFileContents.match(globalRegexp);
|
|
800
|
-
// See https://github.com/GoogleChrome/workbox/issues/2230
|
|
801
611
|
const injectionPoint = options.injectionPoint ? options.injectionPoint : "";
|
|
802
612
|
if (!injectionResults) {
|
|
803
613
|
if (upath.resolve(options.swSrc) === upath.resolve(options.swDest)) {
|
|
@@ -809,17 +619,10 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
809
619
|
const manifestString = manifestEntries === undefined ? "undefined" : stringify(manifestEntries);
|
|
810
620
|
const filesToWrite = {};
|
|
811
621
|
const url = getSourceMapURL(swFileContents);
|
|
812
|
-
// See https://github.com/GoogleChrome/workbox/issues/2957
|
|
813
622
|
const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, options.swSrc, options.swDest);
|
|
814
623
|
if (warning) {
|
|
815
624
|
warnings.push(warning);
|
|
816
625
|
}
|
|
817
|
-
// If our swSrc file contains a sourcemap, we would invalidate that
|
|
818
|
-
// mapping if we just replaced injectionPoint with the stringified manifest.
|
|
819
|
-
// Instead, we need to update the swDest contents as well as the sourcemap
|
|
820
|
-
// (assuming it's a real file, not a data: URL) at the same time.
|
|
821
|
-
// See https://github.com/GoogleChrome/workbox/issues/2235
|
|
822
|
-
// and https://github.com/GoogleChrome/workbox/issues/2648
|
|
823
626
|
if (srcPath && destPath) {
|
|
824
627
|
const originalMap = await fse.readJSON(srcPath, {
|
|
825
628
|
encoding: "utf8"
|
|
@@ -834,8 +637,6 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
834
637
|
filesToWrite[options.swDest] = source;
|
|
835
638
|
filesToWrite[destPath] = map;
|
|
836
639
|
} else {
|
|
837
|
-
// If there's no sourcemap associated with swSrc, a simple string
|
|
838
|
-
// replacement will suffice.
|
|
839
640
|
filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);
|
|
840
641
|
}
|
|
841
642
|
for (const [file, contents] of Object.entries(filesToWrite)){
|
|
@@ -850,7 +651,6 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
850
651
|
count,
|
|
851
652
|
size,
|
|
852
653
|
warnings,
|
|
853
|
-
// Use upath.resolve() to make all the paths absolute.
|
|
854
654
|
filePaths: Object.keys(filesToWrite).map((f)=>upath.resolve(f))
|
|
855
655
|
};
|
|
856
656
|
};
|
package/dist/index.next.js
CHANGED
|
@@ -5,13 +5,16 @@ import { v as validationErrorMap, S as SerwistConfigError } from './chunks/serwi
|
|
|
5
5
|
import './chunks/glob.js';
|
|
6
6
|
|
|
7
7
|
const nextInjectManifestPartial = z.object({
|
|
8
|
-
|
|
8
|
+
cacheOnNavigation: z.boolean().default(false),
|
|
9
9
|
disable: z.boolean().default(false),
|
|
10
10
|
register: z.boolean().default(true),
|
|
11
11
|
reloadOnOnline: z.boolean().default(true),
|
|
12
12
|
scope: z.string().optional(),
|
|
13
13
|
swUrl: z.string().default("/sw.js"),
|
|
14
|
-
globPublicPatterns: z.
|
|
14
|
+
globPublicPatterns: z.union([
|
|
15
|
+
z.string(),
|
|
16
|
+
z.array(z.string())
|
|
17
|
+
]).default([
|
|
15
18
|
"**/*"
|
|
16
19
|
])
|
|
17
20
|
}).strict("Do not pass invalid properties to NextInjectManifestPartial!");
|
|
@@ -0,0 +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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/schema/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/schema/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getManifest.d.ts","sourceRoot":"","sources":["../../src/schema/getManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getManifest.d.ts","sourceRoot":"","sources":["../../src/schema/getManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGmC,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;AAWxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAQmC,CAAC;AAE5D,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC;AAI7E,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectManifest.d.ts","sourceRoot":"","sources":["../../src/schema/injectManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"injectManifest.d.ts","sourceRoot":"","sources":["../../src/schema/injectManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,aAAa;;;;;;;;;EAKmC,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
|
package/dist/schema/next.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const nextInjectManifestPartial: z.ZodObject<{
|
|
3
|
-
|
|
3
|
+
cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
|
|
4
4
|
disable: z.ZodDefault<z.ZodBoolean>;
|
|
5
5
|
register: z.ZodDefault<z.ZodBoolean>;
|
|
6
6
|
reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
scope: z.ZodOptional<z.ZodString>;
|
|
8
8
|
swUrl: z.ZodDefault<z.ZodString>;
|
|
9
|
-
globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
globPublicPatterns: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
|
-
|
|
11
|
+
cacheOnNavigation: boolean;
|
|
12
12
|
disable: boolean;
|
|
13
13
|
register: boolean;
|
|
14
14
|
reloadOnOnline: boolean;
|
|
15
15
|
swUrl: string;
|
|
16
|
-
globPublicPatterns: string[];
|
|
16
|
+
globPublicPatterns: (string | string[]) & (string | string[] | undefined);
|
|
17
17
|
scope?: string | undefined;
|
|
18
18
|
}, {
|
|
19
|
-
|
|
19
|
+
cacheOnNavigation?: boolean | undefined;
|
|
20
20
|
disable?: boolean | undefined;
|
|
21
21
|
register?: boolean | undefined;
|
|
22
22
|
reloadOnOnline?: boolean | undefined;
|
|
23
23
|
scope?: string | undefined;
|
|
24
24
|
swUrl?: string | undefined;
|
|
25
|
-
globPublicPatterns?: string[] | undefined;
|
|
25
|
+
globPublicPatterns?: string | string[] | undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export declare const nextInjectManifestOptions: z.ZodObject<Omit<{
|
|
28
28
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -136,25 +136,25 @@ export declare const nextInjectManifestOptions: z.ZodObject<Omit<{
|
|
|
136
136
|
compileSrc: z.ZodDefault<z.ZodBoolean>;
|
|
137
137
|
webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
138
138
|
swDest: z.ZodString;
|
|
139
|
-
|
|
139
|
+
cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
|
|
140
140
|
disable: z.ZodDefault<z.ZodBoolean>;
|
|
141
141
|
register: z.ZodDefault<z.ZodBoolean>;
|
|
142
142
|
reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
|
|
143
143
|
scope: z.ZodOptional<z.ZodString>;
|
|
144
144
|
swUrl: z.ZodDefault<z.ZodString>;
|
|
145
|
-
globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
145
|
+
globPublicPatterns: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
146
146
|
}, "disablePrecacheManifest">, "strict", z.ZodTypeAny, {
|
|
147
147
|
maximumFileSizeToCacheInBytes: number;
|
|
148
148
|
injectionPoint: string;
|
|
149
149
|
swSrc: string;
|
|
150
150
|
exclude: (string | RegExp | ((args_0: any) => boolean))[];
|
|
151
151
|
compileSrc: boolean;
|
|
152
|
-
|
|
152
|
+
cacheOnNavigation: boolean;
|
|
153
153
|
disable: boolean;
|
|
154
154
|
register: boolean;
|
|
155
155
|
reloadOnOnline: boolean;
|
|
156
156
|
swUrl: string;
|
|
157
|
-
globPublicPatterns: string[];
|
|
157
|
+
globPublicPatterns: (string | string[]) & (string | string[] | undefined);
|
|
158
158
|
swDest: string;
|
|
159
159
|
additionalPrecacheEntries?: (string | {
|
|
160
160
|
revision: string | null;
|
|
@@ -232,12 +232,12 @@ export declare const nextInjectManifestOptions: z.ZodObject<Omit<{
|
|
|
232
232
|
mode?: string | null | undefined;
|
|
233
233
|
compileSrc?: boolean | undefined;
|
|
234
234
|
webpackCompilationPlugins?: any[] | undefined;
|
|
235
|
-
|
|
235
|
+
cacheOnNavigation?: boolean | undefined;
|
|
236
236
|
disable?: boolean | undefined;
|
|
237
237
|
register?: boolean | undefined;
|
|
238
238
|
reloadOnOnline?: boolean | undefined;
|
|
239
239
|
swUrl?: string | undefined;
|
|
240
|
-
globPublicPatterns?: string[] | undefined;
|
|
240
|
+
globPublicPatterns?: string | string[] | undefined;
|
|
241
241
|
scope?: string | undefined;
|
|
242
242
|
}>;
|
|
243
243
|
//# sourceMappingURL=next.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/schema/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/schema/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAUmC,CAAC;AAE1E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAImC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swDest.d.ts","sourceRoot":"","sources":["../../src/schema/swDest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"swDest.d.ts","sourceRoot":"","sources":["../../src/schema/swDest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB;;;;;;EAI4B,CAAC;AAE/D,eAAO,MAAM,qBAAqB;;;;;;EAI4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/schema/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/schema/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/schema/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/schema/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAUmC,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAMmC,CAAC;AAE7E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -223,7 +223,7 @@ export interface NextInjectManifestPartial {
|
|
|
223
223
|
* also adds a bit of overhead due to additional network calls.
|
|
224
224
|
* @default false
|
|
225
225
|
*/
|
|
226
|
-
|
|
226
|
+
cacheOnNavigation?: boolean;
|
|
227
227
|
/**
|
|
228
228
|
* Whether Serwist should be disabled.
|
|
229
229
|
* @default false
|
|
@@ -304,7 +304,7 @@ export interface NextInjectManifestPartial {
|
|
|
304
304
|
*/
|
|
305
305
|
globPublicPatterns?: GlobPattern | GlobPattern[];
|
|
306
306
|
}
|
|
307
|
-
export type NextInjectManifestResolved = Require<NextInjectManifestPartial, "
|
|
307
|
+
export type NextInjectManifestResolved = Require<NextInjectManifestPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">;
|
|
308
308
|
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
|
|
309
309
|
export type GetManifestOptionsComplete = BaseResolved & GlobResolved & RequiredGlobDirectoryResolved;
|
|
310
310
|
export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSwDestPartial & RequiredGlobDirectoryPartial;
|
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,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAEhG,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,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AAM,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,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
|
|
6
6
|
"files": [
|
|
@@ -50,29 +50,29 @@
|
|
|
50
50
|
"fast-json-stable-stringify": "2.1.0",
|
|
51
51
|
"fs-extra": "11.2.0",
|
|
52
52
|
"glob": "10.3.10",
|
|
53
|
+
"pretty-bytes": "6.1.1",
|
|
53
54
|
"rollup": "4.9.6",
|
|
54
55
|
"source-map": "0.8.0-beta.0",
|
|
55
56
|
"upath": "2.0.1",
|
|
56
57
|
"zod": "3.22.4",
|
|
57
|
-
"@serwist/background-sync": "9.0.0-preview.
|
|
58
|
-
"@serwist/broadcast-update": "9.0.0-preview.
|
|
59
|
-
"@serwist/cacheable-response": "9.0.0-preview.
|
|
60
|
-
"@serwist/core": "9.0.0-preview.
|
|
61
|
-
"@serwist/expiration": "9.0.0-preview.
|
|
62
|
-
"@serwist/google-analytics": "9.0.0-preview.
|
|
63
|
-
"@serwist/precaching": "9.0.0-preview.
|
|
64
|
-
"@serwist/routing": "9.0.0-preview.
|
|
58
|
+
"@serwist/background-sync": "9.0.0-preview.1",
|
|
59
|
+
"@serwist/broadcast-update": "9.0.0-preview.1",
|
|
60
|
+
"@serwist/cacheable-response": "9.0.0-preview.1",
|
|
61
|
+
"@serwist/core": "9.0.0-preview.1",
|
|
62
|
+
"@serwist/expiration": "9.0.0-preview.1",
|
|
63
|
+
"@serwist/google-analytics": "9.0.0-preview.1",
|
|
64
|
+
"@serwist/precaching": "9.0.0-preview.1",
|
|
65
|
+
"@serwist/routing": "9.0.0-preview.1"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@types/common-tags": "1.8.4",
|
|
68
69
|
"@types/fs-extra": "11.0.4",
|
|
69
70
|
"@types/node": "20.11.16",
|
|
70
71
|
"@types/stringify-object": "4.0.5",
|
|
71
|
-
"pretty-bytes": "6.1.1",
|
|
72
72
|
"type-fest": "4.10.2",
|
|
73
73
|
"typescript": "5.4.0-dev.20240203",
|
|
74
|
-
"@serwist/constants": "9.0.0-preview.
|
|
75
|
-
"@serwist/utils": "9.0.0-preview.
|
|
74
|
+
"@serwist/constants": "9.0.0-preview.1",
|
|
75
|
+
"@serwist/utils": "9.0.0-preview.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"typescript": ">=5.0.0"
|
package/src/schema/base.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
import type { BasePartial, BaseResolved } from "../types.js";
|
|
4
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
4
5
|
import { manifestEntry } from "./manifestEntry.js";
|
|
5
6
|
import { manifestTransform } from "./manifestTransform.js";
|
|
6
7
|
|
|
@@ -13,4 +14,7 @@ export const basePartial = z
|
|
|
13
14
|
maximumFileSizeToCacheInBytes: z.number().default(2097152),
|
|
14
15
|
modifyURLPrefix: z.record(z.string(), z.string()).optional(),
|
|
15
16
|
})
|
|
16
|
-
.strict("Do not pass invalid properties to BasePartial!")
|
|
17
|
+
.strict("Do not pass invalid properties to BasePartial!");
|
|
18
|
+
|
|
19
|
+
assertType<Equals<BasePartial, z.input<typeof basePartial>>>();
|
|
20
|
+
assertType<Equals<BaseResolved, z.output<typeof basePartial>>>();
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
|
|
3
2
|
import type { GetManifestOptions, GetManifestOptionsComplete } from "../types.js";
|
|
3
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
4
4
|
import { basePartial } from "./base.js";
|
|
5
5
|
import { globPartial, requiredGlobDirectoryPartial } from "./glob.js";
|
|
6
6
|
|
|
7
7
|
export const getManifestOptions = basePartial
|
|
8
8
|
.merge(globPartial)
|
|
9
9
|
.merge(requiredGlobDirectoryPartial)
|
|
10
|
-
.strict("Do not pass invalid properties to GetManifestOptions!")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>;
|
|
10
|
+
.strict("Do not pass invalid properties to GetManifestOptions!");
|
|
11
|
+
|
|
12
|
+
assertType<Equals<GetManifestOptions, z.input<typeof getManifestOptions>>>();
|
|
13
|
+
assertType<Equals<GetManifestOptionsComplete, z.output<typeof getManifestOptions>>>();
|
package/src/schema/glob.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
RequiredGlobDirectoryPartial,
|
|
8
8
|
RequiredGlobDirectoryResolved,
|
|
9
9
|
} from "../types.js";
|
|
10
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
10
11
|
|
|
11
12
|
export const globPartial = z
|
|
12
13
|
.object({
|
|
@@ -16,17 +17,13 @@ export const globPartial = z
|
|
|
16
17
|
globStrict: z.boolean().default(true),
|
|
17
18
|
templatedURLs: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),
|
|
18
19
|
})
|
|
19
|
-
.strict("Do not pass invalid properties to GlobPartial!")
|
|
20
|
+
.strict("Do not pass invalid properties to GlobPartial!");
|
|
20
21
|
|
|
21
22
|
export const optionalGlobDirectoryPartial = z
|
|
22
23
|
.object({
|
|
23
24
|
globDirectory: z.string().optional(),
|
|
24
25
|
})
|
|
25
|
-
.strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!")
|
|
26
|
-
OptionalGlobDirectoryResolved,
|
|
27
|
-
z.ZodObjectDef,
|
|
28
|
-
OptionalGlobDirectoryPartial
|
|
29
|
-
>;
|
|
26
|
+
.strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!");
|
|
30
27
|
|
|
31
28
|
// This needs to be set when using GetManifest or InjectManifest. This is
|
|
32
29
|
// enforced via runtime validation, and needs to be documented.
|
|
@@ -34,8 +31,11 @@ export const requiredGlobDirectoryPartial = z
|
|
|
34
31
|
.object({
|
|
35
32
|
globDirectory: z.string(),
|
|
36
33
|
})
|
|
37
|
-
.strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
.strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!");
|
|
35
|
+
|
|
36
|
+
assertType<Equals<GlobPartial, z.input<typeof globPartial>>>();
|
|
37
|
+
assertType<Equals<GlobResolved, z.output<typeof globPartial>>>();
|
|
38
|
+
assertType<Equals<OptionalGlobDirectoryPartial, z.input<typeof optionalGlobDirectoryPartial>>>();
|
|
39
|
+
assertType<Equals<OptionalGlobDirectoryResolved, z.output<typeof optionalGlobDirectoryPartial>>>();
|
|
40
|
+
assertType<Equals<RequiredGlobDirectoryPartial, z.input<typeof requiredGlobDirectoryPartial>>>();
|
|
41
|
+
assertType<Equals<RequiredGlobDirectoryResolved, z.output<typeof requiredGlobDirectoryPartial>>>();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { InjectManifestOptions, InjectManifestOptionsComplete, InjectPartial, InjectResolved } from "../types.js";
|
|
3
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
3
4
|
import { basePartial } from "./base.js";
|
|
4
5
|
import { globPartial, requiredGlobDirectoryPartial } from "./glob.js";
|
|
5
6
|
import { requiredSwDestPartial } from "./swDest.js";
|
|
@@ -9,15 +10,16 @@ export const injectPartial = z
|
|
|
9
10
|
injectionPoint: z.string().default("self.__SW_MANIFEST"),
|
|
10
11
|
swSrc: z.string(),
|
|
11
12
|
})
|
|
12
|
-
.strict("Do not pass invalid properties to InjectPartial!")
|
|
13
|
+
.strict("Do not pass invalid properties to InjectPartial!");
|
|
13
14
|
|
|
14
15
|
export const injectManifestOptions = basePartial
|
|
15
16
|
.merge(globPartial)
|
|
16
17
|
.merge(injectPartial)
|
|
17
18
|
.merge(requiredSwDestPartial)
|
|
18
19
|
.merge(requiredGlobDirectoryPartial)
|
|
19
|
-
.strict("Do not pass invalid properties to InjectManifestOptions!")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
.strict("Do not pass invalid properties to InjectManifestOptions!");
|
|
21
|
+
|
|
22
|
+
assertType<Equals<InjectPartial, z.input<typeof injectPartial>>>();
|
|
23
|
+
assertType<Equals<InjectResolved, z.output<typeof injectPartial>>>();
|
|
24
|
+
assertType<Equals<InjectManifestOptions, z.input<typeof injectManifestOptions>>>();
|
|
25
|
+
assertType<Equals<InjectManifestOptionsComplete, z.output<typeof injectManifestOptions>>>();
|
package/src/schema/next.ts
CHANGED
|
@@ -5,31 +5,29 @@ import type {
|
|
|
5
5
|
NextInjectManifestPartial,
|
|
6
6
|
NextInjectManifestResolved,
|
|
7
7
|
} from "../types.js";
|
|
8
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
8
9
|
import { requiredSwDestPartial } from "./swDest.js";
|
|
9
10
|
import { webpackInjectManifestOptions } from "./webpack.js";
|
|
10
11
|
|
|
11
12
|
export const nextInjectManifestPartial = z
|
|
12
13
|
.object({
|
|
13
|
-
|
|
14
|
+
cacheOnNavigation: z.boolean().default(false),
|
|
14
15
|
disable: z.boolean().default(false),
|
|
15
16
|
register: z.boolean().default(true),
|
|
16
17
|
reloadOnOnline: z.boolean().default(true),
|
|
17
18
|
scope: z.string().optional(),
|
|
18
19
|
swUrl: z.string().default("/sw.js"),
|
|
19
|
-
globPublicPatterns: z.array(z.string()).default(["**/*"]),
|
|
20
|
+
globPublicPatterns: z.union([z.string(), z.array(z.string())]).default(["**/*"]),
|
|
20
21
|
})
|
|
21
|
-
.strict("Do not pass invalid properties to NextInjectManifestPartial!")
|
|
22
|
-
NextInjectManifestResolved,
|
|
23
|
-
z.ZodObjectDef,
|
|
24
|
-
NextInjectManifestPartial
|
|
25
|
-
>;
|
|
22
|
+
.strict("Do not pass invalid properties to NextInjectManifestPartial!");
|
|
26
23
|
|
|
27
24
|
export const nextInjectManifestOptions = webpackInjectManifestOptions
|
|
28
25
|
.merge(requiredSwDestPartial)
|
|
29
26
|
.merge(nextInjectManifestPartial)
|
|
30
27
|
.omit({ disablePrecacheManifest: true })
|
|
31
|
-
.strict("Do not pass invalid properties to NextInjectManifestOptions!")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
.strict("Do not pass invalid properties to NextInjectManifestOptions!");
|
|
29
|
+
|
|
30
|
+
assertType<Equals<NextInjectManifestPartial, z.input<typeof nextInjectManifestPartial>>>();
|
|
31
|
+
assertType<Equals<NextInjectManifestResolved, z.output<typeof nextInjectManifestPartial>>>();
|
|
32
|
+
assertType<Equals<NextInjectManifestOptions, z.input<typeof nextInjectManifestOptions>>>();
|
|
33
|
+
assertType<Equals<NextInjectManifestOptionsComplete, z.output<typeof nextInjectManifestOptions>>>();
|
package/src/schema/swDest.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { OptionalSwDestPartial, OptionalSwDestResolved, RequiredSwDestPartial, RequiredSwDestResolved } from "../types.js";
|
|
3
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
3
4
|
|
|
4
5
|
export const optionalSwDestPartial = z
|
|
5
6
|
.object({
|
|
6
7
|
swDest: z.string().optional(),
|
|
7
8
|
})
|
|
8
|
-
.strict("Do not pass invalid properties to OptionalSwDest!")
|
|
9
|
+
.strict("Do not pass invalid properties to OptionalSwDest!");
|
|
9
10
|
|
|
10
11
|
export const requiredSwDestPartial = z
|
|
11
12
|
.object({
|
|
12
13
|
swDest: z.string(),
|
|
13
14
|
})
|
|
14
|
-
.strict("Do not pass invalid properties to RequiredSwDest!")
|
|
15
|
+
.strict("Do not pass invalid properties to RequiredSwDest!");
|
|
16
|
+
|
|
17
|
+
assertType<Equals<OptionalSwDestPartial, z.input<typeof optionalSwDestPartial>>>();
|
|
18
|
+
assertType<Equals<OptionalSwDestResolved, z.output<typeof optionalSwDestPartial>>>();
|
|
19
|
+
assertType<Equals<RequiredSwDestPartial, z.input<typeof requiredSwDestPartial>>>();
|
|
20
|
+
assertType<Equals<RequiredSwDestResolved, z.output<typeof requiredSwDestPartial>>>();
|
package/src/schema/vite.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import type { ViteInjectManifestOptions, ViteInjectManifestOptionsComplete } from "../types.js";
|
|
3
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
3
4
|
import { basePartial } from "./base.js";
|
|
4
5
|
import { globPartial } from "./glob.js";
|
|
5
6
|
import { requiredGlobDirectoryPartial } from "./glob.js";
|
|
@@ -11,8 +12,7 @@ export const viteInjectManifestOptions = basePartial
|
|
|
11
12
|
.merge(injectPartial)
|
|
12
13
|
.merge(requiredSwDestPartial)
|
|
13
14
|
.merge(requiredGlobDirectoryPartial)
|
|
14
|
-
.strict("Do not pass invalid properties to ViteInjectManifestPartial!")
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>;
|
|
15
|
+
.strict("Do not pass invalid properties to ViteInjectManifestPartial!");
|
|
16
|
+
|
|
17
|
+
assertType<Equals<ViteInjectManifestOptions, z.input<typeof viteInjectManifestOptions>>>();
|
|
18
|
+
assertType<Equals<ViteInjectManifestOptionsComplete, z.output<typeof viteInjectManifestOptions>>>();
|
package/src/schema/webpack.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
WebpackPartial,
|
|
8
8
|
WebpackResolved,
|
|
9
9
|
} from "../types.js";
|
|
10
|
+
import { type Equals, assertType } from "./assertType.js";
|
|
10
11
|
import { basePartial } from "./base.js";
|
|
11
12
|
import { injectPartial } from "./injectManifest.js";
|
|
12
13
|
import { optionalSwDestPartial } from "./swDest.js";
|
|
@@ -21,7 +22,7 @@ export const webpackPartial = z
|
|
|
21
22
|
include: z.array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())])).optional(),
|
|
22
23
|
mode: z.string().nullable().optional(),
|
|
23
24
|
})
|
|
24
|
-
.strict("Do not pass invalid properties to WebpackPartial!")
|
|
25
|
+
.strict("Do not pass invalid properties to WebpackPartial!");
|
|
25
26
|
|
|
26
27
|
export const webpackInjectManifestPartial = z
|
|
27
28
|
.object({
|
|
@@ -29,19 +30,18 @@ export const webpackInjectManifestPartial = z
|
|
|
29
30
|
swDest: z.string().optional(),
|
|
30
31
|
webpackCompilationPlugins: z.array(z.any()).optional(),
|
|
31
32
|
})
|
|
32
|
-
.strict("Do not pass invalid properties to WebpackInjectManifestPartial!")
|
|
33
|
-
WebpackInjectManifestResolved,
|
|
34
|
-
z.ZodObjectDef,
|
|
35
|
-
WebpackInjectManifestPartial
|
|
36
|
-
>;
|
|
33
|
+
.strict("Do not pass invalid properties to WebpackInjectManifestPartial!");
|
|
37
34
|
|
|
38
35
|
export const webpackInjectManifestOptions = basePartial
|
|
39
36
|
.merge(webpackPartial)
|
|
40
37
|
.merge(injectPartial)
|
|
41
38
|
.merge(optionalSwDestPartial)
|
|
42
39
|
.merge(webpackInjectManifestPartial)
|
|
43
|
-
.strict("Do not pass invalid properties to WebpackInjectManifestOptions!")
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
.strict("Do not pass invalid properties to WebpackInjectManifestOptions!");
|
|
41
|
+
|
|
42
|
+
assertType<Equals<WebpackPartial, z.input<typeof webpackPartial>>>();
|
|
43
|
+
assertType<Equals<WebpackResolved, z.output<typeof webpackPartial>>>();
|
|
44
|
+
assertType<Equals<WebpackInjectManifestPartial, z.input<typeof webpackInjectManifestPartial>>>();
|
|
45
|
+
assertType<Equals<WebpackInjectManifestResolved, z.output<typeof webpackInjectManifestPartial>>>();
|
|
46
|
+
assertType<Equals<WebpackInjectManifestOptions, z.input<typeof webpackInjectManifestOptions>>>();
|
|
47
|
+
assertType<Equals<WebpackInjectManifestOptionsComplete, z.output<typeof webpackInjectManifestOptions>>>();
|
package/src/types.ts
CHANGED
|
@@ -254,7 +254,7 @@ export interface NextInjectManifestPartial {
|
|
|
254
254
|
* also adds a bit of overhead due to additional network calls.
|
|
255
255
|
* @default false
|
|
256
256
|
*/
|
|
257
|
-
|
|
257
|
+
cacheOnNavigation?: boolean;
|
|
258
258
|
/**
|
|
259
259
|
* Whether Serwist should be disabled.
|
|
260
260
|
* @default false
|
|
@@ -338,7 +338,7 @@ export interface NextInjectManifestPartial {
|
|
|
338
338
|
|
|
339
339
|
export type NextInjectManifestResolved = Require<
|
|
340
340
|
NextInjectManifestPartial,
|
|
341
|
-
"
|
|
341
|
+
"cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns"
|
|
342
342
|
>;
|
|
343
343
|
|
|
344
344
|
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
|