@sfirew/mc-motd-parser
Advanced tools
Comparing version 1.0.1-0.1 to 1.0.1-1.1
@@ -1,2 +0,2 @@ | ||
"use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},k=(t,e,o,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of j(e))!L.call(t,s)&&s!==o&&d(t,s,{get:()=>e[s],enumerable:!(p=S(e,s))||p.enumerable});return t};var H=t=>k(d({},"__esModule",{value:!0}),t);var P={};J(P,{JSONToHtml:()=>K,autoToHtml:()=>G,cleanTags:()=>M,default:()=>X,jsonRender:()=>q,motdParser:()=>C,textToHTML:()=>_,textToJSON:()=>$});module.exports=H(P);function y(t){return!!t}var T=t=>t.replace(/ /g,"\xA0").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\n/g,"<br/>");var m={"\xA7k":"obfuscated;","\xA7l":"font-weight: bold;","\xA7m":"text-decoration: line-through;","\xA7n":"text-decoration: underline;","\xA7o":"font-style: italic;","\xA7r":"color: inherit;text-decoration: none !important;font-weight:normal!important;font-style: normal!important;"},A={bold:"font-weight: bold;",italic:"font-style: italic;",underlined:"text-decoration:underline;",strikethrough:"text-decoration: line-through;",obfuscated:"mc_obfuscated;",reset:"color: inherit;text-decoration: none !important;font-weight:normal!important;font-style: normal!important;"},h={"\xA7k":"obfuscated","\xA7l":"bold","\xA7m":"strikethrough","\xA7n":"underlined","\xA7o":"italic","\xA7r":""},F={"\xA70":"#000000","\xA71":"#0000AA","\xA72":"#00AA00","\xA73":"#00AAAA","\xA74":"#AA0000","\xA75":"#AA00AA","\xA76":"#FFAA00","\xA77":"#AAAAAA","\xA78":"#555555","\xA79":"#5555FF","\xA7a":"#55FF55","\xA7b":"#55FFFF","\xA7c":"#FF5555","\xA7d":"#FF55FF","\xA7e":"#FFFF55","\xA7f":"#FFFFFF"},b={black:"#000000",dark_blue:"#0000AA",dark_green:"#00AA00",dark_aqua:"#00AAAA",dark_red:"#AA0000",dark_purple:"#AA00AA",gold:"#FFAA00",gray:"#AAAAAA",dark_gray:"#555555",blue:"#5555FF",green:"#55FF55",aqua:"#55FFFF",red:"#FF5555",light_purple:"#FF55FF",yellow:"#FFFF55",white:"#FFFFFF"};function E(t){let e=/(?:§)([0-9a-fA-FklmnorFKLMNOR])/g,o="";return o=t.replace(e,""),o}function O(t){let e=t,o=/([§][0-9a-fA-FklmnorFKLMNOR])/g,p=new RegExp(o.source),s=e.split(p),r="",n="",a="";return s.forEach(i=>{let l=i.toLowerCase();if(Object.hasOwn(F,l))n=F[l];else if(Object.hasOwn(m,l))r=m[l];else{let c="",f=i;n!==""&&(c=`color:${n};`),f!==""&&(f=T(f),c.length!==0||r.length!==0?a+=`<span style="${c}${r}">${f}</span>`:a+=f)}}),a}function w(t){let e=t,o=/([§][0-9a-f0-9a-fA-FklmnorFKLMNOR])/g,p=new RegExp(o.source),s=e.split(p),r="",n="",a={text:"",extra:[]};s.forEach(l=>{let c=l.toLowerCase();if(Object.hasOwn(F,c))n=F[c];else if(Object.hasOwn(h,c))r=h[c];else{let f={text:"",extra:[]};r!==""&&(f[r]=!0),f.text=l,n!==""&&(f.color=n),typeof a.extra=="object"&&a.extra.push(f)}});let i=[];return a.extra&&(a.extra.length>1?a.extra.forEach((l,c)=>{l.text===""?a.extra&&typeof a.extra[c+1]=="object"&&i.push({...l,...a.extra[c+1]}):l.text!==(i[i.length-1]&&i[i.length-1].text)&&i.push(l)}):i.push(a.extra[0])),i=i.filter(l=>l.text!==""),{text:a.text,extra:i}}function u(t){let e="",o="",p="";for(let r of Object.keys(t)){if(r=r.toLowerCase(),Object.hasOwn(A,r)){t[r]&&(p+=`${A[r]}`);continue}if(r==="text"&&(typeof t.text=="string"||typeof t.text=="number")){e+=O(String(t.text));continue}if(r==="color"){let n=t[r];if(typeof n=="string")if(Object.hasOwn(b,n)){o=`color: ${b[n]};`;continue}else if(Object.hasOwn(F,n)){o=`color: ${F[n]};`;continue}else{o=`color: ${n};`;continue}}if(r==="extra"&&typeof t.extra=="object")for(let n of t.extra)y(n)&&(e+=u(n))}let s="";return p.length!==0||o.length!==0?s=`<span style="${o+p}">${e}</span>`:s=e,s}function g(t){return u(JSON.parse(JSON.stringify(t)))}function N(t){return typeof t=="object"?g(t):typeof t=="string"?g(w(t)):"unknown motd data type"}var R={cleanTags:E,textToHTML:O,textToJSON:w,JSONToHtml:u,jsonRender:g,autoToHtml:N},x=R;var C=x,M=x.cleanTags,_=x.textToHTML,$=x.textToJSON,K=x.JSONToHtml,q=x.jsonRender,G=x.autoToHtml,X=x;0&&(module.exports={JSONToHtml,autoToHtml,cleanTags,jsonRender,motdParser,textToHTML,textToJSON}); | ||
"use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},k=(t,e,o,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of j(e))!L.call(t,s)&&s!==o&&d(t,s,{get:()=>e[s],enumerable:!(p=S(e,s))||p.enumerable});return t};var H=t=>k(d({},"__esModule",{value:!0}),t);var X={};J(X,{JSONToHtml:()=>_,autoToHtml:()=>q,cleanTags:()=>C,default:()=>G,jsonRender:()=>K,motdParser:()=>x,textToHTML:()=>M,textToJSON:()=>$});module.exports=H(X);function y(t){return!!t}var T=t=>t.replace(/ /g,"\xA0").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\n/g,"<br/>");var A={"\xA7k":"obfuscated;","\xA7l":"font-weight: bold;","\xA7m":"text-decoration: line-through;","\xA7n":"text-decoration: underline;","\xA7o":"font-style: italic;","\xA7r":"color: inherit;text-decoration: none !important;font-weight:normal!important;font-style: normal!important;"},m={bold:"font-weight: bold;",italic:"font-style: italic;",underlined:"text-decoration:underline;",strikethrough:"text-decoration: line-through;",obfuscated:"mc_obfuscated;",reset:"color: inherit;text-decoration: none !important;font-weight:normal!important;font-style: normal!important;"},h={"\xA7k":"obfuscated","\xA7l":"bold","\xA7m":"strikethrough","\xA7n":"underlined","\xA7o":"italic","\xA7r":""},F={"\xA70":"#000000","\xA71":"#0000AA","\xA72":"#00AA00","\xA73":"#00AAAA","\xA74":"#AA0000","\xA75":"#AA00AA","\xA76":"#FFAA00","\xA77":"#AAAAAA","\xA78":"#555555","\xA79":"#5555FF","\xA7a":"#55FF55","\xA7b":"#55FFFF","\xA7c":"#FF5555","\xA7d":"#FF55FF","\xA7e":"#FFFF55","\xA7f":"#FFFFFF"},b={black:"#000000",dark_blue:"#0000AA",dark_green:"#00AA00",dark_aqua:"#00AAAA",dark_red:"#AA0000",dark_purple:"#AA00AA",gold:"#FFAA00",gray:"#AAAAAA",dark_gray:"#555555",blue:"#5555FF",green:"#55FF55",aqua:"#55FFFF",red:"#FF5555",light_purple:"#FF55FF",yellow:"#FFFF55",white:"#FFFFFF"};function E(t){let e=/(?:§)([0-9a-fA-FklmnorFKLMNOR])/g,o="";return o=t.replace(e,""),o}function O(t){let e=t,o=/([§][0-9a-fA-FklmnorFKLMNOR])/g,p=new RegExp(o.source),s=e.split(p),r="",n="",a="";return s.forEach(i=>{let l=i.toLowerCase();if(Object.hasOwn(F,l))n=F[l];else if(Object.hasOwn(A,l))r=A[l];else{let c="",f=i;n!==""&&(c=`color:${n};`),f!==""&&(f=T(f),c.length!==0||r.length!==0?a+=`<span style="${c}${r}">${f}</span>`:a+=f)}}),a}function w(t){let e=t,o=/([§][0-9a-f0-9a-fA-FklmnorFKLMNOR])/g,p=new RegExp(o.source),s=e.split(p),r="",n="",a={text:"",extra:[]};s.forEach(l=>{let c=l.toLowerCase();if(Object.hasOwn(F,c))n=F[c];else if(Object.hasOwn(h,c))r=h[c];else{let f={text:"",extra:[]};r!==""&&(f[r]=!0),f.text=l,n!==""&&(f.color=n),typeof a.extra=="object"&&a.extra.push(f)}});let i=[];return a.extra&&(a.extra.length>1?a.extra.forEach((l,c)=>{l.text===""?a.extra&&typeof a.extra[c+1]=="object"&&i.push({...l,...a.extra[c+1]}):l.text!==(i[i.length-1]&&i[i.length-1].text)&&i.push(l)}):i.push(a.extra[0])),i=i.filter(l=>l.text!==""),{text:a.text,extra:i}}function u(t){let e="",o="",p="";for(let r of Object.keys(t)){if(r=r.toLowerCase(),Object.hasOwn(m,r)){t[r]&&(p+=`${m[r]}`);continue}if(r==="text"&&(typeof t.text=="string"||typeof t.text=="number")){e+=O(String(t.text));continue}if(r==="color"){let n=t[r];if(typeof n=="string")if(Object.hasOwn(b,n)){o=`color: ${b[n]};`;continue}else if(Object.hasOwn(F,n)){o=`color: ${F[n]};`;continue}else{o=`color: ${n};`;continue}}if(r==="extra"&&typeof t.extra=="object")for(let n of t.extra)y(n)&&(e+=u(n))}let s="";return p.length!==0||o.length!==0?s=`<span style="${o+p}">${e}</span>`:s=e,s}function g(t){return u(JSON.parse(JSON.stringify(t)))}function N(t){return typeof t=="object"?g(t):typeof t=="string"?g(w(t)):"unknown motd data type"}var R={cleanTags:E,textToHTML:O,textToJSON:w,JSONToHtml:u,jsonRender:g,autoToHtml:N},x=R;var C=x.cleanTags,M=x.textToHTML,$=x.textToJSON,_=x.JSONToHtml,K=x.jsonRender,q=x.autoToHtml,G=x;0&&(module.exports={JSONToHtml,autoToHtml,cleanTags,jsonRender,motdParser,textToHTML,textToJSON}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@sfirew/mc-motd-parser", | ||
"description": "Minecraft Server MOTD Parser, can convert to html, json, text.", | ||
"version": "1.0.10.1", | ||
"version": "1.0.11.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.mjs", |
@@ -56,3 +56,3 @@ # Minecraft Server MOTD Parser | ||
```typescript | ||
const { motdParser } = require('@sfirew/mc-motd-parser'); | ||
const motdParser = require('@sfirew/mc-motd-parser'); | ||
``` | ||
@@ -62,3 +62,3 @@ | ||
```typescript | ||
import { motdParser } from '@sfirew/mc-motd-parser' | ||
import motdParser from '@sfirew/mc-motd-parser' | ||
``` | ||
@@ -65,0 +65,0 @@ |
@@ -1,13 +0,3 @@ | ||
import _motdParser from "./motdParser"; | ||
export declare const motdParser: { | ||
cleanTags: (text: string) => string; | ||
textToHTML: (motdString: string) => string; | ||
textToJSON: (text: string) => { | ||
text: string | number; | ||
extra: import("./types").motdJsonType[]; | ||
}; | ||
JSONToHtml: (sourceJson: import("./types").motdJsonType) => string; | ||
jsonRender: (json: object | import("./types").motdJsonType) => string; | ||
autoToHtml: (motd: string | object | import("./types").motdJsonType) => string; | ||
}; | ||
import motdParser from "./motdParser"; | ||
export { motdParser }; | ||
export declare const cleanTags: (text: string) => string; | ||
@@ -22,2 +12,2 @@ export declare const textToHTML: (motdString: string) => string; | ||
export declare const autoToHtml: (motd: string | object | import("./types").motdJsonType) => string; | ||
export default _motdParser; | ||
export default motdParser; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
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.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
1
54306
129