angular/packages/compiler-cli
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
..
integrationtest build: derive ts_library dep from jasmine_node_test boostrap label if it ends in _es5 (#34736) 2020-01-15 14:58:09 -05:00
ngcc fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:58 -08:00
src fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:58 -08:00
test revert: refactor(ivy): remove styleSanitizer instruction in favor of an inline param (#34480) (#34910) 2020-01-22 15:59:33 -05:00
BUILD.bazel build: upgrade to rules_nodejs 1.0.0 (first stable release) (#34736) 2020-01-15 14:58:08 -05:00
index.ts refactor(compiler-cli): Move diagnostics files to language service (#33809) 2019-11-14 09:29:07 -08:00
package.json feat(compiler-cli): require node 10 as runtime engine (#34722) 2020-01-22 15:35:35 -08:00
tsconfig-build.json build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
tsconfig.json perf(ivy): ngcc - only find dependencies when targeting a single entry-point (#30525) 2019-07-09 09:40:46 -07:00