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

babel-macros

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-macros - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

29

dist/index.js

@@ -12,5 +12,3 @@ 'use strict';

visitor: {
ImportDeclaration(path, _ref) {
var filename = _ref.file.opts.filename;
ImportDeclaration(path, state) {
var isMacros = looksLike(path, {

@@ -30,8 +28,6 @@ node: {

var source = path.node.source.value;
applyMacros({ path, name, source, filename });
applyMacros({ path, name, source, state });
path.remove();
},
CallExpression(path, _ref2) {
var filename = _ref2.file.opts.filename;
CallExpression(path, state) {
var isMacros = looksLike(path, {

@@ -56,3 +52,3 @@ node: {

var source = path.node.arguments[0].value;
applyMacros({ path, name, source, filename });
applyMacros({ path, name, source, state });
path.parentPath.remove();

@@ -64,7 +60,8 @@ }

function applyMacros(_ref3) {
var path = _ref3.path,
name = _ref3.name,
source = _ref3.source,
filename = _ref3.filename;
function applyMacros(_ref) {
var path = _ref.path,
name = _ref.name,
source = _ref.source,
state = _ref.state;
var filename = state.file.opts.filename;

@@ -81,5 +78,5 @@ var referencePaths = path.scope.getBinding(name).referencePaths;

if (ref.parentPath.type === 'TaggedTemplateExpression') {
macros.asTag(ref.parentPath.get('quasi'));
macros.asTag(ref.parentPath.get('quasi'), state);
} else if (ref.parentPath.type === 'CallExpression') {
macros.asFunction(ref.parentPath.get('arguments'));
macros.asFunction(ref.parentPath.get('arguments'), state);
} else if (ref.parentPath.type === 'JSXOpeningElement') {

@@ -89,3 +86,3 @@ macros.asJSX({

children: ref.parentPath.parentPath.get('children')
});
}, state);
} else {

@@ -92,0 +89,0 @@ // TODO: throw a helpful error message

{
"name": "babel-macros",
"version": "0.1.0",
"version": "0.2.0",
"description": "Enables zero-config, importable babel plugins",

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

<div style="text-align:center">
# babel-macros
Enables zero-config, importable babel plugins
# babel-macros 🎣
**Enables zero-config, importable babel plugins**
</div>

@@ -37,3 +39,4 @@

// TODO
This is a work in progress and the form of the solution will likely change a lot
before `1.0.0` is released. Collaboration is welcome!

@@ -40,0 +43,0 @@ ## Installation

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