@node-cli/bundlesize 4.6.1 → 4.6.2
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/config.d.ts +14 -13
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/package.json +5 -6
package/dist/config.d.ts
CHANGED
|
@@ -4,21 +4,20 @@ import type { FooterProperties } from "./utilities.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface SizeEntry {
|
|
6
6
|
/**
|
|
7
|
-
* Path to the file to check. Supports glob patterns.
|
|
8
|
-
* Special placeholders:
|
|
7
|
+
* Path to the file to check. Supports glob patterns. Special placeholders:
|
|
9
8
|
* - `<hash>`: matches content hashes (e.g., `bundle-<hash>.js`)
|
|
10
9
|
* - `<semver>`: matches semantic versions (e.g., `lib-<semver>.js`)
|
|
11
10
|
*/
|
|
12
11
|
path: string;
|
|
13
12
|
/**
|
|
14
|
-
* Maximum allowed size for the file (gzipped).
|
|
15
|
-
*
|
|
13
|
+
* Maximum allowed size for the file (gzipped). Format: number followed by unit
|
|
14
|
+
* (B, kB, KB, MB, GB, TB, PB).
|
|
16
15
|
* @example "10 kB", "1.5 MB", "500 B"
|
|
17
16
|
*/
|
|
18
17
|
limit: string;
|
|
19
18
|
/**
|
|
20
|
-
* Optional alias for the file in reports.
|
|
21
|
-
*
|
|
19
|
+
* Optional alias for the file in reports. Useful for giving meaningful names
|
|
20
|
+
* to files with hash patterns.
|
|
22
21
|
*/
|
|
23
22
|
alias?: string;
|
|
24
23
|
}
|
|
@@ -46,7 +45,8 @@ export interface ReportConfiguration {
|
|
|
46
45
|
*/
|
|
47
46
|
current: string;
|
|
48
47
|
/**
|
|
49
|
-
* Path to the previous stats JSON file for comparison (relative to config
|
|
48
|
+
* Path to the previous stats JSON file for comparison (relative to config
|
|
49
|
+
* file).
|
|
50
50
|
*/
|
|
51
51
|
previous: string;
|
|
52
52
|
/**
|
|
@@ -55,8 +55,8 @@ export interface ReportConfiguration {
|
|
|
55
55
|
*/
|
|
56
56
|
header?: string;
|
|
57
57
|
/**
|
|
58
|
-
* Custom footer function for the report.
|
|
59
|
-
*
|
|
58
|
+
* Custom footer function for the report. Receives an object with limitReached,
|
|
59
|
+
* overallDiff, and totalGzipSize.
|
|
60
60
|
*/
|
|
61
61
|
footer?: (args: FooterProperties) => string;
|
|
62
62
|
/**
|
|
@@ -65,8 +65,8 @@ export interface ReportConfiguration {
|
|
|
65
65
|
*/
|
|
66
66
|
columns?: ColumnDefinition[];
|
|
67
67
|
/**
|
|
68
|
-
* Minimum gzip size change in bytes to consider as a change.
|
|
69
|
-
*
|
|
68
|
+
* Minimum gzip size change in bytes to consider as a change. Changes below
|
|
69
|
+
* this threshold are treated as no change.
|
|
70
70
|
* @default 0
|
|
71
71
|
*/
|
|
72
72
|
threshold?: number;
|
|
@@ -76,8 +76,8 @@ export interface ReportConfiguration {
|
|
|
76
76
|
*/
|
|
77
77
|
export interface BundlesizeConfig {
|
|
78
78
|
/**
|
|
79
|
-
* Array of file size entries to check.
|
|
80
|
-
*
|
|
79
|
+
* Array of file size entries to check. Each entry can be either a SizeEntry
|
|
80
|
+
* (file to check) or HeaderEntry (group separator).
|
|
81
81
|
*/
|
|
82
82
|
sizes?: (SizeEntry | HeaderEntry)[];
|
|
83
83
|
/**
|
|
@@ -99,5 +99,6 @@ export interface BundlesizeConfig {
|
|
|
99
99
|
* ]
|
|
100
100
|
* });
|
|
101
101
|
* ```
|
|
102
|
+
*
|
|
102
103
|
*/
|
|
103
104
|
export declare function defineConfig(config: BundlesizeConfig): BundlesizeConfig;
|
package/dist/config.js
CHANGED
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["import type { FooterProperties } from \"./utilities.js\";\n\n/**\n * Configuration for a single file size entry.\n */\nexport interface SizeEntry {\n\t/**\n\t * Path to the file to check. Supports glob patterns
|
|
1
|
+
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["import type { FooterProperties } from \"./utilities.js\";\n\n/**\n * Configuration for a single file size entry.\n */\nexport interface SizeEntry {\n\t/**\n\t * Path to the file to check. Supports glob patterns. Special placeholders:\n\t * - `<hash>`: matches content hashes (e.g., `bundle-<hash>.js`)\n\t * - `<semver>`: matches semantic versions (e.g., `lib-<semver>.js`)\n\t */\n\tpath: string;\n\t/**\n\t * Maximum allowed size for the file (gzipped). Format: number followed by unit\n\t * (B, kB, KB, MB, GB, TB, PB).\n\t * @example \"10 kB\", \"1.5 MB\", \"500 B\"\n\t */\n\tlimit: string;\n\t/**\n\t * Optional alias for the file in reports. Useful for giving meaningful names\n\t * to files with hash patterns.\n\t */\n\talias?: string;\n}\n\n/**\n * Configuration for a header entry (group separator in reports).\n */\nexport interface HeaderEntry {\n\t/**\n\t * Header text to display as a group separator in reports.\n\t */\n\theader: string;\n}\n\n/**\n * Column definition for the report table.\n */\nexport interface ColumnDefinition {\n\t[key: string]: string;\n}\n\n/**\n * Configuration for generating comparison reports.\n */\nexport interface ReportConfiguration {\n\t/**\n\t * Path to the current stats JSON file (relative to config file).\n\t */\n\tcurrent: string;\n\t/**\n\t * Path to the previous stats JSON file for comparison (relative to config\n\t * file).\n\t */\n\tprevious: string;\n\t/**\n\t * Custom header text for the report.\n\t * @default \"## Bundle Size\"\n\t */\n\theader?: string;\n\t/**\n\t * Custom footer function for the report. Receives an object with limitReached,\n\t * overallDiff, and totalGzipSize.\n\t */\n\tfooter?: (args: FooterProperties) => string;\n\t/**\n\t * Column definitions for the report table.\n\t * @default [{ status: \"Status\" }, { file: \"File\" }, { size: \"Size (Gzip)\" }, { limits: \"Limits\" }]\n\t */\n\tcolumns?: ColumnDefinition[];\n\t/**\n\t * Minimum gzip size change in bytes to consider as a change. Changes below\n\t * this threshold are treated as no change.\n\t * @default 0\n\t */\n\tthreshold?: number;\n}\n\n/**\n * Bundlesize configuration object.\n */\nexport interface BundlesizeConfig {\n\t/**\n\t * Array of file size entries to check. Each entry can be either a SizeEntry\n\t * (file to check) or HeaderEntry (group separator).\n\t */\n\tsizes?: (SizeEntry | HeaderEntry)[];\n\t/**\n\t * Configuration for generating comparison reports.\n\t */\n\treport?: ReportConfiguration;\n}\n\n/**\n * Helper function to define bundlesize configuration with full type support.\n * Provides IntelliSense and type checking for configuration files.\n *\n * @example\n * ```js\n * import { defineConfig } from \"@node-cli/bundlesize\";\n *\n * export default defineConfig({\n * sizes: [\n * { path: \"dist/bundle.js\", limit: \"10 kB\" }\n * ]\n * });\n * ```\n *\n */\n/* v8 ignore start */\nexport function defineConfig(config: BundlesizeConfig): BundlesizeConfig {\n\treturn config;\n}\n/* v8 ignore stop */\n"],"names":["defineConfig","config"],"mappings":"AA6FA;;;;;;;;;;;;;;;CAeC,GACD,mBAAmB,GACnB,OAAO,SAASA,aAAaC,MAAwB;IACpD,OAAOA;AACR,EACA,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-cli/bundlesize",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"description": "Simple CLI tool that checks file(s) size and report if limits have been reached",
|
|
@@ -35,20 +35,19 @@
|
|
|
35
35
|
"watch": "swc --strip-leading-paths --watch --out-dir dist src"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@node-cli/logger": "1.3.
|
|
38
|
+
"@node-cli/logger": "1.3.5",
|
|
39
39
|
"@node-cli/parser": "2.4.5",
|
|
40
40
|
"bytes": "3.1.2",
|
|
41
41
|
"fs-extra": "11.3.3",
|
|
42
|
-
"glob": "13.0.
|
|
43
|
-
"semver": "7.7.
|
|
42
|
+
"glob": "13.0.5",
|
|
43
|
+
"semver": "7.7.4"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@node-cli/comments": "0.2.9",
|
|
50
49
|
"@vitest/coverage-v8": "4.0.18",
|
|
51
50
|
"vitest": "4.0.18"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f4ced1b7a42dead360543afef548cb18f358f588"
|
|
54
53
|
}
|