angular-cn/packages/compiler-cli
Keen Yee Liau a62416c6e4 fix(language-service): include compilerOptions.rootDir in rootDirs (#40243)
When resolving references, the Ivy compiler has a few strategies it could use.

For relative path, one of strategies is [`RelativePathStrategy`](
https://github.com/angular/angular/blob/master/packages/compiler-cli/src/
ngtsc/imports/README.md#relativepathstrategy). This strategy
relies on `compilerOptions.rootDir` and `compilerOptions.rootDirs` to perform
the resolution, but language service only passes `rootDirs` to the compiler,
and not `rootDir`.

In reality, `rootDir` is very different from `rootDirs` even though they
sound the same.
According to the official [TS documentation][1],
> `rootDir` specifies the root directory of input files. Only use to control
> the output directory structure with --outDir.

> `rootDirs` is a list of root folders whose combined content represent the
> structure of the project at runtime. See [Module Resolution documentation](
> https://www.typescriptlang.org/docs/handbook/
> module-resolution.html#virtual-directories-with-rootdirs)
> for more details.

For now, we keep the behavior between compiler and language service consistent,
but we will revisit the notion of `rootDir` and how it is used later.

Fix angular/vscode-ng-language-service#1039

[1]: https://www.typescriptlang.org/docs/handbook/compiler-options.html

PR Close #40243
2021-01-06 10:54:11 -08:00
..
integrationtest refactor(core): add top 10 runtime error codes (#39188) 2020-10-28 10:05:01 -07:00
linker feat(compiler-cli): JIT compilation of component declarations (#40127) 2021-01-06 08:28:03 -08:00
ngcc fix(compiler-cli): ngcc - remove outdated link (#40285) 2021-01-06 07:10:39 -08:00
src fix(language-service): include compilerOptions.rootDir in rootDirs (#40243) 2021-01-06 10:54:11 -08:00
test refactor(core): express trusted constants with tagged template literals (#40082) 2021-01-05 13:56:57 -08:00
BUILD.bazel refactor(compiler-cli): include linker entry-points in NPM package (#40180) 2020-12-22 11:48:11 -08:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -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