1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.createConfigItem = createConfigItem;
|
7 | exports.createConfigItemSync = exports.createConfigItemAsync = void 0;
|
8 | Object.defineProperty(exports, "default", {
|
9 | enumerable: true,
|
10 | get: function () {
|
11 | return _full.default;
|
12 | }
|
13 | });
|
14 | exports.loadPartialConfigSync = exports.loadPartialConfigAsync = exports.loadPartialConfig = exports.loadOptionsSync = exports.loadOptionsAsync = exports.loadOptions = void 0;
|
15 |
|
16 | function _gensync() {
|
17 | const data = require("gensync");
|
18 |
|
19 | _gensync = function () {
|
20 | return data;
|
21 | };
|
22 |
|
23 | return data;
|
24 | }
|
25 |
|
26 | var _full = require("./full");
|
27 |
|
28 | var _partial = require("./partial");
|
29 |
|
30 | var _item = require("./item");
|
31 |
|
32 | const loadOptionsRunner = _gensync()(function* (opts) {
|
33 | var _config$options;
|
34 |
|
35 | const config = yield* (0, _full.default)(opts);
|
36 | return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
|
37 | });
|
38 |
|
39 | const createConfigItemRunner = _gensync()(_item.createConfigItem);
|
40 |
|
41 | const maybeErrback = runner => (opts, callback) => {
|
42 | if (callback === undefined && typeof opts === "function") {
|
43 | callback = opts;
|
44 | opts = undefined;
|
45 | }
|
46 |
|
47 | return callback ? runner.errback(opts, callback) : runner.sync(opts);
|
48 | };
|
49 |
|
50 | const loadPartialConfig = maybeErrback(_partial.loadPartialConfig);
|
51 | exports.loadPartialConfig = loadPartialConfig;
|
52 | const loadPartialConfigSync = _partial.loadPartialConfig.sync;
|
53 | exports.loadPartialConfigSync = loadPartialConfigSync;
|
54 | const loadPartialConfigAsync = _partial.loadPartialConfig.async;
|
55 | exports.loadPartialConfigAsync = loadPartialConfigAsync;
|
56 | const loadOptions = maybeErrback(loadOptionsRunner);
|
57 | exports.loadOptions = loadOptions;
|
58 | const loadOptionsSync = loadOptionsRunner.sync;
|
59 | exports.loadOptionsSync = loadOptionsSync;
|
60 | const loadOptionsAsync = loadOptionsRunner.async;
|
61 | exports.loadOptionsAsync = loadOptionsAsync;
|
62 | const createConfigItemSync = createConfigItemRunner.sync;
|
63 | exports.createConfigItemSync = createConfigItemSync;
|
64 | const createConfigItemAsync = createConfigItemRunner.async;
|
65 | exports.createConfigItemAsync = createConfigItemAsync;
|
66 |
|
67 | function createConfigItem(target, options, callback) {
|
68 | if (callback !== undefined) {
|
69 | return createConfigItemRunner.errback(target, options, callback);
|
70 | } else if (typeof options === "function") {
|
71 | return createConfigItemRunner.errback(target, undefined, callback);
|
72 | } else {
|
73 | return createConfigItemRunner.sync(target, options);
|
74 | }
|
75 | } |
\ | No newline at end of file |