Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yarn constraints rules requiring that dual CJS/ESM builds and type declarations be exposed for all export subpaths in package manifests #4699

Open
MajorLift opened this issue Sep 13, 2024 · 1 comment

Comments

@MajorLift
Copy link
Contributor

MajorLift commented Sep 13, 2024

Descriptions

References

@MajorLift MajorLift changed the title Add yarn constraints rules requiring that dual CJS/ESM builds be exposed for export subpaths in package manifests Add yarn constraints rules requiring that dual CJS/ESM builds be exposed for all export subpaths in package manifests Sep 13, 2024
@MajorLift MajorLift changed the title Add yarn constraints rules requiring that dual CJS/ESM builds be exposed for all export subpaths in package manifests Add yarn constraints rules requiring that dual CJS/ESM builds and type declarations be exposed for all export subpaths in package manifests Sep 13, 2024
@mcmire
Copy link
Contributor

mcmire commented Dec 4, 2024

What should we check here? In the case of . we can reasonably expect that the output JS files are located at dist/index.mjs and dist/index.cjs and that the output declaration files are at dist/index.d.mts and dist/index.d.cts. However, that may not be the case for subpath exports, which may be in different directories. For instance, @metamask/notification-services-controller has a subpath export at ./notification-services/ui, and this points to the relevant files in dist/NotificationServicesController/ui.

Perhaps all we can check is the following?

  • import.types ends in /index.d.mts
  • import.default ends in /index.mjs
  • require.types ends in /index.d.cts
  • require.default ends in /index.cjs
  • types are listed first in both import and require

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants