-
Notifications
You must be signed in to change notification settings - Fork 783
Add "package deduplication", --disablePackageDeduplication #2361
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
Open
jakebailey
wants to merge
29
commits into
main
Choose a base branch
from
jabaile/package-deduping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,090
−695
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
9b349c1
Fix resolver misport
jakebailey dc9841e
Update baselines
jakebailey d81c18e
Implement package deduping kinda
jakebailey 358bd71
Update duplicate package test, sort of intentional behavior
jakebailey ed7017c
equality
jakebailey f98b377
rename
jakebailey ac7cfc5
better comparison
jakebailey 43f6e08
Fix paths
jakebailey b99c0ff
Cleanup
jakebailey e25f2bc
Cleanup
jakebailey 044eee2
Manual test
jakebailey d47b3a7
files are not nil
jakebailey d7e8232
Go to AST replacing version
jakebailey af6f313
fmt
jakebailey 03a3d8f
Drop unused
jakebailey 27d78af
Revert "Drop unused"
jakebailey cf0bc18
Delete files that have been deduped away
jakebailey fb1e84f
Do this during collectFiles
jakebailey 614dafd
Merge branch 'main' into jabaile/package-deduping
jakebailey cae2fba
Merge branch 'main' into jabaile/package-deduping
jakebailey 34155c9
Remove _
jakebailey 68627e3
Add test
jakebailey 2bb7300
Use correct path for module error
jakebailey b966d60
Merge branch 'main' into jabaile/package-deduping
jakebailey 9d0f1d2
Add new failing test that strada passes
jakebailey a6956ef
Do not extra load files
jakebailey 15e0d64
Rando newline
jakebailey 8cbc494
Greatly simplify
jakebailey 2744db9
Further simplifications
jakebailey 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
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
68 changes: 68 additions & 0 deletions
68
internal/fourslash/tests/manual/duplicatePackageServices_fileChanges_test.go
This file contains hidden or 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,68 @@ | ||
| package fourslash_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/microsoft/typescript-go/internal/fourslash" | ||
| "github.com/microsoft/typescript-go/internal/testutil" | ||
| ) | ||
|
|
||
| func TestDuplicatePackageServices_fileChanges(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| defer testutil.RecoverAndFail(t, "Panic on fourslash test") | ||
| const content = `// @noImplicitReferences: true | ||
| // @Filename: /node_modules/a/index.d.ts | ||
| import X from "x"; | ||
| export function a(x: X): void; | ||
| // @Filename: /node_modules/a/node_modules/x/index.d.ts | ||
| export default class /*defAX*/X { | ||
| private x: number; | ||
| } | ||
| // @Filename: /node_modules/a/node_modules/x/package.json | ||
| { "name": "x", "version": "1.2./*aVersionPatch*/3" } | ||
| // @Filename: /node_modules/b/index.d.ts | ||
| import X from "x"; | ||
| export const b: X; | ||
| // @Filename: /node_modules/b/node_modules/x/index.d.ts | ||
| export default class /*defBX*/X { | ||
| private x: number; | ||
| } | ||
| // @Filename: /node_modules/b/node_modules/x/package.json | ||
| { "name": "x", "version": "1.2./*bVersionPatch*/3" } | ||
| // @Filename: /src/a.ts | ||
| import { a } from "a"; | ||
| import { b } from "b"; | ||
| a(/*error*/b);` | ||
| f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) | ||
| defer done() | ||
|
|
||
| f.GoToFile(t, "/src/a.ts") | ||
| f.VerifyNumberOfErrorsInCurrentFile(t, 0) | ||
|
|
||
| testChangeAndChangeBack := func(versionPatch string, def string) { | ||
| // Insert "4" after the version patch marker, changing version from 1.2.3 to 1.2.43 | ||
| f.GoToMarker(t, versionPatch) | ||
| f.Insert(t, "4") | ||
|
|
||
| // Insert a space after the definition marker to trigger a recheck | ||
| f.GoToMarker(t, def) | ||
| f.Insert(t, " ") | ||
|
|
||
| // No longer have identical packageId, so we get errors. | ||
| f.VerifyErrorExistsAfterMarker(t, "error") | ||
|
|
||
| // Undo the changes | ||
| f.GoToMarker(t, versionPatch) | ||
| f.DeleteAtCaret(t, 1) | ||
| f.GoToMarker(t, def) | ||
| f.DeleteAtCaret(t, 1) | ||
|
|
||
| // Back to being identical. | ||
| f.GoToFile(t, "/src/a.ts") | ||
| f.VerifyNumberOfErrorsInCurrentFile(t, 0) | ||
| } | ||
|
|
||
| testChangeAndChangeBack("aVersionPatch", "defAX") | ||
| testChangeAndChangeBack("bVersionPatch", "defBX") | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.