feat(ivy): add ngcc ivy switch (#25238)

Provides a runtime and compile time switch for ivy including
`ApplicationRef.bootstrapModule`.

This is done by naming the symbols such that `ngcc` (angular
Compatibility compiler) can rename symbols in such a way that running
`ngcc` command will switch the `@angular/core` module from `legacy` to
`ivy` mode.

This is done as follows:

```
const someToken__PRE_NGCC__ = ‘legacy mode’;
const someToken__POST_NGCC__ = ‘ivy mode’;

export someSymbol = someToken__PRE_NGCC__;
```

The `ngcc` will search for any token which ends with `__PRE_NGCC__`
and replace it with `__POST_NGCC__`. This allows the `@angular/core`
package to be rewritten to ivy mode post `ngcc` execution.

PR Close #25238
This commit is contained in:
Misko Hevery
2018-07-30 22:34:15 -07:00
committed by Jason Aden
parent cc55d609ce
commit 503905c807
23 changed files with 298 additions and 201 deletions

View File

@ -38,7 +38,9 @@ const MISSING_FROM_CHROME: {[el: string]: string[]} = {
':svg:cursor^:svg:': [],
};
const _G: any = global;
const _G: any = typeof window != 'undefined' && window || typeof global != 'undefined' && global ||
typeof self != 'undefined' && self;
const document: any = typeof _G['document'] == 'object' ? _G['document'] : null;
export function extractSchema(): Map<string, string[]>|null {