+1
-277
@@ -1,277 +0,1 @@ | ||
| import { createRequire as w } from "module"; | ||
| var m = {}; | ||
| (() => { | ||
| m.d = (e, t) => { | ||
| for (var i in t) { | ||
| if (m.o(t, i) && !m.o(e, i)) { | ||
| Object.defineProperty(e, i, { enumerable: true, get: t[i] }); | ||
| } | ||
| } | ||
| }; | ||
| })(); | ||
| (() => { | ||
| m.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t); | ||
| })(); | ||
| var F = {}; | ||
| m.d(F, { | ||
| A: () => ( | ||
| /* binding */ | ||
| N | ||
| ) | ||
| }); | ||
| ; | ||
| const $ = w(import.meta.url)("node:path"); | ||
| ; | ||
| const n = w(import.meta.url)("node:fs"); | ||
| ; | ||
| const d = async (e, t, i) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| if (e === t) { | ||
| throw Error(`\u8BE5\u6587\u4EF6\u5939\u4E0D\u80FD\u88AB\u5220\u9664!`); | ||
| } | ||
| const r = await n.statSync(e); | ||
| if (r.isFile()) { | ||
| await n.unlinkSync(e); | ||
| return e; | ||
| } | ||
| if (r.isDirectory()) { | ||
| const s = await n.readdirSync(e); | ||
| for (let u = 0, o = s.length; u < o; u++) { | ||
| await d(`${e}${i}${s[u]}`, t, i); | ||
| } | ||
| await n.rmdirSync(e); | ||
| return e; | ||
| } | ||
| }; | ||
| const y = d; | ||
| ; | ||
| const O = (e) => { | ||
| const t = e.split("."); | ||
| if (t.filter(Boolean).length < 2) { | ||
| return; | ||
| } | ||
| const i = t.slice(0, -1).join("."); | ||
| const [r] = t.slice(-1); | ||
| return [i, r]; | ||
| }; | ||
| const _ = (e = "/", t) => { | ||
| const i = e.split(t); | ||
| const r = i.slice(0, -1).join(t) || "/"; | ||
| const [s] = i.slice(-1); | ||
| return [s, r]; | ||
| }; | ||
| ; | ||
| const E = async (e, t, i) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| const r = await n.statSync(e); | ||
| if (r.isFile()) { | ||
| const s = e.split(i).slice(-1)[0]; | ||
| let u = `${t}${i}${s}`; | ||
| if (n.existsSync(u)) { | ||
| const o = O(s); | ||
| if (!o) { | ||
| u = `${u}_copy_${+/* @__PURE__ */ new Date()}`; | ||
| } else { | ||
| const [l, f] = o; | ||
| u = `${t}${i}${l}_copy_${+/* @__PURE__ */ new Date()}.${f}`; | ||
| } | ||
| } | ||
| await n.copyFileSync(e, u); | ||
| return u; | ||
| } | ||
| if (r.isDirectory()) { | ||
| const s = e.split(i).slice(-1)[0]; | ||
| let u = `${t}${i}${s}`; | ||
| if (n.existsSync(u)) { | ||
| u = `${u}_copy_${+/* @__PURE__ */ new Date()}`; | ||
| } | ||
| await n.mkdirSync(u); | ||
| const o = await n.readdirSync(e); | ||
| for (let l = 0, f = o.length; l < f; l++) { | ||
| await E(`${e}${i}${o[l]}`, u, i); | ||
| } | ||
| return u; | ||
| } | ||
| }; | ||
| const v = async (e, t, i, r) => { | ||
| if (e === t) { | ||
| return; | ||
| } | ||
| await E(e, t, r); | ||
| await y(e, i, r); | ||
| }; | ||
| ; | ||
| const j = async (e, t = false, i, r) => { | ||
| if (n.existsSync(e)) { | ||
| if (!t) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u5939\u5DF2\u5B58\u5728!`); | ||
| } | ||
| await y(e, i, r); | ||
| } | ||
| await n.mkdirSync(e); | ||
| return e; | ||
| }; | ||
| const k = async (e, t = false, i = "", r, s) => { | ||
| if (n.existsSync(e)) { | ||
| if (i) { | ||
| await n.writeFileSync(e, i); | ||
| return; | ||
| } | ||
| if (!t) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u5DF2\u5B58\u5728!`); | ||
| } | ||
| await y(e, r, s); | ||
| } | ||
| await n.writeFileSync(e, i); | ||
| return e; | ||
| }; | ||
| ; | ||
| const R = async (e, t) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| const i = await n.statSync(e); | ||
| if (!i.isFile()) { | ||
| throw Error(`[${e}] \u4E0D\u662F\u4E00\u4E2A\u6587\u4EF6!`); | ||
| } | ||
| const r = await n.readFileSync(e); | ||
| const [s, u] = _(e, t); | ||
| return { | ||
| dir: u, | ||
| filename: s, | ||
| type: s.split(".").slice(-1)[0], | ||
| size: i.size, | ||
| mtime: i.mtime, | ||
| birthtime: i.birthtime, | ||
| data: r.toString() | ||
| }; | ||
| }; | ||
| const S = async (e, t) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| const i = await n.statSync(e); | ||
| const [r, s] = _(e, t); | ||
| if (i.isFile()) { | ||
| return { | ||
| dir: s, | ||
| filename: r, | ||
| type: r.split(".").slice(-1)[0], | ||
| size: i.size, | ||
| mtime: i.mtime, | ||
| birthtime: i.birthtime | ||
| }; | ||
| } else if (i.isDirectory()) { | ||
| return { | ||
| dir: s, | ||
| filename: r, | ||
| type: "dir", | ||
| size: i.size, | ||
| mtime: i.ctime, | ||
| birthtime: i.birthtime | ||
| }; | ||
| } | ||
| }; | ||
| const h = async (e, t) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| const i = await n.readdirSync(e); | ||
| const r = []; | ||
| for (let s = 0, u = i.length; s < u; s++) { | ||
| try { | ||
| const o = await S(`${e}${t}${i[s]}`, t); | ||
| r.push(o); | ||
| } catch (o) { | ||
| continue; | ||
| } | ||
| } | ||
| return r; | ||
| }; | ||
| const x = async (e = "", t) => { | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| const i = await n.readdirSync(e); | ||
| const r = []; | ||
| for (let s = 0, u = i.length; s < u; s++) { | ||
| const o = `${e}${t}${i[s]}`; | ||
| const l = await n.statSync(o); | ||
| if (l.isFile()) { | ||
| r.push({ | ||
| fullname: o, | ||
| type: o.split(".").slice(-1)[0], | ||
| size: l.size, | ||
| mtime: l.mtime, | ||
| birthtime: l.birthtime | ||
| }); | ||
| } else if (l.isDirectory()) { | ||
| r.push({ | ||
| fullname: o, | ||
| type: "dir", | ||
| size: l.size, | ||
| mtime: l.mtime, | ||
| birthtime: l.birthtime | ||
| }); | ||
| const f = await x(o, t); | ||
| r.push(...f); | ||
| } | ||
| } | ||
| return r; | ||
| }; | ||
| ; | ||
| const q = async (e, t, i) => { | ||
| if (e === t) { | ||
| return; | ||
| } | ||
| if (!n.existsSync(e)) { | ||
| throw Error(`[${e}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`); | ||
| } | ||
| if (n.existsSync(t)) { | ||
| throw Error(`[${t}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u5DF2\u5B58\u5728!`); | ||
| } | ||
| if (e === i) { | ||
| throw Error(`\u8BE5\u6587\u4EF6\u5939\u4E0D\u80FD\u88AB\u91CD\u65B0\u547D\u540D!`); | ||
| } | ||
| await n.renameSync(e, t); | ||
| }; | ||
| const P = q; | ||
| ; | ||
| ; | ||
| const C = (e, t) => e ? e.charAt(e.length - 1) === t ? e.slice(0, -1) : e : ""; | ||
| const I = (e = "", t = "/", i) => { | ||
| if (e.indexOf(`${t}${i}`) === 0) { | ||
| return C(e, i); | ||
| } | ||
| if (e.indexOf(`..${i}`) !== -1) { | ||
| throw Error("\u4E0D\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84\uFF01"); | ||
| } | ||
| return $.resolve(t, `${e.indexOf(i) === 0 ? "." : `.${i}`}${e}`); | ||
| }; | ||
| const K = I; | ||
| ; | ||
| const L = (e) => { | ||
| const t = $.sep; | ||
| const i = e?.rootpath ?? e ?? "/"; | ||
| const r = (c) => K(c, i, t); | ||
| const s = (c, a) => E(r(c), r(a), t); | ||
| const u = (c, a) => v(r(c), r(a), i, t); | ||
| const o = (c, a) => j(r(c), a, i, t); | ||
| const l = (c, a, g) => k(r(c), a, g, i, t); | ||
| const f = (c) => R(r(c), t); | ||
| const D = (c) => S(r(c), t); | ||
| const b = (c) => h(r(c), t); | ||
| const B = (c) => x(r(c), t); | ||
| const A = (c) => y(r(c), i, t); | ||
| const z = (c, a) => P(r(c), r(a), i); | ||
| return { copyfile: s, movefile: u, mkdir: o, touch: l, openfile: f, readfile: D, readdir: b, readAllFile: B, rmfile: A, rnfile: z }; | ||
| }; | ||
| const N = L; | ||
| var T = F.A; | ||
| export { | ||
| T as default | ||
| }; | ||
| import q from"node:path";import y from"node:fs";import $ from"node:fs";var D=async(i,t,e)=>{if(!$.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);if(i===t)throw Error("\u8BE5\u6587\u4EF6\u5939\u4E0D\u80FD\u88AB\u5220\u9664!");let r=await $.statSync(i);if(r.isFile())return await $.unlinkSync(i),i;if(r.isDirectory()){let o=await $.readdirSync(i);for(let n=0,f=o.length;n<f;n++)await D(`${i}${e}${o[n]}`,t,e);return await $.rmdirSync(i),i}},a=D;var v=i=>{let t=i.split(".");if(t.filter(Boolean).length<2)return;let e=t.slice(0,-1).join("."),[r]=t.slice(-1);return[e,r]},p=(i="/",t)=>{let e=i.split(t),r=e.slice(0,-1).join(t)||"/",[o]=e.slice(-1);return[o,r]};var w=async(i,t,e)=>{if(!y.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);let r=await y.statSync(i);if(r.isFile()){let o=i.split(e).slice(-1)[0],n=`${t}${e}${o}`;if(y.existsSync(n)){let f=v(o);if(!f)n=`${n}_copy_${+new Date}`;else{let[l,d]=f;n=`${t}${e}${l}_copy_${+new Date}.${d}`}}return await y.copyFileSync(i,n),n}if(r.isDirectory()){let o=i.split(e).slice(-1)[0],n=`${t}${e}${o}`;y.existsSync(n)&&(n=`${n}_copy_${+new Date}`),await y.mkdirSync(n);let f=await y.readdirSync(i);for(let l=0,d=f.length;l<d;l++)await w(`${i}${e}${f[l]}`,n,e);return n}},A=async(i,t,e,r)=>{i!==t&&(await w(i,t,r),await a(i,e,r))};import x from"node:fs";var E=async(i,t=!1,e,r)=>{if(x.existsSync(i)){if(!t)throw Error(`[${i}] \u6587\u4EF6\u5939\u5DF2\u5B58\u5728!`);await a(i,e,r)}return await x.mkdirSync(i),i},F=async(i,t=!1,e="",r,o)=>{if(x.existsSync(i)){if(e){await x.writeFileSync(i,e);return}if(!t)throw Error(`[${i}] \u6587\u4EF6\u5DF2\u5B58\u5728!`);await a(i,r,o)}return await x.writeFileSync(i,e),i};import c from"node:fs";var b=async(i,t)=>{if(!c.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);let e=await c.statSync(i);if(!e.isFile())throw Error(`[${i}] \u4E0D\u662F\u4E00\u4E2A\u6587\u4EF6!`);let r=await c.readFileSync(i),[o,n]=p(i,t);return{dir:n,filename:o,type:o.split(".").slice(-1)[0],size:e.size,mtime:e.mtime,birthtime:e.birthtime,data:r.toString()}},u=async(i,t)=>{if(!c.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);let e=await c.statSync(i),[r,o]=p(i,t);if(e.isFile())return{dir:o,filename:r,type:r.split(".").slice(-1)[0],size:e.size,mtime:e.mtime,birthtime:e.birthtime};if(e.isDirectory())return{dir:o,filename:r,type:"dir",size:e.size,mtime:e.ctime,birthtime:e.birthtime}},g=async(i,t)=>{if(!c.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);let e=await c.readdirSync(i),r=[];for(let o=0,n=e.length;o<n;o++)try{let f=await u(`${i}${t}${e[o]}`,t);r.push(f)}catch{continue}return r},S=async(i="",t)=>{if(!c.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);let e=await c.readdirSync(i),r=[];for(let o=0,n=e.length;o<n;o++){let f=`${i}${t}${e[o]}`,l=await c.statSync(f);if(l.isFile())r.push({fullname:f,type:f.split(".").slice(-1)[0],size:l.size,mtime:l.mtime,birthtime:l.birthtime});else if(l.isDirectory()){r.push({fullname:f,type:"dir",size:l.size,mtime:l.mtime,birthtime:l.birthtime});let d=await S(f,t);r.push(...d)}}return r};import z from"node:fs";var O=async(i,t,e)=>{if(i!==t){if(!z.existsSync(i))throw Error(`[${i}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u5B58\u5728!`);if(z.existsSync(t))throw Error(`[${t}] \u6587\u4EF6\u6216\u6587\u4EF6\u5939\u5DF2\u5B58\u5728!`);if(i===e)throw Error("\u8BE5\u6587\u4EF6\u5939\u4E0D\u80FD\u88AB\u91CD\u65B0\u547D\u540D!");await z.renameSync(i,t)}},k=O;import B from"node:path";var I=(i,t)=>i?i.charAt(i.length-1)===t?i.slice(0,-1):i:"",R=(i="",t="/",e)=>{if(i.indexOf(`${t}${e}`)===0)return I(i,e);if(i.indexOf(`..${e}`)!==-1)throw Error("\u4E0D\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84\uFF01");return B.resolve(t,`${i.indexOf(e)===0?".":`.${e}`}${i}`)},_=R;var C=i=>{let t=q.sep,e=i?.rootpath??i??"/",r=s=>_(s,e,t);return{copyfile:(s,m)=>w(r(s),r(m),t),movefile:(s,m)=>A(r(s),r(m),e,t),mkdir:(s,m)=>E(r(s),m,e,t),touch:(s,m,h)=>F(r(s),m,h,e,t),openfile:s=>b(r(s),t),readfile:s=>u(r(s),t),readdir:s=>g(r(s),t),readAllFile:s=>S(r(s),t),rmfile:s=>a(r(s),e,t),rnfile:(s,m)=>k(r(s),r(m),e)}},di=C;export{di as default}; |
+2
-2
| { | ||
| "name": "@huxy/fss", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "title": "fss", | ||
@@ -31,5 +31,5 @@ "feature": "0.0.1", | ||
| "engines": { | ||
| "node": ">=18.0.0" | ||
| "node": ">=22.0.0" | ||
| }, | ||
| "author": "yiru" | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
0
-100%864634
-0.26%17
-93.86%3
50%1
Infinity%