@html-validate/commitlint-config 3.0.30 → 3.2.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/bin/commitlint.js +3 -0
- package/bin/install.js +3 -0
- package/dist/commitlint.js +264488 -0
- package/dist/commitlint.schema.json +105 -0
- package/dist/config.js +181 -0
- package/dist/formatter.js +565 -0
- package/dist/install.js +476 -0
- package/dist/parser-preset.js +518 -0
- package/dist/templates/commit.hbs +30 -0
- package/dist/templates/footer.hbs +0 -0
- package/dist/templates/header.hbs +9 -0
- package/dist/templates/template.hbs +23 -0
- package/package.json +20 -42
- package/cli.js +0 -3
- package/index.js +0 -6
- package/install.js +0 -59
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
|
|
2
|
+
import { dirname as _$_dirname } from "node:path";
|
|
3
|
+
import { createRequire as _$_createRequire } from "node:module";
|
|
4
|
+
import { fileURLToPath as _$_fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const require = _$_createRequire(import.meta.url);
|
|
7
|
+
const __dirname = _$_dirname(_$_fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// node_modules/@commitlint/format/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
11
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
12
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
13
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
14
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
15
|
+
var styles = {
|
|
16
|
+
modifier: {
|
|
17
|
+
reset: [0, 0],
|
|
18
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
19
|
+
bold: [1, 22],
|
|
20
|
+
dim: [2, 22],
|
|
21
|
+
italic: [3, 23],
|
|
22
|
+
underline: [4, 24],
|
|
23
|
+
overline: [53, 55],
|
|
24
|
+
inverse: [7, 27],
|
|
25
|
+
hidden: [8, 28],
|
|
26
|
+
strikethrough: [9, 29]
|
|
27
|
+
},
|
|
28
|
+
color: {
|
|
29
|
+
black: [30, 39],
|
|
30
|
+
red: [31, 39],
|
|
31
|
+
green: [32, 39],
|
|
32
|
+
yellow: [33, 39],
|
|
33
|
+
blue: [34, 39],
|
|
34
|
+
magenta: [35, 39],
|
|
35
|
+
cyan: [36, 39],
|
|
36
|
+
white: [37, 39],
|
|
37
|
+
// Bright color
|
|
38
|
+
blackBright: [90, 39],
|
|
39
|
+
gray: [90, 39],
|
|
40
|
+
// Alias of `blackBright`
|
|
41
|
+
grey: [90, 39],
|
|
42
|
+
// Alias of `blackBright`
|
|
43
|
+
redBright: [91, 39],
|
|
44
|
+
greenBright: [92, 39],
|
|
45
|
+
yellowBright: [93, 39],
|
|
46
|
+
blueBright: [94, 39],
|
|
47
|
+
magentaBright: [95, 39],
|
|
48
|
+
cyanBright: [96, 39],
|
|
49
|
+
whiteBright: [97, 39]
|
|
50
|
+
},
|
|
51
|
+
bgColor: {
|
|
52
|
+
bgBlack: [40, 49],
|
|
53
|
+
bgRed: [41, 49],
|
|
54
|
+
bgGreen: [42, 49],
|
|
55
|
+
bgYellow: [43, 49],
|
|
56
|
+
bgBlue: [44, 49],
|
|
57
|
+
bgMagenta: [45, 49],
|
|
58
|
+
bgCyan: [46, 49],
|
|
59
|
+
bgWhite: [47, 49],
|
|
60
|
+
// Bright color
|
|
61
|
+
bgBlackBright: [100, 49],
|
|
62
|
+
bgGray: [100, 49],
|
|
63
|
+
// Alias of `bgBlackBright`
|
|
64
|
+
bgGrey: [100, 49],
|
|
65
|
+
// Alias of `bgBlackBright`
|
|
66
|
+
bgRedBright: [101, 49],
|
|
67
|
+
bgGreenBright: [102, 49],
|
|
68
|
+
bgYellowBright: [103, 49],
|
|
69
|
+
bgBlueBright: [104, 49],
|
|
70
|
+
bgMagentaBright: [105, 49],
|
|
71
|
+
bgCyanBright: [106, 49],
|
|
72
|
+
bgWhiteBright: [107, 49]
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
76
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
77
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
78
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
79
|
+
function assembleStyles() {
|
|
80
|
+
const codes = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
82
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
83
|
+
styles[styleName] = {
|
|
84
|
+
open: `\x1B[${style[0]}m`,
|
|
85
|
+
close: `\x1B[${style[1]}m`
|
|
86
|
+
};
|
|
87
|
+
group[styleName] = styles[styleName];
|
|
88
|
+
codes.set(style[0], style[1]);
|
|
89
|
+
}
|
|
90
|
+
Object.defineProperty(styles, groupName, {
|
|
91
|
+
value: group,
|
|
92
|
+
enumerable: false
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
Object.defineProperty(styles, "codes", {
|
|
96
|
+
value: codes,
|
|
97
|
+
enumerable: false
|
|
98
|
+
});
|
|
99
|
+
styles.color.close = "\x1B[39m";
|
|
100
|
+
styles.bgColor.close = "\x1B[49m";
|
|
101
|
+
styles.color.ansi = wrapAnsi16();
|
|
102
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
103
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
104
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
105
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
106
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
107
|
+
Object.defineProperties(styles, {
|
|
108
|
+
rgbToAnsi256: {
|
|
109
|
+
value(red, green, blue) {
|
|
110
|
+
if (red === green && green === blue) {
|
|
111
|
+
if (red < 8) {
|
|
112
|
+
return 16;
|
|
113
|
+
}
|
|
114
|
+
if (red > 248) {
|
|
115
|
+
return 231;
|
|
116
|
+
}
|
|
117
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
118
|
+
}
|
|
119
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
120
|
+
},
|
|
121
|
+
enumerable: false
|
|
122
|
+
},
|
|
123
|
+
hexToRgb: {
|
|
124
|
+
value(hex) {
|
|
125
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
126
|
+
if (!matches) {
|
|
127
|
+
return [0, 0, 0];
|
|
128
|
+
}
|
|
129
|
+
let [colorString] = matches;
|
|
130
|
+
if (colorString.length === 3) {
|
|
131
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
132
|
+
}
|
|
133
|
+
const integer = Number.parseInt(colorString, 16);
|
|
134
|
+
return [
|
|
135
|
+
/* eslint-disable no-bitwise */
|
|
136
|
+
integer >> 16 & 255,
|
|
137
|
+
integer >> 8 & 255,
|
|
138
|
+
integer & 255
|
|
139
|
+
/* eslint-enable no-bitwise */
|
|
140
|
+
];
|
|
141
|
+
},
|
|
142
|
+
enumerable: false
|
|
143
|
+
},
|
|
144
|
+
hexToAnsi256: {
|
|
145
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
146
|
+
enumerable: false
|
|
147
|
+
},
|
|
148
|
+
ansi256ToAnsi: {
|
|
149
|
+
value(code) {
|
|
150
|
+
if (code < 8) {
|
|
151
|
+
return 30 + code;
|
|
152
|
+
}
|
|
153
|
+
if (code < 16) {
|
|
154
|
+
return 90 + (code - 8);
|
|
155
|
+
}
|
|
156
|
+
let red;
|
|
157
|
+
let green;
|
|
158
|
+
let blue;
|
|
159
|
+
if (code >= 232) {
|
|
160
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
161
|
+
green = red;
|
|
162
|
+
blue = red;
|
|
163
|
+
} else {
|
|
164
|
+
code -= 16;
|
|
165
|
+
const remainder = code % 36;
|
|
166
|
+
red = Math.floor(code / 36) / 5;
|
|
167
|
+
green = Math.floor(remainder / 6) / 5;
|
|
168
|
+
blue = remainder % 6 / 5;
|
|
169
|
+
}
|
|
170
|
+
const value = Math.max(red, green, blue) * 2;
|
|
171
|
+
if (value === 0) {
|
|
172
|
+
return 30;
|
|
173
|
+
}
|
|
174
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
175
|
+
if (value === 2) {
|
|
176
|
+
result += 60;
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
},
|
|
180
|
+
enumerable: false
|
|
181
|
+
},
|
|
182
|
+
rgbToAnsi: {
|
|
183
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
184
|
+
enumerable: false
|
|
185
|
+
},
|
|
186
|
+
hexToAnsi: {
|
|
187
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
188
|
+
enumerable: false
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return styles;
|
|
192
|
+
}
|
|
193
|
+
var ansiStyles = assembleStyles();
|
|
194
|
+
var ansi_styles_default = ansiStyles;
|
|
195
|
+
|
|
196
|
+
// node_modules/@commitlint/format/node_modules/chalk/source/vendor/supports-color/index.js
|
|
197
|
+
import process from "node:process";
|
|
198
|
+
import os from "node:os";
|
|
199
|
+
import tty from "node:tty";
|
|
200
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
|
|
201
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
202
|
+
const position = argv.indexOf(prefix + flag);
|
|
203
|
+
const terminatorPosition = argv.indexOf("--");
|
|
204
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
205
|
+
}
|
|
206
|
+
var { env } = process;
|
|
207
|
+
var flagForceColor;
|
|
208
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
209
|
+
flagForceColor = 0;
|
|
210
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
211
|
+
flagForceColor = 1;
|
|
212
|
+
}
|
|
213
|
+
function envForceColor() {
|
|
214
|
+
if ("FORCE_COLOR" in env) {
|
|
215
|
+
if (env.FORCE_COLOR === "true") {
|
|
216
|
+
return 1;
|
|
217
|
+
}
|
|
218
|
+
if (env.FORCE_COLOR === "false") {
|
|
219
|
+
return 0;
|
|
220
|
+
}
|
|
221
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function translateLevel(level) {
|
|
225
|
+
if (level === 0) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
level,
|
|
230
|
+
hasBasic: true,
|
|
231
|
+
has256: level >= 2,
|
|
232
|
+
has16m: level >= 3
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
236
|
+
const noFlagForceColor = envForceColor();
|
|
237
|
+
if (noFlagForceColor !== void 0) {
|
|
238
|
+
flagForceColor = noFlagForceColor;
|
|
239
|
+
}
|
|
240
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
241
|
+
if (forceColor === 0) {
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
if (sniffFlags) {
|
|
245
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
246
|
+
return 3;
|
|
247
|
+
}
|
|
248
|
+
if (hasFlag("color=256")) {
|
|
249
|
+
return 2;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
253
|
+
return 1;
|
|
254
|
+
}
|
|
255
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
const min = forceColor || 0;
|
|
259
|
+
if (env.TERM === "dumb") {
|
|
260
|
+
return min;
|
|
261
|
+
}
|
|
262
|
+
if (process.platform === "win32") {
|
|
263
|
+
const osRelease = os.release().split(".");
|
|
264
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
265
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
266
|
+
}
|
|
267
|
+
return 1;
|
|
268
|
+
}
|
|
269
|
+
if ("CI" in env) {
|
|
270
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
271
|
+
return 3;
|
|
272
|
+
}
|
|
273
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
return min;
|
|
277
|
+
}
|
|
278
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
279
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
280
|
+
}
|
|
281
|
+
if (env.COLORTERM === "truecolor") {
|
|
282
|
+
return 3;
|
|
283
|
+
}
|
|
284
|
+
if (env.TERM === "xterm-kitty") {
|
|
285
|
+
return 3;
|
|
286
|
+
}
|
|
287
|
+
if ("TERM_PROGRAM" in env) {
|
|
288
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
289
|
+
switch (env.TERM_PROGRAM) {
|
|
290
|
+
case "iTerm.app": {
|
|
291
|
+
return version >= 3 ? 3 : 2;
|
|
292
|
+
}
|
|
293
|
+
case "Apple_Terminal": {
|
|
294
|
+
return 2;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
299
|
+
return 2;
|
|
300
|
+
}
|
|
301
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
302
|
+
return 1;
|
|
303
|
+
}
|
|
304
|
+
if ("COLORTERM" in env) {
|
|
305
|
+
return 1;
|
|
306
|
+
}
|
|
307
|
+
return min;
|
|
308
|
+
}
|
|
309
|
+
function createSupportsColor(stream, options = {}) {
|
|
310
|
+
const level = _supportsColor(stream, {
|
|
311
|
+
streamIsTTY: stream && stream.isTTY,
|
|
312
|
+
...options
|
|
313
|
+
});
|
|
314
|
+
return translateLevel(level);
|
|
315
|
+
}
|
|
316
|
+
var supportsColor = {
|
|
317
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
318
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
319
|
+
};
|
|
320
|
+
var supports_color_default = supportsColor;
|
|
321
|
+
|
|
322
|
+
// node_modules/@commitlint/format/node_modules/chalk/source/utilities.js
|
|
323
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
324
|
+
let index = string.indexOf(substring);
|
|
325
|
+
if (index === -1) {
|
|
326
|
+
return string;
|
|
327
|
+
}
|
|
328
|
+
const substringLength = substring.length;
|
|
329
|
+
let endIndex = 0;
|
|
330
|
+
let returnValue = "";
|
|
331
|
+
do {
|
|
332
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
333
|
+
endIndex = index + substringLength;
|
|
334
|
+
index = string.indexOf(substring, endIndex);
|
|
335
|
+
} while (index !== -1);
|
|
336
|
+
returnValue += string.slice(endIndex);
|
|
337
|
+
return returnValue;
|
|
338
|
+
}
|
|
339
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
340
|
+
let endIndex = 0;
|
|
341
|
+
let returnValue = "";
|
|
342
|
+
do {
|
|
343
|
+
const gotCR = string[index - 1] === "\r";
|
|
344
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
345
|
+
endIndex = index + 1;
|
|
346
|
+
index = string.indexOf("\n", endIndex);
|
|
347
|
+
} while (index !== -1);
|
|
348
|
+
returnValue += string.slice(endIndex);
|
|
349
|
+
return returnValue;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// node_modules/@commitlint/format/node_modules/chalk/source/index.js
|
|
353
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
354
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
355
|
+
var STYLER = Symbol("STYLER");
|
|
356
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
357
|
+
var levelMapping = [
|
|
358
|
+
"ansi",
|
|
359
|
+
"ansi",
|
|
360
|
+
"ansi256",
|
|
361
|
+
"ansi16m"
|
|
362
|
+
];
|
|
363
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
364
|
+
var applyOptions = (object, options = {}) => {
|
|
365
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
366
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
367
|
+
}
|
|
368
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
369
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
370
|
+
};
|
|
371
|
+
var chalkFactory = (options) => {
|
|
372
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
373
|
+
applyOptions(chalk2, options);
|
|
374
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
375
|
+
return chalk2;
|
|
376
|
+
};
|
|
377
|
+
function createChalk(options) {
|
|
378
|
+
return chalkFactory(options);
|
|
379
|
+
}
|
|
380
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
381
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
382
|
+
styles2[styleName] = {
|
|
383
|
+
get() {
|
|
384
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
385
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
386
|
+
return builder;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
styles2.visible = {
|
|
391
|
+
get() {
|
|
392
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
393
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
394
|
+
return builder;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
398
|
+
if (model === "rgb") {
|
|
399
|
+
if (level === "ansi16m") {
|
|
400
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
401
|
+
}
|
|
402
|
+
if (level === "ansi256") {
|
|
403
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
404
|
+
}
|
|
405
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
406
|
+
}
|
|
407
|
+
if (model === "hex") {
|
|
408
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
409
|
+
}
|
|
410
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
411
|
+
};
|
|
412
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
413
|
+
for (const model of usedModels) {
|
|
414
|
+
styles2[model] = {
|
|
415
|
+
get() {
|
|
416
|
+
const { level } = this;
|
|
417
|
+
return function(...arguments_) {
|
|
418
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
419
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
424
|
+
styles2[bgModel] = {
|
|
425
|
+
get() {
|
|
426
|
+
const { level } = this;
|
|
427
|
+
return function(...arguments_) {
|
|
428
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
429
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
var proto = Object.defineProperties(() => {
|
|
435
|
+
}, {
|
|
436
|
+
...styles2,
|
|
437
|
+
level: {
|
|
438
|
+
enumerable: true,
|
|
439
|
+
get() {
|
|
440
|
+
return this[GENERATOR].level;
|
|
441
|
+
},
|
|
442
|
+
set(level) {
|
|
443
|
+
this[GENERATOR].level = level;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
var createStyler = (open, close, parent) => {
|
|
448
|
+
let openAll;
|
|
449
|
+
let closeAll;
|
|
450
|
+
if (parent === void 0) {
|
|
451
|
+
openAll = open;
|
|
452
|
+
closeAll = close;
|
|
453
|
+
} else {
|
|
454
|
+
openAll = parent.openAll + open;
|
|
455
|
+
closeAll = close + parent.closeAll;
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
open,
|
|
459
|
+
close,
|
|
460
|
+
openAll,
|
|
461
|
+
closeAll,
|
|
462
|
+
parent
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
466
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
467
|
+
Object.setPrototypeOf(builder, proto);
|
|
468
|
+
builder[GENERATOR] = self;
|
|
469
|
+
builder[STYLER] = _styler;
|
|
470
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
471
|
+
return builder;
|
|
472
|
+
};
|
|
473
|
+
var applyStyle = (self, string) => {
|
|
474
|
+
if (self.level <= 0 || !string) {
|
|
475
|
+
return self[IS_EMPTY] ? "" : string;
|
|
476
|
+
}
|
|
477
|
+
let styler = self[STYLER];
|
|
478
|
+
if (styler === void 0) {
|
|
479
|
+
return string;
|
|
480
|
+
}
|
|
481
|
+
const { openAll, closeAll } = styler;
|
|
482
|
+
if (string.includes("\x1B")) {
|
|
483
|
+
while (styler !== void 0) {
|
|
484
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
485
|
+
styler = styler.parent;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
const lfIndex = string.indexOf("\n");
|
|
489
|
+
if (lfIndex !== -1) {
|
|
490
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
491
|
+
}
|
|
492
|
+
return openAll + string + closeAll;
|
|
493
|
+
};
|
|
494
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
495
|
+
var chalk = createChalk();
|
|
496
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
497
|
+
var source_default = chalk;
|
|
498
|
+
|
|
499
|
+
// node_modules/@commitlint/format/lib/format.js
|
|
500
|
+
var DEFAULT_SIGNS = [" ", "\u26A0", "\u2716"];
|
|
501
|
+
var DEFAULT_COLORS = ["white", "yellow", "red"];
|
|
502
|
+
function format(report = {}, options = {}) {
|
|
503
|
+
const { results = [] } = report;
|
|
504
|
+
const fi = (result) => formatInput(result, options);
|
|
505
|
+
const fr = (result) => formatResult(result, options);
|
|
506
|
+
return results.filter((r) => Array.isArray(r.warnings) || Array.isArray(r.errors)).map((result) => [...fi(result), ...fr(result)]).reduce((acc, item) => Array.isArray(item) ? [...acc, ...item] : [...acc, item], []).join("\n");
|
|
507
|
+
}
|
|
508
|
+
function formatInput(result, options = {}) {
|
|
509
|
+
const { color: enabled = true } = options;
|
|
510
|
+
const { errors = [], warnings = [], input = "" } = result;
|
|
511
|
+
if (!input) {
|
|
512
|
+
return [""];
|
|
513
|
+
}
|
|
514
|
+
const sign = "\u29D7";
|
|
515
|
+
const decoration = enabled ? source_default.gray(sign) : sign;
|
|
516
|
+
const commitText = errors.length > 0 ? input : input.split("\n")[0];
|
|
517
|
+
const decoratedInput = enabled ? source_default.bold(commitText) : commitText;
|
|
518
|
+
const hasProblems = errors.length > 0 || warnings.length > 0;
|
|
519
|
+
return options.verbose || hasProblems ? [`${decoration} input: ${decoratedInput}`] : [];
|
|
520
|
+
}
|
|
521
|
+
function formatResult(result = {}, options = {}) {
|
|
522
|
+
const { signs = DEFAULT_SIGNS, colors = DEFAULT_COLORS, color: enabled = true } = options;
|
|
523
|
+
const { errors = [], warnings = [] } = result;
|
|
524
|
+
const problems = [...errors, ...warnings].map((problem) => {
|
|
525
|
+
const sign2 = signs[problem.level] || "";
|
|
526
|
+
const color2 = colors[problem.level] || "white";
|
|
527
|
+
const decoration = enabled ? source_default[color2](sign2) : sign2;
|
|
528
|
+
const name = enabled ? source_default.grey(`[${problem.name}]`) : `[${problem.name}]`;
|
|
529
|
+
return `${decoration} ${problem.message} ${name}`;
|
|
530
|
+
});
|
|
531
|
+
const sign = selectSign(result);
|
|
532
|
+
const color = selectColor(result);
|
|
533
|
+
const deco = enabled ? source_default[color](sign) : sign;
|
|
534
|
+
const el = errors.length;
|
|
535
|
+
const wl = warnings.length;
|
|
536
|
+
const hasProblems = problems.length > 0;
|
|
537
|
+
const summary = options.verbose || hasProblems ? `${deco} found ${el} problems, ${wl} warnings` : void 0;
|
|
538
|
+
const fmtSummary = enabled && typeof summary === "string" ? source_default.bold(summary) : summary;
|
|
539
|
+
const help = hasProblems && options.helpUrl ? `\u24D8 Get help: ${options.helpUrl}` : void 0;
|
|
540
|
+
return [
|
|
541
|
+
...problems,
|
|
542
|
+
hasProblems ? "" : void 0,
|
|
543
|
+
fmtSummary,
|
|
544
|
+
help,
|
|
545
|
+
hasProblems ? "" : void 0
|
|
546
|
+
].filter((line) => typeof line === "string");
|
|
547
|
+
}
|
|
548
|
+
function selectSign(result) {
|
|
549
|
+
if ((result.errors || []).length > 0) {
|
|
550
|
+
return "\u2716";
|
|
551
|
+
}
|
|
552
|
+
return (result.warnings || []).length ? "\u26A0" : "\u2714";
|
|
553
|
+
}
|
|
554
|
+
function selectColor(result) {
|
|
555
|
+
if ((result.errors || []).length > 0) {
|
|
556
|
+
return "red";
|
|
557
|
+
}
|
|
558
|
+
return (result.warnings || []).length ? "yellow" : "green";
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// src/formatter.ts
|
|
562
|
+
var formatter_default = format;
|
|
563
|
+
export {
|
|
564
|
+
formatter_default as default
|
|
565
|
+
};
|