@bbob/core
Advanced tools
Comparing version 2.5.7 to 2.5.8
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.5.8](https://github.com/JiLiZART/bbob/compare/v2.5.7...v2.5.8) (2020-07-08) | ||
**Note:** Version bump only for package @bbob/core | ||
## [2.5.7](https://github.com/JiLiZART/bbob/compare/v2.5.6...v2.5.7) (2020-07-05) | ||
@@ -8,0 +16,0 @@ |
@@ -123,3 +123,3 @@ (function (global, factory) { | ||
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''') // eslint-disable-next-line no-script-url | ||
.replace('javascript:', 'javascript%3A'); | ||
.replace(/(javascript):/gi, '$1%3A'); | ||
}; | ||
@@ -448,3 +448,3 @@ /** | ||
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''') // eslint-disable-next-line no-script-url | ||
.replace('javascript:', 'javascript%3A'); | ||
.replace(/(javascript):/gi, '$1%3A'); | ||
}; | ||
@@ -451,0 +451,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).BbobCore=e()}(this,(function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));t(n);var r=e((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var r=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=r;var o=function(t){return"string"==typeof t};e.isStringNode=o;e.isEOL=function(t){return t===n.N};e.getNodeLength=function t(e){return r(e)?e.content.reduce((function(e,n){return e+t(n)}),0):o(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var u=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace("javascript:","javascript%3A")};e.escapeHTML=u;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+u(e)+'"'},object:function(){return t+'="'+u(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));t(r);var o=e((function(t,e){function o(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(){return(u=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}e.__esModule=!0,e.default=e.TagNode=void 0;var i=function(){function t(t,e,n){this.tag=t,this.attrs=e,this.content=[].concat(n)}var e,i,a,s=t.prototype;return s.attr=function(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]},s.append=function(t){return(0,r.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=n.OPEN_BRAKET,e=n.CLOSE_BRAKET,o=0===this.content.length,i=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,r.getUniqAttr)(e);if(n){var o=(0,r.attrValue)(t,n),i=u({},e);return delete i[n],""+o+(0,r.attrsToString)(i)}return""+t+(0,r.attrsToString)(e)}(this.tag,this.attrs);return o?""+t+a+e:""+t+a+e+i+t+n.SLASH+this.tag+e},e=t,(i=[{key:"length",get:function(){return(0,r.getNodeLength)(this)}}])&&o(e.prototype,i),a&&o(e,a),t}();e.TagNode=i,i.create=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),new i(t,e,n)},i.isOf=function(t,e){return t.tag===e},e.default=i}));t(o);var u=e((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));t(u);var i=e((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===u.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var o=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace("javascript:","javascript%3A")};e.escapeHTML=o;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+o(e)+'"'},object:function(){return t+'="'+o(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));t(i);var a=e((function(t,e){e.__esModule=!0,e.default=e.Token=e.TYPE_NEW_LINE=e.TYPE_SPACE=e.TYPE_ATTR_VALUE=e.TYPE_ATTR_NAME=e.TYPE_TAG=e.TYPE_WORD=e.COLUMN_ID=e.LINE_ID=e.VALUE_ID=e.TYPE_ID=void 0;var r=function(t){return t&&void 0!==t.value?t.value:""},o=function(t){return r(t).charCodeAt(0)===n.SLASH.charCodeAt(0)},u=function(){function t(t,e,n,r){this.type=t+"",this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return!!this.type},e.isText=function(){return!(!(t=this)||void 0===t.type||"space"!==t.type&&"new-line"!==t.type&&"word"!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&"tag"===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&"attr-name"===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&"attr-value"===t.type;var t},e.isStart=function(){return!o(this)},e.isEnd=function(){return o(this)},e.getName=function(){return e=r(t=this),o(t)?e.slice(1):e;var t,e},e.getValue=function(){return r(this)},e.getLine=function(){return(t=this)&&t.line||0;var t},e.getColumn=function(){return(t=this)&&t.row||0;var t},e.toString=function(){return t=n.OPEN_BRAKET,t+=r(this),t+=n.CLOSE_BRAKET;var t},t}();e.Token=u;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD="word";e.TYPE_TAG="tag";e.TYPE_ATTR_NAME="attr-name";e.TYPE_ATTR_VALUE="attr-value";e.TYPE_SPACE="space";e.TYPE_NEW_LINE="new-line",e.default=u}));t(a);var s=e((function(t,e){e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){var n={pos:0,length:t.length},r=function(){n.pos+=1,e&&e.onSkip&&e.onSkip()},o=function(){return n.length>n.pos},u=function(){return t.substr(n.pos)},i=function(){return t[n.pos]};return{skip:r,hasNext:o,isLast:function(){return n.pos===n.length},grabWhile:function(e){var u=0;if(o())for(u=n.pos;o()&&e(i());)r();return t.substr(u,n.pos-u)},getNext:function(){var e=n.pos+1;return e>t.length-1?null:t[e]},getPrev:function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},getCurr:i,getRest:u,substrUntilChar:function(t){var e=u(),n=e.indexOf(t);return 0>n?"":e.substr(0,n)}}};e.trimChar=function(t,e){for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t};e.unquote=function(t){return t.replace(n.BACKSLASH+n.QUOTEMARK,n.QUOTEMARK)};e.createList=function(t){void 0===t&&(t=[]);var e=t;return{getLast:function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},flushLast:function(){return!!e.length&&e.pop()},push:function(t){return e.push(t)},toArray:function(){return e}}}}));t(s);var c=e((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var o=0,u=0,i=-1,c=Array(Math.floor(t.length)),f=e.openTag||n.OPEN_BRAKET,l=e.closeTag||n.CLOSE_BRAKET,p=e.enableEscapeTags,g=[l,f,n.QUOTEMARK,n.BACKSLASH,n.SPACE,n.TAB,n.EQ,n.N,"!"],A=[f,n.SPACE,n.TAB,n.N],T=[n.SPACE,n.TAB],E=[n.EQ,n.SPACE,n.TAB],d=function(t){return T.indexOf(t)>=0},v=function(t){return-1===A.indexOf(t)},h=function(t){return t===f||t===l||t===n.BACKSLASH},_=function(t){return t===n.BACKSLASH},L=function(t){e.onToken&&e.onToken(t),c[i+=1]=t},y=function(t){for(var e=null,i=!1,c=[],f=(0,s.createCharGrabber)(t),l=function(t){var r=t===n.EQ,o=d(t),u=f.getPrev(),a=f.getNext(),s=u===n.BACKSLASH;return null===e?!1===(r||o||f.isLast()):!(!i||!function(t){return E.indexOf(t)>=0}(t))||!!(t!==n.QUOTEMARK||s||(i=!i)||a===n.EQ||d(a))&&!1===(r||o)},p=function(){var t=f.grabWhile(l),i=f.getCurr();if(null===e)e=t;else if(d(i)||i===n.QUOTEMARK||!f.hasNext()){var p=(0,s.unquote)((0,s.trimChar)(t,n.QUOTEMARK));c.push(r(a.TYPE_ATTR_VALUE,p,o,u))}else c.push(r(a.TYPE_ATTR_NAME,t,o,u));f.skip()};f.hasNext();)p();return{tag:e,attrs:c}},S=(0,s.createCharGrabber)(t,{onSkip:function(){u++}}),O=function(){var t=S.getCurr(),e=S.getNext();if(t===n.N)S.skip(),o++,L(r(a.TYPE_NEW_LINE,t,o,u=0));else if(d(t)){var i=S.grabWhile(d);L(r(a.TYPE_SPACE,i,o,u))}else if(p&&_(t)&&h(e))S.skip(),S.skip(),L(r(a.TYPE_WORD,e,o,u));else if(t===f){S.skip();var s=S.substrUntilChar(l),c=0===s.length||s.indexOf(f)>=0;if(g.indexOf(e)>=0||c||S.isLast())L(r(a.TYPE_WORD,t,o,u));else{var A=S.grabWhile((function(t){return t!==l}));if(S.skip(),-1===A.indexOf(n.EQ)||A[0]===n.SLASH)L(r(a.TYPE_TAG,A,o,u));else{var T=y(A);L(r(a.TYPE_TAG,T.tag,o,u)),T.attrs.map(L)}}}else if(t===l)S.skip(),L(r(a.TYPE_WORD,t,o,u));else if(v(t))if(p&&_(t)&&!h(e))S.skip(),L(r(a.TYPE_WORD,t,o,u));else{var E=S.grabWhile((function(t){return p?v(t)&&!_(t):v(t)}));L(r(a.TYPE_WORD,E,o,u))}};return{tokenize:function(){for(;S.hasNext();)O();return c.length=i+1,c},isTokenNested:function(e){var r=f+n.SLASH+e.getValue();return t.indexOf(r)>-1}}},e.createTokenOfType=void 0;var r=function(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=0),new a.Token(t,e,n,r)};e.createTokenOfType=r}));t(c);var f=e((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=o)&&n.__esModule?n:{default:n};var u=function(t,e){void 0===e&&(e={});var n=e,o=null,u=(0,s.createList)(),a=(0,s.createList)(),f=(0,s.createList)(),l=(0,s.createList)(),p={},g=function(){f.flushLast()&&l.flushLast()},A=function(t){var e,r,o=(e=a.getLast())&&Array.isArray(e.content)?e.content:u.toArray();Array.isArray(o)&&((0,i.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?o.push(""+t):o.push(t.toTagNode())):o.push(t))},T=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===p[t.getValue()]&&(p[t.getValue()]=o.isTokenNested(t)),p[t.getValue()]}(t);f.push(e),n?a.push(e):A(e)},E=function(t){t.isStart()&&T(t),t.isEnd()&&function(t){g();var e=a.flushLast();if(e)A(e);else if("function"==typeof n.onError){var r=t.getValue(),o=t.getLine(),u=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+o+" and column "+u,tagName:r,lineNumber:o,columnNumber:u})}}(t)},d=function(t){var e=f.getLast(),n=t.getValue(),r=!!p[t];if(e)if(t.isAttrName())l.push(n),e.attr(l.getLast(),"");else if(t.isAttrValue()){var o=l.getLast();o?(e.attr(o,n),l.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):A(n):t.isTag()&&A(""+t);else t.isText()?A(n):t.isTag()&&A(""+t)};(o=(e.createTokenizer?e.createTokenizer:c.createLexer)(t,{onToken:function(t){t.isTag()?E(t):d(t)},onlyAllowTags:n.onlyAllowTags,openTag:n.openTag,closeTag:n.closeTag,enableEscapeTags:n.enableEscapeTags})).tokenize();return u.toArray()};e.parse=u,e.default=u}));t(f);var l=e((function(t,e){e.__esModule=!0,e.TagNode=e.parse=e.default=void 0;var n=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=r();if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if(Object.prototype.hasOwnProperty.call(t,u)){var i=o?Object.getOwnPropertyDescriptor(t,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=t[u]}n.default=t,e&&e.set(t,n);return n}(f);function r(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return r=function(){return t},t}e.default=n.default,e.parse=n.parse,e.TagNode=o.TagNode}));t(l);var p=l.parse,g=function(t){return"object"==typeof t};function A(t,e){var n=t;if(Array.isArray(n))for(var r=0;n.length>r;r++)n[r]=A(e(n[r]),e);else n&&g(n)&&n.content&&A(n.content,e);return n}function T(t,e){return typeof t==typeof e&&(g(t)&&null!==t?Array.isArray(t)?t.every((function(t){return[].some.call(e,(function(e){return T(t,e)}))})):Object.keys(t).every((function(n){var r=e[n],o=t[n];return g(o)&&null!==o&&null!==r?T(o,r):"boolean"==typeof o?o!==(null===r):r===o})):t===e)}function E(t,e){return A(this,Array.isArray(t)?function(n){for(var r=0;t.length>r;r++)if(T(t[r],n))return e(n);return n}:function(n){return T(t,n)?e(n):n})}function d(t){return A(this,t)}return function(t){var e="function"==typeof t?[t]:t||[],n={skipParse:!1};return{process:function(t,r){var o=(n=r||{}).parser||p,u=n.render,i=n.data||null;if("function"!=typeof o)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var a=n.skipParse?t||[]:o(t,n),s=a;return a.messages=[],a.options=n,a.walk=d,a.match=E,e.forEach((function(t){a=t(a,{parse:o,render:u,iterate:A,match:E,data:i})||a})),{get html(){if("function"!=typeof u)throw Error('"render" function not defined, please pass to "process(input, { render })"');return u(a,a.options)},tree:a,raw:s,messages:a.messages}}}}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).BbobCore=e()}(this,(function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));t(n);var r=e((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var r=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=r;var o=function(t){return"string"==typeof t};e.isStringNode=o;e.isEOL=function(t){return t===n.N};e.getNodeLength=function t(e){return r(e)?e.content.reduce((function(e,n){return e+t(n)}),0):o(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var u=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(javascript):/gi,"$1%3A")};e.escapeHTML=u;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+u(e)+'"'},object:function(){return t+'="'+u(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));t(r);var o=e((function(t,e){function o(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(){return(u=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}e.__esModule=!0,e.default=e.TagNode=void 0;var i=function(){function t(t,e,n){this.tag=t,this.attrs=e,this.content=[].concat(n)}var e,i,a,s=t.prototype;return s.attr=function(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]},s.append=function(t){return(0,r.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=n.OPEN_BRAKET,e=n.CLOSE_BRAKET,o=0===this.content.length,i=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,r.getUniqAttr)(e);if(n){var o=(0,r.attrValue)(t,n),i=u({},e);return delete i[n],""+o+(0,r.attrsToString)(i)}return""+t+(0,r.attrsToString)(e)}(this.tag,this.attrs);return o?""+t+a+e:""+t+a+e+i+t+n.SLASH+this.tag+e},e=t,(i=[{key:"length",get:function(){return(0,r.getNodeLength)(this)}}])&&o(e.prototype,i),a&&o(e,a),t}();e.TagNode=i,i.create=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),new i(t,e,n)},i.isOf=function(t,e){return t.tag===e},e.default=i}));t(o);var u=e((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));t(u);var i=e((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===u.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var o=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(javascript):/gi,"$1%3A")};e.escapeHTML=o;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+o(e)+'"'},object:function(){return t+'="'+o(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));t(i);var a=e((function(t,e){e.__esModule=!0,e.default=e.Token=e.TYPE_NEW_LINE=e.TYPE_SPACE=e.TYPE_ATTR_VALUE=e.TYPE_ATTR_NAME=e.TYPE_TAG=e.TYPE_WORD=e.COLUMN_ID=e.LINE_ID=e.VALUE_ID=e.TYPE_ID=void 0;var r=function(t){return t&&void 0!==t.value?t.value:""},o=function(t){return r(t).charCodeAt(0)===n.SLASH.charCodeAt(0)},u=function(){function t(t,e,n,r){this.type=t+"",this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return!!this.type},e.isText=function(){return!(!(t=this)||void 0===t.type||"space"!==t.type&&"new-line"!==t.type&&"word"!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&"tag"===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&"attr-name"===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&"attr-value"===t.type;var t},e.isStart=function(){return!o(this)},e.isEnd=function(){return o(this)},e.getName=function(){return e=r(t=this),o(t)?e.slice(1):e;var t,e},e.getValue=function(){return r(this)},e.getLine=function(){return(t=this)&&t.line||0;var t},e.getColumn=function(){return(t=this)&&t.row||0;var t},e.toString=function(){return t=n.OPEN_BRAKET,t+=r(this),t+=n.CLOSE_BRAKET;var t},t}();e.Token=u;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD="word";e.TYPE_TAG="tag";e.TYPE_ATTR_NAME="attr-name";e.TYPE_ATTR_VALUE="attr-value";e.TYPE_SPACE="space";e.TYPE_NEW_LINE="new-line",e.default=u}));t(a);var s=e((function(t,e){e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){var n={pos:0,length:t.length},r=function(){n.pos+=1,e&&e.onSkip&&e.onSkip()},o=function(){return n.length>n.pos},u=function(){return t.substr(n.pos)},i=function(){return t[n.pos]};return{skip:r,hasNext:o,isLast:function(){return n.pos===n.length},grabWhile:function(e){var u=0;if(o())for(u=n.pos;o()&&e(i());)r();return t.substr(u,n.pos-u)},getNext:function(){var e=n.pos+1;return e>t.length-1?null:t[e]},getPrev:function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},getCurr:i,getRest:u,substrUntilChar:function(t){var e=u(),n=e.indexOf(t);return 0>n?"":e.substr(0,n)}}};e.trimChar=function(t,e){for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t};e.unquote=function(t){return t.replace(n.BACKSLASH+n.QUOTEMARK,n.QUOTEMARK)};e.createList=function(t){void 0===t&&(t=[]);var e=t;return{getLast:function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},flushLast:function(){return!!e.length&&e.pop()},push:function(t){return e.push(t)},toArray:function(){return e}}}}));t(s);var c=e((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var o=0,u=0,i=-1,c=Array(Math.floor(t.length)),f=e.openTag||n.OPEN_BRAKET,l=e.closeTag||n.CLOSE_BRAKET,p=e.enableEscapeTags,g=[l,f,n.QUOTEMARK,n.BACKSLASH,n.SPACE,n.TAB,n.EQ,n.N,"!"],A=[f,n.SPACE,n.TAB,n.N],T=[n.SPACE,n.TAB],E=[n.EQ,n.SPACE,n.TAB],d=function(t){return T.indexOf(t)>=0},v=function(t){return-1===A.indexOf(t)},h=function(t){return t===f||t===l||t===n.BACKSLASH},_=function(t){return t===n.BACKSLASH},L=function(t){e.onToken&&e.onToken(t),c[i+=1]=t},y=function(t){for(var e=null,i=!1,c=[],f=(0,s.createCharGrabber)(t),l=function(t){var r=t===n.EQ,o=d(t),u=f.getPrev(),a=f.getNext(),s=u===n.BACKSLASH;return null===e?!1===(r||o||f.isLast()):!(!i||!function(t){return E.indexOf(t)>=0}(t))||!!(t!==n.QUOTEMARK||s||(i=!i)||a===n.EQ||d(a))&&!1===(r||o)},p=function(){var t=f.grabWhile(l),i=f.getCurr();if(null===e)e=t;else if(d(i)||i===n.QUOTEMARK||!f.hasNext()){var p=(0,s.unquote)((0,s.trimChar)(t,n.QUOTEMARK));c.push(r(a.TYPE_ATTR_VALUE,p,o,u))}else c.push(r(a.TYPE_ATTR_NAME,t,o,u));f.skip()};f.hasNext();)p();return{tag:e,attrs:c}},S=(0,s.createCharGrabber)(t,{onSkip:function(){u++}}),O=function(){var t=S.getCurr(),e=S.getNext();if(t===n.N)S.skip(),o++,L(r(a.TYPE_NEW_LINE,t,o,u=0));else if(d(t)){var i=S.grabWhile(d);L(r(a.TYPE_SPACE,i,o,u))}else if(p&&_(t)&&h(e))S.skip(),S.skip(),L(r(a.TYPE_WORD,e,o,u));else if(t===f){S.skip();var s=S.substrUntilChar(l),c=0===s.length||s.indexOf(f)>=0;if(g.indexOf(e)>=0||c||S.isLast())L(r(a.TYPE_WORD,t,o,u));else{var A=S.grabWhile((function(t){return t!==l}));if(S.skip(),-1===A.indexOf(n.EQ)||A[0]===n.SLASH)L(r(a.TYPE_TAG,A,o,u));else{var T=y(A);L(r(a.TYPE_TAG,T.tag,o,u)),T.attrs.map(L)}}}else if(t===l)S.skip(),L(r(a.TYPE_WORD,t,o,u));else if(v(t))if(p&&_(t)&&!h(e))S.skip(),L(r(a.TYPE_WORD,t,o,u));else{var E=S.grabWhile((function(t){return p?v(t)&&!_(t):v(t)}));L(r(a.TYPE_WORD,E,o,u))}};return{tokenize:function(){for(;S.hasNext();)O();return c.length=i+1,c},isTokenNested:function(e){var r=f+n.SLASH+e.getValue();return t.indexOf(r)>-1}}},e.createTokenOfType=void 0;var r=function(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=0),new a.Token(t,e,n,r)};e.createTokenOfType=r}));t(c);var f=e((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=o)&&n.__esModule?n:{default:n};var u=function(t,e){void 0===e&&(e={});var n=e,o=null,u=(0,s.createList)(),a=(0,s.createList)(),f=(0,s.createList)(),l=(0,s.createList)(),p={},g=function(){f.flushLast()&&l.flushLast()},A=function(t){var e,r,o=(e=a.getLast())&&Array.isArray(e.content)?e.content:u.toArray();Array.isArray(o)&&((0,i.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?o.push(""+t):o.push(t.toTagNode())):o.push(t))},T=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===p[t.getValue()]&&(p[t.getValue()]=o.isTokenNested(t)),p[t.getValue()]}(t);f.push(e),n?a.push(e):A(e)},E=function(t){t.isStart()&&T(t),t.isEnd()&&function(t){g();var e=a.flushLast();if(e)A(e);else if("function"==typeof n.onError){var r=t.getValue(),o=t.getLine(),u=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+o+" and column "+u,tagName:r,lineNumber:o,columnNumber:u})}}(t)},d=function(t){var e=f.getLast(),n=t.getValue(),r=!!p[t];if(e)if(t.isAttrName())l.push(n),e.attr(l.getLast(),"");else if(t.isAttrValue()){var o=l.getLast();o?(e.attr(o,n),l.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):A(n):t.isTag()&&A(""+t);else t.isText()?A(n):t.isTag()&&A(""+t)};(o=(e.createTokenizer?e.createTokenizer:c.createLexer)(t,{onToken:function(t){t.isTag()?E(t):d(t)},onlyAllowTags:n.onlyAllowTags,openTag:n.openTag,closeTag:n.closeTag,enableEscapeTags:n.enableEscapeTags})).tokenize();return u.toArray()};e.parse=u,e.default=u}));t(f);var l=e((function(t,e){e.__esModule=!0,e.TagNode=e.parse=e.default=void 0;var n=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=r();if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if(Object.prototype.hasOwnProperty.call(t,u)){var i=o?Object.getOwnPropertyDescriptor(t,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=t[u]}n.default=t,e&&e.set(t,n);return n}(f);function r(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return r=function(){return t},t}e.default=n.default,e.parse=n.parse,e.TagNode=o.TagNode}));t(l);var p=l.parse,g=function(t){return"object"==typeof t};function A(t,e){var n=t;if(Array.isArray(n))for(var r=0;n.length>r;r++)n[r]=A(e(n[r]),e);else n&&g(n)&&n.content&&A(n.content,e);return n}function T(t,e){return typeof t==typeof e&&(g(t)&&null!==t?Array.isArray(t)?t.every((function(t){return[].some.call(e,(function(e){return T(t,e)}))})):Object.keys(t).every((function(n){var r=e[n],o=t[n];return g(o)&&null!==o&&null!==r?T(o,r):"boolean"==typeof o?o!==(null===r):r===o})):t===e)}function E(t,e){return A(this,Array.isArray(t)?function(n){for(var r=0;t.length>r;r++)if(T(t[r],n))return e(n);return n}:function(n){return T(t,n)?e(n):n})}function d(t){return A(this,t)}return function(t){var e="function"==typeof t?[t]:t||[],n={skipParse:!1};return{process:function(t,r){var o=(n=r||{}).parser||p,u=n.render,i=n.data||null;if("function"!=typeof o)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var a=n.skipParse?t||[]:o(t,n),s=a;return a.messages=[],a.options=n,a.walk=d,a.match=E,e.forEach((function(t){a=t(a,{parse:o,render:u,iterate:A,match:E,data:i})||a})),{get html(){if("function"!=typeof u)throw Error('"render" function not defined, please pass to "process(input, { render })"');return u(a,a.options)},tree:a,raw:s,messages:a.messages}}}}})); |
{ | ||
"name": "@bbob/core", | ||
"version": "2.5.7", | ||
"version": "2.5.8", | ||
"description": "⚡️Blazing fast BBCode transforming and parsing tool in pure javascript, no dependencies ", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@bbob/parser": "^2.5.7" | ||
"@bbob/parser": "^2.5.8" | ||
}, | ||
@@ -72,3 +72,3 @@ "main": "lib/index.js", | ||
], | ||
"gitHead": "fe6a16b6d9850bdfe3569649583c9957bf8ebe9c" | ||
"gitHead": "2eb1fbcccf065a95df2c1a28020119582d4a64d1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72907
Updated@bbob/parser@^2.5.8