@serwist/build 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +225 -7
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +220 -8
- package/dist/lib/validate-options.d.ts +2 -1
- package/dist/schema/index.d.ts +157 -0
- package/dist/types.d.ts +18 -10
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This module's documentation can be found at https://
|
|
1
|
+
This module's documentation can be found at https://serwist.pages.dev/docs/build
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var stringify = require('fast-json-stable-stringify');
|
|
4
4
|
var assert = require('assert');
|
|
5
|
+
var commonTags = require('common-tags');
|
|
5
6
|
var crypto = require('crypto');
|
|
6
7
|
var glob = require('glob');
|
|
7
8
|
var upath = require('upath');
|
|
8
9
|
var fse = require('fs-extra');
|
|
9
10
|
var betterAjvErrors = require('@apideck/better-ajv-errors');
|
|
10
11
|
var Ajv = require('ajv');
|
|
11
|
-
var stringify = require('fast-json-stable-stringify');
|
|
12
12
|
var sourceMap = require('source-map');
|
|
13
|
+
var objectStringify = require('stringify-object');
|
|
14
|
+
var stripComments = require('strip-comments');
|
|
13
15
|
|
|
14
16
|
const errors = {
|
|
15
17
|
"unable-to-get-rootdir": `Unable to get the root directory of your web app.`,
|
|
@@ -569,6 +571,177 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
569
571
|
return transformedManifest;
|
|
570
572
|
}
|
|
571
573
|
|
|
574
|
+
var additionalProperties$3 = false;
|
|
575
|
+
var type$3 = "object";
|
|
576
|
+
var properties$3 = {
|
|
577
|
+
additionalPrecacheEntries: {
|
|
578
|
+
description: "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
|
|
579
|
+
type: "array",
|
|
580
|
+
items: {
|
|
581
|
+
anyOf: [
|
|
582
|
+
{
|
|
583
|
+
$ref: "#/definitions/ManifestEntry"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
type: "string"
|
|
587
|
+
}
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
dontCacheBustURLsMatching: {
|
|
592
|
+
description: "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
|
|
593
|
+
$ref: "#/definitions/RegExp"
|
|
594
|
+
},
|
|
595
|
+
manifestTransforms: {
|
|
596
|
+
description: "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
|
|
597
|
+
type: "array",
|
|
598
|
+
items: {}
|
|
599
|
+
},
|
|
600
|
+
maximumFileSizeToCacheInBytes: {
|
|
601
|
+
description: "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
|
|
602
|
+
"default": 2097152,
|
|
603
|
+
type: "number"
|
|
604
|
+
},
|
|
605
|
+
modifyURLPrefix: {
|
|
606
|
+
description: "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
|
|
607
|
+
type: "object",
|
|
608
|
+
additionalProperties: {
|
|
609
|
+
type: "string"
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
globFollow: {
|
|
613
|
+
description: "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
|
|
614
|
+
"default": true,
|
|
615
|
+
type: "boolean"
|
|
616
|
+
},
|
|
617
|
+
globIgnores: {
|
|
618
|
+
description: "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
|
|
619
|
+
"default": [
|
|
620
|
+
"**/node_modules/**/*"
|
|
621
|
+
],
|
|
622
|
+
type: "array",
|
|
623
|
+
items: {
|
|
624
|
+
type: "string"
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
globPatterns: {
|
|
628
|
+
description: "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
|
|
629
|
+
"default": [
|
|
630
|
+
"**/*.{js,css,html}"
|
|
631
|
+
],
|
|
632
|
+
type: "array",
|
|
633
|
+
items: {
|
|
634
|
+
type: "string"
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
globStrict: {
|
|
638
|
+
description: "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).",
|
|
639
|
+
"default": true,
|
|
640
|
+
type: "boolean"
|
|
641
|
+
},
|
|
642
|
+
templatedURLs: {
|
|
643
|
+
description: "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
|
|
644
|
+
type: "object",
|
|
645
|
+
additionalProperties: {
|
|
646
|
+
anyOf: [
|
|
647
|
+
{
|
|
648
|
+
type: "array",
|
|
649
|
+
items: {
|
|
650
|
+
type: "string"
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
type: "string"
|
|
655
|
+
}
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
globDirectory: {
|
|
660
|
+
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
661
|
+
type: "string"
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
var required$3 = [
|
|
665
|
+
"globDirectory"
|
|
666
|
+
];
|
|
667
|
+
var definitions$3 = {
|
|
668
|
+
ManifestEntry: {
|
|
669
|
+
type: "object",
|
|
670
|
+
properties: {
|
|
671
|
+
integrity: {
|
|
672
|
+
type: "string"
|
|
673
|
+
},
|
|
674
|
+
revision: {
|
|
675
|
+
type: [
|
|
676
|
+
"null",
|
|
677
|
+
"string"
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
url: {
|
|
681
|
+
type: "string"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
additionalProperties: false,
|
|
685
|
+
required: [
|
|
686
|
+
"revision",
|
|
687
|
+
"url"
|
|
688
|
+
]
|
|
689
|
+
},
|
|
690
|
+
"RegExp": {
|
|
691
|
+
type: "object",
|
|
692
|
+
properties: {
|
|
693
|
+
source: {
|
|
694
|
+
type: "string"
|
|
695
|
+
},
|
|
696
|
+
global: {
|
|
697
|
+
type: "boolean"
|
|
698
|
+
},
|
|
699
|
+
ignoreCase: {
|
|
700
|
+
type: "boolean"
|
|
701
|
+
},
|
|
702
|
+
multiline: {
|
|
703
|
+
type: "boolean"
|
|
704
|
+
},
|
|
705
|
+
lastIndex: {
|
|
706
|
+
type: "number"
|
|
707
|
+
},
|
|
708
|
+
flags: {
|
|
709
|
+
type: "string"
|
|
710
|
+
},
|
|
711
|
+
sticky: {
|
|
712
|
+
type: "boolean"
|
|
713
|
+
},
|
|
714
|
+
unicode: {
|
|
715
|
+
type: "boolean"
|
|
716
|
+
},
|
|
717
|
+
dotAll: {
|
|
718
|
+
type: "boolean"
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
additionalProperties: false,
|
|
722
|
+
required: [
|
|
723
|
+
"dotAll",
|
|
724
|
+
"flags",
|
|
725
|
+
"global",
|
|
726
|
+
"ignoreCase",
|
|
727
|
+
"lastIndex",
|
|
728
|
+
"multiline",
|
|
729
|
+
"source",
|
|
730
|
+
"sticky",
|
|
731
|
+
"unicode"
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
var $schema$3 = "http://json-schema.org/draft-07/schema#";
|
|
736
|
+
var getManifestOptionsSchema = {
|
|
737
|
+
additionalProperties: additionalProperties$3,
|
|
738
|
+
type: type$3,
|
|
739
|
+
properties: properties$3,
|
|
740
|
+
required: required$3,
|
|
741
|
+
definitions: definitions$3,
|
|
742
|
+
$schema: $schema$3
|
|
743
|
+
};
|
|
744
|
+
|
|
572
745
|
var additionalProperties$2 = false;
|
|
573
746
|
var type$2 = "object";
|
|
574
747
|
var properties$2 = {
|
|
@@ -654,13 +827,33 @@ var properties$2 = {
|
|
|
654
827
|
]
|
|
655
828
|
}
|
|
656
829
|
},
|
|
830
|
+
injectionPoint: {
|
|
831
|
+
description: "The string to find inside of the `swSrc` file. Once found, it will be\nreplaced by the generated precache manifest.",
|
|
832
|
+
"default": "self.__SW_MANIFEST",
|
|
833
|
+
type: "string"
|
|
834
|
+
},
|
|
835
|
+
swSrc: {
|
|
836
|
+
description: "The path and filename of the service worker file that will be read during\nthe build process, relative to the current working directory.",
|
|
837
|
+
type: "string"
|
|
838
|
+
},
|
|
839
|
+
swDest: {
|
|
840
|
+
description: "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.",
|
|
841
|
+
type: "string"
|
|
842
|
+
},
|
|
657
843
|
globDirectory: {
|
|
658
844
|
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
659
845
|
type: "string"
|
|
846
|
+
},
|
|
847
|
+
disablePrecacheManifest: {
|
|
848
|
+
description: "Whether the precache manifest should be set to `undefined`.",
|
|
849
|
+
"default": false,
|
|
850
|
+
type: "boolean"
|
|
660
851
|
}
|
|
661
852
|
};
|
|
662
853
|
var required$2 = [
|
|
663
|
-
"globDirectory"
|
|
854
|
+
"globDirectory",
|
|
855
|
+
"swDest",
|
|
856
|
+
"swSrc"
|
|
664
857
|
];
|
|
665
858
|
var definitions$2 = {
|
|
666
859
|
ManifestEntry: {
|
|
@@ -731,7 +924,7 @@ var definitions$2 = {
|
|
|
731
924
|
}
|
|
732
925
|
};
|
|
733
926
|
var $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
734
|
-
var
|
|
927
|
+
var injectManifestOptionsSchema = {
|
|
735
928
|
additionalProperties: additionalProperties$2,
|
|
736
929
|
type: type$2,
|
|
737
930
|
properties: properties$2,
|
|
@@ -922,7 +1115,7 @@ var definitions$1 = {
|
|
|
922
1115
|
}
|
|
923
1116
|
};
|
|
924
1117
|
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
925
|
-
var
|
|
1118
|
+
var viteInjectManifestOptionsSchema = {
|
|
926
1119
|
additionalProperties: additionalProperties$1,
|
|
927
1120
|
type: type$1,
|
|
928
1121
|
properties: properties$1,
|
|
@@ -1113,7 +1306,8 @@ var webpackInjectManifestOptionsSchema = {
|
|
|
1113
1306
|
const optionsSchemas = {
|
|
1114
1307
|
GetManifest: getManifestOptionsSchema,
|
|
1115
1308
|
InjectManifest: injectManifestOptionsSchema,
|
|
1116
|
-
WebpackInjectManifest: webpackInjectManifestOptionsSchema
|
|
1309
|
+
WebpackInjectManifest: webpackInjectManifestOptionsSchema,
|
|
1310
|
+
ViteInjectManifest: viteInjectManifestOptionsSchema
|
|
1117
1311
|
};
|
|
1118
1312
|
|
|
1119
1313
|
const ajv = new Ajv({
|
|
@@ -1177,6 +1371,10 @@ function validateWebpackInjectManifestOptions(input) {
|
|
|
1177
1371
|
const [validatedOptions] = validate(inputWithExcludeDefault, "WebpackInjectManifest");
|
|
1178
1372
|
return validatedOptions;
|
|
1179
1373
|
}
|
|
1374
|
+
const validateViteInjectManifestOptions = (input)=>{
|
|
1375
|
+
const [validatedOptions] = validate(input, "ViteInjectManifest");
|
|
1376
|
+
return validatedOptions;
|
|
1377
|
+
};
|
|
1180
1378
|
|
|
1181
1379
|
/**
|
|
1182
1380
|
* This method returns a list of URLs to precache, referred to as a "precache
|
|
@@ -1370,7 +1568,7 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1370
1568
|
throw new Error(`${errors["injection-point-not-found"]} ${injectionPoint}`);
|
|
1371
1569
|
}
|
|
1372
1570
|
assert(injectionResults.length === 1, `${errors["multiple-injection-points"]} ${injectionPoint}`);
|
|
1373
|
-
const manifestString = stringify(manifestEntries);
|
|
1571
|
+
const manifestString = manifestEntries === undefined ? "undefined" : stringify(manifestEntries);
|
|
1374
1572
|
const filesToWrite = {};
|
|
1375
1573
|
const url = getSourceMapURL(swFileContents);
|
|
1376
1574
|
// See https://github.com/GoogleChrome/workbox/issues/2957
|
|
@@ -1419,11 +1617,31 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1419
1617
|
};
|
|
1420
1618
|
}
|
|
1421
1619
|
|
|
1620
|
+
function stringifyWithoutComments(obj) {
|
|
1621
|
+
return objectStringify(obj, {
|
|
1622
|
+
// See https://github.com/yeoman/stringify-object#transformobject-property-originalresult
|
|
1623
|
+
transform: (_obj, _prop, str)=>{
|
|
1624
|
+
if (typeof _prop !== "symbol" && typeof _obj[_prop] === "function") {
|
|
1625
|
+
// Can't typify correctly stripComments
|
|
1626
|
+
return stripComments(str); // eslint-disable-line
|
|
1627
|
+
}
|
|
1628
|
+
return str;
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
exports.stringify = stringify;
|
|
1422
1634
|
exports.errors = errors;
|
|
1423
1635
|
exports.escapeRegExp = escapeRegExp;
|
|
1636
|
+
exports.getFileManifestEntries = getFileManifestEntries;
|
|
1424
1637
|
exports.getManifest = getManifest;
|
|
1425
1638
|
exports.getSourceMapURL = getSourceMapURL;
|
|
1426
1639
|
exports.injectManifest = injectManifest;
|
|
1640
|
+
exports.rebasePath = rebasePath;
|
|
1427
1641
|
exports.replaceAndUpdateSourceMap = replaceAndUpdateSourceMap;
|
|
1642
|
+
exports.stringifyWithoutComments = stringifyWithoutComments;
|
|
1428
1643
|
exports.transformManifest = transformManifest;
|
|
1644
|
+
exports.translateURLToSourcemapPaths = translateURLToSourcemapPaths;
|
|
1645
|
+
exports.validateInjectManifestOptions = validateInjectManifestOptions;
|
|
1646
|
+
exports.validateViteInjectManifestOptions = validateViteInjectManifestOptions;
|
|
1429
1647
|
exports.validateWebpackInjectManifestOptions = validateWebpackInjectManifestOptions;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import stringify from "fast-json-stable-stringify";
|
|
2
2
|
import { getManifest } from "./get-manifest.js";
|
|
3
3
|
import { injectManifest } from "./inject-manifest.js";
|
|
4
|
+
import { errors } from "./lib/errors.js";
|
|
4
5
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
6
|
+
import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
|
|
5
7
|
import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
8
|
+
import { rebasePath } from "./lib/rebase-path.js";
|
|
6
9
|
import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.js";
|
|
10
|
+
import { stringifyWithoutComments } from "./lib/stringify-without-comments.js";
|
|
7
11
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
12
|
+
import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
|
|
13
|
+
import { validateInjectManifestOptions, validateViteInjectManifestOptions, validateWebpackInjectManifestOptions } from "./lib/validate-options.js";
|
|
14
|
+
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, stringifyWithoutComments, transformManifest, translateURLToSourcemapPaths, validateInjectManifestOptions, validateViteInjectManifestOptions, validateWebpackInjectManifestOptions, };
|
|
10
15
|
export * from "./types.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import stringify from "fast-json-stable-stringify";
|
|
2
2
|
import { getManifest } from "./get-manifest.js";
|
|
3
3
|
import { injectManifest } from "./inject-manifest.js";
|
|
4
|
+
import { errors } from "./lib/errors.js";
|
|
4
5
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
6
|
+
import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
|
|
5
7
|
import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
8
|
+
import { rebasePath } from "./lib/rebase-path.js";
|
|
6
9
|
import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.js";
|
|
10
|
+
import { stringifyWithoutComments } from "./lib/stringify-without-comments.js";
|
|
7
11
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
12
|
+
import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
|
|
13
|
+
import { validateInjectManifestOptions, validateViteInjectManifestOptions, validateWebpackInjectManifestOptions } from "./lib/validate-options.js";
|
|
14
|
+
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, stringifyWithoutComments, transformManifest, translateURLToSourcemapPaths, validateInjectManifestOptions, validateViteInjectManifestOptions, validateWebpackInjectManifestOptions, };
|
|
10
15
|
export * from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import stringify from 'fast-json-stable-stringify';
|
|
2
|
+
export { default as stringify } from 'fast-json-stable-stringify';
|
|
2
3
|
import assert from 'assert';
|
|
4
|
+
import { oneLine } from 'common-tags';
|
|
3
5
|
import crypto from 'crypto';
|
|
4
6
|
import { glob } from 'glob';
|
|
5
7
|
import upath from 'upath';
|
|
6
8
|
import fse from 'fs-extra';
|
|
7
9
|
import { betterAjvErrors } from '@apideck/better-ajv-errors';
|
|
8
10
|
import Ajv from 'ajv';
|
|
9
|
-
import stringify from 'fast-json-stable-stringify';
|
|
10
11
|
import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
|
|
12
|
+
import objectStringify from 'stringify-object';
|
|
13
|
+
import stripComments from 'strip-comments';
|
|
11
14
|
|
|
12
15
|
const errors = {
|
|
13
16
|
"unable-to-get-rootdir": `Unable to get the root directory of your web app.`,
|
|
@@ -567,6 +570,177 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
567
570
|
return transformedManifest;
|
|
568
571
|
}
|
|
569
572
|
|
|
573
|
+
var additionalProperties$3 = false;
|
|
574
|
+
var type$3 = "object";
|
|
575
|
+
var properties$3 = {
|
|
576
|
+
additionalPrecacheEntries: {
|
|
577
|
+
description: "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
|
|
578
|
+
type: "array",
|
|
579
|
+
items: {
|
|
580
|
+
anyOf: [
|
|
581
|
+
{
|
|
582
|
+
$ref: "#/definitions/ManifestEntry"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
type: "string"
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
dontCacheBustURLsMatching: {
|
|
591
|
+
description: "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
|
|
592
|
+
$ref: "#/definitions/RegExp"
|
|
593
|
+
},
|
|
594
|
+
manifestTransforms: {
|
|
595
|
+
description: "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
|
|
596
|
+
type: "array",
|
|
597
|
+
items: {}
|
|
598
|
+
},
|
|
599
|
+
maximumFileSizeToCacheInBytes: {
|
|
600
|
+
description: "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
|
|
601
|
+
"default": 2097152,
|
|
602
|
+
type: "number"
|
|
603
|
+
},
|
|
604
|
+
modifyURLPrefix: {
|
|
605
|
+
description: "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
|
|
606
|
+
type: "object",
|
|
607
|
+
additionalProperties: {
|
|
608
|
+
type: "string"
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
globFollow: {
|
|
612
|
+
description: "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
|
|
613
|
+
"default": true,
|
|
614
|
+
type: "boolean"
|
|
615
|
+
},
|
|
616
|
+
globIgnores: {
|
|
617
|
+
description: "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
|
|
618
|
+
"default": [
|
|
619
|
+
"**/node_modules/**/*"
|
|
620
|
+
],
|
|
621
|
+
type: "array",
|
|
622
|
+
items: {
|
|
623
|
+
type: "string"
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
globPatterns: {
|
|
627
|
+
description: "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
|
|
628
|
+
"default": [
|
|
629
|
+
"**/*.{js,css,html}"
|
|
630
|
+
],
|
|
631
|
+
type: "array",
|
|
632
|
+
items: {
|
|
633
|
+
type: "string"
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
globStrict: {
|
|
637
|
+
description: "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).",
|
|
638
|
+
"default": true,
|
|
639
|
+
type: "boolean"
|
|
640
|
+
},
|
|
641
|
+
templatedURLs: {
|
|
642
|
+
description: "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
|
|
643
|
+
type: "object",
|
|
644
|
+
additionalProperties: {
|
|
645
|
+
anyOf: [
|
|
646
|
+
{
|
|
647
|
+
type: "array",
|
|
648
|
+
items: {
|
|
649
|
+
type: "string"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
type: "string"
|
|
654
|
+
}
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
globDirectory: {
|
|
659
|
+
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
660
|
+
type: "string"
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
var required$3 = [
|
|
664
|
+
"globDirectory"
|
|
665
|
+
];
|
|
666
|
+
var definitions$3 = {
|
|
667
|
+
ManifestEntry: {
|
|
668
|
+
type: "object",
|
|
669
|
+
properties: {
|
|
670
|
+
integrity: {
|
|
671
|
+
type: "string"
|
|
672
|
+
},
|
|
673
|
+
revision: {
|
|
674
|
+
type: [
|
|
675
|
+
"null",
|
|
676
|
+
"string"
|
|
677
|
+
]
|
|
678
|
+
},
|
|
679
|
+
url: {
|
|
680
|
+
type: "string"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
additionalProperties: false,
|
|
684
|
+
required: [
|
|
685
|
+
"revision",
|
|
686
|
+
"url"
|
|
687
|
+
]
|
|
688
|
+
},
|
|
689
|
+
"RegExp": {
|
|
690
|
+
type: "object",
|
|
691
|
+
properties: {
|
|
692
|
+
source: {
|
|
693
|
+
type: "string"
|
|
694
|
+
},
|
|
695
|
+
global: {
|
|
696
|
+
type: "boolean"
|
|
697
|
+
},
|
|
698
|
+
ignoreCase: {
|
|
699
|
+
type: "boolean"
|
|
700
|
+
},
|
|
701
|
+
multiline: {
|
|
702
|
+
type: "boolean"
|
|
703
|
+
},
|
|
704
|
+
lastIndex: {
|
|
705
|
+
type: "number"
|
|
706
|
+
},
|
|
707
|
+
flags: {
|
|
708
|
+
type: "string"
|
|
709
|
+
},
|
|
710
|
+
sticky: {
|
|
711
|
+
type: "boolean"
|
|
712
|
+
},
|
|
713
|
+
unicode: {
|
|
714
|
+
type: "boolean"
|
|
715
|
+
},
|
|
716
|
+
dotAll: {
|
|
717
|
+
type: "boolean"
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
additionalProperties: false,
|
|
721
|
+
required: [
|
|
722
|
+
"dotAll",
|
|
723
|
+
"flags",
|
|
724
|
+
"global",
|
|
725
|
+
"ignoreCase",
|
|
726
|
+
"lastIndex",
|
|
727
|
+
"multiline",
|
|
728
|
+
"source",
|
|
729
|
+
"sticky",
|
|
730
|
+
"unicode"
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
var $schema$3 = "http://json-schema.org/draft-07/schema#";
|
|
735
|
+
var getManifestOptionsSchema = {
|
|
736
|
+
additionalProperties: additionalProperties$3,
|
|
737
|
+
type: type$3,
|
|
738
|
+
properties: properties$3,
|
|
739
|
+
required: required$3,
|
|
740
|
+
definitions: definitions$3,
|
|
741
|
+
$schema: $schema$3
|
|
742
|
+
};
|
|
743
|
+
|
|
570
744
|
var additionalProperties$2 = false;
|
|
571
745
|
var type$2 = "object";
|
|
572
746
|
var properties$2 = {
|
|
@@ -652,13 +826,33 @@ var properties$2 = {
|
|
|
652
826
|
]
|
|
653
827
|
}
|
|
654
828
|
},
|
|
829
|
+
injectionPoint: {
|
|
830
|
+
description: "The string to find inside of the `swSrc` file. Once found, it will be\nreplaced by the generated precache manifest.",
|
|
831
|
+
"default": "self.__SW_MANIFEST",
|
|
832
|
+
type: "string"
|
|
833
|
+
},
|
|
834
|
+
swSrc: {
|
|
835
|
+
description: "The path and filename of the service worker file that will be read during\nthe build process, relative to the current working directory.",
|
|
836
|
+
type: "string"
|
|
837
|
+
},
|
|
838
|
+
swDest: {
|
|
839
|
+
description: "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.",
|
|
840
|
+
type: "string"
|
|
841
|
+
},
|
|
655
842
|
globDirectory: {
|
|
656
843
|
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
657
844
|
type: "string"
|
|
845
|
+
},
|
|
846
|
+
disablePrecacheManifest: {
|
|
847
|
+
description: "Whether the precache manifest should be set to `undefined`.",
|
|
848
|
+
"default": false,
|
|
849
|
+
type: "boolean"
|
|
658
850
|
}
|
|
659
851
|
};
|
|
660
852
|
var required$2 = [
|
|
661
|
-
"globDirectory"
|
|
853
|
+
"globDirectory",
|
|
854
|
+
"swDest",
|
|
855
|
+
"swSrc"
|
|
662
856
|
];
|
|
663
857
|
var definitions$2 = {
|
|
664
858
|
ManifestEntry: {
|
|
@@ -729,7 +923,7 @@ var definitions$2 = {
|
|
|
729
923
|
}
|
|
730
924
|
};
|
|
731
925
|
var $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
732
|
-
var
|
|
926
|
+
var injectManifestOptionsSchema = {
|
|
733
927
|
additionalProperties: additionalProperties$2,
|
|
734
928
|
type: type$2,
|
|
735
929
|
properties: properties$2,
|
|
@@ -920,7 +1114,7 @@ var definitions$1 = {
|
|
|
920
1114
|
}
|
|
921
1115
|
};
|
|
922
1116
|
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
923
|
-
var
|
|
1117
|
+
var viteInjectManifestOptionsSchema = {
|
|
924
1118
|
additionalProperties: additionalProperties$1,
|
|
925
1119
|
type: type$1,
|
|
926
1120
|
properties: properties$1,
|
|
@@ -1111,7 +1305,8 @@ var webpackInjectManifestOptionsSchema = {
|
|
|
1111
1305
|
const optionsSchemas = {
|
|
1112
1306
|
GetManifest: getManifestOptionsSchema,
|
|
1113
1307
|
InjectManifest: injectManifestOptionsSchema,
|
|
1114
|
-
WebpackInjectManifest: webpackInjectManifestOptionsSchema
|
|
1308
|
+
WebpackInjectManifest: webpackInjectManifestOptionsSchema,
|
|
1309
|
+
ViteInjectManifest: viteInjectManifestOptionsSchema
|
|
1115
1310
|
};
|
|
1116
1311
|
|
|
1117
1312
|
const ajv = new Ajv({
|
|
@@ -1175,6 +1370,10 @@ function validateWebpackInjectManifestOptions(input) {
|
|
|
1175
1370
|
const [validatedOptions] = validate(inputWithExcludeDefault, "WebpackInjectManifest");
|
|
1176
1371
|
return validatedOptions;
|
|
1177
1372
|
}
|
|
1373
|
+
const validateViteInjectManifestOptions = (input)=>{
|
|
1374
|
+
const [validatedOptions] = validate(input, "ViteInjectManifest");
|
|
1375
|
+
return validatedOptions;
|
|
1376
|
+
};
|
|
1178
1377
|
|
|
1179
1378
|
/**
|
|
1180
1379
|
* This method returns a list of URLs to precache, referred to as a "precache
|
|
@@ -1368,7 +1567,7 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1368
1567
|
throw new Error(`${errors["injection-point-not-found"]} ${injectionPoint}`);
|
|
1369
1568
|
}
|
|
1370
1569
|
assert(injectionResults.length === 1, `${errors["multiple-injection-points"]} ${injectionPoint}`);
|
|
1371
|
-
const manifestString = stringify(manifestEntries);
|
|
1570
|
+
const manifestString = manifestEntries === undefined ? "undefined" : stringify(manifestEntries);
|
|
1372
1571
|
const filesToWrite = {};
|
|
1373
1572
|
const url = getSourceMapURL(swFileContents);
|
|
1374
1573
|
// See https://github.com/GoogleChrome/workbox/issues/2957
|
|
@@ -1417,4 +1616,17 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1417
1616
|
};
|
|
1418
1617
|
}
|
|
1419
1618
|
|
|
1420
|
-
|
|
1619
|
+
function stringifyWithoutComments(obj) {
|
|
1620
|
+
return objectStringify(obj, {
|
|
1621
|
+
// See https://github.com/yeoman/stringify-object#transformobject-property-originalresult
|
|
1622
|
+
transform: (_obj, _prop, str)=>{
|
|
1623
|
+
if (typeof _prop !== "symbol" && typeof _obj[_prop] === "function") {
|
|
1624
|
+
// Can't typify correctly stripComments
|
|
1625
|
+
return stripComments(str); // eslint-disable-line
|
|
1626
|
+
}
|
|
1627
|
+
return str;
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringifyWithoutComments, transformManifest, translateURLToSourcemapPaths, validateInjectManifestOptions, validateViteInjectManifestOptions, validateWebpackInjectManifestOptions };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { GetManifestOptions, InjectManifestOptions, WebpackInjectManifestOptions } from "../types.js";
|
|
1
|
+
import type { GetManifestOptions, InjectManifestOptions, ViteInjectManifestOptions, WebpackInjectManifestOptions } from "../types.js";
|
|
2
2
|
export declare class SerwistConfigError extends Error {
|
|
3
3
|
constructor(message?: string);
|
|
4
4
|
}
|
|
5
5
|
export declare function validateGetManifestOptions(input: unknown): GetManifestOptions;
|
|
6
6
|
export declare function validateInjectManifestOptions(input: unknown): InjectManifestOptions;
|
|
7
7
|
export declare function validateWebpackInjectManifestOptions(input: unknown): WebpackInjectManifestOptions;
|
|
8
|
+
export declare const validateViteInjectManifestOptions: (input: unknown) => ViteInjectManifestOptions;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -445,4 +445,161 @@ export declare const optionsSchemas: {
|
|
|
445
445
|
};
|
|
446
446
|
$schema: string;
|
|
447
447
|
};
|
|
448
|
+
ViteInjectManifest: {
|
|
449
|
+
additionalProperties: boolean;
|
|
450
|
+
type: string;
|
|
451
|
+
properties: {
|
|
452
|
+
additionalPrecacheEntries: {
|
|
453
|
+
description: string;
|
|
454
|
+
type: string;
|
|
455
|
+
items: {
|
|
456
|
+
anyOf: ({
|
|
457
|
+
$ref: string;
|
|
458
|
+
type?: undefined;
|
|
459
|
+
} | {
|
|
460
|
+
type: string;
|
|
461
|
+
$ref?: undefined;
|
|
462
|
+
})[];
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
dontCacheBustURLsMatching: {
|
|
466
|
+
description: string;
|
|
467
|
+
$ref: string;
|
|
468
|
+
};
|
|
469
|
+
manifestTransforms: {
|
|
470
|
+
description: string;
|
|
471
|
+
type: string;
|
|
472
|
+
items: {};
|
|
473
|
+
};
|
|
474
|
+
maximumFileSizeToCacheInBytes: {
|
|
475
|
+
description: string;
|
|
476
|
+
default: number;
|
|
477
|
+
type: string;
|
|
478
|
+
};
|
|
479
|
+
modifyURLPrefix: {
|
|
480
|
+
description: string;
|
|
481
|
+
type: string;
|
|
482
|
+
additionalProperties: {
|
|
483
|
+
type: string;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
globFollow: {
|
|
487
|
+
description: string;
|
|
488
|
+
default: boolean;
|
|
489
|
+
type: string;
|
|
490
|
+
};
|
|
491
|
+
globIgnores: {
|
|
492
|
+
description: string;
|
|
493
|
+
default: string[];
|
|
494
|
+
type: string;
|
|
495
|
+
items: {
|
|
496
|
+
type: string;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
globPatterns: {
|
|
500
|
+
description: string;
|
|
501
|
+
default: string[];
|
|
502
|
+
type: string;
|
|
503
|
+
items: {
|
|
504
|
+
type: string;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
globStrict: {
|
|
508
|
+
description: string;
|
|
509
|
+
default: boolean;
|
|
510
|
+
type: string;
|
|
511
|
+
};
|
|
512
|
+
templatedURLs: {
|
|
513
|
+
description: string;
|
|
514
|
+
type: string;
|
|
515
|
+
additionalProperties: {
|
|
516
|
+
anyOf: ({
|
|
517
|
+
type: string;
|
|
518
|
+
items: {
|
|
519
|
+
type: string;
|
|
520
|
+
};
|
|
521
|
+
} | {
|
|
522
|
+
type: string;
|
|
523
|
+
items?: undefined;
|
|
524
|
+
})[];
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
injectionPoint: {
|
|
528
|
+
description: string;
|
|
529
|
+
default: string;
|
|
530
|
+
type: string;
|
|
531
|
+
};
|
|
532
|
+
swSrc: {
|
|
533
|
+
description: string;
|
|
534
|
+
type: string;
|
|
535
|
+
};
|
|
536
|
+
swDest: {
|
|
537
|
+
description: string;
|
|
538
|
+
type: string;
|
|
539
|
+
};
|
|
540
|
+
globDirectory: {
|
|
541
|
+
description: string;
|
|
542
|
+
type: string;
|
|
543
|
+
};
|
|
544
|
+
disablePrecacheManifest: {
|
|
545
|
+
description: string;
|
|
546
|
+
default: boolean;
|
|
547
|
+
type: string;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
required: string[];
|
|
551
|
+
definitions: {
|
|
552
|
+
ManifestEntry: {
|
|
553
|
+
type: string;
|
|
554
|
+
properties: {
|
|
555
|
+
integrity: {
|
|
556
|
+
type: string;
|
|
557
|
+
};
|
|
558
|
+
revision: {
|
|
559
|
+
type: string[];
|
|
560
|
+
};
|
|
561
|
+
url: {
|
|
562
|
+
type: string;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
additionalProperties: boolean;
|
|
566
|
+
required: string[];
|
|
567
|
+
};
|
|
568
|
+
RegExp: {
|
|
569
|
+
type: string;
|
|
570
|
+
properties: {
|
|
571
|
+
source: {
|
|
572
|
+
type: string;
|
|
573
|
+
};
|
|
574
|
+
global: {
|
|
575
|
+
type: string;
|
|
576
|
+
};
|
|
577
|
+
ignoreCase: {
|
|
578
|
+
type: string;
|
|
579
|
+
};
|
|
580
|
+
multiline: {
|
|
581
|
+
type: string;
|
|
582
|
+
};
|
|
583
|
+
lastIndex: {
|
|
584
|
+
type: string;
|
|
585
|
+
};
|
|
586
|
+
flags: {
|
|
587
|
+
type: string;
|
|
588
|
+
};
|
|
589
|
+
sticky: {
|
|
590
|
+
type: string;
|
|
591
|
+
};
|
|
592
|
+
unicode: {
|
|
593
|
+
type: string;
|
|
594
|
+
};
|
|
595
|
+
dotAll: {
|
|
596
|
+
type: string;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
additionalProperties: boolean;
|
|
600
|
+
required: string[];
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
$schema: string;
|
|
604
|
+
};
|
|
448
605
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -131,7 +131,8 @@ export interface BasePartial {
|
|
|
131
131
|
*/
|
|
132
132
|
additionalPrecacheEntries?: Array<string | ManifestEntry>;
|
|
133
133
|
/**
|
|
134
|
-
* Whether the precache manifest should be set to `undefined`.
|
|
134
|
+
* Whether the precache manifest should be set to `undefined`. Essentially whether `@serwist/build` should
|
|
135
|
+
* be disabled. Mostly useful when you want it to only check if the provided options are valid.
|
|
135
136
|
* @default false
|
|
136
137
|
*/
|
|
137
138
|
disablePrecacheManifest?: boolean;
|
|
@@ -198,29 +199,35 @@ export interface GlobPartial {
|
|
|
198
199
|
/**
|
|
199
200
|
* Determines whether or not symlinks are followed when generating the
|
|
200
201
|
* precache manifest. For more information, see the definition of `follow` in
|
|
201
|
-
*
|
|
202
|
+
* [glob's documentation](https://github.com/isaacs/node-glob#options).
|
|
202
203
|
* @default true
|
|
203
204
|
*/
|
|
204
205
|
globFollow?: boolean;
|
|
205
206
|
/**
|
|
206
207
|
* A set of patterns matching files to always exclude when generating the
|
|
207
208
|
* precache manifest. For more information, see the definition of `ignore` in
|
|
208
|
-
*
|
|
209
|
-
* @default
|
|
209
|
+
* [glob's documentation](https://github.com/isaacs/node-glob#options).
|
|
210
|
+
* @default
|
|
211
|
+
* ```
|
|
212
|
+
* ["**\/node_modules\/**\/*"]
|
|
213
|
+
* ```
|
|
210
214
|
*/
|
|
211
215
|
globIgnores?: Array<string>;
|
|
212
216
|
/**
|
|
213
217
|
* Files matching any of these patterns will be included in the precache
|
|
214
|
-
* manifest. For more information, see
|
|
215
|
-
* [
|
|
216
|
-
* @default
|
|
218
|
+
* manifest. For more information, see
|
|
219
|
+
* [glob's Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
|
|
220
|
+
* @default
|
|
221
|
+
* ```
|
|
222
|
+
* ["**\/*.{js,css,html}"]
|
|
223
|
+
* ```
|
|
217
224
|
*/
|
|
218
225
|
globPatterns?: Array<string>;
|
|
219
226
|
/**
|
|
220
227
|
* If true, an error reading a directory when generating a precache manifest
|
|
221
228
|
* will cause the build to fail. If false, the problematic directory will be
|
|
222
|
-
* skipped. For more information, see the definition of `strict` in
|
|
223
|
-
* [documentation](https://github.com/isaacs/node-glob#options).
|
|
229
|
+
* skipped. For more information, see the definition of `strict` in
|
|
230
|
+
* [glob's documentation](https://github.com/isaacs/node-glob#options).
|
|
224
231
|
* @default true
|
|
225
232
|
*/
|
|
226
233
|
globStrict?: boolean;
|
|
@@ -316,6 +323,7 @@ export interface WebpackInjectManifestPartial {
|
|
|
316
323
|
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
|
|
317
324
|
export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSWDestPartial & RequiredGlobDirectoryPartial;
|
|
318
325
|
export type WebpackInjectManifestOptions = BasePartial & WebpackPartial & InjectPartial & WebpackInjectManifestPartial;
|
|
326
|
+
export type ViteInjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSWDestPartial & RequiredGlobDirectoryPartial;
|
|
319
327
|
export interface GetManifestResult {
|
|
320
328
|
count: number;
|
|
321
329
|
manifestEntries: Array<ManifestEntry> | undefined;
|
|
@@ -344,7 +352,7 @@ export type SerwistPackageJSON = PackageJson;
|
|
|
344
352
|
/**
|
|
345
353
|
* @private
|
|
346
354
|
*/
|
|
347
|
-
export type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest";
|
|
355
|
+
export type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest" | "ViteInjectManifest";
|
|
348
356
|
/**
|
|
349
357
|
* @private
|
|
350
358
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
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": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"repository": "serwist/serwist",
|
|
25
25
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
26
|
-
"homepage": "https://serwist.
|
|
26
|
+
"homepage": "https://serwist.pages.dev",
|
|
27
27
|
"module": "./dist/index.js",
|
|
28
28
|
"main": "./dist/index.cjs",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"stringify-object": "5.0.0",
|
|
53
53
|
"strip-comments": "2.0.1",
|
|
54
54
|
"upath": "2.0.1",
|
|
55
|
-
"@serwist/background-sync": "8.
|
|
56
|
-
"@serwist/broadcast-update": "8.
|
|
57
|
-
"@serwist/cacheable-response": "8.
|
|
58
|
-
"@serwist/core": "8.
|
|
59
|
-
"@serwist/expiration": "8.
|
|
60
|
-
"@serwist/google-analytics": "8.
|
|
61
|
-
"@serwist/precaching": "8.
|
|
62
|
-
"@serwist/routing": "8.
|
|
55
|
+
"@serwist/background-sync": "8.4.0",
|
|
56
|
+
"@serwist/broadcast-update": "8.4.0",
|
|
57
|
+
"@serwist/cacheable-response": "8.4.0",
|
|
58
|
+
"@serwist/core": "8.4.0",
|
|
59
|
+
"@serwist/expiration": "8.4.0",
|
|
60
|
+
"@serwist/google-analytics": "8.4.0",
|
|
61
|
+
"@serwist/precaching": "8.4.0",
|
|
62
|
+
"@serwist/routing": "8.4.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/common-tags": "1.8.4",
|
|
@@ -69,10 +69,11 @@
|
|
|
69
69
|
"@types/strip-comments": "2.0.4",
|
|
70
70
|
"pretty-bytes": "6.1.1",
|
|
71
71
|
"type-fest": "4.8.3",
|
|
72
|
-
"@serwist/constants": "8.
|
|
72
|
+
"@serwist/constants": "8.4.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"build": "rimraf dist && cross-env NODE_OPTIONS='--max-old-space-size=4096' NODE_ENV=production rollup --config rollup.config.js",
|
|
76
|
+
"dev": "rollup --config rollup.config.js --watch",
|
|
76
77
|
"lint": "eslint src --ext ts,tsx,js,jsx,cjs,mjs",
|
|
77
78
|
"typecheck": "tsc"
|
|
78
79
|
}
|