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