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
- Maintenance/active development: The repository shows a very recent upstream push on 2026-05-29, and there is a tagged update v4.0.7 on 2025-03-27, suggesting the project is not fully dormant. However, the evidence also shows long gaps between tagged updates.
- Apparent update cadence: Tagged updates have been sporadic over time (for example, 2023-06-20 (v4.0.6), then 2025-03-27 (v4.0.7)), which implies an infrequent release cadence rather than regular monthly releases.
AI summary generated
Recent updates
v4.0.7
Release 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
Release 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
v4.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.
v4.0.4
v4.0.4 replaces the external node-modules-regexp dependency with an inline regular expression, addressing how this library detects node_modules paths. It also updates the test suite to cover the ignoreNodeModules option behavior.
v4.0.3
Release v4.0.3 is described as a bug fix release, including a correction to loader state restoration and a release-related fix. However, the provided code diff only shows changes to build and npm lifecycle scripts in package.json and related dependency updates in yarn.lock, with no source code changes included.
v4.0.2
v4.0.2 appears to be a mostly maintenance-oriented release, but the provided release notes do not describe any changes beyond stating the release is broken. The code diff shows updates to TypeScript typings (matcher signature and option aliases) plus a functional change to how `addHook` reverts Node require loaders.
BreakingFeaturesv4.0.1
v4.0.1 primarily introduces TypeScript type declarations for the library API. The runtime source changes are minimal and largely limited to formatting/linting related edits, alongside build/test tooling upgrades.
Featuresv4.0.0
v4.0.0 primarily updates the project to require Node.js 6 or newer, aligning the runtime support policy. The code diff shows minimal runtime changes (only a small error-message formatting tweak), while most differences are in tooling, build configuration, CI, and dependency versions.
Breakingv3.0.2
Release v3.0.2 is presented as a small compatibility bug fix. The diff also includes several build/test tooling updates (CI Node versions, lint/coverage config, devDependency and lockfile changes) and an internal change to how the module compile hook is wrapped.
v3.0.1
v3.0.1 is primarily an export fix, adjusting how `addHook` is exported so ES module consumers can import it correctly. The code diff also includes several build, CI, and test/coverage configuration changes (Babel and nyc/codecov).