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:
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.
Would result into the metadata, independent of the implementation of the @component decorator:
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:
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.