merge with origin/master
This commit is contained in:
commit
39c948ad34
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -51,3 +51,4 @@ internal/
|
|||
!**/.vscode/tasks.json
|
||||
!tests/cases/projects/projectOption/**/node_modules
|
||||
!tests/cases/projects/NodeModulesSearch/**/*
|
||||
!tests/baselines/reference/project/nodeModules*/**/*
|
||||
|
|
150
Gulpfile.ts
150
Gulpfile.ts
|
@ -11,8 +11,11 @@ import newer = require("gulp-newer");
|
|||
import tsc = require("gulp-typescript");
|
||||
declare module "gulp-typescript" {
|
||||
interface Settings {
|
||||
stripInternal?: boolean;
|
||||
pretty?: boolean;
|
||||
newLine?: string;
|
||||
noImplicitThis?: boolean;
|
||||
stripInternal?: boolean;
|
||||
types?: string[];
|
||||
}
|
||||
interface CompileStream extends NodeJS.ReadWriteStream {} // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
|
||||
}
|
||||
|
@ -82,12 +85,9 @@ let host = cmdLineOptions["host"];
|
|||
|
||||
// Constants
|
||||
const compilerDirectory = "src/compiler/";
|
||||
const servicesDirectory = "src/services/";
|
||||
const serverDirectory = "src/server/";
|
||||
const harnessDirectory = "src/harness/";
|
||||
const libraryDirectory = "src/lib/";
|
||||
const scriptsDirectory = "scripts/";
|
||||
const unittestsDirectory = "tests/cases/unittests/";
|
||||
const docDirectory = "doc/";
|
||||
|
||||
const builtDirectory = "built/";
|
||||
|
@ -104,69 +104,6 @@ const nodeModulesPathPrefix = path.resolve("./node_modules/.bin/");
|
|||
const isWin = /^win/.test(process.platform);
|
||||
const mocha = path.join(nodeModulesPathPrefix, "mocha") + (isWin ? ".cmd" : "");
|
||||
|
||||
const compilerSources = require("./src/compiler/tsconfig.json").files.map((file) => path.join(compilerDirectory, file));
|
||||
|
||||
const servicesSources = require("./src/services/tsconfig.json").files.map((file) => path.join(servicesDirectory, file));
|
||||
|
||||
const serverCoreSources = require("./src/server/tsconfig.json").files.map((file) => path.join(serverDirectory, file));
|
||||
|
||||
const languageServiceLibrarySources = [
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"session.ts"
|
||||
].map(function (f) {
|
||||
return path.join(serverDirectory, f);
|
||||
}).concat(servicesSources);
|
||||
|
||||
const harnessCoreSources = [
|
||||
"harness.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
"harnessLanguageService.ts",
|
||||
"fourslash.ts",
|
||||
"runnerbase.ts",
|
||||
"compilerRunner.ts",
|
||||
"typeWriter.ts",
|
||||
"fourslashRunner.ts",
|
||||
"projectsRunner.ts",
|
||||
"loggedIO.ts",
|
||||
"rwcRunner.ts",
|
||||
"test262Runner.ts",
|
||||
"runner.ts"
|
||||
].map(function (f) {
|
||||
return path.join(harnessDirectory, f);
|
||||
});
|
||||
|
||||
const harnessSources = harnessCoreSources.concat([
|
||||
"incrementalParser.ts",
|
||||
"jsDocParsing.ts",
|
||||
"services/colorization.ts",
|
||||
"services/documentRegistry.ts",
|
||||
"services/preProcessFile.ts",
|
||||
"services/patternMatcher.ts",
|
||||
"session.ts",
|
||||
"versionCache.ts",
|
||||
"convertToBase64.ts",
|
||||
"transpile.ts",
|
||||
"reuseProgramStructure.ts",
|
||||
"cachingInServerLSHost.ts",
|
||||
"moduleResolution.ts",
|
||||
"tsconfigParsing.ts",
|
||||
"commandLineParsing.ts",
|
||||
"convertCompilerOptionsFromJson.ts",
|
||||
"convertTypingOptionsFromJson.ts",
|
||||
"tsserverProjectSystem.ts",
|
||||
"matchFiles.ts",
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
"protocol.d.ts",
|
||||
"session.ts",
|
||||
"client.ts",
|
||||
"editorServices.ts"
|
||||
].map(function (f) {
|
||||
return path.join(serverDirectory, f);
|
||||
}));
|
||||
|
||||
const es2015LibrarySources = [
|
||||
"es2015.core.d.ts",
|
||||
"es2015.collection.d.ts",
|
||||
|
@ -306,6 +243,11 @@ function needsUpdate(source: string | string[], dest: string | string[]): boolea
|
|||
|
||||
function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings {
|
||||
const copy: tsc.Settings = {};
|
||||
copy.noEmitOnError = true;
|
||||
copy.noImplicitAny = true;
|
||||
copy.noImplicitThis = true;
|
||||
copy.pretty = true;
|
||||
copy.types = [];
|
||||
for (const key in base) {
|
||||
copy[key] = base[key];
|
||||
}
|
||||
|
@ -492,21 +434,18 @@ const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js")
|
|||
const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
|
||||
|
||||
gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
|
||||
const settings: tsc.Settings = getCompilerSettings({
|
||||
declaration: true,
|
||||
outFile: tsserverLibraryFile
|
||||
}, /*useBuiltCompiler*/ true);
|
||||
const {js, dts}: {js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream} = gulp.src(languageServiceLibrarySources)
|
||||
const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
|
||||
const {js, dts}: {js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream} = serverLibraryProject.src()
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(newer(tsserverLibraryFile))
|
||||
.pipe(tsc(settings));
|
||||
.pipe(tsc(serverLibraryProject));
|
||||
|
||||
return merge2([
|
||||
js.pipe(prependCopyright())
|
||||
.pipe(sourcemaps.write("."))
|
||||
.pipe(gulp.dest(".")),
|
||||
.pipe(gulp.dest(builtLocalDirectory)),
|
||||
dts.pipe(prependCopyright())
|
||||
.pipe(gulp.dest("."))
|
||||
.pipe(gulp.dest(builtLocalDirectory))
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -575,15 +514,13 @@ gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUse
|
|||
// Task to build the tests infrastructure using the built compiler
|
||||
const run = path.join(builtLocalDirectory, "run.js");
|
||||
gulp.task(run, false, [servicesFile], () => {
|
||||
const settings: tsc.Settings = getCompilerSettings({
|
||||
outFile: run
|
||||
}, /*useBuiltCompiler*/ true);
|
||||
return gulp.src(harnessSources)
|
||||
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
|
||||
return testProject.src()
|
||||
.pipe(newer(run))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(tsc(settings))
|
||||
.pipe(tsc(testProject))
|
||||
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
|
||||
.pipe(gulp.dest("."));
|
||||
.pipe(gulp.dest(builtLocalDirectory));
|
||||
});
|
||||
|
||||
const internalTests = "internal/";
|
||||
|
@ -758,13 +695,11 @@ gulp.task(nodeServerOutFile, false, [servicesFile], () => {
|
|||
});
|
||||
|
||||
gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
|
||||
const settings: tsc.Settings = getCompilerSettings({
|
||||
outFile: "built/local/bundle.js"
|
||||
}, /*useBuiltCompiler*/ true);
|
||||
return gulp.src(harnessSources)
|
||||
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "built/local/bundle.js" }, /*useBuiltCompiler*/ true));
|
||||
return testProject.src()
|
||||
.pipe(newer("built/local/bundle.js"))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(tsc(settings))
|
||||
.pipe(tsc(testProject))
|
||||
.pipe(through2.obj((file, enc, next) => {
|
||||
browserify(intoStream(file.contents))
|
||||
.bundle((err, res) => {
|
||||
|
@ -1005,36 +940,37 @@ function lintFile(options, path) {
|
|||
return lintFileContents(options, path, contents);
|
||||
}
|
||||
|
||||
const lintTargets = ["Gulpfile.ts"]
|
||||
.concat(compilerSources)
|
||||
.concat(harnessSources)
|
||||
// Other harness sources
|
||||
.concat(["instrumenter.ts"].map(function(f) { return path.join(harnessDirectory, f); }))
|
||||
.concat(serverCoreSources)
|
||||
.concat(tslintRulesFiles)
|
||||
.concat(servicesSources);
|
||||
const lintTargets = [
|
||||
"Gulpfile.ts",
|
||||
"src/compiler/**/*.ts",
|
||||
"src/harness/**/*.ts",
|
||||
"!src/harness/unittests/services/formatting/**/*.ts",
|
||||
"src/server/**/*.ts",
|
||||
"scripts/tslint/**/*.ts",
|
||||
"src/services/**/*.ts",
|
||||
];
|
||||
|
||||
|
||||
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
|
||||
const fileMatcher = RegExp(cmdLineOptions["files"]);
|
||||
const lintOptions = getLinterOptions();
|
||||
let failed = 0;
|
||||
const fileMatcher = RegExp(cmdLineOptions["files"]);
|
||||
const done = {};
|
||||
for (const i in lintTargets) {
|
||||
const target = lintTargets[i];
|
||||
if (!done[target] && fileMatcher.test(target)) {
|
||||
const result = lintFile(lintOptions, target);
|
||||
return gulp.src(lintTargets)
|
||||
.pipe(insert.transform((contents, file) => {
|
||||
if (!fileMatcher.test(file.path)) return contents;
|
||||
const result = lintFile(lintOptions, file.path);
|
||||
if (result.failureCount > 0) {
|
||||
console.log(result.output);
|
||||
failed += result.failureCount;
|
||||
}
|
||||
done[target] = true;
|
||||
}
|
||||
}
|
||||
if (failed > 0) {
|
||||
console.error("Linter errors.");
|
||||
process.exit(1);
|
||||
}
|
||||
return contents; // TODO (weswig): Automatically apply fixes? :3
|
||||
}))
|
||||
.on("end", () => {
|
||||
if (failed > 0) {
|
||||
console.error("Linter errors.");
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
17
Jakefile.js
17
Jakefile.js
|
@ -14,7 +14,7 @@ var serverDirectory = "src/server/";
|
|||
var harnessDirectory = "src/harness/";
|
||||
var libraryDirectory = "src/lib/";
|
||||
var scriptsDirectory = "scripts/";
|
||||
var unittestsDirectory = "tests/cases/unittests/";
|
||||
var unittestsDirectory = "src/harness/unittests/";
|
||||
var docDirectory = "doc/";
|
||||
|
||||
var builtDirectory = "built/";
|
||||
|
@ -100,7 +100,6 @@ var servicesSources = [
|
|||
}));
|
||||
|
||||
var serverCoreSources = [
|
||||
"node.d.ts",
|
||||
"utilities.ts",
|
||||
"scriptVersionCache.ts",
|
||||
"scriptInfo.ts",
|
||||
|
@ -302,13 +301,18 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
|
|||
* @param {boolean} opts.stripInternal: true if compiler should remove declarations marked as @internal
|
||||
* @param {boolean} opts.noMapRoot: true if compiler omit mapRoot option
|
||||
* @param {boolean} opts.inlineSourceMap: true if compiler should inline sourceMap
|
||||
* @param {Array} opts.types: array of types to include in compilation
|
||||
* @param callback: a function to execute after the compilation process ends
|
||||
*/
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
|
||||
file(outFile, prereqs, function() {
|
||||
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
|
||||
var options = "--noImplicitAny --noEmitOnError --types --pretty";
|
||||
opts = opts || {};
|
||||
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
|
||||
var options = "--noImplicitAny --noImplicitThis --noEmitOnError --types "
|
||||
if (opts.types) {
|
||||
options += opts.types.join(",");
|
||||
}
|
||||
options += " --pretty";
|
||||
// Keep comments when specifically requested
|
||||
// or when in debug mode.
|
||||
if (!(opts.keepComments || useDebugMode)) {
|
||||
|
@ -574,8 +578,7 @@ var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js
|
|||
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: true });
|
||||
|
||||
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
|
||||
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright, cancellationTokenFile].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
|
||||
|
||||
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright, cancellationTokenFile].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"] });
|
||||
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
|
||||
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
|
||||
compileFile(
|
||||
|
@ -678,7 +681,7 @@ compileFile(
|
|||
/*prereqs*/ [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources),
|
||||
/*prefixes*/ [],
|
||||
/*useBuiltCompiler:*/ true,
|
||||
/*opts*/ { inlineSourceMap: true });
|
||||
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"] });
|
||||
|
||||
var internalTests = "internal/";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
@ -30,6 +30,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/browserify": "latest",
|
||||
"@types/chai": "latest",
|
||||
"@types/del": "latest",
|
||||
"@types/glob": "latest",
|
||||
"@types/gulp": "latest",
|
||||
|
@ -42,6 +43,7 @@
|
|||
"@types/minimatch": "latest",
|
||||
"@types/minimist": "latest",
|
||||
"@types/mkdirp": "latest",
|
||||
"@types/mocha": "latest",
|
||||
"@types/node": "latest",
|
||||
"@types/q": "latest",
|
||||
"@types/run-sequence": "latest",
|
||||
|
|
|
@ -3160,23 +3160,26 @@ namespace ts {
|
|||
if (declaration.kind === SyntaxKind.ExportAssignment) {
|
||||
return links.type = checkExpression((<ExportAssignment>declaration).expression);
|
||||
}
|
||||
if (declaration.flags & NodeFlags.JavaScriptFile && declaration.kind === SyntaxKind.JSDocPropertyTag && (<JSDocPropertyTag>declaration).typeExpression) {
|
||||
return links.type = getTypeFromTypeNode((<JSDocPropertyTag>declaration).typeExpression.type);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
let type: Type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === SyntaxKind.BinaryExpression) {
|
||||
type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached((<BinaryExpression>declaration.parent).right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === SyntaxKind.BinaryExpression ||
|
||||
declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
type = getUnionType(map(symbol.declarations,
|
||||
decl => decl.kind === SyntaxKind.BinaryExpression ?
|
||||
checkExpressionCached((<BinaryExpression>decl).right) :
|
||||
checkExpressionCached((<BinaryExpression>decl.parent).right)));
|
||||
}
|
||||
|
||||
if (type === undefined) {
|
||||
|
@ -11673,7 +11676,7 @@ namespace ts {
|
|||
function getInferredClassType(symbol: Symbol) {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
|
|
|
@ -901,9 +901,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
export function fileExtensionIs(path: string, extension: string): boolean {
|
||||
const pathLen = path.length;
|
||||
const extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
|
||||
export function fileExtensionIsAny(path: string, extensions: string[]): boolean {
|
||||
|
@ -916,7 +914,6 @@ namespace ts {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.
|
||||
// It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future
|
||||
// proof.
|
||||
|
@ -1238,20 +1235,20 @@ namespace ts {
|
|||
getSignatureConstructor(): new (checker: TypeChecker) => Signature;
|
||||
}
|
||||
|
||||
function Symbol(flags: SymbolFlags, name: string) {
|
||||
function Symbol(this: Symbol, flags: SymbolFlags, name: string) {
|
||||
this.flags = flags;
|
||||
this.name = name;
|
||||
this.declarations = undefined;
|
||||
}
|
||||
|
||||
function Type(checker: TypeChecker, flags: TypeFlags) {
|
||||
function Type(this: Type, checker: TypeChecker, flags: TypeFlags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
function Signature(checker: TypeChecker) {
|
||||
}
|
||||
|
||||
function Node(kind: SyntaxKind, pos: number, end: number) {
|
||||
function Node(this: Node, kind: SyntaxKind, pos: number, end: number) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ts {
|
|||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "2.0.0";
|
||||
export const version = "2.1.0";
|
||||
|
||||
const emptyArray: any[] = [];
|
||||
|
||||
|
@ -112,13 +112,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
function moduleHasNonRelativeName(moduleName: string): boolean {
|
||||
if (isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const i = moduleName.lastIndexOf("./", 1);
|
||||
const startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === CharacterCodes.dot);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(isRootedDiskPath(moduleName) || isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
|
||||
interface ModuleResolutionState {
|
||||
|
@ -997,6 +991,23 @@ namespace ts {
|
|||
return sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
|
||||
export function formatDiagnostics(diagnostics: Diagnostic[], host: CompilerHost): string {
|
||||
let output = "";
|
||||
|
||||
for (const diagnostic of diagnostics) {
|
||||
if (diagnostic.file) {
|
||||
const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
||||
const fileName = diagnostic.file.fileName;
|
||||
const relativeFileName = convertToRelativePath(fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName));
|
||||
output += `${ relativeFileName }(${ line + 1 },${ character + 1 }): `;
|
||||
}
|
||||
|
||||
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
export function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
|
@ -1095,13 +1106,13 @@ namespace ts {
|
|||
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
|
||||
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
|
||||
const maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
let currentNodeModulesJsDepth = 0;
|
||||
let currentNodeModulesDepth = 0;
|
||||
|
||||
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
|
||||
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
|
||||
const modulesWithElidedImports: Map<boolean> = {};
|
||||
|
||||
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
const sourceFilesFoundSearchingNodeModules: Map<boolean> = {};
|
||||
|
||||
const start = new Date().getTime();
|
||||
|
@ -1404,7 +1415,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult {
|
||||
return runWithCancellationToken(() => emitWorker(this, sourceFile, writeFileCallback, cancellationToken));
|
||||
return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken));
|
||||
}
|
||||
|
||||
function isEmitBlocked(emitFileName: string): boolean {
|
||||
|
@ -1923,9 +1934,21 @@ namespace ts {
|
|||
reportFileNamesDifferOnlyInCasingError(fileName, file.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
|
||||
if (file && lookUp(sourceFilesFoundSearchingNodeModules, file.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file, getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file);
|
||||
}
|
||||
|
||||
modulesWithElidedImports[file.path] = false;
|
||||
processImportedModules(file, getDirectoryPath(fileName));
|
||||
}
|
||||
// See if we need to reprocess the imports due to prior skipped imports
|
||||
if (file && lookUp(modulesWithElidedImports, file.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
else if (file && lookUp(modulesWithElidedImports, file.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file.path] = false;
|
||||
processImportedModules(file, getDirectoryPath(fileName));
|
||||
}
|
||||
|
@ -1947,6 +1970,7 @@ namespace ts {
|
|||
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
|
@ -2080,13 +2104,10 @@ namespace ts {
|
|||
const isJsFileFromNodeModules = isFromNodeModulesSearch && hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
|
||||
const elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
const shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
|
||||
if (elideImport) {
|
||||
|
@ -2101,8 +2122,8 @@ namespace ts {
|
|||
file.imports[i].end);
|
||||
}
|
||||
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace ts {
|
|||
return matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
|
||||
return {
|
||||
const wscriptSystem: System = {
|
||||
args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
|
@ -201,7 +201,7 @@ namespace ts {
|
|||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
|
@ -221,6 +221,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
|
||||
function getNodeSystem(): System {
|
||||
|
@ -439,7 +440,7 @@ namespace ts {
|
|||
return filter<string>(_fs.readdirSync(path), p => fileSystemEntryExists(combinePaths(path, p), FileSystemEntryKind.Directory));
|
||||
}
|
||||
|
||||
return {
|
||||
const nodeSystem: System = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
|
@ -501,7 +502,7 @@ namespace ts {
|
|||
fileExists,
|
||||
directoryExists,
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
|
@ -549,6 +550,7 @@ namespace ts {
|
|||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
|
||||
function getChakraSystem(): System {
|
||||
|
|
|
@ -101,23 +101,8 @@ namespace ts {
|
|||
return <string>diagnostic.messageText;
|
||||
}
|
||||
|
||||
function getRelativeFileName(fileName: string, host: CompilerHost): string {
|
||||
return host ? convertToRelativePath(fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName)) : fileName;
|
||||
}
|
||||
|
||||
function reportDiagnosticSimply(diagnostic: Diagnostic, host: CompilerHost): void {
|
||||
let output = "";
|
||||
|
||||
if (diagnostic.file) {
|
||||
const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
||||
const relativeFileName = getRelativeFileName(diagnostic.file.fileName, host);
|
||||
output += `${ relativeFileName }(${ line + 1 },${ character + 1 }): `;
|
||||
}
|
||||
|
||||
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
|
||||
|
||||
sys.write(output);
|
||||
sys.write(ts.formatDiagnostics([diagnostic], host));
|
||||
}
|
||||
|
||||
const redForegroundEscapeSequence = "\u001b[91m";
|
||||
|
@ -145,7 +130,7 @@ namespace ts {
|
|||
const { line: firstLine, character: firstLineChar } = getLineAndCharacterOfPosition(file, start);
|
||||
const { line: lastLine, character: lastLineChar } = getLineAndCharacterOfPosition(file, start + length);
|
||||
const lastLineInFile = getLineAndCharacterOfPosition(file, file.text.length).line;
|
||||
const relativeFileName = getRelativeFileName(file.fileName, host);
|
||||
const relativeFileName = host ? convertToRelativePath(file.fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName)) : file.fileName;
|
||||
|
||||
const hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
|
||||
let gutterWidth = (lastLine + 1 + "").length;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"pretty": true,
|
||||
"outFile": "../../built/local/tsc.js",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
|
|
|
@ -1218,7 +1218,7 @@ namespace ts {
|
|||
export function isExternalModuleNameRelative(moduleName: string): boolean {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
|
||||
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
|
||||
|
@ -3120,6 +3120,6 @@ namespace ts {
|
|||
|
||||
export function endsWith(str: string, suffix: string): boolean {
|
||||
const expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
}
|
||||
|
|
179
src/harness/external/chai.d.ts
vendored
179
src/harness/external/chai.d.ts
vendored
|
@ -1,179 +0,0 @@
|
|||
// Type definitions for chai 1.7.2
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Hunsaker <https://github.com/jedhunsaker/>
|
||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module chai {
|
||||
|
||||
function expect(target: any, message?: string): Expect;
|
||||
|
||||
// Provides a way to extend the internals of Chai
|
||||
function use(fn: (chai: any, utils: any) => void): any;
|
||||
|
||||
interface ExpectStatic {
|
||||
(target: any): Expect;
|
||||
}
|
||||
|
||||
interface Assertions {
|
||||
attr(name: string, value?: string): any;
|
||||
css(name: string, value?: string): any;
|
||||
data(name: string, value?: string): any;
|
||||
class(className: string): any;
|
||||
id(id: string): any;
|
||||
html(html: string): any;
|
||||
text(text: string): any;
|
||||
value(value: string): any;
|
||||
visible: any;
|
||||
hidden: any;
|
||||
selected: any;
|
||||
checked: any;
|
||||
disabled: any;
|
||||
empty: any;
|
||||
exist: any;
|
||||
}
|
||||
|
||||
interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions {
|
||||
not: Expect;
|
||||
deep: Deep;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
contain: Include;
|
||||
ok: Expect;
|
||||
true: Expect;
|
||||
false: Expect;
|
||||
null: Expect;
|
||||
undefined: Expect;
|
||||
exist: Expect;
|
||||
empty: Expect;
|
||||
arguments: Expect;
|
||||
Arguments: Expect;
|
||||
equal: Equal;
|
||||
equals: Equal;
|
||||
eq: Equal;
|
||||
eql: Equal;
|
||||
eqls: Equal;
|
||||
property: Property;
|
||||
ownProperty: OwnProperty;
|
||||
haveOwnProperty: OwnProperty;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(RegularExpression: RegExp, message?: string): Expect;
|
||||
string(string: string, message?: string): Expect;
|
||||
keys: Keys;
|
||||
key(string: string): Expect;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Expect;
|
||||
itself: Expect;
|
||||
satisfy(matcher: Function, message?: string): Expect;
|
||||
closeTo(expected: number, delta: number, message?: string): Expect;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
to: Expect;
|
||||
be: Expect;
|
||||
been: Expect;
|
||||
is: Expect;
|
||||
that: Expect;
|
||||
and: Expect;
|
||||
have: Expect;
|
||||
with: Expect;
|
||||
at: Expect;
|
||||
of: Expect;
|
||||
same: Expect;
|
||||
}
|
||||
|
||||
interface NumericComparison {
|
||||
above: NumberComparer;
|
||||
gt: NumberComparer;
|
||||
greaterThan: NumberComparer;
|
||||
least: NumberComparer;
|
||||
gte: NumberComparer;
|
||||
below: NumberComparer;
|
||||
lt: NumberComparer;
|
||||
lessThan: NumberComparer;
|
||||
most: NumberComparer;
|
||||
lte: NumberComparer;
|
||||
within(start: number, finish: number, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface NumberComparer {
|
||||
(value: number, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
(type: string, message?: string): Expect;
|
||||
instanceof: InstanceOf;
|
||||
instanceOf: InstanceOf;
|
||||
}
|
||||
|
||||
interface InstanceOf {
|
||||
(constructor: Object, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface Deep {
|
||||
equal: Equal;
|
||||
property: Property;
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
(value: any, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
(name: string, value?: any, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface OwnProperty {
|
||||
(name: string, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Expect;
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Expect;
|
||||
(value: string, message?: string): Expect;
|
||||
(value: number, message?: string): Expect;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Expect;
|
||||
(keys: any[]): Expect;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Expect;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Expect;
|
||||
(expected: string, message?: string): Expect;
|
||||
(expected: RegExp, message?: string): Expect;
|
||||
(constructor: Error, expected?: string, message?: string): Expect;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Expect;
|
||||
(constructor: Function, expected?: string, message?: string): Expect;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Expect;
|
||||
}
|
||||
|
||||
function assert(expression: any, message?: string): void;
|
||||
module assert {
|
||||
function equal(actual: any, expected: any, message?: string): void;
|
||||
function notEqual(actual: any, expected: any, message?: string): void;
|
||||
function deepEqual<T>(actual: T, expected: T, message?: string): void;
|
||||
function notDeepEqual<T>(actual: T, expected: T, message?: string): void;
|
||||
function lengthOf(object: any[], length: number, message?: string): void;
|
||||
function isTrue(value: any, message?: string): void;
|
||||
function isFalse(value: any, message?: string): void;
|
||||
function isOk(actual: any, message?: string): void;
|
||||
function isUndefined(value: any, message?: string): void;
|
||||
function isDefined(value: any, message?: string): void;
|
||||
}
|
||||
}
|
45
src/harness/external/mocha.d.ts
vendored
45
src/harness/external/mocha.d.ts
vendored
|
@ -1,45 +0,0 @@
|
|||
// Type definitions for mocha 1.9.0
|
||||
// Project: http://visionmedia.github.io/mocha/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var describe : {
|
||||
(description: string, spec: () => void): void;
|
||||
only(description: string, spec: () => void): void;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
declare var it: {
|
||||
(expectation: string, assertion?: () => void): void;
|
||||
(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
only(expectation: string, assertion?: () => void): void;
|
||||
only(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
timeout(ms: number): void;
|
||||
};
|
||||
|
||||
/** Runs once before any 'it' blocks in the current 'describe' are run */
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
/** Runs once before any 'it' blocks in the current 'describe' are run */
|
||||
declare function before(action: (done: () => void) => void): void;
|
||||
|
||||
/** Runs once after all 'it' blocks in the current 'describe' are run */
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
/** Runs once after all 'it' blocks in the current 'describe' are run */
|
||||
declare function after(action: (done: () => void) => void): void;
|
||||
|
||||
/** Runs before each individual 'it' block in the current 'describe' is run */
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
/** Runs before each individual 'it' block in the current 'describe' is run */
|
||||
declare function beforeEach(action: (done: () => void) => void): void;
|
||||
|
||||
/** Runs after each individual 'it' block in the current 'describe' is run */
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
/** Runs after each individual 'it' block in the current 'describe' is run */
|
||||
declare function afterEach(action: (done: () => void) => void): void;
|
1296
src/harness/external/node.d.ts
vendored
1296
src/harness/external/node.d.ts
vendored
File diff suppressed because it is too large
Load diff
|
@ -18,12 +18,13 @@
|
|||
/// <reference path="..\services\shims.ts" />
|
||||
/// <reference path="..\server\session.ts" />
|
||||
/// <reference path="..\server\client.ts" />
|
||||
/// <reference path="..\server\node.d.ts" />
|
||||
/// <reference path="external\mocha.d.ts"/>
|
||||
/// <reference path="external\chai.d.ts"/>
|
||||
/// <reference path="sourceMapRecorder.ts"/>
|
||||
/// <reference path="runnerbase.ts"/>
|
||||
/// <reference path="virtualFileSystem.ts" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="mocha" />
|
||||
/// <reference types="chai" />
|
||||
|
||||
|
||||
// Block scoped definitions work poorly for global variables, temporarily enable var
|
||||
/* tslint:disable:no-var-keyword */
|
||||
|
@ -32,7 +33,13 @@
|
|||
var _chai: typeof chai = require("chai");
|
||||
var assert: typeof _chai.assert = _chai.assert;
|
||||
declare var __dirname: string; // Node-specific
|
||||
var global = <any>Function("return this").call(undefined);
|
||||
var global: NodeJS.Global = <any>Function("return this").call(undefined);
|
||||
declare namespace NodeJS {
|
||||
export interface Global {
|
||||
WScript: typeof WScript;
|
||||
ActiveXObject: typeof ActiveXObject;
|
||||
}
|
||||
}
|
||||
/* tslint:enable:no-var-keyword */
|
||||
|
||||
namespace Utils {
|
||||
|
@ -57,7 +64,7 @@ namespace Utils {
|
|||
|
||||
export let currentExecutionEnvironment = getExecutionEnvironment();
|
||||
|
||||
const Buffer: BufferConstructor = currentExecutionEnvironment !== ExecutionEnvironment.Browser
|
||||
const Buffer: typeof global.Buffer = currentExecutionEnvironment !== ExecutionEnvironment.Browser
|
||||
? require("buffer").Buffer
|
||||
: undefined;
|
||||
|
||||
|
@ -133,7 +140,7 @@ namespace Utils {
|
|||
export function memoize<T extends Function>(f: T): T {
|
||||
const cache: { [idx: string]: any } = {};
|
||||
|
||||
return <any>(function() {
|
||||
return <any>(function(this: any) {
|
||||
const key = Array.prototype.join.call(arguments);
|
||||
const cachedResult = cache[key];
|
||||
if (cachedResult) {
|
||||
|
@ -1376,31 +1383,27 @@ namespace Harness {
|
|||
writeByteOrderMark: boolean;
|
||||
}
|
||||
|
||||
function stringEndsWith(str: string, end: string) {
|
||||
return str.substr(str.length - end.length) === end;
|
||||
}
|
||||
|
||||
export function isTS(fileName: string) {
|
||||
return stringEndsWith(fileName, ".ts");
|
||||
return ts.endsWith(fileName, ".ts");
|
||||
}
|
||||
|
||||
export function isTSX(fileName: string) {
|
||||
return stringEndsWith(fileName, ".tsx");
|
||||
return ts.endsWith(fileName, ".tsx");
|
||||
}
|
||||
|
||||
export function isDTS(fileName: string) {
|
||||
return stringEndsWith(fileName, ".d.ts");
|
||||
return ts.endsWith(fileName, ".d.ts");
|
||||
}
|
||||
|
||||
export function isJS(fileName: string) {
|
||||
return stringEndsWith(fileName, ".js");
|
||||
return ts.endsWith(fileName, ".js");
|
||||
}
|
||||
export function isJSX(fileName: string) {
|
||||
return stringEndsWith(fileName, ".jsx");
|
||||
return ts.endsWith(fileName, ".jsx");
|
||||
}
|
||||
|
||||
export function isJSMap(fileName: string) {
|
||||
return stringEndsWith(fileName, ".js.map") || stringEndsWith(fileName, ".jsx.map");
|
||||
return ts.endsWith(fileName, ".js.map") || ts.endsWith(fileName, ".jsx.map");
|
||||
}
|
||||
|
||||
/** Contains the code and errors of a compilation and some helper methods to check its status. */
|
||||
|
|
|
@ -479,17 +479,27 @@ class ProjectRunner extends RunnerBase {
|
|||
|
||||
it("Baseline of emitted result (" + moduleNameToString(moduleKind) + "): " + testCaseFileName, () => {
|
||||
if (testCase.baselineCheck) {
|
||||
const errs: Error[] = [];
|
||||
ts.forEach(compilerResult.outputFiles, outputFile => {
|
||||
|
||||
Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
|
||||
try {
|
||||
return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
// There may be multiple files with different baselines. Run all and report at the end, else
|
||||
// it stops copying the remaining emitted files from 'local/projectOutput' to 'local/project'.
|
||||
try {
|
||||
Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
|
||||
try {
|
||||
return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
errs.push(e);
|
||||
}
|
||||
});
|
||||
if (errs.length) {
|
||||
throw Error(errs.join("\n "));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
93
src/harness/tsconfig.json
Normal file
93
src/harness/tsconfig.json
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"pretty": true,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"outFile": "../../built/local/run.js",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"stripInternal": true,
|
||||
"types": [
|
||||
"node", "mocha", "chai"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"../compiler/core.ts",
|
||||
"../compiler/sys.ts",
|
||||
"../compiler/types.ts",
|
||||
"../compiler/scanner.ts",
|
||||
"../compiler/parser.ts",
|
||||
"../compiler/utilities.ts",
|
||||
"../compiler/binder.ts",
|
||||
"../compiler/checker.ts",
|
||||
"../compiler/sourcemap.ts",
|
||||
"../compiler/declarationEmitter.ts",
|
||||
"../compiler/emitter.ts",
|
||||
"../compiler/program.ts",
|
||||
"../compiler/commandLineParser.ts",
|
||||
"../compiler/diagnosticInformationMap.generated.ts",
|
||||
"../services/breakpoints.ts",
|
||||
"../services/navigateTo.ts",
|
||||
"../services/navigationBar.ts",
|
||||
"../services/outliningElementsCollector.ts",
|
||||
"../services/patternMatcher.ts",
|
||||
"../services/services.ts",
|
||||
"../services/shims.ts",
|
||||
"../services/signatureHelp.ts",
|
||||
"../services/utilities.ts",
|
||||
"../services/jsTyping.ts",
|
||||
"../services/formatting/formatting.ts",
|
||||
"../services/formatting/formattingContext.ts",
|
||||
"../services/formatting/formattingRequestKind.ts",
|
||||
"../services/formatting/formattingScanner.ts",
|
||||
"../services/formatting/references.ts",
|
||||
"../services/formatting/rule.ts",
|
||||
"../services/formatting/ruleAction.ts",
|
||||
"../services/formatting/ruleDescriptor.ts",
|
||||
"../services/formatting/ruleFlag.ts",
|
||||
"../services/formatting/ruleOperation.ts",
|
||||
"../services/formatting/ruleOperationContext.ts",
|
||||
"../services/formatting/rules.ts",
|
||||
"../services/formatting/rulesMap.ts",
|
||||
"../services/formatting/rulesProvider.ts",
|
||||
"../services/formatting/smartIndenter.ts",
|
||||
"../services/formatting/tokenRange.ts",
|
||||
"harness.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
"harnessLanguageService.ts",
|
||||
"fourslash.ts",
|
||||
"runnerbase.ts",
|
||||
"compilerRunner.ts",
|
||||
"typeWriter.ts",
|
||||
"fourslashRunner.ts",
|
||||
"projectsRunner.ts",
|
||||
"loggedIO.ts",
|
||||
"rwcRunner.ts",
|
||||
"test262Runner.ts",
|
||||
"runner.ts",
|
||||
"../server/protocol.d.ts",
|
||||
"../server/session.ts",
|
||||
"../server/client.ts",
|
||||
"../server/editorServices.ts",
|
||||
"./unittests/incrementalParser.ts",
|
||||
"./unittests/jsDocParsing.ts",
|
||||
"./unittests/services/colorization.ts",
|
||||
"./unittests/services/documentRegistry.ts",
|
||||
"./unittests/services/preProcessFile.ts",
|
||||
"./unittests/services/patternMatcher.ts",
|
||||
"./unittests/session.ts",
|
||||
"./unittests/versionCache.ts",
|
||||
"./unittests/convertToBase64.ts",
|
||||
"./unittests/transpile.ts",
|
||||
"./unittests/reuseProgramStructure.ts",
|
||||
"./unittests/cachingInServerLSHost.ts",
|
||||
"./unittests/moduleResolution.ts",
|
||||
"./unittests/tsconfigParsing.ts",
|
||||
"./unittests/commandLineParsing.ts",
|
||||
"./unittests/convertCompilerOptionsFromJson.ts",
|
||||
"./unittests/convertTypingOptionsFromJson.ts",
|
||||
"./unittests/tsserverProjectSystem.ts",
|
||||
"./unittests/matchFiles.ts"
|
||||
]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
|
||||
namespace ts {
|
||||
interface File {
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\..\compiler\commandLineParser.ts" />
|
||||
|
||||
namespace ts {
|
||||
describe("parseCommandLine", () => {
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\..\compiler\commandLineParser.ts" />
|
||||
|
||||
namespace ts {
|
||||
describe("convertCompilerOptionsFromJson", () => {
|
|
@ -1,4 +1,4 @@
|
|||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
|
||||
namespace ts {
|
||||
describe("convertToBase64", () => {
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\..\compiler\commandLineParser.ts" />
|
||||
|
||||
namespace ts {
|
||||
describe("convertTypingOptionsFromJson", () => {
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\parser.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\..\compiler\parser.ts" />
|
||||
|
||||
namespace ts {
|
||||
ts.disableIncrementalParsing = false;
|
|
@ -1,7 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\external\chai.d.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\parser.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\compiler\parser.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
|
||||
namespace ts {
|
||||
describe("JSDocParsing", () => {
|
|
@ -1,6 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\harness\virtualFileSystem.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\virtualFileSystem.ts" />
|
||||
|
||||
namespace ts {
|
||||
const caseInsensitiveBasePath = "c:/dev/";
|
|
@ -1,11 +1,4 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path='..\..\..\src\harness\harness.ts' />
|
||||
|
||||
declare namespace chai.assert {
|
||||
/* tslint:disable no-unused-variable */
|
||||
function deepEqual(actual: any, expected: any): void;
|
||||
/* tslint:enable no-unused-variable */
|
||||
}
|
||||
/// <reference path="..\harness.ts" />
|
||||
|
||||
namespace ts {
|
||||
function diagnosticToString(diagnostic: Diagnostic) {
|
|
@ -1,6 +1,5 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path='..\..\..\src\harness\harness.ts' />
|
||||
/// <reference path="..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\..\harness\harnessLanguageService.ts" />
|
||||
|
||||
namespace ts {
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
/// <reference path="..\..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
/// <reference path="..\..\harnessLanguageService.ts" />
|
||||
|
||||
interface ClassificationEntry {
|
||||
value: any;
|
|
@ -1,4 +1,4 @@
|
|||
///<reference path='..\..\..\..\src\harness\harness.ts' />
|
||||
/// <reference path="..\..\harness.ts" />
|
||||
|
||||
describe("DocumentRegistry", () => {
|
||||
it("documents are shared between projects", () => {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue