@secret-momo/utils 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/env.js CHANGED
@@ -1 +1 @@
1
- import{execSync as o}from"child_process";let n=null;function l(){if(n)return n;try{const r=o("system_profiler SPHardwareDataType",{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}),e=t=>{const i=new RegExp(`${t}:\\s+(.+)`);return r.match(i)?.[1]?.trim()??null};return n={modelName:e("Model Name"),modelIdentifier:e("Model Identifier"),chip:e("Chip")||e("Processor Name"),raw:r},n}catch{return{modelName:null,modelIdentifier:null,chip:null,raw:""}}}function m(){const{modelName:r,chip:e}=l();return`${r}(${e})`}export{m as getNodeName};
1
+ import{execSync as o}from"node:child_process";let n=null;function l(){if(n)return n;try{const r=o("system_profiler SPHardwareDataType",{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}),e=t=>{const i=new RegExp(`${t}:\\s+(.+)`);return r.match(i)?.[1]?.trim()??null};return n={modelName:e("Model Name"),modelIdentifier:e("Model Identifier"),chip:e("Chip")||e("Processor Name"),raw:r},n}catch{return{modelName:null,modelIdentifier:null,chip:null,raw:""}}}function m(){const{modelName:r,chip:e}=l();return`${r}(${e})`}export{m as getNodeName};
package/lib/file.js CHANGED
@@ -1 +1 @@
1
- import{statSync as r}from"node:fs";const o=["b","kb","mb","gb","tb"];function i(n){if(n<1024)return`${n}b`;const t=Math.min(Math.floor(Math.log(n)/Math.log(1024)),o.length-1);return`${(n/1024**t).toFixed(2)}${o[t]}`}async function e(n){const{size:t}=r(n);return i(t)}export{e as fileSize};
1
+ import{statSync as r}from"node:fs";const n=["B","KB","MB","GB","TB"];function i(t){if(t<1024)return`${t}B`;const o=Math.min(Math.floor(Math.log(t)/Math.log(1024)),n.length-1);return`${(t/1024**o).toFixed(2)}${n[o]}`}async function e(t){const{size:o}=r(t);return i(o)}export{e as fileSize};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secret-momo/utils",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "scripts": {
30
30
  "prepublishOnly": "bun run build",
31
- "build": "rm -rf lib && rollup -c && tsc -p tsconfig.json"
31
+ "build": "rm -rf lib && rollup -c && tsc -p tsconfig.build.json"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@eslint/config-helpers": "0.6.0",