-
Notifications
You must be signed in to change notification settings - Fork 243
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
feat(compiler): Support ESM subpath imports #5572
Conversation
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, we'll have to confirm with the team that we do indeed want to support that fully but I don't really see why not.
Co-authored-by: Timothee Guerin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked with the Team and we are all good to add this! Will be part of the febuary release(next week).
Thanks for the contribution!
Thank you for picking up this and the follow-up commits 🙏 looking forward to the next release! |
In my understand TypeSpec typically follows the ESM module resolution algorithm. Subpath exports are already supported, but subpath imports are not yet. This pull request proposes to add support for ESM subpath imports in TypeSpec files. For details of subpath imports, refer https://nodejs.org/api/packages.html#subpath-imports and https://nodejs.org/api/esm.html#resolution-algorithm-specification. ## Example usage If we have a `imports` declaration in `package.json`: ```json { "name": "@contoso/tsp", "imports": { "#utils": "./src/utils.tsp", }, } ``` We can now import `#utils` from tsp files: ```tsp import "#utils"; ``` --------- Signed-off-by: Naoki Ikeguchi <[email protected]> Co-authored-by: Timothee Guerin <[email protected]> Co-authored-by: Timothee Guerin <[email protected]>
In my understand TypeSpec typically follows the ESM module resolution algorithm. Subpath exports are already supported, but subpath imports are not yet. This pull request proposes to add support for ESM subpath imports in TypeSpec files.
For details of subpath imports, refer https://nodejs.org/api/packages.html#subpath-imports and https://nodejs.org/api/esm.html#resolution-algorithm-specification.
Example usage
If we have a
imports
declaration inpackage.json
:We can now import
#utils
from tsp files: