angular-cn/packages/compiler-cli/ngcc/test
Pete Bacon Darwin fac20bd8d1 fix(ivy): ngcc - resolve `main` property paths correctly (#31509)
There are two places in the ngcc processing where it needs to load the
content of a file given by a general path:

* when determining the format of an entry-point.
 To do this ngcc uses the value of the relevant property in package.json.
 But in the case of `main` it must parse the contents of the entry-point
 file to decide whether the format is UMD or CommonJS.

* when parsing the source files for dependencies to determine the order in
which compilation must occur. The relative imports in each file are parsed
and followed recursively, looking for external imports.

Previously, we naively assumed that the path would match the file name exactly.
But actually we must consider the standard module resolution conventions.
E.g. the extension (.js) may be missing, or the path may refer to a directory
containing an index.js file.

This commit fixes both places.

This commit now requires the `DependencyHost` instances to check
the existence of more files than before (at worst all the different possible
post-fixes). This should not create a significant performance reduction for
ngcc. Since the results of the checks will be cached, and similar work is
done inside the TS compiler, so what we lose in doing it here, is saved later
in the processing. The main performance loss would be where there are lots
of files that need to be parsed for dependencies that do not end up being
processed by TS. But compared to the main ngcc processing this dependency
parsing is a small proportion of the work done and so should not impact
much on the overall performance of ngcc.

// FW-1444

PR Close #31509
2019-07-12 11:37:35 -04:00
..
analysis fix(ivy): ngcc - do not analyze files outside the current package (#30591) 2019-06-26 08:00:03 -07:00
dependencies fix(ivy): ngcc - resolve `main` property paths correctly (#31509) 2019-07-12 11:37:35 -04:00
entry_point_finder fix(ivy): ngcc - handle pathMappings to files rather then directories (#30525) 2019-07-09 09:40:46 -07:00
helpers fix(ivy): ngcc - do not analyze files outside the current package (#30591) 2019-06-26 08:00:03 -07:00
host fix(ivy): handle namespaced imports correctly (#31367) 2019-07-09 09:40:30 -07:00
integration feat(ivy): customize ngcc via configuration files (#30591) 2019-06-26 08:00:02 -07:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
packages fix(ivy): ngcc - resolve `main` property paths correctly (#31509) 2019-07-12 11:37:35 -04:00
rendering fix(ivy): ngcc - do not analyze files outside the current package (#30591) 2019-06-26 08:00:03 -07:00
writing refactor(ivy): ngcc - pass whole entry-point object to `makeEntryPointBundle()` (#30591) 2019-06-26 08:00:03 -07:00
BUILD.bazel refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
utils_spec.ts refactor(ivy): ngcc - implement new module resolver (#29643) 2019-04-29 12:37:21 -07:00