1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.parse = void 0;
|
7 | exports.parseAsync = parseAsync;
|
8 | exports.parseSync = parseSync;
|
9 | function _gensync() {
|
10 | const data = require("gensync");
|
11 | _gensync = function () {
|
12 | return data;
|
13 | };
|
14 | return data;
|
15 | }
|
16 | var _config = require("./config");
|
17 | var _parser = require("./parser");
|
18 | var _normalizeOpts = require("./transformation/normalize-opts");
|
19 | var _rewriteStackTrace = require("./errors/rewrite-stack-trace");
|
20 | const parseRunner = _gensync()(function* parse(code, opts) {
|
21 | const config = yield* (0, _config.default)(opts);
|
22 | if (config === null) {
|
23 | return null;
|
24 | }
|
25 | return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
26 | });
|
27 | const parse = function parse(code, opts, callback) {
|
28 | if (typeof opts === "function") {
|
29 | callback = opts;
|
30 | opts = undefined;
|
31 | }
|
32 | if (callback === undefined) {
|
33 | {
|
34 | return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts);
|
35 | }
|
36 | }
|
37 | (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback);
|
38 | };
|
39 | exports.parse = parse;
|
40 | function parseSync(...args) {
|
41 | return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args);
|
42 | }
|
43 | function parseAsync(...args) {
|
44 | return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args);
|
45 | }
|
46 | 0 && 0;
|
47 |
|
48 |
|