@kubb/core 2.4.1 → 2.5.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-OYDUQYAK.cjs → chunk-3J25BT5A.cjs} +15 -41
- package/dist/chunk-3J25BT5A.cjs.map +1 -0
- package/dist/{chunk-HI4PB2AG.js → chunk-DJBEBMX6.js} +10 -36
- package/dist/chunk-DJBEBMX6.js.map +1 -0
- package/dist/{chunk-JSJ3NRBQ.cjs → chunk-SSD2TXQZ.cjs} +51 -32
- package/dist/chunk-SSD2TXQZ.cjs.map +1 -0
- package/dist/{chunk-V6AVJEQC.js → chunk-W3NDP3K4.js} +52 -34
- package/dist/chunk-W3NDP3K4.js.map +1 -0
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -56
- package/dist/index.d.ts +54 -56
- package/dist/index.js +17 -18
- package/dist/index.js.map +1 -1
- package/dist/logger-wryz32Ex.d.cts +44 -0
- package/dist/logger-wryz32Ex.d.ts +44 -0
- package/dist/logger.cjs +5 -5
- package/dist/logger.d.cts +2 -32
- package/dist/logger.d.ts +2 -32
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +5 -11
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +5 -11
- package/dist/mocks.js.map +1 -1
- package/package.json +3 -3
- package/src/FileManager.ts +2 -2
- package/src/PluginManager.ts +39 -39
- package/src/build.ts +11 -13
- package/src/config.ts +5 -5
- package/src/index.ts +3 -15
- package/src/kubb.ts +11 -0
- package/src/logger.ts +37 -37
- package/src/plugin.ts +5 -5
- package/src/types.ts +23 -23
- package/dist/chunk-HI4PB2AG.js.map +0 -1
- package/dist/chunk-JSJ3NRBQ.cjs.map +0 -1
- package/dist/chunk-OYDUQYAK.cjs.map +0 -1
- package/dist/chunk-V6AVJEQC.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { transformReservedWord, trimExtName, searchAndReplace } from './chunk-GKW5TTFV.js';
|
|
2
2
|
import { setUniqueName } from './chunk-YW33IVCC.js';
|
|
3
|
-
import { LogLevel } from './chunk-
|
|
3
|
+
import { EventEmitter, LogLevel } from './chunk-W3NDP3K4.js';
|
|
4
4
|
import { read, getRelativePath } from './chunk-YUTCMBUY.js';
|
|
5
5
|
import { write } from './chunk-MYC5HIA5.js';
|
|
6
6
|
import { __commonJS, init_esm_shims, __toESM, __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-ETA3LCRB.js';
|
|
@@ -11,7 +11,6 @@ import * as factory from '@kubb/parser/factory';
|
|
|
11
11
|
import { orderBy } from 'natural-orderby';
|
|
12
12
|
import PQueue from 'p-queue';
|
|
13
13
|
import dirTree from 'directory-tree';
|
|
14
|
-
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
15
14
|
|
|
16
15
|
// ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
|
|
17
16
|
var require_lodash = __commonJS({
|
|
@@ -1386,31 +1385,6 @@ function isPromiseRejectedResult(result) {
|
|
|
1386
1385
|
|
|
1387
1386
|
// src/PluginManager.ts
|
|
1388
1387
|
init_esm_shims();
|
|
1389
|
-
|
|
1390
|
-
// src/utils/EventEmitter.ts
|
|
1391
|
-
init_esm_shims();
|
|
1392
|
-
var _emitter;
|
|
1393
|
-
var EventEmitter = class {
|
|
1394
|
-
constructor() {
|
|
1395
|
-
__privateAdd(this, _emitter, new EventEmitter$1());
|
|
1396
|
-
__privateGet(this, _emitter).setMaxListeners(100);
|
|
1397
|
-
}
|
|
1398
|
-
emit(eventName, ...eventArg) {
|
|
1399
|
-
__privateGet(this, _emitter).emit(eventName, ...eventArg);
|
|
1400
|
-
}
|
|
1401
|
-
on(eventName, handler) {
|
|
1402
|
-
__privateGet(this, _emitter).on(eventName, handler);
|
|
1403
|
-
}
|
|
1404
|
-
off(eventName, handler) {
|
|
1405
|
-
__privateGet(this, _emitter).off(eventName, handler);
|
|
1406
|
-
}
|
|
1407
|
-
removeAll() {
|
|
1408
|
-
__privateGet(this, _emitter).removeAllListeners();
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
_emitter = new WeakMap();
|
|
1412
|
-
|
|
1413
|
-
// src/PluginManager.ts
|
|
1414
1388
|
var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
|
|
1415
1389
|
var PluginManager = class {
|
|
1416
1390
|
constructor(config, options) {
|
|
@@ -1447,14 +1421,14 @@ var PluginManager = class {
|
|
|
1447
1421
|
parameters: [params.baseName, params.directory, params.options]
|
|
1448
1422
|
});
|
|
1449
1423
|
if (paths && paths?.length > 1 && this.logger.logLevel === LogLevel.debug) {
|
|
1450
|
-
this.logger.debug
|
|
1424
|
+
this.logger.emit("debug", [
|
|
1451
1425
|
`Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
1452
1426
|
|
|
1453
1427
|
Paths: ${JSON.stringify(paths, void 0, 2)}
|
|
1454
1428
|
|
|
1455
1429
|
Falling back on the first item.
|
|
1456
1430
|
`
|
|
1457
|
-
);
|
|
1431
|
+
]);
|
|
1458
1432
|
}
|
|
1459
1433
|
return paths?.at(0);
|
|
1460
1434
|
}
|
|
@@ -1471,14 +1445,14 @@ Falling back on the first item.
|
|
|
1471
1445
|
parameters: [params.name, params.type]
|
|
1472
1446
|
});
|
|
1473
1447
|
if (names && names?.length > 1 && this.logger.logLevel === LogLevel.debug) {
|
|
1474
|
-
this.logger.debug
|
|
1448
|
+
this.logger.emit("debug", [
|
|
1475
1449
|
`Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
1476
1450
|
|
|
1477
1451
|
Names: ${JSON.stringify(names, void 0, 2)}
|
|
1478
1452
|
|
|
1479
1453
|
Falling back on the first item.
|
|
1480
1454
|
`
|
|
1481
|
-
);
|
|
1455
|
+
]);
|
|
1482
1456
|
}
|
|
1483
1457
|
return transformReservedWord(names?.at(0) || params.name);
|
|
1484
1458
|
}
|
|
@@ -1680,9 +1654,9 @@ Falling back on the first item.
|
|
|
1680
1654
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
1681
1655
|
if (this.logger.logLevel === LogLevel.debug) {
|
|
1682
1656
|
if (corePlugin) {
|
|
1683
|
-
this.logger.debug
|
|
1657
|
+
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
|
|
1684
1658
|
} else {
|
|
1685
|
-
this.logger.debug
|
|
1659
|
+
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
|
|
1686
1660
|
}
|
|
1687
1661
|
}
|
|
1688
1662
|
return corePlugin ? [corePlugin] : [];
|
|
@@ -1719,7 +1693,7 @@ getSortedPlugins_fn = function(hookName) {
|
|
|
1719
1693
|
if (this.logger.logLevel === LogLevel.info) {
|
|
1720
1694
|
const containsHookName = plugins.some((item) => item[hookName]);
|
|
1721
1695
|
if (!containsHookName) {
|
|
1722
|
-
this.logger.
|
|
1696
|
+
this.logger.emit("warning", `No hook ${hookName} found`);
|
|
1723
1697
|
}
|
|
1724
1698
|
}
|
|
1725
1699
|
return plugins.filter((item) => item[hookName]);
|
|
@@ -1824,7 +1798,7 @@ _catcher = new WeakSet();
|
|
|
1824
1798
|
catcher_fn = function(e, plugin, hookName) {
|
|
1825
1799
|
const text = `${e.message} (plugin: ${plugin?.name || "unknown"}, hook: ${hookName || "unknown"})
|
|
1826
1800
|
`;
|
|
1827
|
-
this.logger.error
|
|
1801
|
+
this.logger.emit("error", text);
|
|
1828
1802
|
this.events.emit("error", e);
|
|
1829
1803
|
};
|
|
1830
1804
|
_parse = new WeakSet();
|
|
@@ -1853,4 +1827,4 @@ parse_fn = function(plugin, pluginManager, context) {
|
|
|
1853
1827
|
|
|
1854
1828
|
export { FileManager, KubbFile, PluginManager, PromiseManager, Warning, createPlugin, isPromise, pluginName };
|
|
1855
1829
|
//# sourceMappingURL=out.js.map
|
|
1856
|
-
//# sourceMappingURL=chunk-
|
|
1830
|
+
//# sourceMappingURL=chunk-DJBEBMX6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js","../src/FileManager.ts","../src/BarrelManager.ts","../src/utils/TreeNode.ts","../src/errors.ts","../src/plugin.ts","../src/utils/cache.ts","../src/PromiseManager.ts","../src/utils/executeStrategies.ts","../src/PluginManager.ts"],"names":["Map","Promise","Set","WeakMap","othValue","isEqual","path","treeNode","KubbFile","name","factory","_options","PQueue","pluginName","plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAUA,QAAI,mBAAmB;AAGvB,QAAI,iBAAiB;AAGrB,QAAI,uBAAuB;AAA3B,QACI,yBAAyB;AAG7B,QAAI,mBAAmB;AAGvB,QAAI,UAAU;AAAd,QACI,WAAW;AADf,QAEI,WAAW;AAFf,QAGI,UAAU;AAHd,QAII,UAAU;AAJd,QAKI,WAAW;AALf,QAMI,UAAU;AANd,QAOI,SAAS;AAPb,QAQI,SAAS;AARb,QASI,YAAY;AAThB,QAUI,UAAU;AAVd,QAWI,YAAY;AAXhB,QAYI,aAAa;AAZjB,QAaI,WAAW;AAbf,QAcI,YAAY;AAdhB,QAeI,SAAS;AAfb,QAgBI,YAAY;AAhBhB,QAiBI,YAAY;AAjBhB,QAkBI,eAAe;AAlBnB,QAmBI,aAAa;AAEjB,QAAI,iBAAiB;AAArB,QACI,cAAc;AADlB,QAEI,aAAa;AAFjB,Q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EtC,gBAAc,OAAO,MAAM,eAAe;AAE1C,QAAM,MAAM,CAAC,OAAO,MAAM,gBAAgB,OAAO,IAAI,CAAC,EAAE,OAAO,OAAO;AAGtE,MAAI,CAAC,OAAO,WAAW;AACrB,WAAO,YAAY,SAAS,UAAU,MAAM;AAC1C,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,OAAO,OAAO,OAAO,OAAO,QAAQ,YAAY;AAClD,UAAM,MAAO,OAAO,IAAiB,KAAK,OAAO;AAEjD,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF","sourcesContent":["/**\n * Lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\n/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = isEqual;\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport crypto from 'node:crypto'\nimport { extname, resolve } from 'node:path'\n\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\n\nimport isEqual from 'lodash.isequal'\nimport { orderBy } from 'natural-orderby'\nimport PQueue from 'p-queue'\n\nimport { getRelativePath, read } from './fs/read.ts'\nimport { write } from './fs/write.ts'\nimport { searchAndReplace } from './transformers/searchAndReplace.ts'\nimport { trimExtName } from './transformers/trim.ts'\nimport { BarrelManager } from './BarrelManager.ts'\n\nimport type { GreaterThan } from '@kubb/types'\nimport type { BarrelManagerOptions } from './BarrelManager.ts'\nimport type { Plugin } from './types.ts'\n\ntype BasePath<T extends string = string> = `${T}/`\n\nexport namespace KubbFile {\n export type Import = {\n /**\n * Import name to be used\n * @example [\"useState\"]\n * @example \"React\"\n */\n name:\n | string\n | Array<\n string | {\n propertyName: string\n name?: string\n }\n >\n /**\n * Path for the import\n * @xample '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Add `* as` prefix to the import, this will result in: `import * as path from './path'`.\n */\n isNameSpace?: boolean\n /**\n * When root is set it will get the path with relative getRelativePath(root, path).\n */\n root?: string\n }\n\n export type Export = {\n /**\n * Export name to be used.\n * @example [\"useState\"]\n * @example \"React\"\n */\n name?: string | Array<string>\n /**\n * Path for the import.\n * @xample '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.\n */\n asAlias?: boolean\n }\n\n export declare const dataTagSymbol: unique symbol\n export type DataTag<Type, Value> = Type & {\n [dataTagSymbol]: Value\n }\n\n export type UUID = string\n export type Source = string\n\n export type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\n export type Mode = 'file' | 'directory'\n\n /**\n * Name to be used to dynamicly create the baseName(based on input.path)\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n export type BaseName = `${string}${Extname}`\n\n /**\n * Path will be full qualified path to a specified file\n */\n export type Path = string\n\n export type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`\n\n export type OptionalPath = Path | undefined | null\n\n export type FileMetaBase = {\n pluginKey?: Plugin['key']\n }\n\n export type File<\n TMeta extends FileMetaBase = FileMetaBase,\n TBaseName extends BaseName = BaseName,\n > = {\n /**\n * Unique identifier to reuse later\n * @default crypto.randomUUID()\n */\n id?: string\n /**\n * Name to be used to create the path\n * Based on UNIX basename, `${name}.extName`\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: TBaseName\n /**\n * Path will be full qualified path to a specified file\n */\n path: AdvancedPath<TBaseName> | Path\n source: Source\n imports?: Import[]\n exports?: Export[]\n /**\n * This will call fileManager.add instead of fileManager.addOrAppend, adding the source when the files already exists\n * This will also ignore the combinefiles utils\n * @default `false`\n */\n override?: boolean\n /**\n * Use extra meta, this is getting used to generate the barrel/index files.\n */\n meta?: TMeta\n /**\n * This will override `process.env[key]` inside the `source`, see `getFileSource`.\n */\n env?: NodeJS.ProcessEnv\n }\n\n export type ResolvedFile<\n TMeta extends FileMetaBase = FileMetaBase,\n TBaseName extends BaseName = BaseName,\n > = KubbFile.File<TMeta, TBaseName> & {\n /**\n * @default crypto.randomUUID()\n */\n id: UUID\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n\n name: string\n }\n}\n\ntype CacheItem = KubbFile.ResolvedFile & {\n cancel?: () => void\n}\n\ntype AddResult<T extends Array<KubbFile.File>> = Promise<\n Awaited<GreaterThan<T['length'], 1> extends true ? Promise<KubbFile.ResolvedFile[]> : Promise<KubbFile.ResolvedFile>>\n>\n\ntype AddIndexesProps = {\n /**\n * Root based on root and output.path specified in the config\n */\n root: string\n /**\n * Output for plugin\n */\n output: {\n path: string\n exportAs?: string\n extName?: KubbFile.Extname\n exportType?: 'barrel' | 'barrelNamed' | false\n }\n options?: BarrelManagerOptions\n meta?: KubbFile.File['meta']\n}\n\ntype Options = {\n queue?: PQueue\n task?: (file: KubbFile.ResolvedFile) => Promise<KubbFile.ResolvedFile>\n}\n\nexport class FileManager {\n #cache: Map<KubbFile.Path, CacheItem[]> = new Map()\n\n #task: Options['task']\n #queue: PQueue\n\n constructor({ task = async (file) => file, queue = new PQueue() }: Options = {}) {\n this.#task = task\n this.#queue = queue\n\n return this\n }\n\n get files(): Array<KubbFile.File> {\n const files: Array<KubbFile.File> = []\n this.#cache.forEach((item) => {\n files.push(...item.flat(1))\n })\n\n return files\n }\n get isExecuting(): boolean {\n return this.#queue.size !== 0 && this.#queue.pending !== 0\n }\n\n async add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(\n ...files: T\n ): AddResult<T> {\n const promises = combineFiles(files).map((file) => {\n if (file.override) {\n return this.#add(file)\n }\n\n return this.#addOrAppend(file)\n })\n\n const resolvedFiles = await Promise.all(promises)\n\n if (files.length > 1) {\n return resolvedFiles as unknown as AddResult<T>\n }\n\n return resolvedFiles[0] as unknown as AddResult<T>\n }\n\n async #add(file: KubbFile.File): Promise<KubbFile.ResolvedFile> {\n const controller = new AbortController()\n const resolvedFile: KubbFile.ResolvedFile = { id: crypto.randomUUID(), name: trimExtName(file.baseName), ...file }\n\n this.#cache.set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }])\n\n return this.#queue.add(\n async () => {\n return this.#task?.(resolvedFile)\n },\n { signal: controller.signal },\n ) as Promise<KubbFile.ResolvedFile>\n }\n\n async #addOrAppend(file: KubbFile.File): Promise<KubbFile.ResolvedFile> {\n const previousCaches = this.#cache.get(file.path)\n const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : undefined\n\n if (previousCache) {\n this.#cache.delete(previousCache.path)\n\n return this.#add({\n ...file,\n source: previousCache.source && file.source ? `${previousCache.source}\\n${file.source}` : '',\n imports: [...(previousCache.imports || []), ...(file.imports || [])],\n exports: [...(previousCache.exports || []), ...(file.exports || [])],\n env: { ...(previousCache.env || {}), ...(file.env || {}) },\n })\n }\n return this.#add(file)\n }\n\n async addIndexes({ root, output, meta, options = {} }: AddIndexesProps): Promise<void> {\n const { exportType = 'barrel' } = output\n\n if (exportType === false) {\n return undefined\n }\n\n const pathToBuildFrom = resolve(root, output.path)\n const exportPath = output.path.startsWith('./') ? trimExtName(output.path) : `./${trimExtName(output.path)}`\n const mode = FileManager.getMode(output.path)\n const barrelManager = new BarrelManager({ extName: output.extName, ...options })\n let files = barrelManager.getIndexes(pathToBuildFrom)\n\n if (!files) {\n return undefined\n }\n\n if (exportType === 'barrelNamed') {\n files = files.map(file => {\n if (file.exports) {\n return {\n ...file,\n exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports),\n }\n }\n return file\n })\n }\n\n await Promise.all(\n files.map((file) => {\n return this.#addOrAppend({\n ...file,\n meta: meta ? meta : file.meta,\n })\n }),\n )\n\n const rootPath = mode === 'directory' ? `${exportPath}/index${output.extName || ''}` : `${exportPath}${output.extName || ''}`\n const rootFile: KubbFile.File = {\n path: resolve(root, 'index.ts'),\n baseName: 'index.ts',\n source: '',\n exports: [\n output.exportAs\n ? {\n name: output.exportAs,\n asAlias: true,\n path: rootPath,\n isTypeOnly: options.isTypeOnly,\n }\n : {\n path: rootPath,\n isTypeOnly: options.isTypeOnly,\n },\n ],\n }\n\n if (exportType === 'barrelNamed' && !output.exportAs && rootFile.exports?.[0]) {\n rootFile.exports = barrelManager.getNamedExport(root, rootFile.exports[0])\n }\n\n await this.#addOrAppend({\n ...rootFile,\n meta: meta ? meta : rootFile.meta,\n })\n }\n\n getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined {\n let cache: KubbFile.File | undefined\n\n this.#cache.forEach((files) => {\n cache = files.find((item) => item.id === UUID)\n })\n return cache\n }\n\n get(path: KubbFile.Path): Array<KubbFile.File> | undefined {\n return this.#cache.get(path)\n }\n\n remove(path: KubbFile.Path): void {\n const cacheItem = this.get(path)\n if (!cacheItem) {\n return\n }\n\n this.#cache.delete(path)\n }\n\n async write(...params: Parameters<typeof write>): Promise<string | undefined> {\n return write(...params)\n }\n\n async read(...params: Parameters<typeof read>): Promise<string> {\n return read(...params)\n }\n\n // statics\n\n static getSource<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(file: KubbFile.File<TMeta>): string {\n return getSource<TMeta>(file)\n }\n\n static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>> {\n return combineFiles<TMeta>(files)\n }\n static getMode(path: string | undefined | null): KubbFile.Mode {\n if (!path) {\n return 'directory'\n }\n return extname(path) ? 'file' : 'directory'\n }\n\n static get extensions(): Array<KubbFile.Extname> {\n return ['.js', '.ts', '.tsx']\n }\n\n static isExtensionAllowed(baseName: string): boolean {\n return FileManager.extensions.some((extension) => baseName.endsWith(extension))\n }\n}\n\nfunction combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(\n files: Array<KubbFile.File<TMeta> | null>,\n): Array<KubbFile.File<TMeta>> {\n return files.filter(Boolean).reduce((acc, file: KubbFile.File<TMeta>) => {\n const prevIndex = acc.findIndex((item) => item.path === file.path)\n\n if (prevIndex === -1) {\n return [...acc, file]\n }\n\n const prev = acc[prevIndex]\n\n if (prev && file.override) {\n acc[prevIndex] = {\n imports: [],\n exports: [],\n ...file,\n }\n return acc\n }\n\n if (prev) {\n acc[prevIndex] = {\n ...file,\n source: prev.source && file.source ? `${prev.source}\\n${file.source}` : '',\n imports: [...(prev.imports || []), ...(file.imports || [])],\n exports: [...(prev.exports || []), ...(file.exports || [])],\n env: { ...(prev.env || {}), ...(file.env || {}) },\n }\n }\n\n return acc\n }, [] as Array<KubbFile.File<TMeta>>)\n}\n\nexport function getSource<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(file: KubbFile.File<TMeta>): string {\n if (!FileManager.isExtensionAllowed(file.baseName)) {\n return file.source\n }\n\n const exports = file.exports ? combineExports(file.exports) : []\n const imports = file.imports ? combineImports(file.imports, exports, file.source) : []\n\n const importNodes = imports.filter(item => {\n // isImportNotNeeded\n // trim extName\n return item.path !== trimExtName(file.path)\n }).map((item) => {\n return factory.createImportDeclaration({\n name: item.name,\n path: item.root ? getRelativePath(item.root, item.path) : item.path,\n isTypeOnly: item.isTypeOnly,\n })\n })\n const exportNodes = exports.map((item) =>\n factory.createExportDeclaration({\n name: item.name,\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n })\n )\n\n return [print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join('\\n')\n}\n\nexport function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export> {\n const combinedExports = orderBy(exports, [(v) => !v.isTypeOnly], ['asc']).reduce((prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (export type ...)\n return prev\n }\n\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n\n return prev\n }\n\n return [...prev, curr]\n }, [] as Array<KubbFile.Export>)\n\n return orderBy(combinedExports, [(v) => !v.isTypeOnly, (v) => v.asAlias], ['desc', 'desc'])\n}\n\nexport function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import> {\n const combinedImports = orderBy(imports, [(v) => !v.isTypeOnly], ['asc']).reduce((prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n const hasImportInSource = (importName: string) => {\n if (!source) {\n return true\n }\n\n const checker = (name?: string) => name && !!source.includes(name)\n return checker(importName) || exports.some(({ name }) => (Array.isArray(name) ? name.some(checker) : checker(name)))\n }\n\n if (Array.isArray(name)) {\n name = name.filter((item) => typeof item === 'string' ? hasImportInSource(item) : hasImportInSource(item.propertyName))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathNameAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (import type ...)\n return prev\n }\n\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n }, [] as Array<KubbFile.Import>)\n\n return orderBy(combinedImports, [(v) => !v.isTypeOnly], ['desc'])\n}\n\nfunction getEnvSource(source: string, env: NodeJS.ProcessEnv | undefined): string {\n if (!env) {\n return source\n }\n\n const keys = Object.keys(env)\n\n if (!keys.length) {\n return source\n }\n\n return keys.reduce((prev, key: string) => {\n const environmentValue = env[key]\n const replaceBy = environmentValue ? `'${environmentValue.replaceAll('\"', '')?.replaceAll(\"'\", '')}'` : 'undefined'\n\n if (key.toUpperCase() !== key) {\n throw new TypeError(`Environment should be in upperCase for ${key}`)\n }\n\n if (typeof replaceBy === 'string') {\n prev = searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: 'process.env', key })\n // removes `declare const ...`\n prev = searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*\\n`, 'ig'), ''), replaceBy, key })\n }\n\n return prev\n }, source)\n}\n","import { getExports } from '@kubb/parser'\n\nimport path from 'path'\n\nimport { trimExtName } from './transformers/trim.ts'\nimport { TreeNode } from './utils/TreeNode.ts'\n\nimport type { DirectoryTreeOptions } from 'directory-tree'\nimport type { KubbFile } from './FileManager.ts'\n\nexport type BarrelManagerOptions = {\n treeNode?: DirectoryTreeOptions\n isTypeOnly?: boolean\n /**\n * Add .ts or .js\n */\n extName?: KubbFile.Extname\n}\n\nexport class BarrelManager {\n #options: BarrelManagerOptions\n\n constructor(options: BarrelManagerOptions = {}) {\n this.#options = options\n\n return this\n }\n\n getNamedExport(root: string, item: KubbFile.Export): KubbFile.Export[] {\n const exportedNames = getExports(path.resolve(root, item.path))\n\n if (!exportedNames) {\n return [item]\n }\n\n return exportedNames.reduce((prev, curr) => {\n if (!prev[0]?.name || !prev[1]?.name) {\n return prev\n }\n\n if (curr.isTypeOnly) {\n prev[1] = { ...prev[1], name: [...prev[1].name, curr.name] }\n } else {\n prev[0] = { ...prev[0], name: [...prev[0].name, curr.name] }\n }\n\n return prev\n }, [{\n ...item,\n name: [],\n isTypeOnly: false,\n }, {\n ...item,\n name: [],\n isTypeOnly: true,\n }] as KubbFile.Export[])\n }\n\n getNamedExports(root: string, exports: KubbFile.Export[]): KubbFile.Export[] {\n return exports?.map(item => {\n return this.getNamedExport(root, item)\n }).flat()\n }\n\n getIndexes(\n root: string,\n ): Array<KubbFile.File> | null {\n const { treeNode = {}, isTypeOnly, extName } = this.#options\n const tree = TreeNode.build(root, treeNode)\n\n if (!tree) {\n return null\n }\n\n const fileReducer = (files: Array<KubbFile.File>, treeNode: TreeNode) => {\n if (!treeNode.children) {\n return []\n }\n\n if (treeNode.children.length > 1) {\n const indexPath: KubbFile.Path = path.resolve(treeNode.data.path, 'index.ts')\n\n const exports: Array<KubbFile.Export> = treeNode.children\n .filter(Boolean)\n .map((file) => {\n const importPath: string = file.data.type === 'directory' ? `./${file.data.name}/index` : `./${trimExtName(file.data.name)}`\n\n if (importPath.endsWith('index') && file.data.type === 'file') {\n return undefined\n }\n\n return {\n path: extName ? `${importPath}${extName}` : importPath,\n isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n\n files.push({\n path: indexPath,\n baseName: 'index.ts',\n source: '',\n exports,\n })\n } else if (treeNode.children.length === 1) {\n const [treeNodeChild] = treeNode.children as [TreeNode]\n\n const indexPath = path.resolve(treeNode.data.path, 'index.ts')\n const importPath = treeNodeChild.data.type === 'directory'\n ? `./${treeNodeChild.data.name}/index`\n : `./${trimExtName(treeNodeChild.data.name)}`\n\n const exports = [\n {\n path: extName\n ? `${importPath}${extName}`\n : importPath,\n isTypeOnly,\n },\n ]\n\n files.push({\n path: indexPath,\n baseName: 'index.ts',\n source: '',\n exports,\n })\n }\n\n treeNode.children.forEach((childItem) => {\n fileReducer(files, childItem)\n })\n\n return files\n }\n\n return fileReducer([], tree).reverse()\n }\n}\n","import dirTree from 'directory-tree'\n\nimport { FileManager } from '../FileManager.ts'\n\nimport type { DirectoryTree, DirectoryTreeOptions } from 'directory-tree'\nimport type { KubbFile } from '../FileManager.ts'\n\nexport type TreeNodeOptions = DirectoryTreeOptions\n\ntype BarrelData = { type: KubbFile.Mode; path: KubbFile.Path; name: string }\n\nexport class TreeNode<T = BarrelData> {\n public data: T\n\n public parent?: TreeNode<T>\n\n public children: Array<TreeNode<T>> = []\n\n constructor(data: T, parent?: TreeNode<T>) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: T): TreeNode<T> {\n const child = new TreeNode(data, this)\n if (!this.children) {\n this.children = []\n }\n this.children.push(child)\n return child\n }\n\n find(data?: T): TreeNode<T> | null {\n if (!data) {\n return null\n }\n\n if (data === this.data) {\n return this\n }\n\n if (this.children?.length) {\n for (let i = 0, { length } = this.children, target: TreeNode<T> | null = null; i < length; i++) {\n target = this.children[i]!.find(data)\n if (target) {\n return target\n }\n }\n }\n\n return null\n }\n\n get leaves(): TreeNode<T>[] {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode<T>[] = []\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n // eslint-disable-next-line prefer-spread\n leaves.push.apply(leaves, this.children[i]!.leaves)\n }\n }\n return leaves\n }\n\n get root(): TreeNode<T> {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n forEach(callback: (treeNode: TreeNode<T>) => void): this {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n callback(this)\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n this.children[i]!.forEach(callback)\n }\n }\n\n return this\n }\n\n public static build(path: string, options: TreeNodeOptions = {}): TreeNode | null {\n try {\n const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean)\n const filteredTree = dirTree(path, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] })\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({ name: filteredTree.name, path: filteredTree.path, type: filteredTree.type || FileManager.getMode(filteredTree.path) })\n\n const recurse = (node: typeof treeNode, item: DirectoryTree) => {\n const subNode = node.addChild({ name: item.name, path: item.path, type: item.type || FileManager.getMode(item.path) })\n\n if (item.children?.length) {\n item.children?.forEach((child) => {\n recurse(subNode, child)\n })\n }\n }\n\n filteredTree.children?.forEach((child) => recurse(treeNode, child))\n\n return treeNode\n } catch (e) {\n throw new Error('Something went wrong with creating index files with the TreehNode class', { cause: e })\n }\n }\n}\n","/**\n * Behaves as an Error to log a warning in the console(still stops the execution)\n */\nexport class Warning extends Error {\n constructor(message?: string, options?: { cause: Error }) {\n super(message, { cause: options?.cause })\n\n this.name = 'Warning'\n }\n}\n\nexport class ValidationPluginError extends Error {}\n","import path from 'node:path'\n\nimport { createPluginCache } from './utils/cache.ts'\n\nimport type { FileManager } from './FileManager.ts'\nimport type { PluginManager } from './PluginManager.ts'\nimport type { Plugin, PluginContext, PluginFactoryOptions, UserPluginWithLifeCycle } from './types.ts'\n\ntype PluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>\n\nexport function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: PluginFactory<T>) {\n return (options: T['options']): ReturnType<PluginFactory<T>> => {\n return factory(options)\n }\n}\n\ntype Options = {\n config: PluginContext['config']\n fileManager: FileManager\n pluginManager: PluginManager\n resolvePath: PluginContext['resolvePath']\n resolveName: PluginContext['resolveName']\n logger: PluginContext['logger']\n getPlugins: () => Array<Plugin>\n plugin?: PluginContext['plugin']\n}\n\n// not publicly exported\nexport type CorePluginOptions = PluginFactoryOptions<'core', Options, Options, PluginContext, never>\n\nexport const pluginName = 'core' satisfies CorePluginOptions['name']\nexport const pluginKey: CorePluginOptions['key'] = [pluginName] satisfies CorePluginOptions['key']\n\nexport const definePlugin = createPlugin<CorePluginOptions>((options) => {\n const { fileManager, pluginManager, resolvePath, resolveName, logger } = options\n\n return {\n name: pluginName,\n options,\n key: ['core'],\n\n api() {\n return {\n get config() {\n return options.config\n },\n get plugins() {\n return options.getPlugins()\n },\n get plugin() {\n // see pluginManger.#execute where we override with `.call` the this with the correct plugin\n return options.plugin as NonNullable<Options['plugin']>\n },\n logger,\n fileManager,\n pluginManager,\n async addFile(...files) {\n const resolvedFiles = await fileManager.add(...files)\n\n if (!Array.isArray(resolvedFiles)) {\n return [resolvedFiles]\n }\n\n return resolvedFiles\n },\n resolvePath,\n resolveName,\n cache: createPluginCache(),\n }\n },\n resolvePath(baseName) {\n const root = path.resolve(this.config.root, this.config.output.path)\n\n return path.resolve(root, baseName)\n },\n resolveName(name) {\n return name\n },\n }\n})\n","import type { PluginCache } from '../types.ts'\n\nexport interface Cache<TStore extends object = object> {\n delete(id: keyof TStore): boolean\n get(id: keyof TStore): TStore[keyof TStore] | null\n has(id: keyof TStore): boolean\n set(id: keyof TStore, value: unknown): void\n}\n\nexport function createPluginCache<TStore extends PluginCache>(Store: TStore = Object.create(null) as TStore): Cache<TStore> {\n return {\n set(id, value): void {\n Store[id] = [0, value] as TStore[keyof TStore]\n },\n get(id): TStore[keyof TStore] | null {\n const item = Store[id]\n if (!item) {\n return null\n }\n item[0] = 0\n return item[1] as TStore[keyof TStore]\n },\n has(id): boolean {\n const item = Store[id]\n if (!item) {\n return false\n }\n item[0] = 0\n return true\n },\n delete(id: keyof TStore): boolean {\n return delete Store[id]\n },\n }\n}\n","import { hookFirst, hookParallel, hookSeq } from './utils/executeStrategies.ts'\n\nimport type { PossiblePromise } from '@kubb/types'\nimport type { Strategy, StrategySwitch } from './utils/executeStrategies.ts'\n\ntype PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2\n\ntype Options<TState = any> = {\n nullCheck?: (state: TState) => boolean\n}\n\nexport class PromiseManager<TState = any> {\n #options: Options<TState> = {}\n\n constructor(options: Options<TState> = {}) {\n this.#options = options\n\n return this\n }\n\n run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(\n strategy: TStrategy,\n promises: TInput,\n ): TOutput {\n if (strategy === 'seq') {\n return hookSeq<TInput, TValue, TOutput>(promises)\n }\n\n if (strategy === 'first') {\n return hookFirst<TInput, TValue, TOutput>(promises, this.#options.nullCheck)\n }\n\n if (strategy === 'parallel') {\n return hookParallel<TInput, TValue, TOutput>(promises)\n }\n\n throw new Error(`${strategy} not implemented`)\n }\n}\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","/* eslint-disable unused-imports/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-unused-vars */\ntype PromiseFunc<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2\n\nexport type ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc<infer X, infer Y>> ? X | Y : never\n\nexport function noReturn(): void {}\n\ntype SeqOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Array<Awaited<ValueOfPromiseFuncArray<TInput>>>\n\n/**\n * Chains promises\n */\nexport function hookSeq<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TOutput = SeqOutput<TInput, TValue>>(\n promises: TInput,\n): TOutput {\n return promises.filter(Boolean).reduce(\n (promise, func) => {\n if (typeof func !== 'function') {\n throw new Error('HookSeq needs a function that returns a promise `() => Promise<unknown>`')\n }\n\n return promise.then((state) => {\n const calledFunc = func(state as TValue)\n\n if (calledFunc) {\n return calledFunc.then(Array.prototype.concat.bind(state))\n }\n })\n },\n Promise.resolve([] as unknown),\n ) as TOutput\n}\n\ntype HookFirstOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>\n\n/**\n * Chains promises, first non-null result stops and returns\n */\nexport function hookFirst<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookFirstOutput<TInput, TValue>>(\n promises: TInput,\n nullCheck = (state: any) => state !== null,\n): TOutput {\n let promise: Promise<unknown> = Promise.resolve(null) as Promise<unknown>\n\n for (const func of promises.filter(Boolean)) {\n promise = promise.then((state) => {\n if (nullCheck(state)) {\n return state\n }\n\n const calledFunc = func(state as TValue)\n\n return calledFunc\n })\n }\n\n return promise as TOutput\n}\n\ntype HookParallelOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<PromiseSettledResult<Awaited<ValueOfPromiseFuncArray<TInput>>>[]>\n\n/**\n * Run promises in parallel with allSettled\n */\nexport function hookParallel<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookParallelOutput<TInput, TValue>>(\n promises: TInput,\n): TOutput {\n return Promise.allSettled(promises.filter(Boolean).map(promise => promise())) as TOutput\n}\n\nexport type Strategy = 'seq' | 'first' | 'parallel'\n\nexport type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc<TValue, null>>, TValue> = TStrategy extends 'first'\n ? HookFirstOutput<TInput, TValue>\n : TStrategy extends 'seq' ? SeqOutput<TInput, TValue>\n : TStrategy extends 'parallel' ? HookParallelOutput<TInput, TValue>\n : never\n\n// tests\n\ntype test = ValueOfPromiseFuncArray<Array<PromiseFunc<number, null>>>\n// ^?\n","/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/no-unsafe-argument */\n\nimport PQueue from 'p-queue'\n\nimport { transformReservedWord } from './transformers/transformReservedWord.ts'\nimport { EventEmitter } from './utils/EventEmitter.ts'\nimport { setUniqueName } from './utils/uniqueName.ts'\nimport { ValidationPluginError } from './errors.ts'\nimport { FileManager } from './FileManager.ts'\nimport { LogLevel } from './logger.ts'\nimport { definePlugin as defineCorePlugin } from './plugin.ts'\nimport { isPromise, isPromiseRejectedResult } from './PromiseManager.ts'\nimport { PromiseManager } from './PromiseManager.ts'\n\nimport type { PossiblePromise } from '@kubb/types'\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { CorePluginOptions } from './plugin.ts'\nimport type {\n Config,\n GetPluginFactoryOptions,\n Plugin,\n PluginFactoryOptions,\n PluginLifecycle,\n PluginLifecycleHooks,\n PluginParameter,\n PluginWithLifeCycle,\n ResolveNameParams,\n ResolvePathParams,\n UserPlugin,\n UserPluginWithLifeCycle,\n} from './types.ts'\n\ntype RequiredPluginLifecycle = Required<PluginLifecycle>\n\n/**\n * Get the type of the first argument in a function.\n * @example Arg0<(a: string, b: number) => void> -> string\n */\ntype Argument0<H extends keyof PluginLifecycle> = Parameters<RequiredPluginLifecycle[H]>[0]\n\ntype Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq'\n\ntype Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {\n strategy: Strategy\n hookName: H\n plugin: Plugin\n parameters?: unknown[] | undefined\n output?: unknown\n}\n\ntype ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H]\n\ntype SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {\n result: Result\n plugin: Plugin\n}\n\n// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#\n\ntype Options = {\n logger: Logger\n\n /**\n * Task for the FileManager\n */\n task: (file: KubbFile.ResolvedFile) => Promise<KubbFile.ResolvedFile>\n}\n\ntype Events = {\n execute: [executer: Executer]\n executed: [executer: Executer]\n error: [error: Error]\n}\n\nexport class PluginManager {\n readonly plugins: PluginWithLifeCycle[]\n readonly fileManager: FileManager\n readonly events: EventEmitter<Events> = new EventEmitter()\n\n readonly config: Config\n\n readonly executed: Array<Executer> = []\n readonly logger: Logger\n readonly #core: Plugin<CorePluginOptions>\n\n readonly #usedPluginNames: Record<string, number> = {}\n readonly #promiseManager: PromiseManager\n\n readonly queue: PQueue\n\n constructor(config: Config, options: Options) {\n this.config = config\n this.logger = options.logger\n this.queue = new PQueue({ concurrency: 1 })\n this.fileManager = new FileManager({ task: options.task, queue: this.queue })\n this.#promiseManager = new PromiseManager({ nullCheck: (state: SafeParseResult<'resolveName'> | null) => !!state?.result })\n\n const plugins = config.plugins || []\n\n const core = defineCorePlugin({\n config,\n logger: this.logger,\n pluginManager: this,\n fileManager: this.fileManager,\n resolvePath: this.resolvePath.bind(this),\n resolveName: this.resolveName.bind(this),\n getPlugins: this.#getSortedPlugins.bind(this),\n })\n\n // call core.api.call with empty context so we can transform `api()` to `api: {}`\n this.#core = this.#parse(core as unknown as UserPlugin, this as any, core.api.call(null as any)) as Plugin<CorePluginOptions>\n\n this.plugins = [this.#core, ...plugins].map((plugin) => {\n return this.#parse(plugin as UserPlugin, this, this.#core.api)\n })\n\n return this\n }\n\n resolvePath = <TOptions = object>(params: ResolvePathParams<TOptions>): KubbFile.OptionalPath => {\n if (params.pluginKey) {\n const paths = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolvePath',\n parameters: [params.baseName, params.directory, params.options as object],\n })\n\n if (paths && paths?.length > 1 && this.logger.logLevel === LogLevel.debug) {\n this.logger.emit('debug', [\n `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'} is not unique enough\\n\\nPaths: ${\n JSON.stringify(paths, undefined, 2)\n }\\n\\nFalling back on the first item.\\n`,\n ])\n }\n\n return paths?.at(0)\n }\n return this.hookFirstSync({\n hookName: 'resolvePath',\n parameters: [params.baseName, params.directory, params.options as object],\n }).result\n }\n resolveName = (params: ResolveNameParams): string => {\n if (params.pluginKey) {\n const names = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolveName',\n parameters: [params.name, params.type],\n })\n\n if (names && names?.length > 1 && this.logger.logLevel === LogLevel.debug) {\n this.logger.emit('debug', [\n `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'} is not unique enough\\n\\nNames: ${\n JSON.stringify(names, undefined, 2)\n }\\n\\nFalling back on the first item.\\n`,\n ])\n }\n\n return transformReservedWord(names?.at(0) || params.name)\n }\n\n const name = this.hookFirstSync({\n hookName: 'resolveName',\n parameters: [params.name, params.type],\n }).result\n\n return transformReservedWord(name)\n }\n\n /**\n * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.\n */\n on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void {\n this.events.on(eventName, handler as any)\n }\n\n /**\n * Run a specific hookName for plugin x.\n */\n hookForPlugin<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n }): Promise<Array<ReturnType<ParseResult<H>> | null>> | null {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n const promises = plugins\n .map((plugin) => {\n return this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n })\n .filter(Boolean)\n\n return Promise.all(promises)\n }\n /**\n * Run a specific hookName for plugin x.\n */\n\n hookForPluginSync<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n }): Array<ReturnType<ParseResult<H>>> | null {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n return plugins\n .map((plugin) => {\n return this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n })\n .filter(Boolean)\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n async hookFirst<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n }): Promise<SafeParseResult<H>> {\n const promises = this.#getSortedPlugins().filter(plugin => {\n return skipped ? skipped.has(plugin) : true\n }).map((plugin) => {\n return async () => {\n const value = await this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n\n return Promise.resolve(\n {\n plugin,\n result: value,\n } as SafeParseResult<H>,\n )\n }\n })\n\n return this.#promiseManager.run('first', promises)\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n hookFirstSync<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n }): SafeParseResult<H> {\n let parseResult: SafeParseResult<H> = null as unknown as SafeParseResult<H>\n\n for (const plugin of this.#getSortedPlugins()) {\n if (skipped && skipped.has(plugin)) {\n continue\n }\n\n parseResult = {\n result: this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n }),\n plugin,\n } as SafeParseResult<H>\n\n if (parseResult?.result != null) {\n break\n }\n }\n return parseResult\n }\n\n /**\n * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).\n */\n async hookParallel<H extends PluginLifecycleHooks, TOuput = void>({\n hookName,\n parameters,\n }: {\n hookName: H\n parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined\n }): Promise<Awaited<TOuput>[]> {\n const promises = this.#getSortedPlugins().map((plugin) => {\n return () => this.#execute({ strategy: 'hookParallel', hookName, parameters, plugin }) as Promise<TOuput>\n })\n\n const results = await this.#promiseManager.run('parallel', promises)\n\n results\n .forEach((result, index) => {\n if (isPromiseRejectedResult<Error>(result)) {\n const plugin = this.#getSortedPlugins()[index]\n\n this.#catcher<H>(result.reason, plugin, hookName)\n }\n })\n\n return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)\n }\n\n /**\n * 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.\n */\n hookReduceArg0<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n reduce,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: Plugin) => PossiblePromise<Argument0<H> | null>\n }): Promise<Argument0<H>> {\n const [argument0, ...rest] = parameters\n\n let promise: Promise<Argument0<H>> = Promise.resolve(argument0)\n for (const plugin of this.#getSortedPlugins()) {\n promise = promise\n .then((arg0) => {\n const value = this.#execute({\n strategy: 'hookReduceArg0',\n hookName,\n parameters: [arg0, ...rest] as PluginParameter<H>,\n plugin,\n })\n return value\n })\n .then((result) => reduce.call(this.#core.api, argument0, result as ReturnType<ParseResult<H>>, plugin)) as Promise<Argument0<H>>\n }\n\n return promise\n }\n\n /**\n * Chains plugins\n */\n async hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters }: { hookName: H; parameters?: PluginParameter<H> }): Promise<void> {\n const promises = this.#getSortedPlugins().map((plugin) => {\n return () =>\n this.#execute({\n strategy: 'hookSeq',\n hookName,\n parameters,\n plugin,\n })\n })\n\n return this.#promiseManager.run('seq', promises)\n }\n\n #getSortedPlugins(hookName?: keyof PluginLifecycle): Plugin[] {\n const plugins = [...this.plugins].filter((plugin) => plugin.name !== 'core')\n\n if (hookName) {\n if (this.logger.logLevel === LogLevel.info) {\n const containsHookName = plugins.some((item) => item[hookName])\n if (!containsHookName) {\n this.logger.emit('warning', `No hook ${hookName} found`)\n }\n }\n\n return plugins.filter((item) => item[hookName])\n }\n // TODO add test case for sorting with pre/post\n\n return plugins.map(plugin => {\n if (plugin.pre) {\n const isValid = plugin.pre.every(pluginName => plugins.find(pluginToFind => pluginToFind.name === pluginName))\n\n if (!isValid) {\n throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, undefined, 2)})`)\n }\n }\n\n return plugin\n }).sort((a, b) => {\n if (b.pre?.includes(a.name)) {\n return 1\n }\n if (b.post?.includes(a.name)) {\n return -1\n }\n return 0\n })\n }\n\n getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: Plugin['key']): Plugin[] {\n const plugins = [...this.plugins]\n const [searchPluginName, searchIdentifier] = pluginKey\n\n const pluginByPluginName = plugins\n .filter((plugin) => plugin[hookName])\n .filter((item) => {\n const [name, identifier] = item.key\n\n const identifierCheck = identifier?.toString() === searchIdentifier?.toString()\n const nameCheck = name === searchPluginName\n\n if (searchIdentifier) {\n return identifierCheck && nameCheck\n }\n\n return nameCheck\n })\n\n if (!pluginByPluginName?.length) {\n // fallback on the core plugin when there is no match\n\n const corePlugin = plugins.find((plugin) => plugin.name === 'core' && plugin[hookName])\n\n if (this.logger.logLevel === LogLevel.debug) {\n if (corePlugin) {\n this.logger.emit('debug', [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`])\n } else {\n this.logger.emit('debug', [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`])\n }\n }\n\n return corePlugin ? [corePlugin] : []\n }\n\n return pluginByPluginName\n }\n\n #addExecutedToCallStack(executer: Executer | undefined) {\n if (executer) {\n this.events.emit('executed', executer)\n this.executed.push(executer)\n }\n }\n\n /**\n * Run an async plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The actual pluginObject to run.\n */\n // Implementation signature\n #execute<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: unknown[] | undefined\n plugin: PluginWithLifeCycle\n }): Promise<ReturnType<ParseResult<H>> | null> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('execute', { strategy, hookName, parameters, plugin })\n\n const task = Promise.resolve()\n .then(() => {\n if (typeof hook === 'function') {\n const possiblePromiseResult = (hook as Function).apply({ ...this.#core.api, plugin }, parameters) as Promise<ReturnType<ParseResult<H>>>\n\n if (isPromise(possiblePromiseResult)) {\n return Promise.resolve(possiblePromiseResult)\n }\n return possiblePromiseResult\n }\n\n return hook\n })\n .then((result) => {\n output = result\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n\n return result\n })\n .catch((e: Error) => {\n this.#catcher<H>(e, plugin, hookName)\n\n return null\n })\n\n return task\n }\n\n /**\n * Run a sync plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be in `PluginHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The acutal plugin\n * @param replaceContext When passed, the plugin context can be overridden.\n */\n #executeSync<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: PluginParameter<H>\n plugin: PluginWithLifeCycle\n }): ReturnType<ParseResult<H>> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('execute', { strategy, hookName, parameters, plugin })\n\n try {\n if (typeof hook === 'function') {\n const fn = (hook as Function).apply({ ...this.#core.api, plugin }, parameters) as ReturnType<ParseResult<H>>\n\n output = fn\n return fn\n }\n\n output = hook\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n\n return hook\n } catch (e) {\n this.#catcher<H>(e as Error, plugin, hookName)\n\n return null\n }\n }\n\n #catcher<H extends PluginLifecycleHooks>(e: Error, plugin?: Plugin, hookName?: H) {\n const text = `${e.message} (plugin: ${plugin?.name || 'unknown'}, hook: ${hookName || 'unknown'})\\n`\n\n this.logger.emit('error', text)\n this.events.emit('error', e)\n }\n\n #parse<TPlugin extends UserPluginWithLifeCycle>(\n plugin: TPlugin,\n pluginManager: PluginManager,\n context: CorePluginOptions['api'] | undefined,\n ): Plugin<GetPluginFactoryOptions<TPlugin>> {\n const usedPluginNames = pluginManager.#usedPluginNames\n\n setUniqueName(plugin.name, usedPluginNames)\n\n const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean) as [typeof plugin.name, string]\n\n // default transform\n if (!plugin.transform) {\n plugin.transform = function transform(code) {\n return code\n }\n }\n\n if (plugin.api && typeof plugin.api === 'function') {\n const api = (plugin.api as Function).call(context) as typeof plugin.api\n\n return {\n ...plugin,\n key,\n api,\n } as unknown as Plugin<GetPluginFactoryOptions<TPlugin>>\n }\n\n return {\n ...plugin,\n key,\n } as unknown as Plugin<GetPluginFactoryOptions<TPlugin>>\n }\n\n static getDependedPlugins<\n T1 extends PluginFactoryOptions,\n T2 extends PluginFactoryOptions = never,\n T3 extends PluginFactoryOptions = never,\n TOutput = T3 extends never ? T2 extends never ? [T1: Plugin<T1>]\n : [T1: Plugin<T1>, T2: Plugin<T2>]\n : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>],\n >(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput {\n let pluginNames: string[] = []\n if (typeof dependedPluginNames === 'string') {\n pluginNames = [dependedPluginNames]\n } else {\n pluginNames = dependedPluginNames\n }\n\n return pluginNames.map((pluginName) => {\n const plugin = plugins.find((plugin) => plugin.name === pluginName)\n if (!plugin) {\n throw new ValidationPluginError(`This plugin depends on the ${pluginName} plugin.`)\n }\n return plugin\n }) as TOutput\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static get hooks() {\n return ['buildStart', 'resolvePath', 'resolveName', 'load', 'transform', 'writeFile', 'buildEnd'] as const\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ var chunkDM53DOLW_cjs = require('./chunk-DM53DOLW.cjs');
|
|
|
4
4
|
var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
5
5
|
var seedrandom = require('seedrandom');
|
|
6
6
|
var tty = require('tty');
|
|
7
|
+
var events = require('events');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
@@ -77,6 +78,29 @@ function w(r2 = false) {
|
|
|
77
78
|
}
|
|
78
79
|
var p2 = w(tty.isatty(1));
|
|
79
80
|
|
|
81
|
+
// src/utils/EventEmitter.ts
|
|
82
|
+
chunkKAA3L7N6_cjs.init_cjs_shims();
|
|
83
|
+
var _emitter;
|
|
84
|
+
var EventEmitter = class {
|
|
85
|
+
constructor() {
|
|
86
|
+
chunkKAA3L7N6_cjs.__privateAdd(this, _emitter, new events.EventEmitter());
|
|
87
|
+
chunkKAA3L7N6_cjs.__privateGet(this, _emitter).setMaxListeners(100);
|
|
88
|
+
}
|
|
89
|
+
emit(eventName, ...eventArg) {
|
|
90
|
+
chunkKAA3L7N6_cjs.__privateGet(this, _emitter).emit(eventName, ...eventArg);
|
|
91
|
+
}
|
|
92
|
+
on(eventName, handler) {
|
|
93
|
+
chunkKAA3L7N6_cjs.__privateGet(this, _emitter).on(eventName, handler);
|
|
94
|
+
}
|
|
95
|
+
off(eventName, handler) {
|
|
96
|
+
chunkKAA3L7N6_cjs.__privateGet(this, _emitter).off(eventName, handler);
|
|
97
|
+
}
|
|
98
|
+
removeAll() {
|
|
99
|
+
chunkKAA3L7N6_cjs.__privateGet(this, _emitter).removeAllListeners();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
_emitter = new WeakMap();
|
|
103
|
+
|
|
80
104
|
// src/logger.ts
|
|
81
105
|
var LogLevel = {
|
|
82
106
|
silent: "silent",
|
|
@@ -84,45 +108,39 @@ var LogLevel = {
|
|
|
84
108
|
debug: "debug"
|
|
85
109
|
};
|
|
86
110
|
function createLogger({ logLevel, name, spinner }) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
spinner.
|
|
91
|
-
logs.push(message);
|
|
111
|
+
const events = new EventEmitter();
|
|
112
|
+
events.on("start", (message) => {
|
|
113
|
+
if (spinner) {
|
|
114
|
+
spinner.start(message);
|
|
92
115
|
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
116
|
+
});
|
|
117
|
+
events.on("end", (message) => {
|
|
118
|
+
if (spinner) {
|
|
119
|
+
spinner.suffixText = "";
|
|
120
|
+
spinner.succeed(message);
|
|
97
121
|
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
if (
|
|
122
|
+
});
|
|
123
|
+
events.on("warning", (message) => {
|
|
124
|
+
if (spinner) {
|
|
101
125
|
spinner.warn(p2.yellow(message));
|
|
102
|
-
logs.push(message);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const info = (message) => {
|
|
106
|
-
if (message && spinner && logLevel !== LogLevel.silent) {
|
|
107
|
-
spinner.info(message);
|
|
108
|
-
logs.push(message);
|
|
109
126
|
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
127
|
+
});
|
|
128
|
+
events.on("error", (message) => {
|
|
129
|
+
throw new Error(message || "Something went wrong");
|
|
130
|
+
});
|
|
131
|
+
events.on("debug", async (messages) => {
|
|
132
|
+
await chunkDM53DOLW_cjs.writeLog(messages.join("\n"));
|
|
133
|
+
});
|
|
116
134
|
const logger = {
|
|
117
135
|
name,
|
|
118
136
|
logLevel,
|
|
119
|
-
log,
|
|
120
|
-
error,
|
|
121
|
-
warn,
|
|
122
|
-
info,
|
|
123
|
-
debug,
|
|
124
137
|
spinner,
|
|
125
|
-
|
|
138
|
+
on: (...args) => {
|
|
139
|
+
return events.on(...args);
|
|
140
|
+
},
|
|
141
|
+
emit: (...args) => {
|
|
142
|
+
return events.emit(...args);
|
|
143
|
+
}
|
|
126
144
|
};
|
|
127
145
|
return logger;
|
|
128
146
|
}
|
|
@@ -153,10 +171,11 @@ function randomCliColour(text, colors = defaultColours) {
|
|
|
153
171
|
return formatter(text);
|
|
154
172
|
}
|
|
155
173
|
|
|
174
|
+
exports.EventEmitter = EventEmitter;
|
|
156
175
|
exports.LogLevel = LogLevel;
|
|
157
176
|
exports.createLogger = createLogger;
|
|
158
177
|
exports.p = p2;
|
|
159
178
|
exports.randomCliColour = randomCliColour;
|
|
160
179
|
exports.randomColour = randomColour;
|
|
161
180
|
//# sourceMappingURL=out.js.map
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
181
|
+
//# sourceMappingURL=chunk-SSD2TXQZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js","../src/utils/EventEmitter.ts"],"names":["r","p"],"mappings":";;;;;;;;;;AAAA;AAAA,OAAO,gBAAgB;;;ACAvB;;;ACAA;AACA,IAAI,IAAI;AAAA,EACN,OAAO,CAAC,GAAG,CAAC;AAAA,EACZ,MAAM,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC/B,KAAK,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC9B,QAAQ,CAAC,GAAG,EAAE;AA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B,CAAC,SAAS,QAAQ,YAAY,QAAQ,QAAQ,SAAS,aAAa,WAAW,OAAO,WAAW,UAAU,YAAY;AAEvI,SAAS,aAAa,MAAe,UAAU,gBAAwB;AAC5E,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,WAAW,IAAI;AAC9B,QAAM,SAAS,QAAQ,GAAG,KAAK,MAAM,OAAO,IAAI,QAAQ,MAAM,CAAC,KAAK;AAEpE,SAAO;AACT;AAEO,SAAS,gBAAgB,MAAe,SAAS,gBAAwB;AAC9E,QAAM,UAAU,EAAa,IAAI;AAEjC,MAAI,CAAC,MAAM;AACT,WAAO,QAAQ,MAAM,IAAI;AAAA,EAC3B;AAEA,QAAM,SAAS,aAAa,MAAM,MAAM;AACxC,QAAM,SAAS,OAAO,SAAS,MAAM;AACrC,QAAM,MAAM,OAAO,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACnD,QAAM,YAAuB,QAAQ,GAAG;AAExC,MAAI,QAAQ;AACV,WAAOA,GAAE,KAAK,UAAU,IAAI,CAAC;AAAA,EAC/B;AAEA,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO,UAAU,IAAI;AACvB","sourcesContent":["import seedrandom from 'seedrandom'\nimport c, { createColors } from 'tinyrainbow'\n\nimport { writeLog } from './fs/write.ts'\nimport { EventEmitter } from './utils/EventEmitter.ts'\n\nimport type { Ora } from 'ora'\nimport type { Formatter } from 'tinyrainbow'\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n\ntype Events = {\n start: [message: string]\n end: [message: string]\n error: [message: string]\n warning: [message: string]\n debug: [logs: string[]]\n}\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n\n spinner?: Ora\n on: EventEmitter<Events>['on']\n emit: EventEmitter<Events>['emit']\n}\n\ntype Props = {\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n}\n\nexport function createLogger({ logLevel, name, spinner }: Props): Logger {\n const events = new EventEmitter<Events>()\n\n events.on('start', (message) => {\n if (spinner) {\n spinner.start(message)\n }\n })\n\n events.on('end', (message) => {\n if (spinner) {\n spinner.suffixText = ''\n spinner.succeed(message)\n }\n })\n\n events.on('warning', (message) => {\n if (spinner) {\n spinner.warn(c.yellow(message))\n }\n })\n\n events.on('error', (message) => {\n throw new Error(message || 'Something went wrong')\n })\n\n events.on('debug', async (messages) => {\n await writeLog(messages.join('\\n'))\n })\n\n const logger: Logger = {\n name,\n logLevel,\n spinner,\n on: (...args) => {\n return events.on(...args)\n },\n emit: (...args) => {\n return events.emit(...args)\n },\n }\n\n return logger\n}\n\nconst defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomCliColour(text?: string, colors = defaultColours): string {\n const colours = createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return c.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import {\n a as t,\n b as e,\n c as o\n} from \"./chunk-5WCZOS7T.js\";\n\n// src/node.ts\nimport { isatty as r } from \"tty\";\nvar p = o(r(1));\nexport {\n o as createColors,\n p as default,\n t as getDefaultColors,\n e as isSupported\n};\n","// src/index.ts\nvar b = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49]\n}, C = Object.entries(b);\nfunction d(r) {\n return String(r);\n}\nd.open = \"\";\nd.close = \"\";\nvar m = /* @__PURE__ */ C.reduce(\n (r, [n]) => (r[n] = d, r),\n { isColorSupported: !1 }\n);\nfunction x() {\n return { ...m };\n}\nfunction p(r = !1) {\n let n = typeof process != \"undefined\" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];\n return !(\"NO_COLOR\" in t || a.includes(\"--no-color\")) && !(\"GITHUB_ACTIONS\" in t) && (\"FORCE_COLOR\" in t || a.includes(\"--color\") || (n == null ? void 0 : n.platform) === \"win32\" || r && t.TERM !== \"dumb\" || \"CI\" in t) || typeof window != \"undefined\" && !!window.chrome;\n}\nfunction w(r = !1) {\n let n = p(r), t = (e, o, c, i) => {\n let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);\n return ~l ? u + t(s, o, c, l) : u + s;\n }, a = (e, o, c = e) => {\n let i = (u) => {\n let s = String(u), l = s.indexOf(o, e.length);\n return ~l ? e + t(s, o, c, l) + o : e + s + o;\n };\n return i.open = e, i.close = o, i;\n }, g = {\n isColorSupported: n\n }, f = (e) => `\\x1B[${e}m`;\n for (let [e, o] of C)\n g[e] = n ? a(\n f(o[0]),\n f(o[1]),\n o[2]\n ) : d;\n return g;\n}\n\nexport {\n x as a,\n p as b,\n w as c\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport { EventEmitter as NodeEventEmitter } from 'node:events'\n\nexport class EventEmitter<TEvents extends Record<string, any>> {\n constructor() {\n this.#emitter.setMaxListeners(100)\n }\n #emitter = new NodeEventEmitter()\n\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {\n this.#emitter.emit(eventName, ...(eventArg as []))\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.on(eventName, handler as any)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.off(eventName, handler as any)\n }\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n"]}
|