`readPackage`'s `try` option is unimplemented
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 300
- Forks
- 30
- Avg merge
- 20h 45m
- Merged PRs (30d)
- 3
Description
Environment
- pkg-types: v2.3.0
- node: v24.13.0
Reproduction
https://stackblitz.com/edit/stackblitz-starters-jg9d7l9r?file=index.js
pnpm install && pnpm dev
Describe the bug
readPackage's options parameter accepts a try boolean option which comes from exsolve's types, and is intended to suppress file-not-found errors and return undefined instead when set to true. Currently, this functionality is not implemented, so errors are thrown even with try: true.
Additional context
No response
Logs
Error: Cannot find matching package.json,package.json5,package.yaml in /foo or parent directories
at findFile (file:///home/projects/stackblitz-starters-jg9d7l9r/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs:96:9)
at async Module.readPackage (file:///home/projects/stackblitz-starters-jg9d7l9r/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs:174:24)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with readPackage and findFile in dist/index.mjs, at the locations shown in the stack trace, and run the linked StackBlitz reproduction with pnpm install && pnpm dev. Confirm that a missing package file with try: true returns undefined instead of throwing, while ordinary missing-file behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100