@node-cli/bundlesize 3.1.1 → 4.0.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/getRawStats.js +1 -1
- package/dist/getRawStats.js.map +1 -1
- package/dist/reportStats.js +7 -4
- package/dist/reportStats.js.map +1 -1
- package/dist/utilities.d.ts +6 -1
- package/dist/utilities.js +13 -3
- package/dist/utilities.js.map +1 -1
- package/package.json +2 -2
package/dist/getRawStats.js
CHANGED
|
@@ -109,7 +109,7 @@ export const getRawStats = async ({ flags })=>{
|
|
|
109
109
|
existingResults[prefix] = currentResults;
|
|
110
110
|
}
|
|
111
111
|
result.prefix = prefix;
|
|
112
|
-
result.exitCode =
|
|
112
|
+
result.exitCode = flags.silent === true ? 0 : Number(failed);
|
|
113
113
|
result.data = existingResults;
|
|
114
114
|
return result;
|
|
115
115
|
};
|
package/dist/getRawStats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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\
|
|
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\tresult.exitCode = flags.silent === true ? 0 : Number(failed);\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","Number"],"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,EAA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0C;YAEhCrB,cAAc,CAAC2B,MAAM,GAAG;gBACvBL;gBACAE;gBACAE,OAAOpB,SAASoB,KAAK;gBACrBD;YACD;QACD;IACD;IAEA,IAAIG,kBAAkB,CAAC;IACvB,IAAIpC,eAAejB,QAAQ;QAC1B,IAAI;YACHqD,kBAAkB7C,GAAG8C,YAAY,CAACrC;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;IAChBL,OAAOE,QAAQ,GAAGH,MAAM4C,MAAM,KAAK,OAAO,IAAIC,OAAOrC;IACrDP,OAAOM,IAAI,GAAGkC;IACd,OAAOxC;AACR,EAAE"}
|
package/dist/reportStats.js
CHANGED
|
@@ -42,6 +42,7 @@ export const reportStats = async ({ flags })=>{
|
|
|
42
42
|
const currentVersion = getMostRecentVersion(currentStats.data);
|
|
43
43
|
let limitReached = false;
|
|
44
44
|
let overallDiff = 0;
|
|
45
|
+
let totalGzipSize = 0;
|
|
45
46
|
const headerString = configuration.report.header || "## Bundle Size";
|
|
46
47
|
const footerFormatter = configuration.report.footer || formatFooter;
|
|
47
48
|
const columns = configuration.report.columns || [
|
|
@@ -79,6 +80,7 @@ export const reportStats = async ({ flags })=>{
|
|
|
79
80
|
unitSeparator: " "
|
|
80
81
|
})} ${percentFormatter(diff / previousFileSizeGzip)})`;
|
|
81
82
|
}
|
|
83
|
+
totalGzipSize += item.fileSizeGzip;
|
|
82
84
|
rowsMD.push(addMDrow({
|
|
83
85
|
type: "row",
|
|
84
86
|
passed: item.passed,
|
|
@@ -89,14 +91,15 @@ export const reportStats = async ({ flags })=>{
|
|
|
89
91
|
columns
|
|
90
92
|
}));
|
|
91
93
|
}
|
|
92
|
-
const overallDiffString = overallDiff === 0 ? "" : `(${overallDiff > 0 ? "+" : "-"}${bytes(Math.abs(overallDiff), {
|
|
93
|
-
unitSeparator: " "
|
|
94
|
-
})})`;
|
|
95
94
|
const template = `
|
|
96
95
|
${headerString}
|
|
97
96
|
${rowsMD.join("\n")}
|
|
98
97
|
|
|
99
|
-
${footerFormatter(
|
|
98
|
+
${footerFormatter({
|
|
99
|
+
limitReached,
|
|
100
|
+
overallDiff,
|
|
101
|
+
totalGzipSize
|
|
102
|
+
})}
|
|
100
103
|
`;
|
|
101
104
|
if (limitReached) {
|
|
102
105
|
result.exitCode = 1;
|
package/dist/reportStats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/reportStats.ts"],"sourcesContent":["import {\n\taddMDrow,\n\tformatFooter,\n\tgetMostRecentVersion,\n\tgetOutputFile,\n\tpercentFormatter,\n\treadJSONFile,\n\tvalidateConfigurationFile,\n} from \"./utilities.js\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport bytes from \"bytes\";\n\ntype ReportConfiguration = {\n\tcurrent: string;\n\tprevious: string;\n\n\theader?: string;\n\tfooter?: (
|
|
1
|
+
{"version":3,"sources":["../src/reportStats.ts"],"sourcesContent":["import {\n\taddMDrow,\n\tformatFooter,\n\tgetMostRecentVersion,\n\tgetOutputFile,\n\tpercentFormatter,\n\treadJSONFile,\n\tvalidateConfigurationFile,\n} from \"./utilities.js\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport type { FooterProperties } from \"./utilities.js\";\nimport bytes from \"bytes\";\n\ntype ReportConfiguration = {\n\tcurrent: string;\n\tprevious: string;\n\n\theader?: string;\n\tfooter?: (arguments_: FooterProperties) => string;\n\tcolumns?: { [key: string]: string }[];\n};\n\ntype ReportCompare = {\n\tdata: string;\n\texitCode: number;\n\texitMessage: string;\n\toutputFile: string;\n};\n\nexport const reportStats = async ({ flags }): Promise<ReportCompare> => {\n\tconst result: ReportCompare = {\n\t\texitCode: 0,\n\t\texitMessage: \"\",\n\t\toutputFile: \"\",\n\t\tdata: \"\",\n\t};\n\tlet previousStats, previousVersion: string;\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\tresult.outputFile = outputFile;\n\n\tconst configuration: { report: ReportConfiguration } = await import(\n\t\tconfigurationFile\n\t).then((m) => m.default);\n\n\tconst currentStats = readJSONFile(\n\t\tjoin(dirname(configurationFile), configuration.report.current),\n\t);\n\tif (currentStats.exitMessage !== \"\") {\n\t\treturn {\n\t\t\t...result,\n\t\t\t...currentStats,\n\t\t};\n\t}\n\n\ttry {\n\t\tpreviousStats = readJSONFile(\n\t\t\tjoin(dirname(configurationFile), configuration.report.previous),\n\t\t);\n\t\tif (previousStats.exitMessage !== \"\") {\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t...previousStats,\n\t\t\t};\n\t\t}\n\t\tpreviousVersion = getMostRecentVersion(previousStats.data);\n\t} catch {\n\t\t// nothing to declare officer\n\t}\n\tconst currentVersion = getMostRecentVersion(currentStats.data);\n\n\tlet limitReached = false;\n\tlet overallDiff = 0;\n\tlet totalGzipSize = 0;\n\n\tconst headerString = configuration.report.header || \"## Bundle Size\";\n\tconst footerFormatter = configuration.report.footer || formatFooter;\n\tconst columns = configuration.report.columns || [\n\t\t{ status: \"Status\" },\n\t\t{ file: \"File\" },\n\t\t{ size: \"Size (Gzip)\" },\n\t\t{ limits: \"Limits\" },\n\t];\n\n\tconst rowsMD = [];\n\trowsMD.push(addMDrow({ type: \"header\", columns }));\n\n\tfor (const key of Object.keys(currentStats.data[currentVersion])) {\n\t\tconst item = currentStats.data[currentVersion][key];\n\t\tconst name = basename(key);\n\t\tif (!item.passed) {\n\t\t\tlimitReached = true;\n\t\t}\n\n\t\tlet diffString = \"\";\n\t\tif (previousStats && previousVersion) {\n\t\t\tconst previousFileStats =\n\t\t\t\tpreviousStats.data[previousVersion] &&\n\t\t\t\tpreviousStats.data[previousVersion][key];\n\t\t\tconst previousFileSizeGzip = previousFileStats?.fileSizeGzip || 0;\n\t\t\tconst diff = item.fileSizeGzip - previousFileSizeGzip;\n\n\t\t\toverallDiff += diff;\n\t\t\tdiffString =\n\t\t\t\tdiff === 0 || diff === item.fileSizeGzip\n\t\t\t\t\t? \"\"\n\t\t\t\t\t: ` (${diff > 0 ? \"+\" : \"-\"}${bytes(Math.abs(diff), {\n\t\t\t\t\t\t\tunitSeparator: \" \",\n\t\t\t\t\t\t})} ${percentFormatter(diff / previousFileSizeGzip)})`;\n\t\t}\n\n\t\ttotalGzipSize += item.fileSizeGzip;\n\n\t\trowsMD.push(\n\t\t\taddMDrow({\n\t\t\t\ttype: \"row\",\n\t\t\t\tpassed: item.passed,\n\t\t\t\tname: name,\n\t\t\t\tsize: item.fileSizeGzip,\n\t\t\t\tdiff: diffString,\n\t\t\t\tlimit: item.limit,\n\t\t\t\tcolumns,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst template = `\n${headerString}\n${rowsMD.join(\"\\n\")}\n\n${footerFormatter({\n\tlimitReached,\n\toverallDiff,\n\ttotalGzipSize,\n})}\n`;\n\n\tif (limitReached) {\n\t\tresult.exitCode = 1;\n\t}\n\n\tresult.data = template;\n\n\treturn result;\n};\n"],"names":["addMDrow","formatFooter","getMostRecentVersion","getOutputFile","percentFormatter","readJSONFile","validateConfigurationFile","basename","dirname","join","bytes","reportStats","flags","result","exitCode","exitMessage","outputFile","data","previousStats","previousVersion","isValidConfigResult","configuration","configurationFile","output","then","m","default","currentStats","report","current","previous","currentVersion","limitReached","overallDiff","totalGzipSize","headerString","header","footerFormatter","footer","columns","status","file","size","limits","rowsMD","push","type","key","Object","keys","item","name","passed","diffString","previousFileStats","previousFileSizeGzip","fileSizeGzip","diff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;YACNT,MAAMQ,KAAKM,YAAY;YACvBC,MAAMJ;YACNQ,OAAOX,KAAKW,KAAK;YACjBtB;QACD;IAEF;IAEA,MAAMuB,WAAW,CAAC;AACnB,EAAE3B,aAAa;AACf,EAAES,OAAOnC,IAAI,CAAC,MAAM;;AAEpB,EAAE4B,gBAAgB;QACjBL;QACAC;QACAC;IACD,GAAG;AACH,CAAC;IAEA,IAAIF,cAAc;QACjBnB,OAAOC,QAAQ,GAAG;IACnB;IAEAD,OAAOI,IAAI,GAAG6C;IAEd,OAAOjD;AACR,EAAE"}
|
package/dist/utilities.d.ts
CHANGED
|
@@ -10,7 +10,12 @@ export declare const validateConfigurationFile: (file: string) => any;
|
|
|
10
10
|
export declare const readJSONFile: (file: string) => any;
|
|
11
11
|
export declare const getMostRecentVersion: (data: []) => any;
|
|
12
12
|
export declare const percentFormatter: (value: number) => string;
|
|
13
|
-
export
|
|
13
|
+
export type FooterProperties = {
|
|
14
|
+
limitReached: boolean;
|
|
15
|
+
overallDiff: number;
|
|
16
|
+
totalGzipSize: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const formatFooter: ({ limitReached, overallDiff, totalGzipSize, }: FooterProperties) => string;
|
|
14
19
|
export declare const addMDrow: ({ type, passed, name, size, diff, limit, columns, }: {
|
|
15
20
|
columns: any;
|
|
16
21
|
type: "header" | "row";
|
package/dist/utilities.js
CHANGED
|
@@ -69,8 +69,18 @@ export const percentFormatter = (value)=>{
|
|
|
69
69
|
});
|
|
70
70
|
return formatter.format(value);
|
|
71
71
|
};
|
|
72
|
-
export const formatFooter = (
|
|
73
|
-
|
|
72
|
+
export const formatFooter = ({ limitReached, overallDiff, totalGzipSize })=>{
|
|
73
|
+
let percentageDiff = "";
|
|
74
|
+
const result = [];
|
|
75
|
+
const totalGzipSizeString = `${bytes(totalGzipSize || 0, {
|
|
76
|
+
unitSeparator: " "
|
|
77
|
+
})}`;
|
|
78
|
+
percentageDiff = percentFormatter(overallDiff / (totalGzipSize - overallDiff));
|
|
79
|
+
const overallDiffString = !overallDiff || overallDiff === 0 ? "" : `(${overallDiff > 0 ? "+" : "-"}${bytes(Math.abs(overallDiff), {
|
|
80
|
+
unitSeparator: " "
|
|
81
|
+
})} ${percentageDiff})`;
|
|
82
|
+
result.push(`Overall bundle size: ${totalGzipSizeString} ${overallDiffString}`.trim(), `Overall status: ${limitReached ? "🚫" : "✅"}`);
|
|
83
|
+
return `${result.join("\n")}`;
|
|
74
84
|
};
|
|
75
85
|
export const addMDrow = ({ type, passed = true, name = "", size = 0, diff = "", limit = "", columns })=>{
|
|
76
86
|
const totalColumns = columns.length;
|
|
@@ -97,7 +107,7 @@ export const addMDrow = ({ type, passed = true, name = "", size = 0, diff = "",
|
|
|
97
107
|
return limit;
|
|
98
108
|
}
|
|
99
109
|
return "";
|
|
100
|
-
});
|
|
110
|
+
}).filter((item)=>item !== "");
|
|
101
111
|
return `| ${row.join(" | ")} |`;
|
|
102
112
|
}
|
|
103
113
|
};
|
package/dist/utilities.js.map
CHANGED
|
@@ -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\";\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 = (value: number) => {\n\tconst formatter = new Intl.NumberFormat(\"en\", {\n\t\tstyle: \"percent\",\n\t\tsignDisplay: \"exceptZero\",\n\t\tminimumFractionDigits: 2,\n\t\tmaximumFractionDigits: 2,\n\t});\n\treturn formatter.format(value);\n};\n\nexport const formatFooter = (
|
|
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 = (value: number) => {\n\tconst formatter = new Intl.NumberFormat(\"en\", {\n\t\tstyle: \"percent\",\n\t\tsignDisplay: \"exceptZero\",\n\t\tminimumFractionDigits: 2,\n\t\tmaximumFractionDigits: 2,\n\t});\n\treturn formatter.format(value);\n};\n\nexport type FooterProperties = {\n\tlimitReached: boolean;\n\toverallDiff: number;\n\ttotalGzipSize: number;\n};\nexport const formatFooter = ({\n\tlimitReached,\n\toverallDiff,\n\ttotalGzipSize,\n}: FooterProperties) => {\n\tlet percentageDiff = \"\";\n\tconst result = [];\n\n\tconst totalGzipSizeString = `${bytes(totalGzipSize || 0, {\n\t\tunitSeparator: \" \",\n\t})}`;\n\n\tpercentageDiff = percentFormatter(\n\t\toverallDiff / (totalGzipSize - overallDiff),\n\t);\n\tconst overallDiffString =\n\t\t!overallDiff || overallDiff === 0\n\t\t\t? \"\"\n\t\t\t: `(${overallDiff > 0 ? \"+\" : \"-\"}${bytes(Math.abs(overallDiff), {\n\t\t\t\t\tunitSeparator: \" \",\n\t\t\t\t})} ${percentageDiff})`;\n\n\tresult.push(\n\t\t`Overall bundle size: ${totalGzipSizeString} ${overallDiffString}`.trim(),\n\t\t`Overall status: ${limitReached ? \"🚫\" : \"✅\"}`,\n\t);\n\n\treturn `${result.join(\"\\n\")}`;\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\n\t\t\t.map((column: {}) => {\n\t\t\t\tconst key = Object.keys(column)[0];\n\t\t\t\tif (key === \"status\") {\n\t\t\t\t\treturn passed ? \"✅\" : \"🚫\";\n\t\t\t\t}\n\t\t\t\tif (key === \"file\") {\n\t\t\t\t\treturn name.replaceAll(\"<\", \"[\").replaceAll(\">\", \"]\");\n\t\t\t\t}\n\t\t\t\tif (key === \"size\") {\n\t\t\t\t\treturn `${bytes(size, {\n\t\t\t\t\t\tunitSeparator: \" \",\n\t\t\t\t\t})}${diff}`;\n\t\t\t\t}\n\t\t\t\tif (key === \"limits\") {\n\t\t\t\t\treturn limit;\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t})\n\t\t\t.filter((item: string) => item !== \"\");\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","value","formatter","Intl","NumberFormat","style","signDisplay","minimumFractionDigits","maximumFractionDigits","format","formatFooter","limitReached","overallDiff","totalGzipSize","percentageDiff","totalGzipSizeString","unitSeparator","overallDiffString","Math","abs","trim","addMDrow","type","passed","name","size","diff","limit","columns","totalColumns","separator","repeat","header","map","column","row","replaceAll","filter","item"],"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;IAC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QAAQ,QAAQ;gBACnB,OAAO6B,KAAKY,UAAU,CAAC,KAAK,KAAKA,UAAU,CAAC,KAAK;YAClD;YACA,IAAIzC,QAAQ,QAAQ;gBACnB,OAAO,CAAC,EAAEnC,MAAMiE,MAAM;oBACrBT,eAAe;gBAChB,GAAG,EAAEU,KAAK,CAAC;YACZ;YACA,IAAI/B,QAAQ,UAAU;gBACrB,OAAOgC;YACR;YACA,OAAO;QACR,GACCU,MAAM,CAAC,CAACC,OAAiBA,SAAS;QAEpC,OAAO,CAAC,EAAE,EAAEH,IAAIzE,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
|
+
"version": "4.0.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": "
|
|
40
|
+
"gitHead": "603727407b5f33825a32b89863ec171f8a9fd2e1"
|
|
41
41
|
}
|