1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.transform = void 0;
|
---|
7 | exports.transformAsync = transformAsync;
|
---|
8 | exports.transformSync = transformSync;
|
---|
9 | function _gensync() {
|
---|
10 | const data = require("gensync");
|
---|
11 | _gensync = function () {
|
---|
12 | return data;
|
---|
13 | };
|
---|
14 | return data;
|
---|
15 | }
|
---|
16 | var _index = require("./config/index.js");
|
---|
17 | var _index2 = require("./transformation/index.js");
|
---|
18 | var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js");
|
---|
19 | const transformRunner = _gensync()(function* transform(code, opts) {
|
---|
20 | const config = yield* (0, _index.default)(opts);
|
---|
21 | if (config === null) return null;
|
---|
22 | return yield* (0, _index2.run)(config, code);
|
---|
23 | });
|
---|
24 | const transform = exports.transform = function transform(code, optsOrCallback, maybeCallback) {
|
---|
25 | let opts;
|
---|
26 | let callback;
|
---|
27 | if (typeof optsOrCallback === "function") {
|
---|
28 | callback = optsOrCallback;
|
---|
29 | opts = undefined;
|
---|
30 | } else {
|
---|
31 | opts = optsOrCallback;
|
---|
32 | callback = maybeCallback;
|
---|
33 | }
|
---|
34 | if (callback === undefined) {
|
---|
35 | {
|
---|
36 | return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback);
|
---|
40 | };
|
---|
41 | function transformSync(...args) {
|
---|
42 | return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args);
|
---|
43 | }
|
---|
44 | function transformAsync(...args) {
|
---|
45 | return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args);
|
---|
46 | }
|
---|
47 | 0 && 0;
|
---|
48 |
|
---|
49 | //# sourceMappingURL=transform.js.map
|
---|