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

build: enable bundle_dts for upgrade package #28642

Closed
wants to merge 3 commits into from
Closed

build: enable bundle_dts for upgrade package #28642

wants to merge 3 commits into from

Conversation

alan-agius4
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

At the moment, the API extractor doesn't support local namespaced imports, this will break the generation of flat dts files. When we turn on dts bundling for this package it will break. Hence this is the ground work needed for making this package compatable with the API extractor.

Relates to #28588

@petebacondarwin
Copy link
Member

Given that ngtsc will not work with api-extractor, why are we not putting our energy into fixing that rather than working around it for this package?

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 11, 2019

Good point, but since we potential want to roll this out for version 8, for the time being the dts bundler will be enabled only under the legacy ngc compiler.

While indeed ngtsc does generate namespaced imports, it could generate named imports if absolutely needed. So eventually after version 8 is release we have 2 options, if we see that this feature has not been implemented by Microsoft.

  1. Pitch in and help to implement this feature, which is not a small one.
  2. Change ngtsc to emit named imports.

//cc @alexeagle, @IgorMinar & @alxhub as there are also aware of this issue.

@alexeagle
Copy link
Contributor

Another possibility is to keep generating individual .d.ts for this one package.

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 13, 2019

Yeah, that’s another option. How’s gonna make the call for that?

Is: merge this and enable flattening dts or keep this package as is?

@alxhub
Copy link
Member

alxhub commented Feb 13, 2019

I'm very wary of us ending up in a state where only a subset of TS will be supported within the Angular repo and as a compilation target. I don't see the "don't use namespaced imports" solution as being viable long-term.

@alan-agius4 alan-agius4 changed the title refactor: replace local namespaced imports with named build: enable bundle_dts for a number of upgrade package Feb 19, 2019
@alan-agius4 alan-agius4 changed the title build: enable bundle_dts for a number of upgrade package build: enable bundle_dts for upgrade package Feb 19, 2019
@alexeagle alexeagle added the target: major This PR is targeted for the next major release label Feb 20, 2019
@alexeagle
Copy link
Contributor

@alxhub I agree somewhat, but also, we've always had to stay within some subset (eg. worked with ts2dart, now has to work with closure compiler)
We know that long-term, we need to make fixes in the dts-bundler so the question is how we want these packages to look for v8. APFv8 will say that bundling .d.ts is optional, so I think either way is valid.

@benlesh benlesh added area: build & ci Related the build and CI infrastructure of the project area: core Issues related to the framework runtime comp: upgrade/static labels Feb 20, 2019
@ngbot ngbot bot added this to the needsTriage milestone Feb 20, 2019
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.

can you please reference microsoft/rushstack#1029 from the commit that removes the namespaces.

also will the build actually break with an (semi) intelligent error when someone reintroduces namespaces or will it just produce a broken artifact? if it's the former then I think we can go ahead with this change otherwise we should discuss how to prevent namespace reintroduction.

@IgorMinar IgorMinar 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 21, 2019
@IgorMinar
Copy link
Contributor

do we have an estimate for fixing microsoft/rushstack#1029? is that something we could do ourselves? or is it already on the short-term roadmap of that team?

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 21, 2019

@IgorMinar, the commit msg has been updated to reference the issue mentioned above.

API extractor, will emit a clear error whenever a local namespaced import is found. Something along "import * as __ from __" for local paths is not supported.

Regarding the ETA/roadmap for this issue to be solved, I reached out to Pete G, from Microsoft. When, I have an answer I'll let you know. To make it clear, this is not a bug but rather a new feature request.

@alan-agius4
Copy link
Contributor Author

CI is flaky, can someone re-triggering it please? Thanks

At the moment, the API extractor doesn't support local namespaced imports, this will break the generation of flat dts files. When we turn on dts bundling for this package it will break. Hence this is the ground work needed for making this package compatable with the API extractor.

See: microsoft/rushstack#1029

Relates to #28588
@IgorMinar
Copy link
Contributor

IgorMinar commented Feb 22, 2019

merge-assistance: check http://test/OCL:235139957:BASE:235139984:1550820856416:dc41396
and merge plz

@IgorMinar IgorMinar added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Feb 22, 2019
@ngbot ngbot bot added the action: merge The PR is ready for merge by the caretaker label Feb 22, 2019
@alan-agius4
Copy link
Contributor Author

@IgorMinar, Pete from Microsoft replied.

@alan-agius4 it would be awesome if someone in the community wanted to help out with microsoft/rushstack#1029 to get it implemented sooner.

However it may be somewhat challenging for a first PR. I haven't thought about the design enough yet to know how much work it is. But I will point out that this construct allows arbitrary aliasing of types, e.g. you can say export { A } from './file'; and also import * as N1 from './file'; export { N1 } and now your entry point has A and N1.A and maybe N2.A in its exports. What is the "main" name for A? There isn't a natural choice. This issue doesn't generally arise with the namespace keyword.

On the other hand, if we look at the various "real life" examples people submitted, maybe we can take a shortcut and implement something simple that works for the most common cases. Again, if people want to do some investigation or post some suggestions, that might help push this along a little faster.

@IgorMinar
Copy link
Contributor

thanks @alan-agius4 for the followup. I'll merge this for now.

@IgorMinar IgorMinar closed this in 7c1b9ff Feb 22, 2019
IgorMinar pushed a commit that referenced this pull request Feb 22, 2019
IgorMinar pushed a commit that referenced this pull request Feb 22, 2019
gkalpak pushed a commit to gkalpak/angular that referenced this pull request Feb 22, 2019
At the moment, the API extractor doesn't support local namespaced imports, this will break the generation of flat dts files. When we turn on dts bundling for this package it will break. Hence this is the ground work needed for making this package compatable with the API extractor.

See: microsoft/rushstack#1029

Relates to angular#28588

PR Close angular#28642
gkalpak pushed a commit to gkalpak/angular that referenced this pull request Feb 22, 2019
gkalpak pushed a commit to gkalpak/angular that referenced this pull request Feb 22, 2019
@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 Sep 14, 2019
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: core Issues related to the framework runtime 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: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants