1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.transformAsync = exports.transformSync = exports.transform = void 0;
|
7 |
|
8 | var _config = _interopRequireDefault(require("./config"));
|
9 |
|
10 | var _transformation = require("./transformation");
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 | const gensync = require("gensync");
|
15 |
|
16 | const transformRunner = gensync(function* transform(code, opts) {
|
17 | const config = yield* (0, _config.default)(opts);
|
18 | if (config === null) return null;
|
19 | return yield* (0, _transformation.run)(config, code);
|
20 | });
|
21 |
|
22 | const transform = function transform(code, opts, callback) {
|
23 | if (typeof opts === "function") {
|
24 | callback = opts;
|
25 | opts = undefined;
|
26 | }
|
27 |
|
28 | if (callback === undefined) return transformRunner.sync(code, opts);
|
29 | transformRunner.errback(code, opts, callback);
|
30 | };
|
31 |
|
32 | exports.transform = transform;
|
33 | const transformSync = transformRunner.sync;
|
34 | exports.transformSync = transformSync;
|
35 | const transformAsync = transformRunner.async;
|
36 | exports.transformAsync = transformAsync; |
\ | No newline at end of file |