← Blog
The Nub Team

Nub 0.11.2

Nub fixes package-manager pins and private-registry downloads, Node version pins in package.json, tsconfig path resolution, and env file parsing.

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 nub command is flag-for-flag compatible with node, while adding full support for TypeScript, JSX, tsconfig.json, .env loading, and modern Web and ECMAScript APIs. It also includes a fast script runner (nub run), package runner (nubx), Node version manager (nub node), and pnpm-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, packageManager keeps 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, so yarn@^4 failed with "no package manager is pinned". pnpm 10 and later ignore a range there, so Nub warns and points at devEngines.packageManager.
  • Registry config. The download reads the user config that NPM_CONFIG_USERCONFIG names, and the registry in npm_config_registry or NPM_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, <25 is written in the form npm checks, >=22 <25.
  • Ranges in pin files. A .node-version or .nvmrc holding a range or another non-version now gets a warning naming the file. It was skipped silently. A range belongs in engines.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 customConditions option is read from the tsconfig governing each importing file. With a file entry, the entry's tsconfig sets the process-wide conditions, so nub app/main.ts from the root runs like nub main.ts inside app.
  • Empty tsconfig. An empty or comment-only tsconfig.json reads as {}, as in tsc. 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.blob

What 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 .ts file 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 .mts or set "type": "module" (#1138).
  • The standalone runner now stops on a tsconfig it cannot read in full, as nub does. Fix or remove the tsconfig the error names (#1138).

Bug fixes

  • Empty .env values. A value left empty before a trailing space or tab, as in EMPTY= , took the next line as its value. It now reads as empty, as dotenv reads it, in both nub <file> and nub watch (#1135).
  • setup-node with an explicit version. An explicit node-version that the runner's own Node satisfies is now provisioned and put first on PATH, as documented. The runner's Node stayed, where a global npm install could fail with EACCES (#1131).
  • Nix flake. The flake builds against current nixpkgs again (fixes #1128, #1129).

The full release notes list every change in this release.

Get started

View repo