aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/core/lib/transform-ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/core/lib/transform-ast.js')
-rw-r--r--node_modules/@babel/core/lib/transform-ast.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/node_modules/@babel/core/lib/transform-ast.js b/node_modules/@babel/core/lib/transform-ast.js
new file mode 100644
index 00000000..13f18a40
--- /dev/null
+++ b/node_modules/@babel/core/lib/transform-ast.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _config = _interopRequireDefault(require("./config"));
+
+var _transformation = require("./transformation");
+
+var _transformAstSync = _interopRequireDefault(require("./transform-ast-sync"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var transformFromAst = function transformFromAst(ast, code, opts, callback) {
+ if (typeof opts === "function") {
+ opts = undefined;
+ callback = opts;
+ }
+
+ if (callback === undefined) return (0, _transformAstSync.default)(ast, code, opts);
+ const cb = callback;
+ process.nextTick(() => {
+ let cfg;
+
+ try {
+ cfg = (0, _config.default)(opts);
+ if (cfg === null) return cb(null, null);
+ } catch (err) {
+ return cb(err);
+ }
+
+ if (!ast) return cb(new Error("No AST given"));
+ (0, _transformation.runAsync)(cfg, code, ast, cb);
+ });
+};
+
+exports.default = transformFromAst; \ No newline at end of file