Skip to content
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

โœจ๐Ÿ— Upgrade Closure Compiler to v20180101 #18794

Merged
merged 10 commits into from Nov 15, 2018
Merged

โœจ๐Ÿ— Upgrade Closure Compiler to v20180101 #18794

merged 10 commits into from Nov 15, 2018

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Oct 17, 2018

It's 2018, so this PR upgrades closure compiler to the earliest version from 2018.

Code changes:

  • Undo the promise-pjs workaround introduced by @cramforce in Turn on closure compiler collapse properties.ย #2972.
  • Fix the Property so-and-so never defined errors in gulp check-types by modifying a few imports
  • Unset the process_common_js_modules option for single-pass to prevent errors due to class exports being appended with .default. To make up for it, also do the following:
    • Apply the babel-plugin-transform-commonjs-es2015-modules transform to common JS dependencies that are shipped with the runtime (promise-pjs,dompurify, and set-dom)
    • Remove the UMD wrapper from third_party/mustache.js to make it an ESM style module
    • Replace the common JS version of @ampproject/animations/dist/animations that we were using in amp-lightbox-gallery with its ESM equivalent
  • Fix a class redefinition error in react-utils.js by renaming Deferred to DeferredType (Deferred is already defined and exported by src/promise.js)
  • Fix a redefinition error of width, left, and right in amp-image-slider.js

Coming up: More PRs to eventually upgrade to the latest version.

Partial fix for #18748
Follow up to #18552
Follow up to #18609

@rsimha
Copy link
Contributor Author

rsimha commented Oct 17, 2018

@rsimha rsimha requested a review from cvializ November 7, 2018 16:23
@rsimha
Copy link
Contributor Author

rsimha commented Nov 7, 2018

This PR is now ready for review.

Adding @cvializ to review the change to react-utils.js.

Copy link
Contributor

@cvializ cvializ left a comment

Choose a reason for hiding this comment

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

react-utils changes look good ๐Ÿ‘ "deferring" approval to other reviewers : )

@dreamofabear
Copy link

Please ping on this PR when it's tested and ready.

@rsimha
Copy link
Contributor Author

rsimha commented Nov 12, 2018

@choumx Pinging this PR. To get the runtime to work in single-pass mode, I had to do a couple things like transform common JS dependencies to ESM and remove the UMD wrapper from third_party/mustache.js. Sending this PR out for a fresh review, so we can figure out which of these changes are acceptable, and what we must do in place of the changes that aren't.

@rsimha
Copy link
Contributor Author

rsimha commented Nov 14, 2018

@choumx @jridgewell @erwinmombay At long last, this is ready for review. PTAL.

@rsimha
Copy link
Contributor Author

rsimha commented Nov 15, 2018

Tested this PR as follows:

  • Double checked that the workflow I used to upgrade closure was correct
  • Made sure all Travis checks passed
  • Compiled runtime locally in multi-pass and single-pass modes
  • Served runtime locally in both modes and made sure several example pages load and render correctly
  • Ran integration tests on latest linux Chrome in compiled mode

Merging now ๐Ÿคž

@rsimha rsimha merged commit b6b8129 into ampproject:master Nov 15, 2018
@rsimha rsimha deleted the 2018-10-15-ClosureUpgrade branch November 15, 2018 18:27
return defaultPlugins;
if (isCommonJsModule) {
pluginsToApply = pluginsToApply.concat([
[require.resolve('babel-plugin-transform-commonjs-es2015-modules')],
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have an open issue for removing this transform when possible? We should migrate over all these dependencies to ESM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a TODO in the code assigned to @erwinmombay and me. I'm working on a follow up PR to upgrade to the latest closure as we speak, and will file issues for all remaining ESM library related tasks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, thanks @rsimha.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sent out #23106 to clean this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants