npm-packlist icon indicating copy to clipboard operation
npm-packlist copied to clipboard

[FEATURE] auto add files from exports map

Open privatenumber opened this issue 4 years ago • 1 comments

What / Why

Node.js added a new exports property to package.json in v12.7.0 to define entry-points.

Since these files are definitely needed in the package, I'd like for files in the exports map be automatically added as well.

When

Whenever I define entry assets in the exports map for published packages.

Where

Any npm package

How

Current Behavior

Currently, npm-packlist automatically detects important files via package.json properties browser, main, and bin.

Expected Behavior

For files in the exports property to be automatically added too.

I'm not sure if the exports map is only respected by Node if "type": "module" is set, but if it is, it should conditionally only add the exports map given "type": "module".

This might be a dangerous change in case the exports property is used by some packages for something else, but checking the type will alleviate the risk a little bit. Might be worth a breaking change.

Who

  • n/a

References

  • n/a

privatenumber avatar Mar 03 '21 07:03 privatenumber

At the very least, it would be nice somewhere within the npm CLI for pack and publish commands to emit a warning or throw an error if the package exports field contains files that aren't published.

jaydenseric avatar May 25 '21 05:05 jaydenseric