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(bazel): enable dts bundling for Ivy packages #42728

Closed
wants to merge 3 commits into from
Closed

fix(bazel): enable dts bundling for Ivy packages #42728

wants to merge 3 commits into from

Conversation

alan-agius4
Copy link
Contributor

It is now possible to bundle DTS files of Ivy libraries since the blocker microsoft/rushstack#1029 has been addressed upstream.

@alan-agius4 alan-agius4 added area: build & ci Related the build and CI infrastructure of the project area: packaging Issues related to Angular's creation of npm packages area: bazel Issues related to the published `@angular/bazel` build rules action: time-zone target: minor This PR is targeted for the next minor release labels Jul 1, 2021
@google-cla google-cla bot added the cla: yes label Jul 1, 2021
@ngbot ngbot bot modified the milestone: Backlog Jul 1, 2021
@@ -262,7 +262,7 @@ export class KeyValuePipe implements PipeTransform {
}

// @public
export class Location {
class Location_2 {
Copy link
Contributor Author

@alan-agius4 alan-agius4 Jul 1, 2021

Choose a reason for hiding this comment

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

API extractor renames these to avoid clashes with globals variables.

@alan-agius4 alan-agius4 added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 1, 2021
@alan-agius4 alan-agius4 marked this pull request as ready for review July 1, 2021 08:31
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 1, 2021
@pullapprove pullapprove bot requested review from alxhub, josephperrott and kyliau July 1, 2021 08:31
@alan-agius4 alan-agius4 requested review from IgorMinar and removed request for kyliau July 1, 2021 08:31
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.

LGTM

Can you clarify the last commit message a bit? I found it a bit confusing.

Currently it says:

fix(compiler-cli): support reflecting local modules
With the recent change to enable Ivy DTS bundling, will convert local namespace imports to local modules such as the below;
```ts
declare namespace i1 {
  export {
    RouterOutletContract,
    RouterOutlet
  }
}

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

With this change we amend `reflectTypeEntityToDeclaration` to support this.

I believe that these "local modules" are what used to be called "internal modules" and are actually now referred to simply as "namespaces". This is compared to "external modules" which are now referred to as just "modules". See https://www.typescriptlang.org/docs/handbook/namespaces.html.

I think it would be helpful to explain the background motivation for this change. I.e that when the definition of a type is in a bundled d.ts file, then what were originally namespaced imports become namespace declarations within this file. And therefore this commit adds support for reflecting types that are defined in such namespace declarations.

goldens/public-api/localize/init/index.md Outdated Show resolved Hide resolved
@alan-agius4
Copy link
Contributor Author

@petebacondarwin, commit message updated.

@petebacondarwin
Copy link
Contributor

@petebacondarwin, commit message updated.

Perfect! Thanks.

Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM. Worth capturing here that 56bd21d has been implemented to allow for this update to happen (due to the new alias exports being generated)

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

Reviewed-for: public-api, bazel, dev-infra

Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

LGTM 🍪

@jessicajaniuk jessicajaniuk removed their request for review July 2, 2021 15:53
We can now allow Renovate to manage this dependency.
It is now possible to bundle DTS files of Ivy libraries since the blocker microsoft/rushstack#1029 has been addressed upstream.
DTS bundling, will cause originally namespaced imports become namespace declarations within the same file. Example:

Before bundling
```ts
import * as i1 from './router';

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

After bundling
```
declare namespace i1 {
  export {
    RouterOutletContract,
    RouterOutlet
  }
}

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

And therefore this commit adds support for reflecting types that are defined in such namespace declarations.

Closes #42064
@alan-agius4
Copy link
Contributor Author

Caretaker: I am unable to remove the unnecessary reviews.

@alan-agius4 alan-agius4 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 action: presubmit The PR is in need of a google3 presubmit labels Jul 2, 2021
@atscott
Copy link
Contributor

atscott commented Jul 2, 2021

presubmit

@atscott atscott closed this in d041455 Jul 2, 2021
atscott pushed a commit that referenced this pull request Jul 2, 2021
It is now possible to bundle DTS files of Ivy libraries since the blocker microsoft/rushstack#1029 has been addressed upstream.

PR Close #42728
atscott pushed a commit that referenced this pull request Jul 2, 2021
DTS bundling, will cause originally namespaced imports become namespace declarations within the same file. Example:

Before bundling
```ts
import * as i1 from './router';

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

After bundling
```
declare namespace i1 {
  export {
    RouterOutletContract,
    RouterOutlet
  }
}

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

And therefore this commit adds support for reflecting types that are defined in such namespace declarations.

Closes #42064

PR Close #42728
atscott pushed a commit that referenced this pull request Jul 2, 2021
We can now allow Renovate to manage this dependency.

PR Close #42728
atscott pushed a commit that referenced this pull request Jul 2, 2021
It is now possible to bundle DTS files of Ivy libraries since the blocker microsoft/rushstack#1029 has been addressed upstream.

PR Close #42728
atscott pushed a commit that referenced this pull request Jul 2, 2021
DTS bundling, will cause originally namespaced imports become namespace declarations within the same file. Example:

Before bundling
```ts
import * as i1 from './router';

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

After bundling
```
declare namespace i1 {
  export {
    RouterOutletContract,
    RouterOutlet
  }
}

export declare class RouterModule {
    constructor(guard: any, router: Router);

    static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, [typeof i1.RouterOutlet...]>;
}
```

And therefore this commit adds support for reflecting types that are defined in such namespace declarations.

Closes #42064

PR Close #42728
@alan-agius4 alan-agius4 deleted the api-extractor-update-ivy branch July 3, 2021 05:02
@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 Aug 3, 2021
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 action: presubmit The PR is in need of a google3 presubmit area: bazel Issues related to the published `@angular/bazel` build rules area: build & ci Related the build and CI infrastructure of the project area: compiler Issues related to `ngc`, Angular's template compiler area: packaging Issues related to Angular's creation of npm packages 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: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't run api-extractor on library compiled with ivy
7 participants