v11y-check 0.8.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 CHANGED
@@ -3,13 +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.8.0 (2026-06-27)
6
+ ## Release notes — v0.10.0 (2026-07-01)
7
7
 
8
8
  ### 🎉 Features
9
9
 
10
- - Centralize the per-package build as an nmr-compile bin (#419)
10
+ - 🚨 **Breaking:** Rebuild nmr-compile on a unified tsc emit (#455)
11
11
 
12
- Introduces `nmr-compile`, a single command shipped with `@williamthorsen/nmr` that compiles each workspace package and now backs the default build. Consuming repos can delete their own per-package build script and pick up future build fixes just by upgrading nmr. Repeated builds with unchanged source now reliably skip recompiling instead of occasionally rebuilding for no reason, and import aliases now resolve correctly in symlinked checkouts.
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.
13
13
  <!-- /section:release-notes -->
14
14
 
15
15
  ## Installation
package/dist/esm/.cache CHANGED
@@ -1 +1 @@
1
- 2c25f324f3be5c45a36af1cc6917c88ff92f1a269164f7aa94a0b8179dd59f31
1
+ d32d9586bf4dd951e3fa117d2712ec09488bb0d025fa16d5daf7c659b885db79
@@ -1,12 +1,11 @@
1
- import process from "node:process";
2
- import { parseArgs, readPackageVersion, translateParseError } from "@williamthorsen/nmr-core";
1
+ import { parseArgs, readPackageVersion, reportError } from '@williamthorsen/nmr-core';
3
2
  import { auditCommand, checkCommand, extractMessage, syncCommand } from "../cli.js";
4
3
  import { initCommand } from "../init/initCommand.js";
5
4
  const VERSION = readPackageVersion(import.meta.url);
6
- const SUBCOMMANDS = ["check", "init", "sync"];
5
+ const SUBCOMMANDS = ['check', 'init', 'sync'];
7
6
  const MIN_PREFIX_LENGTH = 3;
8
7
  function showHelp() {
9
- console.info(`
8
+ console.info(`
10
9
  Usage: v11y [options]
11
10
  v11y <command> [options]
12
11
 
@@ -29,7 +28,7 @@ Other options:
29
28
  `);
30
29
  }
31
30
  function showInitHelp() {
32
- console.info(`
31
+ console.info(`
33
32
  Usage: v11y init [options]
34
33
 
35
34
  Scaffold a starter config file and GitHub Actions workflow.
@@ -41,7 +40,7 @@ Options:
41
40
  `);
42
41
  }
43
42
  function showSyncHelp() {
44
- console.info(`
43
+ console.info(`
45
44
  Usage: v11y sync [options]
46
45
 
47
46
  Synchronize allowlists with current audit findings.
@@ -57,114 +56,111 @@ Other options:
57
56
  `);
58
57
  }
59
58
  function parseSharedFlags(flags) {
60
- const flagSchema = {
61
- config: { long: "--config", type: "string" },
62
- dev: { long: "--dev", type: "boolean" },
63
- json: { long: "--json", type: "boolean", short: "-j" },
64
- prod: { long: "--prod", type: "boolean" },
65
- verbose: { long: "--verbose", type: "boolean", short: "-v" }
66
- };
67
- const { flags: parsed } = parseArgs(flags, flagSchema);
68
- if (parsed.dev && parsed.prod) {
69
- throw new Error("Cannot specify both --dev and --prod");
70
- }
71
- const scopes = [];
72
- if (parsed.dev) scopes.push("dev");
73
- if (parsed.prod) scopes.push("prod");
74
- return {
75
- configPath: parsed.config,
76
- json: parsed.json,
77
- scopes,
78
- verbose: parsed.verbose
79
- };
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
+ };
80
81
  }
81
82
  function findTypoMatch(input) {
82
- if (input.length < MIN_PREFIX_LENGTH || input.startsWith("-")) {
83
- return void 0;
84
- }
85
- for (const cmd of SUBCOMMANDS) {
86
- if (cmd !== input && cmd.startsWith(input)) {
87
- return cmd;
88
- }
89
- }
90
- return void 0;
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;
91
92
  }
92
- async function routeCommand(args) {
93
- const command = args[0];
94
- if (command === "--help" || command === "-h") {
95
- showHelp();
96
- return 0;
97
- }
98
- if (command === "--version" || command === "-V") {
99
- console.info(VERSION);
100
- return 0;
101
- }
102
- if (command === "check") {
103
- return handleSubcommand(args.slice(1), checkCommand);
104
- }
105
- if (command === "init") {
106
- return handleInit(args.slice(1));
107
- }
108
- if (command === "sync") {
109
- return handleSubcommand(args.slice(1), syncCommand, showSyncHelp);
110
- }
111
- if (command !== void 0 && !command.startsWith("-")) {
112
- const typoMatch = findTypoMatch(command);
113
- if (typoMatch !== void 0) {
114
- process.stderr.write(`Error: Unknown command '${command}'. Did you mean 'v11y ${typoMatch}'?
115
- `);
116
- return 1;
93
+ export async function routeCommand(args) {
94
+ const command = args[0];
95
+ if (command === '--help' || command === '-h') {
96
+ showHelp();
97
+ return 0;
117
98
  }
118
- process.stderr.write(`Error: Unknown command '${command}'.
119
- `);
120
- return 1;
121
- }
122
- if (args.includes("--raw")) {
123
- const filteredArgs = args.filter((a) => a !== "--raw");
124
- return handleSubcommand(filteredArgs, auditCommand);
125
- }
126
- return handleSubcommand(args, checkCommand);
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);
127
126
  }
128
127
  async function handleSubcommand(flags, handler, helpFn = showHelp) {
129
- if (flags.some((f) => f === "--help" || f === "-h")) {
130
- helpFn();
131
- return 0;
132
- }
133
- let options;
134
- try {
135
- options = parseSharedFlags(flags);
136
- } catch (error) {
137
- process.stderr.write(`Error: ${translateParseError(error)}
138
- `);
139
- return 1;
140
- }
141
- try {
142
- return await handler(options);
143
- } catch (error) {
144
- process.stderr.write(`Error: ${extractMessage(error)}
145
- `);
146
- return 1;
147
- }
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
+ }
148
147
  }
149
148
  function handleInit(flags) {
150
- if (flags.some((f) => f === "--help" || f === "-h")) {
151
- showInitHelp();
152
- return 0;
153
- }
154
- const initFlagSchema = {
155
- dryRun: { long: "--dry-run", type: "boolean", short: "-n" },
156
- force: { long: "--force", type: "boolean", short: "-f" }
157
- };
158
- let parsed;
159
- try {
160
- parsed = parseArgs(flags, initFlagSchema);
161
- } catch (error) {
162
- process.stderr.write(`Error: ${translateParseError(error)}
163
- `);
164
- return 1;
165
- }
166
- return initCommand({ dryRun: parsed.flags.dryRun, force: parsed.flags.force });
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 });
167
166
  }
168
- export {
169
- routeCommand
170
- };
@@ -1,12 +1,12 @@
1
- import process from "node:process";
1
+ import process from 'node:process';
2
2
  import { routeCommand } from "./route.js";
3
3
  let exitCode;
4
4
  try {
5
- exitCode = await routeCommand(process.argv.slice(2));
6
- } catch (error) {
7
- const message = error instanceof Error ? error.message : String(error);
8
- process.stderr.write(`v11y: unexpected error: ${message}
9
- `);
10
- exitCode = 1;
5
+ exitCode = await routeCommand(process.argv.slice(2));
11
6
  }
12
- process.exit(exitCode);
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
+ }
12
+ process.exitCode = exitCode;
package/dist/esm/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CommandOptions } from './types.ts';
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>;