Pirates is a CommonJS library for adding custom require hooks, letting you modify loaded module code while avoiding interference with other require hooks. It provides a function (addHook) to apply a code transform based on options like file extensions and a filename matcher, and it returns a revert function to undo the hook.
Project status
- The repo appears to be actively maintained, with a very recent upstream push timestamp (2026-05-29), though the last published version shown in the provided history is v4.0.7 on 2025-03-27.
- The apparent updates cadence is irregular and relatively slow, with v4.0.5 in 2022, v4.0.6 in 2023, and v4.0.7 in 2025 (long gaps between versioned updates).
AI summary generated Today
Recent updates
v4.0.7
3/27/2025Release v4.0.7 is presented as small bug fixes, including shipping source directly by removing the build process. The actual diff shows broader changes to how the package is built and executed, plus test and CI workflow adjustments.
v4.0.6
6/20/2023Release v4.0.6 notes only mention a bug fix consisting of an update to package.json. The actual diff shows broader changes, primarily to GitHub Actions CI workflows and a large dependency lockfile refresh.
Securityv4.0.5
1/24/2022v4.0.5 is described as a bug fix release, focused on ensuring revert() correctly restores prior loader state. The code change specifically adjusts how require extension handlers are restored when there is no previous loader.