Repository navigation
Conversation
…and async lowered for zone.js
…itions, with tests
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.
A bundler without per-feature lowering (Rolldown's
transform.targetlowers by ES version) can't build an Angular app that runs zone.js the way the Angular CLI does: zone.js can't see nativeawait, so the CLI's esbuild build turnsasyncfunctions into generators (supported: { 'async-await': false }) and leaves everything else native. Lowering by target to ES2016 also lowers object spread, optional chaining and class fields.transformForBrowser(code, filename, options)(andtransformForBrowserSync) does just that, withoxc_transformer:asyncfunctions, async generators andfor awaitbecome generators; helpers are imported from@oxc-project/runtime;experimentalDecorators), anduseDefineForClassFields: falsesemantics, so fields are assigned in the constructor after parameter properties and statics after the class (astscand esbuild emit them);asyncis lowered;lowerAsync: falsekeepsasyncnative (server rendering is zoneless).We use it in a Rolldown plugin's
transformhook, aftertransformAngularFile, for every TypeScript file and every JavaScript file that containsasync; with it a production build of our app matches the Angular CLI's output.Tests: three in
crates/oxc_angular_compiler/src/browser.rsand five innapi/angular-compiler/test/transform-for-browser.test.ts(async lowering,lowerAsync: false, field order after parameter properties, legacy decorators, syntax errors).index.jsandindex.d.tsare regenerated.