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