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

babel-plugin-macros

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-macros - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

41

dist/index.js

@@ -59,2 +59,12 @@ 'use strict';

function macrosPlugin(babel) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$require = _ref.require,
_require = _ref$require === undefined ? require : _ref$require;
function interopRequire(path) {
// eslint-disable-next-line import/no-dynamic-require
var o = _require(path);
return o && o.__esModule && o.default ? o.default : o;
}
return {

@@ -88,3 +98,4 @@ name: 'macros',

state,
babel
babel,
interopRequire
});

@@ -125,3 +136,4 @@ path.remove();

state,
babel
babel,
interopRequire
});

@@ -137,14 +149,15 @@

// eslint-disable-next-line complexity
function applyMacros(_ref) {
var path = _ref.path,
imports = _ref.imports,
source = _ref.source,
state = _ref.state,
babel = _ref.babel;
function applyMacros(_ref2) {
var path = _ref2.path,
imports = _ref2.imports,
source = _ref2.source,
state = _ref2.state,
babel = _ref2.babel,
interopRequire = _ref2.interopRequire;
var filename = state.file.opts.filename;
var hasReferences = false;
var referencePathsByImportName = imports.reduce(function (byName, _ref2) {
var importedName = _ref2.importedName,
localName = _ref2.localName;
var referencePathsByImportName = imports.reduce(function (byName, _ref3) {
var importedName = _ref3.importedName,
localName = _ref3.localName;

@@ -245,8 +258,2 @@ byName[importedName] = path.scope.getBinding(localName).referencePaths;

function interopRequire(path) {
// eslint-disable-next-line import/no-dynamic-require
var o = require(path);
return o && o.__esModule && o.default ? o.default : o;
}
module.exports = macrosPlugin;

@@ -253,0 +260,0 @@ Object.assign(module.exports, {

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

{"name":"babel-plugin-macros","version":"2.1.0","description":"Enables zero-config, importable babel plugins","main":"dist/index.js","scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","test:update":"npm test -- --updateSnapshot","validate":"kcd-scripts validate","setup":"npm install && npm run validate -s","precommit":"kcd-scripts precommit"},"files":["dist"],"keywords":["babel-plugin","macros","macro","babel-macro","babel-plugin-macro"],"author":"Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)","license":"MIT","dependencies":{"cosmiconfig":"^4.0.0"},"devDependencies":{"ast-pretty-print":"^2.0.1","babel-core":"7.0.0-beta.3","babel-plugin-tester":"^5.0.0","babylon":"7.0.0-beta.34","cpy":"^6.0.0","kcd-scripts":"^0.32.1"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js"},"eslintIgnore":["node_modules","coverage","dist"],"babel":{"presets":["./other/babel-config.js"]},"repository":{"type":"git","url":"https://github.com/kentcdodds/babel-plugin-macros.git"},"bugs":{"url":"https://github.com/kentcdodds/babel-plugin-macros/issues"},"homepage":"https://github.com/kentcdodds/babel-plugin-macros#readme"}
{"name":"babel-plugin-macros","version":"2.2.0","description":"Enables zero-config, importable babel plugins","main":"dist/index.js","scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","test:update":"npm test -- --updateSnapshot","validate":"kcd-scripts validate","setup":"npm install && npm run validate -s","precommit":"kcd-scripts precommit"},"files":["dist"],"keywords":["babel-plugin","macros","macro","babel-macro","babel-plugin-macro"],"author":"Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)","license":"MIT","dependencies":{"cosmiconfig":"^4.0.0"},"devDependencies":{"ast-pretty-print":"^2.0.1","babel-core":"7.0.0-beta.3","babel-plugin-tester":"^5.0.0","babylon":"7.0.0-beta.34","cpy":"^6.0.0","kcd-scripts":"^0.32.1"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js"},"eslintIgnore":["node_modules","coverage","dist"],"babel":{"presets":["./other/babel-config.js"]},"repository":{"type":"git","url":"https://github.com/kentcdodds/babel-plugin-macros.git"},"bugs":{"url":"https://github.com/kentcdodds/babel-plugin-macros/issues"},"homepage":"https://github.com/kentcdodds/babel-plugin-macros#readme"}

@@ -16,3 +16,3 @@ <div align="center">

[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]

@@ -124,2 +124,3 @@ [![Donate][donate-badge]][donate]

* [How about implicit optimizations at compile time?](#how-about-implicit-optimizations-at-compile-time)
* [Should macros be dependencies or devDependencies?](#should-macros-be-dependencies-or-devdependencies)
* [Inspiration](#inspiration)

@@ -193,4 +194,4 @@ * [Other Solutions](#other-solutions)

1. Add `babel-plugin-console` to `.babelrc`
2. Use it in a code:
1. Add `babel-plugin-console` to `.babelrc`
2. Use it in a code:

@@ -221,4 +222,4 @@ ```js

1. Add `babel-plugin-macros` to `.babelrc` (only once for all macros)
2. Use it in a code:
1. Add `babel-plugin-macros` to `.babelrc` (only once for all macros)
2. Use it in a code:

@@ -322,2 +323,6 @@ ```js

### Should macros be dependencies or devDependencies?
Macros are processed at build-time and not required at runtime. They should be devDependencies.
## Inspiration

@@ -342,5 +347,5 @@

<!-- prettier-ignore -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Tests") | [<img src="https://avatars1.githubusercontent.com/u/18808?v=3" width="100px;"/><br /><sub><b>Sunil Pai</b></sub>](https://github.com/threepointone)<br />[🤔](#ideas-threepointone "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/1341513?v=3" width="100px;"/><br /><sub><b>Stephen Scott</b></sub>](http://suchipi.com/)<br />[💬](#question-suchipi "Answering Questions") [📖](https://github.com/kentcdodds/babel-plugin-macros/commits?author=suchipi "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/767261?v=4" width="100px;"/><br /><sub><b>Michiel Dral</b></sub>](http://twitter.com/dralletje)<br />[🤔](#ideas-dralletje "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/662750?v=4" width="100px;"/><br /><sub><b>Kye Hohenberger</b></sub>](https://github.com/tkh44)<br />[🤔](#ideas-tkh44 "Ideas, Planning, & Feedback") | [<img src="https://avatars1.githubusercontent.com/u/11481355?v=4" width="100px;"/><br /><sub><b>Mitchell Hamilton</b></sub>](https://hamil.town)<br />[💻](https://github.com/kentcdodds/babel-plugin-macros/commits?author=mitchellhamilton "Code") [⚠️](https://github.com/kentcdodds/babel-plugin-macros/commits?author=mitchellhamilton "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;"/><br /><sub><b>Justin Hall</b></sub>](https://github.com/wKovacs64)<br />[📖](https://github.com/kentcdodds/babel-plugin-macros/commits?author=wKovacs64 "Documentation") |
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Code") [📖](/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](/kentcdodds/babel-plugin-macros/commits?author=kentcdodds "Tests") | [<img src="https://avatars1.githubusercontent.com/u/18808?v=3" width="100px;"/><br /><sub><b>Sunil Pai</b></sub>](https://github.com/threepointone)<br />[🤔](#ideas-threepointone "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/1341513?v=3" width="100px;"/><br /><sub><b>Stephen Scott</b></sub>](http://suchipi.com/)<br />[💬](#question-suchipi "Answering Questions") [📖](/kentcdodds/babel-plugin-macros/commits?author=suchipi "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/767261?v=4" width="100px;"/><br /><sub><b>Michiel Dral</b></sub>](http://twitter.com/dralletje)<br />[🤔](#ideas-dralletje "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/662750?v=4" width="100px;"/><br /><sub><b>Kye Hohenberger</b></sub>](https://github.com/tkh44)<br />[🤔](#ideas-tkh44 "Ideas, Planning, & Feedback") | [<img src="https://avatars1.githubusercontent.com/u/11481355?v=4" width="100px;"/><br /><sub><b>Mitchell Hamilton</b></sub>](https://hamil.town)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=mitchellhamilton "Code") [⚠️](/kentcdodds/babel-plugin-macros/commits?author=mitchellhamilton "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;"/><br /><sub><b>Justin Hall</b></sub>](https://github.com/wKovacs64)<br />[📖](/kentcdodds/babel-plugin-macros/commits?author=wKovacs64 "Documentation") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars3.githubusercontent.com/u/1903016?v=4" width="100px;"/><br /><sub><b>Brian Pedersen</b></sub>](https://github.com/PiereDome)<br />[💻](https://github.com/kentcdodds/babel-plugin-macros/commits?author=PiereDome "Code") [📖](https://github.com/kentcdodds/babel-plugin-macros/commits?author=PiereDome "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/4495237?v=4" width="100px;"/><br /><sub><b>Andrew Palm</b></sub>](https://github.com/apalm)<br />[💻](https://github.com/kentcdodds/babel-plugin-macros/commits?author=apalm "Code") | [<img src="https://avatars1.githubusercontent.com/u/1527371?v=4" width="100px;"/><br /><sub><b>Michael Hsu</b></sub>](https://michaelhsu.tw/)<br />[📖](https://github.com/kentcdodds/babel-plugin-macros/commits?author=evenchange4 "Documentation") [🔌](#plugin-evenchange4 "Plugin/utility libraries") | [<img src="https://avatars2.githubusercontent.com/u/16605186?v=4" width="100px;"/><br /><sub><b>Bo Lingen</b></sub>](https://github.com/citycide)<br />[💻](https://github.com/kentcdodds/babel-plugin-macros/commits?author=citycide "Code") |
| [<img src="https://avatars3.githubusercontent.com/u/1903016?v=4" width="100px;"/><br /><sub><b>Brian Pedersen</b></sub>](https://github.com/PiereDome)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=PiereDome "Code") [📖](/kentcdodds/babel-plugin-macros/commits?author=PiereDome "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/4495237?v=4" width="100px;"/><br /><sub><b>Andrew Palm</b></sub>](https://github.com/apalm)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=apalm "Code") | [<img src="https://avatars1.githubusercontent.com/u/1527371?v=4" width="100px;"/><br /><sub><b>Michael Hsu</b></sub>](https://michaelhsu.tw/)<br />[📖](/kentcdodds/babel-plugin-macros/commits?author=evenchange4 "Documentation") [🔌](#plugin-evenchange4 "Plugin/utility libraries") | [<img src="https://avatars2.githubusercontent.com/u/16605186?v=4" width="100px;"/><br /><sub><b>Bo Lingen</b></sub>](https://github.com/citycide)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=citycide "Code") | [<img src="https://avatars1.githubusercontent.com/u/11150235?v=4" width="100px;"/><br /><sub><b>Tyler Haas</b></sub>](https://github.com/tylerthehaas)<br />[📖](/kentcdodds/babel-plugin-macros/commits?author=tylerthehaas "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/1250430?v=4" width="100px;"/><br /><sub><b>FWeinb</b></sub>](https://github.com/FWeinb)<br />[💻](/kentcdodds/babel-plugin-macros/commits?author=FWeinb "Code") |

@@ -347,0 +352,0 @@ <!-- ALL-CONTRIBUTORS-LIST:END -->

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