@williamthorsen/nmr 0.42.0 → 0.43.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/.meta/changelog.json +17 -0
- package/.readyup/kits/default.js +1 -1
- package/.readyup/manifest.json +2 -2
- package/CHANGELOG.md +6 -0
- package/README.md +2 -14
- package/dist/esm/commands/build-output.js +1 -1
- package/dist/esm/commands/build.js +3 -2
- package/docs/utilities.md +5 -3
- package/package.json +1 -1
package/.meta/changelog.json
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.43.0",
|
|
4
|
+
"date": "2026-10-09",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "🎉 Features",
|
|
8
|
+
"audience": "all",
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"description": "Extends `nmr-compile` to compile `.tsx` sources and to rewrite relative `.tsx` specifiers to `.js`, and leaves the JSX transform to the package's own tsconfig `jsx` option. (#988)",
|
|
12
|
+
"hash": "5dc56910af4daa0580e3b443b0ddc15557cb5081",
|
|
13
|
+
"entry": 3
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
2
19
|
{
|
|
3
20
|
"version": "0.42.0",
|
|
4
21
|
"date": "2026-10-08",
|
package/.readyup/kits/default.js
CHANGED
|
@@ -8022,7 +8022,7 @@ function formatPaths(paths) {
|
|
|
8022
8022
|
${paths.map((path2) => ` ${path2}`).join("\n")}`;
|
|
8023
8023
|
}
|
|
8024
8024
|
function getMinVersion() {
|
|
8025
|
-
const pickedFields = { "version": "0.
|
|
8025
|
+
const pickedFields = { "version": "0.43.0" };
|
|
8026
8026
|
if (typeof pickedFields["version"] !== "string") {
|
|
8027
8027
|
throw new TypeError("nmr/package.json: 'version' must be a string");
|
|
8028
8028
|
}
|
package/.readyup/manifest.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"path": "kits/default.ts"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"hash": "
|
|
20
|
+
"hash": "caf06cd5",
|
|
21
21
|
"kind": "inline",
|
|
22
22
|
"path": "../package.json",
|
|
23
23
|
"paths": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"readyupVersion": "0.40.0",
|
|
51
51
|
"source": "kits/default.ts",
|
|
52
52
|
"sourceHash": "50b5aac3",
|
|
53
|
-
"targetHash": "
|
|
53
|
+
"targetHash": "7a5cd413"
|
|
54
54
|
}
|
|
55
55
|
]
|
|
56
56
|
}
|
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.43.0 — 2026-10-09
|
|
6
|
+
|
|
7
|
+
### 🎉 Features
|
|
8
|
+
|
|
9
|
+
- Extends `nmr-compile` to compile `.tsx` sources and to rewrite relative `.tsx` specifiers to `.js`, and leaves the JSX transform to the package's own tsconfig `jsx` option. (#988)
|
|
10
|
+
|
|
5
11
|
## 0.42.0 — 2026-10-08
|
|
6
12
|
|
|
7
13
|
### 🎉 Features
|
package/README.md
CHANGED
|
@@ -5,23 +5,11 @@
|
|
|
5
5
|
Context-aware script runner for pnpm monorepos. Includes an `nmr` (node-monorepo run) binary that provides centralized, consistent script execution across workspace packages and the monorepo root.
|
|
6
6
|
|
|
7
7
|
<!-- section:release-notes -->
|
|
8
|
-
## Release notes — v0.
|
|
8
|
+
## Release notes — v0.43.0 (2026-10-09)
|
|
9
9
|
|
|
10
10
|
### 🎉 Features
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- Adds the kit check `no package.json declares a workspaces field`, which warns about every `package.json` in the tree that declares `workspaces`, a field that pnpm ignores because it reads workspace globs only from `pnpm-workspace.yaml`. (#958)
|
|
14
|
-
- Adds a `Package scripts:` section to the `nmr` listing, which shows each script declared by the current scope's `package.json` under a name that the active registry does not contain, hooks such as `build:pre` included and npm and pnpm lifecycle scripts excluded. (#960)
|
|
15
|
-
- Makes Prettier a dependency of `@williamthorsen/nmr`, so that `pnpm dlx --package @williamthorsen/nmr nmr-fmt --check` (or `--write`) formats a git repository that has nothing installed, while a repository that installs its own Prettier keeps formatting with that copy. (#961)
|
|
16
|
-
- Makes `nmr-fmt` apply the house config from `@williamthorsen/nmr/prettier`, shell plugin included, when Prettier does not find a config searching from the working directory, which also gives the house config to a repository whose only Prettier configs are in subdirectories below that directory. (#961)
|
|
17
|
-
- Makes `typescript` an optional peer of `@williamthorsen/nmr`, so that installing nmr no longer requires it, and makes `nmr-compile` report a missing `typescript` together with the version range that it supports. (#961)
|
|
18
|
-
|
|
19
|
-
### 🐛 Bug fixes
|
|
20
|
-
|
|
21
|
-
- Fixes the issue that `nmr fmt` and `nmr fmt:check` aborted with a load failure when a file listed by git could not be stat'ed because of `EACCES` or `EPERM`, such as a tracked `.envrc` under a sandbox that denies reads of `.env*` files; `nmr-fmt` now skips each such file and names it on stderr. (#959)
|
|
22
|
-
- Fixes the issue that `nmr-fmt` reported any other stat failure on a listed file, such as `ELOOP` from a symlink loop, as a load failure; the run now fails with an error that names the path. (#959)
|
|
23
|
-
- Fixes the issue that `nmr-compile` failed with a `TypeError` under TypeScript 7, which it now rejects with an error naming the supported range, `>=5.7 <7`. (#961)
|
|
24
|
-
- Fixes the issue that `nmr fmt` and `nmr fmt:check` failed in a repository that commits a symlink, because `nmr-fmt` passed the symlink to Prettier, which rejects an explicitly named symlink even when `.prettierignore` lists it. (#968)
|
|
12
|
+
- Extends `nmr-compile` to compile `.tsx` sources and to rewrite relative `.tsx` specifiers to `.js`, and leaves the JSX transform to the package's own tsconfig `jsx` option. (#988)
|
|
25
13
|
<!-- /section:release-notes -->
|
|
26
14
|
|
|
27
15
|
## Installation
|
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { findPackageRoot, readCacheEntry, resolveCacheEntryPath } from '@williamthorsen/nmr-core';
|
|
4
4
|
import { glob } from 'glob';
|
|
5
5
|
import { readPackageJson } from "../helpers/package-json.js";
|
|
6
|
-
export const DEFAULT_ENTRY_GLOBS = ['src/**/*.ts'];
|
|
6
|
+
export const DEFAULT_ENTRY_GLOBS = ['src/**/*.{ts,tsx}'];
|
|
7
7
|
export const DEFAULT_IGNORE_PATTERNS = ['**/__fixtures__/**', '**/__mocks__/**', '**/__tests__/**', '**/test-utils/**'];
|
|
8
8
|
export const DEFAULT_OUTDIR = 'dist/esm/';
|
|
9
9
|
const BUILD_CACHE_TOOL = 'nmr-compile';
|
|
@@ -13,7 +13,7 @@ const MINIMUM_TYPESCRIPT_MINOR = 7;
|
|
|
13
13
|
const UNSUPPORTED_TYPESCRIPT_MAJOR = 7;
|
|
14
14
|
const SUPPORTED_TYPESCRIPT_RANGE = `>=${MINIMUM_TYPESCRIPT_MAJOR}.${MINIMUM_TYPESCRIPT_MINOR} <${UNSUPPORTED_TYPESCRIPT_MAJOR}`;
|
|
15
15
|
const INSTALL_TYPESCRIPT_GUIDANCE = "Install a version in that range as the 'typescript' peer dependency.";
|
|
16
|
-
const
|
|
16
|
+
const TS_EXTENSIONS = ['.ts', '.tsx'];
|
|
17
17
|
const JS_EXTENSION = '.js';
|
|
18
18
|
let ts;
|
|
19
19
|
export async function buildPackage(packageDir, options) {
|
|
@@ -401,5 +401,6 @@ function resolveScriptKind(file) {
|
|
|
401
401
|
return file.endsWith('.d.ts') ? ts.ScriptKind.TS : ts.ScriptKind.JS;
|
|
402
402
|
}
|
|
403
403
|
function swapTypeScriptExtension(specifier) {
|
|
404
|
-
|
|
404
|
+
const extension = TS_EXTENSIONS.find((candidate) => specifier.endsWith(candidate));
|
|
405
|
+
return extension === undefined ? specifier : `${specifier.slice(0, -extension.length)}${JS_EXTENSION}`;
|
|
405
406
|
}
|
package/docs/utilities.md
CHANGED
|
@@ -12,9 +12,11 @@ nmr-clean
|
|
|
12
12
|
|
|
13
13
|
## `nmr-compile`
|
|
14
14
|
|
|
15
|
-
Compile a single package's `src` tree to `dist/esm` with the TypeScript compiler API, emitting `.js` from one program and `.d.ts` from a second that reuses it. The package's own `removeComments` governs the `.js` emit; the declarations emit forces it off, so `.d.ts` files keep their doc comments either way. Because the compiler parses each source file, every relative import form (static, re-export, dynamic `import()`, and bare side-effect) is rewritten from `.ts` to `.js` in both outputs, and `.ts` occurrences inside strings and comments are left intact. tsconfig `paths` aliases are resolved to runnable relative `.js` specifiers in both outputs, sourced from the package's tsconfig. An aliased import whose target resolves outside the package's `src/` and is not resolvable without the alias mapping fails the build with a diagnostic, rather than being emitted verbatim to produce output that fails at runtime. The build is skipped when every input is unchanged and the previous output is still on disk (the key is cached under `node_modules/.cache/nmr-compile/`, outside the published output). Deleting the output by any means (`nmr clean`, `rm -rf dist`, `git clean`) therefore forces a rebuild rather than a skip. This is the default `compile` script; run it from a package directory.
|
|
15
|
+
Compile a single package's `src` tree to `dist/esm` with the TypeScript compiler API, emitting `.js` from one program and `.d.ts` from a second that reuses it. The package's own `removeComments` governs the `.js` emit; the declarations emit forces it off, so `.d.ts` files keep their doc comments either way. Because the compiler parses each source file, every relative import form (static, re-export, dynamic `import()`, and bare side-effect) is rewritten from `.ts` or `.tsx` to `.js` in both outputs, and `.ts` occurrences inside strings and comments are left intact. tsconfig `paths` aliases are resolved to runnable relative `.js` specifiers in both outputs, sourced from the package's tsconfig. An aliased import whose target resolves outside the package's `src/` and is not resolvable without the alias mapping fails the build with a diagnostic, rather than being emitted verbatim to produce output that fails at runtime. The build is skipped when every input is unchanged and the previous output is still on disk (the key is cached under `node_modules/.cache/nmr-compile/`, outside the published output). Deleting the output by any means (`nmr clean`, `rm -rf dist`, `git clean`) therefore forces a rebuild rather than a skip. This is the default `compile` script; run it from a package directory.
|
|
16
16
|
|
|
17
|
-
**What it compiles.** Entry points are `src/**/*.ts` less the directories that contain test scaffolding rather than published code: `__fixtures__/`, `__mocks__/`, `__tests__/`, and `test-utils/`. Add to that list per package with [`build.extraIgnorePatterns`](scripts.md#package-level-configuration). Ignoring a directory drops it as an _entry point_, not from the emit: The compiler still emits whatever the surviving entry points import, so a helper that production code uses is still compiled and the compiler never emits a dangling specifier in its importer. This list is deliberately not the Vitest [coverage exclusions](vitest.md#what-the-config-excludes): Helpers live in `test-utils/` precisely so that they stay covered.
|
|
17
|
+
**What it compiles.** Entry points are `src/**/*.{ts,tsx}` less the directories that contain test scaffolding rather than published code: `__fixtures__/`, `__mocks__/`, `__tests__/`, and `test-utils/`. Add to that list per package with [`build.extraIgnorePatterns`](scripts.md#package-level-configuration). Ignoring a directory drops it as an _entry point_, not from the emit: The compiler still emits whatever the surviving entry points import, so a helper that production code uses is still compiled and the compiler never emits a dangling specifier in its importer. This list is deliberately not the Vitest [coverage exclusions](vitest.md#what-the-config-excludes): Helpers live in `test-utils/` precisely so that they stay covered.
|
|
18
|
+
|
|
19
|
+
**JSX.** A `.tsx` source compiles to `.js` like any other. The package's own tsconfig `jsx` option decides the transform, such as `react-jsx`; the build does not set one.
|
|
18
20
|
|
|
19
21
|
**The build owns its output directory.** Every rebuild replaces `dist/esm` wholesale, so the directory contains exactly the current emit: A source that was deleted, or that a widened ignore set now covers, leaves nothing behind. Assets therefore belong outside the output directory, or in a `build:post` hook, which composes correctly because it runs after the output is published. Because a bare `nmr compile` does not run any hook, assets that a `build:post` step copies in are absent until a full `nmr build` restores them. An `outdir` that does not resolve inside the package is rejected rather than replaced.
|
|
20
22
|
|
|
@@ -22,7 +24,7 @@ Compile a single package's `src` tree to `dist/esm` with the TypeScript compiler
|
|
|
22
24
|
|
|
23
25
|
**What busts the cache.** The key folds each input's content and path, the emit options, the resolved TypeScript version, and a fingerprint of the nmr running the build -- its own build digest in a workspace checkout, its package version otherwise. Upgrading nmr in a consuming repo therefore rebuilds every package that nmr compiles, and an edit to nmr's own build sources rebuilds each sibling once nmr itself has been rebuilt. A build of nmr's own package folds the version rather than the digest, which is the cache entry that this build is about to write.
|
|
24
26
|
|
|
25
|
-
`typescript` is an optional peer dependency (`>=5.7.0 <7`), needed only by `nmr-compile`; the consuming repo provides it, and `nmr-compile` run without it fails with an error naming the peer and the version that it requires. The floor is what `rewriteRelativeImportExtensions` requires; the ceiling exists because TypeScript 7 does not include a compiler API: Its root export is a version constant, so `nmr-compile` cannot run on it. Relative imports in source must use explicit `.ts` extensions for them to be rewritten.
|
|
27
|
+
`typescript` is an optional peer dependency (`>=5.7.0 <7`), needed only by `nmr-compile`; the consuming repo provides it, and `nmr-compile` run without it fails with an error naming the peer and the version that it requires. The floor is what `rewriteRelativeImportExtensions` requires; the ceiling exists because TypeScript 7 does not include a compiler API: Its root export is a version constant, so `nmr-compile` cannot run on it. Relative imports in source must use explicit `.ts` or `.tsx` extensions for them to be rewritten.
|
|
26
28
|
|
|
27
29
|
```bash
|
|
28
30
|
nmr-compile
|