[core] Upgrade to ES-Modules for core#26238
Merged
mpodwysocki merged 244 commits intomainfrom Feb 20, 2024
Merged
Conversation
Collaborator
|
API change check API changes are not detected in this pull request. |
xirzec
reviewed
Jun 16, 2023
… feat/core-modulear
witemple-msft
approved these changes
Feb 8, 2024
Member
witemple-msft
left a comment
There was a problem hiding this comment.
No violations of the dev-tool revised code have been detected in this pull request.
Member
For some reason I have the urge to comment "good bot" like in reddit threads. 🤣 But thank you for taking a look @witemple-msft ! |
Closed
… feat/core-modulear
… feat/core-modulear
… feat/core-modulear
3 tasks
sofiar-msft
pushed a commit
to sofiar-msft/azure-sdk-for-js
that referenced
this pull request
Apr 11, 2024
### 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]>
mcgear
reviewed
Jun 1, 2024
There was a problem hiding this comment.
This change seems to have broken some things for us, relating to process.versions being undefined in our Deno project.
Member
There was a problem hiding this comment.
@mcgear thanks for the feedback! Could you please log a new issue? It's hard to track things in a merged PR.
This was referenced Aug 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usingtshyto 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,
sinondoes 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 usingvitestfor all tests. Currently, the system builds a test bundle which targets the correct files such as those targeted for the browser, eglog-browser.mtsbecomeslog.jsin 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