@williamthorsen/toolbelt.packaging 0.8.0 → 0.9.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.
@@ -1,4 +1,56 @@
1
1
  [
2
+ {
3
+ "version": "0.9.1",
4
+ "date": "2026-11-16",
5
+ "sections": [
6
+ {
7
+ "title": "♻️ Refactoring",
8
+ "audience": "dev",
9
+ "items": [
10
+ {
11
+ "description": "Move the cli kit's import-binding reader into adoption (#666)",
12
+ "body": "Moves the import-binding reader out of the cli kit's parser detector and into `packages/adoption` as `readImportBindings`, which takes the export name and the module specifiers to read. With this move, `cli`'s `readiness/` contains only its detector and its export list. The change also recompiles the committed kits of the thirteen packages that bundle `packages/adoption`.",
13
+ "hash": "ac5ff04c0829f035a954325c99d13d781c1e2647"
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "version": "0.9.0",
21
+ "date": "2026-11-15",
22
+ "sections": [
23
+ {
24
+ "title": "🎉 Features",
25
+ "audience": "all",
26
+ "items": [
27
+ {
28
+ "description": "Makes `ProjectRoot`, the result of `findProjectRoot`, a union discriminated by `source`, in which only a `source: 'marker'` result has a `marker` property, typed `string`, and a fallback result omits `marker` rather than setting it to `null`. (#593)",
29
+ "breaking": true,
30
+ "migration": "Replace a check of `result.marker === null` with `result.source !== 'marker'`, and check `source` before reading `marker`: TypeScript rejects `result.marker` on the un-narrowed union, and in untyped code `result.marker === null` is now always `false`, because a fallback result's `marker` is `undefined`.",
31
+ "hash": "cb849ee2916e74c1afd7f1e18fe4cc2c872ec9c8",
32
+ "entry": 1
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "title": "🧪 Tests",
38
+ "audience": "dev",
39
+ "items": [
40
+ {
41
+ "description": "Deletes the `DEFAULT_ROOT_MARKERS` block from `findProjectRoot.unit.test.ts`, whose one test compared the exported list against a copy of its own value and therefore checked a value rather than any behavior of `findProjectRoot`. (#592)",
42
+ "hash": "06ec984c5734607afb590d1b48777c433786a0de",
43
+ "entry": 1
44
+ },
45
+ {
46
+ "description": "Changes the kit tool tests of `async`, `enums`, and `packaging` to select the check under test by id through `selectCheck` rather than as `kit.checks[0]`, which would run the wrong check without any report once a kit declared another check ahead of it. (#605)",
47
+ "hash": "f06e0f299b3816ef383fe03072f224c53597680a",
48
+ "entry": 1
49
+ }
50
+ ]
51
+ }
52
+ ]
53
+ },
2
54
  {
3
55
  "version": "0.8.0",
4
56
  "date": "2026-11-13",
@@ -1,6 +1,6 @@
1
1
  /** @noformat -- @generated. Do not edit. Compiled by rdy. */
2
2
  /* eslint-disable */
3
- export const __readyupVersion = "0.46.2";
3
+ export const __readyupVersion = "0.46.3";
4
4
 
5
5
 
6
6
  // ../adoption/src/conventions/path-predicates.ts
@@ -32,7 +32,7 @@
32
32
  "path": "../../adoption/src/kits/defineAdoptionKit.ts"
33
33
  },
34
34
  {
35
- "hash": "a8c9ffb5",
35
+ "hash": "00beca5f",
36
36
  "kind": "module",
37
37
  "path": "../../adoption/src/mod.ts"
38
38
  },
@@ -81,6 +81,11 @@
81
81
  "kind": "module",
82
82
  "path": "../../adoption/src/portable/readFunctionLiteral.ts"
83
83
  },
84
+ {
85
+ "hash": "20833e21",
86
+ "kind": "module",
87
+ "path": "../../adoption/src/portable/readImportBindings.ts"
88
+ },
84
89
  {
85
90
  "hash": "81846f1a",
86
91
  "kind": "module",
@@ -109,10 +114,10 @@
109
114
  ],
110
115
  "name": "default",
111
116
  "path": "kits/default.js",
112
- "readyupVersion": "0.46.2",
117
+ "readyupVersion": "0.46.3",
113
118
  "source": "kits/default.ts",
114
119
  "sourceHash": "ee39b238",
115
- "targetHash": "65ee85d3"
120
+ "targetHash": "43fc053f"
116
121
  }
117
122
  ]
118
123
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.9.1 — 2026-11-16
6
+
7
+ ### ♻️ Refactoring
8
+
9
+ - Move the cli kit's import-binding reader into adoption (#666)
10
+
11
+ Moves the import-binding reader out of the cli kit's parser detector and into `packages/adoption` as `readImportBindings`, which takes the export name and the module specifiers to read. With this move, `cli`'s `readiness/` contains only its detector and its export list. The change also recompiles the committed kits of the thirteen packages that bundle `packages/adoption`.
12
+
13
+ ## 0.9.0 — 2026-11-15
14
+
15
+ ### 🎉 Features
16
+
17
+ - 🚨 **Breaking:** Makes `ProjectRoot`, the result of `findProjectRoot`, a union discriminated by `source`, in which only a `source: 'marker'` result has a `marker` property, typed `string`, and a fallback result omits `marker` rather than setting it to `null`. (#593)
18
+
19
+ ### 🧪 Tests
20
+
21
+ - Deletes the `DEFAULT_ROOT_MARKERS` block from `findProjectRoot.unit.test.ts`, whose one test compared the exported list against a copy of its own value and therefore checked a value rather than any behavior of `findProjectRoot`. (#592)
22
+ - Changes the kit tool tests of `async`, `enums`, and `packaging` to select the check under test by id through `selectCheck` rather than as `kit.checks[0]`, which would run the wrong check without any report once a kit declared another check ahead of it. (#605)
23
+
5
24
  ## 0.8.0 — 2026-11-13
6
25
 
7
26
  ### 🎉 Features
package/README.md CHANGED
@@ -4,14 +4,7 @@
4
4
 
5
5
  Package and project layout utilities for TypeScript and JavaScript: where a package or project boundary begins, and what the manifest at that boundary declares.
6
6
 
7
- <!-- section:release-notes -->
8
- ## Release notes — v0.8.0 (2026-11-13)
9
-
10
- ### 🎉 Features
11
-
12
- - Adds `findNearestManifest` to `@williamthorsen/toolbelt.packaging/candidate`, which returns the nearest `package.json` at or above a directory that a caller's predicate accepts, together with its path and directory, and throws on a manifest that is unreadable as JSON or is not a JSON object. (#590)
13
- - Changes the fix text of the `no-hand-rolled-manifest-search` adoption check to recommend `findNearestManifest` for a loop that looks for the nearest manifest declaring some other field, or the nearest manifest whatever it declares, in place of `findDirectoryChainMatch` from `@williamthorsen/toolbelt.filesystem`. (#590)
14
- <!-- /section:release-notes -->
7
+ <!-- section:release-notes --><!-- /section:release-notes -->
15
8
 
16
9
  ## Installation
17
10
 
@@ -32,11 +25,9 @@ findProjectRoot(startDir: string, options?: { markers?: ReadonlyArray<string> })
32
25
  Resolves `startDir` to an absolute path, ascends from it, and returns the first directory that contains a root marker, along with the evidence that identified it:
33
26
 
34
27
  ```ts
35
- interface ProjectRoot {
36
- marker: string | null; // the marker that matched, or null when a fallback identified the root
37
- rootDir: string;
38
- source: 'marker' | 'package-json' | 'start-dir';
39
- }
28
+ type ProjectRoot =
29
+ | { marker: string; rootDir: string; source: 'marker' } // marker: the marker that matched
30
+ | { rootDir: string; source: 'package-json' | 'start-dir' };
40
31
  ```
41
32
 
42
33
  `DEFAULT_ROOT_MARKERS` is consulted in order, so the earliest entry wins when one directory contains several:
@@ -58,7 +49,7 @@ findProjectRoot(process.cwd(), { markers: [...DEFAULT_ROOT_MARKERS, 'deno.json']
58
49
 
59
50
  Each marker is a path relative to the level against which it is probed, on the terms set out by [`listDirectoryChainMatches`](https://github.com/williamthorsen/toolbelt/tree/main/packages/filesystem#listdirectorychainmatches): One that is absolute, or whose `..` segments escape its level, is rejected before any directory is probed.
60
51
 
61
- When no directory up to and including the filesystem root contains a marker, the result falls back in this order, reporting a `null` marker either way:
52
+ When no directory up to and including the filesystem root contains a marker, the result falls back in this order, and a fallback result does not have a `marker` property:
62
53
 
63
54
  1. the nearest ancestor containing a `package.json`, reported as `source: 'package-json'`;
64
55
  2. `startDir` itself, reported as `source: 'start-dir'`.
@@ -13,7 +13,7 @@ export declare const DEFAULT_ROOT_MARKERS: ReadonlyArray<string>;
13
13
  *
14
14
  * Ascends from `startDir` (resolved to an absolute path) and returns the first directory that contains one of
15
15
  * `markers`. If no directory up to and including the filesystem root contains one, falls back to the nearest
16
- * ancestor containing a `package.json`, then to `startDir` itself; both fallbacks report a `null` marker.
16
+ * ancestor containing a `package.json`, then to `startDir` itself; a fallback result does not have a `marker`.
17
17
  *
18
18
  * @example
19
19
  * findProjectRoot(import.meta.dirname); // { marker: '.git', rootDir: '/home/dev/my-app', source: 'marker' }
@@ -27,10 +27,13 @@ export interface FindProjectRootOptions {
27
27
  /** Replaces (does not extend) `DEFAULT_ROOT_MARKERS`. */
28
28
  markers?: ReadonlyArray<string> | undefined;
29
29
  }
30
- export interface ProjectRoot {
31
- /** The marker that identified the root, or `null` when a fallback did. */
32
- marker: string | null;
30
+ export type ProjectRoot = {
31
+ /** The marker that identified the root. */
32
+ marker: string;
33
33
  rootDir: string;
34
- source: ProjectRootSource;
35
- }
34
+ source: 'marker';
35
+ } | {
36
+ rootDir: string;
37
+ source: Exclude<ProjectRootSource, 'marker'>;
38
+ };
36
39
  export type ProjectRootSource = 'marker' | 'package-json' | 'start-dir';
@@ -16,7 +16,7 @@ export function findProjectRoot(startDir, options = {}) {
16
16
  }
17
17
  const manifestMatch = findDirectoryChainMatch(startDir, ['package.json']);
18
18
  if (manifestMatch !== undefined) {
19
- return { marker: null, rootDir: manifestMatch.dir, source: 'package-json' };
19
+ return { rootDir: manifestMatch.dir, source: 'package-json' };
20
20
  }
21
- return { marker: null, rootDir: path.resolve(startDir), source: 'start-dir' };
21
+ return { rootDir: path.resolve(startDir), source: 'start-dir' };
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/toolbelt.packaging",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "Package and project layout utilities: where a package or project boundary begins, and what its manifest declares",
5
5
  "keywords": [
6
6
  "esm",
@@ -46,15 +46,15 @@
46
46
  ".meta/changelog.json"
47
47
  ],
48
48
  "dependencies": {
49
- "@williamthorsen/toolbelt.filesystem": "0.11.0",
50
- "@williamthorsen/toolbelt.objects": "4.4.3"
49
+ "@williamthorsen/toolbelt.filesystem": "0.11.2",
50
+ "@williamthorsen/toolbelt.objects": "4.4.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@williamthorsen/toolbelt.adoption": "0.1.0",
54
- "@williamthorsen/toolbelt.strings": "9.0.0",
55
- "@williamthorsen/toolbelt.testing": "0.8.3",
54
+ "@williamthorsen/toolbelt.strings": "9.0.2",
55
+ "@williamthorsen/toolbelt.testing": "0.8.5",
56
56
  "esbuild": "0.28.2",
57
- "readyup": "0.46.2"
57
+ "readyup": "0.46.3"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=24.0.0"