Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 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 = require("gensync");
|
---|
| 10 |
|
---|
| 11 | _gensync = function () {
|
---|
| 12 | return data;
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | return data;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | var _config = require("./config");
|
---|
| 19 |
|
---|
| 20 | var _transformation = require("./transformation");
|
---|
| 21 |
|
---|
| 22 | const transformRunner = _gensync()(function* transform(code, opts) {
|
---|
| 23 | const config = yield* (0, _config.default)(opts);
|
---|
| 24 | if (config === null) return null;
|
---|
| 25 | return yield* (0, _transformation.run)(config, code);
|
---|
| 26 | });
|
---|
| 27 |
|
---|
| 28 | const transform = function transform(code, opts, callback) {
|
---|
| 29 | if (typeof opts === "function") {
|
---|
| 30 | callback = opts;
|
---|
| 31 | opts = undefined;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | if (callback === undefined) return transformRunner.sync(code, opts);
|
---|
| 35 | transformRunner.errback(code, opts, callback);
|
---|
| 36 | };
|
---|
| 37 |
|
---|
| 38 | exports.transform = transform;
|
---|
| 39 | const transformSync = transformRunner.sync;
|
---|
| 40 | exports.transformSync = transformSync;
|
---|
| 41 | const transformAsync = transformRunner.async;
|
---|
| 42 | exports.transformAsync = transformAsync; |
---|
Note:
See
TracBrowser
for help on using the repository browser.