@kubb/core 2.11.1 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4GE2JRAA.cjs → chunk-33S7A7ZE.cjs} +28 -5
- package/dist/chunk-33S7A7ZE.cjs.map +1 -0
- package/dist/{chunk-CH2676BL.js → chunk-4BZD7YTT.js} +2 -2
- package/dist/{chunk-G7EQ47A4.js → chunk-ALE7CO7I.js} +26 -3
- package/dist/chunk-ALE7CO7I.js.map +1 -0
- package/dist/{chunk-WAIHMG76.cjs → chunk-F4TSJHGA.cjs} +3 -3
- package/dist/chunk-FOWWV3PP.js +41 -0
- package/dist/chunk-FOWWV3PP.js.map +1 -0
- package/dist/{chunk-XZZ2F3LK.cjs → chunk-IBUMXAET.cjs} +3 -3
- package/dist/{chunk-WXV3UNEP.js → chunk-IP732R22.js} +1 -29
- package/dist/chunk-IP732R22.js.map +1 -0
- package/dist/chunk-KPXUT3DG.cjs +143 -0
- package/dist/chunk-KPXUT3DG.cjs.map +1 -0
- package/dist/{chunk-UYADU5OY.js → chunk-L2OHRGUS.js} +7 -3
- package/dist/chunk-L2OHRGUS.js.map +1 -0
- package/dist/{chunk-JDIEEDDB.cjs → chunk-OMX2RMAX.cjs} +3 -3
- package/dist/{chunk-TJHTFTXA.cjs → chunk-OVLOS3IJ.cjs} +267 -347
- package/dist/chunk-OVLOS3IJ.cjs.map +1 -0
- package/dist/{chunk-KOQSM5X7.cjs → chunk-VHRZO2NC.cjs} +20 -20
- package/dist/chunk-VHRZO2NC.cjs.map +1 -0
- package/dist/chunk-YYCT7ZB7.cjs +94 -0
- package/dist/chunk-YYCT7ZB7.cjs.map +1 -0
- package/dist/{chunk-H7U5WQ3I.js → chunk-Z5N655B7.js} +20 -20
- package/dist/chunk-Z5N655B7.js.map +1 -0
- package/dist/{chunk-DOELQNBO.cjs → chunk-ZS3YTJ2L.cjs} +3 -133
- package/dist/chunk-ZS3YTJ2L.cjs.map +1 -0
- package/dist/fs.cjs +5 -4
- package/dist/fs.cjs.map +1 -1
- package/dist/fs.js +3 -3
- package/dist/index.cjs +2672 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1981 -52
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +4 -3
- package/dist/logger.js +2 -2
- package/dist/mocks.cjs +6 -10
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.js +1 -6
- package/dist/mocks.js.map +1 -1
- package/dist/transformers.cjs +34 -21
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +4 -2
- package/dist/transformers.d.ts +4 -2
- package/dist/transformers.js +24 -11
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +28 -26
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +29 -27
- package/dist/utils.js.map +1 -1
- package/package.json +4 -3
- package/src/BarrelManager.ts +33 -31
- package/src/FileManager.ts +176 -137
- package/src/PackageManager.ts +4 -4
- package/src/PluginManager.ts +62 -52
- package/src/build.ts +28 -9
- package/src/config.ts +3 -3
- package/src/fs/write.ts +6 -2
- package/src/index.ts +1 -1
- package/src/transformers/casing.ts +11 -5
- package/src/transformers/escape.ts +2 -4
- package/src/transformers/index.ts +3 -2
- package/src/transformers/stringify.ts +19 -3
- package/src/transformers/toNumber.ts +1 -1
- package/src/transformers/toRegExp.ts +1 -5
- package/src/types.ts +67 -71
- package/src/utils/FunctionParams.ts +24 -23
- package/src/utils/TreeNode.ts +15 -4
- package/src/utils/URLPath.ts +2 -6
- package/src/utils/executeStrategies.ts +7 -7
- package/src/utils/index.ts +5 -1
- package/dist/chunk-4GE2JRAA.cjs.map +0 -1
- package/dist/chunk-B7DTFNR4.js +0 -30
- package/dist/chunk-B7DTFNR4.js.map +0 -1
- package/dist/chunk-DOELQNBO.cjs.map +0 -1
- package/dist/chunk-G7EQ47A4.js.map +0 -1
- package/dist/chunk-H7U5WQ3I.js.map +0 -1
- package/dist/chunk-KOQSM5X7.cjs.map +0 -1
- package/dist/chunk-TJHTFTXA.cjs.map +0 -1
- package/dist/chunk-UIWHEBZA.cjs +0 -2549
- package/dist/chunk-UIWHEBZA.cjs.map +0 -1
- package/dist/chunk-UUBXTHJG.cjs +0 -30
- package/dist/chunk-UUBXTHJG.cjs.map +0 -1
- package/dist/chunk-UYADU5OY.js.map +0 -1
- package/dist/chunk-WXV3UNEP.js.map +0 -1
- package/dist/chunk-ZNYG4U5D.js +0 -1888
- package/dist/chunk-ZNYG4U5D.js.map +0 -1
- /package/dist/{chunk-CH2676BL.js.map → chunk-4BZD7YTT.js.map} +0 -0
- /package/dist/{chunk-WAIHMG76.cjs.map → chunk-F4TSJHGA.cjs.map} +0 -0
- /package/dist/{chunk-XZZ2F3LK.cjs.map → chunk-IBUMXAET.cjs.map} +0 -0
- /package/dist/{chunk-JDIEEDDB.cjs.map → chunk-OMX2RMAX.cjs.map} +0 -0
package/dist/chunk-UIWHEBZA.cjs
DELETED
|
@@ -1,2549 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkKOQSM5X7cjs = require('./chunk-KOQSM5X7.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkUUBXTHJGcjs = require('./chunk-UUBXTHJG.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunkDOELQNBOcjs = require('./chunk-DOELQNBO.cjs');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkJDIEEDDBcjs = require('./chunk-JDIEEDDB.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _chunkWAIHMG76cjs = require('./chunk-WAIHMG76.cjs');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _chunkTJHTFTXAcjs = require('./chunk-TJHTFTXA.cjs');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var _chunk4TB6NGOCcjs = require('./chunk-4TB6NGOC.cjs');
|
|
35
|
-
|
|
36
|
-
// ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
|
|
37
|
-
var require_lodash = _chunk4TB6NGOCcjs.__commonJS.call(void 0, {
|
|
38
|
-
"../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js"(exports, module) {
|
|
39
|
-
"use strict";
|
|
40
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
41
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
42
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
43
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
44
|
-
var COMPARE_UNORDERED_FLAG = 2;
|
|
45
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
46
|
-
var argsTag = "[object Arguments]";
|
|
47
|
-
var arrayTag = "[object Array]";
|
|
48
|
-
var asyncTag = "[object AsyncFunction]";
|
|
49
|
-
var boolTag = "[object Boolean]";
|
|
50
|
-
var dateTag = "[object Date]";
|
|
51
|
-
var errorTag = "[object Error]";
|
|
52
|
-
var funcTag = "[object Function]";
|
|
53
|
-
var genTag = "[object GeneratorFunction]";
|
|
54
|
-
var mapTag = "[object Map]";
|
|
55
|
-
var numberTag = "[object Number]";
|
|
56
|
-
var nullTag = "[object Null]";
|
|
57
|
-
var objectTag = "[object Object]";
|
|
58
|
-
var promiseTag = "[object Promise]";
|
|
59
|
-
var proxyTag = "[object Proxy]";
|
|
60
|
-
var regexpTag = "[object RegExp]";
|
|
61
|
-
var setTag = "[object Set]";
|
|
62
|
-
var stringTag = "[object String]";
|
|
63
|
-
var symbolTag = "[object Symbol]";
|
|
64
|
-
var undefinedTag = "[object Undefined]";
|
|
65
|
-
var weakMapTag = "[object WeakMap]";
|
|
66
|
-
var arrayBufferTag = "[object ArrayBuffer]";
|
|
67
|
-
var dataViewTag = "[object DataView]";
|
|
68
|
-
var float32Tag = "[object Float32Array]";
|
|
69
|
-
var float64Tag = "[object Float64Array]";
|
|
70
|
-
var int8Tag = "[object Int8Array]";
|
|
71
|
-
var int16Tag = "[object Int16Array]";
|
|
72
|
-
var int32Tag = "[object Int32Array]";
|
|
73
|
-
var uint8Tag = "[object Uint8Array]";
|
|
74
|
-
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
75
|
-
var uint16Tag = "[object Uint16Array]";
|
|
76
|
-
var uint32Tag = "[object Uint32Array]";
|
|
77
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
78
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
79
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
80
|
-
var typedArrayTags = {};
|
|
81
|
-
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
82
|
-
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
|
83
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
84
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
85
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
86
|
-
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
87
|
-
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
88
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
89
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
90
|
-
var nodeUtil = function() {
|
|
91
|
-
try {
|
|
92
|
-
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
93
|
-
} catch (e) {
|
|
94
|
-
}
|
|
95
|
-
}();
|
|
96
|
-
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
97
|
-
function arrayFilter(array, predicate) {
|
|
98
|
-
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
99
|
-
while (++index < length) {
|
|
100
|
-
var value = array[index];
|
|
101
|
-
if (predicate(value, index, array)) {
|
|
102
|
-
result[resIndex++] = value;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
function arrayPush(array, values) {
|
|
108
|
-
var index = -1, length = values.length, offset = array.length;
|
|
109
|
-
while (++index < length) {
|
|
110
|
-
array[offset + index] = values[index];
|
|
111
|
-
}
|
|
112
|
-
return array;
|
|
113
|
-
}
|
|
114
|
-
function arraySome(array, predicate) {
|
|
115
|
-
var index = -1, length = array == null ? 0 : array.length;
|
|
116
|
-
while (++index < length) {
|
|
117
|
-
if (predicate(array[index], index, array)) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
function baseTimes(n, iteratee) {
|
|
124
|
-
var index = -1, result = Array(n);
|
|
125
|
-
while (++index < n) {
|
|
126
|
-
result[index] = iteratee(index);
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
function baseUnary(func) {
|
|
131
|
-
return function(value) {
|
|
132
|
-
return func(value);
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function cacheHas(cache, key) {
|
|
136
|
-
return cache.has(key);
|
|
137
|
-
}
|
|
138
|
-
function getValue(object, key) {
|
|
139
|
-
return object == null ? void 0 : object[key];
|
|
140
|
-
}
|
|
141
|
-
function mapToArray(map) {
|
|
142
|
-
var index = -1, result = Array(map.size);
|
|
143
|
-
map.forEach(function(value, key) {
|
|
144
|
-
result[++index] = [key, value];
|
|
145
|
-
});
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
function overArg(func, transform) {
|
|
149
|
-
return function(arg) {
|
|
150
|
-
return func(transform(arg));
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function setToArray(set) {
|
|
154
|
-
var index = -1, result = Array(set.size);
|
|
155
|
-
set.forEach(function(value) {
|
|
156
|
-
result[++index] = value;
|
|
157
|
-
});
|
|
158
|
-
return result;
|
|
159
|
-
}
|
|
160
|
-
var arrayProto = Array.prototype;
|
|
161
|
-
var funcProto = Function.prototype;
|
|
162
|
-
var objectProto = Object.prototype;
|
|
163
|
-
var coreJsData = root["__core-js_shared__"];
|
|
164
|
-
var funcToString = funcProto.toString;
|
|
165
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
166
|
-
var maskSrcKey = function() {
|
|
167
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
168
|
-
return uid ? "Symbol(src)_1." + uid : "";
|
|
169
|
-
}();
|
|
170
|
-
var nativeObjectToString = objectProto.toString;
|
|
171
|
-
var reIsNative = RegExp(
|
|
172
|
-
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
173
|
-
);
|
|
174
|
-
var Buffer = moduleExports ? root.Buffer : void 0;
|
|
175
|
-
var Symbol = root.Symbol;
|
|
176
|
-
var Uint8Array = root.Uint8Array;
|
|
177
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
178
|
-
var splice = arrayProto.splice;
|
|
179
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
|
|
180
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
181
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
182
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
183
|
-
var DataView = getNative(root, "DataView");
|
|
184
|
-
var Map2 = getNative(root, "Map");
|
|
185
|
-
var Promise2 = getNative(root, "Promise");
|
|
186
|
-
var Set2 = getNative(root, "Set");
|
|
187
|
-
var WeakMap2 = getNative(root, "WeakMap");
|
|
188
|
-
var nativeCreate = getNative(Object, "create");
|
|
189
|
-
var dataViewCtorString = toSource(DataView);
|
|
190
|
-
var mapCtorString = toSource(Map2);
|
|
191
|
-
var promiseCtorString = toSource(Promise2);
|
|
192
|
-
var setCtorString = toSource(Set2);
|
|
193
|
-
var weakMapCtorString = toSource(WeakMap2);
|
|
194
|
-
var symbolProto = Symbol ? Symbol.prototype : void 0;
|
|
195
|
-
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
196
|
-
function Hash(entries) {
|
|
197
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
198
|
-
this.clear();
|
|
199
|
-
while (++index < length) {
|
|
200
|
-
var entry = entries[index];
|
|
201
|
-
this.set(entry[0], entry[1]);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function hashClear() {
|
|
205
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
206
|
-
this.size = 0;
|
|
207
|
-
}
|
|
208
|
-
function hashDelete(key) {
|
|
209
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
210
|
-
this.size -= result ? 1 : 0;
|
|
211
|
-
return result;
|
|
212
|
-
}
|
|
213
|
-
function hashGet(key) {
|
|
214
|
-
var data = this.__data__;
|
|
215
|
-
if (nativeCreate) {
|
|
216
|
-
var result = data[key];
|
|
217
|
-
return result === HASH_UNDEFINED ? void 0 : result;
|
|
218
|
-
}
|
|
219
|
-
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
|
220
|
-
}
|
|
221
|
-
function hashHas(key) {
|
|
222
|
-
var data = this.__data__;
|
|
223
|
-
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
224
|
-
}
|
|
225
|
-
function hashSet(key, value) {
|
|
226
|
-
var data = this.__data__;
|
|
227
|
-
this.size += this.has(key) ? 0 : 1;
|
|
228
|
-
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
Hash.prototype.clear = hashClear;
|
|
232
|
-
Hash.prototype["delete"] = hashDelete;
|
|
233
|
-
Hash.prototype.get = hashGet;
|
|
234
|
-
Hash.prototype.has = hashHas;
|
|
235
|
-
Hash.prototype.set = hashSet;
|
|
236
|
-
function ListCache(entries) {
|
|
237
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
238
|
-
this.clear();
|
|
239
|
-
while (++index < length) {
|
|
240
|
-
var entry = entries[index];
|
|
241
|
-
this.set(entry[0], entry[1]);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function listCacheClear() {
|
|
245
|
-
this.__data__ = [];
|
|
246
|
-
this.size = 0;
|
|
247
|
-
}
|
|
248
|
-
function listCacheDelete(key) {
|
|
249
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
250
|
-
if (index < 0) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
var lastIndex = data.length - 1;
|
|
254
|
-
if (index == lastIndex) {
|
|
255
|
-
data.pop();
|
|
256
|
-
} else {
|
|
257
|
-
splice.call(data, index, 1);
|
|
258
|
-
}
|
|
259
|
-
--this.size;
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
function listCacheGet(key) {
|
|
263
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
264
|
-
return index < 0 ? void 0 : data[index][1];
|
|
265
|
-
}
|
|
266
|
-
function listCacheHas(key) {
|
|
267
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
268
|
-
}
|
|
269
|
-
function listCacheSet(key, value) {
|
|
270
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
271
|
-
if (index < 0) {
|
|
272
|
-
++this.size;
|
|
273
|
-
data.push([key, value]);
|
|
274
|
-
} else {
|
|
275
|
-
data[index][1] = value;
|
|
276
|
-
}
|
|
277
|
-
return this;
|
|
278
|
-
}
|
|
279
|
-
ListCache.prototype.clear = listCacheClear;
|
|
280
|
-
ListCache.prototype["delete"] = listCacheDelete;
|
|
281
|
-
ListCache.prototype.get = listCacheGet;
|
|
282
|
-
ListCache.prototype.has = listCacheHas;
|
|
283
|
-
ListCache.prototype.set = listCacheSet;
|
|
284
|
-
function MapCache(entries) {
|
|
285
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
286
|
-
this.clear();
|
|
287
|
-
while (++index < length) {
|
|
288
|
-
var entry = entries[index];
|
|
289
|
-
this.set(entry[0], entry[1]);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function mapCacheClear() {
|
|
293
|
-
this.size = 0;
|
|
294
|
-
this.__data__ = {
|
|
295
|
-
"hash": new Hash(),
|
|
296
|
-
"map": new (Map2 || ListCache)(),
|
|
297
|
-
"string": new Hash()
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
function mapCacheDelete(key) {
|
|
301
|
-
var result = getMapData(this, key)["delete"](key);
|
|
302
|
-
this.size -= result ? 1 : 0;
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
function mapCacheGet(key) {
|
|
306
|
-
return getMapData(this, key).get(key);
|
|
307
|
-
}
|
|
308
|
-
function mapCacheHas(key) {
|
|
309
|
-
return getMapData(this, key).has(key);
|
|
310
|
-
}
|
|
311
|
-
function mapCacheSet(key, value) {
|
|
312
|
-
var data = getMapData(this, key), size = data.size;
|
|
313
|
-
data.set(key, value);
|
|
314
|
-
this.size += data.size == size ? 0 : 1;
|
|
315
|
-
return this;
|
|
316
|
-
}
|
|
317
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
318
|
-
MapCache.prototype["delete"] = mapCacheDelete;
|
|
319
|
-
MapCache.prototype.get = mapCacheGet;
|
|
320
|
-
MapCache.prototype.has = mapCacheHas;
|
|
321
|
-
MapCache.prototype.set = mapCacheSet;
|
|
322
|
-
function SetCache(values) {
|
|
323
|
-
var index = -1, length = values == null ? 0 : values.length;
|
|
324
|
-
this.__data__ = new MapCache();
|
|
325
|
-
while (++index < length) {
|
|
326
|
-
this.add(values[index]);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function setCacheAdd(value) {
|
|
330
|
-
this.__data__.set(value, HASH_UNDEFINED);
|
|
331
|
-
return this;
|
|
332
|
-
}
|
|
333
|
-
function setCacheHas(value) {
|
|
334
|
-
return this.__data__.has(value);
|
|
335
|
-
}
|
|
336
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
337
|
-
SetCache.prototype.has = setCacheHas;
|
|
338
|
-
function Stack(entries) {
|
|
339
|
-
var data = this.__data__ = new ListCache(entries);
|
|
340
|
-
this.size = data.size;
|
|
341
|
-
}
|
|
342
|
-
function stackClear() {
|
|
343
|
-
this.__data__ = new ListCache();
|
|
344
|
-
this.size = 0;
|
|
345
|
-
}
|
|
346
|
-
function stackDelete(key) {
|
|
347
|
-
var data = this.__data__, result = data["delete"](key);
|
|
348
|
-
this.size = data.size;
|
|
349
|
-
return result;
|
|
350
|
-
}
|
|
351
|
-
function stackGet(key) {
|
|
352
|
-
return this.__data__.get(key);
|
|
353
|
-
}
|
|
354
|
-
function stackHas(key) {
|
|
355
|
-
return this.__data__.has(key);
|
|
356
|
-
}
|
|
357
|
-
function stackSet(key, value) {
|
|
358
|
-
var data = this.__data__;
|
|
359
|
-
if (data instanceof ListCache) {
|
|
360
|
-
var pairs = data.__data__;
|
|
361
|
-
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
362
|
-
pairs.push([key, value]);
|
|
363
|
-
this.size = ++data.size;
|
|
364
|
-
return this;
|
|
365
|
-
}
|
|
366
|
-
data = this.__data__ = new MapCache(pairs);
|
|
367
|
-
}
|
|
368
|
-
data.set(key, value);
|
|
369
|
-
this.size = data.size;
|
|
370
|
-
return this;
|
|
371
|
-
}
|
|
372
|
-
Stack.prototype.clear = stackClear;
|
|
373
|
-
Stack.prototype["delete"] = stackDelete;
|
|
374
|
-
Stack.prototype.get = stackGet;
|
|
375
|
-
Stack.prototype.has = stackHas;
|
|
376
|
-
Stack.prototype.set = stackSet;
|
|
377
|
-
function arrayLikeKeys(value, inherited) {
|
|
378
|
-
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
379
|
-
for (var key in value) {
|
|
380
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
381
|
-
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
382
|
-
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
383
|
-
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
384
|
-
isIndex(key, length)))) {
|
|
385
|
-
result.push(key);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return result;
|
|
389
|
-
}
|
|
390
|
-
function assocIndexOf(array, key) {
|
|
391
|
-
var length = array.length;
|
|
392
|
-
while (length--) {
|
|
393
|
-
if (eq(array[length][0], key)) {
|
|
394
|
-
return length;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return -1;
|
|
398
|
-
}
|
|
399
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
400
|
-
var result = keysFunc(object);
|
|
401
|
-
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
402
|
-
}
|
|
403
|
-
function baseGetTag(value) {
|
|
404
|
-
if (value == null) {
|
|
405
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
406
|
-
}
|
|
407
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
408
|
-
}
|
|
409
|
-
function baseIsArguments(value) {
|
|
410
|
-
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
411
|
-
}
|
|
412
|
-
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
413
|
-
if (value === other) {
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
417
|
-
return value !== value && other !== other;
|
|
418
|
-
}
|
|
419
|
-
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
420
|
-
}
|
|
421
|
-
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
422
|
-
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
423
|
-
objTag = objTag == argsTag ? objectTag : objTag;
|
|
424
|
-
othTag = othTag == argsTag ? objectTag : othTag;
|
|
425
|
-
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
426
|
-
if (isSameTag && isBuffer(object)) {
|
|
427
|
-
if (!isBuffer(other)) {
|
|
428
|
-
return false;
|
|
429
|
-
}
|
|
430
|
-
objIsArr = true;
|
|
431
|
-
objIsObj = false;
|
|
432
|
-
}
|
|
433
|
-
if (isSameTag && !objIsObj) {
|
|
434
|
-
stack || (stack = new Stack());
|
|
435
|
-
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
436
|
-
}
|
|
437
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
438
|
-
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
439
|
-
if (objIsWrapped || othIsWrapped) {
|
|
440
|
-
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
441
|
-
stack || (stack = new Stack());
|
|
442
|
-
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (!isSameTag) {
|
|
446
|
-
return false;
|
|
447
|
-
}
|
|
448
|
-
stack || (stack = new Stack());
|
|
449
|
-
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
450
|
-
}
|
|
451
|
-
function baseIsNative(value) {
|
|
452
|
-
if (!isObject(value) || isMasked(value)) {
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
456
|
-
return pattern.test(toSource(value));
|
|
457
|
-
}
|
|
458
|
-
function baseIsTypedArray(value) {
|
|
459
|
-
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
460
|
-
}
|
|
461
|
-
function baseKeys(object) {
|
|
462
|
-
if (!isPrototype(object)) {
|
|
463
|
-
return nativeKeys(object);
|
|
464
|
-
}
|
|
465
|
-
var result = [];
|
|
466
|
-
for (var key in Object(object)) {
|
|
467
|
-
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
468
|
-
result.push(key);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return result;
|
|
472
|
-
}
|
|
473
|
-
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
474
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
|
|
475
|
-
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
|
-
var stacked = stack.get(array);
|
|
479
|
-
if (stacked && stack.get(other)) {
|
|
480
|
-
return stacked == other;
|
|
481
|
-
}
|
|
482
|
-
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
|
|
483
|
-
stack.set(array, other);
|
|
484
|
-
stack.set(other, array);
|
|
485
|
-
while (++index < arrLength) {
|
|
486
|
-
var arrValue = array[index], othValue = other[index];
|
|
487
|
-
if (customizer) {
|
|
488
|
-
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
489
|
-
}
|
|
490
|
-
if (compared !== void 0) {
|
|
491
|
-
if (compared) {
|
|
492
|
-
continue;
|
|
493
|
-
}
|
|
494
|
-
result = false;
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
if (seen) {
|
|
498
|
-
if (!arraySome(other, function(othValue2, othIndex) {
|
|
499
|
-
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
500
|
-
return seen.push(othIndex);
|
|
501
|
-
}
|
|
502
|
-
})) {
|
|
503
|
-
result = false;
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
507
|
-
result = false;
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
stack["delete"](array);
|
|
512
|
-
stack["delete"](other);
|
|
513
|
-
return result;
|
|
514
|
-
}
|
|
515
|
-
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
516
|
-
switch (tag) {
|
|
517
|
-
case dataViewTag:
|
|
518
|
-
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
519
|
-
return false;
|
|
520
|
-
}
|
|
521
|
-
object = object.buffer;
|
|
522
|
-
other = other.buffer;
|
|
523
|
-
case arrayBufferTag:
|
|
524
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
return true;
|
|
528
|
-
case boolTag:
|
|
529
|
-
case dateTag:
|
|
530
|
-
case numberTag:
|
|
531
|
-
return eq(+object, +other);
|
|
532
|
-
case errorTag:
|
|
533
|
-
return object.name == other.name && object.message == other.message;
|
|
534
|
-
case regexpTag:
|
|
535
|
-
case stringTag:
|
|
536
|
-
return object == other + "";
|
|
537
|
-
case mapTag:
|
|
538
|
-
var convert = mapToArray;
|
|
539
|
-
case setTag:
|
|
540
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
541
|
-
convert || (convert = setToArray);
|
|
542
|
-
if (object.size != other.size && !isPartial) {
|
|
543
|
-
return false;
|
|
544
|
-
}
|
|
545
|
-
var stacked = stack.get(object);
|
|
546
|
-
if (stacked) {
|
|
547
|
-
return stacked == other;
|
|
548
|
-
}
|
|
549
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
550
|
-
stack.set(object, other);
|
|
551
|
-
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
552
|
-
stack["delete"](object);
|
|
553
|
-
return result;
|
|
554
|
-
case symbolTag:
|
|
555
|
-
if (symbolValueOf) {
|
|
556
|
-
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
return false;
|
|
560
|
-
}
|
|
561
|
-
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
562
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
563
|
-
if (objLength != othLength && !isPartial) {
|
|
564
|
-
return false;
|
|
565
|
-
}
|
|
566
|
-
var index = objLength;
|
|
567
|
-
while (index--) {
|
|
568
|
-
var key = objProps[index];
|
|
569
|
-
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
570
|
-
return false;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
var stacked = stack.get(object);
|
|
574
|
-
if (stacked && stack.get(other)) {
|
|
575
|
-
return stacked == other;
|
|
576
|
-
}
|
|
577
|
-
var result = true;
|
|
578
|
-
stack.set(object, other);
|
|
579
|
-
stack.set(other, object);
|
|
580
|
-
var skipCtor = isPartial;
|
|
581
|
-
while (++index < objLength) {
|
|
582
|
-
key = objProps[index];
|
|
583
|
-
var objValue = object[key], othValue = other[key];
|
|
584
|
-
if (customizer) {
|
|
585
|
-
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
586
|
-
}
|
|
587
|
-
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
588
|
-
result = false;
|
|
589
|
-
break;
|
|
590
|
-
}
|
|
591
|
-
skipCtor || (skipCtor = key == "constructor");
|
|
592
|
-
}
|
|
593
|
-
if (result && !skipCtor) {
|
|
594
|
-
var objCtor = object.constructor, othCtor = other.constructor;
|
|
595
|
-
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
596
|
-
result = false;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
stack["delete"](object);
|
|
600
|
-
stack["delete"](other);
|
|
601
|
-
return result;
|
|
602
|
-
}
|
|
603
|
-
function getAllKeys(object) {
|
|
604
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
605
|
-
}
|
|
606
|
-
function getMapData(map, key) {
|
|
607
|
-
var data = map.__data__;
|
|
608
|
-
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
609
|
-
}
|
|
610
|
-
function getNative(object, key) {
|
|
611
|
-
var value = getValue(object, key);
|
|
612
|
-
return baseIsNative(value) ? value : void 0;
|
|
613
|
-
}
|
|
614
|
-
function getRawTag(value) {
|
|
615
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
616
|
-
try {
|
|
617
|
-
value[symToStringTag] = void 0;
|
|
618
|
-
var unmasked = true;
|
|
619
|
-
} catch (e) {
|
|
620
|
-
}
|
|
621
|
-
var result = nativeObjectToString.call(value);
|
|
622
|
-
if (unmasked) {
|
|
623
|
-
if (isOwn) {
|
|
624
|
-
value[symToStringTag] = tag;
|
|
625
|
-
} else {
|
|
626
|
-
delete value[symToStringTag];
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
return result;
|
|
630
|
-
}
|
|
631
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
632
|
-
if (object == null) {
|
|
633
|
-
return [];
|
|
634
|
-
}
|
|
635
|
-
object = Object(object);
|
|
636
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
637
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
638
|
-
});
|
|
639
|
-
};
|
|
640
|
-
var getTag = baseGetTag;
|
|
641
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
|
|
642
|
-
getTag = function(value) {
|
|
643
|
-
var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
644
|
-
if (ctorString) {
|
|
645
|
-
switch (ctorString) {
|
|
646
|
-
case dataViewCtorString:
|
|
647
|
-
return dataViewTag;
|
|
648
|
-
case mapCtorString:
|
|
649
|
-
return mapTag;
|
|
650
|
-
case promiseCtorString:
|
|
651
|
-
return promiseTag;
|
|
652
|
-
case setCtorString:
|
|
653
|
-
return setTag;
|
|
654
|
-
case weakMapCtorString:
|
|
655
|
-
return weakMapTag;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return result;
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
function isIndex(value, length) {
|
|
662
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
663
|
-
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
664
|
-
}
|
|
665
|
-
function isKeyable(value) {
|
|
666
|
-
var type = typeof value;
|
|
667
|
-
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
668
|
-
}
|
|
669
|
-
function isMasked(func) {
|
|
670
|
-
return !!maskSrcKey && maskSrcKey in func;
|
|
671
|
-
}
|
|
672
|
-
function isPrototype(value) {
|
|
673
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
674
|
-
return value === proto;
|
|
675
|
-
}
|
|
676
|
-
function objectToString(value) {
|
|
677
|
-
return nativeObjectToString.call(value);
|
|
678
|
-
}
|
|
679
|
-
function toSource(func) {
|
|
680
|
-
if (func != null) {
|
|
681
|
-
try {
|
|
682
|
-
return funcToString.call(func);
|
|
683
|
-
} catch (e) {
|
|
684
|
-
}
|
|
685
|
-
try {
|
|
686
|
-
return func + "";
|
|
687
|
-
} catch (e) {
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return "";
|
|
691
|
-
}
|
|
692
|
-
function eq(value, other) {
|
|
693
|
-
return value === other || value !== value && other !== other;
|
|
694
|
-
}
|
|
695
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
696
|
-
return arguments;
|
|
697
|
-
}()) ? baseIsArguments : function(value) {
|
|
698
|
-
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
699
|
-
};
|
|
700
|
-
var isArray = Array.isArray;
|
|
701
|
-
function isArrayLike(value) {
|
|
702
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
703
|
-
}
|
|
704
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
705
|
-
function isEqual2(value, other) {
|
|
706
|
-
return baseIsEqual(value, other);
|
|
707
|
-
}
|
|
708
|
-
function isFunction(value) {
|
|
709
|
-
if (!isObject(value)) {
|
|
710
|
-
return false;
|
|
711
|
-
}
|
|
712
|
-
var tag = baseGetTag(value);
|
|
713
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
714
|
-
}
|
|
715
|
-
function isLength(value) {
|
|
716
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
717
|
-
}
|
|
718
|
-
function isObject(value) {
|
|
719
|
-
var type = typeof value;
|
|
720
|
-
return value != null && (type == "object" || type == "function");
|
|
721
|
-
}
|
|
722
|
-
function isObjectLike(value) {
|
|
723
|
-
return value != null && typeof value == "object";
|
|
724
|
-
}
|
|
725
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
726
|
-
function keys(object) {
|
|
727
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
728
|
-
}
|
|
729
|
-
function stubArray() {
|
|
730
|
-
return [];
|
|
731
|
-
}
|
|
732
|
-
function stubFalse() {
|
|
733
|
-
return false;
|
|
734
|
-
}
|
|
735
|
-
module.exports = isEqual2;
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
740
|
-
var require_eventemitter3 = _chunk4TB6NGOCcjs.__commonJS.call(void 0, {
|
|
741
|
-
"../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
|
|
742
|
-
"use strict";
|
|
743
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
744
|
-
var has = Object.prototype.hasOwnProperty;
|
|
745
|
-
var prefix = "~";
|
|
746
|
-
function Events() {
|
|
747
|
-
}
|
|
748
|
-
if (Object.create) {
|
|
749
|
-
Events.prototype = /* @__PURE__ */ Object.create(null);
|
|
750
|
-
if (!new Events().__proto__)
|
|
751
|
-
prefix = false;
|
|
752
|
-
}
|
|
753
|
-
function EE(fn, context, once) {
|
|
754
|
-
this.fn = fn;
|
|
755
|
-
this.context = context;
|
|
756
|
-
this.once = once || false;
|
|
757
|
-
}
|
|
758
|
-
function addListener(emitter, event, fn, context, once) {
|
|
759
|
-
if (typeof fn !== "function") {
|
|
760
|
-
throw new TypeError("The listener must be a function");
|
|
761
|
-
}
|
|
762
|
-
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
763
|
-
if (!emitter._events[evt])
|
|
764
|
-
emitter._events[evt] = listener, emitter._eventsCount++;
|
|
765
|
-
else if (!emitter._events[evt].fn)
|
|
766
|
-
emitter._events[evt].push(listener);
|
|
767
|
-
else
|
|
768
|
-
emitter._events[evt] = [emitter._events[evt], listener];
|
|
769
|
-
return emitter;
|
|
770
|
-
}
|
|
771
|
-
function clearEvent(emitter, evt) {
|
|
772
|
-
if (--emitter._eventsCount === 0)
|
|
773
|
-
emitter._events = new Events();
|
|
774
|
-
else
|
|
775
|
-
delete emitter._events[evt];
|
|
776
|
-
}
|
|
777
|
-
function EventEmitter3() {
|
|
778
|
-
this._events = new Events();
|
|
779
|
-
this._eventsCount = 0;
|
|
780
|
-
}
|
|
781
|
-
EventEmitter3.prototype.eventNames = function eventNames() {
|
|
782
|
-
var names = [], events, name;
|
|
783
|
-
if (this._eventsCount === 0)
|
|
784
|
-
return names;
|
|
785
|
-
for (name in events = this._events) {
|
|
786
|
-
if (has.call(events, name))
|
|
787
|
-
names.push(prefix ? name.slice(1) : name);
|
|
788
|
-
}
|
|
789
|
-
if (Object.getOwnPropertySymbols) {
|
|
790
|
-
return names.concat(Object.getOwnPropertySymbols(events));
|
|
791
|
-
}
|
|
792
|
-
return names;
|
|
793
|
-
};
|
|
794
|
-
EventEmitter3.prototype.listeners = function listeners(event) {
|
|
795
|
-
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
796
|
-
if (!handlers)
|
|
797
|
-
return [];
|
|
798
|
-
if (handlers.fn)
|
|
799
|
-
return [handlers.fn];
|
|
800
|
-
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
801
|
-
ee[i] = handlers[i].fn;
|
|
802
|
-
}
|
|
803
|
-
return ee;
|
|
804
|
-
};
|
|
805
|
-
EventEmitter3.prototype.listenerCount = function listenerCount(event) {
|
|
806
|
-
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
807
|
-
if (!listeners)
|
|
808
|
-
return 0;
|
|
809
|
-
if (listeners.fn)
|
|
810
|
-
return 1;
|
|
811
|
-
return listeners.length;
|
|
812
|
-
};
|
|
813
|
-
EventEmitter3.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
814
|
-
var evt = prefix ? prefix + event : event;
|
|
815
|
-
if (!this._events[evt])
|
|
816
|
-
return false;
|
|
817
|
-
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
818
|
-
if (listeners.fn) {
|
|
819
|
-
if (listeners.once)
|
|
820
|
-
this.removeListener(event, listeners.fn, void 0, true);
|
|
821
|
-
switch (len) {
|
|
822
|
-
case 1:
|
|
823
|
-
return listeners.fn.call(listeners.context), true;
|
|
824
|
-
case 2:
|
|
825
|
-
return listeners.fn.call(listeners.context, a1), true;
|
|
826
|
-
case 3:
|
|
827
|
-
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
828
|
-
case 4:
|
|
829
|
-
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
830
|
-
case 5:
|
|
831
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
832
|
-
case 6:
|
|
833
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
834
|
-
}
|
|
835
|
-
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
836
|
-
args[i - 1] = arguments[i];
|
|
837
|
-
}
|
|
838
|
-
listeners.fn.apply(listeners.context, args);
|
|
839
|
-
} else {
|
|
840
|
-
var length = listeners.length, j;
|
|
841
|
-
for (i = 0; i < length; i++) {
|
|
842
|
-
if (listeners[i].once)
|
|
843
|
-
this.removeListener(event, listeners[i].fn, void 0, true);
|
|
844
|
-
switch (len) {
|
|
845
|
-
case 1:
|
|
846
|
-
listeners[i].fn.call(listeners[i].context);
|
|
847
|
-
break;
|
|
848
|
-
case 2:
|
|
849
|
-
listeners[i].fn.call(listeners[i].context, a1);
|
|
850
|
-
break;
|
|
851
|
-
case 3:
|
|
852
|
-
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
853
|
-
break;
|
|
854
|
-
case 4:
|
|
855
|
-
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
856
|
-
break;
|
|
857
|
-
default:
|
|
858
|
-
if (!args)
|
|
859
|
-
for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
860
|
-
args[j - 1] = arguments[j];
|
|
861
|
-
}
|
|
862
|
-
listeners[i].fn.apply(listeners[i].context, args);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return true;
|
|
867
|
-
};
|
|
868
|
-
EventEmitter3.prototype.on = function on(event, fn, context) {
|
|
869
|
-
return addListener(this, event, fn, context, false);
|
|
870
|
-
};
|
|
871
|
-
EventEmitter3.prototype.once = function once(event, fn, context) {
|
|
872
|
-
return addListener(this, event, fn, context, true);
|
|
873
|
-
};
|
|
874
|
-
EventEmitter3.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
875
|
-
var evt = prefix ? prefix + event : event;
|
|
876
|
-
if (!this._events[evt])
|
|
877
|
-
return this;
|
|
878
|
-
if (!fn) {
|
|
879
|
-
clearEvent(this, evt);
|
|
880
|
-
return this;
|
|
881
|
-
}
|
|
882
|
-
var listeners = this._events[evt];
|
|
883
|
-
if (listeners.fn) {
|
|
884
|
-
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
885
|
-
clearEvent(this, evt);
|
|
886
|
-
}
|
|
887
|
-
} else {
|
|
888
|
-
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
889
|
-
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
890
|
-
events.push(listeners[i]);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
if (events.length)
|
|
894
|
-
this._events[evt] = events.length === 1 ? events[0] : events;
|
|
895
|
-
else
|
|
896
|
-
clearEvent(this, evt);
|
|
897
|
-
}
|
|
898
|
-
return this;
|
|
899
|
-
};
|
|
900
|
-
EventEmitter3.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
901
|
-
var evt;
|
|
902
|
-
if (event) {
|
|
903
|
-
evt = prefix ? prefix + event : event;
|
|
904
|
-
if (this._events[evt])
|
|
905
|
-
clearEvent(this, evt);
|
|
906
|
-
} else {
|
|
907
|
-
this._events = new Events();
|
|
908
|
-
this._eventsCount = 0;
|
|
909
|
-
}
|
|
910
|
-
return this;
|
|
911
|
-
};
|
|
912
|
-
EventEmitter3.prototype.off = EventEmitter3.prototype.removeListener;
|
|
913
|
-
EventEmitter3.prototype.addListener = EventEmitter3.prototype.on;
|
|
914
|
-
EventEmitter3.prefixed = prefix;
|
|
915
|
-
EventEmitter3.EventEmitter = EventEmitter3;
|
|
916
|
-
if ("undefined" !== typeof module) {
|
|
917
|
-
module.exports = EventEmitter3;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
// src/FileManager.ts
|
|
923
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
924
|
-
var import_lodash = _chunk4TB6NGOCcjs.__toESM.call(void 0, require_lodash(), 1);
|
|
925
|
-
var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
|
|
926
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
927
|
-
var _parser = require('@kubb/parser');
|
|
928
|
-
var _factory = require('@kubb/parser/factory'); var factory = _interopRequireWildcard(_factory);
|
|
929
|
-
|
|
930
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
|
931
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
932
|
-
|
|
933
|
-
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
|
934
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
935
|
-
var import_index = _chunk4TB6NGOCcjs.__toESM.call(void 0, require_eventemitter3(), 1);
|
|
936
|
-
|
|
937
|
-
// ../../node_modules/.pnpm/p-timeout@6.1.2/node_modules/p-timeout/index.js
|
|
938
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
939
|
-
var TimeoutError = class extends Error {
|
|
940
|
-
constructor(message) {
|
|
941
|
-
super(message);
|
|
942
|
-
this.name = "TimeoutError";
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
var AbortError = class extends Error {
|
|
946
|
-
constructor(message) {
|
|
947
|
-
super();
|
|
948
|
-
this.name = "AbortError";
|
|
949
|
-
this.message = message;
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new AbortError(errorMessage) : new DOMException(errorMessage);
|
|
953
|
-
var getAbortedReason = (signal) => {
|
|
954
|
-
const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
|
|
955
|
-
return reason instanceof Error ? reason : getDOMException(reason);
|
|
956
|
-
};
|
|
957
|
-
function pTimeout(promise, options) {
|
|
958
|
-
const {
|
|
959
|
-
milliseconds,
|
|
960
|
-
fallback,
|
|
961
|
-
message,
|
|
962
|
-
customTimers = { setTimeout, clearTimeout }
|
|
963
|
-
} = options;
|
|
964
|
-
let timer;
|
|
965
|
-
const wrappedPromise = new Promise((resolve2, reject) => {
|
|
966
|
-
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
967
|
-
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
968
|
-
}
|
|
969
|
-
if (options.signal) {
|
|
970
|
-
const { signal } = options;
|
|
971
|
-
if (signal.aborted) {
|
|
972
|
-
reject(getAbortedReason(signal));
|
|
973
|
-
}
|
|
974
|
-
signal.addEventListener("abort", () => {
|
|
975
|
-
reject(getAbortedReason(signal));
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
979
|
-
promise.then(resolve2, reject);
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
const timeoutError = new TimeoutError();
|
|
983
|
-
timer = customTimers.setTimeout.call(void 0, () => {
|
|
984
|
-
if (fallback) {
|
|
985
|
-
try {
|
|
986
|
-
resolve2(fallback());
|
|
987
|
-
} catch (error) {
|
|
988
|
-
reject(error);
|
|
989
|
-
}
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
if (typeof promise.cancel === "function") {
|
|
993
|
-
promise.cancel();
|
|
994
|
-
}
|
|
995
|
-
if (message === false) {
|
|
996
|
-
resolve2();
|
|
997
|
-
} else if (message instanceof Error) {
|
|
998
|
-
reject(message);
|
|
999
|
-
} else {
|
|
1000
|
-
timeoutError.message = _nullishCoalesce(message, () => ( `Promise timed out after ${milliseconds} milliseconds`));
|
|
1001
|
-
reject(timeoutError);
|
|
1002
|
-
}
|
|
1003
|
-
}, milliseconds);
|
|
1004
|
-
(async () => {
|
|
1005
|
-
try {
|
|
1006
|
-
resolve2(await promise);
|
|
1007
|
-
} catch (error) {
|
|
1008
|
-
reject(error);
|
|
1009
|
-
}
|
|
1010
|
-
})();
|
|
1011
|
-
});
|
|
1012
|
-
const cancelablePromise = wrappedPromise.finally(() => {
|
|
1013
|
-
cancelablePromise.clear();
|
|
1014
|
-
});
|
|
1015
|
-
cancelablePromise.clear = () => {
|
|
1016
|
-
customTimers.clearTimeout.call(void 0, timer);
|
|
1017
|
-
timer = void 0;
|
|
1018
|
-
};
|
|
1019
|
-
return cancelablePromise;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
|
|
1023
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1024
|
-
|
|
1025
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/lower-bound.js
|
|
1026
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1027
|
-
function lowerBound(array, value, comparator) {
|
|
1028
|
-
let first = 0;
|
|
1029
|
-
let count = array.length;
|
|
1030
|
-
while (count > 0) {
|
|
1031
|
-
const step = Math.trunc(count / 2);
|
|
1032
|
-
let it = first + step;
|
|
1033
|
-
if (comparator(array[it], value) <= 0) {
|
|
1034
|
-
first = ++it;
|
|
1035
|
-
count -= step + 1;
|
|
1036
|
-
} else {
|
|
1037
|
-
count = step;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
return first;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
|
|
1044
|
-
var _queue;
|
|
1045
|
-
var PriorityQueue = class {
|
|
1046
|
-
constructor() {
|
|
1047
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue, []);
|
|
1048
|
-
}
|
|
1049
|
-
enqueue(run, options) {
|
|
1050
|
-
options = {
|
|
1051
|
-
priority: 0,
|
|
1052
|
-
...options
|
|
1053
|
-
};
|
|
1054
|
-
const element = {
|
|
1055
|
-
priority: options.priority,
|
|
1056
|
-
run
|
|
1057
|
-
};
|
|
1058
|
-
if (this.size && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue)[this.size - 1].priority >= options.priority) {
|
|
1059
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).push(element);
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
const index = lowerBound(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue), element, (a, b) => b.priority - a.priority);
|
|
1063
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).splice(index, 0, element);
|
|
1064
|
-
}
|
|
1065
|
-
dequeue() {
|
|
1066
|
-
const item = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).shift();
|
|
1067
|
-
return _optionalChain([item, 'optionalAccess', _2 => _2.run]);
|
|
1068
|
-
}
|
|
1069
|
-
filter(options) {
|
|
1070
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
1071
|
-
}
|
|
1072
|
-
get size() {
|
|
1073
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).length;
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
_queue = new WeakMap();
|
|
1077
|
-
|
|
1078
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
|
1079
|
-
var _carryoverConcurrencyCount, _isIntervalIgnored, _intervalCount, _intervalCap, _interval, _intervalEnd, _intervalId, _timeoutId, _queue2, _queueClass, _pending, _concurrency, _isPaused, _throwOnTimeout, _doesIntervalAllowAnother, doesIntervalAllowAnother_get, _doesConcurrentAllowAnother, doesConcurrentAllowAnother_get, _next, next_fn, _onResumeInterval, onResumeInterval_fn, _isIntervalPaused, isIntervalPaused_get, _tryToStartAnother, tryToStartAnother_fn, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn, _onInterval, onInterval_fn, _processQueue, processQueue_fn, _throwOnAbort, throwOnAbort_fn, _onEvent, onEvent_fn;
|
|
1080
|
-
var PQueue = class extends import_index.default {
|
|
1081
|
-
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
1082
|
-
constructor(options) {
|
|
1083
|
-
super();
|
|
1084
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _doesIntervalAllowAnother);
|
|
1085
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _doesConcurrentAllowAnother);
|
|
1086
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _next);
|
|
1087
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onResumeInterval);
|
|
1088
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isIntervalPaused);
|
|
1089
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _tryToStartAnother);
|
|
1090
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _initializeIntervalIfNeeded);
|
|
1091
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onInterval);
|
|
1092
|
-
/**
|
|
1093
|
-
Executes all queued functions until it reaches the limit.
|
|
1094
|
-
*/
|
|
1095
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _processQueue);
|
|
1096
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _throwOnAbort);
|
|
1097
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onEvent);
|
|
1098
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _carryoverConcurrencyCount, void 0);
|
|
1099
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isIntervalIgnored, void 0);
|
|
1100
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalCount, 0);
|
|
1101
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalCap, void 0);
|
|
1102
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _interval, void 0);
|
|
1103
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalEnd, 0);
|
|
1104
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalId, void 0);
|
|
1105
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _timeoutId, void 0);
|
|
1106
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue2, void 0);
|
|
1107
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queueClass, void 0);
|
|
1108
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _pending, 0);
|
|
1109
|
-
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
1110
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _concurrency, void 0);
|
|
1111
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isPaused, void 0);
|
|
1112
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _throwOnTimeout, void 0);
|
|
1113
|
-
/**
|
|
1114
|
-
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
1115
|
-
|
|
1116
|
-
Applies to each future operation.
|
|
1117
|
-
*/
|
|
1118
|
-
_chunk4TB6NGOCcjs.__publicField.call(void 0, this, "timeout");
|
|
1119
|
-
options = {
|
|
1120
|
-
carryoverConcurrencyCount: false,
|
|
1121
|
-
intervalCap: Number.POSITIVE_INFINITY,
|
|
1122
|
-
interval: 0,
|
|
1123
|
-
concurrency: Number.POSITIVE_INFINITY,
|
|
1124
|
-
autoStart: true,
|
|
1125
|
-
queueClass: PriorityQueue,
|
|
1126
|
-
...options
|
|
1127
|
-
};
|
|
1128
|
-
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
1129
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _3 => _3.intervalCap, 'optionalAccess', _4 => _4.toString, 'call', _5 => _5()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
1130
|
-
}
|
|
1131
|
-
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
1132
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _6 => _6.interval, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
1133
|
-
}
|
|
1134
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _carryoverConcurrencyCount, options.carryoverConcurrencyCount);
|
|
1135
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0);
|
|
1136
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCap, options.intervalCap);
|
|
1137
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _interval, options.interval);
|
|
1138
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue2, new options.queueClass());
|
|
1139
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queueClass, options.queueClass);
|
|
1140
|
-
this.concurrency = options.concurrency;
|
|
1141
|
-
this.timeout = options.timeout;
|
|
1142
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _throwOnTimeout, options.throwOnTimeout === true);
|
|
1143
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, options.autoStart === false);
|
|
1144
|
-
}
|
|
1145
|
-
get concurrency() {
|
|
1146
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _concurrency);
|
|
1147
|
-
}
|
|
1148
|
-
set concurrency(newConcurrency) {
|
|
1149
|
-
if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
|
|
1150
|
-
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
|
|
1151
|
-
}
|
|
1152
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _concurrency, newConcurrency);
|
|
1153
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
|
|
1154
|
-
}
|
|
1155
|
-
async add(function_, options = {}) {
|
|
1156
|
-
options = {
|
|
1157
|
-
timeout: this.timeout,
|
|
1158
|
-
throwOnTimeout: _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _throwOnTimeout),
|
|
1159
|
-
...options
|
|
1160
|
-
};
|
|
1161
|
-
return new Promise((resolve2, reject) => {
|
|
1162
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).enqueue(async () => {
|
|
1163
|
-
_chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _pending)._++;
|
|
1164
|
-
_chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _intervalCount)._++;
|
|
1165
|
-
try {
|
|
1166
|
-
_optionalChain([options, 'access', _9 => _9.signal, 'optionalAccess', _10 => _10.throwIfAborted, 'call', _11 => _11()]);
|
|
1167
|
-
let operation = function_({ signal: options.signal });
|
|
1168
|
-
if (options.timeout) {
|
|
1169
|
-
operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
|
|
1170
|
-
}
|
|
1171
|
-
if (options.signal) {
|
|
1172
|
-
operation = Promise.race([operation, _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _throwOnAbort, throwOnAbort_fn).call(this, options.signal)]);
|
|
1173
|
-
}
|
|
1174
|
-
const result = await operation;
|
|
1175
|
-
resolve2(result);
|
|
1176
|
-
this.emit("completed", result);
|
|
1177
|
-
} catch (error) {
|
|
1178
|
-
if (error instanceof TimeoutError && !options.throwOnTimeout) {
|
|
1179
|
-
resolve2();
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
reject(error);
|
|
1183
|
-
this.emit("error", error);
|
|
1184
|
-
} finally {
|
|
1185
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _next, next_fn).call(this);
|
|
1186
|
-
}
|
|
1187
|
-
}, options);
|
|
1188
|
-
this.emit("add");
|
|
1189
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this);
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
async addAll(functions, options) {
|
|
1193
|
-
return Promise.all(functions.map(async (function_) => this.add(function_, options)));
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
1197
|
-
*/
|
|
1198
|
-
start() {
|
|
1199
|
-
if (!_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused)) {
|
|
1200
|
-
return this;
|
|
1201
|
-
}
|
|
1202
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, false);
|
|
1203
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
|
|
1204
|
-
return this;
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
Put queue execution on hold.
|
|
1208
|
-
*/
|
|
1209
|
-
pause() {
|
|
1210
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, true);
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
Clear the queue.
|
|
1214
|
-
*/
|
|
1215
|
-
clear() {
|
|
1216
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue2, new (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queueClass))());
|
|
1217
|
-
}
|
|
1218
|
-
/**
|
|
1219
|
-
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
1220
|
-
|
|
1221
|
-
@returns A promise that settles when the queue becomes empty.
|
|
1222
|
-
*/
|
|
1223
|
-
async onEmpty() {
|
|
1224
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "empty");
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
1231
|
-
|
|
1232
|
-
If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.
|
|
1233
|
-
|
|
1234
|
-
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
1235
|
-
*/
|
|
1236
|
-
async onSizeLessThan(limit) {
|
|
1237
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size < limit) {
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "next", () => _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size < limit);
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
1244
|
-
|
|
1245
|
-
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
1246
|
-
*/
|
|
1247
|
-
async onIdle() {
|
|
1248
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
1249
|
-
return;
|
|
1250
|
-
}
|
|
1251
|
-
await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "idle");
|
|
1252
|
-
}
|
|
1253
|
-
/**
|
|
1254
|
-
Size of the queue, the number of queued items waiting to run.
|
|
1255
|
-
*/
|
|
1256
|
-
get size() {
|
|
1257
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size;
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
Size of the queue, filtered by the given options.
|
|
1261
|
-
|
|
1262
|
-
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
1263
|
-
*/
|
|
1264
|
-
sizeBy(options) {
|
|
1265
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).filter(options).length;
|
|
1266
|
-
}
|
|
1267
|
-
/**
|
|
1268
|
-
Number of running items (no longer in the queue).
|
|
1269
|
-
*/
|
|
1270
|
-
get pending() {
|
|
1271
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending);
|
|
1272
|
-
}
|
|
1273
|
-
/**
|
|
1274
|
-
Whether the queue is currently paused.
|
|
1275
|
-
*/
|
|
1276
|
-
get isPaused() {
|
|
1277
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused);
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
_carryoverConcurrencyCount = new WeakMap();
|
|
1281
|
-
_isIntervalIgnored = new WeakMap();
|
|
1282
|
-
_intervalCount = new WeakMap();
|
|
1283
|
-
_intervalCap = new WeakMap();
|
|
1284
|
-
_interval = new WeakMap();
|
|
1285
|
-
_intervalEnd = new WeakMap();
|
|
1286
|
-
_intervalId = new WeakMap();
|
|
1287
|
-
_timeoutId = new WeakMap();
|
|
1288
|
-
_queue2 = new WeakMap();
|
|
1289
|
-
_queueClass = new WeakMap();
|
|
1290
|
-
_pending = new WeakMap();
|
|
1291
|
-
_concurrency = new WeakMap();
|
|
1292
|
-
_isPaused = new WeakMap();
|
|
1293
|
-
_throwOnTimeout = new WeakMap();
|
|
1294
|
-
_doesIntervalAllowAnother = new WeakSet();
|
|
1295
|
-
doesIntervalAllowAnother_get = function() {
|
|
1296
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCount) < _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCap);
|
|
1297
|
-
};
|
|
1298
|
-
_doesConcurrentAllowAnother = new WeakSet();
|
|
1299
|
-
doesConcurrentAllowAnother_get = function() {
|
|
1300
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) < _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _concurrency);
|
|
1301
|
-
};
|
|
1302
|
-
_next = new WeakSet();
|
|
1303
|
-
next_fn = function() {
|
|
1304
|
-
_chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _pending)._--;
|
|
1305
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this);
|
|
1306
|
-
this.emit("next");
|
|
1307
|
-
};
|
|
1308
|
-
_onResumeInterval = new WeakSet();
|
|
1309
|
-
onResumeInterval_fn = function() {
|
|
1310
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onInterval, onInterval_fn).call(this);
|
|
1311
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
|
|
1312
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _timeoutId, void 0);
|
|
1313
|
-
};
|
|
1314
|
-
_isIntervalPaused = new WeakSet();
|
|
1315
|
-
isIntervalPaused_get = function() {
|
|
1316
|
-
const now = Date.now();
|
|
1317
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId) === void 0) {
|
|
1318
|
-
const delay = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalEnd) - now;
|
|
1319
|
-
if (delay < 0) {
|
|
1320
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCount, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) : 0);
|
|
1321
|
-
} else {
|
|
1322
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _timeoutId) === void 0) {
|
|
1323
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _timeoutId, setTimeout(() => {
|
|
1324
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onResumeInterval, onResumeInterval_fn).call(this);
|
|
1325
|
-
}, delay));
|
|
1326
|
-
}
|
|
1327
|
-
return true;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
return false;
|
|
1331
|
-
};
|
|
1332
|
-
_tryToStartAnother = new WeakSet();
|
|
1333
|
-
tryToStartAnother_fn = function() {
|
|
1334
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
1335
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId)) {
|
|
1336
|
-
clearInterval(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId));
|
|
1337
|
-
}
|
|
1338
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, void 0);
|
|
1339
|
-
this.emit("empty");
|
|
1340
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0) {
|
|
1341
|
-
this.emit("idle");
|
|
1342
|
-
}
|
|
1343
|
-
return false;
|
|
1344
|
-
}
|
|
1345
|
-
if (!_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused)) {
|
|
1346
|
-
const canInitializeInterval = !_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalPaused, isIntervalPaused_get);
|
|
1347
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _doesIntervalAllowAnother, doesIntervalAllowAnother_get) && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _doesConcurrentAllowAnother, doesConcurrentAllowAnother_get)) {
|
|
1348
|
-
const job = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).dequeue();
|
|
1349
|
-
if (!job) {
|
|
1350
|
-
return false;
|
|
1351
|
-
}
|
|
1352
|
-
this.emit("active");
|
|
1353
|
-
job();
|
|
1354
|
-
if (canInitializeInterval) {
|
|
1355
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
|
|
1356
|
-
}
|
|
1357
|
-
return true;
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
return false;
|
|
1361
|
-
};
|
|
1362
|
-
_initializeIntervalIfNeeded = new WeakSet();
|
|
1363
|
-
initializeIntervalIfNeeded_fn = function() {
|
|
1364
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId) !== void 0) {
|
|
1365
|
-
return;
|
|
1366
|
-
}
|
|
1367
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, setInterval(() => {
|
|
1368
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onInterval, onInterval_fn).call(this);
|
|
1369
|
-
}, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _interval)));
|
|
1370
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalEnd, Date.now() + _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _interval));
|
|
1371
|
-
};
|
|
1372
|
-
_onInterval = new WeakSet();
|
|
1373
|
-
onInterval_fn = function() {
|
|
1374
|
-
if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCount) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId)) {
|
|
1375
|
-
clearInterval(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId));
|
|
1376
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, void 0);
|
|
1377
|
-
}
|
|
1378
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCount, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) : 0);
|
|
1379
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
|
|
1380
|
-
};
|
|
1381
|
-
_processQueue = new WeakSet();
|
|
1382
|
-
processQueue_fn = function() {
|
|
1383
|
-
while (_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this)) {
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1386
|
-
_throwOnAbort = new WeakSet();
|
|
1387
|
-
throwOnAbort_fn = async function(signal) {
|
|
1388
|
-
return new Promise((_resolve, reject) => {
|
|
1389
|
-
signal.addEventListener("abort", () => {
|
|
1390
|
-
reject(signal.reason);
|
|
1391
|
-
}, { once: true });
|
|
1392
|
-
});
|
|
1393
|
-
};
|
|
1394
|
-
_onEvent = new WeakSet();
|
|
1395
|
-
onEvent_fn = async function(event, filter) {
|
|
1396
|
-
return new Promise((resolve2) => {
|
|
1397
|
-
const listener = () => {
|
|
1398
|
-
if (filter && !filter()) {
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
this.off(event, listener);
|
|
1402
|
-
resolve2();
|
|
1403
|
-
};
|
|
1404
|
-
this.on(event, listener);
|
|
1405
|
-
});
|
|
1406
|
-
};
|
|
1407
|
-
|
|
1408
|
-
// src/BarrelManager.ts
|
|
1409
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
// src/utils/TreeNode.ts
|
|
1414
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1415
|
-
var _directorytree = require('directory-tree'); var _directorytree2 = _interopRequireDefault(_directorytree);
|
|
1416
|
-
var TreeNode = class _TreeNode {
|
|
1417
|
-
constructor(data, parent) {
|
|
1418
|
-
this.children = [];
|
|
1419
|
-
this.data = data;
|
|
1420
|
-
this.parent = parent;
|
|
1421
|
-
return this;
|
|
1422
|
-
}
|
|
1423
|
-
addChild(data) {
|
|
1424
|
-
const child = new _TreeNode(data, this);
|
|
1425
|
-
if (!this.children) {
|
|
1426
|
-
this.children = [];
|
|
1427
|
-
}
|
|
1428
|
-
this.children.push(child);
|
|
1429
|
-
return child;
|
|
1430
|
-
}
|
|
1431
|
-
find(data) {
|
|
1432
|
-
if (!data) {
|
|
1433
|
-
return null;
|
|
1434
|
-
}
|
|
1435
|
-
if (data === this.data) {
|
|
1436
|
-
return this;
|
|
1437
|
-
}
|
|
1438
|
-
if (_optionalChain([this, 'access', _12 => _12.children, 'optionalAccess', _13 => _13.length])) {
|
|
1439
|
-
for (let i = 0, { length } = this.children, target = null; i < length; i++) {
|
|
1440
|
-
target = this.children[i].find(data);
|
|
1441
|
-
if (target) {
|
|
1442
|
-
return target;
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
return null;
|
|
1447
|
-
}
|
|
1448
|
-
get leaves() {
|
|
1449
|
-
if (!this.children || this.children.length === 0) {
|
|
1450
|
-
return [this];
|
|
1451
|
-
}
|
|
1452
|
-
const leaves = [];
|
|
1453
|
-
if (this.children) {
|
|
1454
|
-
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
1455
|
-
leaves.push.apply(leaves, this.children[i].leaves);
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
return leaves;
|
|
1459
|
-
}
|
|
1460
|
-
get root() {
|
|
1461
|
-
if (!this.parent) {
|
|
1462
|
-
return this;
|
|
1463
|
-
}
|
|
1464
|
-
return this.parent.root;
|
|
1465
|
-
}
|
|
1466
|
-
forEach(callback) {
|
|
1467
|
-
if (typeof callback !== "function") {
|
|
1468
|
-
throw new TypeError("forEach() callback must be a function");
|
|
1469
|
-
}
|
|
1470
|
-
callback(this);
|
|
1471
|
-
if (this.children) {
|
|
1472
|
-
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
1473
|
-
this.children[i].forEach(callback);
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
return this;
|
|
1477
|
-
}
|
|
1478
|
-
static build(path3, options = {}) {
|
|
1479
|
-
try {
|
|
1480
|
-
const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
|
|
1481
|
-
const filteredTree = _directorytree2.default.call(void 0, path3, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] });
|
|
1482
|
-
if (!filteredTree) {
|
|
1483
|
-
return null;
|
|
1484
|
-
}
|
|
1485
|
-
const treeNode = new _TreeNode({ name: filteredTree.name, path: filteredTree.path, type: filteredTree.type || FileManager.getMode(filteredTree.path) });
|
|
1486
|
-
const recurse = (node, item) => {
|
|
1487
|
-
const subNode = node.addChild({ name: item.name, path: item.path, type: item.type || FileManager.getMode(item.path) });
|
|
1488
|
-
if (_optionalChain([item, 'access', _14 => _14.children, 'optionalAccess', _15 => _15.length])) {
|
|
1489
|
-
_optionalChain([item, 'access', _16 => _16.children, 'optionalAccess', _17 => _17.forEach, 'call', _18 => _18((child) => {
|
|
1490
|
-
recurse(subNode, child);
|
|
1491
|
-
})]);
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
_optionalChain([filteredTree, 'access', _19 => _19.children, 'optionalAccess', _20 => _20.forEach, 'call', _21 => _21((child) => recurse(treeNode, child))]);
|
|
1495
|
-
return treeNode;
|
|
1496
|
-
} catch (e) {
|
|
1497
|
-
throw new Error("Something went wrong with creating index files with the TreehNode class", { cause: e });
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
// src/BarrelManager.ts
|
|
1503
|
-
var _options;
|
|
1504
|
-
var BarrelManager = class {
|
|
1505
|
-
constructor(options = {}) {
|
|
1506
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options, void 0);
|
|
1507
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options, options);
|
|
1508
|
-
return this;
|
|
1509
|
-
}
|
|
1510
|
-
getNamedExport(root, item) {
|
|
1511
|
-
const exportedNames = _parser.getExports.call(void 0, _path2.default.resolve(root, item.path));
|
|
1512
|
-
if (!exportedNames) {
|
|
1513
|
-
return [item];
|
|
1514
|
-
}
|
|
1515
|
-
return exportedNames.reduce((prev, curr) => {
|
|
1516
|
-
if (!_optionalChain([prev, 'access', _22 => _22[0], 'optionalAccess', _23 => _23.name]) || !_optionalChain([prev, 'access', _24 => _24[1], 'optionalAccess', _25 => _25.name])) {
|
|
1517
|
-
return prev;
|
|
1518
|
-
}
|
|
1519
|
-
if (curr.isTypeOnly) {
|
|
1520
|
-
prev[1] = { ...prev[1], name: [...prev[1].name, curr.name] };
|
|
1521
|
-
} else {
|
|
1522
|
-
prev[0] = { ...prev[0], name: [...prev[0].name, curr.name] };
|
|
1523
|
-
}
|
|
1524
|
-
return prev;
|
|
1525
|
-
}, [{
|
|
1526
|
-
...item,
|
|
1527
|
-
name: [],
|
|
1528
|
-
isTypeOnly: false
|
|
1529
|
-
}, {
|
|
1530
|
-
...item,
|
|
1531
|
-
name: [],
|
|
1532
|
-
isTypeOnly: true
|
|
1533
|
-
}]);
|
|
1534
|
-
}
|
|
1535
|
-
getNamedExports(root, exports) {
|
|
1536
|
-
return _optionalChain([exports, 'optionalAccess', _26 => _26.map, 'call', _27 => _27((item) => {
|
|
1537
|
-
return this.getNamedExport(root, item);
|
|
1538
|
-
}), 'access', _28 => _28.flat, 'call', _29 => _29()]);
|
|
1539
|
-
}
|
|
1540
|
-
getIndexes(root) {
|
|
1541
|
-
const { treeNode = {}, isTypeOnly, extName } = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options);
|
|
1542
|
-
const tree = TreeNode.build(root, treeNode);
|
|
1543
|
-
if (!tree) {
|
|
1544
|
-
return null;
|
|
1545
|
-
}
|
|
1546
|
-
const fileReducer = (files, treeNode2) => {
|
|
1547
|
-
if (!treeNode2.children) {
|
|
1548
|
-
return [];
|
|
1549
|
-
}
|
|
1550
|
-
if (treeNode2.children.length > 1) {
|
|
1551
|
-
const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
|
|
1552
|
-
const exports = treeNode2.children.filter(Boolean).map((file) => {
|
|
1553
|
-
const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${_chunkKOQSM5X7cjs.trimExtName.call(void 0, file.data.name)}`;
|
|
1554
|
-
if (importPath.endsWith("index") && file.data.type === "file") {
|
|
1555
|
-
return void 0;
|
|
1556
|
-
}
|
|
1557
|
-
return {
|
|
1558
|
-
path: extName ? `${importPath}${extName}` : importPath,
|
|
1559
|
-
isTypeOnly
|
|
1560
|
-
};
|
|
1561
|
-
}).filter(Boolean);
|
|
1562
|
-
files.push({
|
|
1563
|
-
path: indexPath,
|
|
1564
|
-
baseName: "index.ts",
|
|
1565
|
-
source: "",
|
|
1566
|
-
exports
|
|
1567
|
-
});
|
|
1568
|
-
} else if (treeNode2.children.length === 1) {
|
|
1569
|
-
const [treeNodeChild] = treeNode2.children;
|
|
1570
|
-
const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
|
|
1571
|
-
const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${_chunkKOQSM5X7cjs.trimExtName.call(void 0, treeNodeChild.data.name)}`;
|
|
1572
|
-
const exports = [
|
|
1573
|
-
{
|
|
1574
|
-
path: extName ? `${importPath}${extName}` : importPath,
|
|
1575
|
-
isTypeOnly
|
|
1576
|
-
}
|
|
1577
|
-
];
|
|
1578
|
-
files.push({
|
|
1579
|
-
path: indexPath,
|
|
1580
|
-
baseName: "index.ts",
|
|
1581
|
-
source: "",
|
|
1582
|
-
exports
|
|
1583
|
-
});
|
|
1584
|
-
}
|
|
1585
|
-
treeNode2.children.forEach((childItem) => {
|
|
1586
|
-
fileReducer(files, childItem);
|
|
1587
|
-
});
|
|
1588
|
-
return files;
|
|
1589
|
-
};
|
|
1590
|
-
return fileReducer([], tree).reverse();
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
_options = new WeakMap();
|
|
1594
|
-
|
|
1595
|
-
// src/FileManager.ts
|
|
1596
|
-
var KubbFile;
|
|
1597
|
-
((KubbFile2) => {
|
|
1598
|
-
})(KubbFile || (KubbFile = exports.KubbFile = {}));
|
|
1599
|
-
var _cache, _task, _queue3, _add, add_fn, _addOrAppend, addOrAppend_fn;
|
|
1600
|
-
var _FileManager = class _FileManager {
|
|
1601
|
-
constructor({ task = async (file) => file, queue = new PQueue() } = {}) {
|
|
1602
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _add);
|
|
1603
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _addOrAppend);
|
|
1604
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _cache, /* @__PURE__ */ new Map());
|
|
1605
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _task, void 0);
|
|
1606
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue3, void 0);
|
|
1607
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _task, task);
|
|
1608
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue3, queue);
|
|
1609
|
-
return this;
|
|
1610
|
-
}
|
|
1611
|
-
get files() {
|
|
1612
|
-
const files = [];
|
|
1613
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).forEach((item) => {
|
|
1614
|
-
files.push(...item.flat(1));
|
|
1615
|
-
});
|
|
1616
|
-
return files;
|
|
1617
|
-
}
|
|
1618
|
-
get isExecuting() {
|
|
1619
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).size !== 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).pending !== 0;
|
|
1620
|
-
}
|
|
1621
|
-
async add(...files) {
|
|
1622
|
-
const promises = combineFiles(files).map((file) => {
|
|
1623
|
-
if (file.override) {
|
|
1624
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, file);
|
|
1625
|
-
}
|
|
1626
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, file);
|
|
1627
|
-
});
|
|
1628
|
-
const resolvedFiles = await Promise.all(promises);
|
|
1629
|
-
if (files.length > 1) {
|
|
1630
|
-
return resolvedFiles;
|
|
1631
|
-
}
|
|
1632
|
-
return resolvedFiles[0];
|
|
1633
|
-
}
|
|
1634
|
-
async addIndexes({ root, output, meta, options = {} }) {
|
|
1635
|
-
const { exportType = "barrel" } = output;
|
|
1636
|
-
if (exportType === false) {
|
|
1637
|
-
return void 0;
|
|
1638
|
-
}
|
|
1639
|
-
const pathToBuildFrom = _path.resolve.call(void 0, root, output.path);
|
|
1640
|
-
const exportPath = output.path.startsWith("./") ? _chunkKOQSM5X7cjs.trimExtName.call(void 0, output.path) : `./${_chunkKOQSM5X7cjs.trimExtName.call(void 0, output.path)}`;
|
|
1641
|
-
const mode = _FileManager.getMode(output.path);
|
|
1642
|
-
const barrelManager = new BarrelManager({ extName: output.extName, ...options });
|
|
1643
|
-
let files = barrelManager.getIndexes(pathToBuildFrom);
|
|
1644
|
-
if (!files) {
|
|
1645
|
-
return void 0;
|
|
1646
|
-
}
|
|
1647
|
-
if (exportType === "barrelNamed") {
|
|
1648
|
-
files = files.map((file) => {
|
|
1649
|
-
if (file.exports) {
|
|
1650
|
-
return {
|
|
1651
|
-
...file,
|
|
1652
|
-
exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports)
|
|
1653
|
-
};
|
|
1654
|
-
}
|
|
1655
|
-
return file;
|
|
1656
|
-
});
|
|
1657
|
-
}
|
|
1658
|
-
await Promise.all(
|
|
1659
|
-
files.map((file) => {
|
|
1660
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, {
|
|
1661
|
-
...file,
|
|
1662
|
-
meta: meta ? meta : file.meta
|
|
1663
|
-
});
|
|
1664
|
-
})
|
|
1665
|
-
);
|
|
1666
|
-
const rootPath = mode === "directory" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
|
|
1667
|
-
const rootFile = {
|
|
1668
|
-
path: _path.resolve.call(void 0, root, "index.ts"),
|
|
1669
|
-
baseName: "index.ts",
|
|
1670
|
-
source: "",
|
|
1671
|
-
exports: [
|
|
1672
|
-
output.exportAs ? {
|
|
1673
|
-
name: output.exportAs,
|
|
1674
|
-
asAlias: true,
|
|
1675
|
-
path: rootPath,
|
|
1676
|
-
isTypeOnly: options.isTypeOnly
|
|
1677
|
-
} : {
|
|
1678
|
-
path: rootPath,
|
|
1679
|
-
isTypeOnly: options.isTypeOnly
|
|
1680
|
-
}
|
|
1681
|
-
]
|
|
1682
|
-
};
|
|
1683
|
-
if (exportType === "barrelNamed" && !output.exportAs && _optionalChain([rootFile, 'access', _30 => _30.exports, 'optionalAccess', _31 => _31[0]])) {
|
|
1684
|
-
rootFile.exports = barrelManager.getNamedExport(root, rootFile.exports[0]);
|
|
1685
|
-
}
|
|
1686
|
-
await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, {
|
|
1687
|
-
...rootFile,
|
|
1688
|
-
meta: meta ? meta : rootFile.meta
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
getCacheByUUID(UUID) {
|
|
1692
|
-
let cache;
|
|
1693
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).forEach((files) => {
|
|
1694
|
-
cache = files.find((item) => item.id === UUID);
|
|
1695
|
-
});
|
|
1696
|
-
return cache;
|
|
1697
|
-
}
|
|
1698
|
-
get(path3) {
|
|
1699
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).get(path3);
|
|
1700
|
-
}
|
|
1701
|
-
remove(path3) {
|
|
1702
|
-
const cacheItem = this.get(path3);
|
|
1703
|
-
if (!cacheItem) {
|
|
1704
|
-
return;
|
|
1705
|
-
}
|
|
1706
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).delete(path3);
|
|
1707
|
-
}
|
|
1708
|
-
async write(...params) {
|
|
1709
|
-
return _chunkTJHTFTXAcjs.write.call(void 0, ...params);
|
|
1710
|
-
}
|
|
1711
|
-
async read(...params) {
|
|
1712
|
-
return _chunkWAIHMG76cjs.read.call(void 0, ...params);
|
|
1713
|
-
}
|
|
1714
|
-
// statics
|
|
1715
|
-
static getSource(file) {
|
|
1716
|
-
return getSource(file);
|
|
1717
|
-
}
|
|
1718
|
-
static combineFiles(files) {
|
|
1719
|
-
return combineFiles(files);
|
|
1720
|
-
}
|
|
1721
|
-
static getMode(path3) {
|
|
1722
|
-
if (!path3) {
|
|
1723
|
-
return "directory";
|
|
1724
|
-
}
|
|
1725
|
-
return _path.extname.call(void 0, path3) ? "file" : "directory";
|
|
1726
|
-
}
|
|
1727
|
-
static get extensions() {
|
|
1728
|
-
return [".js", ".ts", ".tsx"];
|
|
1729
|
-
}
|
|
1730
|
-
static isJavascript(baseName) {
|
|
1731
|
-
return _FileManager.extensions.some((extension) => baseName.endsWith(extension));
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
_cache = new WeakMap();
|
|
1735
|
-
_task = new WeakMap();
|
|
1736
|
-
_queue3 = new WeakMap();
|
|
1737
|
-
_add = new WeakSet();
|
|
1738
|
-
add_fn = async function(file) {
|
|
1739
|
-
const controller = new AbortController();
|
|
1740
|
-
const resolvedFile = { id: _crypto2.default.randomUUID(), name: _chunkKOQSM5X7cjs.trimExtName.call(void 0, file.baseName), ...file };
|
|
1741
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
|
|
1742
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).add(
|
|
1743
|
-
async () => {
|
|
1744
|
-
var _a;
|
|
1745
|
-
return (_a = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
|
|
1746
|
-
},
|
|
1747
|
-
{ signal: controller.signal }
|
|
1748
|
-
);
|
|
1749
|
-
};
|
|
1750
|
-
_addOrAppend = new WeakSet();
|
|
1751
|
-
addOrAppend_fn = async function(file) {
|
|
1752
|
-
const previousCaches = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).get(file.path);
|
|
1753
|
-
const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : void 0;
|
|
1754
|
-
if (previousCache) {
|
|
1755
|
-
_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).delete(previousCache.path);
|
|
1756
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, {
|
|
1757
|
-
...file,
|
|
1758
|
-
source: previousCache.source && file.source ? `${previousCache.source}
|
|
1759
|
-
${file.source}` : "",
|
|
1760
|
-
imports: [...previousCache.imports || [], ...file.imports || []],
|
|
1761
|
-
exports: [...previousCache.exports || [], ...file.exports || []],
|
|
1762
|
-
env: { ...previousCache.env || {}, ...file.env || {} }
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, file);
|
|
1766
|
-
};
|
|
1767
|
-
var FileManager = _FileManager;
|
|
1768
|
-
function combineFiles(files) {
|
|
1769
|
-
return files.filter(Boolean).reduce((acc, file) => {
|
|
1770
|
-
const prevIndex = acc.findIndex((item) => item.path === file.path);
|
|
1771
|
-
if (prevIndex === -1) {
|
|
1772
|
-
return [...acc, file];
|
|
1773
|
-
}
|
|
1774
|
-
const prev = acc[prevIndex];
|
|
1775
|
-
if (prev && file.override) {
|
|
1776
|
-
acc[prevIndex] = {
|
|
1777
|
-
imports: [],
|
|
1778
|
-
exports: [],
|
|
1779
|
-
...file
|
|
1780
|
-
};
|
|
1781
|
-
return acc;
|
|
1782
|
-
}
|
|
1783
|
-
if (prev) {
|
|
1784
|
-
acc[prevIndex] = {
|
|
1785
|
-
...file,
|
|
1786
|
-
source: prev.source && file.source ? `${prev.source}
|
|
1787
|
-
${file.source}` : "",
|
|
1788
|
-
imports: [...prev.imports || [], ...file.imports || []],
|
|
1789
|
-
exports: [...prev.exports || [], ...file.exports || []],
|
|
1790
|
-
env: { ...prev.env || {}, ...file.env || {} }
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
return acc;
|
|
1794
|
-
}, []);
|
|
1795
|
-
}
|
|
1796
|
-
function getSource(file) {
|
|
1797
|
-
if (file.language ? !["typescript", "javascript"].includes(file.language) : !FileManager.isJavascript(file.baseName)) {
|
|
1798
|
-
return file.source;
|
|
1799
|
-
}
|
|
1800
|
-
const exports = file.exports ? combineExports(file.exports) : [];
|
|
1801
|
-
const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : [];
|
|
1802
|
-
const importNodes = imports.filter((item) => {
|
|
1803
|
-
return item.path !== _chunkKOQSM5X7cjs.trimExtName.call(void 0, file.path);
|
|
1804
|
-
}).map((item) => {
|
|
1805
|
-
return factory.createImportDeclaration({
|
|
1806
|
-
name: item.name,
|
|
1807
|
-
path: item.root ? _chunkWAIHMG76cjs.getRelativePath.call(void 0, item.root, item.path) : item.path,
|
|
1808
|
-
isTypeOnly: item.isTypeOnly
|
|
1809
|
-
});
|
|
1810
|
-
});
|
|
1811
|
-
const exportNodes = exports.map(
|
|
1812
|
-
(item) => factory.createExportDeclaration({
|
|
1813
|
-
name: item.name,
|
|
1814
|
-
path: item.path,
|
|
1815
|
-
isTypeOnly: item.isTypeOnly,
|
|
1816
|
-
asAlias: item.asAlias
|
|
1817
|
-
})
|
|
1818
|
-
);
|
|
1819
|
-
const source = [_parser.print.call(void 0, [...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
|
|
1820
|
-
return _parser.print.call(void 0, [], { source, noEmitHelpers: false });
|
|
1821
|
-
}
|
|
1822
|
-
function combineExports(exports) {
|
|
1823
|
-
const combinedExports = _chunkDOELQNBOcjs.orderBy.call(void 0, exports, [(v) => !v.isTypeOnly], ["asc"]).reduce((prev, curr) => {
|
|
1824
|
-
const name = curr.name;
|
|
1825
|
-
const prevByPath = prev.findLast((imp) => imp.path === curr.path);
|
|
1826
|
-
const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
|
|
1827
|
-
if (prevByPathAndIsTypeOnly) {
|
|
1828
|
-
return prev;
|
|
1829
|
-
}
|
|
1830
|
-
const uniquePrev = prev.findLast(
|
|
1831
|
-
(imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
|
|
1832
|
-
);
|
|
1833
|
-
if (uniquePrev || Array.isArray(name) && !name.length || _optionalChain([prevByPath, 'optionalAccess', _32 => _32.asAlias]) && !curr.asAlias) {
|
|
1834
|
-
return prev;
|
|
1835
|
-
}
|
|
1836
|
-
if (!prevByPath) {
|
|
1837
|
-
return [
|
|
1838
|
-
...prev,
|
|
1839
|
-
{
|
|
1840
|
-
...curr,
|
|
1841
|
-
name: Array.isArray(name) ? [...new Set(name)] : name
|
|
1842
|
-
}
|
|
1843
|
-
];
|
|
1844
|
-
}
|
|
1845
|
-
if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
|
|
1846
|
-
prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...curr.name])];
|
|
1847
|
-
return prev;
|
|
1848
|
-
}
|
|
1849
|
-
return [...prev, curr];
|
|
1850
|
-
}, []);
|
|
1851
|
-
return _chunkDOELQNBOcjs.orderBy.call(void 0, combinedExports, [(v) => !v.isTypeOnly, (v) => v.asAlias], ["desc", "desc"]);
|
|
1852
|
-
}
|
|
1853
|
-
function combineImports(imports, exports, source) {
|
|
1854
|
-
const combinedImports = _chunkDOELQNBOcjs.orderBy.call(void 0, imports, [(v) => !v.isTypeOnly], ["asc"]).reduce((prev, curr) => {
|
|
1855
|
-
let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
|
|
1856
|
-
const hasImportInSource = (importName) => {
|
|
1857
|
-
if (!source) {
|
|
1858
|
-
return true;
|
|
1859
|
-
}
|
|
1860
|
-
const checker = (name2) => name2 && !!source.includes(name2);
|
|
1861
|
-
return checker(importName) || exports.some(({ name: name2 }) => Array.isArray(name2) ? name2.some(checker) : checker(name2));
|
|
1862
|
-
};
|
|
1863
|
-
if (Array.isArray(name)) {
|
|
1864
|
-
name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
|
|
1865
|
-
}
|
|
1866
|
-
const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
|
|
1867
|
-
const uniquePrev = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
|
|
1868
|
-
const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
|
|
1869
|
-
if (prevByPathNameAndIsTypeOnly) {
|
|
1870
|
-
return prev;
|
|
1871
|
-
}
|
|
1872
|
-
if (uniquePrev || Array.isArray(name) && !name.length) {
|
|
1873
|
-
return prev;
|
|
1874
|
-
}
|
|
1875
|
-
if (!prevByPath) {
|
|
1876
|
-
return [
|
|
1877
|
-
...prev,
|
|
1878
|
-
{
|
|
1879
|
-
...curr,
|
|
1880
|
-
name
|
|
1881
|
-
}
|
|
1882
|
-
];
|
|
1883
|
-
}
|
|
1884
|
-
if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
|
|
1885
|
-
prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...name])];
|
|
1886
|
-
return prev;
|
|
1887
|
-
}
|
|
1888
|
-
if (!Array.isArray(name) && name && !hasImportInSource(name)) {
|
|
1889
|
-
return prev;
|
|
1890
|
-
}
|
|
1891
|
-
return [...prev, curr];
|
|
1892
|
-
}, []);
|
|
1893
|
-
return _chunkDOELQNBOcjs.orderBy.call(void 0, combinedImports, [(v) => !v.isTypeOnly], ["desc"]);
|
|
1894
|
-
}
|
|
1895
|
-
function getEnvSource(source, env) {
|
|
1896
|
-
if (!env) {
|
|
1897
|
-
return source;
|
|
1898
|
-
}
|
|
1899
|
-
const keys = Object.keys(env);
|
|
1900
|
-
if (!keys.length) {
|
|
1901
|
-
return source;
|
|
1902
|
-
}
|
|
1903
|
-
return keys.reduce((prev, key) => {
|
|
1904
|
-
const environmentValue = env[key];
|
|
1905
|
-
const replaceBy = environmentValue ? `'${_optionalChain([environmentValue, 'access', _33 => _33.replaceAll, 'call', _34 => _34('"', ""), 'optionalAccess', _35 => _35.replaceAll, 'call', _36 => _36("'", "")])}'` : "undefined";
|
|
1906
|
-
if (key.toUpperCase() !== key) {
|
|
1907
|
-
throw new TypeError(`Environment should be in upperCase for ${key}`);
|
|
1908
|
-
}
|
|
1909
|
-
if (typeof replaceBy === "string") {
|
|
1910
|
-
prev = _chunkKOQSM5X7cjs.searchAndReplace.call(void 0, { text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: "process.env", key });
|
|
1911
|
-
prev = _chunkKOQSM5X7cjs.searchAndReplace.call(void 0, { text: prev.replaceAll(new RegExp(`(declare const).*
|
|
1912
|
-
`, "ig"), ""), replaceBy, key });
|
|
1913
|
-
}
|
|
1914
|
-
return prev;
|
|
1915
|
-
}, source);
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
// src/errors.ts
|
|
1919
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1920
|
-
var Warning = class extends Error {
|
|
1921
|
-
constructor(message, options) {
|
|
1922
|
-
super(message, { cause: _optionalChain([options, 'optionalAccess', _37 => _37.cause]) });
|
|
1923
|
-
this.name = "Warning";
|
|
1924
|
-
}
|
|
1925
|
-
};
|
|
1926
|
-
var ValidationPluginError = class extends Error {
|
|
1927
|
-
};
|
|
1928
|
-
|
|
1929
|
-
// src/plugin.ts
|
|
1930
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
// src/utils/cache.ts
|
|
1934
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1935
|
-
function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
|
|
1936
|
-
return {
|
|
1937
|
-
set(id, value) {
|
|
1938
|
-
Store[id] = [0, value];
|
|
1939
|
-
},
|
|
1940
|
-
get(id) {
|
|
1941
|
-
const item = Store[id];
|
|
1942
|
-
if (!item) {
|
|
1943
|
-
return null;
|
|
1944
|
-
}
|
|
1945
|
-
item[0] = 0;
|
|
1946
|
-
return item[1];
|
|
1947
|
-
},
|
|
1948
|
-
has(id) {
|
|
1949
|
-
const item = Store[id];
|
|
1950
|
-
if (!item) {
|
|
1951
|
-
return false;
|
|
1952
|
-
}
|
|
1953
|
-
item[0] = 0;
|
|
1954
|
-
return true;
|
|
1955
|
-
},
|
|
1956
|
-
delete(id) {
|
|
1957
|
-
return delete Store[id];
|
|
1958
|
-
}
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
|
|
1962
|
-
// src/plugin.ts
|
|
1963
|
-
function createPlugin(factory2) {
|
|
1964
|
-
return (options) => {
|
|
1965
|
-
return factory2(options);
|
|
1966
|
-
};
|
|
1967
|
-
}
|
|
1968
|
-
var pluginName = "core";
|
|
1969
|
-
var definePlugin = createPlugin((options) => {
|
|
1970
|
-
const { fileManager, pluginManager, resolvePath, resolveName, logger } = options;
|
|
1971
|
-
return {
|
|
1972
|
-
name: pluginName,
|
|
1973
|
-
options,
|
|
1974
|
-
key: ["core"],
|
|
1975
|
-
api() {
|
|
1976
|
-
return {
|
|
1977
|
-
get config() {
|
|
1978
|
-
return options.config;
|
|
1979
|
-
},
|
|
1980
|
-
get plugins() {
|
|
1981
|
-
return options.getPlugins();
|
|
1982
|
-
},
|
|
1983
|
-
get plugin() {
|
|
1984
|
-
return options.plugin;
|
|
1985
|
-
},
|
|
1986
|
-
logger,
|
|
1987
|
-
fileManager,
|
|
1988
|
-
pluginManager,
|
|
1989
|
-
async addFile(...files) {
|
|
1990
|
-
const resolvedFiles = await fileManager.add(...files);
|
|
1991
|
-
if (!Array.isArray(resolvedFiles)) {
|
|
1992
|
-
return [resolvedFiles];
|
|
1993
|
-
}
|
|
1994
|
-
return resolvedFiles;
|
|
1995
|
-
},
|
|
1996
|
-
resolvePath,
|
|
1997
|
-
resolveName,
|
|
1998
|
-
cache: createPluginCache()
|
|
1999
|
-
};
|
|
2000
|
-
},
|
|
2001
|
-
resolvePath(baseName) {
|
|
2002
|
-
const root = _path2.default.resolve(this.config.root, this.config.output.path);
|
|
2003
|
-
return _path2.default.resolve(root, baseName);
|
|
2004
|
-
},
|
|
2005
|
-
resolveName(name) {
|
|
2006
|
-
return name;
|
|
2007
|
-
}
|
|
2008
|
-
};
|
|
2009
|
-
});
|
|
2010
|
-
|
|
2011
|
-
// src/PromiseManager.ts
|
|
2012
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2013
|
-
|
|
2014
|
-
// src/utils/executeStrategies.ts
|
|
2015
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2016
|
-
function hookSeq(promises) {
|
|
2017
|
-
return promises.filter(Boolean).reduce(
|
|
2018
|
-
(promise, func) => {
|
|
2019
|
-
if (typeof func !== "function") {
|
|
2020
|
-
throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
|
|
2021
|
-
}
|
|
2022
|
-
return promise.then((state) => {
|
|
2023
|
-
const calledFunc = func(state);
|
|
2024
|
-
if (calledFunc) {
|
|
2025
|
-
return calledFunc.then(Array.prototype.concat.bind(state));
|
|
2026
|
-
}
|
|
2027
|
-
});
|
|
2028
|
-
},
|
|
2029
|
-
Promise.resolve([])
|
|
2030
|
-
);
|
|
2031
|
-
}
|
|
2032
|
-
function hookFirst(promises, nullCheck = (state) => state !== null) {
|
|
2033
|
-
let promise = Promise.resolve(null);
|
|
2034
|
-
for (const func of promises.filter(Boolean)) {
|
|
2035
|
-
promise = promise.then((state) => {
|
|
2036
|
-
if (nullCheck(state)) {
|
|
2037
|
-
return state;
|
|
2038
|
-
}
|
|
2039
|
-
const calledFunc = func(state);
|
|
2040
|
-
return calledFunc;
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
return promise;
|
|
2044
|
-
}
|
|
2045
|
-
function hookParallel(promises) {
|
|
2046
|
-
return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
|
|
2047
|
-
}
|
|
2048
|
-
|
|
2049
|
-
// src/PromiseManager.ts
|
|
2050
|
-
var _options2;
|
|
2051
|
-
var PromiseManager = class {
|
|
2052
|
-
constructor(options = {}) {
|
|
2053
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options2, {});
|
|
2054
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options2, options);
|
|
2055
|
-
return this;
|
|
2056
|
-
}
|
|
2057
|
-
run(strategy, promises) {
|
|
2058
|
-
if (strategy === "seq") {
|
|
2059
|
-
return hookSeq(promises);
|
|
2060
|
-
}
|
|
2061
|
-
if (strategy === "first") {
|
|
2062
|
-
return hookFirst(promises, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options2).nullCheck);
|
|
2063
|
-
}
|
|
2064
|
-
if (strategy === "parallel") {
|
|
2065
|
-
return hookParallel(promises);
|
|
2066
|
-
}
|
|
2067
|
-
throw new Error(`${strategy} not implemented`);
|
|
2068
|
-
}
|
|
2069
|
-
};
|
|
2070
|
-
_options2 = new WeakMap();
|
|
2071
|
-
function isPromise(result) {
|
|
2072
|
-
return !!result && typeof _optionalChain([result, 'optionalAccess', _38 => _38.then]) === "function";
|
|
2073
|
-
}
|
|
2074
|
-
function isPromiseRejectedResult(result) {
|
|
2075
|
-
return result.status === "rejected";
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
// src/PluginManager.ts
|
|
2079
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2080
|
-
var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
|
|
2081
|
-
var PluginManager = class {
|
|
2082
|
-
constructor(config, options) {
|
|
2083
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _getSortedPlugins);
|
|
2084
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _addExecutedToCallStack);
|
|
2085
|
-
/**
|
|
2086
|
-
* Run an async plugin hook and return the result.
|
|
2087
|
-
* @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
|
|
2088
|
-
* @param args Arguments passed to the plugin hook.
|
|
2089
|
-
* @param plugin The actual pluginObject to run.
|
|
2090
|
-
*/
|
|
2091
|
-
// Implementation signature
|
|
2092
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _execute);
|
|
2093
|
-
/**
|
|
2094
|
-
* Run a sync plugin hook and return the result.
|
|
2095
|
-
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
2096
|
-
* @param args Arguments passed to the plugin hook.
|
|
2097
|
-
* @param plugin The acutal plugin
|
|
2098
|
-
* @param replaceContext When passed, the plugin context can be overridden.
|
|
2099
|
-
*/
|
|
2100
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _executeSync);
|
|
2101
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _catcher);
|
|
2102
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _parse);
|
|
2103
|
-
this.events = new (0, _chunkJDIEEDDBcjs.EventEmitter)();
|
|
2104
|
-
this.executed = [];
|
|
2105
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _core, void 0);
|
|
2106
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
|
|
2107
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _promiseManager, void 0);
|
|
2108
|
-
this.resolvePath = (params) => {
|
|
2109
|
-
if (params.pluginKey) {
|
|
2110
|
-
const paths = this.hookForPluginSync({
|
|
2111
|
-
pluginKey: params.pluginKey,
|
|
2112
|
-
hookName: "resolvePath",
|
|
2113
|
-
parameters: [params.baseName, params.mode, params.options]
|
|
2114
|
-
});
|
|
2115
|
-
if (paths && _optionalChain([paths, 'optionalAccess', _39 => _39.length]) > 1 && this.logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.debug) {
|
|
2116
|
-
this.logger.emit("debug", [
|
|
2117
|
-
`Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
2118
|
-
|
|
2119
|
-
Paths: ${JSON.stringify(paths, void 0, 2)}
|
|
2120
|
-
|
|
2121
|
-
Falling back on the first item.
|
|
2122
|
-
`
|
|
2123
|
-
]);
|
|
2124
|
-
}
|
|
2125
|
-
return _optionalChain([paths, 'optionalAccess', _40 => _40.at, 'call', _41 => _41(0)]);
|
|
2126
|
-
}
|
|
2127
|
-
return this.hookFirstSync({
|
|
2128
|
-
hookName: "resolvePath",
|
|
2129
|
-
parameters: [params.baseName, params.mode, params.options]
|
|
2130
|
-
}).result;
|
|
2131
|
-
};
|
|
2132
|
-
this.resolveName = (params) => {
|
|
2133
|
-
if (params.pluginKey) {
|
|
2134
|
-
const names = this.hookForPluginSync({
|
|
2135
|
-
pluginKey: params.pluginKey,
|
|
2136
|
-
hookName: "resolveName",
|
|
2137
|
-
parameters: [params.name, params.type]
|
|
2138
|
-
});
|
|
2139
|
-
if (names && _optionalChain([names, 'optionalAccess', _42 => _42.length]) > 1 && this.logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.debug) {
|
|
2140
|
-
this.logger.emit("debug", [
|
|
2141
|
-
`Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
2142
|
-
|
|
2143
|
-
Names: ${JSON.stringify(names, void 0, 2)}
|
|
2144
|
-
|
|
2145
|
-
Falling back on the first item.
|
|
2146
|
-
`
|
|
2147
|
-
]);
|
|
2148
|
-
}
|
|
2149
|
-
return _chunkKOQSM5X7cjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _43 => _43.at, 'call', _44 => _44(0)]) || params.name);
|
|
2150
|
-
}
|
|
2151
|
-
const name = this.hookFirstSync({
|
|
2152
|
-
hookName: "resolveName",
|
|
2153
|
-
parameters: [params.name, params.type]
|
|
2154
|
-
}).result;
|
|
2155
|
-
return _chunkKOQSM5X7cjs.transformReservedWord.call(void 0, name);
|
|
2156
|
-
};
|
|
2157
|
-
this.config = config;
|
|
2158
|
-
this.logger = options.logger;
|
|
2159
|
-
this.queue = new PQueue({ concurrency: 1 });
|
|
2160
|
-
this.fileManager = new FileManager({ task: options.task, queue: this.queue });
|
|
2161
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _promiseManager, new PromiseManager({ nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _45 => _45.result]) }));
|
|
2162
|
-
const plugins = config.plugins || [];
|
|
2163
|
-
const core = definePlugin({
|
|
2164
|
-
config,
|
|
2165
|
-
logger: this.logger,
|
|
2166
|
-
pluginManager: this,
|
|
2167
|
-
fileManager: this.fileManager,
|
|
2168
|
-
resolvePath: this.resolvePath.bind(this),
|
|
2169
|
-
resolveName: this.resolveName.bind(this),
|
|
2170
|
-
getPlugins: _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).bind(this)
|
|
2171
|
-
});
|
|
2172
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _core, _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _parse, parse_fn).call(this, core, this, core.api.call(null)));
|
|
2173
|
-
this.plugins = [_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core), ...plugins].map((plugin) => {
|
|
2174
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _parse, parse_fn).call(this, plugin, this, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api);
|
|
2175
|
-
});
|
|
2176
|
-
return this;
|
|
2177
|
-
}
|
|
2178
|
-
getFile({ name, mode, extName, pluginKey, options }) {
|
|
2179
|
-
let source = "";
|
|
2180
|
-
const baseName = `${name}${extName}`;
|
|
2181
|
-
const path3 = this.resolvePath({ baseName, mode, pluginKey, options });
|
|
2182
|
-
if (!path3) {
|
|
2183
|
-
throw new Error(`Filepath should be defined for resolvedName "${name}" and pluginKey [${JSON.stringify(pluginKey)}]`);
|
|
2184
|
-
}
|
|
2185
|
-
try {
|
|
2186
|
-
source = _chunkWAIHMG76cjs.readSync.call(void 0, path3);
|
|
2187
|
-
} catch (_e) {
|
|
2188
|
-
}
|
|
2189
|
-
return {
|
|
2190
|
-
path: path3,
|
|
2191
|
-
baseName,
|
|
2192
|
-
meta: {
|
|
2193
|
-
pluginKey
|
|
2194
|
-
},
|
|
2195
|
-
source
|
|
2196
|
-
};
|
|
2197
|
-
}
|
|
2198
|
-
/**
|
|
2199
|
-
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
2200
|
-
*/
|
|
2201
|
-
on(eventName, handler) {
|
|
2202
|
-
this.events.on(eventName, handler);
|
|
2203
|
-
}
|
|
2204
|
-
/**
|
|
2205
|
-
* Run a specific hookName for plugin x.
|
|
2206
|
-
*/
|
|
2207
|
-
hookForPlugin({
|
|
2208
|
-
pluginKey,
|
|
2209
|
-
hookName,
|
|
2210
|
-
parameters
|
|
2211
|
-
}) {
|
|
2212
|
-
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
2213
|
-
const promises = plugins.map((plugin) => {
|
|
2214
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
|
|
2215
|
-
strategy: "hookFirst",
|
|
2216
|
-
hookName,
|
|
2217
|
-
parameters,
|
|
2218
|
-
plugin
|
|
2219
|
-
});
|
|
2220
|
-
}).filter(Boolean);
|
|
2221
|
-
return Promise.all(promises);
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* Run a specific hookName for plugin x.
|
|
2225
|
-
*/
|
|
2226
|
-
hookForPluginSync({
|
|
2227
|
-
pluginKey,
|
|
2228
|
-
hookName,
|
|
2229
|
-
parameters
|
|
2230
|
-
}) {
|
|
2231
|
-
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
2232
|
-
return plugins.map((plugin) => {
|
|
2233
|
-
return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _executeSync, executeSync_fn).call(this, {
|
|
2234
|
-
strategy: "hookFirst",
|
|
2235
|
-
hookName,
|
|
2236
|
-
parameters,
|
|
2237
|
-
plugin
|
|
2238
|
-
});
|
|
2239
|
-
}).filter(Boolean);
|
|
2240
|
-
}
|
|
2241
|
-
/**
|
|
2242
|
-
* First non-null result stops and will return it's value.
|
|
2243
|
-
*/
|
|
2244
|
-
async hookFirst({
|
|
2245
|
-
hookName,
|
|
2246
|
-
parameters,
|
|
2247
|
-
skipped
|
|
2248
|
-
}) {
|
|
2249
|
-
const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).filter((plugin) => {
|
|
2250
|
-
return skipped ? skipped.has(plugin) : true;
|
|
2251
|
-
}).map((plugin) => {
|
|
2252
|
-
return async () => {
|
|
2253
|
-
const value = await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
|
|
2254
|
-
strategy: "hookFirst",
|
|
2255
|
-
hookName,
|
|
2256
|
-
parameters,
|
|
2257
|
-
plugin
|
|
2258
|
-
});
|
|
2259
|
-
return Promise.resolve(
|
|
2260
|
-
{
|
|
2261
|
-
plugin,
|
|
2262
|
-
result: value
|
|
2263
|
-
}
|
|
2264
|
-
);
|
|
2265
|
-
};
|
|
2266
|
-
});
|
|
2267
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("first", promises);
|
|
2268
|
-
}
|
|
2269
|
-
/**
|
|
2270
|
-
* First non-null result stops and will return it's value.
|
|
2271
|
-
*/
|
|
2272
|
-
hookFirstSync({
|
|
2273
|
-
hookName,
|
|
2274
|
-
parameters,
|
|
2275
|
-
skipped
|
|
2276
|
-
}) {
|
|
2277
|
-
let parseResult = null;
|
|
2278
|
-
for (const plugin of _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
|
|
2279
|
-
if (skipped && skipped.has(plugin)) {
|
|
2280
|
-
continue;
|
|
2281
|
-
}
|
|
2282
|
-
parseResult = {
|
|
2283
|
-
result: _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _executeSync, executeSync_fn).call(this, {
|
|
2284
|
-
strategy: "hookFirst",
|
|
2285
|
-
hookName,
|
|
2286
|
-
parameters,
|
|
2287
|
-
plugin
|
|
2288
|
-
}),
|
|
2289
|
-
plugin
|
|
2290
|
-
};
|
|
2291
|
-
if (_optionalChain([parseResult, 'optionalAccess', _46 => _46.result]) != null) {
|
|
2292
|
-
break;
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
return parseResult;
|
|
2296
|
-
}
|
|
2297
|
-
/**
|
|
2298
|
-
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
2299
|
-
*/
|
|
2300
|
-
async hookParallel({
|
|
2301
|
-
hookName,
|
|
2302
|
-
parameters
|
|
2303
|
-
}) {
|
|
2304
|
-
const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
|
|
2305
|
-
return () => _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, { strategy: "hookParallel", hookName, parameters, plugin });
|
|
2306
|
-
});
|
|
2307
|
-
const results = await _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("parallel", promises);
|
|
2308
|
-
results.forEach((result, index) => {
|
|
2309
|
-
if (isPromiseRejectedResult(result)) {
|
|
2310
|
-
const plugin = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)[index];
|
|
2311
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, result.reason, plugin, hookName);
|
|
2312
|
-
}
|
|
2313
|
-
});
|
|
2314
|
-
return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
2315
|
-
}
|
|
2316
|
-
/**
|
|
2317
|
-
* Chain all plugins, `reduce` can be passed through to handle every returned value. The return value of the first plugin will be used as the first parameter for the plugin after that.
|
|
2318
|
-
*/
|
|
2319
|
-
hookReduceArg0({
|
|
2320
|
-
hookName,
|
|
2321
|
-
parameters,
|
|
2322
|
-
reduce
|
|
2323
|
-
}) {
|
|
2324
|
-
const [argument0, ...rest] = parameters;
|
|
2325
|
-
let promise = Promise.resolve(argument0);
|
|
2326
|
-
for (const plugin of _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
|
|
2327
|
-
promise = promise.then((arg0) => {
|
|
2328
|
-
const value = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
|
|
2329
|
-
strategy: "hookReduceArg0",
|
|
2330
|
-
hookName,
|
|
2331
|
-
parameters: [arg0, ...rest],
|
|
2332
|
-
plugin
|
|
2333
|
-
});
|
|
2334
|
-
return value;
|
|
2335
|
-
}).then((result) => reduce.call(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, argument0, result, plugin));
|
|
2336
|
-
}
|
|
2337
|
-
return promise;
|
|
2338
|
-
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Chains plugins
|
|
2341
|
-
*/
|
|
2342
|
-
async hookSeq({ hookName, parameters }) {
|
|
2343
|
-
const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
|
|
2344
|
-
return () => _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
|
|
2345
|
-
strategy: "hookSeq",
|
|
2346
|
-
hookName,
|
|
2347
|
-
parameters,
|
|
2348
|
-
plugin
|
|
2349
|
-
});
|
|
2350
|
-
});
|
|
2351
|
-
return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("seq", promises);
|
|
2352
|
-
}
|
|
2353
|
-
getPluginsByKey(hookName, pluginKey) {
|
|
2354
|
-
const plugins = [...this.plugins];
|
|
2355
|
-
const [searchPluginName, searchIdentifier] = pluginKey;
|
|
2356
|
-
const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
|
|
2357
|
-
const [name, identifier] = item.key;
|
|
2358
|
-
const identifierCheck = _optionalChain([identifier, 'optionalAccess', _47 => _47.toString, 'call', _48 => _48()]) === _optionalChain([searchIdentifier, 'optionalAccess', _49 => _49.toString, 'call', _50 => _50()]);
|
|
2359
|
-
const nameCheck = name === searchPluginName;
|
|
2360
|
-
if (searchIdentifier) {
|
|
2361
|
-
return identifierCheck && nameCheck;
|
|
2362
|
-
}
|
|
2363
|
-
return nameCheck;
|
|
2364
|
-
});
|
|
2365
|
-
if (!_optionalChain([pluginByPluginName, 'optionalAccess', _51 => _51.length])) {
|
|
2366
|
-
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
2367
|
-
if (this.logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.debug) {
|
|
2368
|
-
if (corePlugin) {
|
|
2369
|
-
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
|
|
2370
|
-
} else {
|
|
2371
|
-
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
return corePlugin ? [corePlugin] : [];
|
|
2375
|
-
}
|
|
2376
|
-
return pluginByPluginName;
|
|
2377
|
-
}
|
|
2378
|
-
static getDependedPlugins(plugins, dependedPluginNames) {
|
|
2379
|
-
let pluginNames = [];
|
|
2380
|
-
if (typeof dependedPluginNames === "string") {
|
|
2381
|
-
pluginNames = [dependedPluginNames];
|
|
2382
|
-
} else {
|
|
2383
|
-
pluginNames = dependedPluginNames;
|
|
2384
|
-
}
|
|
2385
|
-
return pluginNames.map((pluginName2) => {
|
|
2386
|
-
const plugin = plugins.find((plugin2) => plugin2.name === pluginName2);
|
|
2387
|
-
if (!plugin) {
|
|
2388
|
-
throw new ValidationPluginError(`This plugin depends on the ${pluginName2} plugin.`);
|
|
2389
|
-
}
|
|
2390
|
-
return plugin;
|
|
2391
|
-
});
|
|
2392
|
-
}
|
|
2393
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
2394
|
-
static get hooks() {
|
|
2395
|
-
return ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
|
|
2396
|
-
}
|
|
2397
|
-
};
|
|
2398
|
-
_core = new WeakMap();
|
|
2399
|
-
_usedPluginNames = new WeakMap();
|
|
2400
|
-
_promiseManager = new WeakMap();
|
|
2401
|
-
_getSortedPlugins = new WeakSet();
|
|
2402
|
-
getSortedPlugins_fn = function(hookName) {
|
|
2403
|
-
const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
|
|
2404
|
-
if (hookName) {
|
|
2405
|
-
if (this.logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.info) {
|
|
2406
|
-
const containsHookName = plugins.some((item) => item[hookName]);
|
|
2407
|
-
if (!containsHookName) {
|
|
2408
|
-
this.logger.emit("warning", `No hook ${hookName} found`);
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
return plugins.filter((item) => item[hookName]);
|
|
2412
|
-
}
|
|
2413
|
-
return plugins.map((plugin) => {
|
|
2414
|
-
if (plugin.pre) {
|
|
2415
|
-
const isValid = plugin.pre.every((pluginName2) => plugins.find((pluginToFind) => pluginToFind.name === pluginName2));
|
|
2416
|
-
if (!isValid) {
|
|
2417
|
-
throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
return plugin;
|
|
2421
|
-
}).sort((a, b) => {
|
|
2422
|
-
if (_optionalChain([b, 'access', _52 => _52.pre, 'optionalAccess', _53 => _53.includes, 'call', _54 => _54(a.name)])) {
|
|
2423
|
-
return 1;
|
|
2424
|
-
}
|
|
2425
|
-
if (_optionalChain([b, 'access', _55 => _55.post, 'optionalAccess', _56 => _56.includes, 'call', _57 => _57(a.name)])) {
|
|
2426
|
-
return -1;
|
|
2427
|
-
}
|
|
2428
|
-
return 0;
|
|
2429
|
-
});
|
|
2430
|
-
};
|
|
2431
|
-
_addExecutedToCallStack = new WeakSet();
|
|
2432
|
-
addExecutedToCallStack_fn = function(executer) {
|
|
2433
|
-
if (executer) {
|
|
2434
|
-
this.events.emit("executed", executer);
|
|
2435
|
-
this.executed.push(executer);
|
|
2436
|
-
}
|
|
2437
|
-
};
|
|
2438
|
-
_execute = new WeakSet();
|
|
2439
|
-
execute_fn = function({
|
|
2440
|
-
strategy,
|
|
2441
|
-
hookName,
|
|
2442
|
-
parameters,
|
|
2443
|
-
plugin
|
|
2444
|
-
}) {
|
|
2445
|
-
const hook = plugin[hookName];
|
|
2446
|
-
let output;
|
|
2447
|
-
if (!hook) {
|
|
2448
|
-
return null;
|
|
2449
|
-
}
|
|
2450
|
-
this.events.emit("execute", { strategy, hookName, parameters, plugin });
|
|
2451
|
-
const task = Promise.resolve().then(() => {
|
|
2452
|
-
if (typeof hook === "function") {
|
|
2453
|
-
const possiblePromiseResult = hook.apply({ ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, plugin }, parameters);
|
|
2454
|
-
if (isPromise(possiblePromiseResult)) {
|
|
2455
|
-
return Promise.resolve(possiblePromiseResult);
|
|
2456
|
-
}
|
|
2457
|
-
return possiblePromiseResult;
|
|
2458
|
-
}
|
|
2459
|
-
return hook;
|
|
2460
|
-
}).then((result) => {
|
|
2461
|
-
output = result;
|
|
2462
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
|
|
2463
|
-
parameters,
|
|
2464
|
-
output,
|
|
2465
|
-
strategy,
|
|
2466
|
-
hookName,
|
|
2467
|
-
plugin
|
|
2468
|
-
});
|
|
2469
|
-
return result;
|
|
2470
|
-
}).catch((e) => {
|
|
2471
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, e, plugin, hookName);
|
|
2472
|
-
return null;
|
|
2473
|
-
});
|
|
2474
|
-
return task;
|
|
2475
|
-
};
|
|
2476
|
-
_executeSync = new WeakSet();
|
|
2477
|
-
executeSync_fn = function({
|
|
2478
|
-
strategy,
|
|
2479
|
-
hookName,
|
|
2480
|
-
parameters,
|
|
2481
|
-
plugin
|
|
2482
|
-
}) {
|
|
2483
|
-
const hook = plugin[hookName];
|
|
2484
|
-
let output;
|
|
2485
|
-
if (!hook) {
|
|
2486
|
-
return null;
|
|
2487
|
-
}
|
|
2488
|
-
this.events.emit("execute", { strategy, hookName, parameters, plugin });
|
|
2489
|
-
try {
|
|
2490
|
-
if (typeof hook === "function") {
|
|
2491
|
-
const fn = hook.apply({ ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, plugin }, parameters);
|
|
2492
|
-
output = fn;
|
|
2493
|
-
return fn;
|
|
2494
|
-
}
|
|
2495
|
-
output = hook;
|
|
2496
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
|
|
2497
|
-
parameters,
|
|
2498
|
-
output,
|
|
2499
|
-
strategy,
|
|
2500
|
-
hookName,
|
|
2501
|
-
plugin
|
|
2502
|
-
});
|
|
2503
|
-
return hook;
|
|
2504
|
-
} catch (e) {
|
|
2505
|
-
_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, e, plugin, hookName);
|
|
2506
|
-
return null;
|
|
2507
|
-
}
|
|
2508
|
-
};
|
|
2509
|
-
_catcher = new WeakSet();
|
|
2510
|
-
catcher_fn = function(cause, plugin, hookName) {
|
|
2511
|
-
const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess', _58 => _58.name]) || "unknown"}, hook: ${hookName || "unknown"})`;
|
|
2512
|
-
this.logger.emit("error", text, cause);
|
|
2513
|
-
this.events.emit("error", cause);
|
|
2514
|
-
};
|
|
2515
|
-
_parse = new WeakSet();
|
|
2516
|
-
parse_fn = function(plugin, pluginManager, context) {
|
|
2517
|
-
const usedPluginNames = _chunk4TB6NGOCcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
|
|
2518
|
-
_chunkUUBXTHJGcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
|
|
2519
|
-
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
2520
|
-
if (!plugin.transform) {
|
|
2521
|
-
plugin.transform = function transform(code) {
|
|
2522
|
-
return code;
|
|
2523
|
-
};
|
|
2524
|
-
}
|
|
2525
|
-
if (plugin.api && typeof plugin.api === "function") {
|
|
2526
|
-
const api = plugin.api.call(context);
|
|
2527
|
-
return {
|
|
2528
|
-
...plugin,
|
|
2529
|
-
key,
|
|
2530
|
-
api
|
|
2531
|
-
};
|
|
2532
|
-
}
|
|
2533
|
-
return {
|
|
2534
|
-
...plugin,
|
|
2535
|
-
key
|
|
2536
|
-
};
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
exports.KubbFile = KubbFile; exports.FileManager = FileManager; exports.Warning = Warning; exports.createPlugin = createPlugin; exports.pluginName = pluginName; exports.PromiseManager = PromiseManager; exports.isPromise = isPromise; exports.PluginManager = PluginManager;
|
|
2549
|
-
//# sourceMappingURL=chunk-UIWHEBZA.cjs.map
|