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 _index = require("./config/index.js");
|
---|
17 | var _index2 = require("./parser/index.js");
|
---|
18 | var _normalizeOpts = require("./transformation/normalize-opts.js");
|
---|
19 | var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js");
|
---|
20 | const parseRunner = _gensync()(function* parse(code, opts) {
|
---|
21 | const config = yield* (0, _index.default)(opts);
|
---|
22 | if (config === null) {
|
---|
23 | return null;
|
---|
24 | }
|
---|
25 | return yield* (0, _index2.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
---|
26 | });
|
---|
27 | const parse = exports.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 | function parseSync(...args) {
|
---|
40 | return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args);
|
---|
41 | }
|
---|
42 | function parseAsync(...args) {
|
---|
43 | return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args);
|
---|
44 | }
|
---|
45 | 0 && 0;
|
---|
46 |
|
---|
47 | //# sourceMappingURL=parse.js.map
|
---|