@karmaniverous/stan-cli 0.11.7 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/dist/cjs/classifier-Bqzr65UC-D9z0tWqn.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cli/{capture-DKrVoDyl.js → capture-CiVimFuL.js} +1 -1
- package/dist/cli/classifier-Bqzr65UC-BlsMFS8t.js +7 -0
- package/dist/cli/{config-fallback-CV720XTz.js → config-fallback-CL_TDiMw.js} +1 -1
- package/dist/cli/{context-PS5ukh8q.js → context-BzEQ3A1v.js} +1 -1
- package/dist/cli/{index-Cq8YEju6.js → index-DXJaQ46Q.js} +1236 -867
- package/dist/cli/stan.js +904 -170
- package/dist/mjs/classifier-Bqzr65UC-DJLYQY2b.js +1 -0
- package/dist/mjs/index.js +1 -1
- package/dist/types/index.d.ts +30 -2
- package/package.json +27 -27
- package/dist/cjs/classifier-DeYwffC_-CjzCgatc.js +0 -1
- package/dist/cli/classifier-DeYwffC_-DftahF7h.js +0 -7
- package/dist/mjs/classifier-DeYwffC_-C7wwqop3.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stat as t,open as e,readFile as n}from"node:fs/promises";import{resolve as s}from"node:path";const r=1048576;async function o(o,i){const a=[],c=[],h=[];await Promise.all(i.map(async i=>{const l=i.replace(/\\/g,"/"),u=s(o,i);let p=0;try{p=(await t(u)).size}catch{return}let f,g=!1;try{g=await(async t=>{try{const n=await e(t,"r");try{const t=Buffer.allocUnsafe(8192),{bytesRead:e}=await n.read(t,0,t.length,0);for(let n=0;n<e;n+=1)if(0===t[n])return!0;return!1}finally{await n.close().catch(()=>{})}}catch{return!1}})(u)}catch{g=!1}if(g)c.push({path:l,size:p});else{a.push(l);try{(p<=r||p<5*r)&&(f=(t=>{const e=t.replace(/\r\n/g,"\n");return 0===e.length?0:e.split("\n").length})(await n(u,"utf8")))}catch{}(p>r||"number"==typeof f&&f>3e3)&&h.push({path:l,size:p,loc:f})}}));const l=[];if(c.length>0){l.push(`Binary files excluded from archive (${c.length.toString()}):`);for(const t of c)l.push(` - ${t.path} (${t.size.toString()} bytes)`);l.push("")}if(h.length>0){l.push(`Large text files (included; consider excludes if unwanted) (${h.length.toString()}):`);for(const t of h){const e=[` - ${t.path}`,`(${t.size.toString()} bytes)`];"number"==typeof t.loc&&e.push(`${t.loc.toString()} LOC`),l.push(e.join(" "))}l.push(""),l.push(`Thresholds: size > ${r.toString()} bytes or LOC > ${3e3.toString()}`)}0===l.length&&l.push("No archive warnings.");const u=l.join("\n")+(l.length?"\n":"");return{textFiles:a,excludedBinaries:c,largeText:h,warningsBody:u}}export{o as classifyForArchive};
|