-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Check nearest package.json dependencies for possible package names for specifier candidates #58176
Merged
weswigham
merged 17 commits into
microsoft:main
from
weswigham:check-package-json-for-possible-package-names
Apr 19, 2024
+1,016
−6
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dec76ff
Check nearest package.json dependencies for possible package names fo…
weswigham 8f557b4
Format
weswigham a1519a5
New strategy, do extra resolution up-front to precache resolutions, h…
weswigham 0f5448e
Format
weswigham 7e31b6c
Merge branch 'main' into check-package-json-for-possible-package-names
weswigham d725511
Update baselines post-merge
weswigham 5ef7eb3
Limit precache to resolutions for files not in node_modules
weswigham ae1e324
Use package json dir as preferred cache dir
weswigham 5110a5c
Dont precache workspace deps from above the project root
weswigham 310409a
Revert last two changes for want of real perf improvements
weswigham f3e2aca
Fusion of previous two methods
weswigham 682167f
Remove unneeded cache check, also lookup peer deps
weswigham 3539ee0
Also support optional deps, add tests for peer + optional
weswigham df3c0f1
Pass down compilerOptions and mode override requests (which should in…
weswigham 91dfc93
Add watch mode test, forward trace from program to emit host
weswigham 9e67ccf
Merge branch 'main' into check-package-json-for-possible-package-names
weswigham 6cf5b2f
Format
weswigham 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 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
39 changes: 39 additions & 0 deletions
39
...baselines/reference/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.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,39 @@ | ||
//// [tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts] //// | ||
|
||
//// [index.d.ts] | ||
export declare class Foo { | ||
private f: any; | ||
} | ||
//// [package.json] | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"package-a": "file:../packageA" | ||
} | ||
} | ||
//// [index.d.ts] | ||
import { Foo } from "package-a"; | ||
export declare function invoke(): Foo; | ||
//// [package.json] | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"package-b": "file:../packageB", | ||
"package-a": "file:../packageA" | ||
} | ||
} | ||
//// [index.ts] | ||
import * as pkg from "package-b"; | ||
|
||
export const a = pkg.invoke(); | ||
|
||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.a = void 0; | ||
var pkg = require("package-b"); | ||
exports.a = pkg.invoke(); | ||
|
||
|
||
//// [index.d.ts] | ||
export declare const a: import("package-a").Foo; |
27 changes: 27 additions & 0 deletions
27
...ines/reference/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.symbols
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,27 @@ | ||
//// [tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts] //// | ||
|
||
=== workspace/packageA/index.d.ts === | ||
export declare class Foo { | ||
>Foo : Symbol(Foo, Decl(index.d.ts, 0, 0)) | ||
|
||
private f: any; | ||
>f : Symbol(Foo.f, Decl(index.d.ts, 0, 26)) | ||
} | ||
=== workspace/packageB/index.d.ts === | ||
import { Foo } from "package-a"; | ||
>Foo : Symbol(Foo, Decl(index.d.ts, 0, 8)) | ||
|
||
export declare function invoke(): Foo; | ||
>invoke : Symbol(invoke, Decl(index.d.ts, 0, 32)) | ||
>Foo : Symbol(Foo, Decl(index.d.ts, 0, 8)) | ||
|
||
=== workspace/packageC/index.ts === | ||
import * as pkg from "package-b"; | ||
>pkg : Symbol(pkg, Decl(index.ts, 0, 6)) | ||
|
||
export const a = pkg.invoke(); | ||
>a : Symbol(a, Decl(index.ts, 2, 12)) | ||
>pkg.invoke : Symbol(pkg.invoke, Decl(index.d.ts, 0, 32)) | ||
>pkg : Symbol(pkg, Decl(index.ts, 0, 6)) | ||
>invoke : Symbol(pkg.invoke, Decl(index.d.ts, 0, 32)) | ||
|
36 changes: 36 additions & 0 deletions
36
...elines/reference/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.types
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,36 @@ | ||
//// [tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts] //// | ||
|
||
=== workspace/packageA/index.d.ts === | ||
export declare class Foo { | ||
>Foo : Foo | ||
> : ^^^ | ||
|
||
private f: any; | ||
>f : any | ||
} | ||
=== workspace/packageB/index.d.ts === | ||
import { Foo } from "package-a"; | ||
>Foo : typeof Foo | ||
> : ^^^^^^^^^^ | ||
|
||
export declare function invoke(): Foo; | ||
>invoke : () => Foo | ||
> : ^^^^^^ | ||
|
||
=== workspace/packageC/index.ts === | ||
import * as pkg from "package-b"; | ||
>pkg : typeof pkg | ||
> : ^^^^^^^^^^ | ||
|
||
export const a = pkg.invoke(); | ||
>a : import("workspace/packageA/index").Foo | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>pkg.invoke() : import("workspace/packageA/index").Foo | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>pkg.invoke : () => import("workspace/packageA/index").Foo | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>pkg : typeof pkg | ||
> : ^^^^^^^^^^ | ||
>invoke : () => import("workspace/packageA/index").Foo | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
30 changes: 30 additions & 0 deletions
30
tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts
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 @@ | ||
// @declaration: true | ||
// @filename: workspace/packageA/index.d.ts | ||
export declare class Foo { | ||
private f: any; | ||
} | ||
// @filename: workspace/packageB/package.json | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"package-a": "file:../packageA" | ||
} | ||
} | ||
// @filename: workspace/packageB/index.d.ts | ||
import { Foo } from "package-a"; | ||
export declare function invoke(): Foo; | ||
// @filename: workspace/packageC/package.json | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"package-b": "file:../packageB", | ||
"package-a": "file:../packageA" | ||
} | ||
} | ||
// @filename: workspace/packageC/index.ts | ||
import * as pkg from "package-b"; | ||
|
||
export const a = pkg.invoke(); | ||
// @link: workspace/packageA -> workspace/packageC/node_modules/package-a | ||
// @link: workspace/packageA -> workspace/packageB/node_modules/package-a | ||
// @link: workspace/packageB -> workspace/packageC/node_modules/package-b |
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 didn't want to have to
realpath
here, but it seems to be the only way we can check if the two paths actually refer to the same thing through symlinks.