Content-Length: 331713 | pFad | https://github.com/angular/angular/pull/60555

BC fix(compiler-cli): support relative imports to symbols outside `rootDir` by devversion · Pull Request #60555 · angular/angular · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-cli): support relative imports to symbols outside rootDir #60555

Closed
wants to merge 1 commit into from

Conversation

devversion
Copy link
Member

By default, the compiler-cli uses the relative import strategy when there is no rootDir or rootDirs. This is expected as everything is assumed to be somehow reachable through relative imports.

With rootDirs that allow for a "virtual file system"-like environment, the compiler is not necessarily able to always construct proper relative imports. The compiler includes the LogicalProjectStrategy for this reason. This strategy is able to respect rootDirs to construct relative paths when possible.

This logic currently accidentally triggers when there is a rootDir set. This option is not to be confused with the virtual directory option called rootDirs. The compiler currently confuses this and accidentally enters this mode when there is just a rootDir— breaking in monorepos that imports can point outside the rootDir to e.g. other compilation unit's .d.ts (which is valid; just not .ts sources can live outside the root dir).

This is necessary for our Bazel toolchain migration.

By default, the compiler-cli uses the relative import strategy when
there is no `rootDir` or `rootDirs`. This is expected as everything is
assumed to be somehow reachable through relative imports.

With `rootDirs` that allow for a "virtual file system"-like environment,
the compiler is not necessarily able to always construct proper relative
imports. The compiler includes the `LogicalProjectStrategy` for this
reason. This strategy is able to respect `rootDirs` to construct
relative paths when possible.

This logic currently accidentally triggers when there is a `rootDir`
set. This option is not to be confused with the virtual directory
option called `rootDirs`. The compiler currently confuses this and
accidentally enters this mode when there is just a `rootDir`— breaking
in monorepos that imports can point outside the `rootDir` to e.g. other
compilation unit's `.d.ts` (which is valid; just not `.ts` sources can
live outside the root dir).

This is necessary for our Bazel toolchain migration.
@devversion devversion added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Mar 25, 2025
@devversion devversion requested review from alxhub and crisbeto March 25, 2025 18:33
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Mar 25, 2025
@ngbot ngbot bot added this to the Backlog milestone Mar 25, 2025
@devversion devversion removed the request for review from crisbeto March 25, 2025 19:42
@devversion devversion added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 25, 2025
@ngbot

This comment was marked as outdated.

@devversion devversion added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 26, 2025
@devversion
Copy link
Member Author

devversion commented Mar 26, 2025

Caretaker note: PR is green; it just seems to be stuck with the mergeability status

@alxhub
Copy link
Member

alxhub commented Mar 27, 2025

This PR was merged into the repository by commit 9f18c7c.

The changes were merged into the following branches: main, 19.2.x

@alxhub alxhub closed this in 9f18c7c Mar 27, 2025
alxhub pushed a commit that referenced this pull request Mar 27, 2025
…ir` (#60555)

By default, the compiler-cli uses the relative import strategy when
there is no `rootDir` or `rootDirs`. This is expected as everything is
assumed to be somehow reachable through relative imports.

With `rootDirs` that allow for a "virtual file system"-like environment,
the compiler is not necessarily able to always construct proper relative
imports. The compiler includes the `LogicalProjectStrategy` for this
reason. This strategy is able to respect `rootDirs` to construct
relative paths when possible.

This logic currently accidentally triggers when there is a `rootDir`
set. This option is not to be confused with the virtual directory
option called `rootDirs`. The compiler currently confuses this and
accidentally enters this mode when there is just a `rootDir`— breaking
in monorepos that imports can point outside the `rootDir` to e.g. other
compilation unit's `.d.ts` (which is valid; just not `.ts` sources can
live outside the root dir).

This is necessary for our Bazel toolchain migration.

PR Close #60555
mattrberry pushed a commit to mattrberry/angular that referenced this pull request Mar 28, 2025
…ir` (angular#60555)

By default, the compiler-cli uses the relative import strategy when
there is no `rootDir` or `rootDirs`. This is expected as everything is
assumed to be somehow reachable through relative imports.

With `rootDirs` that allow for a "virtual file system"-like environment,
the compiler is not necessarily able to always construct proper relative
imports. The compiler includes the `LogicalProjectStrategy` for this
reason. This strategy is able to respect `rootDirs` to construct
relative paths when possible.

This logic currently accidentally triggers when there is a `rootDir`
set. This option is not to be confused with the virtual directory
option called `rootDirs`. The compiler currently confuses this and
accidentally enters this mode when there is just a `rootDir`— breaking
in monorepos that imports can point outside the `rootDir` to e.g. other
compilation unit's `.d.ts` (which is valid; just not `.ts` sources can
live outside the root dir).

This is necessary for our Bazel toolchain migration.

PR Close angular#60555
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 7, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto added a commit to angular/components that referenced this pull request Apr 7, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
mistrykaran91 pushed a commit to mistrykaran91/components that referenced this pull request Apr 8, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/angular/angular/pull/60555

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy