babel-macros
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -10,3 +10,3 @@ 'use strict'; | ||
function macrosPlugin() { | ||
function macrosPlugin(babel) { | ||
return { | ||
@@ -35,3 +35,3 @@ name: 'macros', | ||
var source = path.node.source.value; | ||
applyMacros({ path, imports, source, state }); | ||
applyMacros({ path, imports, source, state, babel }); | ||
path.remove(); | ||
@@ -63,3 +63,4 @@ }, | ||
source, | ||
state | ||
state, | ||
babel | ||
}); | ||
@@ -76,3 +77,4 @@ path.parentPath.remove(); | ||
source = _ref.source, | ||
state = _ref.state; | ||
state = _ref.state, | ||
babel = _ref.babel; | ||
var filename = state.file.opts.filename; | ||
@@ -95,3 +97,3 @@ | ||
if (isRelative) { | ||
requirePath = p.join(p.dirname(filename), source); | ||
requirePath = p.join(p.dirname(getFullFilename(filename)), source); | ||
} | ||
@@ -102,6 +104,19 @@ // eslint-disable-next-line import/no-dynamic-require | ||
references: referencePathsByImportName, | ||
state | ||
state, | ||
babel | ||
}); | ||
} | ||
/* | ||
istanbul ignore next | ||
because this is hard to test | ||
and not worth it... | ||
*/ | ||
function getFullFilename(filename) { | ||
if (p.isAbsolute(filename)) { | ||
return filename; | ||
} | ||
return p.join(process.cwd(), filename); | ||
} | ||
function looksLike(a, b) { | ||
@@ -108,0 +123,0 @@ return a && b && Object.keys(b).every(function (bKey) { |
{ | ||
"name": "babel-macros", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Enables zero-config, importable babel plugins", | ||
@@ -20,6 +20,7 @@ "main": "dist/index.js", | ||
"all-contributors-cli": "^4.3.0", | ||
"ast-pretty-print": "2.0.0", | ||
"ast-pretty-print": "^2.0.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.25.0", | ||
"babel-jest": "^20.0.3", | ||
"babel-plugin-tester": "3.2.2", | ||
"babel-plugin-tester": "^3.2.2", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
@@ -26,0 +27,0 @@ "babel-plugin-transform-object-rest-spread": "^6.23.0", |
@@ -27,6 +27,2 @@ <div align="center"> | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## The problem | ||
@@ -33,0 +29,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17268
119
22
283