angular-cn/packages/compiler-cli/ngcc/src
George Kalpakas 6ab43d7335 fix(ngcc): correctly detect external files from nested `node_modules/` (#36559)
Previously, when we needed to detect whether a file is external to a
package, we only checked whether the relative path to the file from the
package's root started with `..`. This would detect external imports
when the packages were siblings (e.g. peer dependencies or hoisted to
the top of `node_modules/` by the package manager), but would fail to
detect imports from packages located in nested `node_modules/` as
external. For example, importing `node_modules/foo/node_modules/bar`
from a file in `node_modules/foo/` would be considered internal to the
`foo` package.

This could result in processing/analyzing more files than necessary.
More importantly it could lead to errors due to trying to analyze
non-Angular packages that were direct dependencies of Angular packages.

This commit fixes it by also verifying that the relative path to a file
does not start with `node_modules/`.

Jira issue: [FW-2068](https://angular-team.atlassian.net/browse/FW-2068)

Fixes #36526

PR Close #36559
2020-04-10 09:10:26 -07:00
..
analysis fix(ngcc): correctly detect external files from nested `node_modules/` (#36559) 2020-04-10 09:10:26 -07:00
dependencies perf(ngcc): read dependencies from entry-point manifest (#36486) 2020-04-09 11:33:28 -07:00
entry_point_finder perf(ngcc): read dependencies from entry-point manifest (#36486) 2020-04-09 11:33:28 -07:00
execution style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
host fix(compiler): handle type references to namespaced symbols correctly (#36106) 2020-04-09 11:32:21 -07:00
locking style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
logging style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
migrations style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
packages perf(ngcc): reduce the size of the entry-point manifest file (#36486) 2020-04-09 11:33:28 -07:00
rendering fix(ngcc): don't crash on cyclic source-map references (#36452) 2020-04-06 13:19:53 -07:00
sourcemaps fix(ngcc): don't crash on cyclic source-map references (#36452) 2020-04-06 13:19:53 -07:00
writing style(ngcc): reformat of ngcc after clang update (#36447) 2020-04-06 09:26:57 -07:00
constants.ts refactor(ivy): move ngcc into a higher level folder (#29092) 2019-03-20 14:45:54 -04:00
main.ts perf(ngcc): only load if it is needed (#36486) 2020-04-09 11:33:28 -07:00
utils.ts fix(ngcc): correctly identify relative Windows-style import paths (#36372) 2020-04-07 15:21:27 -07:00