preact-render-to-string
Advanced tools
Comparing version 6.4.0 to 6.4.1
@@ -1,2 +0,2 @@ | ||
var e=require("preact"),t=/[\s\n\\/='"\0<>]/,n=/^(xlink|xmlns|xml)([A-Z])/,r=/^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]/,o=/^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 a(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var s={},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"]),l=/[A-Z]/g;function u(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:s[n]||(s[n]=n.replace(l,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||c.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var p=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{f(r,1,i(this.v))}catch(e){f(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?f(r,1,t?t(o):o):n?f(r,1,n(o)):f(r,2,o)}catch(e){f(r,2,e)}},r},e}();function h(e){return e instanceof p&&1&e.s}function d(e,t,n){for(var r;;){var o=e();if(h(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!h(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!h(a)){r=2;break}}}var s=new p,c=f.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(d)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!h(a))return void a.then(d).then(void 0,c);if(!(o=e())||h(o)&&!o.v)return void f(s,1,i);if(o.then)return void o.then(u).then(void 0,c);h(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):f(s,1,i)}function d(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):f(s,1,i)}}function _(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var v,m,y,g,b=[],k=Array.isArray,x=Object.assign;function w(t,n){var r=e.options.__s;e.options.__s=!0,v=e.options.__b,m=e.options.diffed,y=e.options.__r,g=e.options.unmount;var o=e.h(e.Fragment,null);o.__k=[t];try{return F(t,n||C,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options.__c&&e.options.__c(t,b),e.options.__s=r,b.length=0}}function A(){this.__d=!0}var C={};function S(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=C),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=x({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),y&&y(e),n.render(n.props,n.state,t)}function F(i,s,c,l,f,p){if(null==i||!0===i||!1===i||""===i)return"";if("object"!=typeof i)return"function"==typeof i?"":a(i+"");if(k(i)){var h,d="";f.__k=i;for(var _=0;_<i.length;_++){var b=i[_];if(null!=b&&"boolean"!=typeof b){var w,C=F(b,s,c,l,f,p);"string"==typeof C?d+=C:(h=h||[],d&&h.push(d),d="",Array.isArray(C)?(w=h).push.apply(w,C):h.push(C))}}return h?(d&&h.push(d),h):d}if(void 0!==i.constructor)return"";i.__=f,v&&v(i);var T,D,E,j=i.type,P=i.props,U=s;if("function"==typeof j){if(j===e.Fragment){if(P.tpl){for(var Z="",M=0;M<P.tpl.length;M++)if(Z+=P.tpl[M],P.exprs&&M<P.exprs.length){var W=P.exprs[M];if(null==W)continue;"object"!=typeof W||void 0!==W.constructor&&!k(W)?Z+=W:Z+=F(W,s,c,l,i,p)}return Z}if(P.UNSTABLE_comment)return"\x3c!--"+a(P.UNSTABLE_comment||"")+"--\x3e";D=P.children}else{if(null!=(T=j.contextType)){var $=s[T.__c];U=$?$.props.value:T.__}if(j.prototype&&"function"==typeof j.prototype.render)D=S(i,U),E=i.__c;else{i.__c=E={__v:i,props:P,context:U,setState:A,forceUpdate:A,__d:!0,__h:[]};for(var q=0;E.__d&&q++<25;)E.__d=!1,y&&y(i),D=j.call(E,P,U);E.__d=!0}if(null!=E.getChildContext&&(s=x({},s,E.getChildContext())),(j.getDerivedStateFromError||E.componentDidCatch)&&e.options.errorBoundaries){var z="";D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D;try{return z=F(D,s,c,l,i,p)}catch(t){return j.getDerivedStateFromError&&(E.__s=j.getDerivedStateFromError(t)),E.componentDidCatch&&E.componentDidCatch(t,{}),E.__d&&(D=S(i,s),null!=(E=i.__c).getChildContext&&(s=x({},s,E.getChildContext())),z=F(D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D,s,c,l,i,p)),z}finally{m&&m(i),i.__=void 0,g&&g(i)}}}D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D;var H=function(){return F(D,s,c,l,i,p)};try{var B=H();return m&&m(i),i.__=void 0,g&&g(i),B}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var I=function e(){try{return H()}catch(t){return t.then(function(){return H()},function(){return e()})}};return e.then(function(){return I()})}}var N,O="<"+j,R="";for(var V in P){var K=P[V];switch(V){case"children":N=K;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in P)continue;V="for";break;case"className":if("class"in P)continue;V="class";break;case"defaultChecked":V="checked";break;case"defaultSelected":V="selected";break;case"defaultValue":case"value":switch(V="value",j){case"textarea":N=K;continue;case"select":l=K;continue;case"option":l!=K||"selected"in P||(O+=" selected")}break;case"dangerouslySetInnerHTML":R=K&&K.__html;continue;case"style":"object"==typeof K&&(K=u(K));break;case"acceptCharset":V="accept-charset";break;case"httpEquiv":V="http-equiv";break;default:if(n.test(V))V=V.replace(n,"$1:$2").toLowerCase();else{if(t.test(V))continue;"-"!==V[4]&&"draggable"!==V||null==K?c?o.test(V)&&(V="panose1"===V?"panose-1":V.replace(/([A-Z])/g,"-$1").toLowerCase()):r.test(V)&&(V=V.toLowerCase()):K+=""}}null!=K&&!1!==K&&"function"!=typeof K&&(O=!0===K||""===K?O+" "+V:O+" "+V+'="'+a(K+"")+'"')}if(t.test(j))throw new Error(j+" is not a valid HTML tag name in "+O+">");if(R||("string"==typeof N?R=a(N):null!=N&&!1!==N&&!0!==N&&(R=F(N,s,"svg"===j||"foreignObject"!==j&&c,l,i,p))),m&&m(i),i.__=void 0,g&&g(i),!R&&L.has(j))return O+"/>";var G="</"+j+">",J=O+">";return Array.isArray(R)?[J].concat(R,[G]):"string"!=typeof R?[J,R,G]:J+R+G}var L=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),T=w,D=w;exports.default=w,exports.render=T,exports.renderToStaticMarkup=D,exports.renderToString=w,exports.renderToStringAsync=function(t,n){try{var r,o=e.options.__s;e.options.__s=!0,v=e.options.__b,m=e.options.diffed,y=e.options.__r,g=e.options.unmount;var i=e.h(e.Fragment,null);return i.__k=[t],Promise.resolve(_(function(){var e=F(t,n||C,!1,void 0,i,!0),o=function(){if(Array.isArray(e)){var t=function(){var e=o.join("");return r=1,e},n=0,o=e,i=d(function(){return!!o.some(function(e){return"function"==typeof e.then})&&n++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(t):t()}}();return o&&o.then?o.then(function(t){return r?t:e}):r?o:e},function(n,r){if(e.options.__c&&e.options.__c(t,b),e.options.__s=o,b.length=0,n)throw r;return r}))}catch(e){return Promise.reject(e)}}; | ||
var e=require("preact"),t=/[\s\n\\/='"\0<>]/,n=/^(xlink|xmlns|xml)([A-Z])/,r=/^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]/,o=/^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 a(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var s={},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"]),l=/[A-Z]/g;function u(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:s[n]||(s[n]=n.replace(l,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||c.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var p=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{f(r,1,i(this.v))}catch(e){f(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?f(r,1,t?t(o):o):n?f(r,1,n(o)):f(r,2,o)}catch(e){f(r,2,e)}},r},e}();function h(e){return e instanceof p&&1&e.s}function d(e,t,n){for(var r;;){var o=e();if(h(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!h(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!h(a)){r=2;break}}}var s=new p,c=f.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(d)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!h(a))return void a.then(d).then(void 0,c);if(!(o=e())||h(o)&&!o.v)return void f(s,1,i);if(o.then)return void o.then(u).then(void 0,c);h(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):f(s,1,i)}function d(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):f(s,1,i)}}function _(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var v,m,y,g,b=[],k=Array.isArray,x=Object.assign;function w(t,n){var r=e.options.__s;e.options.__s=!0,v=e.options.__b,m=e.options.diffed,y=e.options.__r,g=e.options.unmount;var o=e.h(e.Fragment,null);o.__k=[t];try{return F(t,n||C,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options.__c&&e.options.__c(t,b),e.options.__s=r,b.length=0}}function A(){this.__d=!0}var C={};function S(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=C),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=x({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),y&&y(e),n.render(n.props,n.state,t)}function F(i,s,c,l,f,p){if(null==i||!0===i||!1===i||""===i)return"";if("object"!=typeof i)return"function"==typeof i?"":a(i+"");if(k(i)){var h,d="";f.__k=i;for(var _=0;_<i.length;_++){var b=i[_];if(null!=b&&"boolean"!=typeof b){var w,C=F(b,s,c,l,f,p);"string"==typeof C?d+=C:(h=h||[],d&&h.push(d),d="",Array.isArray(C)?(w=h).push.apply(w,C):h.push(C))}}return h?(d&&h.push(d),h):d}if(void 0!==i.constructor)return"";i.__=f,v&&v(i);var T,D,E,j=i.type,P=i.props,U=s;if("function"==typeof j){if(j===e.Fragment){if(P.tpl){for(var Z="",M=0;M<P.tpl.length;M++)if(Z+=P.tpl[M],P.exprs&&M<P.exprs.length){var W=P.exprs[M];if(null==W)continue;"object"!=typeof W||void 0!==W.constructor&&!k(W)?Z+=W:Z+=F(W,s,c,l,i,p)}return Z}if(P.UNSTABLE_comment)return"\x3c!--"+a(P.UNSTABLE_comment||"")+"--\x3e";D=P.children}else{if(null!=(T=j.contextType)){var $=s[T.__c];U=$?$.props.value:T.__}if(j.prototype&&"function"==typeof j.prototype.render)D=S(i,U),E=i.__c;else{i.__c=E={__v:i,props:P,context:U,setState:A,forceUpdate:A,__d:!0,__h:[]};for(var q=0;E.__d&&q++<25;)E.__d=!1,y&&y(i),D=j.call(E,P,U);E.__d=!0}if(null!=E.getChildContext&&(s=x({},s,E.getChildContext())),(j.getDerivedStateFromError||E.componentDidCatch)&&e.options.errorBoundaries){var z="";D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D;try{return z=F(D,s,c,l,i,p)}catch(t){return j.getDerivedStateFromError&&(E.__s=j.getDerivedStateFromError(t)),E.componentDidCatch&&E.componentDidCatch(t,{}),E.__d&&(D=S(i,s),null!=(E=i.__c).getChildContext&&(s=x({},s,E.getChildContext())),z=F(D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D,s,c,l,i,p)),z}finally{m&&m(i),i.__=null,g&&g(i)}}}D=null!=D&&D.type===e.Fragment&&null==D.key?D.props.children:D;var H=function(){return F(D,s,c,l,i,p)};try{var B=H();return m&&m(i),i.__=null,g&&g(i),B}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var I=function e(){try{return H()}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(function(){return H()},function(){return e()})}};return e.then(function(){return I()})}}var N,O="<"+j,R="";for(var V in P){var K=P[V];switch(V){case"children":N=K;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in P)continue;V="for";break;case"className":if("class"in P)continue;V="class";break;case"defaultChecked":V="checked";break;case"defaultSelected":V="selected";break;case"defaultValue":case"value":switch(V="value",j){case"textarea":N=K;continue;case"select":l=K;continue;case"option":l!=K||"selected"in P||(O+=" selected")}break;case"dangerouslySetInnerHTML":R=K&&K.__html;continue;case"style":"object"==typeof K&&(K=u(K));break;case"acceptCharset":V="accept-charset";break;case"httpEquiv":V="http-equiv";break;default:if(n.test(V))V=V.replace(n,"$1:$2").toLowerCase();else{if(t.test(V))continue;"-"!==V[4]&&"draggable"!==V||null==K?c?o.test(V)&&(V="panose1"===V?"panose-1":V.replace(/([A-Z])/g,"-$1").toLowerCase()):r.test(V)&&(V=V.toLowerCase()):K+=""}}null!=K&&!1!==K&&"function"!=typeof K&&(O=!0===K||""===K?O+" "+V:O+" "+V+'="'+a(K+"")+'"')}if(t.test(j))throw new Error(j+" is not a valid HTML tag name in "+O+">");if(R||("string"==typeof N?R=a(N):null!=N&&!1!==N&&!0!==N&&(R=F(N,s,"svg"===j||"foreignObject"!==j&&c,l,i,p))),m&&m(i),i.__=null,g&&g(i),!R&&L.has(j))return O+"/>";var G="</"+j+">",J=O+">";return Array.isArray(R)?[J].concat(R,[G]):"string"!=typeof R?[J,R,G]:J+R+G}var L=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),T=w,D=w;exports.default=w,exports.render=T,exports.renderToStaticMarkup=D,exports.renderToString=w,exports.renderToStringAsync=function(t,n){try{var r,o=e.options.__s;e.options.__s=!0,v=e.options.__b,m=e.options.diffed,y=e.options.__r,g=e.options.unmount;var i=e.h(e.Fragment,null);return i.__k=[t],Promise.resolve(_(function(){var e=F(t,n||C,!1,void 0,i,!0),o=function(){if(Array.isArray(e)){var t=function(){var e=o.join("");return r=1,e},n=0,o=e,i=d(function(){return!!o.some(function(e){return"function"==typeof e.then})&&n++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(t):t()}}();return o&&o.then?o.then(function(t){return r?t:e}):r?o:e},function(n,r){if(e.options.__c&&e.options.__c(t,b),e.options.__s=o,b.length=0,n)throw r;return r}))}catch(e){return Promise.reject(e)}}; | ||
//# sourceMappingURL=index.js.map |
const mod = require('./commonjs'); | ||
mod.default.renderToStringAsync = mod.renderToStringAsync; | ||
mod.default.renderToStaticMarkup = mod.default; | ||
@@ -3,0 +4,0 @@ mod.default.renderToString = mod.default; |
@@ -1,2 +0,2 @@ | ||
import{options as e,h as t,Fragment as r}from"preact";var n=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,i=/^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/,c=/["&<]/;function s(e){if(0===e.length||!1===c.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var l={},u=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"]),f=/[A-Z]/g;function h(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:l[r]||(l[r]=r.replace(f,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||u.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function p(e,t,r){if(!e.s){if(r instanceof d){if(!r.s)return void(r.o=p.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=r;const n=e.o;n&&n(e)}}var d=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,o=this.s;if(o){var i=1&o?t:r;if(i){try{p(n,1,i(this.v))}catch(e){p(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?p(n,1,t?t(o):o):r?p(n,1,r(o)):p(n,2,o)}catch(e){p(n,2,e)}},n},e}();function _(e){return e instanceof d&&1&e.s}function v(e,t,r){for(var n;;){var o=e();if(_(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=r();if(i&&i.then){if(!_(i)){n=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!_(a)){n=2;break}}}var c=new d,s=p.bind(null,c,2);return(0===n?o.then(u):1===n?i.then(l):a.then(f)).then(void 0,s),c;function l(n){i=n;do{if(t&&(a=t())&&a.then&&!_(a))return void a.then(f).then(void 0,s);if(!(o=e())||_(o)&&!o.v)return void p(c,1,i);if(o.then)return void o.then(u).then(void 0,s);_(i=r())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,s)}function u(e){e?(i=r())&&i.then?i.then(l).then(void 0,s):l(i):p(c,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,s):u(o):p(c,1,i)}}function m(e,t){try{var r=e()}catch(e){return t(!0,e)}return r&&r.then?r.then(t.bind(null,!1),t.bind(null,!0)):t(!1,r)}var y,g,b,k,x=function(n,o){try{var i,a=e.__s;e.__s=!0,y=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var c=t(r,null);return c.__k=[n],Promise.resolve(m(function(){var e=T(n,o||D,!1,void 0,c,!0),t=function(){if(Array.isArray(e)){var t=function(){var e=n.join("");return i=1,e},r=0,n=e,o=v(function(){return!!n.some(function(e){return"function"==typeof e.then})&&r++<25},void 0,function(){return Promise.resolve(Promise.all(n)).then(function(e){n=e.flat()})});return o&&o.then?o.then(t):t()}}();return t&&t.then?t.then(function(t){return i?t:e}):i?t:e},function(t,r){if(e.__c&&e.__c(n,w),e.__s=a,w.length=0,t)throw r;return r}))}catch(e){return Promise.reject(e)}},w=[],A=Array.isArray,C=Object.assign;function S(n,o){var i=e.__s;e.__s=!0,y=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var a=t(r,null);a.__k=[n];try{return T(n,o||D,!1,void 0,a,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(n,w),e.__s=i,w.length=0}}function L(){this.__d=!0}var D={};function E(e,t){var r,n=e.type,o=!0;return e.__c?(o=!1,(r=e.__c).state=r.__s):r=new n(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=D),null==r.__s&&(r.__s=r.state),n.getDerivedStateFromProps?r.state=C({},r.state,n.getDerivedStateFromProps(r.props,r.state)):o&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!o&&r.componentWillUpdate&&r.componentWillUpdate(),b&&b(e),r.render(r.props,r.state,t)}function T(t,c,l,u,f,p){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return"function"==typeof t?"":s(t+"");if(A(t)){var d,_="";f.__k=t;for(var v=0;v<t.length;v++){var m=t[v];if(null!=m&&"boolean"!=typeof m){var x,w=T(m,c,l,u,f,p);"string"==typeof w?_+=w:(d=d||[],_&&d.push(_),_="",Array.isArray(w)?(x=d).push.apply(x,w):d.push(w))}}return d?(_&&d.push(_),d):_}if(void 0!==t.constructor)return"";t.__=f,y&&y(t);var S,D,P,U=t.type,Z=t.props,F=c;if("function"==typeof U){if(U===r){if(Z.tpl){for(var W="",$=0;$<Z.tpl.length;$++)if(W+=Z.tpl[$],Z.exprs&&$<Z.exprs.length){var M=Z.exprs[$];if(null==M)continue;"object"!=typeof M||void 0!==M.constructor&&!A(M)?W+=M:W+=T(M,c,l,u,t,p)}return W}if(Z.UNSTABLE_comment)return"\x3c!--"+s(Z.UNSTABLE_comment||"")+"--\x3e";D=Z.children}else{if(null!=(S=U.contextType)){var z=c[S.__c];F=z?z.props.value:S.__}if(U.prototype&&"function"==typeof U.prototype.render)D=E(t,F),P=t.__c;else{t.__c=P={__v:t,props:Z,context:F,setState:L,forceUpdate:L,__d:!0,__h:[]};for(var H=0;P.__d&&H++<25;)P.__d=!1,b&&b(t),D=U.call(P,Z,F);P.__d=!0}if(null!=P.getChildContext&&(c=C({},c,P.getChildContext())),(U.getDerivedStateFromError||P.componentDidCatch)&&e.errorBoundaries){var q="";D=null!=D&&D.type===r&&null==D.key?D.props.children:D;try{return q=T(D,c,l,u,t,p)}catch(e){return U.getDerivedStateFromError&&(P.__s=U.getDerivedStateFromError(e)),P.componentDidCatch&&P.componentDidCatch(e,{}),P.__d&&(D=E(t,c),null!=(P=t.__c).getChildContext&&(c=C({},c,P.getChildContext())),q=T(D=null!=D&&D.type===r&&null==D.key?D.props.children:D,c,l,u,t,p)),q}finally{g&&g(t),t.__=void 0,k&&k(t)}}}D=null!=D&&D.type===r&&null==D.key?D.props.children:D;var B=function(){return T(D,c,l,u,t,p)};try{var I=B();return g&&g(t),t.__=void 0,k&&k(t),I}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var N=function e(){try{return B()}catch(t){return t.then(function(){return B()},function(){return e()})}};return e.then(function(){return N()})}}var O,R="<"+U,V="";for(var K in Z){var G=Z[K];switch(K){case"children":O=G;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in Z)continue;K="for";break;case"className":if("class"in Z)continue;K="class";break;case"defaultChecked":K="checked";break;case"defaultSelected":K="selected";break;case"defaultValue":case"value":switch(K="value",U){case"textarea":O=G;continue;case"select":u=G;continue;case"option":u!=G||"selected"in Z||(R+=" selected")}break;case"dangerouslySetInnerHTML":V=G&&G.__html;continue;case"style":"object"==typeof G&&(G=h(G));break;case"acceptCharset":K="accept-charset";break;case"httpEquiv":K="http-equiv";break;default:if(o.test(K))K=K.replace(o,"$1:$2").toLowerCase();else{if(n.test(K))continue;"-"!==K[4]&&"draggable"!==K||null==G?l?a.test(K)&&(K="panose1"===K?"panose-1":K.replace(/([A-Z])/g,"-$1").toLowerCase()):i.test(K)&&(K=K.toLowerCase()):G+=""}}null!=G&&!1!==G&&"function"!=typeof G&&(R=!0===G||""===G?R+" "+K:R+" "+K+'="'+s(G+"")+'"')}if(n.test(U))throw new Error(U+" is not a valid HTML tag name in "+R+">");if(V||("string"==typeof O?V=s(O):null!=O&&!1!==O&&!0!==O&&(V=T(O,c,"svg"===U||"foreignObject"!==U&&l,u,t,p))),g&&g(t),t.__=void 0,k&&k(t),!V&&j.has(U))return R+"/>";var J="</"+U+">",Q=R+">";return Array.isArray(V)?[Q].concat(V,[J]):"string"!=typeof V?[Q,V,J]:Q+V+J}var j=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),P=S,U=S;export default S;export{P as render,U as renderToStaticMarkup,S as renderToString,x as renderToStringAsync}; | ||
import{options as e,h as t,Fragment as r}from"preact";var n=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,i=/^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/,c=/["&<]/;function s(e){if(0===e.length||!1===c.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var l={},u=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"]),f=/[A-Z]/g;function h(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:l[r]||(l[r]=r.replace(f,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||u.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function p(e,t,r){if(!e.s){if(r instanceof d){if(!r.s)return void(r.o=p.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=r;const n=e.o;n&&n(e)}}var d=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,o=this.s;if(o){var i=1&o?t:r;if(i){try{p(n,1,i(this.v))}catch(e){p(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?p(n,1,t?t(o):o):r?p(n,1,r(o)):p(n,2,o)}catch(e){p(n,2,e)}},n},e}();function _(e){return e instanceof d&&1&e.s}function v(e,t,r){for(var n;;){var o=e();if(_(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=r();if(i&&i.then){if(!_(i)){n=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!_(a)){n=2;break}}}var c=new d,s=p.bind(null,c,2);return(0===n?o.then(u):1===n?i.then(l):a.then(f)).then(void 0,s),c;function l(n){i=n;do{if(t&&(a=t())&&a.then&&!_(a))return void a.then(f).then(void 0,s);if(!(o=e())||_(o)&&!o.v)return void p(c,1,i);if(o.then)return void o.then(u).then(void 0,s);_(i=r())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,s)}function u(e){e?(i=r())&&i.then?i.then(l).then(void 0,s):l(i):p(c,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,s):u(o):p(c,1,i)}}function y(e,t){try{var r=e()}catch(e){return t(!0,e)}return r&&r.then?r.then(t.bind(null,!1),t.bind(null,!0)):t(!1,r)}var m,g,b,k,x=function(n,o){try{var i,a=e.__s;e.__s=!0,m=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var c=t(r,null);return c.__k=[n],Promise.resolve(y(function(){var e=T(n,o||D,!1,void 0,c,!0),t=function(){if(Array.isArray(e)){var t=function(){var e=n.join("");return i=1,e},r=0,n=e,o=v(function(){return!!n.some(function(e){return"function"==typeof e.then})&&r++<25},void 0,function(){return Promise.resolve(Promise.all(n)).then(function(e){n=e.flat()})});return o&&o.then?o.then(t):t()}}();return t&&t.then?t.then(function(t){return i?t:e}):i?t:e},function(t,r){if(e.__c&&e.__c(n,w),e.__s=a,w.length=0,t)throw r;return r}))}catch(e){return Promise.reject(e)}},w=[],A=Array.isArray,C=Object.assign;function S(n,o){var i=e.__s;e.__s=!0,m=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var a=t(r,null);a.__k=[n];try{return T(n,o||D,!1,void 0,a,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(n,w),e.__s=i,w.length=0}}function L(){this.__d=!0}var D={};function E(e,t){var r,n=e.type,o=!0;return e.__c?(o=!1,(r=e.__c).state=r.__s):r=new n(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r.state=D),null==r.__s&&(r.__s=r.state),n.getDerivedStateFromProps?r.state=C({},r.state,n.getDerivedStateFromProps(r.props,r.state)):o&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!o&&r.componentWillUpdate&&r.componentWillUpdate(),b&&b(e),r.render(r.props,r.state,t)}function T(t,c,l,u,f,p){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return"function"==typeof t?"":s(t+"");if(A(t)){var d,_="";f.__k=t;for(var v=0;v<t.length;v++){var y=t[v];if(null!=y&&"boolean"!=typeof y){var x,w=T(y,c,l,u,f,p);"string"==typeof w?_+=w:(d=d||[],_&&d.push(_),_="",Array.isArray(w)?(x=d).push.apply(x,w):d.push(w))}}return d?(_&&d.push(_),d):_}if(void 0!==t.constructor)return"";t.__=f,m&&m(t);var S,D,P,U=t.type,Z=t.props,F=c;if("function"==typeof U){if(U===r){if(Z.tpl){for(var W="",$=0;$<Z.tpl.length;$++)if(W+=Z.tpl[$],Z.exprs&&$<Z.exprs.length){var M=Z.exprs[$];if(null==M)continue;"object"!=typeof M||void 0!==M.constructor&&!A(M)?W+=M:W+=T(M,c,l,u,t,p)}return W}if(Z.UNSTABLE_comment)return"\x3c!--"+s(Z.UNSTABLE_comment||"")+"--\x3e";D=Z.children}else{if(null!=(S=U.contextType)){var z=c[S.__c];F=z?z.props.value:S.__}if(U.prototype&&"function"==typeof U.prototype.render)D=E(t,F),P=t.__c;else{t.__c=P={__v:t,props:Z,context:F,setState:L,forceUpdate:L,__d:!0,__h:[]};for(var H=0;P.__d&&H++<25;)P.__d=!1,b&&b(t),D=U.call(P,Z,F);P.__d=!0}if(null!=P.getChildContext&&(c=C({},c,P.getChildContext())),(U.getDerivedStateFromError||P.componentDidCatch)&&e.errorBoundaries){var q="";D=null!=D&&D.type===r&&null==D.key?D.props.children:D;try{return q=T(D,c,l,u,t,p)}catch(e){return U.getDerivedStateFromError&&(P.__s=U.getDerivedStateFromError(e)),P.componentDidCatch&&P.componentDidCatch(e,{}),P.__d&&(D=E(t,c),null!=(P=t.__c).getChildContext&&(c=C({},c,P.getChildContext())),q=T(D=null!=D&&D.type===r&&null==D.key?D.props.children:D,c,l,u,t,p)),q}finally{g&&g(t),t.__=null,k&&k(t)}}}D=null!=D&&D.type===r&&null==D.key?D.props.children:D;var B=function(){return T(D,c,l,u,t,p)};try{var I=B();return g&&g(t),t.__=null,k&&k(t),I}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var N=function e(){try{return B()}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(function(){return B()},function(){return e()})}};return e.then(function(){return N()})}}var O,R="<"+U,V="";for(var K in Z){var G=Z[K];switch(K){case"children":O=G;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in Z)continue;K="for";break;case"className":if("class"in Z)continue;K="class";break;case"defaultChecked":K="checked";break;case"defaultSelected":K="selected";break;case"defaultValue":case"value":switch(K="value",U){case"textarea":O=G;continue;case"select":u=G;continue;case"option":u!=G||"selected"in Z||(R+=" selected")}break;case"dangerouslySetInnerHTML":V=G&&G.__html;continue;case"style":"object"==typeof G&&(G=h(G));break;case"acceptCharset":K="accept-charset";break;case"httpEquiv":K="http-equiv";break;default:if(o.test(K))K=K.replace(o,"$1:$2").toLowerCase();else{if(n.test(K))continue;"-"!==K[4]&&"draggable"!==K||null==G?l?a.test(K)&&(K="panose1"===K?"panose-1":K.replace(/([A-Z])/g,"-$1").toLowerCase()):i.test(K)&&(K=K.toLowerCase()):G+=""}}null!=G&&!1!==G&&"function"!=typeof G&&(R=!0===G||""===G?R+" "+K:R+" "+K+'="'+s(G+"")+'"')}if(n.test(U))throw new Error(U+" is not a valid HTML tag name in "+R+">");if(V||("string"==typeof O?V=s(O):null!=O&&!1!==O&&!0!==O&&(V=T(O,c,"svg"===U||"foreignObject"!==U&&l,u,t,p))),g&&g(t),t.__=null,k&&k(t),!V&&j.has(U))return R+"/>";var J="</"+U+">",Q=R+">";return Array.isArray(V)?[Q].concat(V,[J]):"string"!=typeof V?[Q,V,J]:Q+V+J}var j=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),P=S,U=S;export default S;export{P as render,U as renderToStaticMarkup,S as renderToString,x as renderToStringAsync}; | ||
//# 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 n=/[\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]/,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/,a=/["&<]/;function s(e){if(0===e.length||!1===a.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var c={},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"]),u=/[A-Z]/g;function f(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:c[n]||(c[n]=n.replace(u,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||l.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function p(e,t,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var h=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{p(r,1,i(this.v))}catch(e){p(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?p(r,1,t?t(o):o):n?p(r,1,n(o)):p(r,2,o)}catch(e){p(r,2,e)}},r},e}();function d(e){return e instanceof h&&1&e.s}function _(e,t,n){for(var r;;){var o=e();if(d(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!d(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!d(a)){r=2;break}}}var s=new h,c=p.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!d(a))return void a.then(f).then(void 0,c);if(!(o=e())||d(o)&&!o.v)return void p(s,1,i);if(o.then)return void o.then(u).then(void 0,c);d(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):p(s,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):p(s,1,i)}}function v(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var m,y,g,b,k=[],x=Array.isArray,w=Object.assign;function A(e,n){var r=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var o=t.h(t.Fragment,null);o.__k=[e];try{return F(e,n||S,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{t.options.__c&&t.options.__c(e,k),t.options.__s=r,k.length=0}}function C(){this.__d=!0}var S={};function T(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=S),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=w({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),g&&g(e),n.render(n.props,n.state,t)}function F(e,a,c,l,u,p){if(null==e||!0===e||!1===e||""===e)return"";if("object"!=typeof e)return"function"==typeof e?"":s(e+"");if(x(e)){var h,d="";u.__k=e;for(var _=0;_<e.length;_++){var v=e[_];if(null!=v&&"boolean"!=typeof v){var k,A=F(v,a,c,l,u,p);"string"==typeof A?d+=A:(h=h||[],d&&h.push(d),d="",Array.isArray(A)?(k=h).push.apply(k,A):h.push(A))}}return h?(d&&h.push(d),h):d}if(void 0!==e.constructor)return"";e.__=u,m&&m(e);var S,j,D,E=e.type,P=e.props,U=a;if("function"==typeof E){if(E===t.Fragment){if(P.tpl){for(var Z="",M=0;M<P.tpl.length;M++)if(Z+=P.tpl[M],P.exprs&&M<P.exprs.length){var W=P.exprs[M];if(null==W)continue;"object"!=typeof W||void 0!==W.constructor&&!x(W)?Z+=W:Z+=F(W,a,c,l,e,p)}return Z}if(P.UNSTABLE_comment)return"\x3c!--"+s(P.UNSTABLE_comment||"")+"--\x3e";j=P.children}else{if(null!=(S=E.contextType)){var $=a[S.__c];U=$?$.props.value:S.__}if(E.prototype&&"function"==typeof E.prototype.render)j=T(e,U),D=e.__c;else{e.__c=D={__v:e,props:P,context:U,setState:C,forceUpdate:C,__d:!0,__h:[]};for(var q=0;D.__d&&q++<25;)D.__d=!1,g&&g(e),j=E.call(D,P,U);D.__d=!0}if(null!=D.getChildContext&&(a=w({},a,D.getChildContext())),(E.getDerivedStateFromError||D.componentDidCatch)&&t.options.errorBoundaries){var z="";j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j;try{return z=F(j,a,c,l,e,p)}catch(n){return E.getDerivedStateFromError&&(D.__s=E.getDerivedStateFromError(n)),D.componentDidCatch&&D.componentDidCatch(n,{}),D.__d&&(j=T(e,a),null!=(D=e.__c).getChildContext&&(a=w({},a,D.getChildContext())),z=F(j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j,a,c,l,e,p)),z}finally{y&&y(e),e.__=void 0,b&&b(e)}}}j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j;var H=function(){return F(j,a,c,l,e,p)};try{var B=H();return y&&y(e),e.__=void 0,b&&b(e),B}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var I=function e(){try{return H()}catch(t){return t.then(function(){return H()},function(){return e()})}};return e.then(function(){return I()})}}var N,O="<"+E,R="";for(var V in P){var K=P[V];switch(V){case"children":N=K;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in P)continue;V="for";break;case"className":if("class"in P)continue;V="class";break;case"defaultChecked":V="checked";break;case"defaultSelected":V="selected";break;case"defaultValue":case"value":switch(V="value",E){case"textarea":N=K;continue;case"select":l=K;continue;case"option":l!=K||"selected"in P||(O+=" selected")}break;case"dangerouslySetInnerHTML":R=K&&K.__html;continue;case"style":"object"==typeof K&&(K=f(K));break;case"acceptCharset":V="accept-charset";break;case"httpEquiv":V="http-equiv";break;default:if(r.test(V))V=V.replace(r,"$1:$2").toLowerCase();else{if(n.test(V))continue;"-"!==V[4]&&"draggable"!==V||null==K?c?i.test(V)&&(V="panose1"===V?"panose-1":V.replace(/([A-Z])/g,"-$1").toLowerCase()):o.test(V)&&(V=V.toLowerCase()):K+=""}}null!=K&&!1!==K&&"function"!=typeof K&&(O=!0===K||""===K?O+" "+V:O+" "+V+'="'+s(K+"")+'"')}if(n.test(E))throw new Error(E+" is not a valid HTML tag name in "+O+">");if(R||("string"==typeof N?R=s(N):null!=N&&!1!==N&&!0!==N&&(R=F(N,a,"svg"===E||"foreignObject"!==E&&c,l,e,p))),y&&y(e),e.__=void 0,b&&b(e),!R&&L.has(E))return O+"/>";var G="</"+E+">",J=O+">";return Array.isArray(R)?[J].concat(R,[G]):"string"!=typeof R?[J,R,G]:J+R+G}var L=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),j=A,D=A;e.default=A,e.render=j,e.renderToStaticMarkup=D,e.renderToString=A,e.renderToStringAsync=function(e,n){try{var r,o=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var i=t.h(t.Fragment,null);return i.__k=[e],Promise.resolve(v(function(){var t=F(e,n||S,!1,void 0,i,!0),o=function(){if(Array.isArray(t)){var e=function(){var e=o.join("");return r=1,e},n=0,o=t,i=_(function(){return!!o.some(function(e){return"function"==typeof e.then})&&n++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(e):e()}}();return o&&o.then?o.then(function(e){return r?e:t}):r?o:t},function(n,r){if(t.options.__c&&t.options.__c(e,k),t.options.__s=o,k.length=0,n)throw r;return r}))}catch(e){return Promise.reject(e)}}}); | ||
!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 n=/[\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]/,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/,a=/["&<]/;function s(e){if(0===e.length||!1===a.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var c={},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"]),u=/[A-Z]/g;function f(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:c[n]||(c[n]=n.replace(u,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||l.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function p(e,t,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var h=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{p(r,1,i(this.v))}catch(e){p(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?p(r,1,t?t(o):o):n?p(r,1,n(o)):p(r,2,o)}catch(e){p(r,2,e)}},r},e}();function d(e){return e instanceof h&&1&e.s}function _(e,t,n){for(var r;;){var o=e();if(d(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!d(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!d(a)){r=2;break}}}var s=new h,c=p.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!d(a))return void a.then(f).then(void 0,c);if(!(o=e())||d(o)&&!o.v)return void p(s,1,i);if(o.then)return void o.then(u).then(void 0,c);d(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):p(s,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):p(s,1,i)}}function v(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var m,y,g,b,k=[],x=Array.isArray,w=Object.assign;function A(e,n){var r=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var o=t.h(t.Fragment,null);o.__k=[e];try{return F(e,n||S,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{t.options.__c&&t.options.__c(e,k),t.options.__s=r,k.length=0}}function C(){this.__d=!0}var S={};function T(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=S),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=w({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),g&&g(e),n.render(n.props,n.state,t)}function F(e,a,c,l,u,p){if(null==e||!0===e||!1===e||""===e)return"";if("object"!=typeof e)return"function"==typeof e?"":s(e+"");if(x(e)){var h,d="";u.__k=e;for(var _=0;_<e.length;_++){var v=e[_];if(null!=v&&"boolean"!=typeof v){var k,A=F(v,a,c,l,u,p);"string"==typeof A?d+=A:(h=h||[],d&&h.push(d),d="",Array.isArray(A)?(k=h).push.apply(k,A):h.push(A))}}return h?(d&&h.push(d),h):d}if(void 0!==e.constructor)return"";e.__=u,m&&m(e);var S,j,D,E=e.type,P=e.props,U=a;if("function"==typeof E){if(E===t.Fragment){if(P.tpl){for(var Z="",M=0;M<P.tpl.length;M++)if(Z+=P.tpl[M],P.exprs&&M<P.exprs.length){var W=P.exprs[M];if(null==W)continue;"object"!=typeof W||void 0!==W.constructor&&!x(W)?Z+=W:Z+=F(W,a,c,l,e,p)}return Z}if(P.UNSTABLE_comment)return"\x3c!--"+s(P.UNSTABLE_comment||"")+"--\x3e";j=P.children}else{if(null!=(S=E.contextType)){var $=a[S.__c];U=$?$.props.value:S.__}if(E.prototype&&"function"==typeof E.prototype.render)j=T(e,U),D=e.__c;else{e.__c=D={__v:e,props:P,context:U,setState:C,forceUpdate:C,__d:!0,__h:[]};for(var q=0;D.__d&&q++<25;)D.__d=!1,g&&g(e),j=E.call(D,P,U);D.__d=!0}if(null!=D.getChildContext&&(a=w({},a,D.getChildContext())),(E.getDerivedStateFromError||D.componentDidCatch)&&t.options.errorBoundaries){var z="";j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j;try{return z=F(j,a,c,l,e,p)}catch(n){return E.getDerivedStateFromError&&(D.__s=E.getDerivedStateFromError(n)),D.componentDidCatch&&D.componentDidCatch(n,{}),D.__d&&(j=T(e,a),null!=(D=e.__c).getChildContext&&(a=w({},a,D.getChildContext())),z=F(j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j,a,c,l,e,p)),z}finally{y&&y(e),e.__=null,b&&b(e)}}}j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j;var H=function(){return F(j,a,c,l,e,p)};try{var B=H();return y&&y(e),e.__=null,b&&b(e),B}catch(e){if(!p)throw e;if(!e||"function"!=typeof e.then)throw e;var I=function e(){try{return H()}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(function(){return H()},function(){return e()})}};return e.then(function(){return I()})}}var N,O="<"+E,R="";for(var V in P){var K=P[V];switch(V){case"children":N=K;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in P)continue;V="for";break;case"className":if("class"in P)continue;V="class";break;case"defaultChecked":V="checked";break;case"defaultSelected":V="selected";break;case"defaultValue":case"value":switch(V="value",E){case"textarea":N=K;continue;case"select":l=K;continue;case"option":l!=K||"selected"in P||(O+=" selected")}break;case"dangerouslySetInnerHTML":R=K&&K.__html;continue;case"style":"object"==typeof K&&(K=f(K));break;case"acceptCharset":V="accept-charset";break;case"httpEquiv":V="http-equiv";break;default:if(r.test(V))V=V.replace(r,"$1:$2").toLowerCase();else{if(n.test(V))continue;"-"!==V[4]&&"draggable"!==V||null==K?c?i.test(V)&&(V="panose1"===V?"panose-1":V.replace(/([A-Z])/g,"-$1").toLowerCase()):o.test(V)&&(V=V.toLowerCase()):K+=""}}null!=K&&!1!==K&&"function"!=typeof K&&(O=!0===K||""===K?O+" "+V:O+" "+V+'="'+s(K+"")+'"')}if(n.test(E))throw new Error(E+" is not a valid HTML tag name in "+O+">");if(R||("string"==typeof N?R=s(N):null!=N&&!1!==N&&!0!==N&&(R=F(N,a,"svg"===E||"foreignObject"!==E&&c,l,e,p))),y&&y(e),e.__=null,b&&b(e),!R&&L.has(E))return O+"/>";var G="</"+E+">",J=O+">";return Array.isArray(R)?[J].concat(R,[G]):"string"!=typeof R?[J,R,G]:J+R+G}var L=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),j=A,D=A;e.default=A,e.render=j,e.renderToStaticMarkup=D,e.renderToString=A,e.renderToStringAsync=function(e,n){try{var r,o=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var i=t.h(t.Fragment,null);return i.__k=[e],Promise.resolve(v(function(){var t=F(e,n||S,!1,void 0,i,!0),o=function(){if(Array.isArray(t)){var e=function(){var e=o.join("");return r=1,e},n=0,o=t,i=_(function(){return!!o.some(function(e){return"function"==typeof e.then})&&n++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(e):e()}}();return o&&o.then?o.then(function(e){return r?e:t}):r?o:t},function(n,r){if(t.options.__c&&t.options.__c(e,k),t.options.__s=o,k.length=0,n)throw r;return r}))}catch(e){return Promise.reject(e)}}}); | ||
//# sourceMappingURL=index.umd.js.map |
308
package.json
{ | ||
"name": "preact-render-to-string", | ||
"amdName": "preactRenderToString", | ||
"version": "6.4.0", | ||
"description": "Render JSX to an HTML string, with support for Preact components.", | ||
"main": "dist/index.js", | ||
"umd:main": "dist/index.umd.js", | ||
"module": "dist/index.module.js", | ||
"jsnext:main": "dist/index.module.js", | ||
"types": "src/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./src/index.d.ts", | ||
"browser": "./dist/index.module.js", | ||
"umd": "./dist/index.umd.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./jsx": { | ||
"types": "./jsx.d.ts", | ||
"browser": "./dist/jsx.module.js", | ||
"umd": "./dist/jsx.umd.js", | ||
"import": "./dist/jsx.mjs", | ||
"require": "./dist/jsx.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
"bench": "BABEL_ENV=test node -r @babel/register benchmarks index.js", | ||
"bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs", | ||
"build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition", | ||
"postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js && node ./config/node-verify-exports.js", | ||
"transpile": "microbundle src/index.js -f es,cjs,umd --target web --external preact", | ||
"transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact", | ||
"copy-typescript-definition": "copyfiles -f src/*.d.ts dist", | ||
"test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench", | ||
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/*.test.js", | ||
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/compat/*.test.js'", | ||
"test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/debug/index.test.js'", | ||
"format": "prettier src/**/*.{d.ts,js} test/**/*.js --write", | ||
"prepublishOnly": "npm run build", | ||
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" | ||
}, | ||
"keywords": [ | ||
"preact", | ||
"render", | ||
"universal", | ||
"isomorphic" | ||
], | ||
"files": [ | ||
"src", | ||
"dist", | ||
"jsx.js", | ||
"jsx.d.ts", | ||
"typings.json" | ||
], | ||
"eslintConfig": { | ||
"extends": "developit", | ||
"rules": { | ||
"react/prefer-stateless-function": 0, | ||
"react/jsx-no-bind": 0, | ||
"react/no-danger": 0, | ||
"jest/valid-expect": 0, | ||
"new-cap": 0, | ||
"curly": "off", | ||
"brace-style": "off", | ||
"indent": "off" | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "16.8" | ||
} | ||
} | ||
}, | ||
"babel": { | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": true | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-react-jsx", | ||
{ | ||
"pragma": "h" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"minify": { | ||
"compress": { | ||
"reduce_funcs": false | ||
} | ||
}, | ||
"author": "Jason Miller <jason@developit.ca>", | ||
"license": "MIT", | ||
"repository": "developit/preact-render-to-string", | ||
"bugs": "https://github.com/developit/preact-render-to-string/issues", | ||
"homepage": "https://github.com/developit/preact-render-to-string", | ||
"peerDependencies": { | ||
"preact": ">=10" | ||
}, | ||
"devDependencies": { | ||
"@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.3.10", | ||
"copyfiles": "^2.4.1", | ||
"eslint": "^7.16.0", | ||
"eslint-config-developit": "^1.2.0", | ||
"husky": "^4.3.6", | ||
"lint-staged": "^10.5.3", | ||
"microbundle": "^0.15.1", | ||
"mocha": "^10.2.0", | ||
"baseline-rts": "npm:preact-render-to-string@latest", | ||
"preact": "^10.13.0", | ||
"prettier": "^2.2.1", | ||
"sinon": "^9.2.2", | ||
"sinon-chai": "^3.5.0", | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"pretty-format": "^3.8.0" | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"useTabs": true, | ||
"tabWidth": 2 | ||
}, | ||
"lint-staged": { | ||
"**/*.{js,jsx,ts,tsx,yml}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} | ||
"name": "preact-render-to-string", | ||
"amdName": "preactRenderToString", | ||
"version": "6.4.1", | ||
"description": "Render JSX to an HTML string, with support for Preact components.", | ||
"main": "dist/index.js", | ||
"umd:main": "dist/index.umd.js", | ||
"module": "dist/index.module.js", | ||
"jsnext:main": "dist/index.module.js", | ||
"types": "src/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./src/index.d.ts", | ||
"browser": "./dist/index.module.js", | ||
"umd": "./dist/index.umd.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./jsx": { | ||
"types": "./jsx.d.ts", | ||
"browser": "./dist/jsx.module.js", | ||
"umd": "./dist/jsx.umd.js", | ||
"import": "./dist/jsx.mjs", | ||
"require": "./dist/jsx.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
"bench": "BABEL_ENV=test node -r @babel/register benchmarks index.js", | ||
"bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs", | ||
"build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition", | ||
"postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js && node ./config/node-verify-exports.js", | ||
"transpile": "microbundle src/index.js -f es,cjs,umd --target web --external preact", | ||
"transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact", | ||
"copy-typescript-definition": "copyfiles -f src/*.d.ts dist", | ||
"test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench", | ||
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/*.test.js", | ||
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/compat/*.test.js'", | ||
"test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/debug/index.test.js'", | ||
"format": "prettier src/**/*.{d.ts,js} test/**/*.js --write", | ||
"prepublishOnly": "npm run build", | ||
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" | ||
}, | ||
"keywords": [ | ||
"preact", | ||
"render", | ||
"universal", | ||
"isomorphic" | ||
], | ||
"files": [ | ||
"src", | ||
"dist", | ||
"jsx.js", | ||
"jsx.d.ts", | ||
"typings.json" | ||
], | ||
"eslintConfig": { | ||
"extends": "developit", | ||
"rules": { | ||
"react/prefer-stateless-function": 0, | ||
"react/jsx-no-bind": 0, | ||
"react/no-danger": 0, | ||
"jest/valid-expect": 0, | ||
"new-cap": 0, | ||
"curly": "off", | ||
"brace-style": "off", | ||
"indent": "off" | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "16.8" | ||
} | ||
} | ||
}, | ||
"babel": { | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": true | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-react-jsx", | ||
{ | ||
"pragma": "h" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"minify": { | ||
"compress": { | ||
"reduce_funcs": false | ||
} | ||
}, | ||
"author": "Jason Miller <jason@developit.ca>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/preactjs/preact-render-to-string" | ||
}, | ||
"bugs": "https://github.com/developit/preact-render-to-string/issues", | ||
"homepage": "https://github.com/developit/preact-render-to-string", | ||
"peerDependencies": { | ||
"preact": ">=10" | ||
}, | ||
"devDependencies": { | ||
"@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.3.10", | ||
"copyfiles": "^2.4.1", | ||
"eslint": "^7.16.0", | ||
"eslint-config-developit": "^1.2.0", | ||
"husky": "^4.3.6", | ||
"lint-staged": "^10.5.3", | ||
"microbundle": "^0.15.1", | ||
"mocha": "^10.2.0", | ||
"baseline-rts": "npm:preact-render-to-string@latest", | ||
"preact": "^10.13.0", | ||
"prettier": "^2.2.1", | ||
"sinon": "^9.2.2", | ||
"sinon-chai": "^3.5.0", | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"pretty-format": "^3.8.0" | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"useTabs": true, | ||
"tabWidth": 2 | ||
}, | ||
"lint-staged": { | ||
"**/*.{js,jsx,ts,tsx,yml}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"publishConfig": { | ||
"provenance": true | ||
} | ||
} |
@@ -100,6 +100,6 @@ # preact-render-to-string | ||
### `Suspense` & `lazy` components with [`preact/compat`](https://www.npmjs.com/package/preact) & [`preact-ssr-prepass`](https://www.npmjs.com/package/preact-ssr-prepass) | ||
### `Suspense` & `lazy` components with [`preact/compat`](https://www.npmjs.com/package/preact) | ||
```bash | ||
npm install preact preact-render-to-string preact-ssr-prepass | ||
npm install preact preact-render-to-string | ||
``` | ||
@@ -129,16 +129,9 @@ | ||
```jsx | ||
import { render } from 'preact-render-to-string'; | ||
import prepass from 'preact-ssr-prepass'; | ||
import { renderToStringAsync } from 'preact-render-to-string'; | ||
import { Main } from './main'; | ||
const main = async () => { | ||
// Creation of the virtual DOM | ||
const vdom = <Main />; | ||
// Rendering of lazy components | ||
const html = await renderToStringAsync(<Main />); | ||
// Pre-rendering of lazy components | ||
await prepass(vdom); | ||
// Rendering of components | ||
const html = render(vdom); | ||
console.log(html); | ||
@@ -145,0 +138,0 @@ // <h1>Home page</h1> |
@@ -428,3 +428,3 @@ import { | ||
if (afterDiff) afterDiff(vnode); | ||
vnode[PARENT] = undefined; | ||
vnode[PARENT] = null; | ||
@@ -457,3 +457,3 @@ if (ummountHook) ummountHook(vnode); | ||
if (afterDiff) afterDiff(vnode); | ||
vnode[PARENT] = undefined; | ||
vnode[PARENT] = null; | ||
@@ -472,2 +472,4 @@ if (ummountHook) ummountHook(vnode); | ||
} catch (e) { | ||
if (!e || typeof e.then !== 'function') throw e; | ||
return e.then( | ||
@@ -622,3 +624,3 @@ () => renderChildren(), | ||
if (afterDiff) afterDiff(vnode); | ||
vnode[PARENT] = undefined; | ||
vnode[PARENT] = null; | ||
if (ummountHook) ummountHook(vnode); | ||
@@ -625,0 +627,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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
439211
1634
0
150