react-runner
Advanced tools
Comparing version 0.4.2 to 0.5.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [0.5.0](https://github.com/nihgwu/react-runner/compare/react-runner@0.4.2...react-runner@0.5.0) (2019-07-04) | ||
### Bug Fixes | ||
* runner would crash app if return object ([3ffe899](https://github.com/nihgwu/react-runner/commit/3ffe899)) | ||
### Features | ||
* export compile ([6318c9b](https://github.com/nihgwu/react-runner/commit/6318c9b)) | ||
## [0.4.2](https://github.com/nihgwu/react-runner/compare/react-runner@0.4.1...react-runner@0.4.2) (2019-06-29) | ||
@@ -8,0 +24,0 @@ |
@@ -158,4 +158,6 @@ 'use strict'; | ||
_proto.render = function render() { | ||
if (this.state.error) return null; | ||
return typeof Element === 'function' ? React__default.createElement(Element, null) : Element; | ||
if (this.state.error || !Element) return null; | ||
var type = typeof Element; | ||
if (type === 'object') return Element.toString(); | ||
return type === 'function' ? React__default.createElement(Element, null) : Element; | ||
}; | ||
@@ -187,3 +189,3 @@ | ||
}; | ||
var transpile = function transpile(options, errorCallback) { | ||
var compile = function compile(options, errorCallback) { | ||
var element = null; | ||
@@ -223,3 +225,3 @@ var error = null; | ||
_defineProperty(_assertThisInitialized(_this), "transpile", function () { | ||
_defineProperty(_assertThisInitialized(_this), "compile", function () { | ||
var _this$props = _this.props, | ||
@@ -230,3 +232,3 @@ code = _this$props.code, | ||
var _transpile = transpile({ | ||
var _compile = compile({ | ||
code: code, | ||
@@ -241,4 +243,4 @@ scope: scope, | ||
}), | ||
element = _transpile.element, | ||
error = _transpile.error; | ||
element = _compile.element, | ||
error = _compile.error; | ||
@@ -257,3 +259,3 @@ _this.setState({ | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.transpile(); | ||
this.compile(); | ||
}; | ||
@@ -268,3 +270,3 @@ | ||
if (code !== prevProps.code || scope !== prevProps.scope || type !== prevProps.type) { | ||
this.transpile(); | ||
this.compile(); | ||
} | ||
@@ -312,3 +314,3 @@ }; | ||
React.useEffect(function () { | ||
var _transpile = transpile({ | ||
var _compile = compile({ | ||
code: code, | ||
@@ -323,4 +325,4 @@ scope: memoScope, | ||
}), | ||
element = _transpile.element, | ||
error = _transpile.error; | ||
element = _compile.element, | ||
error = _compile.error; | ||
@@ -335,3 +337,4 @@ setState({ | ||
exports.compile = compile; | ||
exports.default = Runner; | ||
exports.useRunner = useRunner; |
@@ -151,4 +151,6 @@ import React, { useState, useMemo, useEffect } from 'react'; | ||
_proto.render = function render() { | ||
if (this.state.error) return null; | ||
return typeof Element === 'function' ? React.createElement(Element, null) : Element; | ||
if (this.state.error || !Element) return null; | ||
var type = typeof Element; | ||
if (type === 'object') return Element.toString(); | ||
return type === 'function' ? React.createElement(Element, null) : Element; | ||
}; | ||
@@ -180,3 +182,3 @@ | ||
}; | ||
var transpile = function transpile(options, errorCallback) { | ||
var compile = function compile(options, errorCallback) { | ||
var element = null; | ||
@@ -216,3 +218,3 @@ var error = null; | ||
_defineProperty(_assertThisInitialized(_this), "transpile", function () { | ||
_defineProperty(_assertThisInitialized(_this), "compile", function () { | ||
var _this$props = _this.props, | ||
@@ -223,3 +225,3 @@ code = _this$props.code, | ||
var _transpile = transpile({ | ||
var _compile = compile({ | ||
code: code, | ||
@@ -234,4 +236,4 @@ scope: scope, | ||
}), | ||
element = _transpile.element, | ||
error = _transpile.error; | ||
element = _compile.element, | ||
error = _compile.error; | ||
@@ -250,3 +252,3 @@ _this.setState({ | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.transpile(); | ||
this.compile(); | ||
}; | ||
@@ -261,3 +263,3 @@ | ||
if (code !== prevProps.code || scope !== prevProps.scope || type !== prevProps.type) { | ||
this.transpile(); | ||
this.compile(); | ||
} | ||
@@ -305,3 +307,3 @@ }; | ||
useEffect(function () { | ||
var _transpile = transpile({ | ||
var _compile = compile({ | ||
code: code, | ||
@@ -316,4 +318,4 @@ scope: memoScope, | ||
}), | ||
element = _transpile.element, | ||
error = _transpile.error; | ||
element = _compile.element, | ||
error = _compile.error; | ||
@@ -329,2 +331,2 @@ setState({ | ||
export default Runner; | ||
export { useRunner }; | ||
export { compile, useRunner }; |
{ | ||
"name": "react-runner", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"description": "Run your React code on the go", | ||
@@ -39,3 +39,3 @@ "homepage": "https://nihgwu.github.io/react-runner/", | ||
}, | ||
"gitHead": "f1fa96e5a79e5150f28c28838a17d2905984c659" | ||
"gitHead": "1c9f99ac58d28f3e0515152f1791e10a19fa8c83" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23270
531