@kubb/core 2.0.0-beta.12 → 2.0.0-beta.13
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-56YH3VX6.js +239 -0
- package/dist/chunk-56YH3VX6.js.map +1 -0
- package/dist/chunk-6N4JBFFS.js +79 -0
- package/dist/chunk-6N4JBFFS.js.map +1 -0
- package/dist/chunk-72O327DC.cjs +247 -0
- package/dist/chunk-72O327DC.cjs.map +1 -0
- package/dist/chunk-77QZQ377.cjs +155 -0
- package/dist/chunk-77QZQ377.cjs.map +1 -0
- package/dist/chunk-ABFPJZJL.cjs +131 -0
- package/dist/chunk-ABFPJZJL.cjs.map +1 -0
- package/dist/chunk-FOQFLMOC.js +2336 -0
- package/dist/chunk-FOQFLMOC.js.map +1 -0
- package/dist/chunk-I7UUR5MZ.cjs +91 -0
- package/dist/chunk-I7UUR5MZ.cjs.map +1 -0
- package/dist/chunk-L6F5QUH2.js +129 -0
- package/dist/chunk-L6F5QUH2.js.map +1 -0
- package/dist/chunk-PY7I7OEN.cjs +92 -0
- package/dist/chunk-PY7I7OEN.cjs.map +1 -0
- package/dist/chunk-SX2AYX5F.js +18 -0
- package/dist/chunk-SX2AYX5F.js.map +1 -0
- package/dist/chunk-WFDR7OMY.js +148 -0
- package/dist/chunk-WFDR7OMY.js.map +1 -0
- package/dist/chunk-Z7XZQBAK.cjs +2339 -0
- package/dist/chunk-Z7XZQBAK.cjs.map +1 -0
- package/dist/fs.cjs +19 -2372
- package/dist/fs.cjs.map +1 -1
- package/dist/fs.js +3 -2373
- package/dist/fs.js.map +1 -1
- package/dist/index.cjs +209 -3251
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +139 -3473
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +18 -141
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +2 -135
- package/dist/logger.js.map +1 -1
- package/dist/transformers.cjs +40 -208
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +15 -201
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +29 -534
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +10 -526
- package/dist/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/BarrelManager.ts +3 -3
- package/src/FileManager.ts +6 -5
- package/src/utils/FunctionParams.ts +2 -2
- package/src/utils/URLPath.ts +5 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkI7UUR5MZ_cjs = require('./chunk-I7UUR5MZ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/transformers/casing.ts
|
|
6
|
+
chunkI7UUR5MZ_cjs.init_cjs_shims();
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/.pnpm/change-case@5.2.0/node_modules/change-case/dist/index.js
|
|
9
|
+
chunkI7UUR5MZ_cjs.init_cjs_shims();
|
|
10
|
+
var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
11
|
+
var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
12
|
+
var SPLIT_NUMBER_LOWER_RE = /(\d)(\p{Ll})/gu;
|
|
13
|
+
var SPLIT_LETTER_NUMBER_RE = /(\p{L})(\d)/gu;
|
|
14
|
+
var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
15
|
+
var SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
16
|
+
var DEFAULT_PREFIX_CHARACTERS = "";
|
|
17
|
+
function split(input, options) {
|
|
18
|
+
let result = input.trim();
|
|
19
|
+
result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
20
|
+
if (options?.separateNumbers) {
|
|
21
|
+
result = result.replace(SPLIT_NUMBER_LOWER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_LETTER_NUMBER_RE, SPLIT_REPLACE_VALUE);
|
|
22
|
+
}
|
|
23
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
24
|
+
let start = 0;
|
|
25
|
+
let end = result.length;
|
|
26
|
+
while (result.charAt(start) === "\0")
|
|
27
|
+
start++;
|
|
28
|
+
if (start === end)
|
|
29
|
+
return [];
|
|
30
|
+
while (result.charAt(end - 1) === "\0")
|
|
31
|
+
end--;
|
|
32
|
+
return result.slice(start, end).split(/\0/g);
|
|
33
|
+
}
|
|
34
|
+
function camelCase(input, options) {
|
|
35
|
+
const prefix = getPrefix(input, options?.prefixCharacters);
|
|
36
|
+
const lower = lowerFactory(options?.locale);
|
|
37
|
+
const upper = upperFactory(options?.locale);
|
|
38
|
+
const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
|
|
39
|
+
return prefix + split(input, options).map((word, index) => {
|
|
40
|
+
if (index === 0)
|
|
41
|
+
return lower(word);
|
|
42
|
+
return transform(word, index);
|
|
43
|
+
}).join(options?.delimiter ?? "");
|
|
44
|
+
}
|
|
45
|
+
function pascalCase(input, options) {
|
|
46
|
+
const prefix = getPrefix(input, options?.prefixCharacters);
|
|
47
|
+
const lower = lowerFactory(options?.locale);
|
|
48
|
+
const upper = upperFactory(options?.locale);
|
|
49
|
+
const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
|
|
50
|
+
return prefix + split(input, options).map(transform).join(options?.delimiter ?? "");
|
|
51
|
+
}
|
|
52
|
+
function lowerFactory(locale) {
|
|
53
|
+
return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
|
|
54
|
+
}
|
|
55
|
+
function upperFactory(locale) {
|
|
56
|
+
return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
|
|
57
|
+
}
|
|
58
|
+
function capitalCaseTransformFactory(lower, upper) {
|
|
59
|
+
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
|
|
60
|
+
}
|
|
61
|
+
function pascalCaseTransformFactory(lower, upper) {
|
|
62
|
+
return (word, index) => {
|
|
63
|
+
const char0 = word[0];
|
|
64
|
+
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
|
|
65
|
+
return initial + lower(word.slice(1));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function getPrefix(input, prefixCharacters = DEFAULT_PREFIX_CHARACTERS) {
|
|
69
|
+
let prefix = "";
|
|
70
|
+
for (let i = 0; i < input.length; i++) {
|
|
71
|
+
const char = input.charAt(i);
|
|
72
|
+
if (prefixCharacters.includes(char)) {
|
|
73
|
+
prefix += char;
|
|
74
|
+
} else {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return prefix;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/transformers/casing.ts
|
|
82
|
+
function camelCase2(text) {
|
|
83
|
+
return camelCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
84
|
+
}
|
|
85
|
+
function pascalCase2(text) {
|
|
86
|
+
return pascalCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
exports.camelCase = camelCase2;
|
|
90
|
+
exports.pascalCase = pascalCase2;
|
|
91
|
+
//# sourceMappingURL=out.js.map
|
|
92
|
+
//# sourceMappingURL=chunk-PY7I7OEN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transformers/casing.ts","../../../node_modules/.pnpm/change-case@5.2.0/node_modules/change-case/src/index.ts"],"names":["camelCase","pascalCase"],"mappings":";;;;;AAAA;;;ACAA;AACA,IAAM,uBAAuB;AAC7B,IAAM,uBAAuB;AAC7B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB;AAG/B,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAG5B,IAAM,4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SAAS,aAAa,EAAE;AAEpC;AA2FA,SAAS,aAAa,QAAc;AAClC,SAAO,WAAW,QACd,CAAC,UAAkB,MAAM,YAAW,IACpC,CAAC,UAAkB,MAAM,kBAAkB,MAAM;AACvD;AAEA,SAAS,aAAa,QAAc;AAClC,SAAO,WAAW,QACd,CAAC,UAAkB,MAAM,YAAW,IACpC,CAAC,UAAkB,MAAM,kBAAkB,MAAM;AACvD;AAEA,SAAS,4BACP,OACA,OAAgC;AAEhC,SAAO,CAAC,SAAiB,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC;AACnE;AAEA,SAAS,2BACP,OACA,OAAgC;AAEhC,SAAO,CAAC,MAAc,UAAiB;AACrC,UAAM,QAAQ,KAAK,CAAC;AACpB,UAAM,UACJ,QAAQ,KAAK,SAAS,OAAO,SAAS,MAAM,MAAM,QAAQ,MAAM,KAAK;AACvE,WAAO,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;EACtC;AACF;AAEA,SAAS,UACP,OACA,mBAAmB,2BAAyB;AAE5C,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,OAAO,CAAC;AAC3B,QAAI,iBAAiB,SAAS,IAAI,GAAG;AACnC,gBAAU;WACL;AACL;;;AAGJ,SAAO;AACT;;;ADjQO,SAASA,WAAU,MAAsB;AAC9C,SAAO,UAAgB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AAChF;AAEO,SAASC,YAAW,MAAsB;AAC/C,SAAO,WAAiB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AACjF","sourcesContent":["import { camelCase as changeCaseCamel, pascalCase as changePascalCase } from 'change-case'\n\nexport function camelCase(text: string): string {\n return changeCaseCamel(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n\nexport function pascalCase(text: string): string {\n return changePascalCase(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n","// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\nconst SPLIT_NUMBER_LOWER_RE = /(\\d)(\\p{Ll})/gu;\nconst SPLIT_LETTER_NUMBER_RE = /(\\p{L})(\\d)/gu;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options extends SplitOptions {\n locale?: Locale;\n delimiter?: string;\n prefixCharacters?: string;\n}\n\n/**\n * Options used for splitting strings into word segments.\n */\nexport interface SplitOptions {\n separateNumbers?: boolean;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(input: string, options?: SplitOptions) {\n let result = input.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n if (options?.separateNumbers) {\n result = result\n .replace(SPLIT_NUMBER_LOWER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_LETTER_NUMBER_RE, SPLIT_REPLACE_VALUE);\n }\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n return (\n prefix +\n split(input, options)\n .map(lowerFactory(options?.locale))\n .join(options?.delimiter ?? \" \")\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n split(input, options)\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\")\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n split(input, options)\n .map(transform)\n .join(options?.delimiter ?? \"\")\n );\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n split(input, options)\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \")\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n return (\n prefix +\n split(input, options)\n .map(upperFactory(options?.locale))\n .join(options?.delimiter ?? \"_\")\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const prefix = getPrefix(input, options?.prefixCharacters);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n split(input, options)\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \")\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction getPrefix(\n input: string,\n prefixCharacters = DEFAULT_PREFIX_CHARACTERS,\n): string {\n let prefix = \"\";\n for (let i = 0; i < input.length; i++) {\n const char = input.charAt(i);\n if (prefixCharacters.includes(char)) {\n prefix += char;\n } else {\n break;\n }\n }\n return prefix;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { init_esm_shims } from './chunk-6N4JBFFS.js';
|
|
3
|
+
import { camelCase as camelCase$1, pascalCase as pascalCase$1 } from 'change-case';
|
|
4
|
+
|
|
5
|
+
createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
// src/transformers/casing.ts
|
|
8
|
+
init_esm_shims();
|
|
9
|
+
function camelCase(text) {
|
|
10
|
+
return camelCase$1(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
11
|
+
}
|
|
12
|
+
function pascalCase(text) {
|
|
13
|
+
return pascalCase$1(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { camelCase, pascalCase };
|
|
17
|
+
//# sourceMappingURL=out.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-SX2AYX5F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transformers/casing.ts"],"names":[],"mappings":";;;;;;;;;AAAA;AAAA,SAAS,aAAa,iBAAiB,cAAc,wBAAwB;AAEtE,SAAS,UAAU,MAAsB;AAC9C,SAAO,gBAAgB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AAChF;AAEO,SAAS,WAAW,MAAsB;AAC/C,SAAO,iBAAiB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AACjF","sourcesContent":["import { camelCase as changeCaseCamel, pascalCase as changePascalCase } from 'change-case'\n\nexport function camelCase(text: string): string {\n return changeCaseCamel(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n\nexport function pascalCase(text: string): string {\n return changePascalCase(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { init_esm_shims } from './chunk-6N4JBFFS.js';
|
|
3
|
+
import seedrandom from 'seedrandom';
|
|
4
|
+
import { isatty } from 'tty';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
// src/logger.ts
|
|
9
|
+
init_esm_shims();
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
|
|
14
|
+
// ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
|
|
15
|
+
init_esm_shims();
|
|
16
|
+
var b = {
|
|
17
|
+
reset: [0, 0],
|
|
18
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
19
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
20
|
+
italic: [3, 23],
|
|
21
|
+
underline: [4, 24],
|
|
22
|
+
inverse: [7, 27],
|
|
23
|
+
hidden: [8, 28],
|
|
24
|
+
strikethrough: [9, 29],
|
|
25
|
+
black: [30, 39],
|
|
26
|
+
red: [31, 39],
|
|
27
|
+
green: [32, 39],
|
|
28
|
+
yellow: [33, 39],
|
|
29
|
+
blue: [34, 39],
|
|
30
|
+
magenta: [35, 39],
|
|
31
|
+
cyan: [36, 39],
|
|
32
|
+
white: [37, 39],
|
|
33
|
+
gray: [90, 39],
|
|
34
|
+
bgBlack: [40, 49],
|
|
35
|
+
bgRed: [41, 49],
|
|
36
|
+
bgGreen: [42, 49],
|
|
37
|
+
bgYellow: [43, 49],
|
|
38
|
+
bgBlue: [44, 49],
|
|
39
|
+
bgMagenta: [45, 49],
|
|
40
|
+
bgCyan: [46, 49],
|
|
41
|
+
bgWhite: [47, 49]
|
|
42
|
+
};
|
|
43
|
+
var C = Object.entries(b);
|
|
44
|
+
function d(r2) {
|
|
45
|
+
return String(r2);
|
|
46
|
+
}
|
|
47
|
+
d.open = "";
|
|
48
|
+
d.close = "";
|
|
49
|
+
function p(r2 = false) {
|
|
50
|
+
let n = typeof process != "undefined" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];
|
|
51
|
+
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" || r2 && t.TERM !== "dumb" || "CI" in t) || typeof window != "undefined" && !!window.chrome;
|
|
52
|
+
}
|
|
53
|
+
function w(r2 = false) {
|
|
54
|
+
let n = p(r2), t = (e, o, c, i) => {
|
|
55
|
+
let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);
|
|
56
|
+
return ~l ? u + t(s, o, c, l) : u + s;
|
|
57
|
+
}, a = (e, o, c = e) => {
|
|
58
|
+
let i = (u) => {
|
|
59
|
+
let s = String(u), l = s.indexOf(o, e.length);
|
|
60
|
+
return ~l ? e + t(s, o, c, l) + o : e + s + o;
|
|
61
|
+
};
|
|
62
|
+
return i.open = e, i.close = o, i;
|
|
63
|
+
}, g = {
|
|
64
|
+
isColorSupported: n
|
|
65
|
+
}, f = (e) => `\x1B[${e}m`;
|
|
66
|
+
for (let [e, o] of C)
|
|
67
|
+
g[e] = n ? a(
|
|
68
|
+
f(o[0]),
|
|
69
|
+
f(o[1]),
|
|
70
|
+
o[2]
|
|
71
|
+
) : d;
|
|
72
|
+
return g;
|
|
73
|
+
}
|
|
74
|
+
var p2 = w(isatty(1));
|
|
75
|
+
|
|
76
|
+
// src/logger.ts
|
|
77
|
+
var LogLevel = {
|
|
78
|
+
silent: "silent",
|
|
79
|
+
info: "info",
|
|
80
|
+
debug: "debug"
|
|
81
|
+
};
|
|
82
|
+
function createLogger({ logLevel, name, spinner }) {
|
|
83
|
+
const logs = [];
|
|
84
|
+
const log = (message) => {
|
|
85
|
+
if (message && spinner) {
|
|
86
|
+
spinner.text = message;
|
|
87
|
+
logs.push(message);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const error = (message) => {
|
|
91
|
+
if (message) {
|
|
92
|
+
throw new Error(message || "Something went wrong");
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const warn = (message) => {
|
|
96
|
+
if (message && spinner) {
|
|
97
|
+
spinner.warn(p2.yellow(message));
|
|
98
|
+
logs.push(message);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const info = (message) => {
|
|
102
|
+
if (message && spinner && logLevel !== LogLevel.silent) {
|
|
103
|
+
spinner.info(message);
|
|
104
|
+
logs.push(message);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const logger = {
|
|
108
|
+
name,
|
|
109
|
+
logLevel,
|
|
110
|
+
log,
|
|
111
|
+
error,
|
|
112
|
+
warn,
|
|
113
|
+
info,
|
|
114
|
+
spinner,
|
|
115
|
+
logs
|
|
116
|
+
};
|
|
117
|
+
return logger;
|
|
118
|
+
}
|
|
119
|
+
var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
|
|
120
|
+
function randomColour(text, colours = defaultColours) {
|
|
121
|
+
if (!text) {
|
|
122
|
+
return "white";
|
|
123
|
+
}
|
|
124
|
+
const random = seedrandom(text);
|
|
125
|
+
const colour = colours.at(Math.floor(random() * colours.length)) || "white";
|
|
126
|
+
return colour;
|
|
127
|
+
}
|
|
128
|
+
function randomCliColour(text, colors = defaultColours) {
|
|
129
|
+
const colours = w(true);
|
|
130
|
+
if (!text) {
|
|
131
|
+
return colours.white(text);
|
|
132
|
+
}
|
|
133
|
+
const colour = randomColour(text, colors);
|
|
134
|
+
const isDark = colour.includes("dark");
|
|
135
|
+
const key = colour.replace("dark", "").toLowerCase();
|
|
136
|
+
const formatter = colours[key];
|
|
137
|
+
if (isDark) {
|
|
138
|
+
return p2.bold(formatter(text));
|
|
139
|
+
}
|
|
140
|
+
if (typeof formatter !== "function") {
|
|
141
|
+
throw new Error("Formatter for picoColor is not of type function/Formatter");
|
|
142
|
+
}
|
|
143
|
+
return formatter(text);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { LogLevel, createLogger, p2 as p, randomCliColour, randomColour };
|
|
147
|
+
//# sourceMappingURL=out.js.map
|
|
148
|
+
//# sourceMappingURL=chunk-WFDR7OMY.js.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"],"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;AAAA,EACd,WAAW,CAAC,GAAG,EAAE;AAAA,EACjB,SAAS,CAAC,GAAG,EAAE;AAAA,EACf,QAAQ,CAAC,GAAG,EAAE;AAAA,EACd,eAAe,CAAC,GAAG,EAAE;AAAA,EACrB,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,KAAK,CAAC,IAAI,EAAE;AAAA,EACZ,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,QAAQ,CAAC,IAAI,EAAE;AAAA,EACf,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,SAAS,CA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,YAAY;AACxC,QAAI,WAAW,WAAW,aAAa,SAAS,QAAQ;AACtD,cAAQ,KAAK,OAAO;AACpB,WAAK,KAAK,OAAO;AAAA,IACnB;AAAA,EACF;AAEA,QAAM,SAAiB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAM,iBAAiB,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 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\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n log: (message: string | null) => void\n error: (message: string | null) => void\n info: (message: string | null) => void\n warn: (message: string | null) => void\n spinner?: Ora\n logs: string[]\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 logs: string[] = []\n const log: Logger['log'] = (message) => {\n if (message && spinner) {\n spinner.text = message\n logs.push(message)\n }\n }\n\n const error: Logger['error'] = (message) => {\n if (message) {\n throw new Error(message || 'Something went wrong')\n }\n }\n\n const warn: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.warn(c.yellow(message))\n logs.push(message)\n }\n }\n\n const info: Logger['warn'] = (message) => {\n if (message && spinner && logLevel !== LogLevel.silent) {\n spinner.info(message)\n logs.push(message)\n }\n }\n\n const logger: Logger = {\n name,\n logLevel,\n log,\n error,\n warn,\n info,\n spinner,\n logs,\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"]}
|