angular-cn/packages/compiler-cli/ngcc/test/host
George Kalpakas 5fa7b8ba56 fix(ngcc): detect non-emitted, non-imported TypeScript helpers (#36418)
When TypeScript downlevels ES2015+ code to ES5, it uses some helper
functions to emulate some ES2015+ features, such as spread syntax. The
TypeScript compiler can be configured to emit these helpers into the
transpiled code (which is controlled by the `noEmitHelpers` option -
false by default). It can also be configured to import these helpers
from the `tslib` module (which is controlled by the `importHelpers`
option - false by default).

While most of the time the helpers will be either emitted or imported,
it is possible that one configures their app to neither emit nor import
them. In that case, the helpers could, for example, be made available on
the global object. This is what `@nativescript/angular`
v9.0.0-next-2019-11-12-155500-01 does. See, for example, [common.js][1].

Ngcc must be able to detect and statically evaluate these helpers.
Previously, it was only able to detect emitted or imported helpers.

This commit adds support for detecting these helpers if they are neither
emitted nor imported. It does this by checking identifiers for which no
declaration (either concrete or inline) can be found against a list of
known TypeScript helper function names.

[1]: https://unpkg.com/browse/@nativescript/angular@9.0.0-next-2019-11-12-155500-01/common.js

PR Close #36418
2020-04-07 10:19:22 -07:00
..
commonjs_host_import_helper_spec.ts style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
commonjs_host_spec.ts fix(ngcc): detect non-emitted, non-imported TypeScript helpers (#36418) 2020-04-07 10:19:22 -07:00
esm5_host_import_helper_spec.ts style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
esm5_host_spec.ts fix(ngcc): detect non-emitted, non-imported TypeScript helpers (#36418) 2020-04-07 10:19:22 -07:00
esm2015_host_import_helper_spec.ts style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
esm2015_host_spec.ts test(ngcc): use `DelegatingReflectionHost` for testing `NgccReflectionHost`s (#36284) 2020-04-03 11:08:46 -07:00
umd_host_import_helper_spec.ts style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
umd_host_spec.ts fix(ngcc): detect non-emitted, non-imported TypeScript helpers (#36418) 2020-04-07 10:19:22 -07:00
util.ts style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00