v11y-check 0.9.0 → 0.10.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 +3 -9
- package/dist/esm/.cache +1 -1
- package/dist/esm/bin/route.js +105 -103
- package/dist/esm/bin/v11y.js +7 -7
- package/dist/esm/cli.d.ts +1 -1
- package/dist/esm/cli.js +209 -207
- package/dist/esm/config.d.ts +1 -1
- package/dist/esm/config.js +36 -39
- package/dist/esm/format-actions.d.ts +2 -2
- package/dist/esm/format-actions.js +28 -29
- package/dist/esm/format-check.d.ts +1 -1
- package/dist/esm/format-check.js +101 -100
- package/dist/esm/format-summary.d.ts +2 -2
- package/dist/esm/format-summary.js +11 -11
- package/dist/esm/format-time.js +34 -29
- package/dist/esm/format-verbose.d.ts +2 -2
- package/dist/esm/format-verbose.js +119 -111
- package/dist/esm/generate.d.ts +1 -1
- package/dist/esm/generate.js +23 -26
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +3 -20
- package/dist/esm/init/initCommand.js +25 -27
- package/dist/esm/init/scaffold.js +36 -40
- package/dist/esm/init/templates.js +9 -16
- package/dist/esm/run-audit.d.ts +1 -1
- package/dist/esm/run-audit.js +145 -145
- package/dist/esm/sync.d.ts +1 -1
- package/dist/esm/sync.js +77 -83
- package/dist/esm/tmp.js +11 -13
- package/dist/esm/types.js +34 -37
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
Wraps [audit-ci](https://github.com/IBM/audit-ci) with a richer config model, typed JSON source of truth, and a sync workflow that automates allowlist management.
|
|
4
4
|
|
|
5
5
|
<!-- section:release-notes -->
|
|
6
|
-
## Release notes — v0.
|
|
6
|
+
## Release notes — v0.10.0 (2026-07-01)
|
|
7
7
|
|
|
8
8
|
### 🎉 Features
|
|
9
9
|
|
|
10
|
-
- 🚨 **Breaking:**
|
|
10
|
+
- 🚨 **Breaking:** Rebuild nmr-compile on a unified tsc emit (#455)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### 🐛 Bug fixes
|
|
15
|
-
|
|
16
|
-
- Prevent CLI output truncation when piped before exit (#446)
|
|
17
|
-
|
|
18
|
-
Fixes an issue where large output from the `nmr` and `v11y` commands could be truncated when captured through a pipe — for example, by a CI job.
|
|
12
|
+
`nmr` now compiles a package's JavaScript and type declarations in one step, rewriting every import form — static, re-export, dynamic `import()`, bare side-effect, and tsconfig `paths` aliases — to runnable `.js` in both outputs. It now requires TypeScript 5.7 or newer as a peer dependency.
|
|
19
13
|
<!-- /section:release-notes -->
|
|
20
14
|
|
|
21
15
|
## Installation
|
package/dist/esm/.cache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d32d9586bf4dd951e3fa117d2712ec09488bb0d025fa16d5daf7c659b885db79
|
package/dist/esm/bin/route.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { parseArgs, readPackageVersion, reportError } from
|
|
1
|
+
import { parseArgs, readPackageVersion, reportError } from '@williamthorsen/nmr-core';
|
|
2
2
|
import { auditCommand, checkCommand, extractMessage, syncCommand } from "../cli.js";
|
|
3
3
|
import { initCommand } from "../init/initCommand.js";
|
|
4
4
|
const VERSION = readPackageVersion(import.meta.url);
|
|
5
|
-
const SUBCOMMANDS = [
|
|
5
|
+
const SUBCOMMANDS = ['check', 'init', 'sync'];
|
|
6
6
|
const MIN_PREFIX_LENGTH = 3;
|
|
7
7
|
function showHelp() {
|
|
8
|
-
|
|
8
|
+
console.info(`
|
|
9
9
|
Usage: v11y [options]
|
|
10
10
|
v11y <command> [options]
|
|
11
11
|
|
|
@@ -28,7 +28,7 @@ Other options:
|
|
|
28
28
|
`);
|
|
29
29
|
}
|
|
30
30
|
function showInitHelp() {
|
|
31
|
-
|
|
31
|
+
console.info(`
|
|
32
32
|
Usage: v11y init [options]
|
|
33
33
|
|
|
34
34
|
Scaffold a starter config file and GitHub Actions workflow.
|
|
@@ -40,7 +40,7 @@ Options:
|
|
|
40
40
|
`);
|
|
41
41
|
}
|
|
42
42
|
function showSyncHelp() {
|
|
43
|
-
|
|
43
|
+
console.info(`
|
|
44
44
|
Usage: v11y sync [options]
|
|
45
45
|
|
|
46
46
|
Synchronize allowlists with current audit findings.
|
|
@@ -56,109 +56,111 @@ Other options:
|
|
|
56
56
|
`);
|
|
57
57
|
}
|
|
58
58
|
function parseSharedFlags(flags) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
const flagSchema = {
|
|
60
|
+
config: { long: '--config', type: 'string' },
|
|
61
|
+
dev: { long: '--dev', type: 'boolean' },
|
|
62
|
+
json: { long: '--json', type: 'boolean', short: '-j' },
|
|
63
|
+
prod: { long: '--prod', type: 'boolean' },
|
|
64
|
+
verbose: { long: '--verbose', type: 'boolean', short: '-v' },
|
|
65
|
+
};
|
|
66
|
+
const { flags: parsed } = parseArgs(flags, flagSchema);
|
|
67
|
+
if (parsed.dev && parsed.prod) {
|
|
68
|
+
throw new Error('Cannot specify both --dev and --prod');
|
|
69
|
+
}
|
|
70
|
+
const scopes = [];
|
|
71
|
+
if (parsed.dev)
|
|
72
|
+
scopes.push('dev');
|
|
73
|
+
if (parsed.prod)
|
|
74
|
+
scopes.push('prod');
|
|
75
|
+
return {
|
|
76
|
+
configPath: parsed.config,
|
|
77
|
+
json: parsed.json,
|
|
78
|
+
scopes,
|
|
79
|
+
verbose: parsed.verbose,
|
|
80
|
+
};
|
|
79
81
|
}
|
|
80
82
|
function findTypoMatch(input) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
if (input.length < MIN_PREFIX_LENGTH || input.startsWith('-')) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
for (const cmd of SUBCOMMANDS) {
|
|
87
|
+
if (cmd !== input && cmd.startsWith(input)) {
|
|
88
|
+
return cmd;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
90
92
|
}
|
|
91
|
-
async function routeCommand(args) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
93
|
+
export async function routeCommand(args) {
|
|
94
|
+
const command = args[0];
|
|
95
|
+
if (command === '--help' || command === '-h') {
|
|
96
|
+
showHelp();
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (command === '--version' || command === '-V') {
|
|
100
|
+
console.info(VERSION);
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
if (command === 'check') {
|
|
104
|
+
return handleSubcommand(args.slice(1), checkCommand);
|
|
105
|
+
}
|
|
106
|
+
if (command === 'init') {
|
|
107
|
+
return handleInit(args.slice(1));
|
|
108
|
+
}
|
|
109
|
+
if (command === 'sync') {
|
|
110
|
+
return handleSubcommand(args.slice(1), syncCommand, showSyncHelp);
|
|
111
|
+
}
|
|
112
|
+
if (command !== undefined && !command.startsWith('-')) {
|
|
113
|
+
const typoMatch = findTypoMatch(command);
|
|
114
|
+
if (typoMatch !== undefined) {
|
|
115
|
+
reportError(`Unknown command '${command}'. Did you mean 'v11y ${typoMatch}'?`);
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
reportError(`Unknown command '${command}'.`);
|
|
119
|
+
return 1;
|
|
120
|
+
}
|
|
121
|
+
if (args.includes('--raw')) {
|
|
122
|
+
const filteredArgs = args.filter((a) => a !== '--raw');
|
|
123
|
+
return handleSubcommand(filteredArgs, auditCommand);
|
|
124
|
+
}
|
|
125
|
+
return handleSubcommand(args, checkCommand);
|
|
124
126
|
}
|
|
125
127
|
async function handleSubcommand(flags, handler, helpFn = showHelp) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
if (flags.some((f) => f === '--help' || f === '-h')) {
|
|
129
|
+
helpFn();
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
let options;
|
|
133
|
+
try {
|
|
134
|
+
options = parseSharedFlags(flags);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
reportError(extractMessage(error));
|
|
138
|
+
return 1;
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
return await handler(options);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
reportError(extractMessage(error));
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
function handleInit(flags) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
149
|
+
if (flags.some((f) => f === '--help' || f === '-h')) {
|
|
150
|
+
showInitHelp();
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
const initFlagSchema = {
|
|
154
|
+
dryRun: { long: '--dry-run', type: 'boolean', short: '-n' },
|
|
155
|
+
force: { long: '--force', type: 'boolean', short: '-f' },
|
|
156
|
+
};
|
|
157
|
+
let parsed;
|
|
158
|
+
try {
|
|
159
|
+
parsed = parseArgs(flags, initFlagSchema);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
reportError(extractMessage(error));
|
|
163
|
+
return 1;
|
|
164
|
+
}
|
|
165
|
+
return initCommand({ dryRun: parsed.flags.dryRun, force: parsed.flags.force });
|
|
161
166
|
}
|
|
162
|
-
export {
|
|
163
|
-
routeCommand
|
|
164
|
-
};
|
package/dist/esm/bin/v11y.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import process from
|
|
1
|
+
import process from 'node:process';
|
|
2
2
|
import { routeCommand } from "./route.js";
|
|
3
3
|
let exitCode;
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`);
|
|
10
|
-
|
|
5
|
+
exitCode = await routeCommand(process.argv.slice(2));
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
9
|
+
process.stderr.write(`v11y: unexpected error: ${message}\n`);
|
|
10
|
+
exitCode = 1;
|
|
11
11
|
}
|
|
12
12
|
process.exitCode = exitCode;
|
package/dist/esm/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandOptions } from './types.
|
|
1
|
+
import type { CommandOptions } from './types.js';
|
|
2
2
|
export declare function extractMessage(error: unknown): string;
|
|
3
3
|
export declare function auditCommand(options: CommandOptions): Promise<number>;
|
|
4
4
|
export declare function checkCommand(options: CommandOptions): Promise<number>;
|