react-runner
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
import e,{isValidElement as r,createElement as t,Component as o,useRef as n,useState as s,useEffect as c}from"react";import{transform as l}from"sucrase";function u(){return u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u.apply(this,arguments)}const p=e=>l(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),i=/^(\s*)(<[^>]*>|function[\(\s]|\(\)[\s=]|class\s)(.*)/,d=["default","import"],a=(r,t)=>{const{import:o}=t,n=function(e,r){if(null==e)return{};var t,o,n={},s=Object.keys(e);for(o=0;o<s.length;o++)r.indexOf(t=s[o])>=0||(n[t]=e[t]);return n}(t,d),s=u({React:e,require:m(o)},n),c=Object.keys(s),l=c.map(e=>s[e]);return new Function(...c,r)(...l)},f=e=>{const{code:o,scope:n}=e;if(!o.trim())return null;const s={};a(p((e=>e.replace(i,"$1export default $2$3"))(o)),u({render:e=>{s.default=e}},n,{exports:s}));const c=s.default;return c?r(c)?c:"function"==typeof c?t(c):"string"==typeof c?c:null:null},m=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}},v=(e,r)=>{const t={};return a(p(e),u({},r,{exports:t})),t};class h extends o{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:f(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}const y=e=>{let{code:r,scope:o,disableCache:l}=e;const u=n(!0),p=n(null),[i,d]=s(()=>{const e=t(h,{code:r,scope:o,onRendered:r=>{r?d({element:l?null:p.current,error:r.toString()}):p.current=e}});return{element:e,error:null}});return c(()=>{if(u.current)return void(u.current=!1);const e=t(h,{code:r,scope:o,onRendered:r=>{r?d({element:l?null:p.current,error:r.toString()}):p.current=e}});d({element:e,error:null})},[r,o,l]),i};export{h as Runner,m as createRequire,f as generateElement,v as importCode,y as useRunner}; | ||
import e,{isValidElement as r,createElement as t,Component as o,useRef as n,useState as s,useEffect as c}from"react";import{transform as l}from"sucrase";function u(){return u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u.apply(this,arguments)}const p=e=>l(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),i=/^(\s*)(<[^>]*>|function[(\s]|\(\)[\s=]|class\s)(.*)/,d=["default","import"],a=(r,t)=>{const{import:o}=t,n=function(e,r){if(null==e)return{};var t,o,n={},s=Object.keys(e);for(o=0;o<s.length;o++)r.indexOf(t=s[o])>=0||(n[t]=e[t]);return n}(t,d),s=u({React:e,require:m(o)},n),c=Object.keys(s),l=c.map(e=>s[e]);return new Function(...c,r)(...l)},f=e=>{const{code:o,scope:n}=e;if(!o.trim())return null;const s={};a(p((e=>e.replace(i,"$1export default $2$3"))(o)),u({render:e=>{s.default=e}},n,{exports:s}));const c=s.default;return c?r(c)?c:"function"==typeof c?t(c):"string"==typeof c?c:null:null},m=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}},v=(e,r)=>{const t={};return a(p(e),u({},r,{exports:t})),t};class h extends o{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:f(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}const y=e=>{let{code:r,scope:o,disableCache:l}=e;const u=n(!0),p=n(null),[i,d]=s(()=>{const e=t(h,{code:r,scope:o,onRendered:r=>{r?d({element:l?null:p.current,error:r.toString()}):p.current=e}});return{element:e,error:null}});return c(()=>{if(u.current)return void(u.current=!1);const e=t(h,{code:r,scope:o,onRendered:r=>{r?d({element:l?null:p.current,error:r.toString()}):p.current=e}});d({element:e,error:null})},[r,o,l]),i};export{h as Runner,m as createRequire,f as generateElement,v as importCode,y as useRunner}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var e=require("react"),r=require("sucrase");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/t(e);function o(){return o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)}const s=e=>r.transform(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),u=/^(\s*)(<[^>]*>|function[\(\s]|\(\)[\s=]|class\s)(.*)/,c=["default","import"],l=(e,r)=>{const{import:t}=r,s=function(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}(r,c),u=o({React:n.default,require:i(t)},s),l=Object.keys(u),p=l.map(e=>u[e]);return new Function(...l,e)(...p)},p=r=>{const{code:t,scope:n}=r;if(!t.trim())return null;const c={};l(s((e=>e.replace(u,"$1export default $2$3"))(t)),o({render:e=>{c.default=e}},n,{exports:c}));const p=c.default;return p?e.isValidElement(p)?p:"function"==typeof p?e.createElement(p):"string"==typeof p?p:null:null},i=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}};class a extends e.Component{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:p(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}exports.Runner=a,exports.createRequire=i,exports.generateElement=p,exports.importCode=(e,r)=>{const t={};return l(s(e),o({},r,{exports:t})),t},exports.useRunner=r=>{let{code:t,scope:n,disableCache:o}=r;const s=e.useRef(!0),u=e.useRef(null),[c,l]=e.useState(()=>{const r=e.createElement(a,{code:t,scope:n,onRendered:e=>{e?l({element:o?null:u.current,error:e.toString()}):u.current=r}});return{element:r,error:null}});return e.useEffect(()=>{if(s.current)return void(s.current=!1);const r=e.createElement(a,{code:t,scope:n,onRendered:e=>{e?l({element:o?null:u.current,error:e.toString()}):u.current=r}});l({element:r,error:null})},[t,n,o]),c}; | ||
var e=require("react"),r=require("sucrase");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/t(e);function o(){return o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)}const s=e=>r.transform(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),u=/^(\s*)(<[^>]*>|function[(\s]|\(\)[\s=]|class\s)(.*)/,c=["default","import"],l=(e,r)=>{const{import:t}=r,s=function(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}(r,c),u=o({React:n.default,require:i(t)},s),l=Object.keys(u),p=l.map(e=>u[e]);return new Function(...l,e)(...p)},p=r=>{const{code:t,scope:n}=r;if(!t.trim())return null;const c={};l(s((e=>e.replace(u,"$1export default $2$3"))(t)),o({render:e=>{c.default=e}},n,{exports:c}));const p=c.default;return p?e.isValidElement(p)?p:"function"==typeof p?e.createElement(p):"string"==typeof p?p:null:null},i=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}};class a extends e.Component{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:p(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}exports.Runner=a,exports.createRequire=i,exports.generateElement=p,exports.importCode=(e,r)=>{const t={};return l(s(e),o({},r,{exports:t})),t},exports.useRunner=r=>{let{code:t,scope:n,disableCache:o}=r;const s=e.useRef(!0),u=e.useRef(null),[c,l]=e.useState(()=>{const r=e.createElement(a,{code:t,scope:n,onRendered:e=>{e?l({element:o?null:u.current,error:e.toString()}):u.current=r}});return{element:r,error:null}});return e.useEffect(()=>{if(s.current)return void(s.current=!1);const r=e.createElement(a,{code:t,scope:n,onRendered:e=>{e?l({element:o?null:u.current,error:e.toString()}):u.current=r}});l({element:r,error:null})},[t,n,o]),c}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import e,{isValidElement as r,createElement as t,Component as o,useRef as n,useState as s,useEffect as c}from"react";import{transform as l}from"sucrase";function u(){return u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u.apply(this,arguments)}const p=e=>l(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),i=/^(\s*)(<[^>]*>|function[\(\s]|\(\)[\s=]|class\s)(.*)/,d=["default","import"],a=(r,t)=>{const{import:o}=t,n=function(e,r){if(null==e)return{};var t,o,n={},s=Object.keys(e);for(o=0;o<s.length;o++)r.indexOf(t=s[o])>=0||(n[t]=e[t]);return n}(t,d),s=u({React:e,require:m(o)},n),c=Object.keys(s),l=c.map(e=>s[e]);return new Function(...c,r)(...l)},f=e=>{const{code:o,scope:n}=e;if(!o.trim())return null;const s={};a(p((e=>e.replace(i,"$1export default $2$3"))(o)),u({render:e=>{s.default=e}},n,{exports:s}));const c=s.default;return c?r(c)?c:"function"==typeof c?t(c):"string"==typeof c?c:null:null},m=(e={})=>r=>{if(!e.hasOwnProperty(r))throw new Error(`Module not found: '${r}'`);return e[r]},v=(e,r)=>{const t={};return a(p(e),u({},r,{exports:t})),t};class h extends o{constructor(...e){super(...e),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:f(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}const y=({code:e,scope:r,disableCache:o})=>{const l=n(!0),u=n(null),[p,i]=s(()=>{const n=t(h,{code:e,scope:r,onRendered:e=>{e?i({element:o?null:u.current,error:e.toString()}):u.current=n}});return{element:n,error:null}});return c(()=>{if(l.current)return void(l.current=!1);const n=t(h,{code:e,scope:r,onRendered:e=>{e?i({element:o?null:u.current,error:e.toString()}):u.current=n}});i({element:n,error:null})},[e,r,o]),p};export{h as Runner,m as createRequire,f as generateElement,v as importCode,y as useRunner}; | ||
import e,{isValidElement as r,createElement as t,Component as o,useRef as n,useState as s,useEffect as c}from"react";import{transform as l}from"sucrase";function u(){return u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u.apply(this,arguments)}const p=e=>l(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),i=/^(\s*)(<[^>]*>|function[(\s]|\(\)[\s=]|class\s)(.*)/,d=["default","import"],a=(r,t)=>{const{import:o}=t,n=function(e,r){if(null==e)return{};var t,o,n={},s=Object.keys(e);for(o=0;o<s.length;o++)r.indexOf(t=s[o])>=0||(n[t]=e[t]);return n}(t,d),s=u({React:e,require:m(o)},n),c=Object.keys(s),l=c.map(e=>s[e]);return new Function(...c,r)(...l)},f=e=>{const{code:o,scope:n}=e;if(!o.trim())return null;const s={};a(p((e=>e.replace(i,"$1export default $2$3"))(o)),u({render:e=>{s.default=e}},n,{exports:s}));const c=s.default;return c?r(c)?c:"function"==typeof c?t(c):"string"==typeof c?c:null:null},m=(e={})=>r=>{if(!e.hasOwnProperty(r))throw new Error(`Module not found: '${r}'`);return e[r]},v=(e,r)=>{const t={};return a(p(e),u({},r,{exports:t})),t};class h extends o{constructor(...e){super(...e),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:f(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}const y=({code:e,scope:r,disableCache:o})=>{const l=n(!0),u=n(null),[p,i]=s(()=>{const n=t(h,{code:e,scope:r,onRendered:e=>{e?i({element:o?null:u.current,error:e.toString()}):u.current=n}});return{element:n,error:null}});return c(()=>{if(l.current)return void(l.current=!1);const n=t(h,{code:e,scope:r,onRendered:e=>{e?i({element:o?null:u.current,error:e.toString()}):u.current=n}});i({element:n,error:null})},[e,r,o]),p};export{h as Runner,m as createRequire,f as generateElement,v as importCode,y as useRunner}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("sucrase")):"function"==typeof define&&define.amd?define(["exports","react","sucrase"],r):r((e||self).reactRunner={},e.react,e.sucrase)}(this,function(e,r,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/n(r);function s(){return s=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},s.apply(this,arguments)}const u=e=>t.transform(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),c=/^(\s*)(<[^>]*>|function[\(\s]|\(\)[\s=]|class\s)(.*)/,l=["default","import"],i=(e,r)=>{const{import:t}=r,n=function(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}(r,l),u=s({React:o.default,require:a(t)},n),c=Object.keys(u),i=c.map(e=>u[e]);return new Function(...c,e)(...i)},p=e=>{const{code:t,scope:n}=e;if(!t.trim())return null;const o={};i(u((e=>e.replace(c,"$1export default $2$3"))(t)),s({render:e=>{o.default=e}},n,{exports:o}));const l=o.default;return l?r.isValidElement(l)?l:"function"==typeof l?r.createElement(l):"string"==typeof l?l:null:null},a=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}};class d extends r.Component{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:p(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}e.Runner=d,e.createRequire=a,e.generateElement=p,e.importCode=(e,r)=>{const t={};return i(u(e),s({},r,{exports:t})),t},e.useRunner=e=>{let{code:t,scope:n,disableCache:o}=e;const s=r.useRef(!0),u=r.useRef(null),[c,l]=r.useState(()=>{const e=r.createElement(d,{code:t,scope:n,onRendered:r=>{r?l({element:o?null:u.current,error:r.toString()}):u.current=e}});return{element:e,error:null}});return r.useEffect(()=>{if(s.current)return void(s.current=!1);const e=r.createElement(d,{code:t,scope:n,onRendered:r=>{r?l({element:o?null:u.current,error:r.toString()}):u.current=e}});l({element:e,error:null})},[t,n,o]),c}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("sucrase")):"function"==typeof define&&define.amd?define(["exports","react","sucrase"],r):r((e||self).reactRunner={},e.react,e.sucrase)}(this,function(e,r,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/n(r);function s(){return s=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},s.apply(this,arguments)}const u=e=>t.transform(e,{transforms:["jsx","typescript","imports"],production:!0}).code.substring(13),c=/^(\s*)(<[^>]*>|function[(\s]|\(\)[\s=]|class\s)(.*)/,l=["default","import"],i=(e,r)=>{const{import:t}=r,n=function(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}(r,l),u=s({React:o.default,require:a(t)},n),c=Object.keys(u),i=c.map(e=>u[e]);return new Function(...c,e)(...i)},p=e=>{const{code:t,scope:n}=e;if(!t.trim())return null;const o={};i(u((e=>e.replace(c,"$1export default $2$3"))(t)),s({render:e=>{o.default=e}},n,{exports:o}));const l=o.default;return l?r.isValidElement(l)?l:"function"==typeof l?r.createElement(l):"string"==typeof l?l:null:null},a=function(e){return void 0===e&&(e={}),r=>{if(!e.hasOwnProperty(r))throw new Error("Module not found: '"+r+"'");return e[r]}};class d extends r.Component{constructor(){super(...arguments),this.state={element:null,error:null,prevCode:null,prevScope:void 0}}static getDerivedStateFromProps(e,r){if(r.prevCode===e.code&&r.prevScope===e.scope)return null;try{return{element:p(e),error:null,prevCode:e.code,prevScope:e.scope}}catch(r){return{element:null,error:r,prevCode:e.code,prevScope:e.scope}}}static getDerivedStateFromError(e){return{error:e}}componentDidMount(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}shouldComponentUpdate(e,r){return e.code!==this.props.code||e.scope!==this.props.scope||r.error!==this.state.error}componentDidUpdate(){var e,r;null==(e=(r=this.props).onRendered)||e.call(r,this.state.error||void 0)}render(){return this.state.error?null:this.state.element}}e.Runner=d,e.createRequire=a,e.generateElement=p,e.importCode=(e,r)=>{const t={};return i(u(e),s({},r,{exports:t})),t},e.useRunner=e=>{let{code:t,scope:n,disableCache:o}=e;const s=r.useRef(!0),u=r.useRef(null),[c,l]=r.useState(()=>{const e=r.createElement(d,{code:t,scope:n,onRendered:r=>{r?l({element:o?null:u.current,error:r.toString()}):u.current=e}});return{element:e,error:null}});return r.useEffect(()=>{if(s.current)return void(s.current=!1);const e=r.createElement(d,{code:t,scope:n,onRendered:r=>{r?l({element:o?null:u.current,error:r.toString()}):u.current=e}});l({element:e,error:null})},[t,n,o]),c}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "react-runner", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Run your React code on the go", | ||
@@ -70,3 +70,3 @@ "homepage": "https://react-runner.vercel.app", | ||
}, | ||
"gitHead": "c4df83c3f4d192239303d84594163c0ad3a7ff9b" | ||
"gitHead": "ce4f408fbd8726153542ec4e81bafd64a677e830" | ||
} |
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
56184