-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core] Upgrade to ES-Modules for core #26238
Conversation
API change check API changes are not detected in this pull request. |
… feat/core-modulear
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.
No violations of the dev-tool revised code have been detected in this pull request.
For some reason I have the urge to comment "good bot" like in reddit threads. 🤣 But thank you for taking a look @witemple-msft ! |
… feat/core-modulear
… feat/core-modulear
… feat/core-modulear
### Packages impacted by this PR - @azure/abort-controller - @azure/core-auth - @azure/core-client - @azure-rest/core-client - @azure/core-http-compat - @azure/core-lro - @azure/core-paging - @azure/core-rest-pipeline - @azure/core-sse - @azure/core-tracing - @azure/core-util - @azure/core-xml - @azure/logger - @typespec/ts-http-runtime ### Issues associated with this PR ### Describe the problem that is addressed by this PR This migrates the core packages from a hybrid of CJS and ESM to an ESM solution using [`tshy`](https://github.com/isaacs/tshy). The core is now ESM, implemented as a module, and projects using `tshy` to CommonJS and ESM. The ESM build targets we will target include: - ESM (Node) - Browser - React-Native - Bun - Deno This will allow each system to pick up the correct output instead of picking the browser bundle which has happened in the past. Currently, our bun and deno support is strictly through npm compatibility and we are not forking logic at this point for those runtimes. In order to support ESM, `sinon` does not allow for ESM module mocking, so we looked for an alterative in `vitest`. This PR also migrates all core packages stated above from Mocha/Chai for Node and Mocha/Chai/Karma for the browser to using `vitest` for all tests. Currently, the system builds a test bundle which targets the correct files such as those targeted for the browser, eg `log-browser.mts` becomes `log.js` in the compiled output. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary) --------- Co-authored-by: Deyaaeldeen Almahallawi <[email protected]> Co-authored-by: Maor Leger <[email protected]> Co-authored-by: Jeremy Meng <[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.
This change seems to have broken some things for us, relating to process.versions being undefined in our Deno project.
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.
@mcgear thanks for the feedback! Could you please log a new issue? It's hard to track things in a merged PR.
Packages impacted by this PR
Issues associated with this PR
Describe the problem that is addressed by this PR
This migrates the core packages from a hybrid of CJS and ESM to an ESM solution using
tshy
. The core is now ESM, implemented as a module, and projects usingtshy
to CommonJS and ESM.The ESM build targets we will target include:
This will allow each system to pick up the correct output instead of picking the browser bundle which has happened in the past. Currently, our bun and deno support is strictly through npm compatibility and we are not forking logic at this point for those runtimes.
In order to support ESM,
sinon
does not allow for ESM module mocking, so we looked for an alterative invitest
. This PR also migrates all core packages stated above from Mocha/Chai for Node and Mocha/Chai/Karma for the browser to usingvitest
for all tests. Currently, the system builds a test bundle which targets the correct files such as those targeted for the browser, eglog-browser.mts
becomeslog.js
in the compiled output.What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists