Back to Explore

sindresorhus/parent-module

GitHub
2 watchersOpen source

Last release:

parent-module is a Node.js utility that returns the file path of the module that called your code. It supports both CommonJS and ESM, and is useful for getting the immediate parent module path (or undefined at the top-level entry module). You can also combine it with read-package-up to read the parent module’s package.json.

Project status

  • Maintenance status: The last recorded upstream push and package update are from 2025-09-15. Compared to today (2026-06-09), that suggests the project is still in active maintenance, but only with a recent gap of several months and no evidence of more frequent work.
  • Updates cadence: Historical updates show long intervals (for example, 2021 to 2023 and earlier 2019 to 2021), indicating generally infrequent updates. The most recent two years look like a shift to periodic maintenance, with the latest update about nine months ago.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v3.2.0

    v3.2.0 focuses on fixing an ESM top-level module behavior issue. The implementation change is larger than the single release-note bullet suggests, including new call stack filtering logic and cases where the function can return undefined.

    Breaking
  • v3.1.0

    v3.1.0 is a small release that updates the package version and bumps a dependency. The release notes only state that dependencies were updated, without specifying which ones.

  • v3.0.0

    v3.0.0 moves the package to an ES module-only setup and updates the public entrypoints accordingly. The main functional code remains centered on `callsites()`, but the surrounding module system, packaging metadata, and dependency versions were changed.

    Breaking
  • v2.0.0

    v2.0.0 primarily bumps the minimum supported Node.js version to 8 and adds TypeScript type definitions for the module. The JavaScript implementation is mostly unchanged internally, but the package metadata and tooling were updated to support TypeScript checking.

    BreakingFeatures
  • v1.0.1

    v1.0.1 makes a small runtime adjustment in index.js to skip stack frames whose filename is not a string, and it updates documentation formatting and npm install instructions. The release notes only mention ensuring the filepath is a string, but the code change is specifically guarding the filename returned from stack frame inspection. Dev tooling versions in package.json were also bumped.

  • v1.0.0

    This release is a major v1.0.0 update that introduces a compatibility requirement. The primary change is a new minimum Node.js version requirement, which may prevent older environments from running the package.

    Breaking