Skip to content

Implement "exports" proposal#28568

Closed
hybrist wants to merge 1 commit intonodejs:masterfrom
hybrist:exports
Closed

Implement "exports" proposal#28568
hybrist wants to merge 1 commit intonodejs:masterfrom
hybrist:exports

Conversation

@hybrist
Copy link
Copy Markdown
Contributor

@hybrist hybrist commented Jul 5, 2019

This implements the package.json "exports" proposal (https://github.com/jkrems/proposal-pkg-exports/) with the following features:

  • When "exports" are defined for a package ({ "exports": { "./x": "./x.js" }), resolving that package import 'pkg/x', will resolve the exports path (/path/to/pkg/x.js).
  • When a subpath does not match "exports", an error is thrown (see test case).
  • Support for "exports": false to indicate a package has no exports at all.
  • Support for folder exports ({ "./folder/": "./other-folder/" }).

This reflects the consensus from this week's modules working group to move forward with exports support in core.

Items to be addressed before this feature is considered "fully done":

  • Support exports in the require loader.
  • Consider key / target validations (if any) and provide error messages where appropriate.
  • Make call on support for differential exports (array syntax in import maps).
  • Make call on support for package-internal entries (e.g. an imports field in package.json).

The working group's recommendation was to address these items as follow-ups to keep the changes (and discussions) focussed on one thing at a time.

See: hybrist/proposal-pkg-exports#36

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants