Skip to content

Conversation

@JiaLiPassion
Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Feb 23, 2021

Zone.js supports google closure compiler in advance optimization mode,
to prevent closure compiler modify the onProperty name such as Element.prototype.onclick,
Zone.js implements the onProperty patch logic by declaring all the
event names in source code, this increases the bundle size and also require
updating the event names array to keep the information updated.

Now google closure compiler has the required event names defined in the built-in
externs files, so zone.js can use more simple implementation and decrease the bundle size
of zone.js. (about 3k)

@JiaLiPassion JiaLiPassion added area: build & ci Related the build and CI infrastructure of the project area: zones Issues related to zone.js labels Feb 23, 2021
@ngbot ngbot bot modified the milestone: Backlog Feb 23, 2021
@google-cla google-cla bot added the cla: yes label Feb 23, 2021
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Looks like we just need the size tracking to be updated.

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great refactoring and almost 4Kb savings! 👍

Reviewed-for: size-tracking

@pullapprove pullapprove bot requested a review from jelbourn February 24, 2021 00:39
@AndrewKushnir AndrewKushnir added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Feb 24, 2021
@AndrewKushnir
Copy link
Contributor

@JiaLiPassion it looks like there are more places where payload size should be updated, see test_ivy_aot CI job output.

Could you please also set the "target" label (would it be safe to land in patch version or only in major)?

@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch 2 times, most recently from a93240f to f88f609 Compare February 24, 2021 01:08
@JiaLiPassion JiaLiPassion added the target: patch This PR is targeted for the next patch release label Feb 24, 2021
@JiaLiPassion
Copy link
Contributor Author

@AndrewKushnir , @josephperrott , thank you for the review. I have updated the size and also added the target label.
@AndrewKushnir , could you also run a presubmit to check whether it breaks g3, I remembered there was an issue about using closure complier advanced optimization failed without these event names.

@JiaLiPassion JiaLiPassion removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Feb 24, 2021
@AndrewKushnir
Copy link
Contributor

@JiaLiPassion sure, I've started a presubmit, will let you know how it goes.

@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Feb 24, 2021
@AndrewKushnir
Copy link
Contributor

@JiaLiPassion FYI presubmits went well, but I think we'd need to run a global one before merging this change. Thank you.

@JiaLiPassion
Copy link
Contributor Author

@AndrewKushnir , got it, thank you!

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: size-tracking

@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch 2 times, most recently from f3eb998 to 939c525 Compare February 24, 2021 23:59
@JiaLiPassion
Copy link
Contributor Author

@AndrewKushnir, got it, thank you very much!

@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch 2 times, most recently from 581ed79 to 17d40b6 Compare February 25, 2022 21:46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a doc comment to this function describing its intention (and specifically, that it only considers the immediate object properties and not any inherited properties).

@JiaLiPassion
Copy link
Contributor Author

@alxhub , thank you for the review, I have added the comments and update the code style.

@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch 2 times, most recently from 98bd50a to 044b343 Compare February 25, 2022 23:18
…e size

Zone.js supports the google closure compiler in the advance optimization mode,
to prevent closure compiler modify the `onProperty` name such as `Element.prototype.onclick`,
Zone.js implements the `onProperty` patch logic by declaring all the
event names in the source code, this increases the bundle size and also require
updating the event names array to keep the information updated.

Now google closure compiler has the required event names defined in the built-in
externs files, so zone.js can use more simple implementation and decrease the bundle size
of zone.js (about 4k).
@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch from 044b343 to cbea351 Compare March 1, 2022 03:58
For legacy browsers, we still use the eventNames array to patch event instead of
using `Object.getOwnPropertyNames()` to keep backward compatibility.
@JiaLiPassion JiaLiPassion force-pushed the zone-externs-events branch from cbea351 to 22d8b18 Compare March 1, 2022 04:17
@AndrewKushnir
Copy link
Contributor

Global Presubmit #2.

@AndrewKushnir
Copy link
Contributor

FYI, the presubmit is "green", so I'm adding this PR to the merge queue.

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed state: blocked action: presubmit The PR is in need of a google3 presubmit labels Mar 1, 2022
@AndrewKushnir
Copy link
Contributor

Note to the Caretaker: please sync this PR into g3 as a separate change.

@jessicajaniuk
Copy link
Contributor

This does not merge cleanly with 13.2.x. I'll update to target: minor and land it. Please create a patch PR targeting 13.2.x and we'll land that one, too.

@jessicajaniuk jessicajaniuk added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Mar 1, 2022
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit 1b85811.

jessicajaniuk pushed a commit that referenced this pull request Mar 1, 2022
…es (#40962)

For legacy browsers, we still use the eventNames array to patch event instead of
using `Object.getOwnPropertyNames()` to keep backward compatibility.

PR Close #40962
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 1, 2022
josmar-crwdstffng pushed a commit to josmar-crwdstffng/angular that referenced this pull request Apr 8, 2022
…e size (angular#40962)

Zone.js supports the google closure compiler in the advance optimization mode,
to prevent closure compiler modify the `onProperty` name such as `Element.prototype.onclick`,
Zone.js implements the `onProperty` patch logic by declaring all the
event names in the source code, this increases the bundle size and also require
updating the event names array to keep the information updated.

Now google closure compiler has the required event names defined in the built-in
externs files, so zone.js can use more simple implementation and decrease the bundle size
of zone.js (about 4k).

PR Close angular#40962
josmar-crwdstffng pushed a commit to josmar-crwdstffng/angular that referenced this pull request Apr 8, 2022
…es (angular#40962)

For legacy browsers, we still use the eventNames array to patch event instead of
using `Object.getOwnPropertyNames()` to keep backward compatibility.

PR Close angular#40962
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project area: zones Issues related to zone.js cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants