Skip to content

feat!: rewrite as a pure ESM package (Node.js >= 18)#40

Merged
simonepri merged 1 commit into
mainfrom
feat/esm-v1
Jun 8, 2026
Merged

feat!: rewrite as a pure ESM package (Node.js >= 18)#40
simonepri merged 1 commit into
mainfrom
feat/esm-v1

Conversation

@simonepri

Copy link
Copy Markdown
Owner

Phase 1 of the renewal: the first 1.0.0, a pure-ESM rewrite. This is a deliberate breaking change — it ships as a major version, so the millions of ^0.6 consumers are unaffected until they opt in.

Highlights

  • Pure ESM with default and named exports — import pidtree from 'pidtree' and import {pidtree} from 'pidtree' both work.
  • Drops CommonJS and Node.js < 18 (engines: >=18, exports map).
  • Refreshed toolchain: ava 0.25→8, nyc→c8, xo→2, updated tsd; removed np/npm-check/mockery/pify/stream-mock deps.
  • Cleaner, more testable internals: a single shared parse() and dependency injection replace the mockery + fake-stream machinery, so tests need no ESM-loader hacks. Still zero runtime dependencies.
  • Keeps the Windows wmic → PowerShell fallback from 0.6.1 intact.
  • Also fixes a latent bug: querying pid 0 no longer reports "No matching pid found".

CI / tooling

  • Lint runs on modern Node again (retires the temporary Node-14 pin from the hotfix).
  • Type checking (tsd) re-enabled in CI; matrix is Node 18–current on Linux/macOS/Windows (Server 2025, which exercises the PowerShell fallback).

Notes

Merging this lets release-please cut the 1.0.0 release (the feat! commit drives the major bump), which auto-publishes via the now-working OIDC pipeline.

A short migration note is in the readme: CommonJS / older-Node users stay on pidtree@0.6.

@simonepri simonepri force-pushed the feat/esm-v1 branch 3 times, most recently from d6c2257 to fc575ea Compare June 8, 2026 11:30
Modernizes the project for the first 1.0 release:
- Pure ESM with default and named exports (import pidtree from 'pidtree')
- Drops CommonJS and Node.js < 18
- Refreshed toolchain: ava 6, c8, xo 2, tsd; tests use dependency
  injection and a shared parser instead of mockery and stream mocks
- Keeps the Windows wmic -> PowerShell fallback and zero runtime deps

BREAKING CHANGE: pidtree is now ESM-only and requires Node.js >= 18.
CommonJS consumers and older Node.js should stay on pidtree@0.6.

Co-Authored-By: Gavin Aiken <gavin.aiken@netcuras.com>
@simonepri simonepri merged commit bd6c575 into main Jun 8, 2026
14 checks passed
@simonepri simonepri deleted the feat/esm-v1 branch June 8, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pidtree upsets the ESM parser in node 22

1 participant