mirror of
https://github.com/hanzoai/babel.git
synced 2026-10-30 14:46:06 +00:00
* Convert `@babel/helpers` tests to ESM * Run some tests on older versions * Fix * Update jest.config.js
29 lines
612 B
JavaScript
29 lines
612 B
JavaScript
import defineHelper from "../../../helpers/define-helper.js";
|
|
|
|
const dependency = defineHelper(import.meta.url, "dependency", `
|
|
export default function fn() {}
|
|
`);
|
|
|
|
const main = defineHelper(import.meta.url, "main", `
|
|
import dep from "${dependency}";
|
|
|
|
export default function helper() {
|
|
let x = dep;
|
|
return function (dep) {
|
|
return x() + dep;
|
|
}
|
|
}
|
|
`);
|
|
|
|
export default function() {
|
|
return {
|
|
visitor: {
|
|
Identifier(path) {
|
|
if (path.node.name !== "REPLACE_ME") return;
|
|
const helper = this.addHelper(main);
|
|
path.replaceWith(helper);
|
|
},
|
|
},
|
|
};
|
|
};
|