@serwist/build 8.1.0 → 8.2.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.
@@ -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,7 @@ 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 }) {
483
491
  const warnings = [];
484
492
  const allFileDetails = new Map();
485
493
  try {
@@ -546,7 +554,8 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
546
554
  manifestTransforms,
547
555
  maximumFileSizeToCacheInBytes,
548
556
  modifyURLPrefix,
549
- fileDetails: Array.from(allFileDetails.values())
557
+ fileDetails: Array.from(allFileDetails.values()),
558
+ disablePrecacheManifest
550
559
  });
551
560
  transformedManifest.warnings.push(...warnings);
552
561
  return transformedManifest;
@@ -824,6 +833,11 @@ var properties$1 = {
824
833
  globDirectory: {
825
834
  description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
826
835
  type: "string"
836
+ },
837
+ disablePrecacheManifest: {
838
+ description: "Whether the precache manifest should be set to `undefined`.",
839
+ "default": false,
840
+ type: "boolean"
827
841
  }
828
842
  };
829
843
  var required$1 = [
package/dist/index.js CHANGED
@@ -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,7 @@ 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 }) {
481
489
  const warnings = [];
482
490
  const allFileDetails = new Map();
483
491
  try {
@@ -544,7 +552,8 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
544
552
  manifestTransforms,
545
553
  maximumFileSizeToCacheInBytes,
546
554
  modifyURLPrefix,
547
- fileDetails: Array.from(allFileDetails.values())
555
+ fileDetails: Array.from(allFileDetails.values()),
556
+ disablePrecacheManifest
548
557
  });
549
558
  transformedManifest.warnings.push(...warnings);
550
559
  return transformedManifest;
@@ -822,6 +831,11 @@ var properties$1 = {
822
831
  globDirectory: {
823
832
  description: "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
824
833
  type: "string"
834
+ },
835
+ disablePrecacheManifest: {
836
+ description: "Whether the precache manifest should be set to `undefined`.",
837
+ "default": false,
838
+ type: "boolean"
825
839
  }
826
840
  };
827
841
  var required$1 = [
@@ -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>;
@@ -234,6 +234,11 @@ export declare const optionsSchemas: {
234
234
  description: string;
235
235
  type: string;
236
236
  };
237
+ disablePrecacheManifest: {
238
+ description: string;
239
+ default: boolean;
240
+ type: string;
241
+ };
237
242
  };
238
243
  required: string[];
239
244
  definitions: {
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.1.0",
3
+ "version": "8.2.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://ducanh-next-pwa.vercel.app",
26
+ "homepage": "https://serwist.vercel.app",
27
27
  "module": "./dist/index.js",
28
- "main": "./dist/index.old.cjs",
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.old.d.cts",
38
- "default": "./dist/index.old.cjs"
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.1.0",
56
- "@serwist/broadcast-update": "8.1.0",
57
- "@serwist/cacheable-response": "8.1.0",
58
- "@serwist/core": "8.1.0",
59
- "@serwist/expiration": "8.1.0",
60
- "@serwist/google-analytics": "8.1.0",
61
- "@serwist/precaching": "8.1.0",
62
- "@serwist/routing": "8.1.0"
55
+ "@serwist/background-sync": "8.2.0",
56
+ "@serwist/broadcast-update": "8.2.0",
57
+ "@serwist/cacheable-response": "8.2.0",
58
+ "@serwist/core": "8.2.0",
59
+ "@serwist/expiration": "8.2.0",
60
+ "@serwist/google-analytics": "8.2.0",
61
+ "@serwist/precaching": "8.2.0",
62
+ "@serwist/routing": "8.2.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.1.0"
72
+ "@serwist/constants": "8.2.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",
File without changes