mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* Run Babel asynchronously in fixtures * Move `checkScopeInfo` to test folder, convert to ESM * Fix Node.js 8 * Avoid dynamic import feature detection
23 lines
610 B
JavaScript
23 lines
610 B
JavaScript
export default () => {
|
|
return {
|
|
visitor: {
|
|
Program: {
|
|
exit(programPath) {
|
|
// so that this plugin is always called after the transform-destructuring plugin
|
|
programPath.traverse({
|
|
VariableDeclarator(path) {
|
|
const names = Object.keys(path.getBindingIdentifiers());
|
|
for (const name of names) {
|
|
const b = path.scope.getBinding(name);
|
|
if (!b) {
|
|
throw new Error(`No binding for ${name}`);
|
|
}
|
|
}
|
|
},
|
|
});
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|