Skip to content

Commit

Permalink
fix: Use state argument instead of path.hub.
Browse files Browse the repository at this point in the history
In some cases path.hub can be undefined, use the second argument to
visitor functions instead.
  • Loading branch information
coreyfarrell committed Feb 11, 2019
1 parent 1fba803 commit 55279db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ module.exports = ({types: t, template}) => ({
path.replaceWith(template(globalName)());
});
},
VariableDeclarator(path) {
const sourceFileName = getModuleName(path.hub.file.opts.parserOpts.sourceFileName);
VariableDeclarator(path, state) {
const sourceFileName = getModuleName(state.file.opts.parserOpts.sourceFileName);
if (!sourceFileName) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"homepage": "https://github.com/cfware/babel-plugin-remove-ungap#readme",
"devDependencies": {
"@babel/core": "^7.2.2",
"ava": "^1.1.0",
"nyc": "^13.1.0",
"ava": "^1.2.1",
"nyc": "^13.2.0",
"xo": "^0.24.0"
},
"nyc": {
Expand Down

0 comments on commit 55279db

Please sign in to comment.