Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

preact-render-to-string

Package Overview
Dependencies
Maintainers
8
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact-render-to-string - npm Package Compare versions

Comparing version 6.2.2 to 6.3.0

2

dist/commonjs.js

@@ -1,2 +0,2 @@

var e=require("preact"),t=/[\s\n\\/='"\0<>]/,r=/^(xlink|xmlns|xml)([A-Z])/,o=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,n=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,a=/["&<]/;function i(e){if(0===e.length||!1===a.test(e))return e;for(var t=0,r=0,o="",n="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=n,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var s={},l=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),c=/[A-Z]/g;function p(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var n="-"==r[0]?r:s[r]||(s[r]=r.replace(c,"-$&").toLowerCase()),a=";";"number"!=typeof o||n.startsWith("--")||l.has(n)||(a="px;"),t=t+n+":"+o+a}}return t||void 0}var u,_,d,f,h=[],m=Array.isArray,g=Object.assign;function v(t,r){var o=e.options.__s;e.options.__s=!0,u=e.options.__b,_=e.options.diffed,d=e.options.__r,f=e.options.unmount;var n=e.h(e.Fragment,null);n.__k=[t];try{return x(t,r||b,!1,void 0,n)}finally{e.options.__c&&e.options.__c(t,h),e.options.__s=o,h.length=0}}function y(){this.__d=!0}var b={};function k(e,t){var r,o=e.type,n=!0;return e.__c?(n=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=b),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=g({},r.state,o.getDerivedStateFromProps(r.props,r.state)):n&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!n&&r.componentWillUpdate&&r.componentWillUpdate(),d&&d(e),r.render(r.props,r.state,t)}function x(a,s,l,c,h){if(null==a||!0===a||!1===a||""===a)return"";if("object"!=typeof a)return"function"==typeof a?"":i(a+"");if(m(a)){var v="";h.__k=a;for(var b=0;b<a.length;b++){var C=a[b];null!=C&&"boolean"!=typeof C&&(v+=x(C,s,l,c,h))}return v}if(void 0!==a.constructor)return"";a.__=h,u&&u(a);var S,A,L,F=a.type,T=a.props,D=s;if("function"==typeof F){if(F===e.Fragment){if(T.UNSTABLE_comment)return"\x3c!--"+i(T.UNSTABLE_comment||"")+"--\x3e";A=T.children}else{if(null!=(S=F.contextType)){var E=s[S.__c];D=E?E.props.value:S.__}if(F.prototype&&"function"==typeof F.prototype.render)A=k(a,D),L=a.__c;else{a.__c=L={__v:a,props:T,context:D,setState:y,forceUpdate:y,__d:!0,__h:[]};for(var Z=0;L.__d&&Z++<25;)L.__d=!1,d&&d(a),A=F.call(L,T,D);L.__d=!0}if(null!=L.getChildContext&&(s=g({},s,L.getChildContext())),(F.getDerivedStateFromError||L.componentDidCatch)&&e.options.errorBoundaries){var M="";A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A;try{return M=x(A,s,l,c,a)}catch(t){return F.getDerivedStateFromError&&(L.__s=F.getDerivedStateFromError(t)),L.componentDidCatch&&L.componentDidCatch(t,{}),L.__d&&(A=k(a,s),null!=(L=a.__c).getChildContext&&(s=g({},s,L.getChildContext())),M=x(A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A,s,l,c,a)),M}finally{_&&_(a),a.__=void 0,f&&f(a)}}}var U=x(A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A,s,l,c,a);return _&&_(a),a.__=void 0,f&&f(a),U}var W,$="<"+F,j="";for(var q in T){var z=T[q];switch(q){case"children":W=z;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in T)continue;q="for";break;case"className":if("class"in T)continue;q="class";break;case"defaultChecked":q="checked";break;case"defaultSelected":q="selected";break;case"defaultValue":case"value":switch(q="value",F){case"textarea":W=z;continue;case"select":c=z;continue;case"option":c!=z||"selected"in T||($+=" selected")}break;case"dangerouslySetInnerHTML":j=z&&z.__html;continue;case"style":"object"==typeof z&&(z=p(z));break;case"acceptCharset":q="accept-charset";break;case"httpEquiv":q="http-equiv";break;default:if(r.test(q))q=q.replace(r,"$1:$2").toLowerCase();else{if(t.test(q))continue;"-"!==q[4]&&"draggable"!==q||null==z?l?n.test(q)&&(q="panose1"===q?"panose-1":q.replace(/([A-Z])/g,"-$1").toLowerCase()):o.test(q)&&(q=q.toLowerCase()):z+=""}}null!=z&&!1!==z&&"function"!=typeof z&&($=!0===z||""===z?$+" "+q:$+" "+q+'="'+i(z+"")+'"')}if(t.test(F))throw new Error(F+" is not a valid HTML tag name in "+$+">");return j||("string"==typeof W?j=i(W):null!=W&&!1!==W&&!0!==W&&(j=x(W,s,"svg"===F||"foreignObject"!==F&&l,c,a))),_&&_(a),a.__=void 0,f&&f(a),!j&&w.has(F)?$+"/>":$+">"+j+"</"+F+">"}var w=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),C=v,S=v;exports.default=v,exports.render=C,exports.renderToStaticMarkup=S,exports.renderToString=v;
var e=require("preact"),t=/[\s\n\\/='"\0<>]/,r=/^(xlink|xmlns|xml)([A-Z])/,o=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,n=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,a=/["&<]/;function i(e){if(0===e.length||!1===a.test(e))return e;for(var t=0,r=0,o="",n="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=n,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var s={},l=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),c=/[A-Z]/g;function p(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var n="-"==r[0]?r:s[r]||(s[r]=r.replace(c,"-$&").toLowerCase()),a=";";"number"!=typeof o||n.startsWith("--")||l.has(n)||(a="px;"),t=t+n+":"+o+a}}return t||void 0}var u,d,f,_,h=[],m=Array.isArray,v=Object.assign;function g(t,r){var o=e.options.__s;e.options.__s=!0,u=e.options.__b,d=e.options.diffed,f=e.options.__r,_=e.options.unmount;var n=e.h(e.Fragment,null);n.__k=[t];try{return k(t,r||x,!1,void 0,n)}finally{e.options.__c&&e.options.__c(t,h),e.options.__s=o,h.length=0}}function y(){this.__d=!0}var x={};function b(e,t){var r,o=e.type,n=!0;return e.__c?(n=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=x),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=v({},r.state,o.getDerivedStateFromProps(r.props,r.state)):n&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!n&&r.componentWillUpdate&&r.componentWillUpdate(),f&&f(e),r.render(r.props,r.state,t)}function k(a,s,l,c,h){if(null==a||!0===a||!1===a||""===a)return"";if("object"!=typeof a)return"function"==typeof a?"":i(a+"");if(m(a)){var g="";h.__k=a;for(var x=0;x<a.length;x++){var C=a[x];null!=C&&"boolean"!=typeof C&&(g+=k(C,s,l,c,h))}return g}if(void 0!==a.constructor)return"";a.__=h,u&&u(a);var S,A,L,F=a.type,T=a.props,D=s;if("function"==typeof F){if(F===e.Fragment){if(T.tpl){for(var E="",Z=0;Z<T.tpl.length;Z++)if(E+=T.tpl[Z],T.exprs&&Z<T.exprs.length){var M=T.exprs[Z];if(null==M)continue;E+="object"==typeof M&&void 0===M.constructor?k(M,s,l,c,a):T.exprs[Z]}return E}if(T.UNSTABLE_comment)return"\x3c!--"+i(T.UNSTABLE_comment||"")+"--\x3e";A=T.children}else{if(null!=(S=F.contextType)){var U=s[S.__c];D=U?U.props.value:S.__}if(F.prototype&&"function"==typeof F.prototype.render)A=b(a,D),L=a.__c;else{a.__c=L={__v:a,props:T,context:D,setState:y,forceUpdate:y,__d:!0,__h:[]};for(var W=0;L.__d&&W++<25;)L.__d=!1,f&&f(a),A=F.call(L,T,D);L.__d=!0}if(null!=L.getChildContext&&(s=v({},s,L.getChildContext())),(F.getDerivedStateFromError||L.componentDidCatch)&&e.options.errorBoundaries){var $="";A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A;try{return $=k(A,s,l,c,a)}catch(t){return F.getDerivedStateFromError&&(L.__s=F.getDerivedStateFromError(t)),L.componentDidCatch&&L.componentDidCatch(t,{}),L.__d&&(A=b(a,s),null!=(L=a.__c).getChildContext&&(s=v({},s,L.getChildContext())),$=k(A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A,s,l,c,a)),$}finally{d&&d(a),a.__=void 0,_&&_(a)}}}var j=k(A=null!=A&&A.type===e.Fragment&&null==A.key?A.props.children:A,s,l,c,a);return d&&d(a),a.__=void 0,_&&_(a),j}var q,z="<"+F,H="";for(var B in T){var I=T[B];switch(B){case"children":q=I;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in T)continue;B="for";break;case"className":if("class"in T)continue;B="class";break;case"defaultChecked":B="checked";break;case"defaultSelected":B="selected";break;case"defaultValue":case"value":switch(B="value",F){case"textarea":q=I;continue;case"select":c=I;continue;case"option":c!=I||"selected"in T||(z+=" selected")}break;case"dangerouslySetInnerHTML":H=I&&I.__html;continue;case"style":"object"==typeof I&&(I=p(I));break;case"acceptCharset":B="accept-charset";break;case"httpEquiv":B="http-equiv";break;default:if(r.test(B))B=B.replace(r,"$1:$2").toLowerCase();else{if(t.test(B))continue;"-"!==B[4]&&"draggable"!==B||null==I?l?n.test(B)&&(B="panose1"===B?"panose-1":B.replace(/([A-Z])/g,"-$1").toLowerCase()):o.test(B)&&(B=B.toLowerCase()):I+=""}}null!=I&&!1!==I&&"function"!=typeof I&&(z=!0===I||""===I?z+" "+B:z+" "+B+'="'+i(I+"")+'"')}if(t.test(F))throw new Error(F+" is not a valid HTML tag name in "+z+">");return H||("string"==typeof q?H=i(q):null!=q&&!1!==q&&!0!==q&&(H=k(q,s,"svg"===F||"foreignObject"!==F&&l,c,a))),d&&d(a),a.__=void 0,_&&_(a),!H&&w.has(F)?z+"/>":z+">"+H+"</"+F+">"}var w=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),C=g,S=g;exports.default=g,exports.render=C,exports.renderToStaticMarkup=S,exports.renderToString=g;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{options as e,h as t,Fragment as r}from"preact";var o=/[\s\n\\/='"\0<>]/,a=/^(xlink|xmlns|xml)([A-Z])/,n=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,i=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,l=/["&<]/;function s(e){if(0===e.length||!1===l.test(e))return e;for(var t=0,r=0,o="",a="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=a,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var c={},p=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),u=/[A-Z]/g;function _(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var a="-"==r[0]?r:c[r]||(c[r]=r.replace(u,"-$&").toLowerCase()),n=";";"number"!=typeof o||a.startsWith("--")||p.has(a)||(n="px;"),t=t+a+":"+o+n}}return t||void 0}var d,f,h,m,v=[],g=Array.isArray,y=Object.assign;function b(o,a){var n=e.__s;e.__s=!0,d=e.__b,f=e.diffed,h=e.__r,m=e.unmount;var i=t(r,null);i.__k=[o];try{return C(o,a||x,!1,void 0,i)}finally{e.__c&&e.__c(o,v),e.__s=n,v.length=0}}function k(){this.__d=!0}var x={};function w(e,t){var r,o=e.type,a=!0;return e.__c?(a=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=x),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=y({},r.state,o.getDerivedStateFromProps(r.props,r.state)):a&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!a&&r.componentWillUpdate&&r.componentWillUpdate(),h&&h(e),r.render(r.props,r.state,t)}function C(t,l,c,p,u){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return"function"==typeof t?"":s(t+"");if(g(t)){var v="";u.__k=t;for(var b=0;b<t.length;b++){var x=t[b];null!=x&&"boolean"!=typeof x&&(v+=C(x,l,c,p,u))}return v}if(void 0!==t.constructor)return"";t.__=u,d&&d(t);var A,L,D,E=t.type,T=t.props,Z=l;if("function"==typeof E){if(E===r){if(T.UNSTABLE_comment)return"\x3c!--"+s(T.UNSTABLE_comment||"")+"--\x3e";L=T.children}else{if(null!=(A=E.contextType)){var F=l[A.__c];Z=F?F.props.value:A.__}if(E.prototype&&"function"==typeof E.prototype.render)L=w(t,Z),D=t.__c;else{t.__c=D={__v:t,props:T,context:Z,setState:k,forceUpdate:k,__d:!0,__h:[]};for(var U=0;D.__d&&U++<25;)D.__d=!1,h&&h(t),L=E.call(D,T,Z);D.__d=!0}if(null!=D.getChildContext&&(l=y({},l,D.getChildContext())),(E.getDerivedStateFromError||D.componentDidCatch)&&e.errorBoundaries){var W="";L=null!=L&&L.type===r&&null==L.key?L.props.children:L;try{return W=C(L,l,c,p,t)}catch(e){return E.getDerivedStateFromError&&(D.__s=E.getDerivedStateFromError(e)),D.componentDidCatch&&D.componentDidCatch(e,{}),D.__d&&(L=w(t,l),null!=(D=t.__c).getChildContext&&(l=y({},l,D.getChildContext())),W=C(L=null!=L&&L.type===r&&null==L.key?L.props.children:L,l,c,p,t)),W}finally{f&&f(t),t.__=void 0,m&&m(t)}}}var $=C(L=null!=L&&L.type===r&&null==L.key?L.props.children:L,l,c,p,t);return f&&f(t),t.__=void 0,m&&m(t),$}var M,j="<"+E,z="";for(var H in T){var q=T[H];switch(H){case"children":M=q;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in T)continue;H="for";break;case"className":if("class"in T)continue;H="class";break;case"defaultChecked":H="checked";break;case"defaultSelected":H="selected";break;case"defaultValue":case"value":switch(H="value",E){case"textarea":M=q;continue;case"select":p=q;continue;case"option":p!=q||"selected"in T||(j+=" selected")}break;case"dangerouslySetInnerHTML":z=q&&q.__html;continue;case"style":"object"==typeof q&&(q=_(q));break;case"acceptCharset":H="accept-charset";break;case"httpEquiv":H="http-equiv";break;default:if(a.test(H))H=H.replace(a,"$1:$2").toLowerCase();else{if(o.test(H))continue;"-"!==H[4]&&"draggable"!==H||null==q?c?i.test(H)&&(H="panose1"===H?"panose-1":H.replace(/([A-Z])/g,"-$1").toLowerCase()):n.test(H)&&(H=H.toLowerCase()):q+=""}}null!=q&&!1!==q&&"function"!=typeof q&&(j=!0===q||""===q?j+" "+H:j+" "+H+'="'+s(q+"")+'"')}if(o.test(E))throw new Error(E+" is not a valid HTML tag name in "+j+">");return z||("string"==typeof M?z=s(M):null!=M&&!1!==M&&!0!==M&&(z=C(M,l,"svg"===E||"foreignObject"!==E&&c,p,t))),f&&f(t),t.__=void 0,m&&m(t),!z&&S.has(E)?j+"/>":j+">"+z+"</"+E+">"}var S=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),A=b,L=b;export default b;export{A as render,L as renderToStaticMarkup,b as renderToString};
import{options as e,h as t,Fragment as r}from"preact";var o=/[\s\n\\/='"\0<>]/,n=/^(xlink|xmlns|xml)([A-Z])/,a=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,i=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,l=/["&<]/;function s(e){if(0===e.length||!1===l.test(e))return e;for(var t=0,r=0,o="",n="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=n,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var c={},p=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),u=/[A-Z]/g;function f(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var n="-"==r[0]?r:c[r]||(c[r]=r.replace(u,"-$&").toLowerCase()),a=";";"number"!=typeof o||n.startsWith("--")||p.has(n)||(a="px;"),t=t+n+":"+o+a}}return t||void 0}var _,d,h,m,v=[],g=Array.isArray,y=Object.assign;function b(o,n){var a=e.__s;e.__s=!0,_=e.__b,d=e.diffed,h=e.__r,m=e.unmount;var i=t(r,null);i.__k=[o];try{return C(o,n||k,!1,void 0,i)}finally{e.__c&&e.__c(o,v),e.__s=a,v.length=0}}function x(){this.__d=!0}var k={};function w(e,t){var r,o=e.type,n=!0;return e.__c?(n=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=k),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=y({},r.state,o.getDerivedStateFromProps(r.props,r.state)):n&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!n&&r.componentWillUpdate&&r.componentWillUpdate(),h&&h(e),r.render(r.props,r.state,t)}function C(t,l,c,p,u){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return"function"==typeof t?"":s(t+"");if(g(t)){var v="";u.__k=t;for(var b=0;b<t.length;b++){var k=t[b];null!=k&&"boolean"!=typeof k&&(v+=C(k,l,c,p,u))}return v}if(void 0!==t.constructor)return"";t.__=u,_&&_(t);var A,L,D,E=t.type,T=t.props,Z=l;if("function"==typeof E){if(E===r){if(T.tpl){for(var F="",U=0;U<T.tpl.length;U++)if(F+=T.tpl[U],T.exprs&&U<T.exprs.length){var W=T.exprs[U];if(null==W)continue;F+="object"==typeof W&&void 0===W.constructor?C(W,l,c,p,t):T.exprs[U]}return F}if(T.UNSTABLE_comment)return"\x3c!--"+s(T.UNSTABLE_comment||"")+"--\x3e";L=T.children}else{if(null!=(A=E.contextType)){var $=l[A.__c];Z=$?$.props.value:A.__}if(E.prototype&&"function"==typeof E.prototype.render)L=w(t,Z),D=t.__c;else{t.__c=D={__v:t,props:T,context:Z,setState:x,forceUpdate:x,__d:!0,__h:[]};for(var j=0;D.__d&&j++<25;)D.__d=!1,h&&h(t),L=E.call(D,T,Z);D.__d=!0}if(null!=D.getChildContext&&(l=y({},l,D.getChildContext())),(E.getDerivedStateFromError||D.componentDidCatch)&&e.errorBoundaries){var M="";L=null!=L&&L.type===r&&null==L.key?L.props.children:L;try{return M=C(L,l,c,p,t)}catch(e){return E.getDerivedStateFromError&&(D.__s=E.getDerivedStateFromError(e)),D.componentDidCatch&&D.componentDidCatch(e,{}),D.__d&&(L=w(t,l),null!=(D=t.__c).getChildContext&&(l=y({},l,D.getChildContext())),M=C(L=null!=L&&L.type===r&&null==L.key?L.props.children:L,l,c,p,t)),M}finally{d&&d(t),t.__=void 0,m&&m(t)}}}var z=C(L=null!=L&&L.type===r&&null==L.key?L.props.children:L,l,c,p,t);return d&&d(t),t.__=void 0,m&&m(t),z}var H,q="<"+E,B="";for(var I in T){var N=T[I];switch(I){case"children":H=N;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in T)continue;I="for";break;case"className":if("class"in T)continue;I="class";break;case"defaultChecked":I="checked";break;case"defaultSelected":I="selected";break;case"defaultValue":case"value":switch(I="value",E){case"textarea":H=N;continue;case"select":p=N;continue;case"option":p!=N||"selected"in T||(q+=" selected")}break;case"dangerouslySetInnerHTML":B=N&&N.__html;continue;case"style":"object"==typeof N&&(N=f(N));break;case"acceptCharset":I="accept-charset";break;case"httpEquiv":I="http-equiv";break;default:if(n.test(I))I=I.replace(n,"$1:$2").toLowerCase();else{if(o.test(I))continue;"-"!==I[4]&&"draggable"!==I||null==N?c?i.test(I)&&(I="panose1"===I?"panose-1":I.replace(/([A-Z])/g,"-$1").toLowerCase()):a.test(I)&&(I=I.toLowerCase()):N+=""}}null!=N&&!1!==N&&"function"!=typeof N&&(q=!0===N||""===N?q+" "+I:q+" "+I+'="'+s(N+"")+'"')}if(o.test(E))throw new Error(E+" is not a valid HTML tag name in "+q+">");return B||("string"==typeof H?B=s(H):null!=H&&!1!==H&&!0!==H&&(B=C(H,l,"svg"===E||"foreignObject"!==E&&c,p,t))),d&&d(t),t.__=void 0,m&&m(t),!B&&S.has(E)?q+"/>":q+">"+B+"</"+E+">"}var S=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),A=b,L=b;export default b;export{A as render,L as renderToStaticMarkup,b as renderToString};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var r=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,n=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,a=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,i=/["&<]/;function s(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,r=0,o="",n="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=n,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var l={},c=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),p=/[A-Z]/g;function u(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var n="-"==r[0]?r:l[r]||(l[r]=r.replace(p,"-$&").toLowerCase()),a=";";"number"!=typeof o||n.startsWith("--")||c.has(n)||(a="px;"),t=t+n+":"+o+a}}return t||void 0}var d,f,_,h,m=[],g=Array.isArray,v=Object.assign;function y(e,r){var o=t.options.__s;t.options.__s=!0,d=t.options.__b,f=t.options.diffed,_=t.options.__r,h=t.options.unmount;var n=t.h(t.Fragment,null);n.__k=[e];try{return w(e,r||k,!1,void 0,n)}finally{t.options.__c&&t.options.__c(e,m),t.options.__s=o,m.length=0}}function b(){this.__d=!0}var k={};function x(e,t){var r,o=e.type,n=!0;return e.__c?(n=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=k),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=v({},r.state,o.getDerivedStateFromProps(r.props,r.state)):n&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!n&&r.componentWillUpdate&&r.componentWillUpdate(),_&&_(e),r.render(r.props,r.state,t)}function w(e,i,l,c,p){if(null==e||!0===e||!1===e||""===e)return"";if("object"!=typeof e)return"function"==typeof e?"":s(e+"");if(g(e)){var m="";p.__k=e;for(var y=0;y<e.length;y++){var k=e[y];null!=k&&"boolean"!=typeof k&&(m+=w(k,i,l,c,p))}return m}if(void 0!==e.constructor)return"";e.__=p,d&&d(e);var S,A,L,T=e.type,F=e.props,D=i;if("function"==typeof T){if(T===t.Fragment){if(F.UNSTABLE_comment)return"\x3c!--"+s(F.UNSTABLE_comment||"")+"--\x3e";A=F.children}else{if(null!=(S=T.contextType)){var E=i[S.__c];D=E?E.props.value:S.__}if(T.prototype&&"function"==typeof T.prototype.render)A=x(e,D),L=e.__c;else{e.__c=L={__v:e,props:F,context:D,setState:b,forceUpdate:b,__d:!0,__h:[]};for(var Z=0;L.__d&&Z++<25;)L.__d=!1,_&&_(e),A=T.call(L,F,D);L.__d=!0}if(null!=L.getChildContext&&(i=v({},i,L.getChildContext())),(T.getDerivedStateFromError||L.componentDidCatch)&&t.options.errorBoundaries){var M="";A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A;try{return M=w(A,i,l,c,e)}catch(r){return T.getDerivedStateFromError&&(L.__s=T.getDerivedStateFromError(r)),L.componentDidCatch&&L.componentDidCatch(r,{}),L.__d&&(A=x(e,i),null!=(L=e.__c).getChildContext&&(i=v({},i,L.getChildContext())),M=w(A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A,i,l,c,e)),M}finally{f&&f(e),e.__=void 0,h&&h(e)}}}var U=w(A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A,i,l,c,e);return f&&f(e),e.__=void 0,h&&h(e),U}var W,$="<"+T,j="";for(var q in F){var z=F[q];switch(q){case"children":W=z;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in F)continue;q="for";break;case"className":if("class"in F)continue;q="class";break;case"defaultChecked":q="checked";break;case"defaultSelected":q="selected";break;case"defaultValue":case"value":switch(q="value",T){case"textarea":W=z;continue;case"select":c=z;continue;case"option":c!=z||"selected"in F||($+=" selected")}break;case"dangerouslySetInnerHTML":j=z&&z.__html;continue;case"style":"object"==typeof z&&(z=u(z));break;case"acceptCharset":q="accept-charset";break;case"httpEquiv":q="http-equiv";break;default:if(o.test(q))q=q.replace(o,"$1:$2").toLowerCase();else{if(r.test(q))continue;"-"!==q[4]&&"draggable"!==q||null==z?l?a.test(q)&&(q="panose1"===q?"panose-1":q.replace(/([A-Z])/g,"-$1").toLowerCase()):n.test(q)&&(q=q.toLowerCase()):z+=""}}null!=z&&!1!==z&&"function"!=typeof z&&($=!0===z||""===z?$+" "+q:$+" "+q+'="'+s(z+"")+'"')}if(r.test(T))throw new Error(T+" is not a valid HTML tag name in "+$+">");return j||("string"==typeof W?j=s(W):null!=W&&!1!==W&&!0!==W&&(j=w(W,i,"svg"===T||"foreignObject"!==T&&l,c,e))),f&&f(e),e.__=void 0,h&&h(e),!j&&C.has(T)?$+"/>":$+">"+j+"</"+T+">"}var C=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),S=y,A=y;e.default=y,e.render=S,e.renderToStaticMarkup=A,e.renderToString=y});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var r=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,n=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,a=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,i=/["&<]/;function s(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,r=0,o="",n="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;default:continue}r!==t&&(o+=e.slice(t,r)),o+=n,t=r+1}return r!==t&&(o+=e.slice(t,r)),o}var l={},c=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),p=/[A-Z]/g;function u(e){var t="";for(var r in e){var o=e[r];if(null!=o&&""!==o){var n="-"==r[0]?r:l[r]||(l[r]=r.replace(p,"-$&").toLowerCase()),a=";";"number"!=typeof o||n.startsWith("--")||c.has(n)||(a="px;"),t=t+n+":"+o+a}}return t||void 0}var f,d,_,h,m=[],g=Array.isArray,v=Object.assign;function y(e,r){var o=t.options.__s;t.options.__s=!0,f=t.options.__b,d=t.options.diffed,_=t.options.__r,h=t.options.unmount;var n=t.h(t.Fragment,null);n.__k=[e];try{return w(e,r||x,!1,void 0,n)}finally{t.options.__c&&t.options.__c(e,m),t.options.__s=o,m.length=0}}function b(){this.__d=!0}var x={};function k(e,t){var r,o=e.type,n=!0;return e.__c?(n=!1,(r=e.__c).state=r.__s):r=new o(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=x),null==r.__s&&(r.__s=r.state),o.getDerivedStateFromProps?r.state=v({},r.state,o.getDerivedStateFromProps(r.props,r.state)):n&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!n&&r.componentWillUpdate&&r.componentWillUpdate(),_&&_(e),r.render(r.props,r.state,t)}function w(e,i,l,c,p){if(null==e||!0===e||!1===e||""===e)return"";if("object"!=typeof e)return"function"==typeof e?"":s(e+"");if(g(e)){var m="";p.__k=e;for(var y=0;y<e.length;y++){var x=e[y];null!=x&&"boolean"!=typeof x&&(m+=w(x,i,l,c,p))}return m}if(void 0!==e.constructor)return"";e.__=p,f&&f(e);var S,A,L,T=e.type,F=e.props,D=i;if("function"==typeof T){if(T===t.Fragment){if(F.tpl){for(var E="",Z=0;Z<F.tpl.length;Z++)if(E+=F.tpl[Z],F.exprs&&Z<F.exprs.length){var j=F.exprs[Z];if(null==j)continue;E+="object"==typeof j&&void 0===j.constructor?w(j,i,l,c,e):F.exprs[Z]}return E}if(F.UNSTABLE_comment)return"\x3c!--"+s(F.UNSTABLE_comment||"")+"--\x3e";A=F.children}else{if(null!=(S=T.contextType)){var M=i[S.__c];D=M?M.props.value:S.__}if(T.prototype&&"function"==typeof T.prototype.render)A=k(e,D),L=e.__c;else{e.__c=L={__v:e,props:F,context:D,setState:b,forceUpdate:b,__d:!0,__h:[]};for(var U=0;L.__d&&U++<25;)L.__d=!1,_&&_(e),A=T.call(L,F,D);L.__d=!0}if(null!=L.getChildContext&&(i=v({},i,L.getChildContext())),(T.getDerivedStateFromError||L.componentDidCatch)&&t.options.errorBoundaries){var W="";A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A;try{return W=w(A,i,l,c,e)}catch(r){return T.getDerivedStateFromError&&(L.__s=T.getDerivedStateFromError(r)),L.componentDidCatch&&L.componentDidCatch(r,{}),L.__d&&(A=k(e,i),null!=(L=e.__c).getChildContext&&(i=v({},i,L.getChildContext())),W=w(A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A,i,l,c,e)),W}finally{d&&d(e),e.__=void 0,h&&h(e)}}}var $=w(A=null!=A&&A.type===t.Fragment&&null==A.key?A.props.children:A,i,l,c,e);return d&&d(e),e.__=void 0,h&&h(e),$}var q,z="<"+T,H="";for(var B in F){var I=F[B];switch(B){case"children":q=I;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in F)continue;B="for";break;case"className":if("class"in F)continue;B="class";break;case"defaultChecked":B="checked";break;case"defaultSelected":B="selected";break;case"defaultValue":case"value":switch(B="value",T){case"textarea":q=I;continue;case"select":c=I;continue;case"option":c!=I||"selected"in F||(z+=" selected")}break;case"dangerouslySetInnerHTML":H=I&&I.__html;continue;case"style":"object"==typeof I&&(I=u(I));break;case"acceptCharset":B="accept-charset";break;case"httpEquiv":B="http-equiv";break;default:if(o.test(B))B=B.replace(o,"$1:$2").toLowerCase();else{if(r.test(B))continue;"-"!==B[4]&&"draggable"!==B||null==I?l?a.test(B)&&(B="panose1"===B?"panose-1":B.replace(/([A-Z])/g,"-$1").toLowerCase()):n.test(B)&&(B=B.toLowerCase()):I+=""}}null!=I&&!1!==I&&"function"!=typeof I&&(z=!0===I||""===I?z+" "+B:z+" "+B+'="'+s(I+"")+'"')}if(r.test(T))throw new Error(T+" is not a valid HTML tag name in "+z+">");return H||("string"==typeof q?H=s(q):null!=q&&!1!==q&&!0!==q&&(H=w(q,i,"svg"===T||"foreignObject"!==T&&l,c,e))),d&&d(e),e.__=void 0,h&&h(e),!H&&C.has(T)?z+"/>":z+">"+H+"</"+T+">"}var C=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),S=y,A=y;e.default=y,e.render=S,e.renderToStaticMarkup=A,e.renderToString=y});
//# sourceMappingURL=index.umd.js.map
{
"name": "preact-render-to-string",
"amdName": "preactRenderToString",
"version": "6.2.2",
"version": "6.3.0",
"description": "Render JSX to an HTML string, with support for Preact components.",

@@ -113,9 +113,9 @@ "main": "dist/index.js",

"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.12.12",
"@babel/preset-env": "^7.12.11",
"@babel/register": "^7.12.10",
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@babel/preset-env": "^7.23.2",
"@babel/register": "^7.22.15",
"@changesets/changelog-github": "^0.4.1",
"@changesets/cli": "^2.18.0",
"benchmarkjs-pretty": "^2.0.1",
"chai": "^4.2.0",
"chai": "^4.3.10",
"copyfiles": "^2.4.1",

@@ -127,3 +127,3 @@ "eslint": "^7.16.0",

"microbundle": "^0.15.1",
"mocha": "^8.2.1",
"mocha": "^10.2.0",
"baseline-rts": "npm:preact-render-to-string@latest",

@@ -130,0 +130,0 @@ "preact": "^10.13.0",

@@ -185,5 +185,32 @@ import {

if (type === Fragment) {
// Fragments are the least used components of core that's why
// branching here for comments has the least effect on perf.
if (props.UNSTABLE_comment) {
// Serialized precompiled JSX.
if (props.tpl) {
let out = '';
for (let i = 0; i < props.tpl.length; i++) {
out += props.tpl[i];
if (props.exprs && i < props.exprs.length) {
const value = props.exprs[i];
if (value == null) continue;
// Check if we're dealing with a vnode
if (typeof value === 'object' && value.constructor === undefined) {
out += _renderToString(
value,
context,
isSvgMode,
selectValue,
vnode
);
} else {
// Values are pre-escaped by the JSX transform
out += props.exprs[i];
}
}
}
return out;
} else if (props.UNSTABLE_comment) {
// Fragments are the least used components of core that's why
// branching here for comments has the least effect on perf.
return '<!--' + encodeEntities(props.UNSTABLE_comment || '') + '-->';

@@ -190,0 +217,0 @@ }

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc