angular-cn/packages/compiler-cli/ngcc/test
Pete Bacon Darwin 61e8ed6623 fix(ngcc): ensure that bundle `rootDir` is the package path (#34212)
Previously the `rootDir` was set to the entry-point path but
this is incorrect if the source files are stored in a directory outside
the entry-point path. This is the case in the latest versions of the
Angular CDK.

Instead the `rootDir` should be the containing package path, which is
guaranteed to include all the source for the entry-point.

---

A symptom of this is an error when ngcc is trying to process the source of
an entry-point format after the entry-point's typings have already been
processed by a previous processing run.

During processing the `_toR3Reference()` function gets called which in turn
makes a call to `ReflectionHost.getDtsDeclaration()`. If the typings files
are also being processed this returns the node from the dts typings files.

But if we have already processed the typings files and are now processing
only an entry-point format without typings, the call to
`ReflectionHost.getDtsDeclaration()` returns `null`.

When this value is `null`, a JS `valueRef` is passed through as the DTS
`typeRef` to the `ReferenceEmitter`. In this case, the `ReferenceEmitter`
fails during `emit()` because no `ReferenceEmitStrategy` is able to provide
an emission:

1) The `LocalIdentifierStrategy` is not able help because in this case
`ImportMode` is `ForceNewImport`.
2) The `LogicalProjectStrategy` cannot find the JS file below the `rootDir`.

The second strategy failure is fixed by this PR.

Fixes https://github.com/angular/ngcc-validation/issues/495

PR Close #34212
2019-12-05 10:13:02 -08:00
..
analysis fix(ngcc): report errors from `analyze` and `resolve` processing (#33964) 2019-11-21 10:44:24 -08:00
dependencies feat(ngcc): support ignoreMissingDependencies in ngcc config (#33192) 2019-10-17 19:43:39 -04: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 perf(ngcc): process tasks in parallel in async mode (#32427) 2019-09-09 15:55:13 -04:00
helpers refactor(ngcc): store whether to render legacy i18n message ids in the bundle (#34135) 2019-12-03 10:15:53 -08:00
host fix(ngcc): properly detect origin of constructor param types (#33901) 2019-11-19 11:38:33 -08:00
integration fix(ngcc): render legacy i18n message ids by default (#34135) 2019-12-03 10:15:53 -08:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
migrations refactor(ngcc): rework undecorated parent migration (#33362) 2019-10-25 09:16:50 -07:00
packages fix(ngcc): ensure that bundle `rootDir` is the package path (#34212) 2019-12-05 10:13:02 -08:00
rendering fix(ngcc): render UMD global imports correctly (#34012) 2019-11-25 11:38:36 -05:00
writing refactor(ngcc): abstract updating `package.json` files behind an interface (#32427) 2019-09-09 15:55:13 -04:00
BUILD.bazel fix(ngcc): do not emit ES2015 code in ES5 files (#33514) 2019-11-13 13:49:31 -08:00
utils_spec.ts refactor(ivy): ngcc - implement new module resolver (#29643) 2019-04-29 12:37:21 -07:00