@serwist/build 10.0.0-preview.5 → 10.0.0-preview.7

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.
@@ -51,4 +51,8 @@ const validationErrorMap = (error, ctx)=>{
51
51
  };
52
52
  };
53
53
 
54
- export { SerwistConfigError as S, validationErrorMap as v };
54
+ const DEFAULT_GLOB_PATTERNS = [
55
+ "**/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"
56
+ ];
57
+
58
+ export { DEFAULT_GLOB_PATTERNS as D, SerwistConfigError as S, validationErrorMap as v };
@@ -1,5 +1,6 @@
1
1
  import { b as basePartial, g as globPartial, r as requiredGlobDirectoryPartial } from './glob.js';
2
2
  import 'zod';
3
+ import './constants.js';
3
4
 
4
5
  const getManifestOptions = basePartial.merge(globPartial).merge(requiredGlobDirectoryPartial).strict("Do not pass invalid properties to GetManifestOptions!");
5
6
 
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { D as DEFAULT_GLOB_PATTERNS } from './constants.js';
2
3
 
3
4
  const manifestEntry = z.object({
4
5
  integrity: z.string().optional(),
@@ -39,9 +40,7 @@ const globPartial = z.object({
39
40
  globIgnores: z.array(z.string()).default([
40
41
  "**/node_modules/**/*"
41
42
  ]),
42
- globPatterns: z.array(z.string()).default([
43
- "**/*.{js,css,html}"
44
- ]),
43
+ globPatterns: z.array(z.string()).default(DEFAULT_GLOB_PATTERNS),
45
44
  globStrict: z.boolean().default(true),
46
45
  templatedURLs: z.record(z.string(), z.union([
47
46
  z.string(),
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { errors } from "@serwist/utils/node";
2
2
  import { getManifest } from "./get-manifest.js";
3
3
  import { injectManifest } from "./inject-manifest.js";
4
+ import { DEFAULT_GLOB_PATTERNS } from "./lib/constants.js";
4
5
  import { escapeRegExp } from "./lib/escape-regexp.js";
5
6
  import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
6
7
  import { getSourceMapURL } from "./lib/get-source-map-url.js";
@@ -9,15 +10,6 @@ import { replaceAndUpdateSourceMap } from "./lib/replace-and-update-source-map.j
9
10
  import { transformManifest } from "./lib/transform-manifest.js";
10
11
  import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
11
12
  import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
12
- /**
13
- * Use `JSON.stringify` instead.
14
- *
15
- * @deprecated
16
- */
17
- declare const stringify: {
18
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
19
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
20
- };
21
- export { errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions, };
13
+ export { errors, DEFAULT_GLOB_PATTERNS, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions, };
22
14
  export type * from "./types.js";
23
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,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EACrB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,EAC1B,6BAA6B,GAC9B,CAAC;AAEF,mBAAmB,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,8 @@ import assert from 'node:assert';
4
4
  import path from 'node:path';
5
5
  import { globSync } from 'glob';
6
6
  import prettyBytes from 'pretty-bytes';
7
- import { v as validationErrorMap, S as SerwistConfigError } from './chunks/validationErrorMap.js';
7
+ import { v as validationErrorMap, S as SerwistConfigError } from './chunks/constants.js';
8
+ export { D as DEFAULT_GLOB_PATTERNS } from './chunks/constants.js';
8
9
  import fsp from 'node:fs/promises';
9
10
  import { toUnix } from '@serwist/utils';
10
11
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
@@ -487,6 +488,4 @@ const injectManifest = async (config)=>{
487
488
  };
488
489
  };
489
490
 
490
- const stringify = JSON.stringify;
491
-
492
- export { escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
491
+ export { escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
@@ -1,7 +1,7 @@
1
1
  export { b as basePartial, g as globPartial, m as manifestEntry, a as manifestTransform, c as manifestTransformResult, o as optionalGlobDirectoryPartial, r as requiredGlobDirectoryPartial } from './chunks/glob.js';
2
2
  export { getManifestOptions } from './chunks/getManifest.js';
3
3
  export { i as injectManifestOptions, b as injectPartial, o as optionalSwDestPartial, r as requiredSwDestPartial } from './chunks/injectManifest.js';
4
- export { S as SerwistConfigError, v as validationErrorMap } from './chunks/validationErrorMap.js';
4
+ export { S as SerwistConfigError, v as validationErrorMap } from './chunks/constants.js';
5
5
  import 'zod';
6
6
 
7
7
  function assertType() {}
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_GLOB_PATTERNS: string[];
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAiG,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;AAWxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAQmC,CAAC;AAE5D,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC;AAI7E,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC"}
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/schema/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAQmC,CAAC;AAE5D,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC;AAI7E,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -104,7 +104,7 @@ export interface GlobPartial {
104
104
  * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
105
105
  * @default
106
106
  * ```
107
- * ["**\/*.{js,css,html}"]
107
+ * ["**\/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"]
108
108
  * ```
109
109
  */
110
110
  globPatterns?: string[];
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@serwist/build",
3
- "version": "10.0.0-preview.5",
3
+ "version": "10.0.0-preview.7",
4
4
  "type": "module",
5
+ "sideEffects": false,
5
6
  "description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
6
7
  "files": [
7
8
  "src",
@@ -52,14 +53,14 @@
52
53
  "pretty-bytes": "6.1.1",
53
54
  "source-map": "0.8.0-beta.0",
54
55
  "zod": "3.24.3",
55
- "@serwist/utils": "10.0.0-preview.5"
56
+ "@serwist/utils": "10.0.0-preview.7"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/node": "22.14.1",
59
60
  "rollup": "4.40.0",
60
61
  "type-fest": "4.40.0",
61
62
  "typescript": "5.8.3",
62
- "@serwist/configs": "10.0.0-preview.5"
63
+ "@serwist/configs": "10.0.0-preview.7"
63
64
  },
64
65
  "peerDependencies": {
65
66
  "typescript": ">=5.0.0"
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import { errors } from "@serwist/utils/node";
9
9
 
10
10
  import { getManifest } from "./get-manifest.js";
11
11
  import { injectManifest } from "./inject-manifest.js";
12
+ import { DEFAULT_GLOB_PATTERNS } from "./lib/constants.js";
12
13
  import { escapeRegExp } from "./lib/escape-regexp.js";
13
14
  import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
14
15
  import { getSourceMapURL } from "./lib/get-source-map-url.js";
@@ -18,16 +19,9 @@ import { transformManifest } from "./lib/transform-manifest.js";
18
19
  import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
19
20
  import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
20
21
 
21
- // TODO: remove in v10.
22
- /**
23
- * Use `JSON.stringify` instead.
24
- *
25
- * @deprecated
26
- */
27
- const stringify = JSON.stringify;
28
-
29
22
  export {
30
23
  errors,
24
+ DEFAULT_GLOB_PATTERNS,
31
25
  escapeRegExp,
32
26
  getFileManifestEntries,
33
27
  getManifest,
@@ -35,7 +29,6 @@ export {
35
29
  injectManifest,
36
30
  rebasePath,
37
31
  replaceAndUpdateSourceMap,
38
- stringify,
39
32
  transformManifest,
40
33
  translateURLToSourcemapPaths,
41
34
  validateGetManifestOptions,
@@ -0,0 +1 @@
1
+ export const DEFAULT_GLOB_PATTERNS = ["**/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"];
@@ -8,12 +8,13 @@ import type {
8
8
  RequiredGlobDirectoryResolved,
9
9
  } from "../types.js";
10
10
  import { type Equals, assertType } from "./assertType.js";
11
+ import { DEFAULT_GLOB_PATTERNS } from "../lib/constants.js";
11
12
 
12
13
  export const globPartial = z
13
14
  .object({
14
15
  globFollow: z.boolean().default(true),
15
16
  globIgnores: z.array(z.string()).default(["**/node_modules/**/*"]),
16
- globPatterns: z.array(z.string()).default(["**/*.{js,css,html}"]),
17
+ globPatterns: z.array(z.string()).default(DEFAULT_GLOB_PATTERNS),
17
18
  globStrict: z.boolean().default(true),
18
19
  templatedURLs: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),
19
20
  })
package/src/types.ts CHANGED
@@ -116,7 +116,7 @@ export interface GlobPartial {
116
116
  * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
117
117
  * @default
118
118
  * ```
119
- * ["**\/*.{js,css,html}"]
119
+ * ["**\/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"]
120
120
  * ```
121
121
  */
122
122
  globPatterns?: string[];