@serwist/build 8.1.1 → 8.3.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/dist/{index.old.cjs → index.cjs} +27 -4
- package/dist/{index.old.d.cts → index.d.cts} +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +27 -5
- package/dist/lib/get-file-manifest-entries.d.ts +1 -1
- package/dist/lib/transform-manifest.d.ts +2 -2
- package/dist/schema/index.d.ts +5 -0
- package/dist/types.d.ts +6 -6
- package/package.json +14 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var assert = require('assert');
|
|
4
3
|
var commonTags = require('common-tags');
|
|
4
|
+
var assert = require('assert');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
var glob = require('glob');
|
|
7
7
|
var upath = require('upath');
|
|
@@ -425,7 +425,15 @@ function noRevisionForURLsMatchingTransform(regexp) {
|
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam }) {
|
|
428
|
+
async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest }) {
|
|
429
|
+
if (disablePrecacheManifest) {
|
|
430
|
+
return {
|
|
431
|
+
count: 0,
|
|
432
|
+
size: 0,
|
|
433
|
+
manifestEntries: undefined,
|
|
434
|
+
warnings: []
|
|
435
|
+
};
|
|
436
|
+
}
|
|
429
437
|
const allWarnings = [];
|
|
430
438
|
// Take the array of fileDetail objects and convert it into an array of
|
|
431
439
|
// {url, revision, size} objects, with \ replaced with /.
|
|
@@ -479,7 +487,15 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
479
487
|
};
|
|
480
488
|
}
|
|
481
489
|
|
|
482
|
-
async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs }) {
|
|
490
|
+
async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest }) {
|
|
491
|
+
if (disablePrecacheManifest) {
|
|
492
|
+
return {
|
|
493
|
+
count: 0,
|
|
494
|
+
size: 0,
|
|
495
|
+
manifestEntries: undefined,
|
|
496
|
+
warnings: []
|
|
497
|
+
};
|
|
498
|
+
}
|
|
483
499
|
const warnings = [];
|
|
484
500
|
const allFileDetails = new Map();
|
|
485
501
|
try {
|
|
@@ -546,7 +562,8 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
546
562
|
manifestTransforms,
|
|
547
563
|
maximumFileSizeToCacheInBytes,
|
|
548
564
|
modifyURLPrefix,
|
|
549
|
-
fileDetails: Array.from(allFileDetails.values())
|
|
565
|
+
fileDetails: Array.from(allFileDetails.values()),
|
|
566
|
+
disablePrecacheManifest
|
|
550
567
|
});
|
|
551
568
|
transformedManifest.warnings.push(...warnings);
|
|
552
569
|
return transformedManifest;
|
|
@@ -824,6 +841,11 @@ var properties$1 = {
|
|
|
824
841
|
globDirectory: {
|
|
825
842
|
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
826
843
|
type: "string"
|
|
844
|
+
},
|
|
845
|
+
disablePrecacheManifest: {
|
|
846
|
+
description: "Whether the precache manifest should be set to `undefined`.",
|
|
847
|
+
"default": false,
|
|
848
|
+
type: "boolean"
|
|
827
849
|
}
|
|
828
850
|
};
|
|
829
851
|
var required$1 = [
|
|
@@ -1397,6 +1419,7 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1397
1419
|
};
|
|
1398
1420
|
}
|
|
1399
1421
|
|
|
1422
|
+
exports.errors = errors;
|
|
1400
1423
|
exports.escapeRegExp = escapeRegExp;
|
|
1401
1424
|
exports.getManifest = getManifest;
|
|
1402
1425
|
exports.getSourceMapURL = getSourceMapURL;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { errors } from "./lib/errors.js";
|
|
1
2
|
import { getManifest } from "./get-manifest.js";
|
|
2
3
|
import { injectManifest } from "./inject-manifest.js";
|
|
3
4
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
@@ -5,5 +6,5 @@ import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
|
5
6
|
import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.js";
|
|
6
7
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
7
8
|
import { validateWebpackInjectManifestOptions } from "./lib/validate-options.js";
|
|
8
|
-
export { escapeRegExp, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions, };
|
|
9
|
+
export { escapeRegExp, errors, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions, };
|
|
9
10
|
export * from "./types.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { errors } from "./lib/errors.js";
|
|
1
2
|
import { getManifest } from "./get-manifest.js";
|
|
2
3
|
import { injectManifest } from "./inject-manifest.js";
|
|
3
4
|
import { escapeRegExp } from "./lib/escape-regexp.js";
|
|
@@ -5,5 +6,5 @@ import { getSourceMapURL } from "./lib/get-source-map-url.js";
|
|
|
5
6
|
import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.js";
|
|
6
7
|
import { transformManifest } from "./lib/transform-manifest.js";
|
|
7
8
|
import { validateWebpackInjectManifestOptions } from "./lib/validate-options.js";
|
|
8
|
-
export { escapeRegExp, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions, };
|
|
9
|
+
export { escapeRegExp, errors, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions, };
|
|
9
10
|
export * from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import assert from 'assert';
|
|
2
1
|
import { oneLine } from 'common-tags';
|
|
2
|
+
import assert from 'assert';
|
|
3
3
|
import crypto from 'crypto';
|
|
4
4
|
import { glob } from 'glob';
|
|
5
5
|
import upath from 'upath';
|
|
@@ -423,7 +423,15 @@ function noRevisionForURLsMatchingTransform(regexp) {
|
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam }) {
|
|
426
|
+
async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest }) {
|
|
427
|
+
if (disablePrecacheManifest) {
|
|
428
|
+
return {
|
|
429
|
+
count: 0,
|
|
430
|
+
size: 0,
|
|
431
|
+
manifestEntries: undefined,
|
|
432
|
+
warnings: []
|
|
433
|
+
};
|
|
434
|
+
}
|
|
427
435
|
const allWarnings = [];
|
|
428
436
|
// Take the array of fileDetail objects and convert it into an array of
|
|
429
437
|
// {url, revision, size} objects, with \ replaced with /.
|
|
@@ -477,7 +485,15 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
|
|
|
477
485
|
};
|
|
478
486
|
}
|
|
479
487
|
|
|
480
|
-
async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs }) {
|
|
488
|
+
async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest }) {
|
|
489
|
+
if (disablePrecacheManifest) {
|
|
490
|
+
return {
|
|
491
|
+
count: 0,
|
|
492
|
+
size: 0,
|
|
493
|
+
manifestEntries: undefined,
|
|
494
|
+
warnings: []
|
|
495
|
+
};
|
|
496
|
+
}
|
|
481
497
|
const warnings = [];
|
|
482
498
|
const allFileDetails = new Map();
|
|
483
499
|
try {
|
|
@@ -544,7 +560,8 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
|
|
|
544
560
|
manifestTransforms,
|
|
545
561
|
maximumFileSizeToCacheInBytes,
|
|
546
562
|
modifyURLPrefix,
|
|
547
|
-
fileDetails: Array.from(allFileDetails.values())
|
|
563
|
+
fileDetails: Array.from(allFileDetails.values()),
|
|
564
|
+
disablePrecacheManifest
|
|
548
565
|
});
|
|
549
566
|
transformedManifest.warnings.push(...warnings);
|
|
550
567
|
return transformedManifest;
|
|
@@ -822,6 +839,11 @@ var properties$1 = {
|
|
|
822
839
|
globDirectory: {
|
|
823
840
|
description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
|
|
824
841
|
type: "string"
|
|
842
|
+
},
|
|
843
|
+
disablePrecacheManifest: {
|
|
844
|
+
description: "Whether the precache manifest should be set to `undefined`.",
|
|
845
|
+
"default": false,
|
|
846
|
+
type: "boolean"
|
|
825
847
|
}
|
|
826
848
|
};
|
|
827
849
|
var required$1 = [
|
|
@@ -1395,4 +1417,4 @@ function translateURLToSourcemapPaths(url, swSrc, swDest) {
|
|
|
1395
1417
|
};
|
|
1396
1418
|
}
|
|
1397
1419
|
|
|
1398
|
-
export { escapeRegExp, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions };
|
|
1420
|
+
export { errors, escapeRegExp, getManifest, getSourceMapURL, injectManifest, replaceAndUpdateSourceMap, transformManifest, validateWebpackInjectManifestOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { GetManifestOptions, GetManifestResult } from "../types.js";
|
|
2
|
-
export declare function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, }: GetManifestOptions): Promise<GetManifestResult>;
|
|
2
|
+
export declare function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest, }: GetManifestOptions): Promise<GetManifestResult>;
|
|
@@ -50,10 +50,10 @@ import type { BasePartial, FileDetails, ManifestEntry } from "../types.js";
|
|
|
50
50
|
interface ManifestTransformResultWithWarnings {
|
|
51
51
|
count: number;
|
|
52
52
|
size: number;
|
|
53
|
-
manifestEntries: ManifestEntry[];
|
|
53
|
+
manifestEntries: ManifestEntry[] | undefined;
|
|
54
54
|
warnings: string[];
|
|
55
55
|
}
|
|
56
|
-
export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, }: BasePartial & {
|
|
56
|
+
export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest, }: BasePartial & {
|
|
57
57
|
fileDetails: Array<FileDetails>;
|
|
58
58
|
transformParam?: unknown;
|
|
59
59
|
}): Promise<ManifestTransformResultWithWarnings>;
|
package/dist/schema/index.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -130,6 +130,11 @@ export interface BasePartial {
|
|
|
130
130
|
* generated as part of the build configuration.
|
|
131
131
|
*/
|
|
132
132
|
additionalPrecacheEntries?: Array<string | ManifestEntry>;
|
|
133
|
+
/**
|
|
134
|
+
* Whether the precache manifest should be set to `undefined`.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
disablePrecacheManifest?: boolean;
|
|
133
138
|
/**
|
|
134
139
|
* Assets that match this will be assumed to be uniquely versioned via their
|
|
135
140
|
* URL, and exempted from the normal HTTP cache-busting that's done when
|
|
@@ -307,18 +312,13 @@ export interface WebpackInjectManifestPartial {
|
|
|
307
312
|
* input file. Only valid if `compileSrc` is `true`.
|
|
308
313
|
*/
|
|
309
314
|
webpackCompilationPlugins?: Array<any>;
|
|
310
|
-
/**
|
|
311
|
-
* Whether the precache manifest should be set to `undefined`.
|
|
312
|
-
* @default false
|
|
313
|
-
*/
|
|
314
|
-
disablePrecacheManifest?: boolean;
|
|
315
315
|
}
|
|
316
316
|
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
|
|
317
317
|
export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSWDestPartial & RequiredGlobDirectoryPartial;
|
|
318
318
|
export type WebpackInjectManifestOptions = BasePartial & WebpackPartial & InjectPartial & WebpackInjectManifestPartial;
|
|
319
319
|
export interface GetManifestResult {
|
|
320
320
|
count: number;
|
|
321
|
-
manifestEntries: Array<ManifestEntry
|
|
321
|
+
manifestEntries: Array<ManifestEntry> | undefined;
|
|
322
322
|
size: number;
|
|
323
323
|
warnings: Array<string>;
|
|
324
324
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.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,9 +23,9 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"repository": "serwist/serwist",
|
|
25
25
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
26
|
-
"homepage": "https://
|
|
26
|
+
"homepage": "https://serwist.vercel.app",
|
|
27
27
|
"module": "./dist/index.js",
|
|
28
|
-
"main": "./dist/index.
|
|
28
|
+
"main": "./dist/index.cjs",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"default": "./dist/index.js"
|
|
35
35
|
},
|
|
36
36
|
"require": {
|
|
37
|
-
"types": "./dist/index.
|
|
38
|
-
"default": "./dist/index.
|
|
37
|
+
"types": "./dist/index.d.cts",
|
|
38
|
+
"default": "./dist/index.cjs"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"./package.json": "./package.json"
|
|
@@ -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.3.0",
|
|
56
|
+
"@serwist/broadcast-update": "8.3.0",
|
|
57
|
+
"@serwist/cacheable-response": "8.3.0",
|
|
58
|
+
"@serwist/core": "8.3.0",
|
|
59
|
+
"@serwist/expiration": "8.3.0",
|
|
60
|
+
"@serwist/google-analytics": "8.3.0",
|
|
61
|
+
"@serwist/precaching": "8.3.0",
|
|
62
|
+
"@serwist/routing": "8.3.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/common-tags": "1.8.4",
|
|
@@ -69,7 +69,7 @@
|
|
|
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.3.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",
|