@node-cli/bundlesize 3.0.1 → 3.1.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 CHANGED
@@ -94,6 +94,18 @@ The special keyword `<hash>` can be used to match a hash in the filename. It can
94
94
  | Not OK | `dist/**/some-bundle-<hash>.js` | If multiple files match the pattern |
95
95
  | Not OK | `dist/**/some-bundle-<hash>.*` | Cannot use `<hash>` with `*` |
96
96
 
97
+ #### With a version
98
+
99
+ The special keyword `<semver>` can be used to match a version in the filename. It cannot be used in conjunction with the single star (\*) glob pattern, and it cannot be used if multiple files match the pattern.
100
+
101
+ **NOTE**: Using `<semver>` is equivalent to using `*` in the glob pattern. However, the result will be indexed with the `semver` key instead of the `match` key, so that subsequent scripts can use the semver value.
102
+
103
+ | Status | Pattern | Comment |
104
+ | ------ | --------------------------------- | ------------------------------------ |
105
+ | OK | `dist/**/some-bundle-<semver>.js` | If only one file matches the pattern |
106
+ | Not OK | `dist/**/some-bundle-<semver>.js` | If multiple files match the pattern |
107
+ | Not OK | `dist/**/some-bundle-<semver>.*` | Cannot use `<semver>` with `*` |
108
+
97
109
  ### Printing reports from stats
98
110
 
99
111
  #### Simple report
@@ -1,4 +1,4 @@
1
- import { IGNORE, STDOUT, getOutputFile, gzipSizeFromFileSync, validateConfigurationFile } from "./utilities.js";
1
+ import { GLOB_HASH, GLOB_SEMVER, HASH_KEY, IGNORE, SEMVER_KEY, STDOUT, getOutputFile, gzipSizeFromFileSync, validateConfigurationFile } from "./utilities.js";
2
2
  import { basename, dirname, join } from "node:path";
3
3
  import bytes from "bytes";
4
4
  import fs from "fs-extra";
@@ -34,19 +34,31 @@ export const getRawStats = async ({ flags })=>{
34
34
  for (const artifact of configuration.sizes){
35
35
  const rootPath = artifact.path.startsWith("/") ? "" : dirname(configurationFile);
36
36
  const artifactPath = dirname(artifact.path);
37
- const globReplace = "+([a-zA-Z0-9_-])";
38
- const hasHash = artifact.path.includes("<hash>");
37
+ const hasHash = artifact.path.includes(HASH_KEY);
38
+ const hasSemver = artifact.path.includes(SEMVER_KEY);
39
+ if (hasSemver && hasHash) {
40
+ result.exitCode = 1;
41
+ result.exitMessage = `Invalid path: ${artifact.path}.\nCannot use ${HASH_KEY} and ${SEMVER_KEY} in the same path.`;
42
+ return result;
43
+ }
39
44
  /**
40
- * if the artifact.path has the string <hash> in it,
45
+ * if the artifact.path has the string <hash> or <semver> in it,
41
46
  * then we need to check for other characters:
42
47
  * - Double stars ** are allowed.
43
48
  * - Single stars * are not allowed.
44
- */ if (hasHash && /(?<!\*)\*(?!\*)/.test(artifact.path)) {
49
+ */ if ((hasHash || hasSemver) && /(?<!\*)\*(?!\*)/.test(artifact.path)) {
45
50
  result.exitCode = 1;
46
- result.exitMessage = `Invalid path: ${artifact.path}.\nSingle stars (*) are not allowed when using the special keyword <hash>`;
51
+ result.exitMessage = `Invalid path: ${artifact.path}.\nSingle stars (*) are not allowed when using the special keyword ${hasHash ? HASH_KEY : SEMVER_KEY}`;
47
52
  return result;
48
53
  }
49
- const fileGlob = join(rootPath, artifact.path.replace("<hash>", globReplace));
54
+ let location = artifact.path;
55
+ if (hasHash) {
56
+ location = artifact.path.replace(HASH_KEY, GLOB_HASH);
57
+ }
58
+ if (hasSemver) {
59
+ location = artifact.path.replace(SEMVER_KEY, GLOB_SEMVER);
60
+ }
61
+ const fileGlob = join(rootPath, location);
50
62
  const files = glob.sync(fileGlob);
51
63
  if (files.length === 0) {
52
64
  result.exitCode = 1;
@@ -55,7 +67,7 @@ export const getRawStats = async ({ flags })=>{
55
67
  }
56
68
  if (files.length > 1 && hasHash) {
57
69
  result.exitCode = 1;
58
- result.exitMessage = `Multiple files found for: ${artifact.path}.\nPlease use a more specific path when using the special keyword <hash>.`;
70
+ result.exitMessage = `Multiple files found for: ${artifact.path}.\nPlease use a more specific path when using the special keyword ${HASH_KEY}.`;
59
71
  return result;
60
72
  }
61
73
  for (const file of files){
@@ -66,7 +78,7 @@ export const getRawStats = async ({ flags })=>{
66
78
  result.pass = false;
67
79
  failed = true;
68
80
  }
69
- let index = hasHash ? artifact.path : join(artifactPath, basename(file));
81
+ let index = hasHash || hasSemver ? artifact.path : join(artifactPath, basename(file));
70
82
  currentResults[index] = {
71
83
  fileSize,
72
84
  fileSizeGzip,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getRawStats.ts"],"sourcesContent":["import {\n\tIGNORE,\n\tSTDOUT,\n\tgetOutputFile,\n\tgzipSizeFromFileSync,\n\tvalidateConfigurationFile,\n} from \"./utilities.js\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport bytes from \"bytes\";\nimport fs from \"fs-extra\";\nimport { glob } from \"glob\";\nimport { statSync } from \"node:fs\";\n\ntype SizesConfiguration = {\n\tlimit: string;\n\tpath: string;\n};\n\ntype ReportStats = {\n\tdata: Record<string, unknown>;\n\texitCode: number;\n\texitMessage: string;\n\toutputFile: string;\n\tpass: boolean;\n\tprefix: string;\n};\n\nexport const getRawStats = async ({ flags }): Promise<ReportStats> => {\n\tconst result: ReportStats = {\n\t\tpass: true,\n\t\texitCode: 0,\n\t\texitMessage: \"\",\n\t\toutputFile: \"\",\n\t\tprefix: \"\",\n\t\tdata: {},\n\t};\n\tlet failed = false;\n\tconst isValidConfigResult = validateConfigurationFile(flags.configuration);\n\tif (isValidConfigResult.exitMessage !== \"\") {\n\t\treturn {\n\t\t\t...result,\n\t\t\t...isValidConfigResult,\n\t\t};\n\t}\n\tconst configurationFile = isValidConfigResult.data;\n\tconst outputFile = getOutputFile(flags.output);\n\tconst prefix = flags.prefix || \"0.0.0\";\n\tconst currentResults = {};\n\n\tconst configuration: { sizes: SizesConfiguration[] } = await import(\n\t\tconfigurationFile\n\t).then((m) => m.default);\n\n\tif (configuration.sizes === undefined) {\n\t\tresult.exitMessage = \"Invalid configuration file: missing sizes object!\";\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\tfor (const artifact of configuration.sizes) {\n\t\tconst rootPath = artifact.path.startsWith(\"/\")\n\t\t\t? \"\"\n\t\t\t: dirname(configurationFile);\n\t\tconst artifactPath = dirname(artifact.path);\n\t\tconst globReplace = \"+([a-zA-Z0-9_-])\";\n\t\tconst hasHash = artifact.path.includes(\"<hash>\");\n\n\t\t/**\n\t\t * if the artifact.path has the string <hash> in it,\n\t\t * then we need to check for other characters:\n\t\t * - Double stars ** are allowed.\n\t\t * - Single stars * are not allowed.\n\t\t */\n\t\tif (hasHash && /(?<!\\*)\\*(?!\\*)/.test(artifact.path)) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `Invalid path: ${artifact.path}.\\nSingle stars (*) are not allowed when using the special keyword <hash>`;\n\t\t\treturn result;\n\t\t}\n\n\t\tconst fileGlob = join(\n\t\t\trootPath,\n\t\t\tartifact.path.replace(\"<hash>\", globReplace),\n\t\t);\n\t\tconst files = glob.sync(fileGlob);\n\n\t\tif (files.length === 0) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `File not found: ${fileGlob}`;\n\t\t\treturn result;\n\t\t}\n\n\t\tif (files.length > 1 && hasHash) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `Multiple files found for: ${artifact.path}.\\nPlease use a more specific path when using the special keyword <hash>.`;\n\t\t\treturn result;\n\t\t}\n\n\t\tfor (const file of files) {\n\t\t\tconst fileSize = statSync(file).size;\n\t\t\tconst fileSizeGzip = gzipSizeFromFileSync(file);\n\t\t\tconst passed = fileSizeGzip < bytes(artifact.limit);\n\n\t\t\tif (passed === false) {\n\t\t\t\tresult.pass = false;\n\t\t\t\tfailed = true;\n\t\t\t}\n\t\t\tlet index = hasHash ? artifact.path : join(artifactPath, basename(file));\n\n\t\t\tcurrentResults[index] = {\n\t\t\t\tfileSize,\n\t\t\t\tfileSizeGzip,\n\t\t\t\tlimit: artifact.limit,\n\t\t\t\tpassed,\n\t\t\t};\n\t\t}\n\t}\n\n\tlet existingResults = {};\n\tif (outputFile !== STDOUT) {\n\t\ttry {\n\t\t\texistingResults = fs.readJsonSync(outputFile);\n\t\t} catch {\n\t\t\t/**\n\t\t\t * There are no existing results, so we can ignore this error,\n\t\t\t * and simply write the current results to the output file.\n\t\t\t */\n\t\t}\n\t}\n\n\t/**\n\t * If the prefix already exists in the output file,\n\t * - if --force flag is used, overwrite the existing results\n\t * - if --force flag is not used, ignore the new results and\n\t * keep the existing ones.\n\t */\n\tif (existingResults[prefix] !== undefined && flags.force === false) {\n\t\tresult.outputFile = IGNORE;\n\t} else {\n\t\tresult.outputFile = outputFile;\n\t\texistingResults[prefix] = currentResults;\n\t}\n\n\tresult.prefix = prefix;\n\n\tresult.exitCode = failed && flags.silent === false ? 1 : 0;\n\tresult.data = existingResults;\n\treturn result;\n};\n"],"names":["IGNORE","STDOUT","getOutputFile","gzipSizeFromFileSync","validateConfigurationFile","basename","dirname","join","bytes","fs","glob","statSync","getRawStats","flags","result","pass","exitCode","exitMessage","outputFile","prefix","data","failed","isValidConfigResult","configuration","configurationFile","output","currentResults","then","m","default","sizes","undefined","artifact","rootPath","path","startsWith","artifactPath","globReplace","hasHash","includes","test","fileGlob","replace","files","sync","length","file","fileSize","size","fileSizeGzip","passed","limit","index","existingResults","readJsonSync","force","silent"],"mappings":"AAAA,SACCA,MAAM,EACNC,MAAM,EACNC,aAAa,EACbC,oBAAoB,EACpBC,yBAAyB,QACnB,iBAAiB;AACxB,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAEpD,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,WAAW;AAC1B,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,QAAQ,QAAQ,UAAU;AAgBnC,OAAO,MAAMC,cAAc,OAAO,EAAEC,KAAK,EAAE;IAC1C,MAAMC,SAAsB;QAC3BC,MAAM;QACNC,UAAU;QACVC,aAAa;QACbC,YAAY;QACZC,QAAQ;QACRC,MAAM,CAAC;IACR;IACA,IAAIC,SAAS;IACb,MAAMC,sBAA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xB,OAAOE,QAAQ,GAAG;YAClBF,OAAOG,WAAW,GAAG,CAAC,0BAA0B,EAAEe,SAASE,IAAI,CAAC,yEAAyE,CAAC;YAC1I,OAAOpB;QACR;QAEA,KAAK,MAAMgC,QAAQH,MAAO;YACzB,MAAMI,WAAWpC,SAASmC,MAAME,IAAI;YACpC,MAAMC,eAAe9C,qBAAqB2C;YAC1C,MAAMI,SAASD,eAAezC,MAAMwB,SAASmB,KAAK;YAElD,IAAID,WAAW,OAAO;gBACrBpC,OAAOC,IAAI,GAAG;gBACdM,SAAS;YACV;YACA,IAAI+B,QAAQd,UAAUN,SAASE,IAAI,GAAG3B,KAAK6B,cAAc/B,SAASyC;YAElEpB,cAAc,CAAC0B,MAAM,GAAG;gBACvBL;gBACAE;gBACAE,OAAOnB,SAASmB,KAAK;gBACrBD;YACD;QACD;IACD;IAEA,IAAIG,kBAAkB,CAAC;IACvB,IAAInC,eAAejB,QAAQ;QAC1B,IAAI;YACHoD,kBAAkB5C,GAAG6C,YAAY,CAACpC;QACnC,EAAE,OAAM;QACP;;;IAGC,GACF;IACD;IAEA;;;;;EAKC,GACD,IAAImC,eAAe,CAAClC,OAAO,KAAKY,aAAalB,MAAM0C,KAAK,KAAK,OAAO;QACnEzC,OAAOI,UAAU,GAAGlB;IACrB,OAAO;QACNc,OAAOI,UAAU,GAAGA;QACpBmC,eAAe,CAAClC,OAAO,GAAGO;IAC3B;IAEAZ,OAAOK,MAAM,GAAGA;IAEhBL,OAAOE,QAAQ,GAAGK,UAAUR,MAAM2C,MAAM,KAAK,QAAQ,IAAI;IACzD1C,OAAOM,IAAI,GAAGiC;IACd,OAAOvC;AACR,EAAE"}
1
+ {"version":3,"sources":["../src/getRawStats.ts"],"sourcesContent":["import {\n\tGLOB_HASH,\n\tGLOB_SEMVER,\n\tHASH_KEY,\n\tIGNORE,\n\tSEMVER_KEY,\n\tSTDOUT,\n\tgetOutputFile,\n\tgzipSizeFromFileSync,\n\tvalidateConfigurationFile,\n} from \"./utilities.js\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport bytes from \"bytes\";\nimport fs from \"fs-extra\";\nimport { glob } from \"glob\";\nimport { statSync } from \"node:fs\";\n\ntype SizesConfiguration = {\n\tlimit: string;\n\tpath: string;\n};\n\ntype ReportStats = {\n\tdata: Record<string, unknown>;\n\texitCode: number;\n\texitMessage: string;\n\toutputFile: string;\n\tpass: boolean;\n\tprefix: string;\n};\n\nexport const getRawStats = async ({ flags }): Promise<ReportStats> => {\n\tconst result: ReportStats = {\n\t\tpass: true,\n\t\texitCode: 0,\n\t\texitMessage: \"\",\n\t\toutputFile: \"\",\n\t\tprefix: \"\",\n\t\tdata: {},\n\t};\n\tlet failed = false;\n\tconst isValidConfigResult = validateConfigurationFile(flags.configuration);\n\tif (isValidConfigResult.exitMessage !== \"\") {\n\t\treturn {\n\t\t\t...result,\n\t\t\t...isValidConfigResult,\n\t\t};\n\t}\n\tconst configurationFile = isValidConfigResult.data;\n\tconst outputFile = getOutputFile(flags.output);\n\tconst prefix = flags.prefix || \"0.0.0\";\n\tconst currentResults = {};\n\n\tconst configuration: { sizes: SizesConfiguration[] } = await import(\n\t\tconfigurationFile\n\t).then((m) => m.default);\n\n\tif (configuration.sizes === undefined) {\n\t\tresult.exitMessage = \"Invalid configuration file: missing sizes object!\";\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\tfor (const artifact of configuration.sizes) {\n\t\tconst rootPath = artifact.path.startsWith(\"/\")\n\t\t\t? \"\"\n\t\t\t: dirname(configurationFile);\n\t\tconst artifactPath = dirname(artifact.path);\n\t\tconst hasHash = artifact.path.includes(HASH_KEY);\n\t\tconst hasSemver = artifact.path.includes(SEMVER_KEY);\n\n\t\tif (hasSemver && hasHash) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `Invalid path: ${artifact.path}.\\nCannot use ${HASH_KEY} and ${SEMVER_KEY} in the same path.`;\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n\t\t * if the artifact.path has the string <hash> or <semver> in it,\n\t\t * then we need to check for other characters:\n\t\t * - Double stars ** are allowed.\n\t\t * - Single stars * are not allowed.\n\t\t */\n\t\tif ((hasHash || hasSemver) && /(?<!\\*)\\*(?!\\*)/.test(artifact.path)) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `Invalid path: ${artifact.path}.\\nSingle stars (*) are not allowed when using the special keyword ${hasHash ? HASH_KEY : SEMVER_KEY}`;\n\t\t\treturn result;\n\t\t}\n\n\t\tlet location = artifact.path;\n\t\tif (hasHash) {\n\t\t\tlocation = artifact.path.replace(HASH_KEY, GLOB_HASH);\n\t\t}\n\t\tif (hasSemver) {\n\t\t\tlocation = artifact.path.replace(SEMVER_KEY, GLOB_SEMVER);\n\t\t}\n\t\tconst fileGlob = join(rootPath, location);\n\t\tconst files = glob.sync(fileGlob);\n\n\t\tif (files.length === 0) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `File not found: ${fileGlob}`;\n\t\t\treturn result;\n\t\t}\n\n\t\tif (files.length > 1 && hasHash) {\n\t\t\tresult.exitCode = 1;\n\t\t\tresult.exitMessage = `Multiple files found for: ${artifact.path}.\\nPlease use a more specific path when using the special keyword ${HASH_KEY}.`;\n\t\t\treturn result;\n\t\t}\n\n\t\tfor (const file of files) {\n\t\t\tconst fileSize = statSync(file).size;\n\t\t\tconst fileSizeGzip = gzipSizeFromFileSync(file);\n\t\t\tconst passed = fileSizeGzip < bytes(artifact.limit);\n\n\t\t\tif (passed === false) {\n\t\t\t\tresult.pass = false;\n\t\t\t\tfailed = true;\n\t\t\t}\n\t\t\tlet index =\n\t\t\t\thasHash || hasSemver\n\t\t\t\t\t? artifact.path\n\t\t\t\t\t: join(artifactPath, basename(file));\n\n\t\t\tcurrentResults[index] = {\n\t\t\t\tfileSize,\n\t\t\t\tfileSizeGzip,\n\t\t\t\tlimit: artifact.limit,\n\t\t\t\tpassed,\n\t\t\t};\n\t\t}\n\t}\n\n\tlet existingResults = {};\n\tif (outputFile !== STDOUT) {\n\t\ttry {\n\t\t\texistingResults = fs.readJsonSync(outputFile);\n\t\t} catch {\n\t\t\t/**\n\t\t\t * There are no existing results, so we can ignore this error,\n\t\t\t * and simply write the current results to the output file.\n\t\t\t */\n\t\t}\n\t}\n\n\t/**\n\t * If the prefix already exists in the output file,\n\t * - if --force flag is used, overwrite the existing results\n\t * - if --force flag is not used, ignore the new results and\n\t * keep the existing ones.\n\t */\n\tif (existingResults[prefix] !== undefined && flags.force === false) {\n\t\tresult.outputFile = IGNORE;\n\t} else {\n\t\tresult.outputFile = outputFile;\n\t\texistingResults[prefix] = currentResults;\n\t}\n\n\tresult.prefix = prefix;\n\n\tresult.exitCode = failed && flags.silent === false ? 1 : 0;\n\tresult.data = existingResults;\n\treturn result;\n};\n"],"names":["GLOB_HASH","GLOB_SEMVER","HASH_KEY","IGNORE","SEMVER_KEY","STDOUT","getOutputFile","gzipSizeFromFileSync","validateConfigurationFile","basename","dirname","join","bytes","fs","glob","statSync","getRawStats","flags","result","pass","exitCode","exitMessage","outputFile","prefix","data","failed","isValidConfigResult","configuration","configurationFile","output","currentResults","then","m","default","sizes","undefined","artifact","rootPath","path","startsWith","artifactPath","hasHash","includes","hasSemver","test","location","replace","fileGlob","files","sync","length","file","fileSize","size","fileSizeGzip","passed","limit","index","existingResults","readJsonSync","force","silent"],"mappings":"AAAA,SACCA,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,UAAU,EACVC,MAAM,EACNC,aAAa,EACbC,oBAAoB,EACpBC,yBAAyB,QACnB,iBAAiB;AACxB,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAEpD,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,WAAW;AAC1B,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,QAAQ,QAAQ,UAAU;AAgBnC,OAAO,MAAMC,cAAc,OAAO,EAAEC,KAAK,EAAE;IAC1C,MAAMC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AACrC;QACnC,EAAE,OAAM;QACP;;;IAGC,GACF;IACD;IAEA;;;;;EAKC,GACD,IAAIoC,eAAe,CAACnC,OAAO,KAAKY,aAAalB,MAAM2C,KAAK,KAAK,OAAO;QACnE1C,OAAOI,UAAU,GAAGnB;IACrB,OAAO;QACNe,OAAOI,UAAU,GAAGA;QACpBoC,eAAe,CAACnC,OAAO,GAAGO;IAC3B;IAEAZ,OAAOK,MAAM,GAAGA;IAEhBL,OAAOE,QAAQ,GAAGK,UAAUR,MAAM4C,MAAM,KAAK,QAAQ,IAAI;IACzD3C,OAAOM,IAAI,GAAGkC;IACd,OAAOxC;AACR,EAAE"}
@@ -1,5 +1,9 @@
1
1
  export declare const STDOUT = "stdout";
2
2
  export declare const IGNORE = "ignore";
3
+ export declare const HASH_KEY = "<hash>";
4
+ export declare const SEMVER_KEY = "<semver>";
5
+ export declare const GLOB_HASH = "+([a-zA-Z0-9_-])";
6
+ export declare const GLOB_SEMVER = "+([0-9]).+([0-9]).+([0-9])*([.a-zA-Z0-9_-])";
3
7
  export declare const gzipSizeFromFileSync: (file: string) => number;
4
8
  export declare const getOutputFile: (file: string) => string;
5
9
  export declare const validateConfigurationFile: (file: string) => any;
package/dist/utilities.js CHANGED
@@ -5,6 +5,10 @@ import semver from "semver";
5
5
  import zlib from "node:zlib";
6
6
  export const STDOUT = "stdout";
7
7
  export const IGNORE = "ignore";
8
+ export const HASH_KEY = "<hash>";
9
+ export const SEMVER_KEY = "<semver>";
10
+ export const GLOB_HASH = "+([a-zA-Z0-9_-])";
11
+ export const GLOB_SEMVER = "+([0-9]).+([0-9]).+([0-9])*([.a-zA-Z0-9_-])";
8
12
  const CWD = process.cwd();
9
13
  export const gzipSizeFromFileSync = (file)=>{
10
14
  return zlib.gzipSync(fs.readFileSync(file)).length;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utilities.ts"],"sourcesContent":["import bytes from \"bytes\";\nimport fs from \"fs-extra\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\nimport zlib from \"node:zlib\";\n\nexport const STDOUT = \"stdout\";\nexport const IGNORE = \"ignore\";\nconst CWD = process.cwd();\n\nexport const gzipSizeFromFileSync = (file: string): number => {\n\treturn zlib.gzipSync(fs.readFileSync(file)).length;\n};\n\nexport const getOutputFile = (file: string): string => {\n\treturn file === \"\" || file === undefined ? STDOUT : join(CWD, file);\n};\n\nexport const validateConfigurationFile = (file: string): any => {\n\tconst result = {\n\t\texitCode: 0,\n\t\texitMessage: \"\",\n\t\tdata: {},\n\t};\n\tif (file === \"\") {\n\t\tresult.exitMessage = \"Please provide a configuration file\";\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\tconst configurationFile = file.startsWith(\"/\") ? file : join(CWD, file);\n\n\tif (fs.existsSync(configurationFile) === false) {\n\t\tresult.exitMessage = `Invalid or missing configuration file!\\n${configurationFile}`;\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\treturn {\n\t\t...result,\n\t\tdata: configurationFile,\n\t};\n};\n\nexport const readJSONFile = (file: string): any => {\n\ttry {\n\t\treturn {\n\t\t\texitCode: 0,\n\t\t\texitMessage: \"\",\n\t\t\tdata: fs.readJsonSync(file),\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\texitCode: 1,\n\t\t\texitMessage: `Failed to read JSON file: ${error.message}`,\n\t\t};\n\t}\n};\n\nexport const getMostRecentVersion = (data: []) => {\n\tconst keys = [];\n\tfor (const key of Object.keys(data)) {\n\t\tkeys.push(key);\n\t}\n\tkeys.sort(semver.rcompare);\n\treturn keys[0];\n};\n\nexport const percentFormatter = new Intl.NumberFormat(\"en\", {\n\tstyle: \"percent\",\n\tsignDisplay: \"exceptZero\",\n\tminimumFractionDigits: 2,\n\tmaximumFractionDigits: 2,\n});\n\nexport const formatFooter = (limit: boolean, diff: number | string): string => {\n\treturn `Overall status: ${limit ? \"🚫\" : \"✅\"} ${diff}`;\n};\n\nexport const addMDrow = ({\n\ttype,\n\tpassed = true,\n\tname = \"\",\n\tsize = 0,\n\tdiff = \"\",\n\tlimit = \"\",\n\tcolumns,\n}: {\n\tcolumns: any;\n\ttype: \"header\" | \"row\";\n\tpassed?: boolean;\n\tname?: string;\n\tsize?: number;\n\tdiff?: string;\n\tlimit?: string;\n}) => {\n\tconst totalColumns = columns.length;\n\n\tif (type === \"header\") {\n\t\tconst separator = \" --- |\".repeat(totalColumns);\n\t\tconst header = columns.map((column) => column[Object.keys(column)[0]]);\n\t\treturn `| ${header.join(\" | \")} |\\n|${separator}`;\n\t}\n\tif (type === \"row\") {\n\t\tconst row = columns.map((column) => {\n\t\t\tconst key = Object.keys(column)[0];\n\t\t\tif (key === \"status\") {\n\t\t\t\treturn passed ? \"✅\" : \"🚫\";\n\t\t\t}\n\t\t\tif (key === \"file\") {\n\t\t\t\treturn name.replaceAll(\"<\", \"[\").replaceAll(\">\", \"]\");\n\t\t\t}\n\t\t\tif (key === \"size\") {\n\t\t\t\treturn `${bytes(size, {\n\t\t\t\t\tunitSeparator: \" \",\n\t\t\t\t})}${diff}`;\n\t\t\t}\n\t\t\tif (key === \"limits\") {\n\t\t\t\treturn limit;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t});\n\n\t\treturn `| ${row.join(\" | \")} |`;\n\t}\n};\n"],"names":["bytes","fs","join","semver","zlib","STDOUT","IGNORE","CWD","process","cwd","gzipSizeFromFileSync","file","gzipSync","readFileSync","length","getOutputFile","undefined","validateConfigurationFile","result","exitCode","exitMessage","data","configurationFile","startsWith","existsSync","readJSONFile","readJsonSync","error","message","getMostRecentVersion","keys","key","Object","push","sort","rcompare","percentFormatter","Intl","NumberFormat","style","signDisplay","minimumFractionDigits","maximumFractionDigits","formatFooter","limit","diff","addMDrow","type","passed","name","size","columns","totalColumns","separator","repeat","header","map","column","row","replaceAll","unitSeparator"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,WAAW;AAC1B,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,YAAY,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,UAAU;gBACrB,OAAOa;YACR;YACA,OAAO;QACR;QAEA,OAAO,CAAC,EAAE,EAAEc,IAAIxD,IAAI,CAAC,OAAO,EAAE,CAAC;IAChC;AACD,EAAE"}
1
+ {"version":3,"sources":["../src/utilities.ts"],"sourcesContent":["import bytes from \"bytes\";\nimport fs from \"fs-extra\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\nimport zlib from \"node:zlib\";\n\nexport const STDOUT = \"stdout\";\nexport const IGNORE = \"ignore\";\nexport const HASH_KEY = \"<hash>\";\nexport const SEMVER_KEY = \"<semver>\";\nexport const GLOB_HASH = \"+([a-zA-Z0-9_-])\";\nexport const GLOB_SEMVER = \"+([0-9]).+([0-9]).+([0-9])*([.a-zA-Z0-9_-])\";\n\nconst CWD = process.cwd();\n\nexport const gzipSizeFromFileSync = (file: string): number => {\n\treturn zlib.gzipSync(fs.readFileSync(file)).length;\n};\n\nexport const getOutputFile = (file: string): string => {\n\treturn file === \"\" || file === undefined ? STDOUT : join(CWD, file);\n};\n\nexport const validateConfigurationFile = (file: string): any => {\n\tconst result = {\n\t\texitCode: 0,\n\t\texitMessage: \"\",\n\t\tdata: {},\n\t};\n\tif (file === \"\") {\n\t\tresult.exitMessage = \"Please provide a configuration file\";\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\tconst configurationFile = file.startsWith(\"/\") ? file : join(CWD, file);\n\n\tif (fs.existsSync(configurationFile) === false) {\n\t\tresult.exitMessage = `Invalid or missing configuration file!\\n${configurationFile}`;\n\t\tresult.exitCode = 1;\n\t\treturn result;\n\t}\n\n\treturn {\n\t\t...result,\n\t\tdata: configurationFile,\n\t};\n};\n\nexport const readJSONFile = (file: string): any => {\n\ttry {\n\t\treturn {\n\t\t\texitCode: 0,\n\t\t\texitMessage: \"\",\n\t\t\tdata: fs.readJsonSync(file),\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\texitCode: 1,\n\t\t\texitMessage: `Failed to read JSON file: ${error.message}`,\n\t\t};\n\t}\n};\n\nexport const getMostRecentVersion = (data: []) => {\n\tconst keys = [];\n\tfor (const key of Object.keys(data)) {\n\t\tkeys.push(key);\n\t}\n\tkeys.sort(semver.rcompare);\n\treturn keys[0];\n};\n\nexport const percentFormatter = new Intl.NumberFormat(\"en\", {\n\tstyle: \"percent\",\n\tsignDisplay: \"exceptZero\",\n\tminimumFractionDigits: 2,\n\tmaximumFractionDigits: 2,\n});\n\nexport const formatFooter = (limit: boolean, diff: number | string): string => {\n\treturn `Overall status: ${limit ? \"🚫\" : \"✅\"} ${diff}`;\n};\n\nexport const addMDrow = ({\n\ttype,\n\tpassed = true,\n\tname = \"\",\n\tsize = 0,\n\tdiff = \"\",\n\tlimit = \"\",\n\tcolumns,\n}: {\n\tcolumns: any;\n\ttype: \"header\" | \"row\";\n\tpassed?: boolean;\n\tname?: string;\n\tsize?: number;\n\tdiff?: string;\n\tlimit?: string;\n}) => {\n\tconst totalColumns = columns.length;\n\n\tif (type === \"header\") {\n\t\tconst separator = \" --- |\".repeat(totalColumns);\n\t\tconst header = columns.map((column) => column[Object.keys(column)[0]]);\n\t\treturn `| ${header.join(\" | \")} |\\n|${separator}`;\n\t}\n\tif (type === \"row\") {\n\t\tconst row = columns.map((column) => {\n\t\t\tconst key = Object.keys(column)[0];\n\t\t\tif (key === \"status\") {\n\t\t\t\treturn passed ? \"✅\" : \"🚫\";\n\t\t\t}\n\t\t\tif (key === \"file\") {\n\t\t\t\treturn name.replaceAll(\"<\", \"[\").replaceAll(\">\", \"]\");\n\t\t\t}\n\t\t\tif (key === \"size\") {\n\t\t\t\treturn `${bytes(size, {\n\t\t\t\t\tunitSeparator: \" \",\n\t\t\t\t})}${diff}`;\n\t\t\t}\n\t\t\tif (key === \"limits\") {\n\t\t\t\treturn limit;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t});\n\n\t\treturn `| ${row.join(\" | \")} |`;\n\t}\n};\n"],"names":["bytes","fs","join","semver","zlib","STDOUT","IGNORE","HASH_KEY","SEMVER_KEY","GLOB_HASH","GLOB_SEMVER","CWD","process","cwd","gzipSizeFromFileSync","file","gzipSync","readFileSync","length","getOutputFile","undefined","validateConfigurationFile","result","exitCode","exitMessage","data","configurationFile","startsWith","existsSync","readJSONFile","readJsonSync","error","message","getMostRecentVersion","keys","key","Object","push","sort","rcompare","percentFormatter","Intl","NumberFormat","style","signDisplay","minimumFractionDigits","maximumFractionDigits","formatFooter","limit","diff","addMDrow","type","passed","name","size","columns","totalColumns","separator","repeat","header","map","column","row","replaceAll","unitSeparator"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,WAAW;AAC1B,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,YAAY;AAE7B,OAAO,MAAMC,SAAS,SAAS;AAC/B,OAAO,MAAMC,SAAS,SAAS;AAC/B,OAAO,MAAMC,WAAW,SAAS;AACjC,OAAO,MAAMC,aAAa,WAAW;AACrC,OAAO,MAAMC,YAAY,mBAAmB;AAC5C,OAAO,MAAMC,cAAc,8CAA8C;AAEzE,MAAMC,MAAMC,QAAQC,GAAG;AAEvB,OAAO,MAAMC,uBAAuB,CAACC;IACpC,OAAOX,KAAKY,QAAQ,CAACf,GAAGgB,YAAY,CAACF,OAAOG,MAAM;AACnD,EAAE;AAEF,OAAO,MAAMC,gBAAgB,CAACJ;IAC7B,OAAOA,SAAS,MAAMA,SAASK,YAAYf,SAASH,KAAKS,KAAKI;AAC/D,EAAE;AAEF,OAAO,MAAMM,4BAA4B,CAACN;IACzC,MAAMO,SAAS;QACdC,UAAU;QACVC,aAAa;QACbC,MAAM,CAAC;IACR;IACA,IAAIV,SAAS,IAAI;QAChBO,OAAOE,WAAW,GAAG;QACrBF,OAAOC,QAAQ,GAAG;QAClB,OAAOD;IACR;IAEA,MAAMI,oBAAoBX,KAAKY,UAAU,CAAC,OAAOZ,OAAOb,KAAKS,KAAKI;IAElE,IAAId,GAAG2B,UAAU,C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AM,CAACzB,OAAOF,IAAI,CAAC2B,OAAO,CAAC,EAAE,CAAC;QACrE,OAAO,CAAC,EAAE,EAAEF,OAAOzD,IAAI,CAAC,OAAO,KAAK,EAAEuD,UAAU,CAAC;IAClD;IACA,IAAIN,SAAS,OAAO;QACnB,MAAMW,MAAMP,QAAQK,GAAG,CAAC,CAACC;YACxB,MAAM1B,MAAMC,OAAOF,IAAI,CAAC2B,OAAO,CAAC,EAAE;YAClC,IAAI1B,QAAQ,UAAU;gBACrB,OAAOiB,SAAS,MAAM;YACvB;YACA,IAAIjB,QAAQ,QAAQ;gBACnB,OAAOkB,KAAKU,UAAU,CAAC,KAAK,KAAKA,UAAU,CAAC,KAAK;YAClD;YACA,IAAI5B,QAAQ,QAAQ;gBACnB,OAAO,CAAC,EAAEnC,MAAMsD,MAAM;oBACrBU,eAAe;gBAChB,GAAG,EAAEf,KAAK,CAAC;YACZ;YACA,IAAId,QAAQ,UAAU;gBACrB,OAAOa;YACR;YACA,OAAO;QACR;QAEA,OAAO,CAAC,EAAE,EAAEc,IAAI5D,IAAI,CAAC,OAAO,EAAE,CAAC;IAChC;AACD,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-cli/bundlesize",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
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",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "4454b51030c60a28b3727a498ea72c492bc4b775"
40
+ "gitHead": "7616300fb0b6789c3880328324b6940ecd9c203e"
41
41
  }