From e7f3026a1f3ca9f6ce35a965ba7a6d62b4d3e9d0 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 07:35:57 -0400 Subject: [PATCH 01/10] Adding a cursor rules file --- .cursor/rules/javascript.mdc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .cursor/rules/javascript.mdc diff --git a/.cursor/rules/javascript.mdc b/.cursor/rules/javascript.mdc new file mode 100644 index 0000000..78c6287 --- /dev/null +++ b/.cursor/rules/javascript.mdc @@ -0,0 +1,14 @@ +--- +description: JavaScript module +globs: +alwaysApply: true +--- + +- Use JSDoc standard for creating docblocks of functions and classes. +- Always use camelCase for function names. +- Always use upper-case snake_case for constants. +- Create integration tests in 'tests/integration' that use node-assert, which run with mocha. +- Create unit tests in 'tests/unit' that use node-assert, which run with mocha. +- Use node.js community "Best Practices". +- Adhere to DRY, KISS, YAGNI, & SOLID principles +- Adhere to OWASP security guidance From 2298b84925267be89ef79aa57e2f345bbfee1780 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 07:54:27 -0400 Subject: [PATCH 02/10] Adding docblocks --- dist/filesize.cjs | 93 +- dist/filesize.esm.min.js | 5 - dist/filesize.esm.min.js.map | 1 - dist/filesize.js | 97 +- dist/filesize.min.js | 6 +- dist/filesize.min.js.map | 2 +- dist/{filesize.esm.js => filesize.umd.js} | 97 +- dist/filesize.umd.min.js | 5 + dist/filesize.umd.min.js.map | 1 + package-lock.json | 3181 +++++++-------------- package.json | 37 +- rollup.config.js | 10 +- src/constants.js | 37 +- src/filesize.js | 52 + test/filesize_test.js | 312 -- 15 files changed, 1386 insertions(+), 2550 deletions(-) delete mode 100644 dist/filesize.esm.min.js delete mode 100644 dist/filesize.esm.min.js.map rename dist/{filesize.esm.js => filesize.umd.js} (52%) create mode 100644 dist/filesize.umd.min.js create mode 100644 dist/filesize.umd.min.js.map delete mode 100644 test/filesize_test.js diff --git a/dist/filesize.cjs b/dist/filesize.cjs index 20843c9..1f27c4a 100644 --- a/dist/filesize.cjs +++ b/dist/filesize.cjs @@ -1,34 +1,47 @@ /** * filesize * - * @copyright 2024 Jason Mulligan + * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.6 + * @version 11.0.0 */ 'use strict'; -const ARRAY = "array"; +// Error Messages +const INVALID_NUMBER = "Invalid number"; +const INVALID_ROUND = "Invalid rounding method"; + +// Standard Types +const IEC = "iec"; +const JEDEC = "jedec"; +const SI = "si"; + +// Unit Types const BIT = "bit"; const BITS = "bits"; const BYTE = "byte"; const BYTES = "bytes"; -const EMPTY = ""; -const EXPONENT = "exponent"; +const SI_KBIT = "kbit"; +const SI_KBYTE = "kB"; + +// Output Format Types +const ARRAY = "array"; const FUNCTION = "function"; -const IEC = "iec"; -const INVALID_NUMBER = "Invalid number"; -const INVALID_ROUND = "Invalid rounding method"; -const JEDEC = "jedec"; const OBJECT = "object"; -const PERIOD = "."; +const STRING = "string"; + +// Processing Constants +const EXPONENT = "exponent"; const ROUND = "round"; + +// Special Characters and Values +const EMPTY = ""; +const PERIOD = "."; const S = "s"; -const SI = "si"; -const SI_KBIT = "kbit"; -const SI_KBYTE = "kB"; const SPACE = " "; -const STRING = "string"; const ZERO = "0"; + +// Data Structures const STRINGS = { symbol: { iec: { @@ -46,6 +59,33 @@ const STRINGS = { } }; +/** + * Converts a file size in bytes to a human-readable string with appropriate units + * @param {number|bigint} arg - The file size in bytes to convert + * @param {Object} [options={}] - Configuration options for formatting + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {string|Array|Object|number} Formatted file size based on output option + * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid + * @example + * filesize(1024) // "1 KB" + * filesize(1024, {bits: true}) // "8 Kb" + * filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"} + */ function filesize (arg, { bits = false, pad = false, @@ -195,6 +235,31 @@ function filesize (arg, { } : result.join(spacer); } +/** + * Creates a partially applied version of filesize with preset options + * @param {Object} [options={}] - Default options to apply to the returned function + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {Function} A function that takes a file size and returns formatted output + * @example + * const formatBytes = partial({round: 1, standard: "IEC"}); + * formatBytes(1024) // "1.0 KiB" + * formatBytes(2048) // "2.0 KiB" + */ // Partial application for functional programming function partial ({ bits = false, diff --git a/dist/filesize.esm.min.js b/dist/filesize.esm.min.js deleted file mode 100644 index bc36f1b..0000000 --- a/dist/filesize.esm.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! - 2024 Jason Mulligan - @version 10.1.6 -*/ -const t="array",i="bit",o="bits",e="byte",n="bytes",r="",a="exponent",b="function",s="iec",l="Invalid number",p="Invalid rounding method",u="jedec",c="object",d=".",f="round",g="s",m="si",B="kbit",y="kB",h=" ",M="string",x="0",w={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function E(E,{bits:T=!1,pad:j=!1,base:N=-1,round:P=2,locale:S=r,localeOptions:k={},separator:G=r,spacer:K=h,symbols:Y={},standard:Z=r,output:v=M,fullform:O=!1,fullforms:$=[],exponent:z=-1,roundingMethod:I=f,precision:L=0}={}){let D=z,q=Number(E),A=[],C=0,F=r;Z===m?(N=10,Z=u):Z===s||Z===u?N=2:2===N?Z=s:(N=10,Z=u);const H=10===N?1e3:1024,J=!0===O,Q=q<0,R=Math[I];if("bigint"!=typeof E&&isNaN(E))throw new TypeError(l);if(typeof R!==b)throw new TypeError(p);if(Q&&(q=-q),(-1===D||isNaN(D))&&(D=Math.floor(Math.log(q)/Math.log(H)),D<0&&(D=0)),D>8&&(L>0&&(L+=8-D),D=8),v===a)return D;if(0===q)A[0]=0,F=A[1]=w.symbol[Z][T?o:n][D];else{C=q/(2===N?Math.pow(2,10*D):Math.pow(1e3,D)),T&&(C*=8,C>=H&&D<8&&(C/=H,D++));const t=Math.pow(10,D>0?P:0);A[0]=R(C*t)/t,A[0]===H&&D<8&&-1===z&&(A[0]=1,D++),F=A[1]=10===N&&1===D?T?B:y:w.symbol[Z][T?o:n][D]}if(Q&&(A[0]=-A[0]),L>0&&(A[0]=A[0].toPrecision(L)),A[1]=Y[A[1]]||A[1],!0===S?A[0]=A[0].toLocaleString():S.length>0?A[0]=A[0].toLocaleString(S,k):G.length>0&&(A[0]=A[0].toString().replace(d,G)),j&&P>0){const t=A[0].toString(),i=G||(t.match(/(\D)/g)||[]).pop()||d,o=t.toString().split(i),e=o[1]||r,n=e.length,a=P-n;A[0]=`${o[0]}${i}${e.padEnd(n+a,x)}`}return J&&(A[1]=$[D]?$[D]:w.fullform[Z][D]+(T?i:e)+(1===A[0]?r:g)),v===t?A:v===c?{value:A[0],symbol:A[1],exponent:D,unit:F}:A.join(K)}function T({bits:t=!1,pad:i=!1,base:o=-1,round:e=2,locale:n=r,localeOptions:a={},separator:b=r,spacer:s=h,symbols:l={},standard:p=r,output:u=M,fullform:c=!1,fullforms:d=[],exponent:g=-1,roundingMethod:m=f,precision:B=0}={}){return r=>E(r,{bits:t,pad:i,base:o,round:e,locale:n,localeOptions:a,separator:b,spacer:s,symbols:l,standard:p,output:u,fullform:c,fullforms:d,exponent:g,roundingMethod:m,precision:B})}export{E as filesize,T as partial};//# sourceMappingURL=filesize.esm.min.js.map diff --git a/dist/filesize.esm.min.js.map b/dist/filesize.esm.min.js.map deleted file mode 100644 index e832996..0000000 --- a/dist/filesize.esm.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filesize.esm.min.js","sources":["../src/constants.js","../src/filesize.js"],"sourcesContent":["export const ARRAY = \"array\";\r\nexport const BIT = \"bit\";\r\nexport const BITS = \"bits\";\r\nexport const BYTE = \"byte\";\r\nexport const BYTES = \"bytes\";\r\nexport const EMPTY = \"\";\r\nexport const EXPONENT = \"exponent\";\r\nexport const FUNCTION = \"function\";\r\nexport const IEC = \"iec\";\r\nexport const INVALID_NUMBER = \"Invalid number\";\r\nexport const INVALID_ROUND = \"Invalid rounding method\";\r\nexport const JEDEC = \"jedec\";\r\nexport const OBJECT = \"object\";\r\nexport const PERIOD = \".\";\r\nexport const ROUND = \"round\";\r\nexport const S = \"s\";\r\nexport const SI = \"si\";\r\nexport const SI_KBIT = \"kbit\";\r\nexport const SI_KBYTE = \"kB\";\r\nexport const SPACE = \" \";\r\nexport const STRING = \"string\";\r\nexport const ZERO = \"0\";\r\nexport const STRINGS = {\r\n\tsymbol: {\r\n\t\tiec: {\r\n\t\t\tbits: [\"bit\", \"Kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"],\r\n\t\t\tbytes: [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"]\r\n\t\t},\r\n\t\tjedec: {\r\n\t\t\tbits: [\"bit\", \"Kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"],\r\n\t\t\tbytes: [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\r\n\t\t}\r\n\t},\r\n\tfullform: {\r\n\t\tiec: [\"\", \"kibi\", \"mebi\", \"gibi\", \"tebi\", \"pebi\", \"exbi\", \"zebi\", \"yobi\"],\r\n\t\tjedec: [\"\", \"kilo\", \"mega\", \"giga\", \"tera\", \"peta\", \"exa\", \"zetta\", \"yotta\"]\r\n\t}\r\n};\r\n","import {\r\n\tARRAY,\r\n\tBIT,\r\n\tBITS,\r\n\tBYTE,\r\n\tBYTES,\r\n\tEMPTY,\r\n\tEXPONENT,\r\n\tFUNCTION,\r\n\tIEC,\r\n\tINVALID_NUMBER,\r\n\tINVALID_ROUND,\r\n\tJEDEC,\r\n\tOBJECT,\r\n\tPERIOD,\r\n\tROUND,\r\n\tS,\r\n\tSI,\r\n\tSI_KBIT,\r\n\tSI_KBYTE,\r\n\tSPACE,\r\n\tSTRING,\r\n\tSTRINGS,\r\n\tZERO\r\n} from \"./constants\";\r\n\r\nexport function filesize (arg, {\r\n\tbits = false,\r\n\tpad = false,\r\n\tbase = -1,\r\n\tround = 2,\r\n\tlocale = EMPTY,\r\n\tlocaleOptions = {},\r\n\tseparator = EMPTY,\r\n\tspacer = SPACE,\r\n\tsymbols = {},\r\n\tstandard = EMPTY,\r\n\toutput = STRING,\r\n\tfullform = false,\r\n\tfullforms = [],\r\n\texponent = -1,\r\n\troundingMethod = ROUND,\r\n\tprecision = 0\r\n} = {}) {\r\n\tlet e = exponent,\r\n\t\tnum = Number(arg),\r\n\t\tresult = [],\r\n\t\tval = 0,\r\n\t\tu = EMPTY;\r\n\r\n\t// Sync base & standard\r\n\tif (standard === SI) {\r\n\t\tbase = 10;\r\n\t\tstandard = JEDEC;\r\n\t} else if (standard === IEC || standard === JEDEC) {\r\n\t\tbase = 2;\r\n\t} else if (base === 2) {\r\n\t\tstandard = IEC;\r\n\t} else {\r\n\t\tbase = 10;\r\n\t\tstandard = JEDEC;\r\n\t}\r\n\r\n\tconst ceil = base === 10 ? 1000 : 1024,\r\n\t\tfull = fullform === true,\r\n\t\tneg = num < 0,\r\n\t\troundingFunc = Math[roundingMethod];\r\n\r\n\tif (typeof arg !== \"bigint\" && isNaN(arg)) {\r\n\t\tthrow new TypeError(INVALID_NUMBER);\r\n\t}\r\n\r\n\tif (typeof roundingFunc !== FUNCTION) {\r\n\t\tthrow new TypeError(INVALID_ROUND);\r\n\t}\r\n\r\n\t// Flipping a negative number to determine the size\r\n\tif (neg) {\r\n\t\tnum = -num;\r\n\t}\r\n\r\n\t// Determining the exponent\r\n\tif (e === -1 || isNaN(e)) {\r\n\t\te = Math.floor(Math.log(num) / Math.log(ceil));\r\n\r\n\t\tif (e < 0) {\r\n\t\t\te = 0;\r\n\t\t}\r\n\t}\r\n\r\n\t// Exceeding supported length, time to reduce & multiply\r\n\tif (e > 8) {\r\n\t\tif (precision > 0) {\r\n\t\t\tprecision += 8 - e;\r\n\t\t}\r\n\r\n\t\te = 8;\r\n\t}\r\n\r\n\tif (output === EXPONENT) {\r\n\t\treturn e;\r\n\t}\r\n\r\n\t// Zero is now a special case because bytes divide by 1\r\n\tif (num === 0) {\r\n\t\tresult[0] = 0;\r\n\t\tu = result[1] = STRINGS.symbol[standard][bits ? BITS : BYTES][e];\r\n\t} else {\r\n\t\tval = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));\r\n\r\n\t\tif (bits) {\r\n\t\t\tval = val * 8;\r\n\r\n\t\t\tif (val >= ceil && e < 8) {\r\n\t\t\t\tval = val / ceil;\r\n\t\t\t\te++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst p = Math.pow(10, e > 0 ? round : 0);\r\n\t\tresult[0] = roundingFunc(val * p) / p;\r\n\r\n\t\tif (result[0] === ceil && e < 8 && exponent === -1) {\r\n\t\t\tresult[0] = 1;\r\n\t\t\te++;\r\n\t\t}\r\n\r\n\t\tu = result[1] = base === 10 && e === 1 ? bits ? SI_KBIT : SI_KBYTE : STRINGS.symbol[standard][bits ? BITS : BYTES][e];\r\n\t}\r\n\r\n\t// Decorating a 'diff'\r\n\tif (neg) {\r\n\t\tresult[0] = -result[0];\r\n\t}\r\n\r\n\t// Setting optional precision\r\n\tif (precision > 0) {\r\n\t\tresult[0] = result[0].toPrecision(precision);\r\n\t}\r\n\r\n\t// Applying custom symbol\r\n\tresult[1] = symbols[result[1]] || result[1];\r\n\r\n\tif (locale === true) {\r\n\t\tresult[0] = result[0].toLocaleString();\r\n\t} else if (locale.length > 0) {\r\n\t\tresult[0] = result[0].toLocaleString(locale, localeOptions);\r\n\t} else if (separator.length > 0) {\r\n\t\tresult[0] = result[0].toString().replace(PERIOD, separator);\r\n\t}\r\n\r\n\tif (pad && round > 0) {\r\n\t\tconst i = result[0].toString(),\r\n\t\t\tx = separator || ((i.match(/(\\D)/g) || []).pop() || PERIOD),\r\n\t\t\ttmp = i.toString().split(x),\r\n\t\t\ts = tmp[1] || EMPTY,\r\n\t\t\tl = s.length,\r\n\t\t\tn = round - l;\r\n\r\n\t\tresult[0] = `${tmp[0]}${x}${s.padEnd(l + n, ZERO)}`;\r\n\t}\r\n\r\n\tif (full) {\r\n\t\tresult[1] = fullforms[e] ? fullforms[e] : STRINGS.fullform[standard][e] + (bits ? BIT : BYTE) + (result[0] === 1 ? EMPTY : S);\r\n\t}\r\n\r\n\t// Returning Array, Object, or String (default)\r\n\treturn output === ARRAY ? result : output === OBJECT ? {\r\n\t\tvalue: result[0],\r\n\t\tsymbol: result[1],\r\n\t\texponent: e,\r\n\t\tunit: u\r\n\t} : result.join(spacer);\r\n}\r\n\r\n// Partial application for functional programming\r\nexport function partial ({\r\n\tbits = false,\r\n\tpad = false,\r\n\tbase = -1,\r\n\tround = 2,\r\n\tlocale = EMPTY,\r\n\tlocaleOptions = {},\r\n\tseparator = EMPTY,\r\n\tspacer = SPACE,\r\n\tsymbols = {},\r\n\tstandard = EMPTY,\r\n\toutput = STRING,\r\n\tfullform = false,\r\n\tfullforms = [],\r\n\texponent = -1,\r\n\troundingMethod = ROUND,\r\n\tprecision = 0\r\n} = {}) {\r\n\treturn arg => filesize(arg, {\r\n\t\tbits,\r\n\t\tpad,\r\n\t\tbase,\r\n\t\tround,\r\n\t\tlocale,\r\n\t\tlocaleOptions,\r\n\t\tseparator,\r\n\t\tspacer,\r\n\t\tsymbols,\r\n\t\tstandard,\r\n\t\toutput,\r\n\t\tfullform,\r\n\t\tfullforms,\r\n\t\texponent,\r\n\t\troundingMethod,\r\n\t\tprecision\r\n\t});\r\n}\r\n"],"names":["ARRAY","BIT","BITS","BYTE","BYTES","EMPTY","EXPONENT","FUNCTION","IEC","INVALID_NUMBER","INVALID_ROUND","JEDEC","OBJECT","PERIOD","ROUND","S","SI","SI_KBIT","SI_KBYTE","SPACE","STRING","ZERO","STRINGS","symbol","iec","bits","bytes","jedec","fullform","filesize","arg","pad","base","round","locale","localeOptions","separator","spacer","symbols","standard","output","fullforms","exponent","roundingMethod","precision","e","num","Number","result","val","u","ceil","full","neg","roundingFunc","Math","isNaN","TypeError","floor","log","pow","p","toPrecision","toLocaleString","length","toString","replace","i","x","match","pop","tmp","split","s","l","n","padEnd","value","unit","join","partial"],"mappings":";;;;AAAO,MAAMA,EAAQ,QACRC,EAAM,MACNC,EAAO,OACPC,EAAO,OACPC,EAAQ,QACRC,EAAQ,GACRC,EAAW,WACXC,EAAW,WACXC,EAAM,MACNC,EAAiB,iBACjBC,EAAgB,0BAChBC,EAAQ,QACRC,EAAS,SACTC,EAAS,IACTC,EAAQ,QACRC,EAAI,IACJC,EAAK,KACLC,EAAU,OACVC,EAAW,KACXC,EAAQ,IACRC,EAAS,SACTC,EAAO,IACPC,EAAU,CACtBC,OAAQ,CACPC,IAAK,CACJC,KAAM,CAAC,MAAO,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,SAC7EC,MAAO,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAE/DC,MAAO,CACNF,KAAM,CAAC,MAAO,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QACtEC,MAAO,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QAGzDE,SAAU,CACTJ,IAAK,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAClEG,MAAO,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAO,QAAS,WCT/D,SAASE,EAAUC,GAAKL,KAC9BA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAAS7B,EAAK8B,cACdA,EAAgB,CAAE,EAAAC,UAClBA,EAAY/B,EAAKgC,OACjBA,EAASlB,EAAKmB,QACdA,EAAU,CAAE,EAAAC,SACZA,EAAWlC,EAAKmC,OAChBA,EAASpB,EAAMQ,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiB7B,EAAK8B,UACtBA,EAAY,GACT,IACH,IAAIC,EAAIH,EACPI,EAAMC,OAAOjB,GACbkB,EAAS,GACTC,EAAM,EACNC,EAAI7C,EAGDkC,IAAavB,GAChBgB,EAAO,GACPO,EAAW5B,GACD4B,IAAa/B,GAAO+B,IAAa5B,EAC3CqB,EAAO,EACY,IAATA,EACVO,EAAW/B,GAEXwB,EAAO,GACPO,EAAW5B,GAGZ,MAAMwC,EAAgB,KAATnB,EAAc,IAAO,KACjCoB,GAAoB,IAAbxB,EACPyB,EAAMP,EAAM,EACZQ,EAAeC,KAAKZ,GAErB,GAAmB,iBAARb,GAAoB0B,MAAM1B,GACpC,MAAM,IAAI2B,UAAUhD,GAGrB,UAAW6C,IAAiB/C,EAC3B,MAAM,IAAIkD,UAAU/C,GA0BrB,GAtBI2C,IACHP,GAAOA,KAIG,IAAPD,GAAYW,MAAMX,MACrBA,EAAIU,KAAKG,MAAMH,KAAKI,IAAIb,GAAOS,KAAKI,IAAIR,IAEpCN,EAAI,IACPA,EAAI,IAKFA,EAAI,IACHD,EAAY,IACfA,GAAa,EAAIC,GAGlBA,EAAI,GAGDL,IAAWlC,EACd,OAAOuC,EAIR,GAAY,IAARC,EACHE,EAAO,GAAK,EACZE,EAAIF,EAAO,GAAK1B,EAAQC,OAAOgB,GAAUd,EAAOvB,EAAOE,GAAOyC,OACxD,CACNI,EAAMH,GAAgB,IAATd,EAAauB,KAAKK,IAAI,EAAO,GAAJf,GAAUU,KAAKK,IAAI,IAAMf,IAE3DpB,IACHwB,GAAY,EAERA,GAAOE,GAAQN,EAAI,IACtBI,GAAYE,EACZN,MAIF,MAAMgB,EAAIN,KAAKK,IAAI,GAAIf,EAAI,EAAIZ,EAAQ,GACvCe,EAAO,GAAKM,EAAaL,EAAMY,GAAKA,EAEhCb,EAAO,KAAOG,GAAQN,EAAI,IAAmB,IAAdH,IAClCM,EAAO,GAAK,EACZH,KAGDK,EAAIF,EAAO,GAAc,KAAThB,GAAqB,IAANa,EAAUpB,EAAOR,EAAUC,EAAWI,EAAQC,OAAOgB,GAAUd,EAAOvB,EAAOE,GAAOyC,EACnH,CAuBD,GApBIQ,IACHL,EAAO,IAAMA,EAAO,IAIjBJ,EAAY,IACfI,EAAO,GAAKA,EAAO,GAAGc,YAAYlB,IAInCI,EAAO,GAAKV,EAAQU,EAAO,KAAOA,EAAO,IAE1B,IAAXd,EACHc,EAAO,GAAKA,EAAO,GAAGe,iBACZ7B,EAAO8B,OAAS,EAC1BhB,EAAO,GAAKA,EAAO,GAAGe,eAAe7B,EAAQC,GACnCC,EAAU4B,OAAS,IAC7BhB,EAAO,GAAKA,EAAO,GAAGiB,WAAWC,QAAQrD,EAAQuB,IAG9CL,GAAOE,EAAQ,EAAG,CACrB,MAAMkC,EAAKnB,EAAO,GAAGiB,WACpBG,EAAIhC,IAAe+B,EAAEE,MAAM,UAAY,IAAIC,OAASzD,EACpD0D,EAAMJ,EAAEF,WAAWO,MAAMJ,GACzBK,EAAIF,EAAI,IAAMlE,EACdqE,EAAID,EAAET,OACNW,EAAI1C,EAAQyC,EAEb1B,EAAO,GAAK,GAAGuB,EAAI,KAAKH,IAAIK,EAAEG,OAAOF,EAAIC,EAAGtD,IAC5C,CAOD,OALI+B,IACHJ,EAAO,GAAKP,EAAUI,GAAKJ,EAAUI,GAAKvB,EAAQM,SAASW,GAAUM,IAAMpB,EAAOxB,EAAME,IAAuB,IAAd6C,EAAO,GAAW3C,EAAQU,IAIrHyB,IAAWxC,EAAQgD,EAASR,IAAW5B,EAAS,CACtDiE,MAAO7B,EAAO,GACdzB,OAAQyB,EAAO,GACfN,SAAUG,EACViC,KAAM5B,GACHF,EAAO+B,KAAK1C,EACjB,CAGO,SAAS2C,GAASvD,KACxBA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAAS7B,EAAK8B,cACdA,EAAgB,CAAE,EAAAC,UAClBA,EAAY/B,EAAKgC,OACjBA,EAASlB,EAAKmB,QACdA,EAAU,CAAE,EAAAC,SACZA,EAAWlC,EAAKmC,OAChBA,EAASpB,EAAMQ,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiB7B,EAAK8B,UACtBA,EAAY,GACT,IACH,OAAOd,GAAOD,EAASC,EAAK,CAC3BL,OACAM,MACAC,OACAC,QACAC,SACAC,gBACAC,YACAC,SACAC,UACAC,WACAC,SACAZ,WACAa,YACAC,WACAC,iBACAC,aAEF,QAAAf,cAAAmD"} \ No newline at end of file diff --git a/dist/filesize.js b/dist/filesize.js index 0bb36b4..3b2d404 100644 --- a/dist/filesize.js +++ b/dist/filesize.js @@ -1,32 +1,45 @@ /** * filesize * - * @copyright 2024 Jason Mulligan + * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.6 + * @version 11.0.0 */ -(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';const ARRAY = "array"; +// Error Messages +const INVALID_NUMBER = "Invalid number"; +const INVALID_ROUND = "Invalid rounding method"; + +// Standard Types +const IEC = "iec"; +const JEDEC = "jedec"; +const SI = "si"; + +// Unit Types const BIT = "bit"; const BITS = "bits"; const BYTE = "byte"; const BYTES = "bytes"; -const EMPTY = ""; -const EXPONENT = "exponent"; +const SI_KBIT = "kbit"; +const SI_KBYTE = "kB"; + +// Output Format Types +const ARRAY = "array"; const FUNCTION = "function"; -const IEC = "iec"; -const INVALID_NUMBER = "Invalid number"; -const INVALID_ROUND = "Invalid rounding method"; -const JEDEC = "jedec"; const OBJECT = "object"; -const PERIOD = "."; +const STRING = "string"; + +// Processing Constants +const EXPONENT = "exponent"; const ROUND = "round"; + +// Special Characters and Values +const EMPTY = ""; +const PERIOD = "."; const S = "s"; -const SI = "si"; -const SI_KBIT = "kbit"; -const SI_KBYTE = "kB"; const SPACE = " "; -const STRING = "string"; const ZERO = "0"; + +// Data Structures const STRINGS = { symbol: { iec: { @@ -42,7 +55,34 @@ const STRINGS = { iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"], jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"] } -};function filesize (arg, { +};/** + * Converts a file size in bytes to a human-readable string with appropriate units + * @param {number|bigint} arg - The file size in bytes to convert + * @param {Object} [options={}] - Configuration options for formatting + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {string|Array|Object|number} Formatted file size based on output option + * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid + * @example + * filesize(1024) // "1 KB" + * filesize(1024, {bits: true}) // "8 Kb" + * filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"} + */ +function filesize (arg, { bits = false, pad = false, base = -1, @@ -191,6 +231,31 @@ const STRINGS = { } : result.join(spacer); } +/** + * Creates a partially applied version of filesize with preset options + * @param {Object} [options={}] - Default options to apply to the returned function + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {Function} A function that takes a file size and returns formatted output + * @example + * const formatBytes = partial({round: 1, standard: "IEC"}); + * formatBytes(1024) // "1.0 KiB" + * formatBytes(2048) // "2.0 KiB" + */ // Partial application for functional programming function partial ({ bits = false, @@ -228,4 +293,4 @@ function partial ({ roundingMethod, precision }); -}exports.filesize=filesize;exports.partial=partial;})); \ No newline at end of file +}export{filesize,partial}; \ No newline at end of file diff --git a/dist/filesize.min.js b/dist/filesize.min.js index 412455e..02f8fd3 100644 --- a/dist/filesize.min.js +++ b/dist/filesize.min.js @@ -1,5 +1,5 @@ /*! - 2024 Jason Mulligan - @version 10.1.6 + 2025 Jason Mulligan + @version 11.0.0 */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).filesize={})}(this,(function(t){"use strict";const i="array",e="bit",o="bits",n="byte",r="bytes",s="",l="exponent",a="function",b="iec",p="Invalid number",f="Invalid rounding method",u="jedec",d="object",c=".",g="round",m="s",y="si",h="kbit",B="kB",M=" ",x="string",T="0",w={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function E(t,{bits:E=!1,pad:j=!1,base:N=-1,round:P=2,locale:S=s,localeOptions:k={},separator:z=s,spacer:G=M,symbols:K={},standard:Y=s,output:Z=x,fullform:v=!1,fullforms:O=[],exponent:$=-1,roundingMethod:I=g,precision:L=0}={}){let D=$,q=Number(t),A=[],C=0,F=s;Y===y?(N=10,Y=u):Y===b||Y===u?N=2:2===N?Y=b:(N=10,Y=u);const H=10===N?1e3:1024,J=!0===v,Q=q<0,R=Math[I];if("bigint"!=typeof t&&isNaN(t))throw new TypeError(p);if(typeof R!==a)throw new TypeError(f);if(Q&&(q=-q),(-1===D||isNaN(D))&&(D=Math.floor(Math.log(q)/Math.log(H)),D<0&&(D=0)),D>8&&(L>0&&(L+=8-D),D=8),Z===l)return D;if(0===q)A[0]=0,F=A[1]=w.symbol[Y][E?o:r][D];else{C=q/(2===N?Math.pow(2,10*D):Math.pow(1e3,D)),E&&(C*=8,C>=H&&D<8&&(C/=H,D++));const t=Math.pow(10,D>0?P:0);A[0]=R(C*t)/t,A[0]===H&&D<8&&-1===$&&(A[0]=1,D++),F=A[1]=10===N&&1===D?E?h:B:w.symbol[Y][E?o:r][D]}if(Q&&(A[0]=-A[0]),L>0&&(A[0]=A[0].toPrecision(L)),A[1]=K[A[1]]||A[1],!0===S?A[0]=A[0].toLocaleString():S.length>0?A[0]=A[0].toLocaleString(S,k):z.length>0&&(A[0]=A[0].toString().replace(c,z)),j&&P>0){const t=A[0].toString(),i=z||(t.match(/(\D)/g)||[]).pop()||c,e=t.toString().split(i),o=e[1]||s,n=o.length,r=P-n;A[0]=`${e[0]}${i}${o.padEnd(n+r,T)}`}return J&&(A[1]=O[D]?O[D]:w.fullform[Y][D]+(E?e:n)+(1===A[0]?s:m)),Z===i?A:Z===d?{value:A[0],symbol:A[1],exponent:D,unit:F}:A.join(G)}t.filesize=E,t.partial=function({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:n=s,localeOptions:r={},separator:l=s,spacer:a=M,symbols:b={},standard:p=s,output:f=x,fullform:u=!1,fullforms:d=[],exponent:c=-1,roundingMethod:m=g,precision:y=0}={}){return s=>E(s,{bits:t,pad:i,base:e,round:o,locale:n,localeOptions:r,separator:l,spacer:a,symbols:b,standard:p,output:f,fullform:u,fullforms:d,exponent:c,roundingMethod:m,precision:y})}}));//# sourceMappingURL=filesize.min.js.map +const t="jedec",i="bits",o="bytes",e="string",n="round",r="",a={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function b(b,{bits:s=!1,pad:l=!1,base:p=-1,round:c=2,locale:u="",localeOptions:d={},separator:f="",spacer:g=" ",symbols:m={},standard:B="",output:y=e,fullform:h=!1,fullforms:M=[],exponent:x=-1,roundingMethod:w=n,precision:E=0}={}){let T=x,j=Number(b),N=[],P=0,S=r;"si"===B?(p=10,B=t):"iec"===B||B===t?p=2:2===p?B="iec":(p=10,B=t);const k=10===p?1e3:1024,G=!0===h,K=j<0,Y=Math[w];if("bigint"!=typeof b&&isNaN(b))throw new TypeError("Invalid number");if("function"!=typeof Y)throw new TypeError("Invalid rounding method");if(K&&(j=-j),(-1===T||isNaN(T))&&(T=Math.floor(Math.log(j)/Math.log(k)),T<0&&(T=0)),T>8&&(E>0&&(E+=8-T),T=8),"exponent"===y)return T;if(0===j)N[0]=0,S=N[1]=a.symbol[B][s?i:o][T];else{P=j/(2===p?Math.pow(2,10*T):Math.pow(1e3,T)),s&&(P*=8,P>=k&&T<8&&(P/=k,T++));const t=Math.pow(10,T>0?c:0);N[0]=Y(P*t)/t,N[0]===k&&T<8&&-1===x&&(N[0]=1,T++),S=N[1]=10===p&&1===T?s?"kbit":"kB":a.symbol[B][s?i:o][T]}if(K&&(N[0]=-N[0]),E>0&&(N[0]=N[0].toPrecision(E)),N[1]=m[N[1]]||N[1],!0===u?N[0]=N[0].toLocaleString():u.length>0?N[0]=N[0].toLocaleString(u,d):f.length>0&&(N[0]=N[0].toString().replace(".",f)),l&&c>0){const t=N[0].toString(),i=f||(t.match(/(\D)/g)||[]).pop()||".",o=t.toString().split(i),e=o[1]||r,n=e.length,a=c-n;N[0]=`${o[0]}${i}${e.padEnd(n+a,"0")}`}return G&&(N[1]=M[T]?M[T]:a.fullform[B][T]+(s?"bit":"byte")+(1===N[0]?r:"s")),"array"===y?N:"object"===y?{value:N[0],symbol:N[1],exponent:T,unit:S}:N.join(g)}function s({bits:t=!1,pad:i=!1,base:o=-1,round:r=2,locale:a="",localeOptions:s={},separator:l="",spacer:p=" ",symbols:c={},standard:u="",output:d=e,fullform:f=!1,fullforms:g=[],exponent:m=-1,roundingMethod:B=n,precision:y=0}={}){return e=>b(e,{bits:t,pad:i,base:o,round:r,locale:a,localeOptions:s,separator:l,spacer:p,symbols:c,standard:u,output:d,fullform:f,fullforms:g,exponent:m,roundingMethod:B,precision:y})}export{b as filesize,s as partial};//# sourceMappingURL=filesize.min.js.map diff --git a/dist/filesize.min.js.map b/dist/filesize.min.js.map index 7da0da8..c291a48 100644 --- a/dist/filesize.min.js.map +++ b/dist/filesize.min.js.map @@ -1 +1 @@ -{"version":3,"file":"filesize.min.js","sources":["../src/constants.js","../src/filesize.js"],"sourcesContent":["export const ARRAY = \"array\";\r\nexport const BIT = \"bit\";\r\nexport const BITS = \"bits\";\r\nexport const BYTE = \"byte\";\r\nexport const BYTES = \"bytes\";\r\nexport const EMPTY = \"\";\r\nexport const EXPONENT = \"exponent\";\r\nexport const FUNCTION = \"function\";\r\nexport const IEC = \"iec\";\r\nexport const INVALID_NUMBER = \"Invalid number\";\r\nexport const INVALID_ROUND = \"Invalid rounding method\";\r\nexport const JEDEC = \"jedec\";\r\nexport const OBJECT = \"object\";\r\nexport const PERIOD = \".\";\r\nexport const ROUND = \"round\";\r\nexport const S = \"s\";\r\nexport const SI = \"si\";\r\nexport const SI_KBIT = \"kbit\";\r\nexport const SI_KBYTE = \"kB\";\r\nexport const SPACE = \" \";\r\nexport const STRING = \"string\";\r\nexport const ZERO = \"0\";\r\nexport const STRINGS = {\r\n\tsymbol: {\r\n\t\tiec: {\r\n\t\t\tbits: [\"bit\", \"Kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"],\r\n\t\t\tbytes: [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"]\r\n\t\t},\r\n\t\tjedec: {\r\n\t\t\tbits: [\"bit\", \"Kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"],\r\n\t\t\tbytes: [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\r\n\t\t}\r\n\t},\r\n\tfullform: {\r\n\t\tiec: [\"\", \"kibi\", \"mebi\", \"gibi\", \"tebi\", \"pebi\", \"exbi\", \"zebi\", \"yobi\"],\r\n\t\tjedec: [\"\", \"kilo\", \"mega\", \"giga\", \"tera\", \"peta\", \"exa\", \"zetta\", \"yotta\"]\r\n\t}\r\n};\r\n","import {\r\n\tARRAY,\r\n\tBIT,\r\n\tBITS,\r\n\tBYTE,\r\n\tBYTES,\r\n\tEMPTY,\r\n\tEXPONENT,\r\n\tFUNCTION,\r\n\tIEC,\r\n\tINVALID_NUMBER,\r\n\tINVALID_ROUND,\r\n\tJEDEC,\r\n\tOBJECT,\r\n\tPERIOD,\r\n\tROUND,\r\n\tS,\r\n\tSI,\r\n\tSI_KBIT,\r\n\tSI_KBYTE,\r\n\tSPACE,\r\n\tSTRING,\r\n\tSTRINGS,\r\n\tZERO\r\n} from \"./constants\";\r\n\r\nexport function filesize (arg, {\r\n\tbits = false,\r\n\tpad = false,\r\n\tbase = -1,\r\n\tround = 2,\r\n\tlocale = EMPTY,\r\n\tlocaleOptions = {},\r\n\tseparator = EMPTY,\r\n\tspacer = SPACE,\r\n\tsymbols = {},\r\n\tstandard = EMPTY,\r\n\toutput = STRING,\r\n\tfullform = false,\r\n\tfullforms = [],\r\n\texponent = -1,\r\n\troundingMethod = ROUND,\r\n\tprecision = 0\r\n} = {}) {\r\n\tlet e = exponent,\r\n\t\tnum = Number(arg),\r\n\t\tresult = [],\r\n\t\tval = 0,\r\n\t\tu = EMPTY;\r\n\r\n\t// Sync base & standard\r\n\tif (standard === SI) {\r\n\t\tbase = 10;\r\n\t\tstandard = JEDEC;\r\n\t} else if (standard === IEC || standard === JEDEC) {\r\n\t\tbase = 2;\r\n\t} else if (base === 2) {\r\n\t\tstandard = IEC;\r\n\t} else {\r\n\t\tbase = 10;\r\n\t\tstandard = JEDEC;\r\n\t}\r\n\r\n\tconst ceil = base === 10 ? 1000 : 1024,\r\n\t\tfull = fullform === true,\r\n\t\tneg = num < 0,\r\n\t\troundingFunc = Math[roundingMethod];\r\n\r\n\tif (typeof arg !== \"bigint\" && isNaN(arg)) {\r\n\t\tthrow new TypeError(INVALID_NUMBER);\r\n\t}\r\n\r\n\tif (typeof roundingFunc !== FUNCTION) {\r\n\t\tthrow new TypeError(INVALID_ROUND);\r\n\t}\r\n\r\n\t// Flipping a negative number to determine the size\r\n\tif (neg) {\r\n\t\tnum = -num;\r\n\t}\r\n\r\n\t// Determining the exponent\r\n\tif (e === -1 || isNaN(e)) {\r\n\t\te = Math.floor(Math.log(num) / Math.log(ceil));\r\n\r\n\t\tif (e < 0) {\r\n\t\t\te = 0;\r\n\t\t}\r\n\t}\r\n\r\n\t// Exceeding supported length, time to reduce & multiply\r\n\tif (e > 8) {\r\n\t\tif (precision > 0) {\r\n\t\t\tprecision += 8 - e;\r\n\t\t}\r\n\r\n\t\te = 8;\r\n\t}\r\n\r\n\tif (output === EXPONENT) {\r\n\t\treturn e;\r\n\t}\r\n\r\n\t// Zero is now a special case because bytes divide by 1\r\n\tif (num === 0) {\r\n\t\tresult[0] = 0;\r\n\t\tu = result[1] = STRINGS.symbol[standard][bits ? BITS : BYTES][e];\r\n\t} else {\r\n\t\tval = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));\r\n\r\n\t\tif (bits) {\r\n\t\t\tval = val * 8;\r\n\r\n\t\t\tif (val >= ceil && e < 8) {\r\n\t\t\t\tval = val / ceil;\r\n\t\t\t\te++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst p = Math.pow(10, e > 0 ? round : 0);\r\n\t\tresult[0] = roundingFunc(val * p) / p;\r\n\r\n\t\tif (result[0] === ceil && e < 8 && exponent === -1) {\r\n\t\t\tresult[0] = 1;\r\n\t\t\te++;\r\n\t\t}\r\n\r\n\t\tu = result[1] = base === 10 && e === 1 ? bits ? SI_KBIT : SI_KBYTE : STRINGS.symbol[standard][bits ? BITS : BYTES][e];\r\n\t}\r\n\r\n\t// Decorating a 'diff'\r\n\tif (neg) {\r\n\t\tresult[0] = -result[0];\r\n\t}\r\n\r\n\t// Setting optional precision\r\n\tif (precision > 0) {\r\n\t\tresult[0] = result[0].toPrecision(precision);\r\n\t}\r\n\r\n\t// Applying custom symbol\r\n\tresult[1] = symbols[result[1]] || result[1];\r\n\r\n\tif (locale === true) {\r\n\t\tresult[0] = result[0].toLocaleString();\r\n\t} else if (locale.length > 0) {\r\n\t\tresult[0] = result[0].toLocaleString(locale, localeOptions);\r\n\t} else if (separator.length > 0) {\r\n\t\tresult[0] = result[0].toString().replace(PERIOD, separator);\r\n\t}\r\n\r\n\tif (pad && round > 0) {\r\n\t\tconst i = result[0].toString(),\r\n\t\t\tx = separator || ((i.match(/(\\D)/g) || []).pop() || PERIOD),\r\n\t\t\ttmp = i.toString().split(x),\r\n\t\t\ts = tmp[1] || EMPTY,\r\n\t\t\tl = s.length,\r\n\t\t\tn = round - l;\r\n\r\n\t\tresult[0] = `${tmp[0]}${x}${s.padEnd(l + n, ZERO)}`;\r\n\t}\r\n\r\n\tif (full) {\r\n\t\tresult[1] = fullforms[e] ? fullforms[e] : STRINGS.fullform[standard][e] + (bits ? BIT : BYTE) + (result[0] === 1 ? EMPTY : S);\r\n\t}\r\n\r\n\t// Returning Array, Object, or String (default)\r\n\treturn output === ARRAY ? result : output === OBJECT ? {\r\n\t\tvalue: result[0],\r\n\t\tsymbol: result[1],\r\n\t\texponent: e,\r\n\t\tunit: u\r\n\t} : result.join(spacer);\r\n}\r\n\r\n// Partial application for functional programming\r\nexport function partial ({\r\n\tbits = false,\r\n\tpad = false,\r\n\tbase = -1,\r\n\tround = 2,\r\n\tlocale = EMPTY,\r\n\tlocaleOptions = {},\r\n\tseparator = EMPTY,\r\n\tspacer = SPACE,\r\n\tsymbols = {},\r\n\tstandard = EMPTY,\r\n\toutput = STRING,\r\n\tfullform = false,\r\n\tfullforms = [],\r\n\texponent = -1,\r\n\troundingMethod = ROUND,\r\n\tprecision = 0\r\n} = {}) {\r\n\treturn arg => filesize(arg, {\r\n\t\tbits,\r\n\t\tpad,\r\n\t\tbase,\r\n\t\tround,\r\n\t\tlocale,\r\n\t\tlocaleOptions,\r\n\t\tseparator,\r\n\t\tspacer,\r\n\t\tsymbols,\r\n\t\tstandard,\r\n\t\toutput,\r\n\t\tfullform,\r\n\t\tfullforms,\r\n\t\texponent,\r\n\t\troundingMethod,\r\n\t\tprecision\r\n\t});\r\n}\r\n"],"names":["ARRAY","BIT","BITS","BYTE","BYTES","EMPTY","EXPONENT","FUNCTION","IEC","INVALID_NUMBER","INVALID_ROUND","JEDEC","OBJECT","PERIOD","ROUND","S","SI","SI_KBIT","SI_KBYTE","SPACE","STRING","ZERO","STRINGS","symbol","iec","bits","bytes","jedec","fullform","filesize","arg","pad","base","round","locale","localeOptions","separator","spacer","symbols","standard","output","fullforms","exponent","roundingMethod","precision","e","num","Number","result","val","u","ceil","full","neg","roundingFunc","Math","isNaN","TypeError","floor","log","pow","p","toPrecision","toLocaleString","length","toString","replace","i","x","match","pop","tmp","split","s","l","n","padEnd","value","unit","join","exports","partial"],"mappings":";;;;gPAAO,MAAMA,EAAQ,QACRC,EAAM,MACNC,EAAO,OACPC,EAAO,OACPC,EAAQ,QACRC,EAAQ,GACRC,EAAW,WACXC,EAAW,WACXC,EAAM,MACNC,EAAiB,iBACjBC,EAAgB,0BAChBC,EAAQ,QACRC,EAAS,SACTC,EAAS,IACTC,EAAQ,QACRC,EAAI,IACJC,EAAK,KACLC,EAAU,OACVC,EAAW,KACXC,EAAQ,IACRC,EAAS,SACTC,EAAO,IACPC,EAAU,CACtBC,OAAQ,CACPC,IAAK,CACJC,KAAM,CAAC,MAAO,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,SAC7EC,MAAO,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAE/DC,MAAO,CACNF,KAAM,CAAC,MAAO,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QACtEC,MAAO,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QAGzDE,SAAU,CACTJ,IAAK,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAClEG,MAAO,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAO,QAAS,WCT/D,SAASE,EAAUC,GAAKL,KAC9BA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAAS7B,EAAK8B,cACdA,EAAgB,CAAE,EAAAC,UAClBA,EAAY/B,EAAKgC,OACjBA,EAASlB,EAAKmB,QACdA,EAAU,CAAE,EAAAC,SACZA,EAAWlC,EAAKmC,OAChBA,EAASpB,EAAMQ,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiB7B,EAAK8B,UACtBA,EAAY,GACT,IACH,IAAIC,EAAIH,EACPI,EAAMC,OAAOjB,GACbkB,EAAS,GACTC,EAAM,EACNC,EAAI7C,EAGDkC,IAAavB,GAChBgB,EAAO,GACPO,EAAW5B,GACD4B,IAAa/B,GAAO+B,IAAa5B,EAC3CqB,EAAO,EACY,IAATA,EACVO,EAAW/B,GAEXwB,EAAO,GACPO,EAAW5B,GAGZ,MAAMwC,EAAgB,KAATnB,EAAc,IAAO,KACjCoB,GAAoB,IAAbxB,EACPyB,EAAMP,EAAM,EACZQ,EAAeC,KAAKZ,GAErB,GAAmB,iBAARb,GAAoB0B,MAAM1B,GACpC,MAAM,IAAI2B,UAAUhD,GAGrB,UAAW6C,IAAiB/C,EAC3B,MAAM,IAAIkD,UAAU/C,GA0BrB,GAtBI2C,IACHP,GAAOA,KAIG,IAAPD,GAAYW,MAAMX,MACrBA,EAAIU,KAAKG,MAAMH,KAAKI,IAAIb,GAAOS,KAAKI,IAAIR,IAEpCN,EAAI,IACPA,EAAI,IAKFA,EAAI,IACHD,EAAY,IACfA,GAAa,EAAIC,GAGlBA,EAAI,GAGDL,IAAWlC,EACd,OAAOuC,EAIR,GAAY,IAARC,EACHE,EAAO,GAAK,EACZE,EAAIF,EAAO,GAAK1B,EAAQC,OAAOgB,GAAUd,EAAOvB,EAAOE,GAAOyC,OACxD,CACNI,EAAMH,GAAgB,IAATd,EAAauB,KAAKK,IAAI,EAAO,GAAJf,GAAUU,KAAKK,IAAI,IAAMf,IAE3DpB,IACHwB,GAAY,EAERA,GAAOE,GAAQN,EAAI,IACtBI,GAAYE,EACZN,MAIF,MAAMgB,EAAIN,KAAKK,IAAI,GAAIf,EAAI,EAAIZ,EAAQ,GACvCe,EAAO,GAAKM,EAAaL,EAAMY,GAAKA,EAEhCb,EAAO,KAAOG,GAAQN,EAAI,IAAmB,IAAdH,IAClCM,EAAO,GAAK,EACZH,KAGDK,EAAIF,EAAO,GAAc,KAAThB,GAAqB,IAANa,EAAUpB,EAAOR,EAAUC,EAAWI,EAAQC,OAAOgB,GAAUd,EAAOvB,EAAOE,GAAOyC,EACnH,CAuBD,GApBIQ,IACHL,EAAO,IAAMA,EAAO,IAIjBJ,EAAY,IACfI,EAAO,GAAKA,EAAO,GAAGc,YAAYlB,IAInCI,EAAO,GAAKV,EAAQU,EAAO,KAAOA,EAAO,IAE1B,IAAXd,EACHc,EAAO,GAAKA,EAAO,GAAGe,iBACZ7B,EAAO8B,OAAS,EAC1BhB,EAAO,GAAKA,EAAO,GAAGe,eAAe7B,EAAQC,GACnCC,EAAU4B,OAAS,IAC7BhB,EAAO,GAAKA,EAAO,GAAGiB,WAAWC,QAAQrD,EAAQuB,IAG9CL,GAAOE,EAAQ,EAAG,CACrB,MAAMkC,EAAKnB,EAAO,GAAGiB,WACpBG,EAAIhC,IAAe+B,EAAEE,MAAM,UAAY,IAAIC,OAASzD,EACpD0D,EAAMJ,EAAEF,WAAWO,MAAMJ,GACzBK,EAAIF,EAAI,IAAMlE,EACdqE,EAAID,EAAET,OACNW,EAAI1C,EAAQyC,EAEb1B,EAAO,GAAK,GAAGuB,EAAI,KAAKH,IAAIK,EAAEG,OAAOF,EAAIC,EAAGtD,IAC5C,CAOD,OALI+B,IACHJ,EAAO,GAAKP,EAAUI,GAAKJ,EAAUI,GAAKvB,EAAQM,SAASW,GAAUM,IAAMpB,EAAOxB,EAAME,IAAuB,IAAd6C,EAAO,GAAW3C,EAAQU,IAIrHyB,IAAWxC,EAAQgD,EAASR,IAAW5B,EAAS,CACtDiE,MAAO7B,EAAO,GACdzB,OAAQyB,EAAO,GACfN,SAAUG,EACViC,KAAM5B,GACHF,EAAO+B,KAAK1C,EACjB,CAuCA2C,EAAAnD,SAAAA,EAAAmD,EAAAC,QApCO,UAAkBxD,KACxBA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAAS7B,EAAK8B,cACdA,EAAgB,CAAE,EAAAC,UAClBA,EAAY/B,EAAKgC,OACjBA,EAASlB,EAAKmB,QACdA,EAAU,CAAE,EAAAC,SACZA,EAAWlC,EAAKmC,OAChBA,EAASpB,EAAMQ,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiB7B,EAAK8B,UACtBA,EAAY,GACT,IACH,OAAOd,GAAOD,EAASC,EAAK,CAC3BL,OACAM,MACAC,OACAC,QACAC,SACAC,gBACAC,YACAC,SACAC,UACAC,WACAC,SACAZ,WACAa,YACAC,WACAC,iBACAC,aAEF,CAAA"} \ No newline at end of file +{"version":3,"file":"filesize.min.js","sources":["../src/constants.js","../src/filesize.js"],"sourcesContent":["// Error Messages\nexport const INVALID_NUMBER = \"Invalid number\";\nexport const INVALID_ROUND = \"Invalid rounding method\";\n\n// Standard Types\nexport const IEC = \"iec\";\nexport const JEDEC = \"jedec\";\nexport const SI = \"si\";\n\n// Unit Types\nexport const BIT = \"bit\";\nexport const BITS = \"bits\";\nexport const BYTE = \"byte\";\nexport const BYTES = \"bytes\";\nexport const SI_KBIT = \"kbit\";\nexport const SI_KBYTE = \"kB\";\n\n// Output Format Types\nexport const ARRAY = \"array\";\nexport const FUNCTION = \"function\";\nexport const OBJECT = \"object\";\nexport const STRING = \"string\";\n\n// Processing Constants\nexport const EXPONENT = \"exponent\";\nexport const ROUND = \"round\";\n\n// Special Characters and Values\nexport const EMPTY = \"\";\nexport const PERIOD = \".\";\nexport const S = \"s\";\nexport const SPACE = \" \";\nexport const ZERO = \"0\";\n\n// Data Structures\nexport const STRINGS = {\n\tsymbol: {\n\t\tiec: {\n\t\t\tbits: [\"bit\", \"Kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"],\n\t\t\tbytes: [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"]\n\t\t},\n\t\tjedec: {\n\t\t\tbits: [\"bit\", \"Kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"],\n\t\t\tbytes: [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n\t\t}\n\t},\n\tfullform: {\n\t\tiec: [\"\", \"kibi\", \"mebi\", \"gibi\", \"tebi\", \"pebi\", \"exbi\", \"zebi\", \"yobi\"],\n\t\tjedec: [\"\", \"kilo\", \"mega\", \"giga\", \"tera\", \"peta\", \"exa\", \"zetta\", \"yotta\"]\n\t}\n};\n","import {\n\tARRAY,\n\tBIT,\n\tBITS,\n\tBYTE,\n\tBYTES,\n\tEMPTY,\n\tEXPONENT,\n\tFUNCTION,\n\tIEC,\n\tINVALID_NUMBER,\n\tINVALID_ROUND,\n\tJEDEC,\n\tOBJECT,\n\tPERIOD,\n\tROUND,\n\tS,\n\tSI,\n\tSI_KBIT,\n\tSI_KBYTE,\n\tSPACE,\n\tSTRING,\n\tSTRINGS,\n\tZERO\n} from \"./constants\";\n\n/**\n * Converts a file size in bytes to a human-readable string with appropriate units\n * @param {number|bigint} arg - The file size in bytes to convert\n * @param {Object} [options={}] - Configuration options for formatting\n * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes\n * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter\n * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto)\n * @param {number} [options.round=2] - Number of decimal places to round to\n * @param {string|boolean} [options.locale=\"\"] - Locale for number formatting, true for system locale\n * @param {Object} [options.localeOptions={}] - Additional options for locale formatting\n * @param {string} [options.separator=\"\"] - Custom decimal separator\n * @param {string} [options.spacer=\" \"] - String to separate value and unit\n * @param {Object} [options.symbols={}] - Custom unit symbols\n * @param {string} [options.standard=\"\"] - Unit standard to use (SI, IEC, JEDEC)\n * @param {string} [options.output=\"string\"] - Output format: \"string\", \"array\", \"object\", or \"exponent\"\n * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations\n * @param {Array} [options.fullforms=[]] - Custom full unit names\n * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto)\n * @param {string} [options.roundingMethod=\"round\"] - Math rounding method to use\n * @param {number} [options.precision=0] - Number of significant digits (0 for auto)\n * @returns {string|Array|Object|number} Formatted file size based on output option\n * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid\n * @example\n * filesize(1024) // \"1 KB\"\n * filesize(1024, {bits: true}) // \"8 Kb\"\n * filesize(1024, {output: \"object\"}) // {value: 1, symbol: \"KB\", exponent: 1, unit: \"KB\"}\n */\nexport function filesize (arg, {\n\tbits = false,\n\tpad = false,\n\tbase = -1,\n\tround = 2,\n\tlocale = EMPTY,\n\tlocaleOptions = {},\n\tseparator = EMPTY,\n\tspacer = SPACE,\n\tsymbols = {},\n\tstandard = EMPTY,\n\toutput = STRING,\n\tfullform = false,\n\tfullforms = [],\n\texponent = -1,\n\troundingMethod = ROUND,\n\tprecision = 0\n} = {}) {\n\tlet e = exponent,\n\t\tnum = Number(arg),\n\t\tresult = [],\n\t\tval = 0,\n\t\tu = EMPTY;\n\n\t// Sync base & standard\n\tif (standard === SI) {\n\t\tbase = 10;\n\t\tstandard = JEDEC;\n\t} else if (standard === IEC || standard === JEDEC) {\n\t\tbase = 2;\n\t} else if (base === 2) {\n\t\tstandard = IEC;\n\t} else {\n\t\tbase = 10;\n\t\tstandard = JEDEC;\n\t}\n\n\tconst ceil = base === 10 ? 1000 : 1024,\n\t\tfull = fullform === true,\n\t\tneg = num < 0,\n\t\troundingFunc = Math[roundingMethod];\n\n\tif (typeof arg !== \"bigint\" && isNaN(arg)) {\n\t\tthrow new TypeError(INVALID_NUMBER);\n\t}\n\n\tif (typeof roundingFunc !== FUNCTION) {\n\t\tthrow new TypeError(INVALID_ROUND);\n\t}\n\n\t// Flipping a negative number to determine the size\n\tif (neg) {\n\t\tnum = -num;\n\t}\n\n\t// Determining the exponent\n\tif (e === -1 || isNaN(e)) {\n\t\te = Math.floor(Math.log(num) / Math.log(ceil));\n\n\t\tif (e < 0) {\n\t\t\te = 0;\n\t\t}\n\t}\n\n\t// Exceeding supported length, time to reduce & multiply\n\tif (e > 8) {\n\t\tif (precision > 0) {\n\t\t\tprecision += 8 - e;\n\t\t}\n\n\t\te = 8;\n\t}\n\n\tif (output === EXPONENT) {\n\t\treturn e;\n\t}\n\n\t// Zero is now a special case because bytes divide by 1\n\tif (num === 0) {\n\t\tresult[0] = 0;\n\t\tu = result[1] = STRINGS.symbol[standard][bits ? BITS : BYTES][e];\n\t} else {\n\t\tval = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));\n\n\t\tif (bits) {\n\t\t\tval = val * 8;\n\n\t\t\tif (val >= ceil && e < 8) {\n\t\t\t\tval = val / ceil;\n\t\t\t\te++;\n\t\t\t}\n\t\t}\n\n\t\tconst p = Math.pow(10, e > 0 ? round : 0);\n\t\tresult[0] = roundingFunc(val * p) / p;\n\n\t\tif (result[0] === ceil && e < 8 && exponent === -1) {\n\t\t\tresult[0] = 1;\n\t\t\te++;\n\t\t}\n\n\t\tu = result[1] = base === 10 && e === 1 ? bits ? SI_KBIT : SI_KBYTE : STRINGS.symbol[standard][bits ? BITS : BYTES][e];\n\t}\n\n\t// Decorating a 'diff'\n\tif (neg) {\n\t\tresult[0] = -result[0];\n\t}\n\n\t// Setting optional precision\n\tif (precision > 0) {\n\t\tresult[0] = result[0].toPrecision(precision);\n\t}\n\n\t// Applying custom symbol\n\tresult[1] = symbols[result[1]] || result[1];\n\n\tif (locale === true) {\n\t\tresult[0] = result[0].toLocaleString();\n\t} else if (locale.length > 0) {\n\t\tresult[0] = result[0].toLocaleString(locale, localeOptions);\n\t} else if (separator.length > 0) {\n\t\tresult[0] = result[0].toString().replace(PERIOD, separator);\n\t}\n\n\tif (pad && round > 0) {\n\t\tconst i = result[0].toString(),\n\t\t\tx = separator || ((i.match(/(\\D)/g) || []).pop() || PERIOD),\n\t\t\ttmp = i.toString().split(x),\n\t\t\ts = tmp[1] || EMPTY,\n\t\t\tl = s.length,\n\t\t\tn = round - l;\n\n\t\tresult[0] = `${tmp[0]}${x}${s.padEnd(l + n, ZERO)}`;\n\t}\n\n\tif (full) {\n\t\tresult[1] = fullforms[e] ? fullforms[e] : STRINGS.fullform[standard][e] + (bits ? BIT : BYTE) + (result[0] === 1 ? EMPTY : S);\n\t}\n\n\t// Returning Array, Object, or String (default)\n\treturn output === ARRAY ? result : output === OBJECT ? {\n\t\tvalue: result[0],\n\t\tsymbol: result[1],\n\t\texponent: e,\n\t\tunit: u\n\t} : result.join(spacer);\n}\n\n/**\n * Creates a partially applied version of filesize with preset options\n * @param {Object} [options={}] - Default options to apply to the returned function\n * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes\n * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter\n * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto)\n * @param {number} [options.round=2] - Number of decimal places to round to\n * @param {string|boolean} [options.locale=\"\"] - Locale for number formatting, true for system locale\n * @param {Object} [options.localeOptions={}] - Additional options for locale formatting\n * @param {string} [options.separator=\"\"] - Custom decimal separator\n * @param {string} [options.spacer=\" \"] - String to separate value and unit\n * @param {Object} [options.symbols={}] - Custom unit symbols\n * @param {string} [options.standard=\"\"] - Unit standard to use (SI, IEC, JEDEC)\n * @param {string} [options.output=\"string\"] - Output format: \"string\", \"array\", \"object\", or \"exponent\"\n * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations\n * @param {Array} [options.fullforms=[]] - Custom full unit names\n * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto)\n * @param {string} [options.roundingMethod=\"round\"] - Math rounding method to use\n * @param {number} [options.precision=0] - Number of significant digits (0 for auto)\n * @returns {Function} A function that takes a file size and returns formatted output\n * @example\n * const formatBytes = partial({round: 1, standard: \"IEC\"});\n * formatBytes(1024) // \"1.0 KiB\"\n * formatBytes(2048) // \"2.0 KiB\"\n */\n// Partial application for functional programming\nexport function partial ({\n\tbits = false,\n\tpad = false,\n\tbase = -1,\n\tround = 2,\n\tlocale = EMPTY,\n\tlocaleOptions = {},\n\tseparator = EMPTY,\n\tspacer = SPACE,\n\tsymbols = {},\n\tstandard = EMPTY,\n\toutput = STRING,\n\tfullform = false,\n\tfullforms = [],\n\texponent = -1,\n\troundingMethod = ROUND,\n\tprecision = 0\n} = {}) {\n\treturn arg => filesize(arg, {\n\t\tbits,\n\t\tpad,\n\t\tbase,\n\t\tround,\n\t\tlocale,\n\t\tlocaleOptions,\n\t\tseparator,\n\t\tspacer,\n\t\tsymbols,\n\t\tstandard,\n\t\toutput,\n\t\tfullform,\n\t\tfullforms,\n\t\texponent,\n\t\troundingMethod,\n\t\tprecision\n\t});\n}\n"],"names":["JEDEC","BITS","BYTES","STRING","ROUND","EMPTY","STRINGS","symbol","iec","bits","bytes","jedec","fullform","filesize","arg","pad","base","round","locale","localeOptions","separator","spacer","symbols","standard","output","fullforms","exponent","roundingMethod","precision","e","num","Number","result","val","u","ceil","full","neg","roundingFunc","Math","isNaN","TypeError","floor","log","pow","p","toPrecision","toLocaleString","length","toString","replace","i","x","match","pop","tmp","split","s","l","n","padEnd","value","unit","join","partial"],"mappings":";;;;AACO,MAKMA,EAAQ,QAKRC,EAAO,OAEPC,EAAQ,QAQRC,EAAS,SAITC,EAAQ,QAGRC,EAAQ,GAORC,EAAU,CACtBC,OAAQ,CACPC,IAAK,CACJC,KAAM,CAAC,MAAO,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,SAC7EC,MAAO,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAE/DC,MAAO,CACNF,KAAM,CAAC,MAAO,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QACtEC,MAAO,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QAGzDE,SAAU,CACTJ,IAAK,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAClEG,MAAO,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAO,QAAS,WCK/D,SAASE,EAAUC,GAAKL,KAC9BA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAASb,GAAKc,cACdA,EAAgB,CAAA,EAAEC,UAClBA,EAAYf,GAAKgB,OACjBA,ED9BoB,IC8BNC,QACdA,EAAU,CAAA,EAAEC,SACZA,EAAWlB,GAAKmB,OAChBA,EAASrB,EAAMS,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiBvB,EAAKwB,UACtBA,EAAY,GACT,IACH,IAAIC,EAAIH,EACPI,EAAMC,OAAOjB,GACbkB,EAAS,GACTC,EAAM,EACNC,EAAI7B,EDpEY,OCuEbkB,GACHP,EAAO,GACPO,EAAWvB,GD3EM,QC4EPuB,GAAoBA,IAAavB,EAC3CgB,EAAO,EACY,IAATA,EACVO,ED/EiB,OCiFjBP,EAAO,GACPO,EAAWvB,GAGZ,MAAMmC,EAAgB,KAATnB,EAAc,IAAO,KACjCoB,GAAoB,IAAbxB,EACPyB,EAAMP,EAAM,EACZQ,EAAeC,KAAKZ,GAErB,GAAmB,iBAARb,GAAoB0B,MAAM1B,GACpC,MAAM,IAAI2B,UD/FkB,kBCkG7B,GDhFuB,mBCgFZH,EACV,MAAM,IAAIG,UDlGiB,2BC4H5B,GAtBIJ,IACHP,GAAOA,KAIE,IAAND,GAAYW,MAAMX,MACrBA,EAAIU,KAAKG,MAAMH,KAAKI,IAAIb,GAAOS,KAAKI,IAAIR,IAEpCN,EAAI,IACPA,EAAI,IAKFA,EAAI,IACHD,EAAY,IACfA,GAAa,EAAIC,GAGlBA,EAAI,GDnGkB,aCsGnBL,EACH,OAAOK,EAIR,GAAY,IAARC,EACHE,EAAO,GAAK,EACZE,EAAIF,EAAO,GAAK1B,EAAQC,OAAOgB,GAAUd,EAAOR,EAAOC,GAAO2B,OACxD,CACNI,EAAMH,GAAgB,IAATd,EAAauB,KAAKK,IAAI,EAAO,GAAJf,GAAUU,KAAKK,IAAI,IAAMf,IAE3DpB,IACHwB,GAAY,EAERA,GAAOE,GAAQN,EAAI,IACtBI,GAAYE,EACZN,MAIF,MAAMgB,EAAIN,KAAKK,IAAI,GAAIf,EAAI,EAAIZ,EAAQ,GACvCe,EAAO,GAAKM,EAAaL,EAAMY,GAAKA,EAEhCb,EAAO,KAAOG,GAAQN,EAAI,QAAKH,IAClCM,EAAO,GAAK,EACZH,KAGDK,EAAIF,EAAO,GAAc,KAAThB,GAAqB,IAANa,EAAUpB,ED5IpB,OACC,KC2I+CH,EAAQC,OAAOgB,GAAUd,EAAOR,EAAOC,GAAO2B,EACpH,CAuBA,GApBIQ,IACHL,EAAO,IAAMA,EAAO,IAIjBJ,EAAY,IACfI,EAAO,GAAKA,EAAO,GAAGc,YAAYlB,IAInCI,EAAO,GAAKV,EAAQU,EAAO,KAAOA,EAAO,IAE1B,IAAXd,EACHc,EAAO,GAAKA,EAAO,GAAGe,iBACZ7B,EAAO8B,OAAS,EAC1BhB,EAAO,GAAKA,EAAO,GAAGe,eAAe7B,EAAQC,GACnCC,EAAU4B,OAAS,IAC7BhB,EAAO,GAAKA,EAAO,GAAGiB,WAAWC,QDlJb,ICkJ6B9B,IAG9CL,GAAOE,EAAQ,EAAG,CACrB,MAAMkC,EAAKnB,EAAO,GAAGiB,WACpBG,EAAIhC,IAAe+B,EAAEE,MAAM,UAAY,IAAIC,ODvJxB,ICwJnBC,EAAMJ,EAAEF,WAAWO,MAAMJ,GACzBK,EAAIF,EAAI,IAAMlD,EACdqD,EAAID,EAAET,OACNW,EAAI1C,EAAQyC,EAEb1B,EAAO,GAAK,GAAGuB,EAAI,KAAKH,IAAIK,EAAEG,OAAOF,EAAIC,ED1JvB,MC2JnB,CAOA,OALIvB,IACHJ,EAAO,GAAKP,EAAUI,GAAKJ,EAAUI,GAAKvB,EAAQM,SAASW,GAAUM,IAAMpB,EDpL1D,MAEC,SCkL6F,IAAduB,EAAO,GAAW3B,EDhKpG,MAZI,UCgLbmB,EAAmBQ,ED9KL,WC8KcR,EAAoB,CACtDqC,MAAO7B,EAAO,GACdzB,OAAQyB,EAAO,GACfN,SAAUG,EACViC,KAAM5B,GACHF,EAAO+B,KAAK1C,EACjB,CA4BO,SAAS2C,GAASvD,KACxBA,GAAO,EAAKM,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAASb,GAAKc,cACdA,EAAgB,CAAA,EAAEC,UAClBA,EAAYf,GAAKgB,OACjBA,ED7MoB,IC6MNC,QACdA,EAAU,CAAA,EAAEC,SACZA,EAAWlB,GAAKmB,OAChBA,EAASrB,EAAMS,SACfA,GAAW,EAAKa,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiBvB,EAAKwB,UACtBA,EAAY,GACT,IACH,OAAOd,GAAOD,EAASC,EAAK,CAC3BL,OACAM,MACAC,OACAC,QACAC,SACAC,gBACAC,YACAC,SACAC,UACAC,WACAC,SACAZ,WACAa,YACAC,WACAC,iBACAC,aAEF,QAAAf,cAAAmD"} \ No newline at end of file diff --git a/dist/filesize.esm.js b/dist/filesize.umd.js similarity index 52% rename from dist/filesize.esm.js rename to dist/filesize.umd.js index ecb6216..42d1e66 100644 --- a/dist/filesize.esm.js +++ b/dist/filesize.umd.js @@ -1,32 +1,45 @@ /** * filesize * - * @copyright 2024 Jason Mulligan + * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.6 + * @version 11.0.0 */ -const ARRAY = "array"; +(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';// Error Messages +const INVALID_NUMBER = "Invalid number"; +const INVALID_ROUND = "Invalid rounding method"; + +// Standard Types +const IEC = "iec"; +const JEDEC = "jedec"; +const SI = "si"; + +// Unit Types const BIT = "bit"; const BITS = "bits"; const BYTE = "byte"; const BYTES = "bytes"; -const EMPTY = ""; -const EXPONENT = "exponent"; +const SI_KBIT = "kbit"; +const SI_KBYTE = "kB"; + +// Output Format Types +const ARRAY = "array"; const FUNCTION = "function"; -const IEC = "iec"; -const INVALID_NUMBER = "Invalid number"; -const INVALID_ROUND = "Invalid rounding method"; -const JEDEC = "jedec"; const OBJECT = "object"; -const PERIOD = "."; +const STRING = "string"; + +// Processing Constants +const EXPONENT = "exponent"; const ROUND = "round"; + +// Special Characters and Values +const EMPTY = ""; +const PERIOD = "."; const S = "s"; -const SI = "si"; -const SI_KBIT = "kbit"; -const SI_KBYTE = "kB"; const SPACE = " "; -const STRING = "string"; const ZERO = "0"; + +// Data Structures const STRINGS = { symbol: { iec: { @@ -42,7 +55,34 @@ const STRINGS = { iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"], jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"] } -};function filesize (arg, { +};/** + * Converts a file size in bytes to a human-readable string with appropriate units + * @param {number|bigint} arg - The file size in bytes to convert + * @param {Object} [options={}] - Configuration options for formatting + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {string|Array|Object|number} Formatted file size based on output option + * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid + * @example + * filesize(1024) // "1 KB" + * filesize(1024, {bits: true}) // "8 Kb" + * filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"} + */ +function filesize (arg, { bits = false, pad = false, base = -1, @@ -191,6 +231,31 @@ const STRINGS = { } : result.join(spacer); } +/** + * Creates a partially applied version of filesize with preset options + * @param {Object} [options={}] - Default options to apply to the returned function + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {Function} A function that takes a file size and returns formatted output + * @example + * const formatBytes = partial({round: 1, standard: "IEC"}); + * formatBytes(1024) // "1.0 KiB" + * formatBytes(2048) // "2.0 KiB" + */ // Partial application for functional programming function partial ({ bits = false, @@ -228,4 +293,4 @@ function partial ({ roundingMethod, precision }); -}export{filesize,partial}; \ No newline at end of file +}exports.filesize=filesize;exports.partial=partial;})); \ No newline at end of file diff --git a/dist/filesize.umd.min.js b/dist/filesize.umd.min.js new file mode 100644 index 0000000..e3a5a08 --- /dev/null +++ b/dist/filesize.umd.min.js @@ -0,0 +1,5 @@ +/*! + 2025 Jason Mulligan + @version 11.0.0 +*/ +!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).filesize={})}(this,function(t){"use strict";const i="jedec",e="bits",o="bytes",n="string",r="round",s="",l={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function a(t,{bits:a=!1,pad:b=!1,base:p=-1,round:f=2,locale:u="",localeOptions:c={},separator:d="",spacer:g=" ",symbols:m={},standard:y="",output:h=n,fullform:B=!1,fullforms:M=[],exponent:x=-1,roundingMethod:T=r,precision:w=0}={}){let E=x,j=Number(t),N=[],P=0,S=s;"si"===y?(p=10,y=i):"iec"===y||y===i?p=2:2===p?y="iec":(p=10,y=i);const k=10===p?1e3:1024,z=!0===B,G=j<0,K=Math[T];if("bigint"!=typeof t&&isNaN(t))throw new TypeError("Invalid number");if("function"!=typeof K)throw new TypeError("Invalid rounding method");if(G&&(j=-j),(-1===E||isNaN(E))&&(E=Math.floor(Math.log(j)/Math.log(k)),E<0&&(E=0)),E>8&&(w>0&&(w+=8-E),E=8),"exponent"===h)return E;if(0===j)N[0]=0,S=N[1]=l.symbol[y][a?e:o][E];else{P=j/(2===p?Math.pow(2,10*E):Math.pow(1e3,E)),a&&(P*=8,P>=k&&E<8&&(P/=k,E++));const t=Math.pow(10,E>0?f:0);N[0]=K(P*t)/t,N[0]===k&&E<8&&-1===x&&(N[0]=1,E++),S=N[1]=10===p&&1===E?a?"kbit":"kB":l.symbol[y][a?e:o][E]}if(G&&(N[0]=-N[0]),w>0&&(N[0]=N[0].toPrecision(w)),N[1]=m[N[1]]||N[1],!0===u?N[0]=N[0].toLocaleString():u.length>0?N[0]=N[0].toLocaleString(u,c):d.length>0&&(N[0]=N[0].toString().replace(".",d)),b&&f>0){const t=N[0].toString(),i=d||(t.match(/(\D)/g)||[]).pop()||".",e=t.toString().split(i),o=e[1]||s,n=o.length,r=f-n;N[0]=`${e[0]}${i}${o.padEnd(n+r,"0")}`}return z&&(N[1]=M[E]?M[E]:l.fullform[y][E]+(a?"bit":"byte")+(1===N[0]?s:"s")),"array"===h?N:"object"===h?{value:N[0],symbol:N[1],exponent:E,unit:S}:N.join(g)}t.filesize=a,t.partial=function({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:s="",localeOptions:l={},separator:b="",spacer:p=" ",symbols:f={},standard:u="",output:c=n,fullform:d=!1,fullforms:g=[],exponent:m=-1,roundingMethod:y=r,precision:h=0}={}){return n=>a(n,{bits:t,pad:i,base:e,round:o,locale:s,localeOptions:l,separator:b,spacer:p,symbols:f,standard:u,output:c,fullform:d,fullforms:g,exponent:m,roundingMethod:y,precision:h})}});//# sourceMappingURL=filesize.umd.min.js.map diff --git a/dist/filesize.umd.min.js.map b/dist/filesize.umd.min.js.map new file mode 100644 index 0000000..610e7d9 --- /dev/null +++ b/dist/filesize.umd.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filesize.umd.min.js","sources":["../src/constants.js","../src/filesize.js"],"sourcesContent":["// Error Messages\nexport const INVALID_NUMBER = \"Invalid number\";\nexport const INVALID_ROUND = \"Invalid rounding method\";\n\n// Standard Types\nexport const IEC = \"iec\";\nexport const JEDEC = \"jedec\";\nexport const SI = \"si\";\n\n// Unit Types\nexport const BIT = \"bit\";\nexport const BITS = \"bits\";\nexport const BYTE = \"byte\";\nexport const BYTES = \"bytes\";\nexport const SI_KBIT = \"kbit\";\nexport const SI_KBYTE = \"kB\";\n\n// Output Format Types\nexport const ARRAY = \"array\";\nexport const FUNCTION = \"function\";\nexport const OBJECT = \"object\";\nexport const STRING = \"string\";\n\n// Processing Constants\nexport const EXPONENT = \"exponent\";\nexport const ROUND = \"round\";\n\n// Special Characters and Values\nexport const EMPTY = \"\";\nexport const PERIOD = \".\";\nexport const S = \"s\";\nexport const SPACE = \" \";\nexport const ZERO = \"0\";\n\n// Data Structures\nexport const STRINGS = {\n\tsymbol: {\n\t\tiec: {\n\t\t\tbits: [\"bit\", \"Kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"],\n\t\t\tbytes: [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"]\n\t\t},\n\t\tjedec: {\n\t\t\tbits: [\"bit\", \"Kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"],\n\t\t\tbytes: [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n\t\t}\n\t},\n\tfullform: {\n\t\tiec: [\"\", \"kibi\", \"mebi\", \"gibi\", \"tebi\", \"pebi\", \"exbi\", \"zebi\", \"yobi\"],\n\t\tjedec: [\"\", \"kilo\", \"mega\", \"giga\", \"tera\", \"peta\", \"exa\", \"zetta\", \"yotta\"]\n\t}\n};\n","import {\n\tARRAY,\n\tBIT,\n\tBITS,\n\tBYTE,\n\tBYTES,\n\tEMPTY,\n\tEXPONENT,\n\tFUNCTION,\n\tIEC,\n\tINVALID_NUMBER,\n\tINVALID_ROUND,\n\tJEDEC,\n\tOBJECT,\n\tPERIOD,\n\tROUND,\n\tS,\n\tSI,\n\tSI_KBIT,\n\tSI_KBYTE,\n\tSPACE,\n\tSTRING,\n\tSTRINGS,\n\tZERO\n} from \"./constants\";\n\n/**\n * Converts a file size in bytes to a human-readable string with appropriate units\n * @param {number|bigint} arg - The file size in bytes to convert\n * @param {Object} [options={}] - Configuration options for formatting\n * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes\n * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter\n * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto)\n * @param {number} [options.round=2] - Number of decimal places to round to\n * @param {string|boolean} [options.locale=\"\"] - Locale for number formatting, true for system locale\n * @param {Object} [options.localeOptions={}] - Additional options for locale formatting\n * @param {string} [options.separator=\"\"] - Custom decimal separator\n * @param {string} [options.spacer=\" \"] - String to separate value and unit\n * @param {Object} [options.symbols={}] - Custom unit symbols\n * @param {string} [options.standard=\"\"] - Unit standard to use (SI, IEC, JEDEC)\n * @param {string} [options.output=\"string\"] - Output format: \"string\", \"array\", \"object\", or \"exponent\"\n * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations\n * @param {Array} [options.fullforms=[]] - Custom full unit names\n * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto)\n * @param {string} [options.roundingMethod=\"round\"] - Math rounding method to use\n * @param {number} [options.precision=0] - Number of significant digits (0 for auto)\n * @returns {string|Array|Object|number} Formatted file size based on output option\n * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid\n * @example\n * filesize(1024) // \"1 KB\"\n * filesize(1024, {bits: true}) // \"8 Kb\"\n * filesize(1024, {output: \"object\"}) // {value: 1, symbol: \"KB\", exponent: 1, unit: \"KB\"}\n */\nexport function filesize (arg, {\n\tbits = false,\n\tpad = false,\n\tbase = -1,\n\tround = 2,\n\tlocale = EMPTY,\n\tlocaleOptions = {},\n\tseparator = EMPTY,\n\tspacer = SPACE,\n\tsymbols = {},\n\tstandard = EMPTY,\n\toutput = STRING,\n\tfullform = false,\n\tfullforms = [],\n\texponent = -1,\n\troundingMethod = ROUND,\n\tprecision = 0\n} = {}) {\n\tlet e = exponent,\n\t\tnum = Number(arg),\n\t\tresult = [],\n\t\tval = 0,\n\t\tu = EMPTY;\n\n\t// Sync base & standard\n\tif (standard === SI) {\n\t\tbase = 10;\n\t\tstandard = JEDEC;\n\t} else if (standard === IEC || standard === JEDEC) {\n\t\tbase = 2;\n\t} else if (base === 2) {\n\t\tstandard = IEC;\n\t} else {\n\t\tbase = 10;\n\t\tstandard = JEDEC;\n\t}\n\n\tconst ceil = base === 10 ? 1000 : 1024,\n\t\tfull = fullform === true,\n\t\tneg = num < 0,\n\t\troundingFunc = Math[roundingMethod];\n\n\tif (typeof arg !== \"bigint\" && isNaN(arg)) {\n\t\tthrow new TypeError(INVALID_NUMBER);\n\t}\n\n\tif (typeof roundingFunc !== FUNCTION) {\n\t\tthrow new TypeError(INVALID_ROUND);\n\t}\n\n\t// Flipping a negative number to determine the size\n\tif (neg) {\n\t\tnum = -num;\n\t}\n\n\t// Determining the exponent\n\tif (e === -1 || isNaN(e)) {\n\t\te = Math.floor(Math.log(num) / Math.log(ceil));\n\n\t\tif (e < 0) {\n\t\t\te = 0;\n\t\t}\n\t}\n\n\t// Exceeding supported length, time to reduce & multiply\n\tif (e > 8) {\n\t\tif (precision > 0) {\n\t\t\tprecision += 8 - e;\n\t\t}\n\n\t\te = 8;\n\t}\n\n\tif (output === EXPONENT) {\n\t\treturn e;\n\t}\n\n\t// Zero is now a special case because bytes divide by 1\n\tif (num === 0) {\n\t\tresult[0] = 0;\n\t\tu = result[1] = STRINGS.symbol[standard][bits ? BITS : BYTES][e];\n\t} else {\n\t\tval = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));\n\n\t\tif (bits) {\n\t\t\tval = val * 8;\n\n\t\t\tif (val >= ceil && e < 8) {\n\t\t\t\tval = val / ceil;\n\t\t\t\te++;\n\t\t\t}\n\t\t}\n\n\t\tconst p = Math.pow(10, e > 0 ? round : 0);\n\t\tresult[0] = roundingFunc(val * p) / p;\n\n\t\tif (result[0] === ceil && e < 8 && exponent === -1) {\n\t\t\tresult[0] = 1;\n\t\t\te++;\n\t\t}\n\n\t\tu = result[1] = base === 10 && e === 1 ? bits ? SI_KBIT : SI_KBYTE : STRINGS.symbol[standard][bits ? BITS : BYTES][e];\n\t}\n\n\t// Decorating a 'diff'\n\tif (neg) {\n\t\tresult[0] = -result[0];\n\t}\n\n\t// Setting optional precision\n\tif (precision > 0) {\n\t\tresult[0] = result[0].toPrecision(precision);\n\t}\n\n\t// Applying custom symbol\n\tresult[1] = symbols[result[1]] || result[1];\n\n\tif (locale === true) {\n\t\tresult[0] = result[0].toLocaleString();\n\t} else if (locale.length > 0) {\n\t\tresult[0] = result[0].toLocaleString(locale, localeOptions);\n\t} else if (separator.length > 0) {\n\t\tresult[0] = result[0].toString().replace(PERIOD, separator);\n\t}\n\n\tif (pad && round > 0) {\n\t\tconst i = result[0].toString(),\n\t\t\tx = separator || ((i.match(/(\\D)/g) || []).pop() || PERIOD),\n\t\t\ttmp = i.toString().split(x),\n\t\t\ts = tmp[1] || EMPTY,\n\t\t\tl = s.length,\n\t\t\tn = round - l;\n\n\t\tresult[0] = `${tmp[0]}${x}${s.padEnd(l + n, ZERO)}`;\n\t}\n\n\tif (full) {\n\t\tresult[1] = fullforms[e] ? fullforms[e] : STRINGS.fullform[standard][e] + (bits ? BIT : BYTE) + (result[0] === 1 ? EMPTY : S);\n\t}\n\n\t// Returning Array, Object, or String (default)\n\treturn output === ARRAY ? result : output === OBJECT ? {\n\t\tvalue: result[0],\n\t\tsymbol: result[1],\n\t\texponent: e,\n\t\tunit: u\n\t} : result.join(spacer);\n}\n\n/**\n * Creates a partially applied version of filesize with preset options\n * @param {Object} [options={}] - Default options to apply to the returned function\n * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes\n * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter\n * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto)\n * @param {number} [options.round=2] - Number of decimal places to round to\n * @param {string|boolean} [options.locale=\"\"] - Locale for number formatting, true for system locale\n * @param {Object} [options.localeOptions={}] - Additional options for locale formatting\n * @param {string} [options.separator=\"\"] - Custom decimal separator\n * @param {string} [options.spacer=\" \"] - String to separate value and unit\n * @param {Object} [options.symbols={}] - Custom unit symbols\n * @param {string} [options.standard=\"\"] - Unit standard to use (SI, IEC, JEDEC)\n * @param {string} [options.output=\"string\"] - Output format: \"string\", \"array\", \"object\", or \"exponent\"\n * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations\n * @param {Array} [options.fullforms=[]] - Custom full unit names\n * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto)\n * @param {string} [options.roundingMethod=\"round\"] - Math rounding method to use\n * @param {number} [options.precision=0] - Number of significant digits (0 for auto)\n * @returns {Function} A function that takes a file size and returns formatted output\n * @example\n * const formatBytes = partial({round: 1, standard: \"IEC\"});\n * formatBytes(1024) // \"1.0 KiB\"\n * formatBytes(2048) // \"2.0 KiB\"\n */\n// Partial application for functional programming\nexport function partial ({\n\tbits = false,\n\tpad = false,\n\tbase = -1,\n\tround = 2,\n\tlocale = EMPTY,\n\tlocaleOptions = {},\n\tseparator = EMPTY,\n\tspacer = SPACE,\n\tsymbols = {},\n\tstandard = EMPTY,\n\toutput = STRING,\n\tfullform = false,\n\tfullforms = [],\n\texponent = -1,\n\troundingMethod = ROUND,\n\tprecision = 0\n} = {}) {\n\treturn arg => filesize(arg, {\n\t\tbits,\n\t\tpad,\n\t\tbase,\n\t\tround,\n\t\tlocale,\n\t\tlocaleOptions,\n\t\tseparator,\n\t\tspacer,\n\t\tsymbols,\n\t\tstandard,\n\t\toutput,\n\t\tfullform,\n\t\tfullforms,\n\t\texponent,\n\t\troundingMethod,\n\t\tprecision\n\t});\n}\n"],"names":["g","f","exports","module","define","amd","globalThis","self","filesize","this","JEDEC","BITS","BYTES","STRING","ROUND","EMPTY","STRINGS","symbol","iec","bits","bytes","jedec","fullform","arg","pad","base","round","locale","localeOptions","separator","spacer","symbols","standard","output","fullforms","exponent","roundingMethod","precision","e","num","Number","result","val","u","ceil","full","neg","roundingFunc","Math","isNaN","TypeError","floor","log","pow","p","toPrecision","toLocaleString","length","toString","replace","i","x","match","pop","tmp","split","s","l","n","padEnd","value","unit","join","partial"],"mappings":";;;;CAAA,SAAAA,EAAAC,GAAA,iBAAAC,SAAA,oBAAAC,OAAAF,EAAAC,SAAA,mBAAAE,QAAAA,OAAAC,IAAAD,OAAA,CAAA,WAAAH,GAAAA,GAAAD,EAAA,oBAAAM,WAAAA,WAAAN,GAAAO,MAAAC,SAAA,CAAA,EAAA,CAAA,CAAAC,KAAA,SAAAP,GAAA,aACO,MAKMQ,EAAQ,QAKRC,EAAO,OAEPC,EAAQ,QAQRC,EAAS,SAITC,EAAQ,QAGRC,EAAQ,GAORC,EAAU,CACtBC,OAAQ,CACPC,IAAK,CACJC,KAAM,CAAC,MAAO,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,QAAS,SAC7EC,MAAO,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAE/DC,MAAO,CACNF,KAAM,CAAC,MAAO,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QACtEC,MAAO,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QAGzDE,SAAU,CACTJ,IAAK,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAClEG,MAAO,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAO,QAAS,WCK/D,SAASb,EAAUe,GAAKJ,KAC9BA,GAAO,EAAKK,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAASZ,GAAKa,cACdA,EAAgB,CAAA,EAAEC,UAClBA,EAAYd,GAAKe,OACjBA,ED9BoB,IC8BNC,QACdA,EAAU,CAAA,EAAEC,SACZA,EAAWjB,GAAKkB,OAChBA,EAASpB,EAAMS,SACfA,GAAW,EAAKY,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiBtB,EAAKuB,UACtBA,EAAY,GACT,IACH,IAAIC,EAAIH,EACPI,EAAMC,OAAOjB,GACbkB,EAAS,GACTC,EAAM,EACNC,EAAI5B,EDpEY,OCuEbiB,GACHP,EAAO,GACPO,EAAWtB,GD3EM,QC4EPsB,GAAoBA,IAAatB,EAC3Ce,EAAO,EACY,IAATA,EACVO,ED/EiB,OCiFjBP,EAAO,GACPO,EAAWtB,GAGZ,MAAMkC,EAAgB,KAATnB,EAAc,IAAO,KACjCoB,GAAoB,IAAbvB,EACPwB,EAAMP,EAAM,EACZQ,EAAeC,KAAKZ,GAErB,GAAmB,iBAARb,GAAoB0B,MAAM1B,GACpC,MAAM,IAAI2B,UD/FkB,kBCkG7B,GDhFuB,mBCgFZH,EACV,MAAM,IAAIG,UDlGiB,2BC4H5B,GAtBIJ,IACHP,GAAOA,KAIE,IAAND,GAAYW,MAAMX,MACrBA,EAAIU,KAAKG,MAAMH,KAAKI,IAAIb,GAAOS,KAAKI,IAAIR,IAEpCN,EAAI,IACPA,EAAI,IAKFA,EAAI,IACHD,EAAY,IACfA,GAAa,EAAIC,GAGlBA,EAAI,GDnGkB,aCsGnBL,EACH,OAAOK,EAIR,GAAY,IAARC,EACHE,EAAO,GAAK,EACZE,EAAIF,EAAO,GAAKzB,EAAQC,OAAOe,GAAUb,EAAOR,EAAOC,GAAO0B,OACxD,CACNI,EAAMH,GAAgB,IAATd,EAAauB,KAAKK,IAAI,EAAO,GAAJf,GAAUU,KAAKK,IAAI,IAAMf,IAE3DnB,IACHuB,GAAY,EAERA,GAAOE,GAAQN,EAAI,IACtBI,GAAYE,EACZN,MAIF,MAAMgB,EAAIN,KAAKK,IAAI,GAAIf,EAAI,EAAIZ,EAAQ,GACvCe,EAAO,GAAKM,EAAaL,EAAMY,GAAKA,EAEhCb,EAAO,KAAOG,GAAQN,EAAI,QAAKH,IAClCM,EAAO,GAAK,EACZH,KAGDK,EAAIF,EAAO,GAAc,KAAThB,GAAqB,IAANa,EAAUnB,ED5IpB,OACC,KC2I+CH,EAAQC,OAAOe,GAAUb,EAAOR,EAAOC,GAAO0B,EACpH,CAuBA,GApBIQ,IACHL,EAAO,IAAMA,EAAO,IAIjBJ,EAAY,IACfI,EAAO,GAAKA,EAAO,GAAGc,YAAYlB,IAInCI,EAAO,GAAKV,EAAQU,EAAO,KAAOA,EAAO,IAE1B,IAAXd,EACHc,EAAO,GAAKA,EAAO,GAAGe,iBACZ7B,EAAO8B,OAAS,EAC1BhB,EAAO,GAAKA,EAAO,GAAGe,eAAe7B,EAAQC,GACnCC,EAAU4B,OAAS,IAC7BhB,EAAO,GAAKA,EAAO,GAAGiB,WAAWC,QDlJb,ICkJ6B9B,IAG9CL,GAAOE,EAAQ,EAAG,CACrB,MAAMkC,EAAKnB,EAAO,GAAGiB,WACpBG,EAAIhC,IAAe+B,EAAEE,MAAM,UAAY,IAAIC,ODvJxB,ICwJnBC,EAAMJ,EAAEF,WAAWO,MAAMJ,GACzBK,EAAIF,EAAI,IAAMjD,EACdoD,EAAID,EAAET,OACNW,EAAI1C,EAAQyC,EAEb1B,EAAO,GAAK,GAAGuB,EAAI,KAAKH,IAAIK,EAAEG,OAAOF,EAAIC,ED1JvB,MC2JnB,CAOA,OALIvB,IACHJ,EAAO,GAAKP,EAAUI,GAAKJ,EAAUI,GAAKtB,EAAQM,SAASU,GAAUM,IAAMnB,EDpL1D,MAEC,SCkL6F,IAAdsB,EAAO,GAAW1B,EDhKpG,MAZI,UCgLbkB,EAAmBQ,ED9KL,WC8KcR,EAAoB,CACtDqC,MAAO7B,EAAO,GACdxB,OAAQwB,EAAO,GACfN,SAAUG,EACViC,KAAM5B,GACHF,EAAO+B,KAAK1C,EACjB,CAgEA5B,EAAAM,SAAAA,EAAAN,EAAAuE,QApCO,UAAkBtD,KACxBA,GAAO,EAAKK,IACZA,GAAM,EAAKC,KACXA,GAAO,EAAEC,MACTA,EAAQ,EAACC,OACTA,EAASZ,GAAKa,cACdA,EAAgB,CAAA,EAAEC,UAClBA,EAAYd,GAAKe,OACjBA,ED7MoB,IC6MNC,QACdA,EAAU,CAAA,EAAEC,SACZA,EAAWjB,GAAKkB,OAChBA,EAASpB,EAAMS,SACfA,GAAW,EAAKY,UAChBA,EAAY,GAAEC,SACdA,GAAW,EAAEC,eACbA,EAAiBtB,EAAKuB,UACtBA,EAAY,GACT,IACH,OAAOd,GAAOf,EAASe,EAAK,CAC3BJ,OACAK,MACAC,OACAC,QACAC,SACAC,gBACAC,YACAC,SACAC,UACAC,WACAC,SACAX,WACAY,YACAC,WACAC,iBACAC,aAEF,CAAA"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d260848..bb6f365 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,448 +1,40 @@ { "name": "filesize", - "version": "10.1.6", + "version": "11.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "filesize", - "version": "10.1.6", + "version": "11.0.0", "license": "BSD-3-Clause", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "auto-changelog": "^2.4.0", - "eslint": "^9.6.0", - "husky": "^9.0.11", - "mocha": "^10.6.0", - "nyc": "^17.0.0", - "rollup": "^4.18.1", - "typescript": "^5.5.3" + "auto-changelog": "^2.5.0", + "eslint": "^9.30.1", + "husky": "^9.1.7", + "mocha": "^11.7.1", + "rollup": "^4.44.2" }, "engines": { "node": ">= 10.4.0" } }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.24.7", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.7.tgz", - "integrity": "sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.7.tgz", - "integrity": "sha512-nykK+LEK86ahTkX/3TgauT0ikKoNCfKHEaZYTUVupJdTLzGNvrblu4u6fa7DhZONAltdf8e662t/abY8idrd/g==", - "dev": true, - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.24.7", - "@babel/helper-compilation-targets": "^7.24.7", - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helpers": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/template": "^7.24.7", - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/generator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz", - "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.24.7", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.7.tgz", - "integrity": "sha512-ctSdRHBi20qWOfy27RUb4Fhp07KSJ3sXcuSvTrXrc4aG8NSYDo1ici3Vhg9bg69y5bj0Mr1lh0aeEgTvc12rMg==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.24.7", - "@babel/helper-validator-option": "^7.24.7", - "browserslist": "^4.22.2", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", - "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", - "dev": true, - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", - "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", - "dev": true, - "dependencies": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", - "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", - "dev": true, - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", - "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", - "dev": true, - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.7.tgz", - "integrity": "sha512-1fuJEwIrp+97rM4RWdO+qrRsZlAeL1lQJoPqtCYWv0NL115XM93hIH4CSRln2w52SqvmY5hqdtauB6QFCDiZNQ==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", - "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", - "dev": true, - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", - "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", - "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz", - "integrity": "sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.7.tgz", - "integrity": "sha512-NlmJJtvcw72yRJRcnCmGvSi+3jDEg8qFu3z0AFoymmzLx5ERVWyzd9kVXr7Th9/8yIJi2Zc6av4Tqz3wFs8QWg==", - "dev": true, - "dependencies": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/template": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", - "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz", - "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", - "@babel/helper-hoist-variables": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/types": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", - "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", "dev": true, + "license": "MIT", "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, + "funding": { + "url": "https://opencollective.com/eslint" + }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } @@ -452,6 +44,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -460,21 +53,23 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", - "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/config-array": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.0.tgz", - "integrity": "sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^2.1.4", + "@eslint/object-schema": "^2.1.6", "debug": "^4.3.1", "minimatch": "^3.1.2" }, @@ -482,11 +77,35 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@eslint/config-helpers": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz", + "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -506,169 +125,148 @@ } }, "node_modules/@eslint/js": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.6.0.tgz", - "integrity": "sha512-D9B0/3vNg44ZeWbYMpBoXqNP4j6eQD5vNwIlGAuFRRzK/WtT/jvDQW3Bi9kkf3PMDMlM7Yi+73VLUsn5bJcl8A==", + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.30.1.tgz", + "integrity": "sha512-zXhuECFlyep42KZUhWjfvsmXGX39W8K8LFb8AWXM9gSV9dQB+MrJGLKvW6Zw0Ggnbpw0VHTtrhFXYe3Gym18jg==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" } }, "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "node_modules/@eslint/plugin-kit": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.3.tgz", + "integrity": "sha512-1+WqvgNMhmlAambTvT3KPtCl/Ibr68VldY2XY40SL1CE0ZXiakFR/cbTspaF5HsnpDMvcYYoJHfl4980NBjGag==", "dev": true, - "engines": { - "node": ">=12.22" + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.15.1", + "levn": "^0.4.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", - "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", - "dev": true, "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.1.tgz", + "integrity": "sha512-bkOp+iumZCCbt1K1CmWf0R9pM5yKpDv+ZXtvSyQpudrI9kuFLp+bM2WOPXImuD/ceQuaa8f5pj93Y7zyECIGNA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" + "@types/json-schema": "^7.0.15" }, "engines": { - "node": ">=8" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" }, "engines": { - "node": ">=8" + "node": ">=18.18.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, + "license": "Apache-2.0", "engines": { - "node": ">=8" + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, + "license": "Apache-2.0", "engines": { - "node": ">=6" + "node": ">=18.18" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", "dependencies": { - "p-limit": "^2.2.0" + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" }, "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" + "node": ">=12" } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { @@ -676,78 +274,49 @@ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/source-map": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", - "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.10.tgz", + "integrity": "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, + "license": "MIT", + "optional": true, "engines": { - "node": ">= 8" + "node": ">=14" } }, "node_modules/@rollup/plugin-terser": { @@ -755,6 +324,7 @@ "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", "dev": true, + "license": "MIT", "dependencies": { "serialize-javascript": "^6.0.1", "smob": "^1.0.0", @@ -773,224 +343,305 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", - "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.44.2.tgz", + "integrity": "sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", - "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.44.2.tgz", + "integrity": "sha512-Yt5MKrOosSbSaAK5Y4J+vSiID57sOvpBNBR6K7xAaQvk3MkcNVV0f9fE20T+41WYN8hDn6SGFlFrKudtx4EoxA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", - "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.44.2.tgz", + "integrity": "sha512-EsnFot9ZieM35YNA26nhbLTJBHD0jTwWpPwmRVDzjylQT6gkar+zenfb8mHxWpRrbn+WytRRjE0WKsfaxBkVUA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", - "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.44.2.tgz", + "integrity": "sha512-dv/t1t1RkCvJdWWxQ2lWOO+b7cMsVw5YFaS04oHpZRWehI1h0fV1gF4wgGCTyQHHjJDfbNpwOi6PXEafRBBezw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.44.2.tgz", + "integrity": "sha512-W4tt4BLorKND4qeHElxDoim0+BsprFTwb+vriVQnFFtT/P6v/xO5I99xvYnVzKWrK6j7Hb0yp3x7V5LUbaeOMg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.44.2.tgz", + "integrity": "sha512-tdT1PHopokkuBVyHjvYehnIe20fxibxFCEhQP/96MDSOcyjM/shlTkZZLOufV3qO6/FQOSiJTBebhVc12JyPTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", - "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.44.2.tgz", + "integrity": "sha512-+xmiDGGaSfIIOXMzkhJ++Oa0Gwvl9oXUeIiwarsdRXSe27HUIvjbSIpPxvnNsRebsNdUo7uAiQVgBD1hVriwSQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", - "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.44.2.tgz", + "integrity": "sha512-bDHvhzOfORk3wt8yxIra8N4k/N0MnKInCW5OGZaeDYa/hMrdPaJzo7CSkjKZqX4JFUWjUGm88lI6QJLCM7lDrA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", - "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.44.2.tgz", + "integrity": "sha512-NMsDEsDiYghTbeZWEGnNi4F0hSbGnsuOG+VnNvxkKg0IGDvFh7UVpM/14mnMwxRxUf9AdAVJgHPvKXf6FpMB7A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", - "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.44.2.tgz", + "integrity": "sha512-lb5bxXnxXglVq+7imxykIp5xMq+idehfl+wOgiiix0191av84OqbjUED+PRC5OA8eFJYj5xAGcpAZ0pF2MnW+A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.44.2.tgz", + "integrity": "sha512-Yl5Rdpf9pIc4GW1PmkUGHdMtbx0fBLE1//SxDmuf3X0dUC57+zMepow2LK0V21661cjXdTn8hO2tXDdAWAqE5g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", - "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.44.2.tgz", + "integrity": "sha512-03vUDH+w55s680YYryyr78jsO1RWU9ocRMaeV2vMniJJW/6HhoTBwyyiiTPVHNWLnhsnwcQ0oH3S9JSBEKuyqw==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", - "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.44.2.tgz", + "integrity": "sha512-iYtAqBg5eEMG4dEfVlkqo05xMOk6y/JXIToRca2bAWuqjrJYJlx/I7+Z+4hSrsWU8GdJDFPL4ktV3dy4yBSrzg==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.44.2.tgz", + "integrity": "sha512-e6vEbgaaqz2yEHqtkPXa28fFuBGmUJ0N2dOJK8YUfijejInt9gfCSA7YDdJ4nYlv67JfP3+PSWFX4IVw/xRIPg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", - "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.44.2.tgz", + "integrity": "sha512-evFOtkmVdY3udE+0QKrV5wBx7bKI0iHz5yEVx5WqDJkxp9YQefy4Mpx3RajIVcM6o7jxTvVd/qpC1IXUhGc1Mw==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", - "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.44.2.tgz", + "integrity": "sha512-/bXb0bEsWMyEkIsUL2Yt5nFB5naLAwyOWMEviQfQY1x3l5WsLKgvZf66TM7UTfED6erckUVUJQ/jJ1FSpm3pRQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", - "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.44.2.tgz", + "integrity": "sha512-3D3OB1vSSBXmkGEZR27uiMRNiwN08/RVAcBKwhUYPaiZ8bcvdeEwWPvbnXvvXHY+A/7xluzcN+kaiOFNiOZwWg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", - "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.44.2.tgz", + "integrity": "sha512-VfU0fsMK+rwdK8mwODqYeM2hDrF2WiHaSmCBrS7gColkQft95/8tphyzv2EupVxn3iE0FI78wzffoULH1G+dkw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", - "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.44.2.tgz", + "integrity": "sha512-+qMUrkbUurpE6DVRjiJCNGZBGo9xM4Y0FXU5cjgudWqIBWbcLkjE3XprJUsOFgC6xjBClwVa9k6O3A7K3vxb5Q==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", - "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.2.tgz", + "integrity": "sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1003,28 +654,17 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1036,22 +676,17 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/ansi-styles": { @@ -1059,6 +694,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1069,53 +705,25 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/append-transform": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", - "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", - "dev": true, - "dependencies": { - "default-require-extensions": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", - "dev": true - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "dev": true, + "license": "Python-2.0" }, "node_modules/auto-changelog": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", - "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.0.tgz", + "integrity": "sha512-UTnLjT7I9U2U/xkCUH5buDlp8C7g0SGChfib+iDrJkamcj5kaMqNKHNfbKJw1kthJUq8sUo3i3q2S6FzO/l/wA==", "dev": true, + "license": "MIT", "dependencies": { "commander": "^7.2.0", "handlebars": "^4.7.7", + "import-cwd": "^3.0.0", "node-fetch": "^2.6.1", - "parse-github-url": "^1.0.2", + "parse-github-url": "^1.0.3", "semver": "^7.3.5" }, "bin": { @@ -1129,144 +737,63 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/browserslist": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", - "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001629", - "electron-to-chromium": "^1.4.796", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.16" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } + "license": "ISC" }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "node_modules/caching-transform": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", - "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", "dev": true, - "dependencies": { - "hasha": "^5.0.0", - "make-dir": "^3.0.0", - "package-hash": "^4.0.0", - "write-file-atomic": "^3.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "MIT" }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001640", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz", - "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1279,59 +806,97 @@ } }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, + "license": "MIT", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, "funding": { "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "engines": { + "node": ">=12" } }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { - "is-glob": "^4.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/color-convert": { @@ -1339,6 +904,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1350,40 +916,32 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1394,12 +952,13 @@ } }, "node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1411,67 +970,55 @@ } }, "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/default-require-extensions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz", - "integrity": "sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==", "dev": true, - "dependencies": { - "strip-bom": "^4.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, "node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/electron-to-chromium": { - "version": "1.4.819", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.819.tgz", - "integrity": "sha512-8RwI6gKUokbHWcN3iRij/qpvf/wCbIVY5slODi85werwqUQwpFXM+dvUBND93Qh7SB0pW3Hlq3/wZsqQ3M9Jaw==", - "dev": true + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "dev": true + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -1481,6 +1028,7 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -1489,27 +1037,33 @@ } }, "node_modules/eslint": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.6.0.tgz", - "integrity": "sha512-ElQkdLMEEqQNM9Njff+2Y4q2afHk7JpkPvrd7Xh7xefwgQynqPxwf55J7di9+MEibWUGdNjFF9ITG9Pck5M84w==", + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.30.1.tgz", + "integrity": "sha512-zmxXPNMOXmwm9E0yQLi5uqXHs7uq2UIiqEKo3Gq+3fwo1XrJ+hijAZImyF7hclW3E6oHz43Yk3RP8at6OTKflQ==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/config-array": "^0.17.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.6.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.0", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.30.1", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.3.0", - "@nodelib/fs.walk": "^1.2.8", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.0.1", - "eslint-visitor-keys": "^4.0.0", - "espree": "^10.1.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1519,15 +1073,11 @@ "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" @@ -1537,13 +1087,22 @@ }, "funding": { "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-scope": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.1.tgz", - "integrity": "sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -1556,10 +1115,11 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", - "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -1568,14 +1128,15 @@ } }, "node_modules/espree": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", - "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.12.0", + "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1584,24 +1145,12 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/esquery": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -1614,6 +1163,7 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -1626,6 +1176,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -1635,6 +1186,7 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } @@ -1643,34 +1195,29 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } + "license": "MIT" }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, + "license": "MIT", "dependencies": { "flat-cache": "^4.0.0" }, @@ -1678,40 +1225,12 @@ "node": ">=16.0.0" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", - "dev": true, - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -1728,6 +1247,7 @@ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, + "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } @@ -1737,6 +1257,7 @@ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, + "license": "MIT", "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" @@ -1746,56 +1267,36 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", - "dev": true + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" }, "node_modules/foreground-child": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", - "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", "dev": true, + "license": "ISC", "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^3.0.2" + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/fromentries": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", - "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1804,48 +1305,32 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, + "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">=12" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -1856,6 +1341,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, @@ -1864,24 +1350,29 @@ } }, "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/globals": { @@ -1889,6 +1380,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -1896,17 +1388,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dev": true, + "license": "MIT", "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", @@ -1928,48 +1415,29 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/hasha": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", - "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", - "dev": true, - "dependencies": { - "is-stream": "^2.0.0", - "type-fest": "^0.8.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true, + "license": "MIT", "bin": { "he": "bin/he" } }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, "node_modules/husky": { - "version": "9.0.11", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", - "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", "dev": true, + "license": "MIT", "bin": { - "husky": "bin.mjs" + "husky": "bin.js" }, "engines": { "node": ">=18" @@ -1979,19 +1447,34 @@ } }, "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, + "node_modules/import-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", + "integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "import-from": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, + "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -2003,51 +1486,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "node_modules/import-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz", + "integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==", "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, "engines": { "node": ">=8" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "node_modules/import-from/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.8.19" } }, "node_modules/is-extglob": { @@ -2055,6 +1524,7 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2064,6 +1534,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -2073,6 +1544,7 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -2080,56 +1552,22 @@ "node": ">=0.10.0" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true - }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -2137,142 +1575,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-hook": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", - "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", - "dev": true, - "dependencies": { - "append-transform": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", - "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", - "dev": true, - "dependencies": { - "@babel/core": "^7.23.9", - "@babel/parser": "^7.23.9", - "@istanbuljs/schema": "^0.1.3", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-processinfo": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", - "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==", - "dev": true, - "dependencies": { - "archy": "^1.0.0", - "cross-spawn": "^7.0.3", - "istanbul-lib-coverage": "^3.2.0", - "p-map": "^3.0.0", - "rimraf": "^3.0.0", - "uuid": "^8.3.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - } + "license": "ISC" }, - "node_modules/istanbul-lib-report/node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" + "@isaacs/cliui": "^8.0.2" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", - "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" + "url": "https://github.com/sponsors/isaacs" }, - "engines": { - "node": ">=8" + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -2280,53 +1611,33 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } + "license": "MIT" }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, + "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } @@ -2336,6 +1647,7 @@ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -2349,6 +1661,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^5.0.0" }, @@ -2359,23 +1672,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", - "dev": true - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -2388,43 +1697,18 @@ } }, "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "bin": { - "semver": "bin/semver.js" - } + "license": "ISC" }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2437,348 +1721,139 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mocha": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.6.0.tgz", - "integrity": "sha512-hxjt4+EEB0SA0ZDygSS015t65lJw/I2yRCS3Ae+SJ5FrbzrXgfYwJr96f0OvIXdj7h4lv/vLCrH3rkiuizFSvw==", + "version": "11.7.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.1.tgz", + "integrity": "sha512-5EK+Cty6KheMS/YLPPMJC64g5V61gIR25KsRItHw6x4hEKT6Njp1n9LOlH4gpevuwMVS66SXaBBpg+RWZkza4A==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", - "chokidar": "^3.5.3", + "chokidar": "^4.0.1", "debug": "^4.3.5", - "diff": "^5.2.0", + "diff": "^7.0.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", - "glob": "^8.1.0", + "glob": "^10.4.5", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", - "minimatch": "^5.1.6", + "minimatch": "^9.0.5", "ms": "^2.1.3", + "picocolors": "^1.1.1", "serialize-javascript": "^6.0.2", "strip-json-comments": "^3.1.1", "supports-color": "^8.1.1", - "workerpool": "^6.5.1", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9", + "workerpool": "^9.2.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1", "yargs-unparser": "^2.0.0" }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - } - }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-preload": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", - "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", - "dev": true, - "dependencies": { - "process-on-spawn": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/node-releases": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", - "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", - "dev": true - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nyc": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-17.0.0.tgz", - "integrity": "sha512-ISp44nqNCaPugLLGGfknzQwSwt10SSS5IMoPR7GLoMAyS18Iw5js8U7ga2VF9lYuMZ42gOHr3UddZw4WZltxKg==", - "dev": true, - "dependencies": { - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "caching-transform": "^4.0.0", - "convert-source-map": "^1.7.0", - "decamelize": "^1.2.0", - "find-cache-dir": "^3.2.0", - "find-up": "^4.1.0", - "foreground-child": "^2.0.0", - "get-package-type": "^0.1.0", - "glob": "^7.1.6", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-hook": "^3.0.0", - "istanbul-lib-instrument": "^6.0.2", - "istanbul-lib-processinfo": "^2.0.2", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "make-dir": "^3.0.0", - "node-preload": "^0.2.1", - "p-map": "^3.0.0", - "process-on-spawn": "^1.0.0", - "resolve-from": "^5.0.0", - "rimraf": "^3.0.0", - "signal-exit": "^3.0.2", - "spawn-wrap": "^2.0.0", - "test-exclude": "^6.0.0", - "yargs": "^15.0.2" - }, - "bin": { - "nyc": "bin/nyc.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/nyc/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/nyc/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nyc/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/nyc/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" + "balanced-match": "^1.0.0" } }, - "node_modules/nyc/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/mocha/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { - "p-try": "^2.0.0" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=6" + "node": ">=16 || 14 >=14.17" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/nyc/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { - "p-limit": "^2.2.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/nyc/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/nyc/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nyc/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true + "license": "MIT" }, - "node_modules/nyc/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/nyc/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, + "license": "MIT", "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" + "whatwg-url": "^5.0.0" }, "engines": { - "node": ">=6" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/optionator": { @@ -2786,6 +1861,7 @@ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, + "license": "MIT", "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -2803,6 +1879,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -2818,6 +1895,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^3.0.2" }, @@ -2828,47 +1906,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", - "dev": true, - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-hash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", - "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true, - "dependencies": { - "graceful-fs": "^4.1.15", - "hasha": "^5.0.0", - "lodash.flattendeep": "^4.4.0", - "release-zalgo": "^1.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "BlueOak-1.0.0" }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, + "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -2881,6 +1931,7 @@ "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.3.tgz", "integrity": "sha512-tfalY5/4SqGaV/GIGzWyHnFjlpTPTNpENR9Ea2lLldSJ8EWXMsvacWucqY3m3I4YPtas15IxTLQVQ5NSYXPrww==", "dev": true, + "license": "MIT", "bin": { "parse-github-url": "cli.js" }, @@ -2893,191 +1944,87 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "p-try": "^2.0.0" + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=6" + "node": ">=16 || 14 >=14.18" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } + "license": "ISC" }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } }, - "node_modules/process-on-spawn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", - "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", - "dev": true, - "dependencies": { - "fromentries": "^1.2.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, + "license": "MIT", "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/release-zalgo": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", - "integrity": "sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA==", - "dev": true, - "dependencies": { - "es6-error": "^4.0.1" + "node": ">= 14.18.0" }, - "engines": { - "node": ">=4" + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, "node_modules/require-directory": { @@ -3085,128 +2032,59 @@ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rollup": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", - "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.22.4", - "@rollup/rollup-android-arm64": "4.22.4", - "@rollup/rollup-darwin-arm64": "4.22.4", - "@rollup/rollup-darwin-x64": "4.22.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", - "@rollup/rollup-linux-arm-musleabihf": "4.22.4", - "@rollup/rollup-linux-arm64-gnu": "4.22.4", - "@rollup/rollup-linux-arm64-musl": "4.22.4", - "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", - "@rollup/rollup-linux-riscv64-gnu": "4.22.4", - "@rollup/rollup-linux-s390x-gnu": "4.22.4", - "@rollup/rollup-linux-x64-gnu": "4.22.4", - "@rollup/rollup-linux-x64-musl": "4.22.4", - "@rollup/rollup-win32-arm64-msvc": "4.22.4", - "@rollup/rollup-win32-ia32-msvc": "4.22.4", - "@rollup/rollup-win32-x64-msvc": "4.22.4", - "fsevents": "~2.3.2" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/rollup": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.44.2.tgz", + "integrity": "sha512-PVoapzTwSEcelaWGth3uR66u7ZRo6qhPHc0f2uRO9fX6XDVNrIiGYS0Pj9+R8yIIYSD/mCx2b16Ws9itljKSPg==", + "dev": true, + "license": "MIT", "dependencies": { - "queue-microtask": "^1.2.2" + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.44.2", + "@rollup/rollup-android-arm64": "4.44.2", + "@rollup/rollup-darwin-arm64": "4.44.2", + "@rollup/rollup-darwin-x64": "4.44.2", + "@rollup/rollup-freebsd-arm64": "4.44.2", + "@rollup/rollup-freebsd-x64": "4.44.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.44.2", + "@rollup/rollup-linux-arm-musleabihf": "4.44.2", + "@rollup/rollup-linux-arm64-gnu": "4.44.2", + "@rollup/rollup-linux-arm64-musl": "4.44.2", + "@rollup/rollup-linux-loongarch64-gnu": "4.44.2", + "@rollup/rollup-linux-powerpc64le-gnu": "4.44.2", + "@rollup/rollup-linux-riscv64-gnu": "4.44.2", + "@rollup/rollup-linux-riscv64-musl": "4.44.2", + "@rollup/rollup-linux-s390x-gnu": "4.44.2", + "@rollup/rollup-linux-x64-gnu": "4.44.2", + "@rollup/rollup-linux-x64-musl": "4.44.2", + "@rollup/rollup-win32-arm64-msvc": "4.44.2", + "@rollup/rollup-win32-ia32-msvc": "4.44.2", + "@rollup/rollup-win32-x64-msvc": "4.44.2", + "fsevents": "~2.3.2" } }, "node_modules/safe-buffer": { @@ -3227,13 +2105,15 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -3246,21 +2126,17 @@ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" }, @@ -3273,27 +2149,37 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/smob": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -3303,39 +2189,37 @@ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "node_modules/spawn-wrap": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", - "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { - "foreground-child": "^2.0.0", - "is-windows": "^1.0.2", - "make-dir": "^3.0.0", - "rimraf": "^3.0.0", - "signal-exit": "^3.0.2", - "which": "^2.0.1" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "node_modules/string-width": { + "node_modules/string-width-cjs": { + "name": "string-width", "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -3345,11 +2229,59 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -3357,11 +2289,12 @@ "node": ">=8" } }, - "node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3371,6 +2304,7 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -3383,6 +2317,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3391,13 +2326,14 @@ } }, "node_modules/terser": { - "version": "5.31.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.1.tgz", - "integrity": "sha512-37upzU1+viGvuFtBo9NPufCb9dwM0+l9hMxYyWfBA+fbwrPqNJAhbZ6W47bBFnZHKHTUBnMvi87434qq+qnxOg==", + "version": "5.43.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", + "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", + "acorn": "^8.14.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -3412,81 +2348,22 @@ "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/test-exclude/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } + "license": "MIT" }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" }, @@ -3494,42 +2371,12 @@ "node": ">= 0.8.0" } }, - "node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/typescript": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", - "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/uglify-js": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.18.0.tgz", - "integrity": "sha512-SyVVbcNBCk0dzr9XL/R/ySrmYf0s372K6/hFklzgcp2lBFyXtw4I7BOdDjlLhE1aVqaI/SHWXWmYdlZxuyF38A==", + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "bin": { "uglifyjs": "bin/uglifyjs" @@ -3538,65 +2385,29 @@ "node": ">=0.8.0" } }, - "node_modules/update-browserslist-db": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", - "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, + "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -3607,6 +2418,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -3617,17 +2429,12 @@ "node": ">= 8" } }, - "node_modules/which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", - "dev": true - }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3636,19 +2443,41 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/workerpool": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", - "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", - "dev": true + "version": "9.3.3", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.3.tgz", + "integrity": "sha512-slxCaKbYjEdFT/o2rH9xS1hf4uRDch1w7Uo+apxhZ+sf/1d9e0ZVkn42kPNGP2dgjIx6YFvSevj0zHvbWe2jdw==", + "dev": true, + "license": "Apache-2.0" }, "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -3661,22 +2490,62 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/y18n": { @@ -3684,41 +2553,38 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, + "license": "MIT", "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.1.1" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true, + "license": "ISC", "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-unparser": { @@ -3726,6 +2592,7 @@ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, + "license": "MIT", "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", @@ -3736,28 +2603,49 @@ "node": ">=10" } }, - "node_modules/yargs-unparser/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/yargs-unparser/node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, "engines": { - "node": ">=10" + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=8" } }, "node_modules/yocto-queue": { @@ -3765,6 +2653,7 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, diff --git a/package.json b/package.json index 5c65897..ba75488 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "filesize", "description": "JavaScript library to generate a human readable String describing the file size", - "version": "10.1.6", + "version": "11.0.0", "homepage": "https://filesizejs.com", "author": "Jason Mulligan ", "repository": { @@ -12,41 +12,40 @@ "url": "https://github.com/avoidwork/filesize.js/issues" }, "files": [ + "dist/filesize.js", "dist/filesize.cjs", - "dist/filesize.esm.js", - "types/filesize.d.ts" + "types" ], "license": "BSD-3-Clause", + "source": "src/filesize.js", "main": "dist/filesize.cjs", - "module": "dist/filesize.esm.js", - "types": "types/filesize.d.ts", + "exports": { + "types": "./types/filesize.d.ts", + "import": "./dist/filesize.js", + "require": "./dist/filesize.cjs" + }, "type": "module", - "sourceType": "module", + "types": "types/filesize.d.ts", "engines": { "node": ">= 10.4.0" }, "scripts": { "build": "npm run rollup", "changelog": "auto-changelog -p", - "coverage": "nyc npm run test", - "lint": "eslint *.js src/*.js test/*.js", - "fix": "eslint --fix *.js src/*.js test/*.js", - "mocha": "nyc mocha test/*.js", + "lint": "eslint *.js src/*.js tests/**/*.js", + "fix": "eslint --fix *.js src/*.js tests/**/*.js", + "mocha": "mocha tests/**/*.js", "rollup": "rollup --config", "test": "npm run lint && npm run mocha", - "test-webpack": "mkdir -p test/webpack && rm -rf test/webpack/* && git clone git@github.com:rabelais88/typescript-webpack.git test/webpack && echo \"import { filesize } from 'filesize';console.log(filesize(1234));\" >> test/webpack/src/index.ts && cd test/webpack && npm install && mkdir -p node_modules/filesize/dist && cp ../../package.json node_modules/filesize/ && cp ../../dist/* node_modules/filesize/dist/ && npm run build", - "types": "npx -p typescript tsc src/*.js --declaration --allowJs --emitDeclarationOnly --outDir types", "prepare": "husky" }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "auto-changelog": "^2.4.0", - "eslint": "^9.6.0", - "husky": "^9.0.11", - "mocha": "^10.6.0", - "nyc": "^17.0.0", - "rollup": "^4.18.1", - "typescript": "^5.5.3" + "auto-changelog": "^2.5.0", + "eslint": "^9.30.1", + "husky": "^9.1.7", + "mocha": "^11.7.1", + "rollup": "^4.44.2" }, "keywords": [ "file", diff --git a/rollup.config.js b/rollup.config.js index 744dcec..e38fe0d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,5 @@ import terser from "@rollup/plugin-terser"; -import {createRequire} from "node:module"; +import { createRequire } from "node:module"; const require = createRequire(import.meta.url); const pkg = require("./package.json"); const year = new Date().getFullYear(); @@ -31,22 +31,22 @@ export default [ }, { ...esmOutBase, - file: `dist/${pkg.name}.esm.js` + file: `dist/${pkg.name}.js` }, { ...esmOutBase, ...minOutBase, - file: `dist/${pkg.name}.esm.min.js` + file: `dist/${pkg.name}.min.js` }, { ...umdOutBase, - file: `dist/${pkg.name}.js`, + file: `dist/${pkg.name}.umd.js`, name: "filesize" }, { ...umdOutBase, ...minOutBase, - file: `dist/${pkg.name}.min.js`, + file: `dist/${pkg.name}.umd.min.js`, name: "filesize" } ] diff --git a/src/constants.js b/src/constants.js index a3769ff..a6c6c9f 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,25 +1,38 @@ -export const ARRAY = "array"; +// Error Messages +export const INVALID_NUMBER = "Invalid number"; +export const INVALID_ROUND = "Invalid rounding method"; + +// Standard Types +export const IEC = "iec"; +export const JEDEC = "jedec"; +export const SI = "si"; + +// Unit Types export const BIT = "bit"; export const BITS = "bits"; export const BYTE = "byte"; export const BYTES = "bytes"; -export const EMPTY = ""; -export const EXPONENT = "exponent"; +export const SI_KBIT = "kbit"; +export const SI_KBYTE = "kB"; + +// Output Format Types +export const ARRAY = "array"; export const FUNCTION = "function"; -export const IEC = "iec"; -export const INVALID_NUMBER = "Invalid number"; -export const INVALID_ROUND = "Invalid rounding method"; -export const JEDEC = "jedec"; export const OBJECT = "object"; -export const PERIOD = "."; +export const STRING = "string"; + +// Processing Constants +export const EXPONENT = "exponent"; export const ROUND = "round"; + +// Special Characters and Values +export const EMPTY = ""; +export const PERIOD = "."; export const S = "s"; -export const SI = "si"; -export const SI_KBIT = "kbit"; -export const SI_KBYTE = "kB"; export const SPACE = " "; -export const STRING = "string"; export const ZERO = "0"; + +// Data Structures export const STRINGS = { symbol: { iec: { diff --git a/src/filesize.js b/src/filesize.js index de316b0..fc998ee 100644 --- a/src/filesize.js +++ b/src/filesize.js @@ -24,6 +24,33 @@ import { ZERO } from "./constants"; +/** + * Converts a file size in bytes to a human-readable string with appropriate units + * @param {number|bigint} arg - The file size in bytes to convert + * @param {Object} [options={}] - Configuration options for formatting + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {string|Array|Object|number} Formatted file size based on output option + * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid + * @example + * filesize(1024) // "1 KB" + * filesize(1024, {bits: true}) // "8 Kb" + * filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"} + */ export function filesize (arg, { bits = false, pad = false, @@ -173,6 +200,31 @@ export function filesize (arg, { } : result.join(spacer); } +/** + * Creates a partially applied version of filesize with preset options + * @param {Object} [options={}] - Default options to apply to the returned function + * @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes + * @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter + * @param {number} [options.base=-1] - Number base (2 for binary, 10 for decimal, -1 for auto) + * @param {number} [options.round=2] - Number of decimal places to round to + * @param {string|boolean} [options.locale=""] - Locale for number formatting, true for system locale + * @param {Object} [options.localeOptions={}] - Additional options for locale formatting + * @param {string} [options.separator=""] - Custom decimal separator + * @param {string} [options.spacer=" "] - String to separate value and unit + * @param {Object} [options.symbols={}] - Custom unit symbols + * @param {string} [options.standard=""] - Unit standard to use (SI, IEC, JEDEC) + * @param {string} [options.output="string"] - Output format: "string", "array", "object", or "exponent" + * @param {boolean} [options.fullform=false] - If true, uses full unit names instead of abbreviations + * @param {Array} [options.fullforms=[]] - Custom full unit names + * @param {number} [options.exponent=-1] - Force specific exponent (-1 for auto) + * @param {string} [options.roundingMethod="round"] - Math rounding method to use + * @param {number} [options.precision=0] - Number of significant digits (0 for auto) + * @returns {Function} A function that takes a file size and returns formatted output + * @example + * const formatBytes = partial({round: 1, standard: "IEC"}); + * formatBytes(1024) // "1.0 KiB" + * formatBytes(2048) // "2.0 KiB" + */ // Partial application for functional programming export function partial ({ bits = false, diff --git a/test/filesize_test.js b/test/filesize_test.js deleted file mode 100644 index b9f3665..0000000 --- a/test/filesize_test.js +++ /dev/null @@ -1,312 +0,0 @@ -import assert from "node:assert"; -import {filesize, partial} from "../dist/filesize.cjs"; - -describe("Testing functionality", function () { - beforeEach(function () { - this.kilobit = 500; - this.edgecase = 1023; - this.kibibyte = 1024; - this.petabyte = 1125899906842620; - this.neg = -1024; - this.byte = 1; - this.zero = 0; - this.invld = "abc"; - this.huge = 10e40; - this.small = 1 / 8; - this.bigint = BigInt(this.kibibyte); - this.bigintBig = BigInt("123422222222222222222222222222222222222"); - }); - - it("It should pass base2 tests", function () { - assert.strictEqual(filesize(this.kilobit, {base: 2}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, round: 1}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, round: 1, spacer: ""}), "500B", "Should be '500B'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, round: 1, bits: true}), "3.9 Kibit", "Should be '3.9 Kibit'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, bits: true}), "3.91 Kibit", "Should be '3.91 Kibit'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, bits: true, output: "array"})[0], 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.kilobit, {base: 2, bits: true, output: "object"}).value, 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.edgecase, {base: 2}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.edgecase, {base: 2, round: 1}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2}), "1 KiB", "Should be '1 KiB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, round: 1}), "1 KiB", "Should be '1 KiB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, round: 1, spacer: ""}), "1KiB", "Should be '1KiB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, bits: true}), "8 Kibit", "Should be '8 Kibit'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, round: 1, bits: true}), "8 Kibit", "Should be '8 Kibit'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, exponent: 0}), "1024 B", "Should be '1024 B'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, exponent: 0, output: "object"}).unit, "B", "Should be 'B'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, output: "exponent"}), 1, "Should be '1'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, output: "object"}).unit, "KiB", "Should be 'KiB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", output: "object"}).unit, "KiB", "Should be 'KiB'"); - assert.strictEqual(filesize(this.neg, {base: 2}), "-1 KiB", "Should be '-1 KiB'"); - assert.strictEqual(filesize(this.neg, {base: 2, round: 1}), "-1 KiB", "Should be '-1 KiB'"); - assert.strictEqual(filesize(this.neg, {base: 2, round: 1, spacer: ""}), "-1KiB", "Should be '-1KiB'"); - assert.strictEqual(filesize(this.neg, {base: 2, bits: true}), "-8 Kibit", "Should be '-8 Kibit'"); - assert.strictEqual(filesize(this.neg, {base: 2, round: 1, bits: true}), "-8 Kibit", "Should be '-8 Kibit'"); - assert.strictEqual(filesize(this.byte, {base: 2}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {base: 2, round: 1}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {base: 2, round: 1, spacer: ""}), "1B", "Should be '1B'"); - assert.strictEqual(filesize(this.byte, {base: 2, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.byte, {base: 2, round: 1, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.zero, {base: 2}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {base: 2, round: 1}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {base: 2, round: 1, spacer: ""}), "0B", "Should be '0B'"); - assert.strictEqual(filesize(this.zero, {base: 2, bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.zero, {base: 2, round: 1, bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.huge, {base: 2}), "82718061255302770 YiB", "Should be '82718061255302770 YiB'"); - assert.strictEqual(filesize(this.huge, {base: 2, bits: true}), "661744490042422100 Yibit", "Should be '661744490042422100 Yibit'"); - assert.strictEqual(filesize(this.small, {base: 2}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.small, {base: 2, bits: true}), "1 bit", "Should be '1 bit'"); - assert.strictEqual(filesize(this.petabyte, {base: 2}), "1 PiB", "Should be '1 PiB'"); - }); - - it("It should pass IEC tests", function () { - assert.strictEqual(filesize(this.kilobit, {standard: "iec"}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", round: 1}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", round: 1, spacer: ""}), "500B", "Should be '500B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", round: 1, bits: true}), "3.9 Kibit", "Should be '3.9 Kibit'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", bits: true}), "3.91 Kibit", "Should be '3.91 Kibit'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", bits: true, output: "array"})[0], 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.kilobit, {standard: "iec", bits: true, output: "object"}).value, 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.edgecase, {standard: "iec"}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.edgecase, {standard: "iec", round: 1}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec"}), "1 KiB", "Should be '1 KiB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", round: 1}), "1 KiB", "Should be '1 KiB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", round: 1, spacer: ""}), "1KiB", "Should be '1KiB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", bits: true}), "8 Kibit", "Should be '8 Kibit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", round: 1, bits: true}), "8 Kibit", "Should be '8 Kibit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", exponent: 0}), "1024 B", "Should be '1024 B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", exponent: 0, output: "object"}).unit, "B", "Should be 'B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", output: "exponent"}), 1, "Should be '1'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", output: "object"}).unit, "KiB", "Should be 'KiB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "iec", output: "object"}).unit, "KiB", "Should be 'KiB'"); - assert.strictEqual(filesize(this.neg, {standard: "iec"}), "-1 KiB", "Should be '-1 KiB'"); - assert.strictEqual(filesize(this.neg, {standard: "iec", round: 1}), "-1 KiB", "Should be '-1 KiB'"); - assert.strictEqual(filesize(this.neg, {standard: "iec", round: 1, spacer: ""}), "-1KiB", "Should be '-1KiB'"); - assert.strictEqual(filesize(this.neg, {standard: "iec", bits: true}), "-8 Kibit", "Should be '-8 Kibit'"); - assert.strictEqual(filesize(this.neg, {standard: "iec", round: 1, bits: true}), "-8 Kibit", "Should be '-8 Kibit'"); - assert.strictEqual(filesize(this.byte, {standard: "iec"}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "iec", round: 1}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "iec", round: 1, spacer: ""}), "1B", "Should be '1B'"); - assert.strictEqual(filesize(this.byte, {standard: "iec", bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.byte, {standard: "iec", round: 1, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "iec"}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "iec", round: 1}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "iec", round: 1, spacer: ""}), "0B", "Should be '0B'"); - assert.strictEqual(filesize(this.zero, {standard: "iec", bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "iec", round: 1, bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.huge, {standard: "iec"}), "82718061255302770 YiB", "Should be '82718061255302770 YiB'"); - assert.strictEqual(filesize(this.huge, {standard: "iec", bits: true}), "661744490042422100 Yibit", "Should be '661744490042422100 Yibit'"); - assert.strictEqual(filesize(this.small, {standard: "iec"}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.small, {standard: "iec", bits: true}), "1 bit", "Should be '1 bit'"); - assert.strictEqual(filesize(this.petabyte, {standard: "iec"}), "1 PiB", "Should be '1 PiB'"); - }); - - it("It should pass JEDEC tests", function () { - assert.strictEqual(filesize(this.kilobit, {standard: "jedec"}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", round: 1}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", round: 1, spacer: ""}), "500B", "Should be '500B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", round: 1, bits: true}), "3.9 Kbit", "Should be '3.9 Kbit'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", bits: true}), "3.91 Kbit", "Should be '3.91 Kbit'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", bits: true, output: "array"})[0], 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.kilobit, {standard: "jedec", bits: true, output: "object"}).value, 3.91, "Should be '3.91'"); - assert.strictEqual(filesize(this.edgecase, {standard: "jedec"}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.edgecase, {standard: "jedec", round: 1}), "1023 B", "Should be '1023 B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec"}), "1 KB", "Should be '1 KB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", round: 1}), "1 KB", "Should be '1 KB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", round: 1, spacer: ""}), "1KB", "Should be '1KB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", bits: true}), "8 Kbit", "Should be '8 Kbit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", round: 1, bits: true}), "8 Kbit", "Should be '8 Kbit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", exponent: 0}), "1024 B", "Should be '1024 B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", exponent: 0, output: "object"}).unit, "B", "Should be 'B'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", output: "exponent"}), 1, "Should be '1'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "jedec", output: "object"}).unit, "KB", "Should be 'KB'"); - assert.strictEqual(filesize(this.neg, {standard: "jedec"}), "-1 KB", "Should be '-1 KB'"); - assert.strictEqual(filesize(this.neg, {standard: "jedec", round: 1}), "-1 KB", "Should be '-1 KB'"); - assert.strictEqual(filesize(this.neg, {standard: "jedec", round: 1, spacer: ""}), "-1KB", "Should be '-1KB'"); - assert.strictEqual(filesize(this.neg, {standard: "jedec", bits: true}), "-8 Kbit", "Should be '-8 Kbit'"); - assert.strictEqual(filesize(this.neg, {standard: "jedec", round: 1, bits: true}), "-8 Kbit", "Should be '-8 Kbit'"); - assert.strictEqual(filesize(this.byte, {standard: "jedec"}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "jedec", round: 1}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "jedec", round: 1, spacer: ""}), "1B", "Should be '1B'"); - assert.strictEqual(filesize(this.byte, {standard: "jedec", bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.byte, {standard: "jedec", round: 1, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "jedec"}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "jedec", round: 1}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "jedec", round: 1, spacer: ""}), "0B", "Should be '0B'"); - assert.strictEqual(filesize(this.zero, {standard: "jedec", bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "jedec", round: 1, bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.huge, {standard: "jedec"}), "82718061255302770 YB", "Should be '82718061255302770 YB'"); - assert.strictEqual(filesize(this.huge, {standard: "jedec", bits: true}), "661744490042422100 Ybit", "Should be '661744490042422100 Ybit'"); - assert.strictEqual(filesize(this.small, {standard: "jedec"}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.small, {standard: "jedec", bits: true}), "1 bit", "Should be '1 bit'"); - assert.strictEqual(filesize(this.petabyte, {standard: "jedec"}), "1 PB", "Should be '1 PB'"); - }); - - it("It should pass base10 tests", function () { - assert.strictEqual(filesize(this.kilobit, {base: 10}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {base: 10, round: 1}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {base: 10, round: 1, spacer: ""}), "500B", "Should be '500B'"); - assert.strictEqual(filesize(this.kilobit, {base: 10, bits: true}), "4 kbit", "Should be '4 kbit'"); - assert.strictEqual(filesize(this.kilobit, {base: 10, round: 1, bits: true}), "4 kbit", "Should be '4 kbit'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10}), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, round: 1}), "1 kB", "Should be '1 kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, round: 1, spacer: ""}), "1kB", "Should be '1kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, bits: true}), "8.19 kbit", "Should be '8.19 kbit'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, round: 1, bits: true}), "8.2 kbit", "Should be '8.2 kbit'"); - assert.strictEqual(filesize(this.neg, {base: 10}), "-1.02 kB", "Should be '-1.02 kB'"); - assert.strictEqual(filesize(this.neg, {base: 10, round: 1}), "-1 kB", "Should be '-1 kB'"); - assert.strictEqual(filesize(this.neg, {base: 10, round: 1, spacer: ""}), "-1kB", "Should be '-1kB'"); - assert.strictEqual(filesize(this.neg, {base: 10, bits: true}), "-8.19 kbit", "Should be '-8.19 kbit'"); - assert.strictEqual(filesize(this.neg, {base: 10, round: 1, bits: true}), "-8.2 kbit", "Should be '-8.2 kbit'"); - assert.strictEqual(filesize(this.byte, {base: 10}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {base: 10, round: 1}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {base: 10, round: 1, spacer: ""}), "1B", "Should be '1B'"); - assert.strictEqual(filesize(this.byte, {base: 10, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.byte, {base: 10, round: 1, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.zero, {base: 10}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {base: 10, round: 1}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {base: 10, round: 1, spacer: ""}), "0B", "Should be '0B'"); - assert.strictEqual(filesize(this.zero, {base: 10, bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.zero, {base: 10, round: 1, bits: true}), "0 bit", "Should be '0 bit'"); - }); - - it("It should pass SI tests", function () { - assert.strictEqual(filesize(this.kilobit, {standard: "si"}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "si", round: 1}), "500 B", "Should be '500 B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "si", round: 1, spacer: ""}), "500B", "Should be '500B'"); - assert.strictEqual(filesize(this.kilobit, {standard: "si", bits: true}), "4 kbit", "Should be '4 kbit'"); - assert.strictEqual(filesize(this.kilobit, {standard: "si", round: 1, bits: true}), "4 kbit", "Should be '4 kbit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "si"}), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "si", round: 1}), "1 kB", "Should be '1 kB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "si", round: 1, spacer: ""}), "1kB", "Should be '1kB'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "si", bits: true}), "8.19 kbit", "Should be '8.19 kbit'"); - assert.strictEqual(filesize(this.kibibyte, {standard: "si", round: 1, bits: true}), "8.2 kbit", "Should be '8.2 kbit'"); - assert.strictEqual(filesize(this.neg, {standard: "si"}), "-1.02 kB", "Should be '-1.02 kB'"); - assert.strictEqual(filesize(this.neg, {standard: "si", round: 1}), "-1 kB", "Should be '-1 kB'"); - assert.strictEqual(filesize(this.neg, {standard: "si", round: 1, spacer: ""}), "-1kB", "Should be '-1kB'"); - assert.strictEqual(filesize(this.neg, {standard: "si", bits: true}), "-8.19 kbit", "Should be '-8.19 kbit'"); - assert.strictEqual(filesize(this.neg, {standard: "si", round: 1, bits: true}), "-8.2 kbit", "Should be '-8.2 kbit'"); - assert.strictEqual(filesize(this.byte, {standard: "si"}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "si", round: 1}), "1 B", "Should be '1 B'"); - assert.strictEqual(filesize(this.byte, {standard: "si", round: 1, spacer: ""}), "1B", "Should be '1B'"); - assert.strictEqual(filesize(this.byte, {standard: "si", bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.byte, {standard: "si", round: 1, bits: true}), "8 bit", "Should be '8 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "si"}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "si", round: 1}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(this.zero, {standard: "si", round: 1, spacer: ""}), "0B", "Should be '0B'"); - assert.strictEqual(filesize(this.zero, {standard: "si", bits: true}), "0 bit", "Should be '0 bit'"); - assert.strictEqual(filesize(this.zero, {standard: "si", round: 1, bits: true}), "0 bit", "Should be '0 bit'"); - }); - - it("It should pass invalid input tests", function () { - const input = this.invld; - assert.throws(function () { - filesize(input); - }, Error, "Should match"); - }); - - it("It should pass symbols tests", function () { - assert.strictEqual(filesize(this.byte, {base: 10, symbols: {B: "Б"}}), "1 Б", "Should be '1 Б'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, symbols: {B: "Б"}}), "1.02 kB", "Should be '1.02 kB'"); - }); - - it("It should pass partial() tests", function () { - const size = partial({base: 10, exponent: 0}); - - assert.strictEqual(size(this.kibibyte), "1024 B", "Should be '1024 B'"); - }); - - it("It should pass bits tests", function () { - assert.strictEqual(filesize(124, {bits: true, base: 10}), "992 bit", "Should be '992 bit'"); - assert.strictEqual(filesize(125, {bits: true, base: 10}), "1 kbit", "Should be '1 kbit'"); - assert.strictEqual(filesize(126, {bits: true, base: 10}), "1.01 kbit", "Should be '1.01 kbit'"); - }); - - it("It should pass full forms tests", function () { - assert.strictEqual(filesize(0, {base: 10, fullform: true}), "0 bytes", "Should be '0 bytes'"); - assert.strictEqual(filesize(0, {base: 10, fullform: true, output: "object"}).unit, "B", "Should be 'B'"); - assert.strictEqual(filesize(1, {base: 10, bits: true, fullform: true}), "8 bits", "Should be '8 bits'"); - assert.strictEqual(filesize(1, {base: 10, fullform: true}), "1 byte", "Should be '1 byte'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, fullform: true}), "1.02 kilobytes", "Should be '1.02 kilobytes'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, standard: "iec", fullform: true }), "1 kibibyte", "Should be '1 kibibyte'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2, standard: "iec", fullform: true, output: "object"}).unit, "KiB", "Should be 'KiB'"); - assert.strictEqual(filesize(this.kibibyte * 1.3, { - base: 2, - standard: "iec", - fullform: true - }), "1.3 kibibytes", "Should be '1.3 kibibytes'"); - assert.strictEqual(filesize(0, {base: 10, fullform: true, fullforms: ["байт"]}), "0 байт", "Should be '0 байт'"); - }); - - it("It should pass exponent tests", function () { - assert.strictEqual(filesize(0, {base: 10, exponent: 0}), "0 B", "Should be '0 B'"); - assert.strictEqual(filesize(0, {base: 10, exponent: 2}), "0 MB", "Should be '0 MB'"); - }); - - it("It should pass separator tests", function () { - assert.strictEqual(filesize(1040, {base: 10, separator: ""}), "1.04 kB", "Should be '1.04 kB'"); - assert.strictEqual(filesize(1040, {base: 10, separator: ","}), "1,04 kB", "Should be '1,04 kB'"); - assert.strictEqual(filesize(1040, {base: 10, separator: ",", round: 1, pad: true}), "1,0 kB", "Should be '1,0 kB'"); - }); - - it("It should pass separator tests", function () { - assert.strictEqual(filesize(1000, {base: 10, pad: true}), "1.00 kB", "Should be '1.00 kB'"); - }); - - it("It should pass locale tests", function () { - assert.strictEqual(filesize(1040, {base: 10, locale: ""}), "1.04 kB", "Should be '1.04 kB'"); - assert.strictEqual(filesize(1040, {base: 10, locale: true}), Number(1.04).toLocaleString() + " kB", "Should be '" + Number(1.04).toLocaleString() + " kB'"); - assert.strictEqual(filesize(1040, {base: 10, locale: "de"}), Number(1.04).toLocaleString("de") + " kB", "Should be '" + Number(1.04).toLocaleString("de") + " kB'"); - }); - - it("It should pass localeOptions tests", function () { - assert.strictEqual(filesize(this.kibibyte, {base: 10, locale: "de"}), Number(1.02).toLocaleString("de") + " kB", "Should be '" + Number(1.02).toLocaleString("de") + " kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, localeOptions: {minimumFractionDigits: 1}}), Number(1.02).toLocaleString(undefined, {minimumFractionDigits: 1}) + " kB", "Should be '" + Number(1.02).toLocaleString(undefined, {minimumFractionDigits: 1}) + " kB'"); - assert.strictEqual(filesize(this.kibibyte, { - base: 10, - locale: true, - localeOptions: {minimumFractionDigits: 1} - }), Number(1.02).toLocaleString(undefined, {minimumFractionDigits: 1}) + " kB", "Should be '" + Number(1.02).toLocaleString(undefined, {minimumFractionDigits: 1}) + " kB'"); - assert.strictEqual(filesize(this.kibibyte, { - base: 10, - locale: "de", - localeOptions: {minimumFractionDigits: 1} - }), Number(1.02).toLocaleString("de", {minimumFractionDigits: 1}) + " kB", "Should be '" + Number(1.02).toLocaleString("de", {minimumFractionDigits: 1}) + " kB'"); - }); - - it("It should pass roundingMethod tests", function () { - assert.strictEqual(filesize(this.kibibyte, {base: 10, roundingMethod: "round"}), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, roundingMethod: "floor"}), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 10, roundingMethod: "ceil"}), "1.03 kB", "Should be '1.03 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.333, {base: 10, roundingMethod: "round"}), "1.36 kB", "Should be '1.36 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.333, {base: 10, roundingMethod: "floor"}), "1.36 kB", "Should be '1.36 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.333, {base: 10, roundingMethod: "ceil"}), "1.37 kB", "Should be '1.37 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.456, {base: 10, round: 1, roundingMethod: "round"}), "1.5 kB", "Should be '1.5 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.456, {base: 10, round: 1, roundingMethod: "floor"}), "1.4 kB", "Should be '1.4 kB'"); - assert.strictEqual(filesize(this.kibibyte * 1.456, {base: 10, round: 1, roundingMethod: "ceil"}), "1.5 kB", "Should be '1.5 kB'"); - const input = this.kibibyte * 1.456; - assert.throws(function () { - filesize(filesize(input, {base: 10, round: 1, roundingMethod: "invalid"})); - }, Error, "Should match"); - }); - - it("It should pass precision tests", function () { - assert.strictEqual(filesize(this.kibibyte * 1, {base: 10, precision: 3}), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: 3}), "10.8 MB", "Should be '10.8 MB'"); - assert.strictEqual(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: "x"}), "10.75 MB", "Should be '10.75 MB'"); - assert.strictEqual(filesize(this.kibibyte * this.kibibyte * this.kibibyte, {base: 10, precision: 3}), "1.07 GB", "Should be '1.07 GB'"); - assert.strictEqual(filesize(Math.pow(this.kibibyte, 10), {base: 10, precision: 3}), "1e+6 YB", "Should be '1e+6 YB'"); - }); - - it("It should pass defaults tests", function () { - assert.strictEqual(filesize(this.kibibyte), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.kibibyte, {base: 2}), "1 KiB", "Should be '1 KiB'"); - }); - - it("It should pass BigInt tests", function () { - assert.strictEqual(filesize(this.bigint), "1.02 kB", "Should be '1.02 kB'"); - assert.strictEqual(filesize(this.bigint, {base: 2}), "1 KiB", "Should be '1 KiB'"); - assert.strictEqual(filesize(this.bigintBig), "123422222222222.23 YB", "Should be '123422222222222.23 YB'"); - assert.strictEqual(filesize(this.bigintBig, {base: 2}), "102092469380433.69 YiB", "Should be '102092469380433.69 YiB'"); - }); -}); From f42d58898038e69270cad89845b33e39d9cb6db9 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:10:29 -0400 Subject: [PATCH 03/10] Updating README.md --- .gitignore | 3 +- LICENSE | 2 +- README.md | 388 ++++++++++++++++++++++++++++++------ package-lock.json | 187 +++++++++++++++++ package.json | 3 +- tests/unit/filesize.test.js | 317 +++++++++++++++++++++++++++++ 6 files changed, 831 insertions(+), 69 deletions(-) create mode 100644 tests/unit/filesize.test.js diff --git a/.gitignore b/.gitignore index b156756..3200b01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .husky -.nyc_output node_modules .idea -test/webpack +coverage diff --git a/LICENSE b/LICENSE index 8aeb290..a5edba3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024, Jason Mulligan +Copyright (c) 2025, Jason Mulligan All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 92e6a7a..ee02be1 100644 --- a/README.md +++ b/README.md @@ -2,112 +2,370 @@ [![downloads](https://img.shields.io/npm/dt/filesize.svg)](https://www.npmjs.com/package/filesize) [![CDNJS version](https://img.shields.io/cdnjs/v/filesize.svg)](https://cdnjs.com/libraries/filesize) -filesize.js provides a simple way to get a human-readable file size string from a number (float or integer) or string. +A lightweight, high-performance file size utility for JavaScript that converts bytes to human-readable strings. Works in both Node.js and browser environments with comprehensive format support. + +## Installation + +```bash +npm install filesize +``` + +## Usage + +### ES Modules ```javascript import {filesize} from "filesize"; filesize(265318, {standard: "jedec"}); // "259.1 KB" ``` +### CommonJS + +```javascript +const {filesize} = require("filesize"); +filesize(1024); // "1.02 kB" +``` + +### Partial Application + +```javascript +import {partial} from "filesize"; +const size = partial({standard: "jedec"}); +size(265318); // "259.1 KB" +``` + +## Parameters + +* **input** `{Number|String|BigInt}` - The value to convert (required) +* **options** `{Object}` - Configuration object (optional) + +### Options Object + +* **base** `{Number}` - Number base, default is `10` +* **bits** `{Boolean}` - Enables `bit` sizes, default is `false` +* **exponent** `{Number}` - Specifies the symbol via exponent, e.g. `2` is `MB` for base 2, default is `-1` +* **fullform** `{Boolean}` - Enables full form of unit of measure, default is `false` +* **fullforms** `{Array}` - Array of full form overrides, default is `[]` +* **locale** `{String|Boolean}` - BCP 47 language tag to specify a locale, or `true` to use default locale, default is `""` +* **localeOptions** `{Object}` - Dictionary of options defined by ECMA-402 ([Number.prototype.toLocaleString](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)) +* **output** `{String}` - Output of function (`array`, `exponent`, `object`, or `string`), default is `string` +* **pad** `{Boolean}` - Decimal place end padding, default is `false` +* **precision** `{Number}` - Sets precision of numerical output, default is `0` +* **round** `{Number}` - Decimal place, default is `2` +* **roundingMethod** `{String}` - Rounding method, can be `round`, `floor`, or `ceil`, default is `round` +* **separator** `{String}` - Decimal separator character, default is an empty string +* **spacer** `{String}` - Character between the `result` and `symbol`, default is `" "` +* **standard** `{String}` - Standard unit of measure, can be `iec`, `jedec`, or `si`. Default is `si` (base 10) +* **symbols** `{Object}` - Dictionary of IEC/JEDEC symbols to replace for localization + +### Input Validation + +The function validates input and throws `TypeError` for invalid values: + +```javascript +// Invalid input will throw TypeError +try { + filesize("invalid"); +} catch (error) { + console.error(error.message); // "Invalid input" +} + +try { + filesize(NaN); +} catch (error) { + console.error(error.message); // "Invalid input" +} +``` + ## Testing -filesize has 100% code coverage with its tests. +filesize.js maintains **100% test coverage** across all metrics with a comprehensive test suite of 47 test cases: ```console ---------------|---------|----------|---------|---------|----------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------|---------|----------|---------|---------|----------------------- -All files | 100 | 95.52 | 100 | 100 | - filesize.cjs | 100 | 95.52 | 100 | 100 | 77-78,173,196,199,210 ---------------|---------|----------|---------|---------|----------------------- +-------------|---------|----------|---------|---------|------------------- +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +-------------|---------|----------|---------|---------|------------------- +All files | 100 | 100 | 100 | 100 | + filesize.js | 100 | 100 | 100 | 100 | +-------------|---------|----------|---------|---------|------------------- ``` -## Optional settings +### Running Tests -`filesize()` accepts an optional descriptor Object as a second argument, so you can customize the output. +```bash +# Run all tests (linting + unit tests) +npm test -### base -_*(number)*_ Number base, default is `10` +# Run only unit tests +npm run mocha +``` -### bits -_*(boolean)*_ Enables `bit` sizes, default is `false` +### Test Coverage -### exponent -_*(number)*_ Specifies the symbol via exponent, e.g. `2` is `MB` for base 2, default is `-1` +The test suite comprehensively covers: -### fullform -_*(boolean)*_ Enables full form of unit of measure, default is `false` +* **Basic functionality**: Core conversion logic and edge cases +* **Output formats**: All output types (string, array, object, exponent) +* **Standards support**: IEC, JEDEC, and SI standards with different bases +* **Bit conversion**: Bits vs bytes with auto-increment logic +* **Precision handling**: Rounding methods and decimal precision +* **Localization**: Locale formatting and custom symbols +* **Error handling**: Invalid inputs and boundary conditions +* **Partial functions**: All option combinations with curried functions -### fullforms -_*(array)*_ Array of full form overrides, default is `[]` +## API Reference -### locale (overrides 'separator') -_*(string || boolean)*_ BCP 47 language tag to specify a locale, or `true` to use default locale, default is `""` +### Functions -### localeOptions (overrides 'separator', requires string for 'locale' option) -_*(object)*_ Dictionary of options defined by ECMA-402 ([Number.prototype.toLocaleString](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)). Requires locale option to be explicitly passed as a string, otherwise is ignored. +#### filesize(input, options) -### output -_*(string)*_ Output of function (`array`, `exponent`, `object`, or `string`), default is `string` +Converts a numeric value to a human-readable file size string. -### pad -_*(boolean)*_ Decimal place end padding, default is `false` +**Parameters:** -### precision -_*(number)*_ Sets precision of numerical output, default is `0` +* `input` `{Number|String|BigInt}` - The value to convert +* `options` `{Object}` - Configuration options (optional) -### round -_*(number)*_ Decimal place, default is `2` +**Returns:** `{String|Array|Object|Number}` - Formatted size based on output option -### roundingMethod -_*(string)*_ Rounding method, can be `round`, `floor`, or `ceil`, default is `round` +```javascript +filesize(500); // "500 B" +filesize(1024, {base: 2}); // "1 KiB" +filesize(265318, {output: "array"}); // [265.32, "kB"] +``` -### separator -_*(string)*_ Decimal separator character, default is an empty string. +**See also:** partial() -### spacer -_*(string)*_ Character between the `result` and `symbol`, default is `" "` +#### partial(options) -### standard -_*(string)*_ Standard unit of measure, can be `iec`, `jedec`, or `si`. Default is `si` (base 10). The `si` option is an alias of `jedec`, such that it is not valid for other configuration options. +Creates a pre-configured filesize function with options applied. -### symbols -_*(object)*_ Dictionary of IEC/JEDEC symbols to replace for localization, defaults to english if no match is found; SI is handled automatically with JEDEC values. +**Parameters:** -## Examples +* `options` `{Object}` - Configuration options to apply + +**Returns:** `{Function}` - New function with options pre-applied + +```javascript +const formatBinary = partial({base: 2, standard: "iec"}); +formatBinary(1048576); // "1 MiB" + +const formatBits = partial({bits: true}); +formatBits(1024); // "8.19 kbit" +``` + +**See also:** filesize() + +### Output Formats + +#### String Output (default) + +```javascript +filesize(265318); // "265.32 kB" +filesize(265318, {separator: ","}); // "265,32 kB" +``` + +#### Array Output + +```javascript +filesize(265318, {output: "array"}); // [265.32, "kB"] +filesize(1024, {output: "array", base: 2}); // [1, "KiB"] +``` + +#### Object Output + +```javascript +filesize(265318, {output: "object"}); +// {value: 265.32, symbol: "kB", exponent: 1, unit: "kB"} +``` + +#### Exponent Output ```javascript -filesize(500); // "500 B" -filesize(500, {bits: true}); // "4 kbit" -filesize(265318, {base: 2}); // "259.1 KiB" -filesize(265318); // "265.32 kB" -filesize(265318, {round: 0}); // "265 kB" -filesize(265318, {output: "array"}); // [265.32, "kB"] -filesize(265318, {output: "object"}); // {value: 265.32, symbol: "kB", exponent: 1, unit: "kB"} -filesize(1, {symbols: {B: "Б"}}); // "1 Б" -filesize(1024); // "1.02 kB" -filesize(1024, {exponent: 0}); // "1024 B" filesize(1024, {output: "exponent"}); // 1 -filesize(265318, {standard: "jedec"}); // "259.1 KB" -filesize(265318, {base: 2, fullform: true}); // "259.1 kibibytes" -filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов" -filesize(265318, {separator: ","}); // "265,32 kB" -filesize(265318, {locale: "de"}); // "265,32 kB" +filesize(1048576, {output: "exponent", base: 2}); // 2 +``` + +### Standards Support + +#### SI (International System of Units) - Default + +```javascript +filesize(1000); // "1 kB" (base 10) +filesize(1000000); // "1 MB" +``` + +#### IEC (International Electrotechnical Commission) + +```javascript +filesize(1024, {standard: "iec", base: 2}); // "1 KiB" +filesize(1048576, {standard: "iec", base: 2}); // "1 MiB" +``` + +#### JEDEC (Joint Electron Device Engineering Council) + +```javascript +filesize(1024, {standard: "jedec"}); // "1 KB" +filesize(1048576, {standard: "jedec"}); // "1 MB" +``` + +## Examples + +### Basic Usage + +```javascript +import {filesize} from "filesize"; + +filesize(500); // "500 B" +filesize(1024); // "1.02 kB" +filesize(265318); // "265.32 kB" +filesize(265318, {round: 0}); // "265 kB" +``` + +### Binary Formats + +```javascript +// IEC binary prefixes (KiB, MiB, GiB) +filesize(1024, {base: 2, standard: "iec"}); // "1 KiB" +filesize(1048576, {base: 2, standard: "iec"}); // "1 MiB" + +// JEDEC binary format (KB, MB, GB with binary calculation) +filesize(1024, {standard: "jedec"}); // "1 KB" +filesize(265318, {standard: "jedec"}); // "259.1 KB" +``` + +### Bits vs Bytes + +```javascript +filesize(500, {bits: true}); // "4 kbit" +filesize(1024, {bits: true}); // "8.19 kbit" +filesize(1024, {bits: true, base: 2}); // "8 kibit" +``` + +### Custom Formatting + +```javascript +// Full form units +filesize(1024, {fullform: true}); // "1.02 kilobytes" +filesize(1024, {base: 2, fullform: true}); // "1 kibibytes" + +// Custom separators and spacing +filesize(265318, {separator: ","}); // "265,32 kB" +filesize(265318, {spacer: ""}); // "265.32kB" + +// Precision and padding +filesize(1536, {round: 3, pad: true}); // "1.536 kB" +filesize(1536, {precision: 3}); // "1.54 kB" +``` + +### Localization + +```javascript +// German locale +filesize(265318, {locale: "de"}); // "265,32 kB" + +// Custom symbols +filesize(1, {symbols: {B: "Б"}}); // "1 Б" + +// Custom full forms +filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов" ``` +### Advanced Usage + +```javascript +// Specific exponent +filesize(1024, {exponent: 0}); // "1024 B" +filesize(1024, {exponent: 1}); // "1.02 kB" + +// BigInt support +filesize(BigInt(1024), {standard: "jedec"}); // "1 KB" + +// Extreme precision for very large numbers +filesize(Math.pow(1024, 8), {precision: 3}); // "1208925819614629174706176 YB" +``` -## Partial Application -`partial()` takes the second parameter of `filesize()` and returns a new function with the configuration applied -upon execution. This can be used to reduce `Object` creation if you call `filesize()` without caching the `descriptor` -in lexical scope. +### Partial Application Patterns ```javascript import {partial} from "filesize"; -const size = partial({standard: "jedec"}); -size(265318); // "259.1 KB" +// Create specialized formatters +const formatBinary = partial({base: 2, standard: "iec"}); +const formatBits = partial({bits: true}); +const formatPrecise = partial({round: 3, pad: true}); +const formatGerman = partial({locale: "de"}); + +// Use throughout application +formatBinary(1048576); // "1 MiB" +formatBits(1024); // "8.19 kbit" +formatPrecise(1536); // "1.536 kB" +formatGerman(265318); // "265,32 kB" + +// Method chaining equivalent +const sizes = [1024, 2048, 4096]; +sizes.map(formatBinary); // ["1 KiB", "2 KiB", "4 KiB"] +``` + +## Development + +This project follows Node.js best practices and uses: + +* **ES Modules** for modern JavaScript +* **Mocha** for testing with comprehensive coverage +* **ESLint** for code quality and consistency +* **Rollup** for building distributions +* **TypeScript definitions** for type safety + +### Project Structure + +``` +filesize.js/ +├── src/ +│ ├── filesize.js # Main implementation +│ └── constants.js # Unit definitions and constants +├── tests/ +│ └── unit/ +│ └── filesize.test.js # Comprehensive test suite +├── types/ +│ ├── filesize.d.ts # TypeScript definitions +│ └── constants.d.ts # Constants type definitions +└── package.json # Dependencies and scripts +``` + +### Contributing + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Write tests for your changes +4. Ensure all tests pass (`npm test`) +5. Commit your changes (`git commit -m 'Add amazing feature'`) +6. Push to the branch (`git push origin feature/amazing-feature`) +7. Open a Pull Request + +### Development Commands + +```bash +# Install dependencies +npm install + +# Run linting +npm run lint + +# Run tests +npm test + +# Run tests with coverage +npx c8 npm run mocha + +# Build distribution +npm run build + +# Run all checks (lint + test) +npm run ci ``` ## License -Copyright (c) 2024 Jason Mulligan + +Copyright (c) 2025 Jason Mulligan Licensed under the BSD-3 license. diff --git a/package-lock.json b/package-lock.json index bb6f365..799876c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "auto-changelog": "^2.5.0", + "c8": "^10.1.3", "eslint": "^9.30.1", "husky": "^9.1.7", "mocha": "^11.7.1", @@ -20,6 +21,16 @@ "node": ">= 10.4.0" } }, + "node_modules/@bcoe/v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", @@ -258,6 +269,16 @@ "node": ">=12" } }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.12", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", @@ -629,6 +650,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -765,6 +793,40 @@ "dev": true, "license": "MIT" }, + "node_modules/c8": { + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.3.tgz", + "integrity": "sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bcoe/v8-coverage": "^1.0.1", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^3.1.1", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", + "test-exclude": "^7.0.1", + "v8-to-istanbul": "^9.0.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "monocart-coverage-reports": "^2" + }, + "peerDependenciesMeta": { + "monocart-coverage-reports": { + "optional": true + } + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -936,6 +998,13 @@ "dev": true, "license": "MIT" }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -1430,6 +1499,13 @@ "he": "bin/he" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, "node_modules/husky": { "version": "9.1.7", "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", @@ -1582,6 +1658,45 @@ "dev": true, "license": "ISC" }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jackspeak": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", @@ -1703,6 +1818,22 @@ "dev": true, "license": "ISC" }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2351,6 +2482,47 @@ "dev": true, "license": "MIT" }, + "node_modules/test-exclude": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^9.0.4" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -2395,6 +2567,21 @@ "punycode": "^2.1.0" } }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index ba75488..d0a6727 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "changelog": "auto-changelog -p", "lint": "eslint *.js src/*.js tests/**/*.js", "fix": "eslint --fix *.js src/*.js tests/**/*.js", - "mocha": "mocha tests/**/*.js", + "mocha": "c8 mocha tests/**/*.js", "rollup": "rollup --config", "test": "npm run lint && npm run mocha", "prepare": "husky" @@ -42,6 +42,7 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "auto-changelog": "^2.5.0", + "c8": "^10.1.3", "eslint": "^9.30.1", "husky": "^9.1.7", "mocha": "^11.7.1", diff --git a/tests/unit/filesize.test.js b/tests/unit/filesize.test.js new file mode 100644 index 0000000..767f98a --- /dev/null +++ b/tests/unit/filesize.test.js @@ -0,0 +1,317 @@ +/** + * Unit tests for filesize.js + * Tests the main filesize function and partial function + */ + +import assert from 'assert'; +import { filesize, partial } from '../../dist/filesize.js'; + +describe('filesize', () => { + describe('Basic functionality', () => { + it('should convert bytes to human readable format', () => { + assert.strictEqual(filesize(1000), '1 kB'); + assert.strictEqual(filesize(1000000), '1 MB'); + assert.strictEqual(filesize(1000000000), '1 GB'); + }); + + it('should handle zero bytes', () => { + assert.strictEqual(filesize(0), '0 B'); + }); + + it('should handle small numbers', () => { + assert.strictEqual(filesize(1), '1 B'); + assert.strictEqual(filesize(512), '512 B'); + }); + + it('should handle negative numbers', () => { + assert.strictEqual(filesize(-1000), '-1 kB'); + assert.strictEqual(filesize(-1000000), '-1 MB'); + }); + }); + + describe('Bits option', () => { + it('should convert to bits when bits option is true', () => { + assert.strictEqual(filesize(1000, { bits: true }), '8 kbit'); + assert.strictEqual(filesize(1000000, { bits: true }), '8 Mbit'); + }); + + it('should handle zero with bits option', () => { + assert.strictEqual(filesize(0, { bits: true }), '0 bit'); + }); + }); + + describe('Standards', () => { + it('should use IEC standard', () => { + assert.strictEqual(filesize(1024, { standard: 'iec' }), '1 KiB'); + assert.strictEqual(filesize(1048576, { standard: 'iec' }), '1 MiB'); + }); + + it('should use JEDEC standard', () => { + assert.strictEqual(filesize(1024, { standard: 'jedec' }), '1 KB'); + assert.strictEqual(filesize(1048576, { standard: 'jedec' }), '1 MB'); + }); + + it('should use SI standard', () => { + assert.strictEqual(filesize(1000, { standard: 'si' }), '1 kB'); + assert.strictEqual(filesize(1000000, { standard: 'si' }), '1 MB'); + }); + }); + + describe('Output formats', () => { + it('should return string by default', () => { + const result = filesize(1000); + assert.strictEqual(typeof result, 'string'); + assert.strictEqual(result, '1 kB'); + }); + + it('should return array when output is "array"', () => { + const result = filesize(1000, { output: 'array' }); + assert(Array.isArray(result)); + assert.strictEqual(result[0], 1); + assert.strictEqual(result[1], 'kB'); + }); + + it('should return object when output is "object"', () => { + const result = filesize(1000, { output: 'object' }); + assert.strictEqual(typeof result, 'object'); + assert.strictEqual(result.value, 1); + assert.strictEqual(result.symbol, 'kB'); + assert.strictEqual(result.exponent, 1); + assert.strictEqual(result.unit, 'kB'); + }); + + it('should return exponent when output is "exponent"', () => { + const result = filesize(1000, { output: 'exponent' }); + assert.strictEqual(typeof result, 'number'); + assert.strictEqual(result, 1); + }); + }); + + describe('Rounding', () => { + it('should round to specified decimal places', () => { + assert.strictEqual(filesize(1536, { round: 1 }), '1.5 kB'); + assert.strictEqual(filesize(1536, { round: 0 }), '2 kB'); + assert.strictEqual(filesize(1536, { round: 3 }), '1.536 kB'); + }); + + it('should use different rounding methods', () => { + assert.strictEqual(filesize(1536, { roundingMethod: 'floor' }), '1.53 kB'); + assert.strictEqual(filesize(1536, { roundingMethod: 'ceil' }), '1.54 kB'); + assert.strictEqual(filesize(1536, { roundingMethod: 'round' }), '1.54 kB'); + }); + }); + + describe('Padding', () => { + it('should pad decimal places when pad is true', () => { + assert.strictEqual(filesize(1000, { pad: true, round: 2 }), '1.00 kB'); + assert.strictEqual(filesize(1536, { pad: true, round: 1 }), '1.5 kB'); + }); + }); + + describe('Custom separators and spacers', () => { + it('should use custom decimal separator', () => { + assert.strictEqual(filesize(1536, { separator: ',' }), '1,54 kB'); + }); + + it('should use custom spacer between value and unit', () => { + assert.strictEqual(filesize(1000, { spacer: '_' }), '1_kB'); + assert.strictEqual(filesize(1000, { spacer: '' }), '1kB'); + }); + }); + + describe('Custom symbols', () => { + it('should use custom symbols when provided', () => { + const customSymbols = { kB: 'kilobyte' }; + assert.strictEqual(filesize(1000, { symbols: customSymbols }), '1 kilobyte'); + }); + }); + + describe('Locale formatting', () => { + it('should format using system locale when locale is true', () => { + const result = filesize(1000, { locale: true }); + assert(typeof result === 'string'); + assert(result.includes('kB')); + }); + + it('should format using specific locale', () => { + const result = filesize(1536, { locale: 'en-US' }); + assert(typeof result === 'string'); + assert(result.includes('1.5')); + }); + }); + + describe('Full form names', () => { + it('should use full form names when fullform is true', () => { + assert.strictEqual(filesize(1000, { fullform: true }), '1 kilobyte'); + assert.strictEqual(filesize(2000, { fullform: true }), '2 kilobytes'); + assert.strictEqual(filesize(1, { fullform: true }), '1 byte'); + }); + + it('should use custom fullforms when provided', () => { + const customFullforms = ['', 'thousand-byte']; + assert.strictEqual(filesize(1000, { fullform: true, fullforms: customFullforms }), '1 thousand-byte'); + }); + }); + + describe('Base and exponent options', () => { + it('should use base 2 calculations', () => { + assert.strictEqual(filesize(1024, { base: 2 }), '1 KiB'); + }); + + it('should use base 10 calculations', () => { + assert.strictEqual(filesize(1000, { base: 10 }), '1 kB'); + }); + + it('should use forced exponent', () => { + assert.strictEqual(filesize(1024, { exponent: 0 }), '1024 B'); + assert.strictEqual(filesize(1024, { exponent: 2 }), '0 MB'); + }); + }); + + describe('Precision option', () => { + it('should use specified precision', () => { + assert.strictEqual(filesize(1536, { precision: 3 }), '1.54 kB'); + assert.strictEqual(filesize(1536000, { precision: 2 }), '1.5 MB'); + }); + }); + + describe('Edge cases', () => { + it('should handle very large numbers', () => { + const largeNumber = Math.pow(1024, 8); + const result = filesize(largeNumber); + assert(typeof result === 'string'); + assert(result.includes('YB') || result.includes('YiB')); + }); + + it('should handle BigInt input', () => { + const result = filesize(BigInt(1024), { standard: 'jedec' }); + assert.strictEqual(result, '1 KB'); + }); + + it('should handle numbers exceeding maximum exponent', () => { + const hugeNumber = Math.pow(1024, 10); + const result = filesize(hugeNumber); + assert(typeof result === 'string'); + }); + + it('should handle extremely large numbers with precision adjustment', () => { + const extremeNumber = Math.pow(1024, 15); // Much larger than supported exponent + const result = filesize(extremeNumber, { precision: 3 }); + assert(typeof result === 'string'); + assert(result.includes('YB') || result.includes('YiB')); + }); + + it('should handle bit conversion auto-increment near boundary', () => { + // Test edge case where bits conversion causes auto-increment to next unit + const result = filesize(127.5, { bits: true }); // Should auto-increment + assert(typeof result === 'string'); + }); + + it('should handle result equal to ceil boundary for auto-increment', () => { + // Test case where result equals ceil and triggers increment + const result = filesize(999.5, { round: 0 }); // Should round to 1000 and increment + assert(typeof result === 'string'); + }); + + it('should handle padding with custom separator edge cases', () => { + // Test padding when separator is found via regex + const result = filesize(1536, { pad: true, round: 2, locale: 'de-DE' }); + assert(typeof result === 'string'); + }); + + it('should handle NaN exponent edge case', () => { + const result = filesize(1000, { exponent: NaN }); + assert.strictEqual(result, '1 kB'); + }); + }); + + describe('Error handling', () => { + it('should throw TypeError for invalid number input', () => { + assert.throws(() => filesize('invalid'), TypeError); + assert.throws(() => filesize(NaN), TypeError); + assert.throws(() => filesize({}), TypeError); + }); + + it('should throw TypeError for invalid rounding method', () => { + assert.throws(() => filesize(1024, { roundingMethod: 'invalid' }), TypeError); + assert.throws(() => filesize(1024, { roundingMethod: 'nonexistent' }), TypeError); + }); + }); +}); + +describe('partial', () => { + describe('Basic functionality', () => { + it('should create a function with preset options', () => { + const formatKiB = partial({ standard: 'iec' }); + assert.strictEqual(typeof formatKiB, 'function'); + assert.strictEqual(formatKiB(1024), '1 KiB'); + }); + + it('should preserve all options in partial application', () => { + const formatWithOptions = partial({ + round: 1, + standard: 'iec', + spacer: '_' + }); + assert.strictEqual(formatWithOptions(1536), '1.5_KiB'); + }); + }); + + describe('Options inheritance', () => { + it('should apply bits option from partial', () => { + const formatBits = partial({ bits: true }); + assert.strictEqual(formatBits(1000), '8 kbit'); + }); + + it('should apply pad option from partial', () => { + const formatPadded = partial({ pad: true, round: 2 }); + assert.strictEqual(formatPadded(1000), '1.00 kB'); + }); + + it('should apply output format from partial', () => { + const formatArray = partial({ output: 'array' }); + const result = formatArray(1000); + assert(Array.isArray(result)); + assert.strictEqual(result[0], 1); + assert.strictEqual(result[1], 'kB'); + }); + + it('should apply custom symbols from partial', () => { + const formatCustom = partial({ symbols: { kB: 'kilobyte' } }); + assert.strictEqual(formatCustom(1000), '1 kilobyte'); + }); + }); + + describe('Multiple partial functions', () => { + it('should create independent partial functions', () => { + const formatIEC = partial({ standard: 'iec' }); + const formatJEDEC = partial({ standard: 'jedec' }); + + assert.strictEqual(formatIEC(1024), '1 KiB'); + assert.strictEqual(formatJEDEC(1024), '1 KB'); + }); + + it('should handle complex option combinations', () => { + const formatComplex = partial({ + bits: true, + standard: 'iec', + round: 1, + fullform: true + }); + assert.strictEqual(formatComplex(1024), '8 kibibits'); + }); + }); + + describe('Default behavior', () => { + it('should work with no options provided', () => { + const defaultFormat = partial(); + assert.strictEqual(typeof defaultFormat, 'function'); + assert.strictEqual(defaultFormat(1000), '1 kB'); + }); + + it('should work with empty options object', () => { + const emptyOptions = partial({}); + assert.strictEqual(emptyOptions(1000), '1 kB'); + }); + }); +}); \ No newline at end of file From 3027df75893e6493f6eea462e0dcf226e96a4919 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:15:23 -0400 Subject: [PATCH 04/10] Updating README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee02be1..1a4b413 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # filesize.js -[![downloads](https://img.shields.io/npm/dt/filesize.svg)](https://www.npmjs.com/package/filesize) [![CDNJS version](https://img.shields.io/cdnjs/v/filesize.svg)](https://cdnjs.com/libraries/filesize) +[![downloads](https://img.shields.io/npm/dt/filesize.svg)](https://www.npmjs.com/package/filesize) +[![npm version](https://badge.fury.io/js/filesize.svg)](https://badge.fury.io/js/filesize) +[![Node.js Version](https://img.shields.io/node/v/filesize.svg)](https://nodejs.org/) +[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +[![Build Status](https://github.com/avoidwork/woodland/actions/workflows/ci.yml/badge.svg)](https://github.com/avoidwork/filesize/actions) A lightweight, high-performance file size utility for JavaScript that converts bytes to human-readable strings. Works in both Node.js and browser environments with comprehensive format support. @@ -355,9 +359,6 @@ npm run lint # Run tests npm test -# Run tests with coverage -npx c8 npm run mocha - # Build distribution npm run build From 45a09dc11a2c4bfb4b46ee5e2fe33adc0a9b933b Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:17:37 -0400 Subject: [PATCH 05/10] Updating type defs --- types/constants.d.ts | 73 +++++++++++++---------- types/filesize.d.ts | 136 +++++++++++++++++++++++++++---------------- 2 files changed, 128 insertions(+), 81 deletions(-) diff --git a/types/constants.d.ts b/types/constants.d.ts index ceebaec..4da91d1 100644 --- a/types/constants.d.ts +++ b/types/constants.d.ts @@ -1,42 +1,51 @@ -export const ARRAY: "array"; +// Error Messages +export const INVALID_NUMBER: "Invalid number"; +export const INVALID_ROUND: "Invalid rounding method"; + +// Standard Types +export const IEC: "iec"; +export const JEDEC: "jedec"; +export const SI: "si"; + +// Unit Types export const BIT: "bit"; export const BITS: "bits"; export const BYTE: "byte"; export const BYTES: "bytes"; -export const EMPTY: ""; -export const EXPONENT: "exponent"; +export const SI_KBIT: "kbit"; +export const SI_KBYTE: "kB"; + +// Output Format Types +export const ARRAY: "array"; export const FUNCTION: "function"; -export const IEC: "iec"; -export const INVALID_NUMBER: "Invalid number"; -export const INVALID_ROUND: "Invalid rounding method"; -export const JEDEC: "jedec"; export const OBJECT: "object"; -export const PERIOD: "."; +export const STRING: "string"; + +// Processing Constants +export const EXPONENT: "exponent"; export const ROUND: "round"; + +// Special Characters and Values +export const EMPTY: ""; +export const PERIOD: "."; export const S: "s"; -export const SI: "si"; -export const SI_KBIT: "kbit"; -export const SI_KBYTE: "kB"; export const SPACE: " "; -export const STRING: "string"; export const ZERO: "0"; -export namespace STRINGS { - namespace symbol { - namespace iec { - const bits: string[]; - const bytes: string[]; - } - namespace jedec { - const bits_1: string[]; - export { bits_1 as bits }; - const bytes_1: string[]; - export { bytes_1 as bytes }; - } - } - namespace fullform { - const iec_1: string[]; - export { iec_1 as iec }; - const jedec_1: string[]; - export { jedec_1 as jedec }; - } -} + +// Data Structures +export const STRINGS: { + symbol: { + iec: { + bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"]; + bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; + }; + jedec: { + bits: ["bit", "Kbit", "Mbit", "Gbit", "Tbit", "Pbit", "Ebit", "Zbit", "Ybit"]; + bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + }; + }; + fullform: { + iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"]; + jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]; + }; +}; \ No newline at end of file diff --git a/types/filesize.d.ts b/types/filesize.d.ts index 91251a1..4b40847 100644 --- a/types/filesize.d.ts +++ b/types/filesize.d.ts @@ -1,56 +1,94 @@ -interface FileSizeOptionsBase { - base?: 10 | 2; - bits?: boolean; - exponent?: number; - fullform?: boolean; - fullforms?: string[]; - locale?: string | boolean; - localeOptions?: Intl.DateTimeFormatOptions; - pad?: boolean; - precision?: number; - round?: number; - roundingMethod?: 'round' | 'floor' | 'ceil'; - separator?: string; - spacer?: string; - standard?: 'si' | 'iec' | 'jedec'; - symbols?: {}; +/** + * Options interface for configuring filesize behavior + */ +export interface FilesizeOptions { + /** If true, calculates bits instead of bytes */ + bits?: boolean; + /** If true, pads decimal places to match round parameter */ + pad?: boolean; + /** Number base (2 for binary, 10 for decimal, -1 for auto) */ + base?: number; + /** Number of decimal places to round to */ + round?: number; + /** Locale for number formatting, true for system locale */ + locale?: string | boolean; + /** Additional options for locale formatting */ + localeOptions?: Intl.NumberFormatOptions; + /** Custom decimal separator */ + separator?: string; + /** String to separate value and unit */ + spacer?: string; + /** Custom unit symbols */ + symbols?: Record; + /** Unit standard to use (SI, IEC, JEDEC) */ + standard?: "si" | "iec" | "jedec" | ""; + /** Output format: "string", "array", "object", or "exponent" */ + output?: "string" | "array" | "object" | "exponent"; + /** If true, uses full unit names instead of abbreviations */ + fullform?: boolean; + /** Custom full unit names */ + fullforms?: string[]; + /** Force specific exponent (-1 for auto) */ + exponent?: number; + /** Math rounding method to use */ + roundingMethod?: "round" | "floor" | "ceil"; + /** Number of significant digits (0 for auto) */ + precision?: number; } -interface FileSizeOptionsArray extends FileSizeOptionsBase { - output: 'array' +/** + * Object format return type when output is "object" + */ +export interface FilesizeObject { + /** The numeric value */ + value: number | string; + /** The unit symbol */ + symbol: string; + /** The exponent used in calculation */ + exponent: number; + /** The original unit before symbol customization */ + unit: string; } -interface FileSizeOptionsExponent extends FileSizeOptionsBase { - output: 'exponent' -} - -interface FileSizeOptionsObject extends FileSizeOptionsBase { - output: 'object' -} - -interface FileSizeOptionsString extends FileSizeOptionsBase { - output: 'string' -} - -interface FileSizeReturnObject { - value: string, - symbol: string, - exponent: number, - unit: string, -} +/** + * Array format return type when output is "array" + */ +export type FilesizeArray = [number | string, string]; -type FileSizeReturnArray = [ number, string ] +/** + * Return type based on output option + */ +export type FilesizeReturn = + T['output'] extends "object" ? FilesizeObject : + T['output'] extends "array" ? FilesizeArray : + T['output'] extends "exponent" ? number : + string; -type FileSizeOptionStringOrBase = FileSizeOptionsString | FileSizeOptionsBase; -type FileSizeOptions = FileSizeOptionsArray | FileSizeOptionsExponent | FileSizeOptionsObject | FileSizeOptionStringOrBase | undefined -type FileSizeReturnType = - Options extends FileSizeOptionsArray - ? FileSizeReturnArray - : Options extends FileSizeOptionsExponent - ? number - : Options extends FileSizeOptionsObject - ? FileSizeReturnObject - : string; +/** + * Converts a file size in bytes to a human-readable string with appropriate units + * @param arg - The file size in bytes to convert + * @param options - Configuration options for formatting + * @returns Formatted file size based on output option + * @throws {TypeError} When arg is not a valid number or roundingMethod is invalid + * @example + * filesize(1024) // "1 KB" + * filesize(1024, {bits: true}) // "8 Kb" + * filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"} + */ +export function filesize( + arg: number | bigint, + options?: T +): FilesizeReturn; -export function filesize(byteCount: number | string | bigint, options?: Options): FileSizeReturnType -export function partial(options?: Options): (byteCount: number | string | bigint) => FileSizeReturnType +/** + * Creates a partially applied version of filesize with preset options + * @param options - Default options to apply to the returned function + * @returns A function that takes a file size and returns formatted output + * @example + * const formatBytes = partial({round: 1, standard: "iec"}); + * formatBytes(1024) // "1.0 KiB" + * formatBytes(2048) // "2.0 KiB" + */ +export function partial( + options?: T +): (arg: number | bigint) => FilesizeReturn; \ No newline at end of file From f1031957ed3c0b3bb73ce73a6e946fe26127bb1f Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:25:50 -0400 Subject: [PATCH 06/10] Adding docs --- docs/CODE_STYLE_GUIDE.md | 610 ++++++++++++++++++ docs/TECHNICAL_DOCUMENTATION.md | 1059 +++++++++++++++++++++++++++++++ 2 files changed, 1669 insertions(+) create mode 100644 docs/CODE_STYLE_GUIDE.md create mode 100644 docs/TECHNICAL_DOCUMENTATION.md diff --git a/docs/CODE_STYLE_GUIDE.md b/docs/CODE_STYLE_GUIDE.md new file mode 100644 index 0000000..f25af77 --- /dev/null +++ b/docs/CODE_STYLE_GUIDE.md @@ -0,0 +1,610 @@ +# Code Style Guide + +## Table of Contents + +1. [Overview](#overview) +2. [General Principles](#general-principles) +3. [Code Formatting](#code-formatting) +4. [Naming Conventions](#naming-conventions) +5. [Function and Class Design](#function-and-class-design) +6. [Documentation Standards](#documentation-standards) +7. [Error Handling](#error-handling) +8. [Module Structure](#module-structure) +9. [Testing Standards](#testing-standards) +10. [Security Guidelines](#security-guidelines) +11. [Performance Considerations](#performance-considerations) +12. [Tools and Linting](#tools-and-linting) + +## Overview + +This style guide establishes coding standards for the filesize.js project, following Node.js community best practices and ensuring code maintainability, readability, and security. + +## General Principles + +### Core Development Principles + +- **DRY (Don't Repeat Yourself)**: Eliminate code duplication through abstraction and modularization +- **KISS (Keep It Simple, Stupid)**: Favor simplicity over complexity +- **YAGNI (You Aren't Gonna Need It)**: Implement features only when necessary +- **SOLID Principles**: Follow Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion principles + +### Code Quality Standards + +- Write self-documenting code with clear intent +- Prioritize code readability over cleverness +- Use meaningful names that express intent +- Keep functions small and focused +- Write testable code with minimal dependencies + +## Code Formatting + +### Indentation and Spacing + +```javascript +// Use tabs for indentation (project standard) +function exampleFunction(param1, param2) { + const result = param1 + param2; + return result; +} + +// Space around operators +const sum = a + b; +const isValid = value > 0 && value < 100; + +// Space after commas in arrays and objects +const array = [1, 2, 3, 4]; +const obj = { key1: "value1", key2: "value2" }; +``` + +### Line Length and Breaks + +- Maximum line length: 120 characters +- Break long parameter lists across multiple lines +- Use consistent indentation for wrapped lines + +```javascript +// Good: Long parameter list +function processData({ + inputData, + outputFormat, + processingOptions, + validationRules +}) { + // Function implementation +} + +// Good: Long conditional +if (condition1 && + condition2 && + condition3) { + // Action +} +``` + +### Trailing Commas + +Use trailing commas in multi-line arrays and objects for cleaner diffs: + +```javascript +const config = { + option1: "value1", + option2: "value2", + option3: "value3", // Trailing comma +}; +``` + +## Naming Conventions + +### Variables and Functions + +- Use **camelCase** for all variables and functions +- Use descriptive names that clearly indicate purpose +- Avoid abbreviations unless they are widely understood + +```javascript +// Good +const userAccountBalance = getUserBalance(); +const isValidEmail = validateEmailFormat(email); + +// Bad +const usrAccBal = getUsrBal(); +const isValidEml = validateEmlFmt(eml); +``` + +### Constants + +- Use **UPPER_SNAKE_CASE** for all constants +- Group related constants together +- Use meaningful prefixes for constant categories + +```javascript +// Good +const MAX_FILE_SIZE = 1024 * 1024; +const ERROR_INVALID_INPUT = "Invalid input provided"; +const HTTP_STATUS_OK = 200; + +// Export constants from dedicated module +export const STANDARDS = { + IEC: "iec", + JEDEC: "jedec", + SI: "si" +}; +``` + +### Files and Directories + +- Use **kebab-case** for file and directory names +- Use descriptive names that indicate file purpose +- Group related files in logical directories + +``` +src/ +├── constants.js +├── filesize.js +├── utils/ +│ ├── validation-helpers.js +│ └── formatting-utils.js +tests/ +├── unit/ +│ ├── filesize.test.js +│ └── constants.test.js +└── integration/ + └── full-workflow.test.js +``` + +## Function and Class Design + +### Function Structure + +- Keep functions small (ideally under 20 lines) +- Single responsibility per function +- Pure functions when possible (no side effects) +- Use default parameters for optional arguments + +```javascript +/** + * Calculates the file size with specified formatting options + * @param {number} bytes - The size in bytes + * @param {Object} [options={}] - Formatting options + * @param {string} [options.standard="jedec"] - Unit standard to use + * @param {number} [options.precision=2] - Decimal places + * @returns {string} Formatted file size string + */ +function formatFileSize(bytes, { + standard = "jedec", + precision = 2 +} = {}) { + // Implementation +} +``` + +### Parameter Handling + +- Use destructuring for options objects +- Provide sensible defaults +- Validate critical parameters + +```javascript +// Good: Clear parameter destructuring with defaults +function processFile({ + inputPath, + outputPath = "./output", + format = "json", + compress = false +} = {}) { + if (!inputPath) { + throw new TypeError("inputPath is required"); + } + // Process file +} +``` + +### Return Values + +- Be consistent with return types +- Return early for error conditions +- Use descriptive return objects when returning multiple values + +```javascript +// Good: Consistent return pattern +function parseFileSize(input) { + if (typeof input !== "string") { + return { success: false, error: "Input must be a string" }; + } + + const parsed = parseSize(input); + return { + success: true, + value: parsed.value, + unit: parsed.unit + }; +} +``` + +## Documentation Standards + +### JSDoc Requirements + +All public functions and classes must have comprehensive JSDoc comments: + +```javascript +/** + * Converts bytes to human-readable format with specified options + * @param {number|bigint} input - Number of bytes to convert + * @param {Object} [options={}] - Configuration options + * @param {boolean} [options.binary=false] - Use binary (1024) vs decimal (1000) calculation + * @param {number} [options.precision=2] - Number of decimal places + * @param {string} [options.standard="jedec"] - Unit standard (jedec, iec, si) + * @param {string} [options.locale=""] - Locale for number formatting + * @returns {string|Object|Array} Formatted file size + * @throws {TypeError} When input is not a valid number + * @throws {RangeError} When precision is negative + * @example + * // Basic usage + * formatBytes(1024) // "1 KB" + * + * // With options + * formatBytes(1024, { binary: true, precision: 1 }) // "1.0 KiB" + * + * // Object output + * formatBytes(1024, { output: "object" }) + * // { value: 1, unit: "KB", symbol: "KB" } + */ +function formatBytes(input, options = {}) { + // Implementation +} +``` + +### Inline Comments + +- Use comments sparingly for complex logic +- Explain "why" not "what" +- Keep comments up-to-date with code changes + +```javascript +// Calculate exponent based on logarithm +// This handles edge cases where Math.log returns unexpected values +const exponent = Math.max(0, Math.floor(Math.log(bytes) / Math.log(base))); +``` + +### README Documentation + +- Include clear installation instructions +- Provide comprehensive API documentation +- Include practical examples +- Document all configuration options + +## Error Handling + +### Error Types and Messages + +- Use specific error types for different error conditions +- Provide clear, actionable error messages +- Include context in error messages + +```javascript +// Good: Specific error handling +function validateInput(value) { + if (typeof value !== "number" && typeof value !== "bigint") { + throw new TypeError( + `Expected number or bigint, received ${typeof value}` + ); + } + + if (value < 0) { + throw new RangeError( + `Value must be non-negative, received ${value}` + ); + } +} +``` + +### Error Constants + +Define error messages as constants to ensure consistency: + +```javascript +// constants.js +export const ERRORS = { + INVALID_NUMBER: "Invalid number: expected number or bigint", + INVALID_PRECISION: "Invalid precision: must be non-negative integer", + INVALID_STANDARD: "Invalid standard: must be 'jedec', 'iec', or 'si'", + INVALID_ROUNDING: "Invalid rounding method: method does not exist on Math object" +}; +``` + +### Graceful Degradation + +- Provide fallback behavior when possible +- Log warnings for recoverable errors +- Fail fast for critical errors + +```javascript +function formatWithLocale(value, locale, options) { + try { + return value.toLocaleString(locale, options); + } catch (error) { + // Fallback to default formatting + console.warn(`Locale formatting failed: ${error.message}`); + return value.toString(); + } +} +``` + +## Module Structure + +### ES6 Module Standards + +- Use ES6 import/export syntax +- Prefer named exports over default exports for utilities +- Use default exports for main functionality + +```javascript +// constants.js - Named exports for related constants +export const BYTE_SIZES = { + KILOBYTE: 1024, + MEGABYTE: 1024 * 1024, + GIGABYTE: 1024 * 1024 * 1024 +}; + +export const STANDARDS = { + IEC: "iec", + JEDEC: "jedec" +}; + +// filesize.js - Default export for main function +import { BYTE_SIZES, STANDARDS } from "./constants.js"; + +export default function filesize(bytes, options) { + // Implementation +} + +// Also provide named export +export { filesize }; +``` + +### File Organization + +- Separate concerns into different modules +- Keep related functionality together +- Use barrel exports for clean public APIs + +```javascript +// index.js - Barrel export +export { default as filesize, filesize } from "./filesize.js"; +export { partial } from "./partial.js"; +export * from "./constants.js"; +``` + +## Testing Standards + +### Test Structure + +- Use descriptive test names that explain behavior +- Group related tests with `describe` blocks +- Use `beforeEach`/`afterEach` for setup and cleanup + +```javascript +import assert from "node:assert"; +import { filesize } from "../src/filesize.js"; + +describe("filesize()", () => { + describe("basic functionality", () => { + it("should convert bytes to KB correctly", () => { + const result = filesize(1024); + assert.strictEqual(result, "1 KB"); + }); + + it("should handle zero bytes", () => { + const result = filesize(0); + assert.strictEqual(result, "0 B"); + }); + }); + + describe("error handling", () => { + it("should throw TypeError for invalid input", () => { + assert.throws( + () => filesize("invalid"), + { name: "TypeError", message: /Invalid number/ } + ); + }); + }); +}); +``` + +### Test Types + +#### Unit Tests (`tests/unit/`) +- Test individual functions in isolation +- Mock external dependencies +- Focus on function behavior and edge cases +- Use node:assert for assertions + +#### Integration Tests (`tests/integration/`) +- Test complete workflows +- Test module interactions +- Use real dependencies when appropriate +- Validate end-to-end functionality + +### Test Coverage + +- Aim for 90%+ code coverage +- Cover all public API methods +- Test error conditions and edge cases +- Use c8 for coverage reporting + +```javascript +// Example comprehensive test +describe("filesize with options", () => { + const testCases = [ + { input: 1024, options: { binary: true }, expected: "1 KiB" }, + { input: 1000, options: { binary: false }, expected: "1 KB" }, + { input: 1536, options: { precision: 1 }, expected: "1.5 KB" } + ]; + + testCases.forEach(({ input, options, expected }) => { + it(`should return "${expected}" for ${input} bytes with options ${JSON.stringify(options)}`, () => { + assert.strictEqual(filesize(input, options), expected); + }); + }); +}); +``` + +## Security Guidelines + +### Input Validation + +Following OWASP security guidelines: + +- Validate all inputs at entry points +- Sanitize user-provided data +- Use type checking for security-critical operations + +```javascript +function secureFilesize(input, options = {}) { + // Input validation + if (typeof input !== "number" && typeof input !== "bigint") { + throw new TypeError("Input must be a number or bigint"); + } + + // Validate numeric ranges + if (typeof input === "number" && !Number.isFinite(input)) { + throw new RangeError("Input must be a finite number"); + } + + // Validate options object + if (options !== null && typeof options !== "object") { + throw new TypeError("Options must be an object"); + } + + return formatFilesize(input, options); +} +``` + +### Dependency Security + +- Regularly audit dependencies with `npm audit` +- Use specific version numbers in package.json +- Review security advisories for dependencies +- Minimize dependency count + +### Data Sanitization + +- Escape output for display contexts +- Validate object properties before use +- Use allow-lists for string values when possible + +```javascript +const ALLOWED_STANDARDS = ["jedec", "iec", "si"]; + +function validateStandard(standard) { + if (!ALLOWED_STANDARDS.includes(standard)) { + throw new Error(`Invalid standard: ${standard}`); + } + return standard; +} +``` + +## Performance Considerations + +### Optimization Guidelines + +- Profile before optimizing +- Prefer readable code over premature optimization +- Cache expensive calculations when appropriate +- Use appropriate data structures for the task + +```javascript +// Good: Efficient object lookup instead of array iteration +const UNIT_MULTIPLIERS = { + B: 1, + KB: 1024, + MB: 1024 * 1024, + GB: 1024 * 1024 * 1024 +}; + +function getMultiplier(unit) { + return UNIT_MULTIPLIERS[unit] || 1; +} +``` + +### Memory Management + +- Avoid memory leaks with proper cleanup +- Use `const` and `let` appropriately +- Minimize object creation in hot paths + +```javascript +// Good: Reuse objects when possible +const formatOptions = { + minimumFractionDigits: 0, + maximumFractionDigits: 2 +}; + +function formatNumber(value, precision = 2) { + formatOptions.maximumFractionDigits = precision; + return value.toLocaleString("en-US", formatOptions); +} +``` + +## Tools and Linting + +### ESLint Configuration + +The project uses ESLint for code quality enforcement. Key rules include: + +- Consistent indentation (tabs) +- Semicolon usage +- Quote style consistency +- Unused variable detection +- Function complexity limits + +### Development Workflow + +1. **Linting**: Run `npm run lint` before committing +2. **Auto-fixing**: Use `npm run fix` for automatic fixes +3. **Testing**: Run `npm test` for full test suite +4. **Coverage**: Review coverage reports with c8 + +### Pre-commit Hooks + +The project uses Husky for pre-commit hooks: + +- Lint all staged files +- Run tests +- Validate commit message format + +### Recommended VS Code Extensions + +- ESLint +- Prettier (if configured) +- JavaScript (ES6) code snippets +- Path Intellisense +- GitLens + +## Code Review Guidelines + +### Review Checklist + +- [ ] Code follows established patterns +- [ ] Functions have appropriate JSDoc documentation +- [ ] Error handling is comprehensive +- [ ] Tests cover new functionality +- [ ] No security vulnerabilities introduced +- [ ] Performance implications considered +- [ ] Breaking changes documented + +### Review Process + +1. **Self-review**: Author reviews their own changes first +2. **Peer review**: At least one other developer reviews +3. **Testing**: All tests pass in CI/CD +4. **Documentation**: Updates made to relevant docs + +--- + +## Conclusion + +This style guide serves as the foundation for consistent, maintainable, and secure code in the filesize.js project. Regular updates to this guide should reflect evolving best practices and project needs. + +For questions or suggestions regarding this style guide, please open an issue in the project repository. \ No newline at end of file diff --git a/docs/TECHNICAL_DOCUMENTATION.md b/docs/TECHNICAL_DOCUMENTATION.md new file mode 100644 index 0000000..008127a --- /dev/null +++ b/docs/TECHNICAL_DOCUMENTATION.md @@ -0,0 +1,1059 @@ +# Technical Documentation + +## Table of Contents + +1. [Overview](#overview) +2. [Architecture](#architecture) +3. [Data Flow](#data-flow) +4. [API Reference](#api-reference) +5. [Usage Patterns](#usage-patterns) +6. [Modern Application Examples (2025)](#modern-application-examples-2025) +7. [Internationalization & Localization](#internationalization--localization) +8. [Performance Considerations](#performance-considerations) +9. [Integration Patterns](#integration-patterns) +10. [Troubleshooting](#troubleshooting) + +## Overview + +**filesize.js** is a modern JavaScript library that converts numeric byte values into human-readable file size strings with extensive customization options. The library supports multiple unit standards, localization, and various output formats, making it ideal for modern web applications, mobile apps, and cloud platforms. + +### Key Features + +- **Multiple Unit Standards**: SI (decimal), IEC (binary), and JEDEC standards +- **Localization Support**: Full internationalization with locale-specific formatting +- **Flexible Output**: String, Array, Object, or Exponent formats +- **BigInt Support**: Handle extremely large file sizes +- **Customizable Formatting**: Precision, rounding, symbols, and spacing control +- **Functional Programming**: Partial application support for configuration reuse + +### Browser & Runtime Support + +- **Node.js**: 10.4.0+ +- **Modern Browsers**: ES6+ support required +- **Mobile**: iOS Safari 10+, Android Chrome 51+ +- **Server Environments**: Deno, Bun, Cloudflare Workers + +## Architecture + +### System Architecture + +```mermaid +graph TB + subgraph "Core Components" + A[Input Validation] --> B[Standard Normalization] + B --> C[Exponent Calculation] + C --> D[Value Conversion] + D --> E[Formatting Engine] + E --> F[Output Generation] + end + + subgraph "Configuration Layer" + G[Constants Module] + H[Standards Config] + I[Locale Settings] + J[Symbol Mappings] + end + + subgraph "Public API" + K[filesize Function] + L[partial Function] + end + + G --> A + H --> B + I --> E + J --> E + + K --> A + L --> K + + style A fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff + style E fill:#7c2d12,stroke:#92400e,stroke-width:2px,color:#ffffff + style K fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff +``` + +### Module Structure + +```mermaid +graph LR + subgraph "filesize.js Library" + A[constants.js
Constants & Symbols] + B[filesize.js
Core Logic] + C[Types
TypeScript Definitions] + end + + subgraph "External Dependencies" + D[Math Object
Rounding Functions] + E[Intl API
Localization] + end + + A --> B + B --> D + B --> E + + style A fill:#d97706,stroke:#b45309,stroke-width:2px,color:#ffffff + style B fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style C fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff +``` + +## Data Flow + +### Primary Processing Pipeline + +```mermaid +flowchart TD + Start([Input: bytes, options]) --> Validate{Valid Input?} + + Validate -->|No| Error[Throw TypeError] + Validate -->|Yes| Normalize[Normalize Base & Standard] + + Normalize --> CalcExp[Calculate Exponent] + CalcExp --> CheckExp{Exponent > 8?} + CheckExp -->|Yes| LimitExp[Limit to 8, Adjust Precision] + CheckExp -->|No| CheckZero{Input = 0?} + LimitExp --> CheckZero + + CheckZero -->|Yes| ZeroCase[Set result = 0, unit = base unit] + CheckZero -->|No| Convert[Convert Value & Calculate Unit] + + Convert --> CheckBits{Bits Mode?} + CheckBits -->|Yes| MultiplyBy8[Multiply by 8] + CheckBits -->|No| Round[Apply Rounding] + MultiplyBy8 --> Round + + Round --> CheckOverflow{Value >= ceil?} + CheckOverflow -->|Yes| Increment[Increment Exponent] + CheckOverflow -->|No| Format[Apply Formatting] + Increment --> Format + + ZeroCase --> Format + + Format --> Locale{Locale Set?} + Locale -->|Yes| LocaleFormat[Apply Locale Formatting] + Locale -->|No| Separator{Custom Separator?} + LocaleFormat --> Padding + Separator -->|Yes| CustomSep[Apply Custom Separator] + Separator -->|No| Padding{Padding Enabled?} + CustomSep --> Padding + + Padding -->|Yes| PadDecimal[Pad Decimal Places] + Padding -->|No| FullForm{Full Form?} + PadDecimal --> FullForm + + FullForm -->|Yes| ExpandUnit[Use Full Unit Names] + FullForm -->|No| CustomSymbols{Custom Symbols?} + ExpandUnit --> CustomSymbols + + CustomSymbols -->|Yes| ApplySymbols[Apply Custom Symbols] + CustomSymbols -->|No| Output[Generate Output] + ApplySymbols --> Output + + Output --> Return([Return: Formatted Result]) + + style Start fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style Error fill:#dc2626,stroke:#b91c1c,stroke-width:2px,color:#ffffff + style Return fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff +``` + +### Standard Selection Logic + +```mermaid +flowchart TD + Input[Input: standard, base] --> CheckStandard{Standard = SI?} + + CheckStandard -->|Yes| SetDecimal[base = 10
standard = JEDEC] + CheckStandard -->|No| CheckIEC{Standard = IEC or JEDEC?} + + CheckIEC -->|Yes| SetBinary[base = 2] + CheckIEC -->|No| CheckBase{Base = 2?} + + CheckBase -->|Yes| SetIEC[standard = IEC] + CheckBase -->|No| SetDefault[base = 10
standard = JEDEC] + + SetDecimal --> Result[Final: base, standard] + SetBinary --> Result + SetIEC --> Result + SetDefault --> Result + + style Input fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style Result fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff +``` + +## API Reference + +### Core Functions + +#### `filesize(arg, options)` + +Converts bytes to human-readable format. + +**Parameters:** +- `arg` (number|bigint): File size in bytes +- `options` (Object): Configuration options + +**Returns:** string|Array|Object|number + +#### `partial(options)` + +Creates a partially applied function with preset options. + +**Parameters:** +- `options` (Object): Default configuration + +**Returns:** Function + +### Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `bits` | boolean | `false` | Calculate bits instead of bytes | +| `pad` | boolean | `false` | Pad decimal places | +| `base` | number | `-1` | Number base (2, 10, or -1 for auto) | +| `round` | number | `2` | Decimal places to round | +| `locale` | string\|boolean | `""` | Locale for formatting | +| `localeOptions` | Object | `{}` | Additional locale options | +| `separator` | string | `""` | Custom decimal separator | +| `spacer` | string | `" "` | Value-unit separator | +| `symbols` | Object | `{}` | Custom unit symbols | +| `standard` | string | `""` | Unit standard (SI, IEC, JEDEC) | +| `output` | string | `"string"` | Output format | +| `fullform` | boolean | `false` | Use full unit names | +| `fullforms` | Array | `[]` | Custom full unit names | +| `exponent` | number | `-1` | Force specific exponent | +| `roundingMethod` | string | `"round"` | Math rounding method | +| `precision` | number | `0` | Significant digits | + +### Output Formats + +```mermaid +graph TD + Input[filesize(1536, options)] --> Format{Output Format} + + Format -->|string| String["1.5 KB"] + Format -->|array| Array["[1.5, 'KB']"] + Format -->|object| Object["{value: 1.5, symbol: 'KB', exponent: 1, unit: 'KB'}"] + Format -->|exponent| Exp["1"] + + style Input fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style String fill:#d97706,stroke:#b45309,stroke-width:2px,color:#ffffff + style Array fill:#7c2d12,stroke:#92400e,stroke-width:2px,color:#ffffff + style Object fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff + style Exp fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff +``` + +## Usage Patterns + +### Basic Usage + +```javascript +import { filesize } from 'filesize'; + +// Simple conversion +filesize(1024); // "1 KB" +filesize(1536); // "1.5 KB" +filesize(1073741824); // "1 GB" +``` + +### Advanced Configuration + +```javascript +// IEC binary standard +filesize(1024, { standard: "IEC" }); // "1 KiB" + +// High precision +filesize(1536, { round: 3 }); // "1.500 KB" + +// Bits instead of bytes +filesize(1024, { bits: true }); // "8 Kb" + +// Object output for programmatic use +filesize(1536, { output: "object" }); +// { value: 1.5, symbol: "KB", exponent: 1, unit: "KB" } +``` + +### Functional Programming Pattern + +```javascript +import { partial } from 'filesize'; + +// Create specialized formatters +const formatBinary = partial({ standard: "IEC", round: 1 }); +const formatPrecise = partial({ round: 4, pad: true }); + +formatBinary(1024); // "1.0 KiB" +formatPrecise(1536); // "1.5000 KB" +``` + +## Modern Application Examples (2025) + +### 1. Cloud Storage Dashboard + +```javascript +// components/StorageWidget.js +import { filesize, partial } from 'filesize'; +import { useLocale } from '@/hooks/useLocale'; + +const formatStorage = partial({ + standard: "IEC", + round: 1, + output: "object" +}); + +function StorageWidget({ usage, quota }) { + const { locale } = useLocale(); + + const usageFormatted = filesize(usage, { + locale, + standard: "IEC", + localeOptions: { notation: "compact" } + }); + + const quotaFormatted = filesize(quota, { + locale, + standard: "IEC" + }); + + const percentage = (usage / quota) * 100; + + return ( +
+
+

{usageFormatted} of {quotaFormatted} used

+
+ ); +} +``` + +### 2. File Upload Progress (React/Vue) + +```javascript +// hooks/useFileUpload.js +import { filesize } from 'filesize'; +import { useState, useCallback } from 'react'; + +export function useFileUpload() { + const [uploads, setUploads] = useState([]); + + const formatBytes = useCallback((bytes, locale = 'en-US') => { + return filesize(bytes, { + locale, + round: 1, + localeOptions: { + minimumFractionDigits: 1, + maximumFractionDigits: 1 + } + }); + }, []); + + const addUpload = useCallback((file) => { + const upload = { + id: crypto.randomUUID(), + name: file.name, + size: file.size, + sizeFormatted: formatBytes(file.size), + progress: 0, + uploaded: 0 + }; + + setUploads(prev => [...prev, upload]); + return upload.id; + }, [formatBytes]); + + const updateProgress = useCallback((id, uploaded) => { + setUploads(prev => prev.map(upload => { + if (upload.id === id) { + const progress = (uploaded / upload.size) * 100; + return { + ...upload, + uploaded, + uploadedFormatted: formatBytes(uploaded), + progress: Math.min(100, progress) + }; + } + return upload; + })); + }, [formatBytes]); + + return { uploads, addUpload, updateProgress }; +} +``` + +### 3. Mobile App Data Usage Tracker + +```javascript +// utils/dataTracker.js +import { filesize, partial } from 'filesize'; + +class DataUsageTracker { + constructor(locale = 'en-US') { + this.locale = locale; + this.formatData = partial({ + bits: true, + standard: "IEC", + locale: this.locale, + round: 1 + }); + + this.formatBytes = partial({ + standard: "IEC", + locale: this.locale, + round: 2 + }); + } + + // Format network speeds + formatSpeed(bytesPerSecond) { + const bitsPerSecond = bytesPerSecond * 8; + return `${this.formatData(bitsPerSecond)}/s`; + } + + // Format data consumption + formatUsage(bytes) { + return this.formatBytes(bytes); + } + + // Generate usage report + generateReport(dailyUsage) { + const total = dailyUsage.reduce((sum, day) => sum + day.bytes, 0); + const average = total / dailyUsage.length; + + return { + total: this.formatUsage(total), + average: this.formatUsage(average), + peak: this.formatUsage(Math.max(...dailyUsage.map(d => d.bytes))), + details: dailyUsage.map(day => ({ + ...day, + formatted: this.formatUsage(day.bytes) + })) + }; + } +} + +// Usage in React Native +export const dataTracker = new DataUsageTracker(); +``` + +### 4. Progressive Web App (PWA) Cache Management + +```javascript +// service-worker.js - Cache size monitoring +import { filesize } from 'filesize'; + +class CacheManager { + async getCacheSize() { + const cacheNames = await caches.keys(); + let totalSize = 0; + + for (const cacheName of cacheNames) { + const cache = await caches.open(cacheName); + const requests = await cache.keys(); + + for (const request of requests) { + const response = await cache.match(request); + if (response) { + const blob = await response.blob(); + totalSize += blob.size; + } + } + } + + return { + bytes: totalSize, + formatted: filesize(totalSize, { + standard: "IEC", + round: 1 + }) + }; + } + + async cleanupCache(maxSize = 50 * 1024 * 1024) { // 50MB default + const { bytes } = await this.getCacheSize(); + + if (bytes > maxSize) { + // Cleanup logic + console.log(`Cache size ${filesize(bytes)} exceeds limit ${filesize(maxSize)}`); + // Implementation... + } + } +} +``` + +### 5. Real-time System Monitoring Dashboard + +```javascript +// components/SystemMetrics.tsx +import { filesize } from 'filesize'; +import { useEffect, useState } from 'react'; + +interface SystemMetrics { + memory: { + used: number; + total: number; + }; + disk: { + used: number; + total: number; + }; + network: { + download: number; + upload: number; + }; +} + +export function SystemMetrics() { + const [metrics, setMetrics] = useState(null); + const [locale] = useState(() => navigator.language); + + const formatMetric = (value: number, options = {}) => + filesize(value, { + locale, + standard: "IEC", + round: 1, + ...options + }); + + const formatSpeed = (bytesPerSecond: number) => + `${formatMetric(bytesPerSecond * 8, { bits: true })}/s`; + + useEffect(() => { + const ws = new WebSocket('ws://localhost:8080/metrics'); + + ws.onmessage = (event) => { + const data = JSON.parse(event.data); + setMetrics(data); + }; + + return () => ws.close(); + }, []); + + if (!metrics) return
Loading...
; + + return ( +
+ + + + + +
+ ); +} +``` + +## Internationalization & Localization + +### Global Locale Support + +```mermaid +graph TB + subgraph "Locale Processing" + A[Input Locale] --> B{Locale Type} + B -->|true| C[System Locale] + B -->|string| D[Specific Locale] + B -->|empty| E[No Localization] + + C --> F[navigator.language] + D --> G[Custom Locale] + F --> H[toLocaleString()] + G --> H + + H --> I[Formatted Number] + E --> J[toString()] + J --> K[Apply Custom Separator] + end + + style A fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style I fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff + style K fill:#d97706,stroke:#b45309,stroke-width:2px,color:#ffffff +``` + +### Localization Examples + +```javascript +// Multi-language file size formatting +const localizedFormatters = { + 'en-US': partial({ locale: 'en-US', standard: "JEDEC" }), + 'en-GB': partial({ locale: 'en-GB', standard: "IEC" }), + 'de-DE': partial({ locale: 'de-DE', standard: "IEC", separator: ',' }), + 'fr-FR': partial({ locale: 'fr-FR', standard: "SI" }), + 'ja-JP': partial({ locale: 'ja-JP', standard: "IEC" }), + 'zh-CN': partial({ locale: 'zh-CN', standard: "IEC" }), + 'ar-SA': partial({ locale: 'ar-SA', standard: "IEC" }) +}; + +// Usage in internationalized app +function formatFileSize(bytes, userLocale = 'en-US') { + const formatter = localizedFormatters[userLocale] || localizedFormatters['en-US']; + return formatter(bytes); +} + +// Examples +formatFileSize(1536, 'en-US'); // "1.5 KB" +formatFileSize(1536, 'de-DE'); // "1,5 KB" (German decimal separator) +formatFileSize(1536, 'fr-FR'); // "1,5 ko" (French locale) +``` + +### Advanced Locale Configuration + +```javascript +// Custom locale options for different regions +const regionConfigs = { + europe: { + locale: 'en-GB', + standard: 'IEC', + localeOptions: { + minimumFractionDigits: 1, + maximumFractionDigits: 2 + } + }, + + asia: { + locale: 'ja-JP', + standard: 'IEC', + localeOptions: { + notation: 'compact', + compactDisplay: 'short' + } + }, + + americas: { + locale: 'en-US', + standard: 'JEDEC', + localeOptions: { + style: 'decimal' + } + } +}; + +// Context-aware formatting +class LocalizedFileSize { + constructor(region = 'americas') { + this.config = regionConfigs[region]; + this.formatter = partial(this.config); + } + + format(bytes) { + return this.formatter(bytes); + } + + formatWithContext(bytes, context = 'storage') { + const contextOptions = { + storage: { standard: 'IEC' }, + network: { bits: true, standard: 'SI' }, + memory: { standard: 'IEC', round: 0 } + }; + + return filesize(bytes, { + ...this.config, + ...contextOptions[context] + }); + } +} +``` + +### RTL Language Support + +```javascript +// Right-to-left language support +function formatWithDirection(bytes, locale) { + const rtlLocales = ['ar', 'he', 'fa', 'ur']; + const isRTL = rtlLocales.some(lang => locale.startsWith(lang)); + + const formatted = filesize(bytes, { locale }); + + if (isRTL) { + // For RTL languages, you might want to adjust spacing or direction + return `${formatted}`; + } + + return formatted; +} +``` + +## Performance Considerations + +### Optimization Strategies + +```mermaid +graph TD + subgraph "Performance Optimization" + A[Input Caching] --> B[Formatter Reuse] + B --> C[Locale Memoization] + C --> D[Output Pooling] + + E[Batch Processing] --> F[Web Workers] + F --> G[Lazy Loading] + + A --> H[Memory Efficiency] + E --> H + + H --> I[Optimized Performance] + end + + style A fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff + style I fill:#1e40af,stroke:#1e3a8a,stroke-width:2px,color:#ffffff +``` + +### Optimized Usage Patterns + +```javascript +// 1. Formatter Reuse +const commonFormatter = partial({ + standard: "IEC", + round: 1, + locale: "en-US" +}); + +// Reuse instead of creating new options each time +const sizes = [1024, 2048, 4096].map(commonFormatter); + +// 2. Memoization for expensive operations +const memoizedFilesize = (() => { + const cache = new Map(); + + return (bytes, options = {}) => { + const key = `${bytes}-${JSON.stringify(options)}`; + + if (cache.has(key)) { + return cache.get(key); + } + + const result = filesize(bytes, options); + cache.set(key, result); + + // Prevent memory leaks + if (cache.size > 1000) { + const firstKey = cache.keys().next().value; + cache.delete(firstKey); + } + + return result; + }; +})(); + +// 3. Batch processing for large datasets +function formatFileSizes(files, options = {}) { + const formatter = partial(options); + return files.map(file => ({ + ...file, + sizeFormatted: formatter(file.size) + })); +} + +// 4. Web Worker for heavy processing +// worker.js +self.onmessage = function(e) { + const { files, options } = e.data; + + importScripts('./filesize.js'); + + const formatted = files.map(file => ({ + id: file.id, + size: filesize(file.size, options) + })); + + self.postMessage(formatted); +}; +``` + +## Integration Patterns + +### Framework-Specific Integrations + +#### React Hook + +```javascript +// hooks/useFilesize.js +import { filesize, partial } from 'filesize'; +import { useMemo, useCallback } from 'react'; + +export function useFilesize(options = {}) { + const formatter = useMemo(() => partial(options), [options]); + + const format = useCallback((bytes) => { + if (typeof bytes !== 'number' && typeof bytes !== 'bigint') { + return 'Invalid size'; + } + + try { + return formatter(bytes); + } catch (error) { + console.error('Filesize formatting error:', error); + return 'Error'; + } + }, [formatter]); + + return { format, formatter }; +} + +// Usage +function FileList({ files }) { + const { format } = useFilesize({ + standard: 'IEC', + locale: navigator.language + }); + + return ( +
    + {files.map(file => ( +
  • + {file.name} - {format(file.size)} +
  • + ))} +
+ ); +} +``` + +#### Vue Composable + +```javascript +// composables/useFilesize.js +import { filesize, partial } from 'filesize'; +import { computed, ref } from 'vue'; + +export function useFilesize(defaultOptions = {}) { + const options = ref(defaultOptions); + + const formatter = computed(() => partial(options.value)); + + const format = (bytes) => { + try { + return formatter.value(bytes); + } catch (error) { + console.error('Filesize error:', error); + return 'Error'; + } + }; + + const updateOptions = (newOptions) => { + options.value = { ...options.value, ...newOptions }; + }; + + return { + format, + options: readonly(options), + updateOptions + }; +} +``` + +#### Angular Service + +```typescript +// services/filesize.service.ts +import { Injectable } from '@angular/core'; +import { filesize, partial } from 'filesize'; + +@Injectable({ + providedIn: 'root' +}) +export class FilesizeService { + private formatters = new Map(); + + getFormatter(options: any = {}): Function { + const key = JSON.stringify(options); + + if (!this.formatters.has(key)) { + this.formatters.set(key, partial(options)); + } + + return this.formatters.get(key)!; + } + + format(bytes: number | bigint, options: any = {}): string { + return this.getFormatter(options)(bytes); + } + + formatWithLocale(bytes: number | bigint, locale: string): string { + return this.format(bytes, { locale, standard: 'IEC' }); + } +} +``` + +### Server-Side Integration + +```javascript +// Express.js middleware +function filesizeMiddleware(options = {}) { + const formatter = partial(options); + + return (req, res, next) => { + res.formatFilesize = (bytes) => formatter(bytes); + next(); + }; +} + +// Usage +app.use(filesizeMiddleware({ standard: 'IEC', locale: 'en-US' })); + +app.get('/api/files', (req, res) => { + const files = getFiles().map(file => ({ + ...file, + sizeFormatted: res.formatFilesize(file.size) + })); + + res.json(files); +}); +``` + +## Troubleshooting + +### Common Issues and Solutions + +#### Issue: Inconsistent Output Across Locales + +```javascript +// Problem: Different locales produce different decimal separators +filesize(1536, { locale: 'en-US' }); // "1.5 KB" +filesize(1536, { locale: 'de-DE' }); // "1,5 KB" + +// Solution: Normalize for API consistency +function normalizedFilesize(bytes, options = {}) { + const result = filesize(bytes, options); + + // If you need consistent decimal separators for APIs + if (options.normalizeDecimal) { + return result.replace(',', '.'); + } + + return result; +} +``` + +#### Issue: BigInt Support in Older Environments + +```javascript +// Problem: BigInt not supported in older browsers + +// Solution: Graceful fallback +function safeBigIntFilesize(value, options = {}) { + try { + return filesize(value, options); + } catch (error) { + if (error.message.includes('BigInt')) { + // Convert BigInt to number with potential precision loss warning + const num = Number(value); + if (num === Infinity) { + return 'Size too large'; + } + return filesize(num, options); + } + throw error; + } +} +``` + +#### Issue: Performance with Large Datasets + +```javascript +// Problem: Formatting thousands of file sizes is slow + +// Solution: Virtual scrolling with memoization +class VirtualizedFileSizeFormatter { + constructor(options = {}) { + this.formatter = partial(options); + this.cache = new Map(); + this.maxCacheSize = 1000; + } + + format(bytes) { + if (this.cache.has(bytes)) { + return this.cache.get(bytes); + } + + const result = this.formatter(bytes); + + if (this.cache.size >= this.maxCacheSize) { + const firstKey = this.cache.keys().next().value; + this.cache.delete(firstKey); + } + + this.cache.set(bytes, result); + return result; + } + + batchFormat(bytesArray) { + return bytesArray.map(bytes => this.format(bytes)); + } +} +``` + +### Debugging Tools + +```javascript +// Debug helper for troubleshooting +function debugFilesize(bytes, options = {}) { + console.group('Filesize Debug'); + console.log('Input:', bytes, typeof bytes); + console.log('Options:', options); + + try { + const result = filesize(bytes, { ...options, output: 'object' }); + console.log('Parsed result:', result); + + const stringResult = filesize(bytes, options); + console.log('Final output:', stringResult); + + return stringResult; + } catch (error) { + console.error('Error:', error); + throw error; + } finally { + console.groupEnd(); + } +} +``` + +### Error Handling Best Practices + +```javascript +// Comprehensive error handling wrapper +function robustFilesize(bytes, options = {}, fallback = 'Unknown size') { + try { + // Input validation + if (bytes == null) { + throw new Error('Input cannot be null or undefined'); + } + + // Type coercion with warnings + if (typeof bytes === 'string') { + const parsed = parseFloat(bytes); + if (isNaN(parsed)) { + throw new Error('String input could not be parsed as number'); + } + console.warn('String input converted to number:', bytes, '→', parsed); + bytes = parsed; + } + + return filesize(bytes, options); + + } catch (error) { + console.error('Filesize error:', error.message, { bytes, options }); + + // Return fallback instead of throwing + return fallback; + } +} +``` + +--- + +## Conclusion + +This technical documentation provides a comprehensive guide to integrating filesize.js into modern applications. The library's flexibility, performance optimizations, and internationalization support make it ideal for 2025's global, multi-platform applications. + +For additional support, examples, or contributions, visit the [project repository](https://github.com/avoidwork/filesize.js) or refer to the [API documentation](./API_REFERENCE.md). \ No newline at end of file From 83d3caf17f16cbeeac4bbb60177884fdd2c4c296 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:31:48 -0400 Subject: [PATCH 07/10] Updating docs --- docs/TECHNICAL_DOCUMENTATION.md | 47 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/docs/TECHNICAL_DOCUMENTATION.md b/docs/TECHNICAL_DOCUMENTATION.md index 008127a..78e3992 100644 --- a/docs/TECHNICAL_DOCUMENTATION.md +++ b/docs/TECHNICAL_DOCUMENTATION.md @@ -227,12 +227,12 @@ Creates a partially applied function with preset options. ```mermaid graph TD - Input[filesize(1536, options)] --> Format{Output Format} + Input["filesize(1536, options)"] --> Format{Output Format} - Format -->|string| String["1.5 KB"] - Format -->|array| Array["[1.5, 'KB']"] - Format -->|object| Object["{value: 1.5, symbol: 'KB', exponent: 1, unit: 'KB'}"] - Format -->|exponent| Exp["1"] + Format -->|string| String["String: '1.5 KB'"] + Format -->|array| Array["Array: 1.5, 'KB'"] + Format -->|object| Object["Object: value, symbol, exponent, unit"] + Format -->|exponent| Exp["Number: 1"] style Input fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff style String fill:#d97706,stroke:#b45309,stroke-width:2px,color:#ffffff @@ -241,6 +241,23 @@ graph TD style Exp fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff ``` +#### Output Format Examples + +```javascript +// String output (default) +filesize(1536) // "1.5 KB" + +// Array output +filesize(1536, { output: "array" }) // [1.5, "KB"] + +// Object output +filesize(1536, { output: "object" }) +// { value: 1.5, symbol: "KB", exponent: 1, unit: "KB" } + +// Exponent output +filesize(1536, { output: "exponent" }) // 1 +``` + ## Usage Patterns ### Basic Usage @@ -560,19 +577,19 @@ export function SystemMetrics() { ```mermaid graph TB subgraph "Locale Processing" - A[Input Locale] --> B{Locale Type} - B -->|true| C[System Locale] - B -->|string| D[Specific Locale] - B -->|empty| E[No Localization] + A["Input Locale"] --> B{"Locale Type"} + B -->|"true"| C["System Locale"] + B -->|"string"| D["Specific Locale"] + B -->|"empty"| E["No Localization"] - C --> F[navigator.language] - D --> G[Custom Locale] - F --> H[toLocaleString()] + C --> F["navigator.language"] + D --> G["Custom Locale"] + F --> H["toLocaleString()"] G --> H - H --> I[Formatted Number] - E --> J[toString()] - J --> K[Apply Custom Separator] + H --> I["Formatted Number"] + E --> J["toString()"] + J --> K["Apply Custom Separator"] end style A fill:#166534,stroke:#15803d,stroke-width:2px,color:#ffffff From 1d680d4e48a88d02ae8615f91af1d4a84abe0470 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:39:36 -0400 Subject: [PATCH 08/10] Updating github workflows --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1da6940..4f5965e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x, 22.x] steps: - name: Checkout Repository @@ -21,7 +21,7 @@ jobs: fetch-depth: 1 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: always-auth: false node-version: ${{ matrix.node-version }} @@ -30,10 +30,10 @@ jobs: run: npm install - name: Build - run: npm run rollup + run: npm run build - name: Run Tests - run: npm run test + run: npm test automerge: needs: build From ce6d77f4fdb250a3f8ba2cbf94afff233c28a4f8 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:41:20 -0400 Subject: [PATCH 09/10] Returning 'module' to 'package.json' --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d0a6727..82c6f0a 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ ], "license": "BSD-3-Clause", "source": "src/filesize.js", + "module": "dist/filesize.js", "main": "dist/filesize.cjs", "exports": { "types": "./types/filesize.d.ts", From 9141455185b8a8386a097d9ac221c74c832d8e8c Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 11 Jul 2025 08:42:33 -0400 Subject: [PATCH 10/10] Returning 'sourceType' to 'package.json' --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 82c6f0a..48e6c52 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "require": "./dist/filesize.cjs" }, "type": "module", + "sourceType": "module", "types": "types/filesize.d.ts", "engines": { "node": ">= 10.4.0"