WIP
This commit is contained in:
parent
0faeba223c
commit
f5387fb082
|
@ -32,6 +32,7 @@ namespace ts {
|
|||
getSourceFiles(): SourceFile[];
|
||||
|
||||
/* @internal */
|
||||
//!!!
|
||||
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
|
@ -2632,6 +2633,7 @@ namespace ts {
|
|||
const sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
|
||||
for (const sourceFile of sourceFiles) {
|
||||
// Don't emit if source file is a declaration file, or was located under node_modules
|
||||
//!!!!!!!
|
||||
if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
|
||||
onSingleFileEmit(host, sourceFile);
|
||||
}
|
||||
|
@ -2684,6 +2686,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
//!!!
|
||||
export function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
|
||||
let sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
|
||||
const commonSourceDirectory = host.getCommonSourceDirectory();
|
||||
|
|
|
@ -977,9 +977,9 @@ namespace Harness {
|
|||
|
||||
function getSourceFile(fileName: string) {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
const path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
if (fileMap.contains(path)) {
|
||||
return fileMap.get(path)();
|
||||
const fromMap = fileMap.get(realPath(fileName));
|
||||
if (fromMap) {
|
||||
return fromMap();
|
||||
}
|
||||
else if (fileName === fourslashFileName) {
|
||||
const tsFn = "tests/cases/fourslash/" + fourslashFileName;
|
||||
|
@ -998,6 +998,13 @@ namespace Harness {
|
|||
newLineKind === ts.NewLineKind.LineFeed ? lineFeed :
|
||||
Harness.IO.newLine();
|
||||
|
||||
//move
|
||||
function realPath(fileName: string): ts.Path {
|
||||
const path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
return realPathMap
|
||||
? (realPathMap.get(path) as ts.Path) || path
|
||||
: path;
|
||||
}
|
||||
|
||||
return {
|
||||
getCurrentDirectory: () => currentDirectory,
|
||||
|
@ -1012,12 +1019,9 @@ namespace Harness {
|
|||
return fileMap.contains(path) || (realPathMap && realPathMap.contains(path));
|
||||
},
|
||||
readFile: (fileName: string): string => {
|
||||
return fileMap.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName))().getText();
|
||||
return fileMap.get(realPath(fileName))().getText();
|
||||
},
|
||||
realpath: realPathMap && ((f: string) => {
|
||||
const path = ts.toPath(f, currentDirectory, getCanonicalFileName);
|
||||
return realPathMap.get(path) || path;
|
||||
}),
|
||||
realpath: realPathMap && realPath,
|
||||
directoryExists: dir => {
|
||||
let path = ts.toPath(dir, currentDirectory, getCanonicalFileName);
|
||||
// Strip trailing /, which may exist if the path is a drive root
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
// @outDir: bin
|
||||
|
||||
// @filename: /test/index.ts
|
||||
// @symlink: /app/node_modules/test/index.ts
|
||||
export const x = 0;
|
||||
|
||||
// @filename: /app/index.ts
|
||||
import { x } from "test";
|
||||
x + 1;
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
|
||||
// @filename: /node_modules/@types/foo/index.d.ts
|
||||
// @symlink: /src/node_modules/@types/foo/index.d.ts
|
||||
export as namespace angular;
|
||||
export const x: number;
|
||||
|
||||
// @filename: /node_modules/@types/bar/index.d.ts
|
||||
// @symlink: /src/node_modules/@types/bar/index.d.ts
|
||||
import * as angular from "foo";
|
||||
|
||||
|
||||
// @filename: /src/a.ts
|
||||
angular.x + 1;
|
||||
|
||||
// @filename: /src/tsconfig.json
|
||||
{}
|
|
@ -0,0 +1,18 @@
|
|||
// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
// Test of GH#10364
|
||||
|
||||
// @filename: /shared/abc.ts
|
||||
// @symlink: /src/shared/abc.ts
|
||||
export const x = 0;
|
||||
|
||||
// @filename: /src/app.ts
|
||||
import { x } from './shared/abc';
|
||||
x + 1;
|
||||
|
||||
// @filename: /src/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "bin"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue