Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.parseAsync = exports.parseSync = exports.parse = void 0;
|
---|
7 |
|
---|
8 | function _gensync() {
|
---|
9 | const data = require("gensync");
|
---|
10 |
|
---|
11 | _gensync = function () {
|
---|
12 | return data;
|
---|
13 | };
|
---|
14 |
|
---|
15 | return data;
|
---|
16 | }
|
---|
17 |
|
---|
18 | var _config = require("./config");
|
---|
19 |
|
---|
20 | var _parser = require("./parser");
|
---|
21 |
|
---|
22 | var _normalizeOpts = require("./transformation/normalize-opts");
|
---|
23 |
|
---|
24 | const parseRunner = _gensync()(function* parse(code, opts) {
|
---|
25 | const config = yield* (0, _config.default)(opts);
|
---|
26 |
|
---|
27 | if (config === null) {
|
---|
28 | return null;
|
---|
29 | }
|
---|
30 |
|
---|
31 | return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
---|
32 | });
|
---|
33 |
|
---|
34 | const parse = function parse(code, opts, callback) {
|
---|
35 | if (typeof opts === "function") {
|
---|
36 | callback = opts;
|
---|
37 | opts = undefined;
|
---|
38 | }
|
---|
39 |
|
---|
40 | if (callback === undefined) return parseRunner.sync(code, opts);
|
---|
41 | parseRunner.errback(code, opts, callback);
|
---|
42 | };
|
---|
43 |
|
---|
44 | exports.parse = parse;
|
---|
45 | const parseSync = parseRunner.sync;
|
---|
46 | exports.parseSync = parseSync;
|
---|
47 | const parseAsync = parseRunner.async;
|
---|
48 | exports.parseAsync = parseAsync; |
---|
Note:
See
TracBrowser
for help on using the repository browser.