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/README.md +276 -54
- package/dist/cli.js +20 -3
- package/dist/index.d.ts +1047 -157
- package/dist/index.js +3 -1
- package/dist/io-eBMDYKV0.js +52 -0
- package/dist/{run-BBZUJJq-.js → run-DYkP4HLQ.js} +16492 -2689
- package/package.json +2 -2
- package/schema.json +30 -0
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { a as colorsFor } from "./io-eBMDYKV0.js";
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
/**
|
|
5
5
|
* Output to a stream whose reader has gone (depcurfew doctor --sarif | head -1) fails with EPIPE, which Node reports
|
|
@@ -21,7 +21,24 @@ function quietWhenClosed(stream) {
|
|
|
21
21
|
if (!closed) stream.write(text);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Node 22.15 and later warn on stderr while loading node:util (which parseArgs needs) when FORCE_COLOR and NO_COLOR
|
|
26
|
+
* are both set: "The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set". depcurfew decides about colors
|
|
27
|
+
* itself, the same way (colorsFor: FORCE_COLOR wins), and stderr must stay empty with --json. Node emits warnings on
|
|
28
|
+
* the next tick, which on Node.js 24 and later comes before this module runs when node:util is a static import, so the
|
|
29
|
+
* filter is installed first and the commands are loaded afterwards; every other warning is printed as before.
|
|
30
|
+
*/
|
|
31
|
+
function dropKnownWarnings() {
|
|
32
|
+
const printers = process.listeners("warning");
|
|
33
|
+
process.removeAllListeners("warning");
|
|
34
|
+
process.on("warning", (warning) => {
|
|
35
|
+
if (warning.name === "Warning" && warning.message.includes("'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env")) return;
|
|
36
|
+
if (warning.name === "ExperimentalWarning" && warning.message.startsWith("The Fetch API is an experimental feature")) return;
|
|
37
|
+
for (const print of printers) print(warning);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
dropKnownWarnings();
|
|
41
|
+
import("./run-DYkP4HLQ.js").then((n) => n.n).then(({ run }) => run(process.argv.slice(2), {
|
|
25
42
|
stdout: quietWhenClosed(process.stdout),
|
|
26
43
|
stderr: quietWhenClosed(process.stderr),
|
|
27
44
|
colors: {
|
|
@@ -32,7 +49,7 @@ run(process.argv.slice(2), {
|
|
|
32
49
|
stdout: process.stdout.isTTY === true,
|
|
33
50
|
stderr: process.stderr.isTTY === true
|
|
34
51
|
}
|
|
35
|
-
}).then((code) => {
|
|
52
|
+
})).then((code) => {
|
|
36
53
|
if (process.exitCode === void 0 || process.exitCode === 0) process.exitCode = code;
|
|
37
54
|
}, (error) => {
|
|
38
55
|
process.stderr.write(`depcurfew: unexpected error: ${error instanceof Error ? error.stack : String(error)}\n`);
|