mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
use CompilerHost.realpath to resolve actual location for symlinks
This commit is contained in:
37
tests/baselines/reference/moduleResolutionWithSymlinks.js
Normal file
37
tests/baselines/reference/moduleResolutionWithSymlinks.js
Normal file
@@ -0,0 +1,37 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSymlinks.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
|
||||
export class MyClass{}
|
||||
|
||||
//// [index.ts]
|
||||
import {MyClass} from "library-a";
|
||||
export { MyClass as MyClass2 }
|
||||
|
||||
//// [app.ts]
|
||||
import { MyClass } from "./library-a";
|
||||
import { MyClass2 } from "./library-b";
|
||||
|
||||
let x: MyClass;
|
||||
let y: MyClass2;
|
||||
x = y;
|
||||
y = x;
|
||||
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
var MyClass = (function () {
|
||||
function MyClass() {
|
||||
}
|
||||
return MyClass;
|
||||
}());
|
||||
exports.MyClass = MyClass;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
var library_a_1 = require("library-a");
|
||||
exports.MyClass2 = library_a_1.MyClass;
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
var x;
|
||||
var y;
|
||||
x = y;
|
||||
y = x;
|
||||
@@ -0,0 +1,36 @@
|
||||
=== /src/app.ts ===
|
||||
import { MyClass } from "./library-a";
|
||||
>MyClass : Symbol(MyClass, Decl(app.ts, 0, 8))
|
||||
|
||||
import { MyClass2 } from "./library-b";
|
||||
>MyClass2 : Symbol(MyClass2, Decl(app.ts, 1, 8))
|
||||
|
||||
let x: MyClass;
|
||||
>x : Symbol(x, Decl(app.ts, 3, 3))
|
||||
>MyClass : Symbol(MyClass, Decl(app.ts, 0, 8))
|
||||
|
||||
let y: MyClass2;
|
||||
>y : Symbol(y, Decl(app.ts, 4, 3))
|
||||
>MyClass2 : Symbol(MyClass2, Decl(app.ts, 1, 8))
|
||||
|
||||
x = y;
|
||||
>x : Symbol(x, Decl(app.ts, 3, 3))
|
||||
>y : Symbol(y, Decl(app.ts, 4, 3))
|
||||
|
||||
y = x;
|
||||
>y : Symbol(y, Decl(app.ts, 4, 3))
|
||||
>x : Symbol(x, Decl(app.ts, 3, 3))
|
||||
|
||||
=== /src/library-a/index.ts ===
|
||||
|
||||
export class MyClass{}
|
||||
>MyClass : Symbol(MyClass, Decl(index.ts, 0, 0))
|
||||
|
||||
=== /src/library-b/index.ts ===
|
||||
import {MyClass} from "library-a";
|
||||
>MyClass : Symbol(MyClass, Decl(index.ts, 0, 8))
|
||||
|
||||
export { MyClass as MyClass2 }
|
||||
>MyClass : Symbol(MyClass2, Decl(index.ts, 1, 8))
|
||||
>MyClass2 : Symbol(MyClass2, Decl(index.ts, 1, 8))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
[
|
||||
"======== Resolving module './library-a' from '/src/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/src/library-a'.",
|
||||
"File '/src/library-a.ts' does not exist.",
|
||||
"File '/src/library-a.tsx' does not exist.",
|
||||
"File '/src/library-a.d.ts' does not exist.",
|
||||
"File '/src/library-a/package.json' does not exist.",
|
||||
"File '/src/library-a/index.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/library-a/index.ts', result '/src/library-a/index.ts'",
|
||||
"======== Module name './library-a' was successfully resolved to '/src/library-a/index.ts'. ========",
|
||||
"======== Resolving module './library-b' from '/src/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/src/library-b'.",
|
||||
"File '/src/library-b.ts' does not exist.",
|
||||
"File '/src/library-b.tsx' does not exist.",
|
||||
"File '/src/library-b.d.ts' does not exist.",
|
||||
"File '/src/library-b/package.json' does not exist.",
|
||||
"File '/src/library-b/index.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/library-b/index.ts', result '/src/library-b/index.ts'",
|
||||
"======== Module name './library-b' was successfully resolved to '/src/library-b/index.ts'. ========",
|
||||
"======== Resolving module 'library-a' from '/src/library-b/index.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module 'library-a' from 'node_modules' folder.",
|
||||
"File '/src/library-b/node_modules/library-a.ts' does not exist.",
|
||||
"File '/src/library-b/node_modules/library-a.tsx' does not exist.",
|
||||
"File '/src/library-b/node_modules/library-a.d.ts' does not exist.",
|
||||
"File '/src/library-b/node_modules/library-a/package.json' does not exist.",
|
||||
"File '/src/library-b/node_modules/library-a/index.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'",
|
||||
"======== Module name 'library-a' was successfully resolved to '/src/library-a/index.ts'. ========"
|
||||
]
|
||||
38
tests/baselines/reference/moduleResolutionWithSymlinks.types
Normal file
38
tests/baselines/reference/moduleResolutionWithSymlinks.types
Normal file
@@ -0,0 +1,38 @@
|
||||
=== /src/app.ts ===
|
||||
import { MyClass } from "./library-a";
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
import { MyClass2 } from "./library-b";
|
||||
>MyClass2 : typeof MyClass
|
||||
|
||||
let x: MyClass;
|
||||
>x : MyClass
|
||||
>MyClass : MyClass
|
||||
|
||||
let y: MyClass2;
|
||||
>y : MyClass
|
||||
>MyClass2 : MyClass
|
||||
|
||||
x = y;
|
||||
>x = y : MyClass
|
||||
>x : MyClass
|
||||
>y : MyClass
|
||||
|
||||
y = x;
|
||||
>y = x : MyClass
|
||||
>y : MyClass
|
||||
>x : MyClass
|
||||
|
||||
=== /src/library-a/index.ts ===
|
||||
|
||||
export class MyClass{}
|
||||
>MyClass : MyClass
|
||||
|
||||
=== /src/library-b/index.ts ===
|
||||
import {MyClass} from "library-a";
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
export { MyClass as MyClass2 }
|
||||
>MyClass : typeof MyClass
|
||||
>MyClass2 : typeof MyClass
|
||||
|
||||
20
tests/cases/compiler/moduleResolutionWithSymlinks.ts
Normal file
20
tests/cases/compiler/moduleResolutionWithSymlinks.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
|
||||
// @filename: /src/library-a/index.ts
|
||||
// @symlink: /src/library-b/node_modules/library-a/index.ts
|
||||
export class MyClass{}
|
||||
|
||||
// @filename: /src/library-b/index.ts
|
||||
import {MyClass} from "library-a";
|
||||
export { MyClass as MyClass2 }
|
||||
|
||||
// @filename: /src/app.ts
|
||||
import { MyClass } from "./library-a";
|
||||
import { MyClass2 } from "./library-b";
|
||||
|
||||
let x: MyClass;
|
||||
let y: MyClass2;
|
||||
x = y;
|
||||
y = x;
|
||||
Reference in New Issue
Block a user