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

jarle

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jarle - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

11

CHANGELOG.md

@@ -0,1 +1,12 @@

# [1.1.0](https://github.com/jquense/jarle/compare/v1.0.3...v1.1.0) (2021-01-22)
### Features
* allow component returns and export default ([1000f48](https://github.com/jquense/jarle/commit/1000f48271f0a9424c9e00b27323b5a89e99de42))
## [1.0.3](https://github.com/jquense/jarle/compare/v1.0.2...v1.0.3) (2021-01-12)

@@ -2,0 +13,0 @@

@@ -16,2 +16,4 @@ "use strict";

var _reactIs = require("react-is");
var _sourcemapCodec = require("sourcemap-codec");

@@ -150,2 +152,10 @@

if (! /*#__PURE__*/(0, _react.isValidElement)(element)) {
if ((0, _reactIs.isValidElementType)(element)) {
element = /*#__PURE__*/(0, _react.createElement)(element);
} else {
reject(new SyntaxError('The code did not return a valid React element or element type'));
}
}
resolve(element);

@@ -152,0 +162,0 @@ });

22

esm/transform/wrapLastExpression.js

@@ -12,8 +12,22 @@ "use strict";

leave(node) {
if (node.body.find(n => n.type === 'ReturnStatement')) {
return;
const body = node.body.concat().reverse();
let lastExpr;
for (const _node of body) {
switch (_node.type) {
case 'ExpressionStatement':
case 'ClassDeclaration':
case 'FunctionDeclaration':
lastExpr = lastExpr || _node;
break;
case 'ReturnStatement':
return;
case 'ExportDefaultDeclaration':
this.overwrite(_node.start, _node.declaration.start, '');
lastExpr = _node.declaration;
}
}
const lastExpr = node.body.concat().reverse().find(n => n.type === 'ExpressionStatement' || n.type === 'ClassDeclaration' || n.type === 'FunctionDeclaration');
if (!lastExpr) {

@@ -20,0 +34,0 @@ return;

@@ -16,2 +16,4 @@ "use strict";

var _reactIs = require("react-is");
var _sourcemapCodec = require("sourcemap-codec");

@@ -150,2 +152,10 @@

if (! /*#__PURE__*/(0, _react.isValidElement)(element)) {
if ((0, _reactIs.isValidElementType)(element)) {
element = /*#__PURE__*/(0, _react.createElement)(element);
} else {
reject(new SyntaxError('The code did not return a valid React element or element type'));
}
}
resolve(element);

@@ -152,0 +162,0 @@ });

@@ -12,8 +12,22 @@ "use strict";

leave(node) {
if (node.body.find(n => n.type === 'ReturnStatement')) {
return;
const body = node.body.concat().reverse();
let lastExpr;
for (const _node of body) {
switch (_node.type) {
case 'ExpressionStatement':
case 'ClassDeclaration':
case 'FunctionDeclaration':
lastExpr = lastExpr || _node;
break;
case 'ReturnStatement':
return;
case 'ExportDefaultDeclaration':
this.overwrite(_node.start, _node.declaration.start, '');
lastExpr = _node.declaration;
}
}
const lastExpr = node.body.concat().reverse().find(n => n.type === 'ExpressionStatement' || n.type === 'ClassDeclaration' || n.type === 'FunctionDeclaration');
if (!lastExpr) {

@@ -20,0 +34,0 @@ return;

4

package.json
{
"name": "jarle",
"version": "1.0.3",
"version": "1.1.0",
"main": "lib/index.js",

@@ -65,2 +65,3 @@ "module": "esm/index.js",

"@types/react-dom": "^16.9.7",
"@types/react-is": "^17.0.0",
"acorn": "^8.0.1",

@@ -72,2 +73,3 @@ "acorn-jsx": "^5.2.0",

"prop-types": "^15.7.2",
"react-is": "^17.0.1",
"react-simple-code-editor": "^0.11.0",

@@ -74,0 +76,0 @@ "sourcemap-codec": "^1.4.8"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc