zeed 0.7.95 → 0.7.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-M7T7UAH7.js → chunk-DTCT2M2D.js} +2 -2
- package/dist/{chunk-M7T7UAH7.js.map → chunk-DTCT2M2D.js.map} +1 -1
- package/dist/chunk-G7UNQQAN.js +5 -0
- package/dist/chunk-G7UNQQAN.js.map +1 -0
- package/dist/{chunk-JL5GA55T.js → chunk-GLNZJHZB.js} +2 -2
- package/dist/{chunk-JL5GA55T.js.map → chunk-GLNZJHZB.js.map} +1 -1
- package/dist/chunk-JGD3KNXY.js +2 -0
- package/dist/{chunk-LNZLD7Y3.js.map → chunk-JGD3KNXY.js.map} +1 -1
- package/dist/chunk-Z5D3PV5I.js +7 -0
- package/dist/{chunk-PRTZGAJJ.js.map → chunk-Z5D3PV5I.js.map} +1 -1
- package/dist/index.all.cjs +8 -8
- package/dist/index.all.cjs.map +1 -1
- package/dist/index.all.d.ts +3 -3
- package/dist/index.all.js +1 -1
- package/dist/index.browser.cjs +4 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +1 -1
- package/dist/index.log.cjs +1 -1
- package/dist/index.log.cjs.map +1 -1
- package/dist/index.log.js +1 -1
- package/dist/index.node.cjs +8 -8
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +1 -1
- package/dist/{log-colors-5cf23b92.d.ts → log-colors-a7617733.d.ts} +1 -1
- package/dist/{log-util-1e8a9b16.d.ts → log-util-4c3eadbf.d.ts} +1 -1
- package/dist/{uuid-1e3016ec.d.ts → uuid-7e83c0e5.d.ts} +5 -2
- package/package.json +1 -1
- package/dist/chunk-LNZLD7Y3.js +0 -2
- package/dist/chunk-M7FCO5WL.js +0 -5
- package/dist/chunk-M7FCO5WL.js.map +0 -1
- package/dist/chunk-PRTZGAJJ.js +0 -7
package/dist/chunk-PRTZGAJJ.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{Xa as K,ib as j,oa as $}from"./chunk-M7FCO5WL.js";import{c as l,q as T,r as F,s as m,x,y as P,z as _}from"./chunk-LNZLD7Y3.js";import O from"fs";import{resolve as ae}from"path";var L=x("zeed:env"),ce=`
|
|
2
|
-
`,fe=/^\s*([\w_.-]+)\s*=\s*(.*)?\s*$/,ge=/\\n/g,ue=/\n|\r|\r\n/;function U(e,t={}){let r={};return e.toString().split(ue).forEach(function(n,i){let o=n.match(fe);if(o!=null){let c=o[1],s=o[2]||"",g=s.length-1,p=s[0]==='"'&&s[g]==='"';s[0]==="'"&&s[g]==="'"||p?(s=s.substring(1,g),p&&(s=s.replace(ge,ce))):s=s.trim(),r[c]=s}else L.debug(`did not match key and value when parsing line ${i+1}: ${n}`)}),r}l(U,"parse");function me(e,t="."){return ae(process.cwd(),e!=null?e:t)}l(me,"stringToPath");function de(e,t=""){return e==null&&(e=t),me(String(e).trim(),t)}l(de,"valueToPath");var R=de;function Ie(e={}){var i,o,c,s;let t=(o=e==null?void 0:e.path)!=null?o:R((i=e==null?void 0:e.filename)!=null?i:".env"),r=(c=e==null?void 0:e.encoding)!=null?c:"utf8",n=(e==null?void 0:e.debug)||!1;n!==!0&&(L.level=m.off);try{let g=O.existsSync(t)?U(O.readFileSync(t,{encoding:r}),{debug:n}):{},p=O.existsSync(t+".local")?U(O.readFileSync(t+".local",{encoding:r}),{debug:n}):{},y=Object.assign({},g,p),f=(s=e==null?void 0:e.env)!=null?s:process.env;return Object.entries(y).forEach(([u,d])=>{typeof(e==null?void 0:e.prefix)=="string"&&(u=(e==null?void 0:e.prefix)+u),Object.prototype.hasOwnProperty.call(f,u)?L.debug(`"${u}" is already defined and will not be overwritten`):d!=null&&(L.info(`set env.${u} = ${d}`),f[u]=d)}),{parsed:y}}catch(g){return L.error(g),{error:g}}}l(Ie,"setupEnv");import{mkdirSync as pe,readdirSync as he,readFileSync as Y,rmSync as ye,unlinkSync as be,writeFileSync as Se}from"fs";import{dirname as ve,resolve as J}from"path";var B=x("zeed:filestorage"),Q=class{constructor(t={}){this.store={};this.fileKeys=void 0;this.pretty=!1;var r,n,i,o;this.dirname=J(process.cwd(),t.path||".fileStorage"),this.pretty=!!t.pretty,this.extension=(r=t.extension)!=null?r:".json",t.extension&&!this.extension.startsWith(".")&&(this.extension="."+this.extension),this.extensionLength=this.extension.length,this.objectToString=(n=t.objectToString)!=null?n:c=>this.pretty?JSON.stringify(c,null,2):JSON.stringify(c),this.objectFromString=(i=t.objectFromString)!=null?i:c=>{try{return JSON.parse(c)}catch(s){B.warn(`fileStorage parse error '${s}' in`,c)}},this.keyToFilename=(o=t.keyToFilename)!=null?o:K}setItem(t,r){this.store[t]=j(r);try{let n=this.objectToString(r),i=this.getPath(t);pe(ve(i),{recursive:!0}),Se(i,n,"utf8")}catch(n){B.error("setItem error",n)}}getPath(t){return J(this.dirname,this.keyToFilename(t)+this.extension)}getBuffer(t){let r=this.getPath(t);return Buffer.from(Y(r))}getItem(t){let r=this.store[t];if(r!==null){if(r!=null)return j(r);try{let n=this.getPath(t),i=Y(n,"utf8");if(i!=null){let o=this.objectFromString(i);return this.store[t]=o,o}}catch(n){B.warn("getItem error",n),this.store[t]=null}}}removeItem(t){if(delete this.store[t],this.fileKeys!=null){let r=this.fileKeys.indexOf(t);r!==-1&&this.fileKeys.splice(r,1)}try{let r=this.getPath(t);be(r)}catch{}}clear(){this.fileKeys=[],this.store={},ye(this.dirname,{recursive:!0,force:!0})}allKeys(){if(this.fileKeys==null)try{this.fileKeys=he(this.dirname,{withFileTypes:!0}).filter(r=>!r.isDirectory()&&r.name.endsWith(this.extension)).map(r=>r.name.slice(0,-this.extensionLength))||[]}catch{}let t=[...this.fileKeys||[]];for(let r of Object.keys(this.store))t.includes(r)||t.push(r);return t.sort(),t}};l(Q,"FileStorage");import{createWriteStream as xe,mkdirSync as Le}from"fs";import{dirname as Ee,resolve as we}from"path";var z={};function V(e,t={}){let{level:r=m.all,filter:n="*"}=t;e=we(process.cwd(),e),Le(Ee(e),{recursive:!0});var i=xe(e,{flags:"a"});let o=T(n),c=F(r);return s=>{if(!c(s.level)||!o(s.name))return;let g=new Date().toISOString(),p=s.name||"",y=z[p||""];y==null&&(z[p]=y);let f=[`[${p||"*"}]`,$(s.messages,{pretty:!1})];function u(...d){i.write(d.join(" ")+`
|
|
3
|
-
`)}switch(l(u,"write"),s.level){case m.info:u(g,"I|* ",...f);break;case m.warn:u(g,"W|** ",...f);break;case m.error:u(g,"E|***",...f);break;default:u(g,"D| ",...f);break}}}l(V,"LoggerFileHandler");import{resolve as Z}from"path";function Ne(e){var t,r;return typeof e!="string"?[]:((r=(t=e==null?void 0:e.split(`
|
|
4
|
-
`))==null?void 0:t.map(n=>{let i=n.match(/^\s+at.*(\((.*)\)|file:\/\/(.*)$)/);if(i){let o=i[3]||i[2];return o.endsWith(")")&&(o=o.slice(0,-1)),o}}))==null?void 0:r.filter(n=>n!=null))||[]}l(Ne,"getStackLlocationList");var D=Z(process.cwd()),ee,te,H=((ee=process.env)==null?void 0:ee.HOME)?Z((te=process.env)==null?void 0:te.HOME):"";function q(e){if(e.includes("/node_modules/"))return"";let t="file://";return e.startsWith(t)?e.substr(t.length):D&&e.startsWith(D)?e.substr(D.length+1):(H&&e.startsWith(H)&&(e="~/"+e.substr(H.length+1)),e)}l(q,"pathStripCwd");function Te(e){let t=e.match(/^\s*at.*(\((.*)\)|file:\/\/(.*)$)/);if(t){let r=t[3]||t[2];return r.endsWith(")")&&(r=r.slice(0,-1)),r}return""}l(Te,"extractFileInfo");function I(e=2,t=!0){var i;let r=new Error().stack||"",n=(i=Ne(r))==null?void 0:i[e];return n&&t&&(n=q(n)),n||""}l(I,"getSourceLocation");function X(){return new Error().stack||""}l(X,"getStack");function C(e,t=!0){let r="",n=new Error().stack||"";if(typeof n=="string"){let i=n.split(`
|
|
5
|
-
`).map(c=>c.trim()),o=i.findIndex(c=>e.some(s=>c.startsWith(s)));r=i[o+1],r&&(r=Te(r)),r&&t&&(r=q(r))}return r}l(C,"getSourceLocationByPrecedingPattern");import re from"tty";function Fe(){try{return re.isatty(process.stdout.fd)}catch{}return!1}l(Fe,"isTTY");var ne=[6,2,3,4,5,1];function $e(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return ne[Math.abs(t)%ne.length]}l($e,"selectColor");var ie={},Oe=P(),W=re.isatty(process.stderr.fd);function k(...e){return process.stderr.write($(e)+`
|
|
6
|
-
`)}l(k,"log");var E={BOLD:"[1m",UNBOLD:"[2m",RED:"[31m",GREEN:"[32m",BLUE:"[34m",PURPLE:"[35m",GRAY:"[37m",ORANGE:"[38;5;208m",UNCOLOR:"[0m"};var se="[0m";function w(e,t){return`${t===8?E.ORANGE:"[3"+(t<8?t:"8;5;"+t)+"m"}${e}${se}`}l(w,"colorString");function oe(e,t,r=!0){return e.map(n=>{if(typeof n!="string")return n;let i=t,o=se;return r&&(i=`${E.BOLD}${i}`,o=`${o}${E.BOLD}`),`${i}${n}${o}`})}l(oe,"colorStringList");var ke="loggerStackTraceDebug-7d38e5a9214b58d29734374cdb9521fd964d7485";function le(e={}){let{level:t=void 0,filter:r=void 0,colors:n=Fe(),levelHelper:i=!0,nameBrackets:o=!0,padding:c=0,fill:s=0,stack:g=!0}=e,p=T(r),y=F(t);return f=>{var M;if(!y(f.level)||!p(f.name))return;let u=P(),d=f.name||"",N=ie[d||""];N==null&&(N={color:$e(d)},ie[d]=N);let G=_(u-Oe),a,v=o?`[${d}]`:d;if(c>0&&(v=v.padStart(c," ")),s>0&&(v=v.padEnd(s," ")),n&&W){let h=N.color;a=[w(v,h)+" | "],f.level===m.warn?a.push(...oe(f.messages,E.ORANGE)):f.level===m.error?a.push(...oe(f.messages,E.RED)):a.push(...f.messages),a.push(w(`+${G}`,h))}else a=[v,...f.messages],a.push(`+${G}`);if(((M=f.messages)==null?void 0:M[0])===ke&&console.log(X()),g){let h="";typeof g=="boolean"?(h=C(["at Function.","at null.log (","at log ("],!0),h||(h=I(0,!0))):h=I(typeof g=="number"?g:3,!0),h&&a.push(w(`(${h})`,7))}switch(f.level){case m.info:i&&(a[0]="I|* "+a[0]),k(...a);break;case m.warn:i&&(a[0]=(n&&W?w("W|** ",8):"W|** ")+a[0]),k(...a);break;case m.error:i&&(a[0]=(n&&W?w("E|*** ",1):"E|*** ")+a[0]),k(...a);break;default:i&&(a[0]="D| "+a[0]),k(...a);break}}}l(le,"LoggerNodeHandler");import A from"crypto";try{A&&A.webcrypto&&typeof globalThis!="undefined"&&typeof globalThis.crypto=="undefined"&&(globalThis.crypto=A.webcrypto)}catch(e){console.warn("Failed to polyfill webcrypto",e)}function je(){var r;let e=[le({padding:32,nameBrackets:!1})],t=(r=process.env.ZEED_LOG)!=null?r:process.env.LOG;t&&e.unshift(V(R(t))),x.setHandlers(e)}l(je,"setupLogContextNode");je();export{me as a,de as b,R as c,Ie as d,Q as e,V as f,Ne as g,I as h,X as i,C as j,Fe as k,w as l,oe as m,ke as n,le as o};
|
|
7
|
-
//# sourceMappingURL=chunk-PRTZGAJJ.js.map
|