@williamthorsen/nmr-core 0.15.0 → 0.15.1
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/.meta/changelog.json +17 -0
- package/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/dist/esm/UserError.d.ts +2 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/isAnticipatedFailure.d.ts +5 -0
- package/dist/esm/isAnticipatedFailure.js +12 -0
- package/dist/esm/terminal.d.ts +2 -2
- package/dist/esm/terminal.js +2 -2
- package/package.json +1 -1
package/.meta/changelog.json
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.15.1",
|
|
4
|
+
"date": "2026-11-06",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "🐛 Bug fixes",
|
|
8
|
+
"audience": "all",
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"description": "Fixes the issue that `nmr` and `v11y-check` printed a Node system error, such as `EACCES` or `ENOENT`, as an internal error with a stack trace rather than as `Error: <message>`. (#1158)",
|
|
12
|
+
"hash": "3a62cc768b23f37156c846f32fd4acaa70f7f931",
|
|
13
|
+
"entry": 2
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
2
19
|
{
|
|
3
20
|
"version": "0.15.0",
|
|
4
21
|
"date": "2026-11-05",
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.15.1 — 2026-11-06
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug fixes
|
|
8
|
+
|
|
9
|
+
- Fixes the issue that `nmr` and `v11y-check` printed a Node system error, such as `EACCES` or `ENOENT`, as an internal error with a stack trace rather than as `Error: <message>`. (#1158)
|
|
10
|
+
|
|
5
11
|
## 0.15.0 — 2026-11-05
|
|
6
12
|
|
|
7
13
|
### 🎉 Features
|
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@ Shared utilities for node-monorepo-tools packages.
|
|
|
7
7
|
This package serves as the shared library foundation for the monorepo. For the nmr CLI tool, see [`@williamthorsen/nmr`](../nmr).
|
|
8
8
|
|
|
9
9
|
<!-- section:release-notes -->
|
|
10
|
-
## Release notes — v0.15.
|
|
10
|
+
## Release notes — v0.15.1 (2026-11-06)
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### 🐛 Bug fixes
|
|
13
13
|
|
|
14
|
-
-
|
|
14
|
+
- Fixes the issue that `nmr` and `v11y-check` printed a Node system error, such as `EACCES` or `ENOENT`, as an internal error with a stack trace rather than as `Error: <message>`. (#1158)
|
|
15
15
|
<!-- /section:release-notes -->
|
|
16
16
|
|
|
17
17
|
## Installation
|
package/dist/esm/UserError.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* A failure that the tool anticipated -- in the user's input, config, or environment, including a failed external
|
|
3
3
|
* command -- rather than a fault in the tool.
|
|
4
4
|
*
|
|
5
|
-
* A CLI's last-resort handler prints one of these as `Error: <message
|
|
5
|
+
* A CLI's last-resort handler prints one of these, or a Node system error, as `Error: <message>`, and anything else as an
|
|
6
|
+
* internal error.
|
|
6
7
|
*/
|
|
7
8
|
export declare class UserError extends Error {
|
|
8
9
|
constructor(message: string, options?: ErrorOptions);
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { GIT_OUTPUT_LIMIT_BYTES } from './gitOutputLimit.js';
|
|
|
5
5
|
export { hasErrnoCode } from './hasErrnoCode.js';
|
|
6
6
|
export type { WorkingTreeHashResult } from './hashWorkingTree.js';
|
|
7
7
|
export { hashWorkingTree, readHeadSha } from './hashWorkingTree.js';
|
|
8
|
+
export { isAnticipatedFailure } from './isAnticipatedFailure.js';
|
|
8
9
|
export type { FlagDefinition, FlagSchema, ParseArgsOptions, ParsedArgs, ParsedFlags, ParseErrorKind, } from './parseArgs.js';
|
|
9
10
|
export { parseArgs, parseArgsOrExit, ParseError } from './parseArgs.js';
|
|
10
11
|
export type { GlyphSet, InvalidOutputStyle, OutputStyle, ResolveStreamStylesOptions, StatusGlyphName, StreamStyleResolution, StreamStyles, TruncateToWidthOptions, } from './terminal.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { readCacheEntry, readGuardedCacheEntry, readJsonCacheEntry, removeCacheD
|
|
|
3
3
|
export { GIT_OUTPUT_LIMIT_BYTES } from "./gitOutputLimit.js";
|
|
4
4
|
export { hasErrnoCode } from "./hasErrnoCode.js";
|
|
5
5
|
export { hashWorkingTree, readHeadSha } from "./hashWorkingTree.js";
|
|
6
|
+
export { isAnticipatedFailure } from "./isAnticipatedFailure.js";
|
|
6
7
|
export { parseArgs, parseArgsOrExit, ParseError } from "./parseArgs.js";
|
|
7
8
|
export { defineGlyphSet, describeInvalidOutputStyle, formatErrorLine, formatGlyphLine, formatStatusLine, measureGlyphColumn, measureWidth, printError, printSkip, printStep, printSuccess, reportCrash, reportError, reportFailure, reportTemplateUpdate, reportWriteResult, resolveStreamStyles, STATUS_GLYPHS, truncateToWidth, wrapToWidth, } from "./terminal.js";
|
|
8
9
|
export { startTimer } from "./timer.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports whether a thrown value is a failure that a CLI reports as `Error: <message>` rather than as an internal
|
|
3
|
+
* error: a `UserError`, or a Node system error such as `EACCES` or `ENOENT`, which comes from the environment.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isAnticipatedFailure(error: unknown): error is Error;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isError } from '@williamthorsen/toolbelt.errors';
|
|
2
|
+
import { UserError } from "./UserError.js";
|
|
3
|
+
export function isAnticipatedFailure(error) {
|
|
4
|
+
return error instanceof UserError || isSystemError(error);
|
|
5
|
+
}
|
|
6
|
+
function isSystemError(error) {
|
|
7
|
+
return (isError(error) &&
|
|
8
|
+
'code' in error &&
|
|
9
|
+
typeof error.code === 'string' &&
|
|
10
|
+
'syscall' in error &&
|
|
11
|
+
typeof error.syscall === 'string');
|
|
12
|
+
}
|
package/dist/esm/terminal.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function reportCrash(bin: string, error: unknown, stream?: Writab
|
|
|
49
49
|
/** Writes the canonical `Error: <message>` line to `stream`, which an in-process CLI sets to its own `Writable`. */
|
|
50
50
|
export declare function reportError(message: string, stream?: Writable): void;
|
|
51
51
|
/**
|
|
52
|
-
* Writes a failure that reached a CLI's last-resort handler:
|
|
53
|
-
* as an internal error through `reportCrash`.
|
|
52
|
+
* Writes a failure that reached a CLI's last-resort handler: an anticipated failure (see `isAnticipatedFailure`) as
|
|
53
|
+
* `Error: <message>`, and anything else as an internal error through `reportCrash`.
|
|
54
54
|
*/
|
|
55
55
|
export declare function reportFailure(bin: string, error: unknown, stream?: Writable): void;
|
|
56
56
|
/**
|
package/dist/esm/terminal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { describeError, isError } from '@williamthorsen/toolbelt.errors';
|
|
3
3
|
import { detectOutputStyle, measureGlyphColumn, resolveOutputStyle, STATUS_GLYPHS, } from '@williamthorsen/toolbelt.terminal/candidate';
|
|
4
|
-
import {
|
|
4
|
+
import { isAnticipatedFailure } from "./isAnticipatedFailure.js";
|
|
5
5
|
export { defineGlyphSet, describeInvalidOutputStyle, measureGlyphColumn, measureWidth, STATUS_GLYPHS, truncateToWidth, wrapToWidth, } from '@williamthorsen/toolbelt.terminal/candidate';
|
|
6
6
|
export function formatErrorLine(message) {
|
|
7
7
|
return `Error: ${message}`;
|
|
@@ -37,7 +37,7 @@ export function reportError(message, stream = process.stderr) {
|
|
|
37
37
|
stream.write(`${formatErrorLine(message)}\n`);
|
|
38
38
|
}
|
|
39
39
|
export function reportFailure(bin, error, stream = process.stderr) {
|
|
40
|
-
if (error
|
|
40
|
+
if (isAnticipatedFailure(error)) {
|
|
41
41
|
reportError(describeError(error), stream);
|
|
42
42
|
return;
|
|
43
43
|
}
|