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

fix(ngcc): support alternate UMD layout when adding new imports #43931

Closed
wants to merge 2 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Oct 23, 2021

In #43879, UmdReflectionHost was updated to deal with the new UMD format used by Rollup, where the parenthesis is around the wrapper function and not the wrapper function call.
For reference, this caused failures in the ngcc-validation repo (example 1, example 2).

This commit updates UmdRenderingFormatter to also handle both UMD formats. In order to validate the change, this commit also updates the UmdRenderingFormatter tests to run against both UMD formats.

Fixes #43936.

NOTE: Better reviewed with whitespace changes ignored.

In angular#43879, `UmdReflectionHost` was updated to deal with the new UMD
format used by Rollup, where the parenthesis is around the wrapper
function and not the wrapper function call.
For reference, this caused failures in the `ngcc-validation` repo
([example 1][1], [example 2][2]).

This commit updates `UmdRenderingFormatter` to also handle both UMD
formats. In order to validate the change, this commit also updates the
`UmdRenderingFormatter` tests to run against both UMD formats.

[1]: https://circleci.com/gh/angular/ngcc-validation/65916
[2]: https://circleci.com/gh/angular/ngcc-validation/65758
@google-cla google-cla bot added the cla: yes label Oct 23, 2021
@gkalpak gkalpak added comp: ngcc target: patch This PR is targeted for the next patch release type: bug/fix labels Oct 23, 2021
@ngbot ngbot bot added this to the Backlog milestone Oct 23, 2021
@mary-poppins
Copy link

You can preview da9b1de at https://pr43931-da9b1de.ngbuilds.io/.

@gkalpak gkalpak added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 23, 2021
@gkalpak gkalpak marked this pull request as ready for review October 23, 2021 11:48
@mary-poppins
Copy link

You can preview 7dc34e3 at https://pr43931-7dc34e3.ngbuilds.io/.

@petebacondarwin
Copy link
Member

Great spot @gkalpak - thanks for fixing.

Copy link
Member

@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.

LGTM - Did you test it directly on ngcc-validation for e2e confidence?

gkalpak added a commit to gkalpak/ngcc-validation that referenced this pull request Oct 24, 2021
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 25, 2021
@petebacondarwin
Copy link
Member

petebacondarwin commented Oct 25, 2021

Hmm, I see that ngcc-validation still fails with this PR on @delon/theme package:

Error: Failed to find exported name of node (I18nPipe = /** @class */ (function () {
        function I18nPipe(i18n) {
            this.i18n = i18n;
        }
        I18nPipe.prototype.transform = function (key, params) {
            return this.i18n.fanyi(key, params);
        };
        return I18nPipe;
    }())) in '/home/circleci/repo/node_modules/@delon/theme/bundles/theme.umd.js'.

Not 100% sure if this is related.

I wonder if the parentheses around members has also changed in rollup...

@petebacondarwin
Copy link
Member

petebacondarwin commented Oct 25, 2021

Ahah! The export of I18nPipe has changed from:

exports.ɵa = I18nPipe;

to

exports["ɵa"] = I18nPipe;

So we also need to update UmdReflectionHost.getExportsOfModule() and in particular isExportsAssignment()

@gkalpak
Copy link
Member Author

gkalpak commented Oct 25, 2021

Yes, I saw it. I am working on it 😃

@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit 6e37c93.

jessicajaniuk pushed a commit that referenced this pull request Oct 25, 2021
In #43879, `UmdReflectionHost` was updated to deal with the new UMD
format used by Rollup, where the parenthesis is around the wrapper
function and not the wrapper function call.
For reference, this caused failures in the `ngcc-validation` repo
([example 1][1], [example 2][2]).

This commit updates `UmdRenderingFormatter` to also handle both UMD
formats. In order to validate the change, this commit also updates the
`UmdRenderingFormatter` tests to run against both UMD formats.

[1]: https://circleci.com/gh/angular/ngcc-validation/65916
[2]: https://circleci.com/gh/angular/ngcc-validation/65758

PR Close #43931
jessicajaniuk pushed a commit that referenced this pull request Oct 25, 2021
In #43879, `UmdReflectionHost` was updated to deal with the new UMD
format used by Rollup, where the parenthesis is around the wrapper
function and not the wrapper function call.
For reference, this caused failures in the `ngcc-validation` repo
([example 1][1], [example 2][2]).

This commit updates `UmdRenderingFormatter` to also handle both UMD
formats. In order to validate the change, this commit also updates the
`UmdRenderingFormatter` tests to run against both UMD formats.

[1]: https://circleci.com/gh/angular/ngcc-validation/65916
[2]: https://circleci.com/gh/angular/ngcc-validation/65758

PR Close #43931
@gkalpak gkalpak deleted the fix-ngcc-umd-rendering branch October 25, 2021 17:56
@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 Nov 25, 2021
Serginho pushed a commit to TuLotero/angular that referenced this pull request Jan 20, 2022
…lar#43931)

In angular#43879, `UmdReflectionHost` was updated to deal with the new UMD
format used by Rollup, where the parenthesis is around the wrapper
function and not the wrapper function call.
For reference, this caused failures in the `ngcc-validation` repo
([example 1][1], [example 2][2]).

This commit updates `UmdRenderingFormatter` to also handle both UMD
formats. In order to validate the change, this commit also updates the
`UmdRenderingFormatter` tests to run against both UMD formats.

[1]: https://circleci.com/gh/angular/ngcc-validation/65916
[2]: https://circleci.com/gh/angular/ngcc-validation/65758

PR Close angular#43931
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 cla: yes target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ngcc: (main as umd) Cannot read property '1' of undefined
4 participants