react-runner
Advanced tools
Comparing version 1.0.0 to 1.0.1-alpha.0
@@ -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-esm";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-esm");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-esm";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-esm")):"function"==typeof define&&define.amd?define(["exports","react","sucrase-esm"],r):r((e||self).reactRunner={},e.react,e.sucraseEsm)}(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.0", | ||
"version": "1.0.1-alpha.0", | ||
"description": "Run your React code on the go", | ||
@@ -42,3 +42,3 @@ "homepage": "https://react-runner.vercel.app", | ||
"dependencies": { | ||
"sucrase": "^3.10.1" | ||
"sucrase-esm": "^3.20.3" | ||
}, | ||
@@ -71,3 +71,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "8eae60cbd1fa42d6ed1127d36bf80ccfa99c94e7" | ||
"gitHead": "4f27a5de0bfb8d67885539d2f27272a207c404b2" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54502
3
+ Addedsucrase-esm@^3.20.3
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.1.6(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedsucrase-esm@3.21.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedsucrase@^3.10.1
- Removed@isaacs/cliui@8.0.2(transitive)
- Removed@jridgewell/gen-mapping@0.3.8(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@pkgjs/parseargs@0.11.0(transitive)
- Removedansi-regex@5.0.16.1.0(transitive)
- Removedansi-styles@4.3.06.2.1(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcross-spawn@7.0.6(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@8.0.09.2.2(transitive)
- Removedforeground-child@3.3.0(transitive)
- Removedglob@10.4.5(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjackspeak@3.4.3(transitive)
- Removedlru-cache@10.4.3(transitive)
- Removedminimatch@9.0.5(transitive)
- Removedminipass@7.1.2(transitive)
- Removedpackage-json-from-dist@1.0.1(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpath-scurry@1.11.1(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@4.1.0(transitive)
- Removedstring-width@4.2.35.1.2(transitive)
- Removedstrip-ansi@6.0.17.1.0(transitive)
- Removedsucrase@3.35.0(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwrap-ansi@7.0.08.1.0(transitive)