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

Produce closure externs in Angular distro #14325

Closed
alexeagle opened this issue Feb 6, 2017 · 5 comments
Closed

Produce closure externs in Angular distro #14325

alexeagle opened this issue Feb 6, 2017 · 5 comments
Assignees
Labels
area: packaging Issues related to Angular's creation of npm packages

Comments

@alexeagle
Copy link
Contributor

alexeagle commented Feb 6, 2017

Tsickle can convert an interface declaration like

declare interface MyJsonData {
  fieldThatComesAsJson: string;
}

to the Closure Compiler externs format, preventing fieldThatComesAsJson from being renamed to something shorter by Closure.

We just need to hook up the externs generation in @angular/tsc-wrapped and include them in the Angular distro (for things like testability API that Protractor calls), and make sure an example user app also generates externs that can be discovered by closure.

@b-strauss
Copy link

I thought the plan was to let closure optimize symbols across the whole program (RxJS + Angular + App). Would this not significantly increase the output?

@alexeagle
Copy link
Contributor Author

@b-strauss yes, that is what we do already. A single JS bundle containing the parts of angular/rxjs that your app uses. The externs are needed only for:

  • parts of Angular that need to be used outside the bundle (just the testability interface for Protractor so far)
  • interacting with the JSON data you receive at runtime
  • usage of 3rd party libraries you use that aren't compatible with closure, and you plan to load outside the bundle

@tbosch tbosch added the area: packaging Issues related to Angular's creation of npm packages label Apr 10, 2017
@IgorMinar
Copy link
Contributor

@alexeagle I think this one is already being taken care of by us running the ts code through tsickle before shipping it to npm. can this be closed?

@alexeagle
Copy link
Contributor Author

We have some externs copied manually out of tsickle's output. Ideally we should generate them, but I reviewed them again just now, and they are very trivial (search for *.externs.js in the angular repo) so I think there's nothing more to do.

@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 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: packaging Issues related to Angular's creation of npm packages
Projects
None yet
Development

No branches or pull requests

4 participants