| 1 |
"use strict"; |
| 2 |
|
| 3 |
const babelP = import("./lib/index.js"); |
| 4 |
|
| 5 |
const functionNames = [ |
| 6 |
"createConfigItem", |
| 7 |
"loadPartialConfig", |
| 8 |
"loadOptions", |
| 9 |
"transform", |
| 10 |
"transformFile", |
| 11 |
"transformFromAst", |
| 12 |
"parse", |
| 13 |
]; |
| 14 |
|
| 15 |
for (const name of functionNames) { |
| 16 |
exports[`${name}Sync`] = function () { |
| 17 |
throw new Error( |
| 18 |
`"${name}Sync" is not supported when loading @babel/core using require()` |
| 19 |
); |
| 20 |
}; |
| 21 |
exports[name] = function (...args) { |
| 22 |
babelP.then(babel => { |
| 23 |
babel[name](...args); |
| 24 |
}); |
| 25 |
}; |
| 26 |
exports[`${name}Async`] = function (...args) { |
| 27 |
return babelP.then(babel => babel[`${name}Async`](...args)); |
| 28 |
}; |
| 29 |
} |