tool-log 0.0.0-stage → 0.0.3

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.
@@ -0,0 +1,5 @@
1
+ "use strict";var p=r=>{throw TypeError(r)};var C=(r,o,t)=>o.has(r)||p("Cannot "+t);var s=(r,o,t)=>(C(r,o,"read from private field"),t?t.call(r):o.get(r)),g=(r,o,t)=>o.has(r)?p("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,t),m=(r,o,t,n)=>(C(r,o,"write to private field"),n?n.call(r,t):o.set(r,t),t),l=(r,o,t)=>(C(r,o,"access private method"),t);function W(){return typeof window<"u"?window.location.hostname:null}var d=W();d&&console.log("isLogLocalhost === ",d);var u,h,y,b,e,a,L,w,V,k,v,B,x,A,c=class{constructor(o={}){g(this,e);g(this,u,{reset:"\x1B[0m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m"});g(this,h);g(this,y);g(this,b);m(this,h,o.textColor??"white"),m(this,y,o.bgColor??null),m(this,b,d)}color(...o){if(!s(this,b))return;let[t,n]=l(this,e,L).call(this,o),f=n.textColor??s(this,h),O=n.bgColor??s(this,y),j=l(this,e,V).call(this,f,O),R=s(this,u).reset,T=l(this,e,k).call(this,t).split(`
2
+ `).map(S=>j+S+R).join(`
3
+ `);console.log(T)}get black(){return l(this,e,a).call(this,"black")}get red(){return l(this,e,a).call(this,"red")}get green(){return l(this,e,a).call(this,"green")}get yellow(){return l(this,e,a).call(this,"yellow")}get blue(){return l(this,e,a).call(this,"blue")}get magenta(){return l(this,e,a).call(this,"magenta")}get cyan(){return l(this,e,a).call(this,"cyan")}get white(){return l(this,e,a).call(this,"white")}get gray(){return l(this,e,a).call(this,"gray")}};u=new WeakMap,h=new WeakMap,y=new WeakMap,b=new WeakMap,e=new WeakSet,a=function(o){return s(this,b)?(...t)=>{this.color(...t,{textColor:o})}:(...t)=>{}},L=function(o){if(o.length===0)return[[],{}];let t=o[o.length-1];return l(this,e,w).call(this,t)?[o.slice(0,-1),t]:[o,{}]},w=function(o){if(!o||typeof o!="object"||Array.isArray(o))return!1;let t=o,n=Object.keys(t);return!(n.length===0||!n.every(f=>f==="textColor"||f==="bgColor")||"textColor"in t&&!(t.textColor in s(this,u))||"bgColor"in t&&!(t.bgColor in s(this,u)))},V=function(o,t){let n=t?s(this,u)[t]:"",f=s(this,u)[o]??s(this,u).white;return n+f},k=function(o){return o.map(t=>l(this,e,v).call(this,t)).join(" ")},v=function(o){if(o===null)return"null";if(o===void 0)return"undefined";let t=typeof o;if(t==="string"||t==="number"||t==="boolean"||t==="bigint"||t==="symbol"||t==="function")return String(o);try{return JSON.stringify(o,l(this,e,B),2)}catch{return String(o)}},B=function(o,t){return typeof t=="bigint"?t.toString()+"n":typeof t=="function"?`[Function: ${t.name||"anonymous"}]`:typeof t=="symbol"?t.toString():t},x=new WeakSet,A=function(){let o=d;if(typeof o=="boolean")return o;if(typeof o=="function")try{return!!o()}catch{return!1}if(o&&typeof o=="object"){let t=o;if("default"in t){let n=t.default;if(typeof n=="boolean")return n;if(typeof n=="function")try{return!!n()}catch{}}if("isLogLocalhost"in t){let n=t.isLogLocalhost;if(typeof n=="boolean")return n;if(typeof n=="function")try{return!!n()}catch{}}}return!1},g(c,x);var i=new c({textColor:"green",bgColor:"bgBlack"});i.color("\u0421 \u0444\u043E\u043D\u043E\u043C",{textColor:"red",bgColor:"bgWhite"});i.color("\u0422\u0435\u043A\u0441\u0442",123,{nested:!0},{textColor:"red",bgColor:"bgWhite"});i.red("\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F");i.blue("\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F");i.gray(null);i.white(void 0);i.red("\u041E\u0448\u0438\u0431\u043A\u0430",404,!0);i.green("\u042E\u0437\u0435\u0440",{id:1,name:"\u0418\u0432\u0430\u043D"},[1,2,3]);i.yellow("a","b","c");i.cyan("\u0444\u043B\u0430\u0433:",!1,"\u0441\u0447\u0451\u0442\u0447\u0438\u043A:",42,"null:",null);i.green({status:"ok",users:42});i.yellow([1,2,3,{nested:!0}]);var{red:F,green:_,cyan:D}=i;F("\u043E\u0448\u0438\u0431\u043A\u0430 \u0438\u0437 \u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0438\u0437\u0430\u0446\u0438\u0438");_({ok:!0});D("\u0433\u043E\u0442\u043E\u0432\u043E");var E=new c({textColor:"cyan"}),G=new c({textColor:"white",bgColor:"bgRed"});E.cyan({status:"ok"},`
4
+ `,"test",`
5
+ `,123);G.color("\u041A\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",500);
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,5 @@
1
+ var p=r=>{throw TypeError(r)};var C=(r,o,t)=>o.has(r)||p("Cannot "+t);var s=(r,o,t)=>(C(r,o,"read from private field"),t?t.call(r):o.get(r)),g=(r,o,t)=>o.has(r)?p("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,t),m=(r,o,t,n)=>(C(r,o,"write to private field"),n?n.call(r,t):o.set(r,t),t),l=(r,o,t)=>(C(r,o,"access private method"),t);function W(){return typeof window<"u"?window.location.hostname:null}var d=W();d&&console.log("isLogLocalhost === ",d);var u,h,y,b,e,a,L,w,V,k,v,B,x,A,c=class{constructor(o={}){g(this,e);g(this,u,{reset:"\x1B[0m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m"});g(this,h);g(this,y);g(this,b);m(this,h,o.textColor??"white"),m(this,y,o.bgColor??null),m(this,b,d)}color(...o){if(!s(this,b))return;let[t,n]=l(this,e,L).call(this,o),f=n.textColor??s(this,h),O=n.bgColor??s(this,y),j=l(this,e,V).call(this,f,O),R=s(this,u).reset,T=l(this,e,k).call(this,t).split(`
2
+ `).map(S=>j+S+R).join(`
3
+ `);console.log(T)}get black(){return l(this,e,a).call(this,"black")}get red(){return l(this,e,a).call(this,"red")}get green(){return l(this,e,a).call(this,"green")}get yellow(){return l(this,e,a).call(this,"yellow")}get blue(){return l(this,e,a).call(this,"blue")}get magenta(){return l(this,e,a).call(this,"magenta")}get cyan(){return l(this,e,a).call(this,"cyan")}get white(){return l(this,e,a).call(this,"white")}get gray(){return l(this,e,a).call(this,"gray")}};u=new WeakMap,h=new WeakMap,y=new WeakMap,b=new WeakMap,e=new WeakSet,a=function(o){return s(this,b)?(...t)=>{this.color(...t,{textColor:o})}:(...t)=>{}},L=function(o){if(o.length===0)return[[],{}];let t=o[o.length-1];return l(this,e,w).call(this,t)?[o.slice(0,-1),t]:[o,{}]},w=function(o){if(!o||typeof o!="object"||Array.isArray(o))return!1;let t=o,n=Object.keys(t);return!(n.length===0||!n.every(f=>f==="textColor"||f==="bgColor")||"textColor"in t&&!(t.textColor in s(this,u))||"bgColor"in t&&!(t.bgColor in s(this,u)))},V=function(o,t){let n=t?s(this,u)[t]:"",f=s(this,u)[o]??s(this,u).white;return n+f},k=function(o){return o.map(t=>l(this,e,v).call(this,t)).join(" ")},v=function(o){if(o===null)return"null";if(o===void 0)return"undefined";let t=typeof o;if(t==="string"||t==="number"||t==="boolean"||t==="bigint"||t==="symbol"||t==="function")return String(o);try{return JSON.stringify(o,l(this,e,B),2)}catch{return String(o)}},B=function(o,t){return typeof t=="bigint"?t.toString()+"n":typeof t=="function"?`[Function: ${t.name||"anonymous"}]`:typeof t=="symbol"?t.toString():t},x=new WeakSet,A=function(){let o=d;if(typeof o=="boolean")return o;if(typeof o=="function")try{return!!o()}catch{return!1}if(o&&typeof o=="object"){let t=o;if("default"in t){let n=t.default;if(typeof n=="boolean")return n;if(typeof n=="function")try{return!!n()}catch{}}if("isLogLocalhost"in t){let n=t.isLogLocalhost;if(typeof n=="boolean")return n;if(typeof n=="function")try{return!!n()}catch{}}}return!1},g(c,x);var i=new c({textColor:"green",bgColor:"bgBlack"});i.color("\u0421 \u0444\u043E\u043D\u043E\u043C",{textColor:"red",bgColor:"bgWhite"});i.color("\u0422\u0435\u043A\u0441\u0442",123,{nested:!0},{textColor:"red",bgColor:"bgWhite"});i.red("\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F");i.blue("\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F");i.gray(null);i.white(void 0);i.red("\u041E\u0448\u0438\u0431\u043A\u0430",404,!0);i.green("\u042E\u0437\u0435\u0440",{id:1,name:"\u0418\u0432\u0430\u043D"},[1,2,3]);i.yellow("a","b","c");i.cyan("\u0444\u043B\u0430\u0433:",!1,"\u0441\u0447\u0451\u0442\u0447\u0438\u043A:",42,"null:",null);i.green({status:"ok",users:42});i.yellow([1,2,3,{nested:!0}]);var{red:F,green:_,cyan:D}=i;F("\u043E\u0448\u0438\u0431\u043A\u0430 \u0438\u0437 \u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0438\u0437\u0430\u0446\u0438\u0438");_({ok:!0});D("\u0433\u043E\u0442\u043E\u0432\u043E");var E=new c({textColor:"cyan"}),G=new c({textColor:"white",bgColor:"bgRed"});E.cyan({status:"ok"},`
4
+ `,"test",`
5
+ `,123);G.color("\u041A\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",500);
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "tool-log",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Цветная консоль для логирования",
4
+ "author": "Vladimir Kurguzov <kurguzov74@gmail.com>",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "version": "0.0.3",
10
+ "type": "module",
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "dev": "vite --open --host",
26
+ "build": "tsup src/example.ts --format esm,cjs --clean --dts --minify",
27
+ "ver:patch": "npm version patch --no-git-tag-version",
28
+ "ver:minor": "npm version minor --no-git-tag-version",
29
+ "ver:major": "npm version major --no-git-tag-version",
30
+ "release:patch": "npm run ver:patch && npm run build && npm publish --access public",
31
+ "release:minor": "npm run ver:minor && npm run build && npm publish --access public",
32
+ "release:major": "npm run ver:major && npm run build && npm publish --access public"
33
+ },
34
+ "devDependencies": {
35
+ "tsup": "^8.5.1",
36
+ "typescript": "^5.6.3",
37
+ "vite": "^8.3.2",
38
+ "tool-islocalhost": "^0.0.2"
39
+ }
40
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.