angular/packages/compiler-cli/ngcc/src
Paul Gschwendtner 4eeb6cf24d fix(ngcc): libraries using spread in object literals cannot be processed (#34661)
Consider a library that uses a shared constant for host bindings. e.g.

```ts
export const BASE_BINDINGS= {
  '[class.mat-themed]': '_isThemed',
}

----

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir1 {}

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir2 {}
```

Previously when these components were shipped as part of the
library to NPM, consumers were able to consume `Dir1` and `Dir2`.
No errors showed up.

Now with Ivy, when ngcc tries to process the library, an error
will be thrown. The error is stating that the host bindings should
be an object (which they obviously are). This happens because
TypeScript transforms the object spread to individual
`Object.assign` calls (for compatibility).

The partial evaluator used by the `@Directive` annotation handler
is unable to process this expression because there is no
integrated support for `Object.assign`. In View Engine, this was
not a problem because the `metadata.json` files from the library
were used to compute the host bindings.

Fixes #34659

PR Close #34661
2020-01-23 10:29:58 -08:00
..
analysis fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:58 -08:00
dependencies fix(ngcc): do not add DTS deep imports to missing packages list (#34695) 2020-01-15 10:24:50 -08:00
entry_point_finder fix(ngcc): do not analyze dependencies for non Angular entry-points (#32303) 2019-08-26 10:08:44 -07:00
execution fix(ngcc): update package.json deterministically (#34870) 2020-01-23 10:16:36 -08:00
host fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:58 -08:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
migrations fix(ngcc): fix undecorated child migration when exportAs is present (#34014) 2019-12-09 16:13:10 -08:00
packages fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:58 -08:00
rendering fix(ngcc): insert definitions after statement (#34677) 2020-01-08 15:09:25 -08:00
writing fix(ngcc): update package.json deterministically (#34870) 2020-01-23 10:16:36 -08:00
constants.ts refactor(ivy): move ngcc into a higher level folder (#29092) 2019-03-20 14:45:54 -04:00
main.ts fix(ngcc): only lock ngcc after targeted entry-point check (#34722) 2020-01-22 15:35:35 -08:00
utils.ts fix(ngcc): avoid error due to circular dependency in EsmDependencyHost (#34512) 2020-01-08 15:00:51 -08:00