paths.macro
Advanced tools
Comparing version
15
macro.js
@@ -11,8 +11,8 @@ const path = require('path'); | ||
const _file = path.basename(_fileAbsolute); | ||
const _extention = path.extname(_fileAbsolute) | ||
const _extention = path.extname(_fileAbsolute); | ||
const _filename = _file.replace(_extention, ''); | ||
const _npmRoot = findRootAttempt(_fileAbsolute); | ||
const _gitRoot = findRootAttempt(_fileAbsolute, (dir) => fs.existsSync(path.resolve(dir, '.git'))); | ||
const _npmRoot = toUnix(findRootAttempt(_fileAbsolute)); | ||
const _gitRoot = toUnix(findRootAttempt(_fileAbsolute, (dir) => fs.existsSync(path.resolve(dir, '.git')))); | ||
const _wd = toUnix(process.cwd()); | ||
@@ -35,3 +35,3 @@ | ||
}; | ||
} | ||
}; | ||
@@ -42,8 +42,7 @@ const findRootAttempt = (...params) => { | ||
} catch (error) { | ||
return []; | ||
return ''; | ||
} | ||
} | ||
}; | ||
const macro = ({ references, babel, state }) => { | ||
const macro = ({ references, state }) => { | ||
const paths = getPaths(state.file.opts.filename); | ||
@@ -50,0 +49,0 @@ |
{ | ||
"name": "paths.macro", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Babel plugin that returns an object containing paths like __dirname and __filename as static values", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,0 +0,0 @@ # Babel paths.macro |
@@ -0,0 +0,0 @@ import base, { filename } from '../macro'; |
@@ -0,0 +0,0 @@ const babel = require('babel-core'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
101938
3.07%63
-1.56%1
Infinity%