depcurfew 1.2.0 → 1.3.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/index.js CHANGED
@@ -1 +1,3 @@
1
- export { b as APPLY_ERRORS, x as APPLY_WARNINGS, m as ApplyWriteError, M as DEFAULT_POLICY, d as EXIT_FAILURE, f as EXIT_OK, p as EXIT_USAGE, N as POLICY_FILE, h as PolicyError, s as PopularNames, i as RULES, P as SCHEMA_URL, g as applyProject, _ as botDuration, l as checkSpec, u as checkSpecs, D as convertCooldown, O as convertMinutes, a as countLevels, I as detectProject, A as formatDuration, w as formatIssue, L as getVersion, v as loadPolicy, j as parseDuration, T as parsePolicy, y as planApply, F as renderPolicy, o as renderText, t as run, n as runDoctor, c as scanCommandLine, k as toDurationString, r as toSarif, C as unifiedDiff, E as validatePolicy, S as warningText } from "./run-BBZUJJq-.js";
1
+ import { A as parseDuration, C as formatIssue, D as convertMinutes, E as convertCooldown, F as detectProject, I as getVersion, M as POLICY_FILE, N as SCHEMA_URL, O as toDurationString, P as renderPolicy, S as unifiedDiff, T as validatePolicy, _ as planApply, a as RULES, b as APPLY_WARNINGS, c as PopularNames, d as checkSpecs, f as ApplyWriteError, g as loadPolicy, h as botDuration, i as toSarif, j as DEFAULT_POLICY, k as formatDuration, l as scanCommandLine, m as applyProject, o as countLevels, p as PolicyError, r as runDoctor, s as renderText, t as run, u as checkSpec, v as planRepository, w as parsePolicy, x as warningText, y as APPLY_ERRORS } from "./run-DYkP4HLQ.js";
2
+ import { n as EXIT_OK, r as EXIT_USAGE, t as EXIT_FAILURE } from "./io-eBMDYKV0.js";
3
+ export { APPLY_ERRORS, APPLY_WARNINGS, ApplyWriteError, DEFAULT_POLICY, EXIT_FAILURE, EXIT_OK, EXIT_USAGE, POLICY_FILE, PolicyError, PopularNames, RULES, SCHEMA_URL, applyProject, botDuration, checkSpec, checkSpecs, convertCooldown, convertMinutes, countLevels, detectProject, formatDuration, formatIssue, getVersion, loadPolicy, parseDuration, parsePolicy, planApply, planRepository, renderPolicy, renderText, run, runDoctor, scanCommandLine, toDurationString, toSarif, unifiedDiff, validatePolicy, warningText };
@@ -0,0 +1,52 @@
1
+ // src/color.ts
2
+ const CODES = {
3
+ red: [31, 39],
4
+ yellow: [33, 39],
5
+ green: [32, 39],
6
+ cyan: [36, 39],
7
+ bold: [1, 22],
8
+ dim: [2, 22]
9
+ };
10
+ const style = ([open, close]) => (text) => text === "" ? text : `\u001b[${open}m${text}\u001b[${close}m`;
11
+ const same = (text) => text;
12
+ const PLAIN = {
13
+ red: same,
14
+ yellow: same,
15
+ green: same,
16
+ cyan: same,
17
+ bold: same,
18
+ dim: same
19
+ };
20
+ const COLORED = {
21
+ red: style(CODES.red),
22
+ yellow: style(CODES.yellow),
23
+ green: style(CODES.green),
24
+ cyan: style(CODES.cyan),
25
+ bold: style(CODES.bold),
26
+ dim: style(CODES.dim)
27
+ };
28
+ function paint(colors) {
29
+ return colors === true ? COLORED : PLAIN;
30
+ }
31
+ /**
32
+ * Whether to color a stream. FORCE_COLOR wins (any value but "0" or "false" turns colors on, those two turn them
33
+ * off), then NO_COLOR with any non-empty value turns them off; otherwise only a terminal that is not "dumb" gets them.
34
+ */
35
+ function colorsFor(stream, env) {
36
+ const force = env["FORCE_COLOR"];
37
+ if (force !== void 0) return force !== "0" && force !== "false";
38
+ if ((env["NO_COLOR"] ?? "") !== "") return false;
39
+ return stream.isTTY === true && env["TERM"] !== "dumb";
40
+ }
41
+ /** Colors the prefix of diagnostic lines on stderr: "depcurfew:" and "error:" red, "warning:" yellow, "note:" cyan. */
42
+ function paintDiagnostics(text, colors) {
43
+ return text.replace(/^(depcurfew:|error:|warning:|note:)/gmu, (prefix) => {
44
+ if (prefix === "warning:") return colors.yellow(prefix);
45
+ return prefix === "note:" ? colors.cyan(prefix) : colors.red(colors.bold(prefix));
46
+ });
47
+ }
48
+ // src/cli/io.ts
49
+ const EXIT_OK = 0;
50
+ const EXIT_FAILURE = 1;
51
+ const EXIT_USAGE = 2;
52
+ export { colorsFor as a, PLAIN as i, EXIT_OK as n, paint as o, EXIT_USAGE as r, paintDiagnostics as s, EXIT_FAILURE as t };