Socket
Socket
Sign inDemoInstall

babel-plugin-estrela

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-estrela - npm Package Compare versions

Comparing version 0.11.1 to 0.11.2

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Eduardo Rosostolato",
"version": "0.11.1",
"version": "0.11.2",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "dist/index.js",

@@ -43,3 +43,3 @@ import { NodePath, types as t } from '@babel/core';

} else {
tmpl = path.scope.generateUidIdentifier('_tmpl');
tmpl = path.scope.generateUidIdentifier('_tmpl$');
const template = t.callExpression(state.template, [

@@ -60,3 +60,3 @@ t.stringLiteral(result.template),

function createProps(props: Record<string, any>): t.ObjectExpression {
const result: t.ObjectProperty[] = [];
const result: (t.ObjectProperty | t.SpreadElement)[] = [];
for (const prop in props) {

@@ -70,23 +70,25 @@ let value = props[prop];

}
if (typeof value === 'object' && !t.isNode(value)) {
value = createProps(props[prop]);
if (typeof value === 'object' && value !== null && !t.isNode(value)) {
value = createProps(value);
}
if (typeof value !== 'object') {
if (typeof value === 'string') {
value = t.stringLiteral(value);
}
if (typeof value === 'number') {
value = t.numericLiteral(value);
}
if (typeof value === 'boolean') {
value = t.booleanLiteral(value);
}
if (typeof value === null) {
value = t.nullLiteral();
}
if (typeof value === 'undefined') {
value = t.identifier('undefined');
}
if (typeof value === 'string') {
value = t.stringLiteral(value);
}
result.push(t.objectProperty(t.stringLiteral(prop), value));
if (typeof value === 'number') {
value = t.numericLiteral(value);
}
if (typeof value === 'boolean') {
value = t.booleanLiteral(value);
}
if (value === undefined) {
value = t.tsUndefinedKeyword();
}
if (value === null) {
value = t.nullLiteral();
}
if (prop === '_$spread$') {
result.push(t.spreadElement(value));
} else {
result.push(t.objectProperty(t.stringLiteral(prop), value));
}
}

@@ -134,2 +136,4 @@ return t.objectExpression(result);

}
} else if (attribute.isJSXSpreadAttribute()) {
props['_$spread$'] = attribute.get('argument').node;
} else {

@@ -136,0 +140,0 @@ throw new Error('Unsupported attribute type');

@@ -8,5 +8,5 @@ import { NodePath, types as t } from '@babel/core';

path.state = {
h: path.scope.generateUidIdentifier('h'),
h: path.scope.generateUidIdentifier('h$'),
template: path.scope.generateUidIdentifier('template$'),
tmplDeclaration: t.variableDeclaration('const', []),
template: path.scope.generateUidIdentifier('template'),
} as State;

@@ -13,0 +13,0 @@ },

Sorry, the diff of this file is too big to display

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