evanw / evanw/esbuild

Add imports/exports for inputs in metafile

Open
#4,489 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Our team would like to perform some analysis on our project's imports and exports. Some things, like detecting circular references or entirely unused files, should be simple enough with the existing metafile output. But one thing we'd like to do is detect unused exports. Typescript can inform us about locally unused items, but it can't inform us about exported functions/classes/etc which are never used. The metafile already has a list of who imported what where, but we don't know what was imported or what exports each file had available. Hopefully esbuild already has this information available as part of the build process, so I'd like to request the following:

- Each "imports" entry also lists what was imported.
- Each "inputs" entry also contains an exhaustive list of all exports.
- Bonus if the exports list contains all exports as listed in the source, e.g. Typescript types, rather than just Javascript runtime objects

If this information is added to the metafile output we can run our own analysis on this to find unused exports.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing metafile output, especially its imports and inputs entries, and trace where this metadata is assembled during the build. Done means imports identify what was imported and each input contains an exhaustive export list, including source-level exports where supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, javascript, typescript
Domain
build-system, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.