angular/packages/compiler-cli/ngcc/test/packages
JoostK b66e479cdb fix(ngcc): support element accesses for export declarations (#44669)
Bundlers like Rollup may use an element access expression for an export
declaration, which causes ngcc to ignore those export declarations possibly
resulting in incomplete processing of packages.

Element access syntax may be used when the declared name is not considered
as valid JS identifier, but bundlers may be conservative in determining whether
an identifier can be used (to emit a property access) and opt for a string
literal in an element access instead.

The element access syntax introduces a problem for ngcc, where it wouldn't
consider such export as class declaration, causing them to be skipped. The
ngtsc compiler is implemented with the assumption that all class declarations
use a `ts.Identifier` as name, whereas the element access is using a string
literal for the declared name. This makes it troublesome for ngcc to support
this syntax form in UMD bundles.

To work around the problem, this function transforms these access expressions
into regular property accesses. The source text is parsed to an AST to allow
finding the element accesses in a robust way, after which the affected text
ranges are replaced with property accesses in the original source text.

Closes #44037

PR Close #44669
2022-01-14 17:43:59 -08:00
..
adjust_cjs_exports_spec.ts fix(ngcc): support element accesses for export declarations (#44669) 2022-01-14 17:43:59 -08:00
build_marker_spec.ts fix(compiler-cli): update type castings for JSON.parse usage (#40710) 2021-02-09 10:48:43 -08:00
configuration_spec.ts fix(ngcc): do not fail for packages which correspond with Object members (#43589) 2021-09-27 14:21:53 -07:00
entry_point_bundle_spec.ts refactor(ngcc): improve logging of progress (#43996) 2021-11-09 18:10:18 +00:00
entry_point_manifest_spec.ts refactor(ngcc): improve logging of progress (#43996) 2021-11-09 18:10:18 +00:00
entry_point_spec.ts refactor(ngcc): make it easy to support more UMD wrapper function formats (#44245) 2021-11-29 12:38:05 -05:00
source_file_cache_spec.ts fix(ngcc): support element accesses for export declarations (#44669) 2022-01-14 17:43:59 -08:00