@williamthorsen/nmr-core 0.13.2 → 0.13.4

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.
@@ -1,4 +1,38 @@
1
1
  [
2
+ {
3
+ "version": "0.13.4",
4
+ "date": "2026-10-17",
5
+ "sections": [
6
+ {
7
+ "title": "📦 Dependencies",
8
+ "audience": "dev",
9
+ "items": [
10
+ {
11
+ "description": "Upgrades `@williamthorsen/eslint-config-typescript` from 18.0.0 to 19.0.0 and rewrites the code in `build-info`, `nmr-core`, `nmr`, and `release-kit` that its new and widened rules report, without changing behavior. (#1047)",
12
+ "hash": "610ee159fdc429681b1078b500a064c5df296724",
13
+ "entry": 1
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "version": "0.13.3",
21
+ "date": "2026-10-12",
22
+ "sections": [
23
+ {
24
+ "title": "🏗️ Internal features",
25
+ "audience": "dev",
26
+ "items": [
27
+ {
28
+ "description": "Fixes the issue that nmr-core's `findPackageRoot` and `readPackageVersion` stopped at the first `package.json` above the caller, which in a dual-format layout is a marker manifest without a `version`, by re-exporting `findPackageRoot` and `resolveSelfVersion` from `@williamthorsen/toolbelt.packaging/candidate` in place of both walks. (#1016)",
29
+ "hash": "ff6627180d9e86d083656afb2c09a3fb190fc79d",
30
+ "entry": 1
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
2
36
  {
3
37
  "version": "0.13.2",
4
38
  "date": "2026-10-08",
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.13.4 — 2026-10-17
6
+
7
+ ### 📦 Dependencies
8
+
9
+ - Upgrades `@williamthorsen/eslint-config-typescript` from 18.0.0 to 19.0.0 and rewrites the code in `build-info`, `nmr-core`, `nmr`, and `release-kit` that its new and widened rules report, without changing behavior. (#1047)
10
+
11
+ ## 0.13.3 — 2026-10-12
12
+
13
+ ### 🏗️ Internal features
14
+
15
+ - Fixes the issue that nmr-core's `findPackageRoot` and `readPackageVersion` stopped at the first `package.json` above the caller, which in a dual-format layout is a marker manifest without a `version`, by re-exporting `findPackageRoot` and `resolveSelfVersion` from `@williamthorsen/toolbelt.packaging/candidate` in place of both walks. (#1016)
16
+
5
17
  ## 0.13.2 — 2026-10-08
6
18
 
7
19
  ### 🏗️ Internal features
@@ -92,14 +92,15 @@ function collectChangedPaths(statusOutput) {
92
92
  return { ok: false, reason: `malformed git status record: ${JSON.stringify(record.slice(0, 40))}` };
93
93
  }
94
94
  paths.add(changedPath);
95
- if (type === '2') {
96
- index++;
97
- const originalPath = records[index];
98
- if (originalPath === undefined || originalPath === '') {
99
- return { ok: false, reason: 'git status reported a rename without an original path' };
100
- }
101
- paths.add(originalPath);
95
+ if (type !== '2') {
96
+ continue;
97
+ }
98
+ index++;
99
+ const originalPath = records[index];
100
+ if (originalPath === undefined || originalPath === '') {
101
+ return { ok: false, reason: 'git status reported a rename without an original path' };
102
102
  }
103
+ paths.add(originalPath);
103
104
  }
104
105
  return { ok: true, paths };
105
106
  }
@@ -1,17 +1,16 @@
1
1
  export declare const PACKAGE_NAME = "@williamthorsen/nmr-core";
2
2
  export type { CacheDirRef, CacheEntryRef } from './cache-store.js';
3
3
  export { readCacheEntry, readJsonCacheEntry, removeCacheDir, removeCacheEntry, resolveCacheDir, resolveCacheEntryPath, writeCacheEntry, } from './cache-store.js';
4
- export { findPackageRoot } from './findPackageRoot.js';
5
4
  export { GIT_OUTPUT_LIMIT } from './gitOutputLimit.js';
6
5
  export { hasErrnoCode } from './hasErrnoCode.js';
7
6
  export type { WorkingTreeHashResult } from './hashWorkingTree.js';
8
7
  export { hashWorkingTree, readHeadSha } from './hashWorkingTree.js';
9
8
  export type { FlagDefinition, FlagSchema, ParseArgsOptions, ParsedArgs, ParsedFlags, ParseErrorKind, } from './parseArgs.js';
10
9
  export { parseArgs, parseArgsOrExit, ParseError } from './parseArgs.js';
11
- export { readPackageVersion } from './readPackageVersion.js';
12
10
  export type { GlyphSet, InvalidOutputStyle, OutputStyle, ResolveStreamStylesOptions, StatusGlyphName, StreamStyleResolution, StreamStyles, TruncateToWidthOptions, } from './terminal.js';
13
11
  export { defineGlyphSet, describeInvalidOutputStyle, formatErrorLine, formatGlyphLine, formatStatusLine, measureGlyphColumn, measureWidth, printError, printSkip, printStep, printSuccess, reportError, reportTemplateUpdate, reportWriteResult, resolveStreamStyles, STATUS_GLYPHS, truncateToWidth, wrapToWidth, } from './terminal.js';
14
12
  export type { ManagedFileOutcome, ManagedFileResult } from './updateManagedFile.js';
15
13
  export { updateManagedFile } from './updateManagedFile.js';
16
14
  export type { WriteOutcome, WriteResult } from './writeFileWithCheck.js';
17
15
  export { writeFileWithCheck } from './writeFileWithCheck.js';
16
+ export { findPackageRoot, resolveSelfVersion } from '@williamthorsen/toolbelt.packaging/candidate';
package/dist/esm/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  export const PACKAGE_NAME = '@williamthorsen/nmr-core';
2
2
  export { readCacheEntry, readJsonCacheEntry, removeCacheDir, removeCacheEntry, resolveCacheDir, resolveCacheEntryPath, writeCacheEntry, } from "./cache-store.js";
3
- export { findPackageRoot } from "./findPackageRoot.js";
4
3
  export { GIT_OUTPUT_LIMIT } from "./gitOutputLimit.js";
5
4
  export { hasErrnoCode } from "./hasErrnoCode.js";
6
5
  export { hashWorkingTree, readHeadSha } from "./hashWorkingTree.js";
7
6
  export { parseArgs, parseArgsOrExit, ParseError } from "./parseArgs.js";
8
- export { readPackageVersion } from "./readPackageVersion.js";
9
7
  export { defineGlyphSet, describeInvalidOutputStyle, formatErrorLine, formatGlyphLine, formatStatusLine, measureGlyphColumn, measureWidth, printError, printSkip, printStep, printSuccess, reportError, reportTemplateUpdate, reportWriteResult, resolveStreamStyles, STATUS_GLYPHS, truncateToWidth, wrapToWidth, } from "./terminal.js";
10
8
  export { updateManagedFile } from "./updateManagedFile.js";
11
9
  export { writeFileWithCheck } from "./writeFileWithCheck.js";
10
+ export { findPackageRoot, resolveSelfVersion } from '@williamthorsen/toolbelt.packaging/candidate';
@@ -1,6 +1,7 @@
1
1
  import process from 'node:process';
2
2
  import { parseArgs as nodeParseArgs } from 'node:util';
3
3
  import { reportError } from "./terminal.js";
4
+ const initialFlagValues = { boolean: false, string: undefined };
4
5
  export class ParseError extends Error {
5
6
  kind;
6
7
  flag;
@@ -20,7 +21,7 @@ export function parseArgs(argv, schema, options = {}) {
20
21
  nodeOptions[name] =
21
22
  def.short === undefined ? { type: def.type } : { type: def.type, short: def.short.replace(/^-/, '') };
22
23
  byName.set(name, { key, def });
23
- flags[key] = def.type === 'boolean' ? false : undefined;
24
+ flags[key] = initialFlagValues[def.type];
24
25
  }
25
26
  const { tokens } = nodeParseArgs({
26
27
  args: argv,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/nmr-core",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "private": false,
5
5
  "description": "Shared utilities for node-monorepo-tools packages",
6
6
  "keywords": [
@@ -39,15 +39,16 @@
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
- "@williamthorsen/toolbelt.errors": "0.8.2",
43
- "@williamthorsen/toolbelt.filesystem": "0.9.2",
42
+ "@williamthorsen/toolbelt.errors": "0.8.3",
43
+ "@williamthorsen/toolbelt.filesystem": "0.9.3",
44
+ "@williamthorsen/toolbelt.packaging": "0.6.3",
44
45
  "@williamthorsen/toolbelt.terminal": "0.2.1",
45
46
  "diff": "9.0.0",
46
47
  "yaml": "2.9.1"
47
48
  },
48
49
  "devDependencies": {
49
- "@williamthorsen/toolbelt.testing": "0.6.2",
50
- "@williamthorsen/toolbelt.vitest": "0.10.2",
50
+ "@williamthorsen/toolbelt.testing": "0.6.3",
51
+ "@williamthorsen/toolbelt.vitest": "0.10.3",
51
52
  "vitest": "4.1.11"
52
53
  },
53
54
  "engines": {
@@ -1,8 +0,0 @@
1
- /**
2
- * Finds the nearest ancestor directory containing `package.json`, starting from
3
- * the directory of the given `import.meta.url`.
4
- *
5
- * Useful for resolving bundled assets (presets, templates) relative to the
6
- * package root, regardless of the calling module's depth in the source or dist tree.
7
- */
8
- export declare function findPackageRoot(fromUrl: string): string;
@@ -1,14 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { dirname, resolve } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- export function findPackageRoot(fromUrl) {
5
- let dir = dirname(fileURLToPath(fromUrl));
6
- while (!existsSync(resolve(dir, 'package.json'))) {
7
- const parent = dirname(dir);
8
- if (parent === dir) {
9
- throw new Error('Could not find package root from ' + fromUrl);
10
- }
11
- dir = parent;
12
- }
13
- return dir;
14
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Reads the `version` field from the nearest ancestor `package.json`, starting
3
- * from the directory of the given `import.meta.url`.
4
- *
5
- * Throws if the located `package.json` lacks a string `version` field.
6
- * Propagates `findPackageRoot`'s own error when it does not find an ancestor
7
- * `package.json`.
8
- */
9
- export declare function readPackageVersion(fromUrl: string): string;
@@ -1,12 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { resolve } from 'node:path';
3
- import { findPackageRoot } from "./findPackageRoot.js";
4
- export function readPackageVersion(fromUrl) {
5
- const root = findPackageRoot(fromUrl);
6
- const packageJsonPath = resolve(root, 'package.json');
7
- const raw = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
8
- if (typeof raw !== 'object' || raw === null || !('version' in raw) || typeof raw.version !== 'string') {
9
- throw new Error(`No string "version" field in ${packageJsonPath}`);
10
- }
11
- return raw.version;
12
- }