Nub 0.11.2 fixes package-manager pins and private-registry downloads, Node pins in devEngines, tsconfig resolution, and .env parsing.
Nub is an all-in-one toolkit for Node.js written in Rust. The
nubcommand is flag-for-flag compatible withnode, while adding full support for TypeScript, JSX,tsconfig.json,.envloading, and modern Web and ECMAScript APIs. It also includes a fast script runner (nub run), package runner (nubx), Node version manager (nub node), andpnpm-compatible package manager.
Package-manager pins and downloads
Pinning pnpm 11 now writes a pin pnpm 11 reads without a warning, and downloading a package manager reads the same registry config npm does (#1137).
$ nub pm use pnpm@11.5.3
Fetching pnpm 11.5.3 (4 MB)...
using pnpm@11.5.3
package.json: packageManager = pnpm@11.5.3
package.json: devEngines.packageManager =
{ name: "pnpm", version: "11.5.3", onFail: "warn" }What changed:
- pnpm 11 pins. Both fields hold the same exact version with no hash. The integrity goes in
pnpm-lock.yaml, and a fresh download is checked against it. With no lockfile,packageManagerkeeps its hash. - Ranges in
packageManager. A range resolves to the newest matching release for Yarn as it does for npm and pnpm. It was ignored, soyarn@^4failed with "no package manager is pinned". pnpm 10 and later ignore a range there, so Nub warns and points atdevEngines.packageManager. - Registry config. The download reads the user config that
NPM_CONFIG_USERCONFIGnames, and the registry innpm_config_registryorNPM_CONFIG_REGISTRY. - Path-prefixed registries. A registry such as
https://example.com/artifactory/api/npm/npm/keeps its path on the tarball download. It returned 404. - Exact pins. A registry that answers an exact pin with a different version is refused.
Node pins
When package.json pins Node in devEngines.runtime, nub node pin now updates that entry (#1136). It wrote a .node-version, which devEngines.runtime outranks, so the pin changed nothing.
"devEngines": {
"runtime": {
"name": "node",
"version": "24"
"version": "26"
}
}What changed:
- Comma ranges. A range such as
>=22, <25is written in the form npm checks,>=22 <25. - Ranges in pin files. A
.node-versionor.nvmrcholding a range or another non-version now gets a warning naming the file. It was skipped silently. A range belongs inengines.node.
tsconfig resolution
A tsconfig paths target inside an installed package that declares exports now resolves through those exports and the import or require conditions (#1138). It resolved to the package's main.
// tsconfig.json
{
"compilerOptions": {
"paths": { "*": ["./node_modules/*"] }
}
}What changed:
- Conditions. The
customConditionsoption is read from the tsconfig governing each importing file. With a file entry, the entry's tsconfig sets the process-wide conditions, sonub app/main.tsfrom the root runs likenub main.tsinsideapp. - Empty tsconfig. An empty or comment-only
tsconfig.jsonreads as{}, as intsc. It errored.
Snapshot launches
Running a startup snapshot with nubr now hands the blob straight to Node, skipping the JavaScript runner and the extra Node startup it cost (#1130). Median launch time for one snapshot on a macOS arm64 machine fell from 82 ms to 47 ms.
node --snapshot-blob app.blob --build-snapshot entry.js
nubr --snapshot-blob app.blobWhat changed:
- Node version. The blob runs on the Node that Nub resolves for the project, which has to be the Node that built it.
- TypeScript. Nub's loader is loaded, so code run against the snapshot can import TypeScript.
Breaking changes
Two setups that used to load are now refused.
- ESM syntax in a
.tsfile under"type": "commonjs"is now refused on every Node version. Node 20.19+ and 22.12–22.14 loaded such a file as an ES module. Rename it to.mtsor set"type": "module"(#1138). - The standalone runner now stops on a tsconfig it cannot read in full, as
nubdoes. Fix or remove the tsconfig the error names (#1138).
Bug fixes
- Empty
.envvalues. A value left empty before a trailing space or tab, as inEMPTY=, took the next line as its value. It now reads as empty, as dotenv reads it, in bothnub <file>andnub watch(#1135). - setup-node with an explicit version. An explicit
node-versionthat the runner's own Node satisfies is now provisioned and put first onPATH, as documented. The runner's Node stayed, where a global npm install could fail withEACCES(#1131). - Nix flake. The flake builds against current nixpkgs again (fixes #1128, #1129).
The full release notes list every change in this release.