@williamthorsen/nmr-core 0.13.2 → 0.13.3
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/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +1 -2
- package/package.json +6 -5
- package/dist/esm/findPackageRoot.d.ts +0 -8
- package/dist/esm/findPackageRoot.js +0 -14
- package/dist/esm/readPackageVersion.d.ts +0 -9
- package/dist/esm/readPackageVersion.js +0 -12
package/.meta/changelog.json
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.13.3",
|
|
4
|
+
"date": "2026-10-12",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "🏗️ Internal features",
|
|
8
|
+
"audience": "dev",
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"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)",
|
|
12
|
+
"hash": "ff6627180d9e86d083656afb2c09a3fb190fc79d",
|
|
13
|
+
"entry": 1
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
2
19
|
{
|
|
3
20
|
"version": "0.13.2",
|
|
4
21
|
"date": "2026-10-08",
|
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.13.3 — 2026-10-12
|
|
6
|
+
|
|
7
|
+
### 🏗️ Internal features
|
|
8
|
+
|
|
9
|
+
- 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)
|
|
10
|
+
|
|
5
11
|
## 0.13.2 — 2026-10-08
|
|
6
12
|
|
|
7
13
|
### 🏗️ Internal features
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williamthorsen/nmr-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
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.
|
|
43
|
-
"@williamthorsen/toolbelt.filesystem": "0.9.
|
|
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.
|
|
50
|
-
"@williamthorsen/toolbelt.vitest": "0.10.
|
|
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
|
-
}
|