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