@kubb/core 2.12.1 → 2.12.3
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-33S7A7ZE.cjs → chunk-LHNV7GQH.cjs} +23 -23
- package/dist/chunk-LHNV7GQH.cjs.map +1 -0
- package/dist/{chunk-ALE7CO7I.js → chunk-NKAOH4VT.js} +24 -24
- package/dist/chunk-NKAOH4VT.js.map +1 -0
- package/dist/chunk-OPTGFWPQ.cjs +368 -0
- package/dist/chunk-OPTGFWPQ.cjs.map +1 -0
- package/dist/{chunk-OMX2RMAX.cjs → chunk-TTAE4JRW.cjs} +4 -2
- package/dist/chunk-TTAE4JRW.cjs.map +1 -0
- package/dist/chunk-VPKB6WED.js +368 -0
- package/dist/chunk-VPKB6WED.js.map +1 -0
- package/dist/{chunk-4BZD7YTT.js → chunk-XHJKKPCO.js} +4 -2
- package/dist/chunk-XHJKKPCO.js.map +1 -0
- package/dist/index.cjs +129 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -23
- package/dist/index.d.ts +24 -23
- package/dist/index.js +108 -109
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +2 -2
- package/dist/logger.js +1 -1
- package/dist/transformers.cjs +18 -205
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +16 -203
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/src/BarrelManager.ts +3 -3
- package/src/FileManager.ts +14 -5
- package/src/PluginManager.ts +12 -15
- package/src/build.ts +14 -18
- package/src/logger.ts +4 -1
- package/src/types.ts +6 -6
- package/src/utils/TreeNode.ts +2 -2
- package/dist/chunk-33S7A7ZE.cjs.map +0 -1
- package/dist/chunk-4BZD7YTT.js.map +0 -1
- package/dist/chunk-ALE7CO7I.js.map +0 -1
- package/dist/chunk-OMX2RMAX.cjs.map +0 -1
- package/dist/chunk-VHRZO2NC.cjs +0 -145
- package/dist/chunk-VHRZO2NC.cjs.map +0 -1
- package/dist/chunk-Z5N655B7.js +0 -145
- package/dist/chunk-Z5N655B7.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkVHRZO2NCcjs = require('./chunk-VHRZO2NC.cjs');
|
|
6
5
|
|
|
6
|
+
var _chunkOPTGFWPQcjs = require('./chunk-OPTGFWPQ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkLHNV7GQHcjs = require('./chunk-LHNV7GQH.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
var _chunkZS3YTJ2Lcjs = require('./chunk-ZS3YTJ2L.cjs');
|
|
@@ -16,7 +17,7 @@ var _chunkZS3YTJ2Lcjs = require('./chunk-ZS3YTJ2L.cjs');
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
var
|
|
20
|
+
var _chunkTTAE4JRWcjs = require('./chunk-TTAE4JRW.cjs');
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
var _chunkIBUMXAETcjs = require('./chunk-IBUMXAET.cjs');
|
|
@@ -934,15 +935,6 @@ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
|
934
935
|
// src/build.ts
|
|
935
936
|
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
936
937
|
|
|
937
|
-
// src/config.ts
|
|
938
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
939
|
-
function defineConfig(options) {
|
|
940
|
-
return options;
|
|
941
|
-
}
|
|
942
|
-
function isInputPath(result) {
|
|
943
|
-
return !!result && "path" in result;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
938
|
// src/FileManager.ts
|
|
947
939
|
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
948
940
|
var import_lodash = _chunk4TB6NGOCcjs.__toESM.call(void 0, require_lodash(), 1);
|
|
@@ -1512,13 +1504,13 @@ var TreeNode = class _TreeNode {
|
|
|
1512
1504
|
const treeNode = new _TreeNode({
|
|
1513
1505
|
name: filteredTree.name,
|
|
1514
1506
|
path: filteredTree.path,
|
|
1515
|
-
type:
|
|
1507
|
+
type: FileManager.getMode(filteredTree.path)
|
|
1516
1508
|
});
|
|
1517
1509
|
const recurse = (node, item) => {
|
|
1518
1510
|
const subNode = node.addChild({
|
|
1519
1511
|
name: item.name,
|
|
1520
1512
|
path: item.path,
|
|
1521
|
-
type:
|
|
1513
|
+
type: FileManager.getMode(item.path)
|
|
1522
1514
|
});
|
|
1523
1515
|
if (_optionalChain([item, 'access', _18 => _18.children, 'optionalAccess', _19 => _19.length])) {
|
|
1524
1516
|
_optionalChain([item, 'access', _20 => _20.children, 'optionalAccess', _21 => _21.forEach, 'call', _22 => _22((child) => {
|
|
@@ -1591,8 +1583,8 @@ var BarrelManager = class {
|
|
|
1591
1583
|
if (treeNode2.children.length > 1) {
|
|
1592
1584
|
const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
|
|
1593
1585
|
const exports = treeNode2.children.filter(Boolean).map((file) => {
|
|
1594
|
-
const importPath = file.data.type === "
|
|
1595
|
-
if (importPath.endsWith("index") && file.data.type === "
|
|
1586
|
+
const importPath = file.data.type === "split" ? `./${file.data.name}/index` : `./${_chunkOPTGFWPQcjs.trimExtName.call(void 0, file.data.name)}`;
|
|
1587
|
+
if (importPath.endsWith("index") && file.data.type === "single") {
|
|
1596
1588
|
return void 0;
|
|
1597
1589
|
}
|
|
1598
1590
|
return {
|
|
@@ -1610,7 +1602,7 @@ var BarrelManager = class {
|
|
|
1610
1602
|
} else if (treeNode2.children.length === 1) {
|
|
1611
1603
|
const [treeNodeChild] = treeNode2.children;
|
|
1612
1604
|
const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
|
|
1613
|
-
const importPath = treeNodeChild.data.type === "
|
|
1605
|
+
const importPath = treeNodeChild.data.type === "split" ? `./${treeNodeChild.data.name}/index` : `./${_chunkOPTGFWPQcjs.trimExtName.call(void 0, treeNodeChild.data.name)}`;
|
|
1614
1606
|
const exports = [
|
|
1615
1607
|
{
|
|
1616
1608
|
path: extName ? `${importPath}${extName}` : importPath,
|
|
@@ -1674,13 +1666,17 @@ var _FileManager = class _FileManager {
|
|
|
1674
1666
|
}
|
|
1675
1667
|
return resolvedFiles[0];
|
|
1676
1668
|
}
|
|
1677
|
-
async addIndexes({ root, output, meta, options = {} }) {
|
|
1669
|
+
async addIndexes({ root, output, meta, logger, options = {} }) {
|
|
1678
1670
|
const { exportType = "barrel" } = output;
|
|
1679
1671
|
if (exportType === false) {
|
|
1680
1672
|
return void 0;
|
|
1681
1673
|
}
|
|
1682
1674
|
const pathToBuildFrom = _path.resolve.call(void 0, root, output.path);
|
|
1683
|
-
|
|
1675
|
+
if (_chunkOPTGFWPQcjs.transformers_default.trimExtName(pathToBuildFrom).endsWith("index")) {
|
|
1676
|
+
logger.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
const exportPath = output.path.startsWith("./") ? _chunkOPTGFWPQcjs.trimExtName.call(void 0, output.path) : `./${_chunkOPTGFWPQcjs.trimExtName.call(void 0, output.path)}`;
|
|
1684
1680
|
const mode = _FileManager.getMode(output.path);
|
|
1685
1681
|
const barrelManager = new BarrelManager({
|
|
1686
1682
|
extName: output.extName,
|
|
@@ -1709,7 +1705,7 @@ var _FileManager = class _FileManager {
|
|
|
1709
1705
|
});
|
|
1710
1706
|
})
|
|
1711
1707
|
);
|
|
1712
|
-
const rootPath = mode === "
|
|
1708
|
+
const rootPath = mode === "split" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
|
|
1713
1709
|
const rootFile = {
|
|
1714
1710
|
path: _path.resolve.call(void 0, root, "index.ts"),
|
|
1715
1711
|
baseName: "index.ts",
|
|
@@ -1767,9 +1763,9 @@ var _FileManager = class _FileManager {
|
|
|
1767
1763
|
}
|
|
1768
1764
|
static getMode(path5) {
|
|
1769
1765
|
if (!path5) {
|
|
1770
|
-
return "
|
|
1766
|
+
return "split";
|
|
1771
1767
|
}
|
|
1772
|
-
return _path.extname.call(void 0, path5) ? "
|
|
1768
|
+
return _path.extname.call(void 0, path5) ? "single" : "split";
|
|
1773
1769
|
}
|
|
1774
1770
|
static get extensions() {
|
|
1775
1771
|
return [".js", ".ts", ".tsx"];
|
|
@@ -1786,7 +1782,7 @@ add_fn = async function(file) {
|
|
|
1786
1782
|
const controller = new AbortController();
|
|
1787
1783
|
const resolvedFile = {
|
|
1788
1784
|
id: _crypto2.default.randomUUID(),
|
|
1789
|
-
name:
|
|
1785
|
+
name: _chunkOPTGFWPQcjs.trimExtName.call(void 0, file.baseName),
|
|
1790
1786
|
...file
|
|
1791
1787
|
};
|
|
1792
1788
|
if (_optionalChain([resolvedFile, 'access', _34 => _34.exports, 'optionalAccess', _35 => _35.length])) {
|
|
@@ -1864,7 +1860,7 @@ function getSource(file) {
|
|
|
1864
1860
|
const exports = file.exports ? combineExports(file.exports) : [];
|
|
1865
1861
|
const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : [];
|
|
1866
1862
|
const importNodes = imports.filter((item) => {
|
|
1867
|
-
return item.path !==
|
|
1863
|
+
return item.path !== _chunkOPTGFWPQcjs.trimExtName.call(void 0, file.path);
|
|
1868
1864
|
}).map((item) => {
|
|
1869
1865
|
return factory.createImportDeclaration({
|
|
1870
1866
|
name: item.name,
|
|
@@ -1977,13 +1973,13 @@ function getEnvSource(source, env) {
|
|
|
1977
1973
|
throw new TypeError(`Environment should be in upperCase for ${key}`);
|
|
1978
1974
|
}
|
|
1979
1975
|
if (typeof replaceBy === "string") {
|
|
1980
|
-
prev =
|
|
1976
|
+
prev = _chunkOPTGFWPQcjs.searchAndReplace.call(void 0, {
|
|
1981
1977
|
text: prev.replaceAll(`process.env.${key}`, replaceBy),
|
|
1982
1978
|
replaceBy,
|
|
1983
1979
|
prefix: "process.env",
|
|
1984
1980
|
key
|
|
1985
1981
|
});
|
|
1986
|
-
prev =
|
|
1982
|
+
prev = _chunkOPTGFWPQcjs.searchAndReplace.call(void 0, {
|
|
1987
1983
|
text: prev.replaceAll(/(declare const).*\n/gi, ""),
|
|
1988
1984
|
replaceBy,
|
|
1989
1985
|
key
|
|
@@ -1996,11 +1992,78 @@ function getEnvSource(source, env) {
|
|
|
1996
1992
|
// src/PluginManager.ts
|
|
1997
1993
|
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1998
1994
|
|
|
1995
|
+
// src/PromiseManager.ts
|
|
1996
|
+
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
1997
|
+
|
|
1998
|
+
// src/utils/executeStrategies.ts
|
|
1999
|
+
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2000
|
+
function hookSeq(promises) {
|
|
2001
|
+
return promises.filter(Boolean).reduce(
|
|
2002
|
+
(promise, func) => {
|
|
2003
|
+
if (typeof func !== "function") {
|
|
2004
|
+
throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
|
|
2005
|
+
}
|
|
2006
|
+
return promise.then((state) => {
|
|
2007
|
+
const calledFunc = func(state);
|
|
2008
|
+
if (calledFunc) {
|
|
2009
|
+
return calledFunc.then(Array.prototype.concat.bind(state));
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
},
|
|
2013
|
+
Promise.resolve([])
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
function hookFirst(promises, nullCheck = (state) => state !== null) {
|
|
2017
|
+
let promise = Promise.resolve(null);
|
|
2018
|
+
for (const func of promises.filter(Boolean)) {
|
|
2019
|
+
promise = promise.then((state) => {
|
|
2020
|
+
if (nullCheck(state)) {
|
|
2021
|
+
return state;
|
|
2022
|
+
}
|
|
2023
|
+
const calledFunc = func(state);
|
|
2024
|
+
return calledFunc;
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
return promise;
|
|
2028
|
+
}
|
|
2029
|
+
function hookParallel(promises) {
|
|
2030
|
+
return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// src/PromiseManager.ts
|
|
2034
|
+
var _options2;
|
|
2035
|
+
var PromiseManager = class {
|
|
2036
|
+
constructor(options = {}) {
|
|
2037
|
+
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options2, {});
|
|
2038
|
+
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options2, options);
|
|
2039
|
+
return this;
|
|
2040
|
+
}
|
|
2041
|
+
run(strategy, promises) {
|
|
2042
|
+
if (strategy === "seq") {
|
|
2043
|
+
return hookSeq(promises);
|
|
2044
|
+
}
|
|
2045
|
+
if (strategy === "first") {
|
|
2046
|
+
return hookFirst(promises, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options2).nullCheck);
|
|
2047
|
+
}
|
|
2048
|
+
if (strategy === "parallel") {
|
|
2049
|
+
return hookParallel(promises);
|
|
2050
|
+
}
|
|
2051
|
+
throw new Error(`${strategy} not implemented`);
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
_options2 = new WeakMap();
|
|
2055
|
+
function isPromise(result) {
|
|
2056
|
+
return !!result && typeof _optionalChain([result, 'optionalAccess', _41 => _41.then]) === "function";
|
|
2057
|
+
}
|
|
2058
|
+
function isPromiseRejectedResult(result) {
|
|
2059
|
+
return result.status === "rejected";
|
|
2060
|
+
}
|
|
2061
|
+
|
|
1999
2062
|
// src/errors.ts
|
|
2000
2063
|
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2001
2064
|
var Warning = class extends Error {
|
|
2002
2065
|
constructor(message, options) {
|
|
2003
|
-
super(message, { cause: _optionalChain([options, 'optionalAccess',
|
|
2066
|
+
super(message, { cause: _optionalChain([options, 'optionalAccess', _42 => _42.cause]) });
|
|
2004
2067
|
this.name = "Warning";
|
|
2005
2068
|
}
|
|
2006
2069
|
};
|
|
@@ -2089,73 +2152,6 @@ var definePlugin = createPlugin((options) => {
|
|
|
2089
2152
|
};
|
|
2090
2153
|
});
|
|
2091
2154
|
|
|
2092
|
-
// src/PromiseManager.ts
|
|
2093
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2094
|
-
|
|
2095
|
-
// src/utils/executeStrategies.ts
|
|
2096
|
-
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2097
|
-
function hookSeq(promises) {
|
|
2098
|
-
return promises.filter(Boolean).reduce(
|
|
2099
|
-
(promise, func) => {
|
|
2100
|
-
if (typeof func !== "function") {
|
|
2101
|
-
throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
|
|
2102
|
-
}
|
|
2103
|
-
return promise.then((state) => {
|
|
2104
|
-
const calledFunc = func(state);
|
|
2105
|
-
if (calledFunc) {
|
|
2106
|
-
return calledFunc.then(Array.prototype.concat.bind(state));
|
|
2107
|
-
}
|
|
2108
|
-
});
|
|
2109
|
-
},
|
|
2110
|
-
Promise.resolve([])
|
|
2111
|
-
);
|
|
2112
|
-
}
|
|
2113
|
-
function hookFirst(promises, nullCheck = (state) => state !== null) {
|
|
2114
|
-
let promise = Promise.resolve(null);
|
|
2115
|
-
for (const func of promises.filter(Boolean)) {
|
|
2116
|
-
promise = promise.then((state) => {
|
|
2117
|
-
if (nullCheck(state)) {
|
|
2118
|
-
return state;
|
|
2119
|
-
}
|
|
2120
|
-
const calledFunc = func(state);
|
|
2121
|
-
return calledFunc;
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
return promise;
|
|
2125
|
-
}
|
|
2126
|
-
function hookParallel(promises) {
|
|
2127
|
-
return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
// src/PromiseManager.ts
|
|
2131
|
-
var _options2;
|
|
2132
|
-
var PromiseManager = class {
|
|
2133
|
-
constructor(options = {}) {
|
|
2134
|
-
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options2, {});
|
|
2135
|
-
_chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options2, options);
|
|
2136
|
-
return this;
|
|
2137
|
-
}
|
|
2138
|
-
run(strategy, promises) {
|
|
2139
|
-
if (strategy === "seq") {
|
|
2140
|
-
return hookSeq(promises);
|
|
2141
|
-
}
|
|
2142
|
-
if (strategy === "first") {
|
|
2143
|
-
return hookFirst(promises, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options2).nullCheck);
|
|
2144
|
-
}
|
|
2145
|
-
if (strategy === "parallel") {
|
|
2146
|
-
return hookParallel(promises);
|
|
2147
|
-
}
|
|
2148
|
-
throw new Error(`${strategy} not implemented`);
|
|
2149
|
-
}
|
|
2150
|
-
};
|
|
2151
|
-
_options2 = new WeakMap();
|
|
2152
|
-
function isPromise(result) {
|
|
2153
|
-
return !!result && typeof _optionalChain([result, 'optionalAccess', _42 => _42.then]) === "function";
|
|
2154
|
-
}
|
|
2155
|
-
function isPromiseRejectedResult(result) {
|
|
2156
|
-
return result.status === "rejected";
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
2155
|
// src/PluginManager.ts
|
|
2160
2156
|
var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
|
|
2161
2157
|
var PluginManager = class {
|
|
@@ -2180,7 +2176,7 @@ var PluginManager = class {
|
|
|
2180
2176
|
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _executeSync);
|
|
2181
2177
|
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _catcher);
|
|
2182
2178
|
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _parse);
|
|
2183
|
-
this.events = new (0,
|
|
2179
|
+
this.events = new (0, _chunkTTAE4JRWcjs.EventEmitter)();
|
|
2184
2180
|
this.executed = [];
|
|
2185
2181
|
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _core, void 0);
|
|
2186
2182
|
_chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
|
|
@@ -2192,7 +2188,7 @@ var PluginManager = class {
|
|
|
2192
2188
|
hookName: "resolvePath",
|
|
2193
2189
|
parameters: [params.baseName, params.mode, params.options]
|
|
2194
2190
|
});
|
|
2195
|
-
if (paths && _optionalChain([paths, 'optionalAccess', _43 => _43.length]) > 1
|
|
2191
|
+
if (paths && _optionalChain([paths, 'optionalAccess', _43 => _43.length]) > 1) {
|
|
2196
2192
|
this.logger.emit("debug", [
|
|
2197
2193
|
`Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
2198
2194
|
|
|
@@ -2216,7 +2212,7 @@ Falling back on the first item.
|
|
|
2216
2212
|
hookName: "resolveName",
|
|
2217
2213
|
parameters: [params.name, params.type]
|
|
2218
2214
|
});
|
|
2219
|
-
if (names && _optionalChain([names, 'optionalAccess', _46 => _46.length]) > 1
|
|
2215
|
+
if (names && _optionalChain([names, 'optionalAccess', _46 => _46.length]) > 1) {
|
|
2220
2216
|
this.logger.emit("debug", [
|
|
2221
2217
|
`Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
2222
2218
|
|
|
@@ -2226,13 +2222,13 @@ Falling back on the first item.
|
|
|
2226
2222
|
`
|
|
2227
2223
|
]);
|
|
2228
2224
|
}
|
|
2229
|
-
return
|
|
2225
|
+
return _chunkOPTGFWPQcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _47 => _47.at, 'call', _48 => _48(0)]) || params.name);
|
|
2230
2226
|
}
|
|
2231
2227
|
const name = this.hookFirstSync({
|
|
2232
2228
|
hookName: "resolveName",
|
|
2233
2229
|
parameters: [params.name, params.type]
|
|
2234
2230
|
}).result;
|
|
2235
|
-
return
|
|
2231
|
+
return _chunkOPTGFWPQcjs.transformReservedWord.call(void 0, name);
|
|
2236
2232
|
};
|
|
2237
2233
|
this.config = config;
|
|
2238
2234
|
this.logger = options.logger;
|
|
@@ -2452,12 +2448,10 @@ Falling back on the first item.
|
|
|
2452
2448
|
});
|
|
2453
2449
|
if (!_optionalChain([pluginByPluginName, 'optionalAccess', _57 => _57.length])) {
|
|
2454
2450
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
}
|
|
2459
|
-
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
|
|
2460
|
-
}
|
|
2451
|
+
if (corePlugin) {
|
|
2452
|
+
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
|
|
2453
|
+
} else {
|
|
2454
|
+
this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
|
|
2461
2455
|
}
|
|
2462
2456
|
return corePlugin ? [corePlugin] : [];
|
|
2463
2457
|
}
|
|
@@ -2490,7 +2484,7 @@ _getSortedPlugins = new WeakSet();
|
|
|
2490
2484
|
getSortedPlugins_fn = function(hookName) {
|
|
2491
2485
|
const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
|
|
2492
2486
|
if (hookName) {
|
|
2493
|
-
if (this.logger.logLevel ===
|
|
2487
|
+
if (this.logger.logLevel === _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2494
2488
|
const containsHookName = plugins.some((item) => item[hookName]);
|
|
2495
2489
|
if (!containsHookName) {
|
|
2496
2490
|
this.logger.emit("warning", `No hook ${hookName} found`);
|
|
@@ -2603,7 +2597,7 @@ catcher_fn = function(cause, plugin, hookName) {
|
|
|
2603
2597
|
_parse = new WeakSet();
|
|
2604
2598
|
parse_fn = function(plugin, pluginManager, context) {
|
|
2605
2599
|
const usedPluginNames = _chunk4TB6NGOCcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
|
|
2606
|
-
|
|
2600
|
+
_chunkLHNV7GQHcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
|
|
2607
2601
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
2608
2602
|
if (!plugin.transform) {
|
|
2609
2603
|
plugin.transform = function transform(code) {
|
|
@@ -2624,21 +2618,30 @@ parse_fn = function(plugin, pluginManager, context) {
|
|
|
2624
2618
|
};
|
|
2625
2619
|
};
|
|
2626
2620
|
|
|
2621
|
+
// src/config.ts
|
|
2622
|
+
_chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
|
|
2623
|
+
function defineConfig(options) {
|
|
2624
|
+
return options;
|
|
2625
|
+
}
|
|
2626
|
+
function isInputPath(result) {
|
|
2627
|
+
return !!result && "path" in result;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2627
2630
|
// src/build.ts
|
|
2628
2631
|
async function transformReducer(_previousCode, result, _plugin) {
|
|
2629
2632
|
return result;
|
|
2630
2633
|
}
|
|
2631
2634
|
async function setup(options) {
|
|
2632
|
-
const { config, logger =
|
|
2635
|
+
const { config, logger = _chunkTTAE4JRWcjs.createLogger.call(void 0, { logLevel: _chunkTTAE4JRWcjs.LogLevel.silent }) } = options;
|
|
2633
2636
|
let count = 0;
|
|
2634
2637
|
try {
|
|
2635
|
-
if (isInputPath(config) && !new (0,
|
|
2638
|
+
if (isInputPath(config) && !new (0, _chunkLHNV7GQHcjs.URLPath)(config.input.path).isURL) {
|
|
2636
2639
|
await _chunkF4TSJHGAcjs.read.call(void 0, config.input.path);
|
|
2637
2640
|
}
|
|
2638
2641
|
} catch (e) {
|
|
2639
2642
|
if (isInputPath(config)) {
|
|
2640
2643
|
throw new Error(
|
|
2641
|
-
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${
|
|
2644
|
+
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${_chunkTTAE4JRWcjs.p.dim(config.input.path)}`,
|
|
2642
2645
|
{
|
|
2643
2646
|
cause: e
|
|
2644
2647
|
}
|
|
@@ -2691,16 +2694,14 @@ async function setup(options) {
|
|
|
2691
2694
|
const { hookName, parameters, plugin } = executer;
|
|
2692
2695
|
if (hookName === "writeFile") {
|
|
2693
2696
|
const [code] = parameters;
|
|
2694
|
-
|
|
2695
|
-
logger.emit("debug", [`PluginKey ${_chunkOMX2RMAXcjs.p.dim(JSON.stringify(plugin.key))}
|
|
2697
|
+
logger.emit("debug", [`PluginKey ${_chunkTTAE4JRWcjs.p.dim(JSON.stringify(plugin.key))}
|
|
2696
2698
|
with source
|
|
2697
2699
|
|
|
2698
2700
|
${code}`]);
|
|
2699
|
-
}
|
|
2700
2701
|
}
|
|
2701
2702
|
});
|
|
2702
2703
|
pluginManager.queue.on("add", () => {
|
|
2703
|
-
if (logger.logLevel !==
|
|
2704
|
+
if (logger.logLevel !== _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2704
2705
|
return;
|
|
2705
2706
|
}
|
|
2706
2707
|
if (count === 0) {
|
|
@@ -2708,36 +2709,34 @@ ${code}`]);
|
|
|
2708
2709
|
}
|
|
2709
2710
|
});
|
|
2710
2711
|
pluginManager.queue.on("active", () => {
|
|
2711
|
-
if (logger.logLevel !==
|
|
2712
|
+
if (logger.logLevel !== _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2712
2713
|
return;
|
|
2713
2714
|
}
|
|
2714
2715
|
if (logger.spinner && pluginManager.queue.size > 0) {
|
|
2715
2716
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
2716
|
-
logger.spinner.suffixText =
|
|
2717
|
+
logger.spinner.suffixText = _chunkTTAE4JRWcjs.p.dim(text);
|
|
2717
2718
|
}
|
|
2718
2719
|
++count;
|
|
2719
2720
|
});
|
|
2720
2721
|
pluginManager.queue.on("completed", () => {
|
|
2721
|
-
if (logger.logLevel !==
|
|
2722
|
+
if (logger.logLevel !== _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2722
2723
|
return;
|
|
2723
2724
|
}
|
|
2724
2725
|
if (logger.spinner) {
|
|
2725
2726
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
2726
|
-
logger.spinner.suffixText =
|
|
2727
|
+
logger.spinner.suffixText = _chunkTTAE4JRWcjs.p.dim(text);
|
|
2727
2728
|
}
|
|
2728
2729
|
});
|
|
2729
2730
|
pluginManager.on("executed", (executer) => {
|
|
2730
2731
|
const { hookName, plugin, output, parameters } = executer;
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
logger.emit("debug", logs);
|
|
2740
|
-
}
|
|
2732
|
+
const logs = [
|
|
2733
|
+
`${_chunkTTAE4JRWcjs.randomCliColour.call(void 0, plugin.name)} Executing ${hookName}`,
|
|
2734
|
+
parameters && `${_chunkTTAE4JRWcjs.p.bgWhite("Parameters")} ${_chunkTTAE4JRWcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
2735
|
+
JSON.stringify(parameters, void 0, 2),
|
|
2736
|
+
output && `${_chunkTTAE4JRWcjs.p.bgWhite("Output")} ${_chunkTTAE4JRWcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
2737
|
+
output
|
|
2738
|
+
].filter(Boolean);
|
|
2739
|
+
logger.emit("debug", logs);
|
|
2741
2740
|
});
|
|
2742
2741
|
return pluginManager;
|
|
2743
2742
|
}
|
|
@@ -2749,7 +2748,7 @@ async function build(options) {
|
|
|
2749
2748
|
parameters: [options.config]
|
|
2750
2749
|
});
|
|
2751
2750
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
2752
|
-
if (logger.logLevel ===
|
|
2751
|
+
if (logger.logLevel === _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2753
2752
|
logger.emit("end", "\u{1F4BE} Writing completed");
|
|
2754
2753
|
}
|
|
2755
2754
|
return {
|
|
@@ -2769,7 +2768,7 @@ async function safeBuild(options) {
|
|
|
2769
2768
|
parameters: [options.config]
|
|
2770
2769
|
});
|
|
2771
2770
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
2772
|
-
if (logger.logLevel ===
|
|
2771
|
+
if (logger.logLevel === _chunkTTAE4JRWcjs.LogLevel.info) {
|
|
2773
2772
|
logger.emit("end", "\u{1F4BE} Writing completed");
|
|
2774
2773
|
}
|
|
2775
2774
|
} catch (e) {
|