-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Inspect all possible module paths when looking for the best one to create a specifier with #25850
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//// [tests/cases/compiler/symbolLinkDeclarationEmitModuleNamesImportRef.ts] //// | ||
|
||
//// [index.d.ts] | ||
export declare const styles: import("styled-components").InterpolationValue[]; | ||
|
||
//// [package.json] | ||
{ | ||
"name": "styled-components", | ||
"version": "3.3.3", | ||
"typings": "typings/styled-components.d.ts" | ||
} | ||
|
||
//// [styled-components.d.ts] | ||
export interface InterpolationValue {} | ||
//// [index.ts] | ||
import { styles } from "package-a"; | ||
|
||
export function getStyles() { | ||
return styles; | ||
} | ||
|
||
|
||
//// [index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var package_a_1 = require("package-a"); | ||
function getStyles() { | ||
return package_a_1.styles; | ||
} | ||
exports.getStyles = getStyles; | ||
|
||
|
||
//// [index.d.ts] | ||
export declare function getStyles(): import("styled-components").InterpolationValue[]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== tests/cases/compiler/Folder/monorepo/core/index.ts === | ||
import { styles } from "package-a"; | ||
>styles : Symbol(styles, Decl(index.ts, 0, 8)) | ||
|
||
export function getStyles() { | ||
>getStyles : Symbol(getStyles, Decl(index.ts, 0, 35)) | ||
|
||
return styles; | ||
>styles : Symbol(styles, Decl(index.ts, 0, 8)) | ||
} | ||
|
||
=== tests/cases/compiler/Folder/monorepo/package-a/index.d.ts === | ||
export declare const styles: import("styled-components").InterpolationValue[]; | ||
>styles : Symbol(styles, Decl(index.d.ts, 0, 20)) | ||
>InterpolationValue : Symbol(InterpolationValue, Decl(styled-components.d.ts, 0, 0)) | ||
|
||
=== tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components.d.ts === | ||
export interface InterpolationValue {} | ||
>InterpolationValue : Symbol(InterpolationValue, Decl(styled-components.d.ts, 0, 0)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== tests/cases/compiler/Folder/monorepo/core/index.ts === | ||
import { styles } from "package-a"; | ||
>styles : import("tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components").InterpolationValue[] | ||
|
||
export function getStyles() { | ||
>getStyles : () => import("tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components").InterpolationValue[] | ||
|
||
return styles; | ||
>styles : import("tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components").InterpolationValue[] | ||
} | ||
|
||
=== tests/cases/compiler/Folder/monorepo/package-a/index.d.ts === | ||
export declare const styles: import("styled-components").InterpolationValue[]; | ||
>styles : import("tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components").InterpolationValue[] | ||
>InterpolationValue : import("tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components").InterpolationValue | ||
|
||
=== tests/cases/compiler/Folder/node_modules/styled-components/typings/styled-components.d.ts === | ||
export interface InterpolationValue {} | ||
>InterpolationValue : InterpolationValue | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @declaration: true | ||
// @useCaseSensitiveFileNames: false | ||
// @noImplicitReferences: true | ||
// @filename: Folder/monorepo/package-a/index.d.ts | ||
export declare const styles: import("styled-components").InterpolationValue[]; | ||
|
||
// @filename: Folder/node_modules/styled-components/package.json | ||
{ | ||
"name": "styled-components", | ||
"version": "3.3.3", | ||
"typings": "typings/styled-components.d.ts" | ||
} | ||
|
||
// @filename: Folder/node_modules/styled-components/typings/styled-components.d.ts | ||
export interface InterpolationValue {} | ||
// @filename: Folder/monorepo/core/index.ts | ||
import { styles } from "package-a"; | ||
|
||
export function getStyles() { | ||
return styles; | ||
} | ||
|
||
// @link: tests/cases/compiler/Folder/node_modules/styled-components -> tests/cases/compiler/Folder/monorepo/package-a/node_modules/styled-components | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like some tests use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// @link: tests/cases/compiler/Folder/monorepo/package-a -> tests/cases/compiler/Folder/monorepo/core/node_modules/package-a |
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'm not sure I follow all the logic here, but there may be some duplicated effort. A few lines above this we get symlinks, then in
discoverProbableSymlinks
there is some nearly identical (copy-pasted?) code to do the same thing.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.
As far as I know, it's not duplicated at all. Here we find files whose realpath differed from their actual path, provided those files refer to the imported file. In
discoverProbableSymlinks
, we crawl all files looking for common parts among all files with symlinks to find probable directory junction links. If I remember correctly, anyway.