-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Description
Static analysis for TS apps, fallback plan for ES5/ES6
Use the same library code to invoke TS language services to collect the component metadata for the offline compiler as we use in Angular 2 Developer Services.
E.g.
@Component({
selector: 'some-comp',
...
})
class SomeComponent {}
Would result into the metadata, independent of the implementation of the @component decorator:
{
selector: 'some-comp'
}
Advantages:
Offline template compilation is fast in developer roundtrip since editor usecase requires low latency.
Disadvantages:
Can't use the full power of the Decorators language feature. Probably need to detect and warn if user's code can't be statically analyzed.
Allowing users to write their own Decorator
We should avoid a first-party-only solution, where only the Decorators we've written work with the metadata collection.
Options discussed:
- Add a meta-decorator, which describes the compiler metadata produced by a decorator.
- Develop a plugin mechanism so that user's decorators can publish the metadata produced by execution of their decorator
- What about ES5/ES6 users?
- Ship the template compiler in a version of angular binary. Add a $templateCache similar to angular1 to avoid XHR for template content. Template compiler becomes performance sensitive.
Write the tool from Option 1, but only use it for ES5/ES6 users. Maintenance of that tool likely worse, as it falls off our main support path. - Require ES5/ES6 users to provide some statically analyzable data in their application, possibly by requiring a particular syntax sugaring for attaching annotations to classes/functions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels