@kubb/core 4.11.0 → 4.11.2
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/{getBarrelFiles-BkDzzugQ.cjs → getBarrelFiles-8VEWWk9Z.cjs} +80 -111
- package/dist/getBarrelFiles-8VEWWk9Z.cjs.map +1 -0
- package/dist/{getBarrelFiles-BVMBhc50.d.cts → getBarrelFiles-B_2WDywH.d.cts} +3 -3
- package/dist/{getBarrelFiles-a-GlnjYa.js → getBarrelFiles-DQ0hksqD.js} +80 -111
- package/dist/getBarrelFiles-DQ0hksqD.js.map +1 -0
- package/dist/{getBarrelFiles-DjQ68d4e.d.ts → getBarrelFiles-ZIHk_1ln.d.ts} +3 -3
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/index.cjs +261 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +262 -43
- package/dist/index.js.map +1 -1
- package/dist/{logger-DIA19Yfz.js → logger-CQn6sdC0.js} +72 -7
- package/dist/{logger-CPt4U57Z.cjs.map → logger-CQn6sdC0.js.map} +1 -1
- package/dist/{logger-CPt4U57Z.cjs → logger-US5g7KdM.cjs} +72 -7
- package/dist/logger-US5g7KdM.cjs.map +1 -0
- package/dist/{logger-C96jDrSt.d.ts → logger-mq06Cxxv.d.cts} +29 -4
- package/dist/{logger-BJDkLsF0.d.cts → logger-o16AyvGp.d.ts} +29 -4
- package/dist/logger.cjs +1 -1
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +1 -1
- package/dist/{types-tSSA1oz8.d.cts → types-CCEy_FVr.d.cts} +36 -27
- package/dist/{types-69-evK37.d.ts → types-DgfEZ3IN.d.ts} +36 -27
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/src/PluginManager.ts +81 -114
- package/src/build.ts +229 -25
- package/src/logger.ts +87 -9
- package/src/utils/ciDetection.ts +40 -0
- package/src/utils/diagnostics.ts +15 -0
- package/dist/getBarrelFiles-BkDzzugQ.cjs.map +0 -1
- package/dist/getBarrelFiles-a-GlnjYa.js.map +0 -1
- package/dist/logger-DIA19Yfz.js.map +0 -1
|
@@ -495,8 +495,8 @@ const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
|
495
495
|
const isWindows = platform === "win32";
|
|
496
496
|
const isDumbTerminal = env.TERM === "dumb";
|
|
497
497
|
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
498
|
-
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
499
|
-
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
498
|
+
const isCI$1 = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
499
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI$1);
|
|
500
500
|
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
501
501
|
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
502
502
|
}
|
|
@@ -992,13 +992,52 @@ function _getDefaultLogLevel() {
|
|
|
992
992
|
}
|
|
993
993
|
const consola = createConsola();
|
|
994
994
|
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/utils/ciDetection.ts
|
|
997
|
+
/**
|
|
998
|
+
* Detect if running in a CI environment
|
|
999
|
+
* Note: Currently exported for potential future use in plugins or extensions
|
|
1000
|
+
*/
|
|
1001
|
+
function isCI() {
|
|
1002
|
+
return !!(process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.BUILD_NUMBER || process.env.RUN_ID);
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Detect if running in GitHub Actions
|
|
1006
|
+
*/
|
|
1007
|
+
function isGitHubActions() {
|
|
1008
|
+
return process.env.GITHUB_ACTIONS === "true";
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* GitHub Actions group markers
|
|
1012
|
+
*/
|
|
1013
|
+
const GITHUB_ACTIONS_GROUP_START = "::group::";
|
|
1014
|
+
const GITHUB_ACTIONS_GROUP_END = "::endgroup::";
|
|
1015
|
+
/**
|
|
1016
|
+
* Create a collapsible group marker for GitHub Actions logs
|
|
1017
|
+
*/
|
|
1018
|
+
function startGroup(title) {
|
|
1019
|
+
if (isCI() && isGitHubActions()) return `${GITHUB_ACTIONS_GROUP_START}${title}`;
|
|
1020
|
+
return "";
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* End a collapsible group in GitHub Actions logs
|
|
1024
|
+
*/
|
|
1025
|
+
function endGroup() {
|
|
1026
|
+
if (isGitHubActions()) return GITHUB_ACTIONS_GROUP_END;
|
|
1027
|
+
return "";
|
|
1028
|
+
}
|
|
1029
|
+
|
|
995
1030
|
//#endregion
|
|
996
1031
|
//#region src/logger.ts
|
|
997
1032
|
const LogMapper = {
|
|
998
1033
|
silent: Number.NEGATIVE_INFINITY,
|
|
1034
|
+
error: 0,
|
|
1035
|
+
warn: 1,
|
|
999
1036
|
info: 3,
|
|
1000
|
-
|
|
1037
|
+
verbose: 4,
|
|
1038
|
+
debug: 5
|
|
1001
1039
|
};
|
|
1040
|
+
const DEBUG_LOG_TITLE_MAX_LENGTH = 50;
|
|
1002
1041
|
function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
1003
1042
|
const events = new EventEmitter();
|
|
1004
1043
|
const startDate = Date.now();
|
|
@@ -1025,8 +1064,35 @@ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
|
1025
1064
|
events.on("info", (message) => {
|
|
1026
1065
|
consola$1.info(pc.yellow(message));
|
|
1027
1066
|
});
|
|
1067
|
+
events.on("verbose", (message) => {
|
|
1068
|
+
if (logLevel >= LogMapper.verbose) {
|
|
1069
|
+
const formattedLogs = message.logs.join("\n");
|
|
1070
|
+
consola$1.log(pc.dim(formattedLogs));
|
|
1071
|
+
}
|
|
1072
|
+
cachedLogs.add(message);
|
|
1073
|
+
});
|
|
1028
1074
|
events.on("debug", (message) => {
|
|
1029
|
-
|
|
1075
|
+
const fullLog = message.logs.join("\n");
|
|
1076
|
+
if (logLevel >= LogMapper.debug) {
|
|
1077
|
+
if (isGitHubActions()) {
|
|
1078
|
+
if (message.pluginGroupMarker === "start") {
|
|
1079
|
+
const title = message.pluginName || "Plugin";
|
|
1080
|
+
console.log(startGroup(title));
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (message.pluginGroupMarker === "end") {
|
|
1084
|
+
console.log(endGroup());
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
if (!message.pluginName && message.category && ["setup", "file"].includes(message.category)) {
|
|
1088
|
+
const firstLine = message.logs[0] || "Debug Details";
|
|
1089
|
+
const title = firstLine.length > DEBUG_LOG_TITLE_MAX_LENGTH ? `${firstLine.substring(0, DEBUG_LOG_TITLE_MAX_LENGTH)}...` : firstLine;
|
|
1090
|
+
console.log(startGroup(title));
|
|
1091
|
+
console.log(pc.dim(fullLog));
|
|
1092
|
+
console.log(endGroup());
|
|
1093
|
+
} else consola$1.log(pc.dim(fullLog));
|
|
1094
|
+
} else if (!message.pluginGroupMarker) consola$1.log(pc.dim(fullLog));
|
|
1095
|
+
}
|
|
1030
1096
|
cachedLogs.add(message);
|
|
1031
1097
|
});
|
|
1032
1098
|
events.on("error", (message, cause) => {
|
|
@@ -1050,12 +1116,11 @@ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
|
1050
1116
|
cachedLogs.forEach((log) => {
|
|
1051
1117
|
const fileName = resolve(process.cwd(), ".kubb", log.fileName || `kubb-${startDate}.log`);
|
|
1052
1118
|
if (!files[fileName]) files[fileName] = [];
|
|
1053
|
-
files[fileName] = [...files[fileName], `[${log.date.toLocaleString()}]: ${log.logs.join("\n
|
|
1119
|
+
if (log.logs.length) files[fileName] = [...files[fileName], `[${log.date.toLocaleString()}]: \n${log.logs.join("\n")}`];
|
|
1054
1120
|
});
|
|
1055
1121
|
await Promise.all(Object.entries(files).map(async ([fileName, logs]) => {
|
|
1056
1122
|
return write(fileName, logs.join("\n"));
|
|
1057
1123
|
}));
|
|
1058
|
-
return Object.keys(files);
|
|
1059
1124
|
}
|
|
1060
1125
|
};
|
|
1061
1126
|
}
|
|
@@ -1084,4 +1149,4 @@ function randomCliColour(text) {
|
|
|
1084
1149
|
|
|
1085
1150
|
//#endregion
|
|
1086
1151
|
export { write as a, randomColour as i, createLogger as n, randomCliColour as r, LogMapper as t };
|
|
1087
|
-
//# sourceMappingURL=logger-
|
|
1152
|
+
//# sourceMappingURL=logger-CQn6sdC0.js.map
|