-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: use oxc-resolver hot fix for symlinks #9302
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bf14221
Using a diff dependency
NicholasLYang 5695cdc
Switched to a git dependency of my fork. Also added a fallback tsconf…
NicholasLYang 07777f1
Added test
NicholasLYang 0f263a6
Remove unnecessary file
NicholasLYang 180aff6
Fix test
NicholasLYang 92d18d7
Ugh windows
NicholasLYang adf8fad
Switch to oxc 2.0
NicholasLYang 7694661
Setting up turborepo-lib tests
NicholasLYang ea3300b
Fixing up tests
NicholasLYang 7341ae0
Remove double symlink integration test
NicholasLYang 1dab4e8
move tests to turborepo crate
NicholasLYang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
/node_modules | ||
.turbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# oxc symlink bug reproduction | ||
|
||
The bug occurs when a symlink is nested inside a directory that is also symlinked. | ||
This occurs with pnpm since it recreates a conventional node_modules structure using | ||
a content addressed store and symlinks. | ||
|
||
Here's the setup: | ||
|
||
- `apps/web/nm/@repo/typescript-config` is a symlink pointing to `tooling/typescript-config` (imagine `typescript-config` is a workspace package and symlinked into `apps/web`'s node modules) | ||
- `tooling/typescript-config/index.js` is a _relative_ symlink pointing to `../../nm/index.js` | ||
- Therefore, `apps/web/nm/@repo/typescript-config/index.js` is resolved as: | ||
|
||
``` | ||
apps/web/nm/@repo/typescript-config/index.js | ||
-> tooling/typescript-config/index.js | ||
-> tooling/typescript-config/../../nm/index.js | ||
-> nm/index.js | ||
``` | ||
|
||
However, when oxc resolves this, it does not do the first resolution, so we get: | ||
|
||
``` | ||
apps/web/nm/@repo/typescript-config/index.js | ||
-> apps/web/nm/@repo/typescript-config/../../nm/index.js | ||
-> apps/web/nm/nm/index.js | ||
``` | ||
|
||
You can validate this by running `node main.mjs`, which attempts to resolve | ||
both `apps/web/nm/@repo/typescript-config/index.js` and `apps/web/nm/@repo/index.js`. | ||
The first fails while the second succeeds. |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/oxc_repro/apps/web/nm/@repo/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo = "10"; |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/oxc_repro/apps/web/nm/@repo/typescript-config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../tooling/typescript-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import foo from "./apps/web/nm/@repo/typescript-config/index.js"; |
Empty file.
14 changes: 14 additions & 0 deletions
14
turborepo-tests/integration/fixtures/oxc_repro/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "oxc-repro", | ||
"version": "1.0.0", | ||
"description": "", | ||
"workspaces": ["c"], | ||
"packageManager": "npm@10.5.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": {} | ||
} |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/oxc_repro/tooling/typescript-config/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../nm/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../helpers/setup_integration_test.sh oxc_repro | ||
|
||
$ ${TURBO} query "query { file(path: \"./index.js\") { path dependencies { files { items { path } } errors { items { message import } } } } }" | ||
WARNING query command is experimental and may change in the future | ||
{ | ||
"data": { | ||
"file": { | ||
"path": "index.js", | ||
"dependencies": { | ||
"files": { | ||
"items": [ | ||
{ | ||
"path": "nm/index.js" | ||
} | ||
] | ||
}, | ||
"errors": { | ||
"items": [] | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a behavior change where we now respect
tsconfig
? Maybe update PR description to include functionality this gains us? (I'm curious and want to know, but can't grok it from this PR)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah tsconfig is necessary for doing prefix resolution, i.e.
@/components/ui
. tsconfig loading is what's broken in oxc-resolver