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

babel-plugin-vdux-transform

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-vdux-transform - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

39

lib/index.js

@@ -37,2 +37,13 @@ 'use strict';

function isDefaultExport(path) {
var p = path;
while (p.parentPath) {
if (p.type === 'ExportDefaultDeclaration') return true;
p = p.parentPath;
}
return false;
}
function isFunctionalComponent(path) {

@@ -95,2 +106,10 @@ var node = path.node;

function filenameToComponentName(basename, filename) {
if (basename === 'index') {
return path.basename(path.dirname(filename));
}
return basename;
}
var wrapperFunctionTemplate = template('\n function WRAPPER_FUNCTION_ID(ID_PARAM) {\n return function(COMPONENT_PARAM) {\n return EXPRESSION\n }\n }\n ');

@@ -121,6 +140,23 @@

CallExpression: function CallExpression(path) {
if (path.node[VISITED_KEY] || !isHocComponent(path.node, this.options.hoc) && !isVduxLikeComponent(path.node)) {
var isHoc = isHocComponent(path.node, this.options.hoc);
if (path.node[VISITED_KEY] || !isHoc && !isVduxLikeComponent(path.node)) {
return;
}
if (!isHoc && isDefaultExport(path)) {
var name = filenameToComponentName(this.file.opts.basename, this.file.opts.filename);
var props = path.node.arguments[0].properties;
for (var i = 0; i < props.length; i++) {
var prop = props[i];
var key = t.toComputedKey(prop);
if (t.isLiteral(key, { value: 'name' })) {
return;
}
}
props.unshift(t.objectProperty(t.identifier('name'), t.stringLiteral(name)));
}
path.node[VISITED_KEY] = true;

@@ -228,2 +264,3 @@

currentlyInFunction: false,
file: this.file,
options: this.options

@@ -230,0 +267,0 @@ });

2

package.json
{
"name": "babel-plugin-vdux-transform",
"version": "1.1.0",
"version": "1.1.1",
"description": "Babel plugin to instrument vdux components with custom transforms",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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