Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add test * fix: pass File to helper traverser * pass babel.File to helpers.ensure
- Loading branch information
1 parent
748897b
commit 2886e1e
Showing
8 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
REPLACE_ME; |
3 changes: 3 additions & 0 deletions
3
packages/babel-helpers/test/fixtures/regression/9496/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["./plugin"] | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-helpers/test/fixtures/regression/9496/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function _$_9496_main_hub_is_found() {} | ||
|
||
_$_9496_main_hub_is_found; |
22 changes: 22 additions & 0 deletions
22
packages/babel-helpers/test/fixtures/regression/9496/plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const defineHelper = require("../../../helpers/define-helper").default; | ||
|
||
const main = defineHelper(__dirname, "main", ` | ||
export default function helper() {} | ||
`); | ||
|
||
module.exports = function() { | ||
return { | ||
visitor: { | ||
Identifier(path) { | ||
if (path.node.name !== "REPLACE_ME") { | ||
if (path.hub) { | ||
path.node.name += "_hub_is_found"; | ||
} | ||
return; | ||
} | ||
const helper = this.addHelper(main); | ||
path.replaceWith(helper); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters