Have tsconfig for harness
This commit is contained in:
parent
f19844fbe9
commit
fb20df0568
141
Gulpfile.ts
141
Gulpfile.ts
|
@ -85,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/";
|
||||
|
@ -107,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",
|
||||
|
@ -500,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))
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -583,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/";
|
||||
|
@ -766,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) => {
|
||||
|
@ -1013,36 +940,38 @@ 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",
|
||||
"tests/cases/unittests/**/*.ts",
|
||||
"!tests/cases/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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
15
Jakefile.js
15
Jakefile.js
|
@ -100,7 +100,6 @@ var servicesSources = [
|
|||
}));
|
||||
|
||||
var serverCoreSources = [
|
||||
"node.d.ts",
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"session.ts",
|
||||
|
@ -279,13 +278,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 --noImplicitThis --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)) {
|
||||
|
@ -548,8 +552,7 @@ compileFile(
|
|||
});
|
||||
|
||||
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
|
||||
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
|
||||
|
||||
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"] });
|
||||
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
|
||||
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
|
||||
compileFile(
|
||||
|
@ -652,7 +655,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/";
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
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;
|
||||
|
||||
|
|
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",
|
||||
"../../tests/cases/unittests/incrementalParser.ts",
|
||||
"../../tests/cases/unittests/jsDocParsing.ts",
|
||||
"../../tests/cases/unittests/services/colorization.ts",
|
||||
"../../tests/cases/unittests/services/documentRegistry.ts",
|
||||
"../../tests/cases/unittests/services/preProcessFile.ts",
|
||||
"../../tests/cases/unittests/services/patternMatcher.ts",
|
||||
"../../tests/cases/unittests/session.ts",
|
||||
"../../tests/cases/unittests/versionCache.ts",
|
||||
"../../tests/cases/unittests/convertToBase64.ts",
|
||||
"../../tests/cases/unittests/transpile.ts",
|
||||
"../../tests/cases/unittests/reuseProgramStructure.ts",
|
||||
"../../tests/cases/unittests/cachingInServerLSHost.ts",
|
||||
"../../tests/cases/unittests/moduleResolution.ts",
|
||||
"../../tests/cases/unittests/tsconfigParsing.ts",
|
||||
"../../tests/cases/unittests/commandLineParsing.ts",
|
||||
"../../tests/cases/unittests/convertCompilerOptionsFromJson.ts",
|
||||
"../../tests/cases/unittests/convertTypingOptionsFromJson.ts",
|
||||
"../../tests/cases/unittests/tsserverProjectSystem.ts",
|
||||
"../../tests/cases/unittests/matchFiles.ts"
|
||||
]
|
||||
}
|
682
src/server/node.d.ts
vendored
682
src/server/node.d.ts
vendored
|
@ -1,682 +0,0 @@
|
|||
// Type definitions for Node.js v0.10.1
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
* Node.js v0.10.1 API *
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
* GLOBAL *
|
||||
* *
|
||||
************************************************/
|
||||
declare var process: NodeJS.Process;
|
||||
declare var global: any;
|
||||
|
||||
declare var __filename: string;
|
||||
declare var __dirname: string;
|
||||
|
||||
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
||||
declare function clearTimeout(timeoutId: NodeJS.Timer): void;
|
||||
declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
||||
declare function clearInterval(intervalId: NodeJS.Timer): void;
|
||||
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
|
||||
declare function clearImmediate(immediateId: any): void;
|
||||
|
||||
declare var require: {
|
||||
(id: string): any;
|
||||
resolve(id: string): string;
|
||||
cache: any;
|
||||
extensions: any;
|
||||
main: any;
|
||||
};
|
||||
|
||||
declare var module: {
|
||||
exports: any;
|
||||
require(id: string): any;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
parent: any;
|
||||
children: any[];
|
||||
};
|
||||
|
||||
// Same as module.exports
|
||||
declare var exports: any;
|
||||
declare var SlowBuffer: {
|
||||
new (str: string, encoding?: string): Buffer;
|
||||
new (size: number): Buffer;
|
||||
new (size: Uint8Array): Buffer;
|
||||
new (array: any[]): Buffer;
|
||||
prototype: Buffer;
|
||||
isBuffer(obj: any): boolean;
|
||||
byteLength(string: string, encoding?: string): number;
|
||||
concat(list: Buffer[], totalLength?: number): Buffer;
|
||||
};
|
||||
|
||||
|
||||
// Buffer class
|
||||
interface Buffer extends NodeBuffer { }
|
||||
interface BufferConstructor {
|
||||
new (str: string, encoding?: string): Buffer;
|
||||
new (size: number): Buffer;
|
||||
new (size: Uint8Array): Buffer;
|
||||
new (array: any[]): Buffer;
|
||||
prototype: Buffer;
|
||||
isBuffer(obj: any): boolean;
|
||||
byteLength(string: string, encoding?: string): number;
|
||||
concat(list: Buffer[], totalLength?: number): Buffer;
|
||||
}
|
||||
declare var Buffer: BufferConstructor;
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
* GLOBAL INTERFACES *
|
||||
* *
|
||||
************************************************/
|
||||
declare namespace NodeJS {
|
||||
export interface ErrnoException extends Error {
|
||||
errno?: any;
|
||||
code?: string;
|
||||
path?: string;
|
||||
syscall?: string;
|
||||
}
|
||||
|
||||
export interface EventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
removeListener(event: string, listener: Function): EventEmitter;
|
||||
removeAllListeners(event?: string): EventEmitter;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
export interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends WritableStream>(destination?: T): void;
|
||||
unshift(chunk: string): void;
|
||||
unshift(chunk: Buffer): void;
|
||||
wrap(oldStream: ReadableStream): ReadableStream;
|
||||
}
|
||||
|
||||
export interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
interface WindowSize {
|
||||
columns: number;
|
||||
rows: number;
|
||||
}
|
||||
|
||||
export interface Process extends EventEmitter {
|
||||
stdout: WritableStream & WindowSize;
|
||||
stderr: WritableStream & WindowSize;
|
||||
stdin: ReadableStream;
|
||||
argv: string[];
|
||||
execPath: string;
|
||||
abort(): void;
|
||||
chdir(directory: string): void;
|
||||
cwd(): string;
|
||||
env: any;
|
||||
exit(code?: number): void;
|
||||
getgid(): number;
|
||||
setgid(id: number): void;
|
||||
setgid(id: string): void;
|
||||
getuid(): number;
|
||||
setuid(id: number): void;
|
||||
setuid(id: string): void;
|
||||
version: string;
|
||||
versions: {
|
||||
http_parser: string;
|
||||
node: string;
|
||||
v8: string;
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
openssl: string;
|
||||
};
|
||||
config: {
|
||||
target_defaults: {
|
||||
cflags: any[];
|
||||
default_configuration: string;
|
||||
defines: string[];
|
||||
include_dirs: string[];
|
||||
libraries: string[];
|
||||
};
|
||||
variables: {
|
||||
clang: number;
|
||||
host_arch: string;
|
||||
node_install_npm: boolean;
|
||||
node_install_waf: boolean;
|
||||
node_prefix: string;
|
||||
node_shared_openssl: boolean;
|
||||
node_shared_v8: boolean;
|
||||
node_shared_zlib: boolean;
|
||||
node_use_dtrace: boolean;
|
||||
node_use_etw: boolean;
|
||||
node_use_openssl: boolean;
|
||||
target_arch: string;
|
||||
v8_no_strict_aliasing: number;
|
||||
v8_use_snapshot: boolean;
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid: number, signal?: string): void;
|
||||
pid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
platform: string;
|
||||
memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; };
|
||||
nextTick(callback: Function): void;
|
||||
umask(mask?: number): number;
|
||||
uptime(): number;
|
||||
hrtime(time?: number[]): number[];
|
||||
|
||||
// Worker
|
||||
send? (message: any, sendHandle?: any): void;
|
||||
}
|
||||
|
||||
export interface Timer {
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
interface NodeBuffer {
|
||||
[index: number]: number;
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
toJSON(): any;
|
||||
length: number;
|
||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
readUInt8(offset: number, noAsset?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
writeUInt8(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeInt8(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
|
||||
fill(value: any, offset?: number, end?: number): void;
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
export interface Path {
|
||||
normalize(p: string): string;
|
||||
join(...paths: any[]): string;
|
||||
resolve(...pathSegments: any[]): string;
|
||||
relative(from: string, to: string): string;
|
||||
dirname(p: string): string;
|
||||
basename(p: string, ext?: string): string;
|
||||
extname(p: string): string;
|
||||
sep: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
export interface ReadLineInstance extends EventEmitter {
|
||||
setPrompt(prompt: string, length: number): void;
|
||||
prompt(preserveCursor?: boolean): void;
|
||||
question(query: string, callback: Function): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
close(): void;
|
||||
write(data: any, key?: any): void;
|
||||
}
|
||||
export interface ReadLineOptions {
|
||||
input: NodeJS.ReadableStream;
|
||||
output: NodeJS.WritableStream;
|
||||
completer?: Function;
|
||||
terminal?: boolean;
|
||||
}
|
||||
|
||||
export interface ReadLine {
|
||||
createInterface(options: ReadLineOptions): ReadLineInstance;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
namespace events {
|
||||
export class EventEmitter implements NodeJS.EventEmitter {
|
||||
static listenerCount(emitter: EventEmitter, event: string): number;
|
||||
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
removeListener(event: string, listener: Function): EventEmitter;
|
||||
removeAllListeners(event?: string): EventEmitter;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
namespace stream {
|
||||
|
||||
export interface Stream extends events.EventEmitter {
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
|
||||
export interface ReadableOptions {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
}
|
||||
|
||||
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
||||
readable: boolean;
|
||||
constructor(opts?: ReadableOptions);
|
||||
_read(size: number): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: string): void;
|
||||
unshift(chunk: Buffer): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
}
|
||||
|
||||
export interface WritableOptions {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
writable: boolean;
|
||||
constructor(opts?: WritableOptions);
|
||||
_write(data: Buffer, encoding: string, callback: Function): void;
|
||||
_write(data: string, encoding: string, callback: Function): void;
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
}
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
||||
writable: boolean;
|
||||
constructor(opts?: DuplexOptions);
|
||||
_write(data: Buffer, encoding: string, callback: Function): void;
|
||||
_write(data: string, encoding: string, callback: Function): void;
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface TransformOptions extends ReadableOptions, WritableOptions { }
|
||||
|
||||
// Note: Transform lacks the _read and _write methods of Readable/Writable.
|
||||
export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
|
||||
readable: boolean;
|
||||
writable: boolean;
|
||||
constructor(opts?: TransformOptions);
|
||||
_transform(chunk: Buffer, encoding: string, callback: Function): void;
|
||||
_transform(chunk: string, encoding: string, callback: Function): void;
|
||||
_flush(callback: Function): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: string): void;
|
||||
unshift(chunk: Buffer): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export class PassThrough extends Transform { }
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
namespace fs {
|
||||
interface Stats {
|
||||
isFile(): boolean;
|
||||
isDirectory(): boolean;
|
||||
isBlockDevice(): boolean;
|
||||
isCharacterDevice(): boolean;
|
||||
isSymbolicLink(): boolean;
|
||||
isFIFO(): boolean;
|
||||
isSocket(): boolean;
|
||||
dev: number;
|
||||
ino: number;
|
||||
mode: number;
|
||||
nlink: number;
|
||||
uid: number;
|
||||
gid: number;
|
||||
rdev: number;
|
||||
size: number;
|
||||
blksize: number;
|
||||
blocks: number;
|
||||
atime: Date;
|
||||
mtime: Date;
|
||||
ctime: Date;
|
||||
}
|
||||
interface FSWatcher extends events.EventEmitter {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export interface ReadStream extends stream.Readable { }
|
||||
export interface WriteStream extends stream.Writable { }
|
||||
|
||||
export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function renameSync(oldPath: string, newPath: string): void;
|
||||
export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function truncateSync(path: string, len?: number): void;
|
||||
export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function ftruncateSync(fd: number, len?: number): void;
|
||||
export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function chownSync(path: string, uid: number, gid: number): void;
|
||||
export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function fchownSync(fd: number, uid: number, gid: number): void;
|
||||
export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function lchownSync(path: string, uid: number, gid: number): void;
|
||||
export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function chmodSync(path: string, mode: number): void;
|
||||
export function chmodSync(path: string, mode: string): void;
|
||||
export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function fchmodSync(fd: number, mode: number): void;
|
||||
export function fchmodSync(fd: number, mode: string): void;
|
||||
export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function lchmodSync(path: string, mode: number): void;
|
||||
export function lchmodSync(path: string, mode: string): void;
|
||||
export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||
export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||
export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||
export function statSync(path: string): Stats;
|
||||
export function lstatSync(path: string): Stats;
|
||||
export function fstatSync(fd: number): Stats;
|
||||
export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function linkSync(srcpath: string, dstpath: string): void;
|
||||
export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
|
||||
export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
export function readlinkSync(path: string): string;
|
||||
export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpathSync(path: string, cache?: { [path: string]: string }): string;
|
||||
export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function unlinkSync(path: string): void;
|
||||
export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function rmdirSync(path: string): void;
|
||||
export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function mkdirSync(path: string, mode?: number): void;
|
||||
export function mkdirSync(path: string, mode?: string): void;
|
||||
export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
export function readdirSync(path: string): string[];
|
||||
export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function closeSync(fd: number): void;
|
||||
export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function openSync(path: string, flags: string, mode?: number): number;
|
||||
export function openSync(path: string, flags: string, mode?: string): number;
|
||||
export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function utimesSync(path: string, atime: number, mtime: number): void;
|
||||
export function utimesSync(path: string, atime: Date, mtime: Date): void;
|
||||
export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function futimesSync(fd: number, atime: number, mtime: number): void;
|
||||
export function futimesSync(fd: number, atime: Date, mtime: Date): void;
|
||||
export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function fsyncSync(fd: number): void;
|
||||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
export function readFileSync(filename: string, encoding: string): string;
|
||||
export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
|
||||
export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
||||
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
|
||||
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
|
||||
export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
|
||||
export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function exists(path: string, callback?: (exists: boolean) => void): void;
|
||||
export function existsSync(path: string): boolean;
|
||||
export function createReadStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: string;
|
||||
mode?: number;
|
||||
bufferSize?: number;
|
||||
}): ReadStream;
|
||||
export function createReadStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: string;
|
||||
mode?: string;
|
||||
bufferSize?: number;
|
||||
}): ReadStream;
|
||||
export function createWriteStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
string?: string;
|
||||
}): WriteStream;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
namespace path {
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace NodeJS {
|
||||
namespace _debugger {
|
||||
export interface Packet {
|
||||
raw: string;
|
||||
headers: string[];
|
||||
body: Message;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
seq: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface RequestInfo {
|
||||
command: string;
|
||||
arguments: any;
|
||||
}
|
||||
|
||||
export interface Request extends Message, RequestInfo {
|
||||
}
|
||||
|
||||
export interface Event extends Message {
|
||||
event: string;
|
||||
body?: any;
|
||||
}
|
||||
|
||||
export interface Response extends Message {
|
||||
request_seq: number;
|
||||
success: boolean;
|
||||
/** Contains error message if success === false. */
|
||||
message?: string;
|
||||
/** Contains message body if success === true. */
|
||||
body?: any;
|
||||
}
|
||||
|
||||
export interface BreakpointMessageBody {
|
||||
type: string;
|
||||
target: number;
|
||||
line: number;
|
||||
}
|
||||
|
||||
export class Protocol {
|
||||
res: Packet;
|
||||
state: string;
|
||||
execute(data: string): void;
|
||||
serialize(rq: Request): string;
|
||||
onResponse: (pkt: Packet) => void;
|
||||
}
|
||||
|
||||
export var NO_FRAME: number;
|
||||
export var port: number;
|
||||
|
||||
export interface ScriptDesc {
|
||||
name: string;
|
||||
id: number;
|
||||
isNative?: boolean;
|
||||
handle?: number;
|
||||
type: string;
|
||||
lineOffset?: number;
|
||||
columnOffset?: number;
|
||||
lineCount?: number;
|
||||
}
|
||||
|
||||
export interface Breakpoint {
|
||||
id: number;
|
||||
scriptId: number;
|
||||
script: ScriptDesc;
|
||||
line: number;
|
||||
condition?: string;
|
||||
scriptReq?: string;
|
||||
}
|
||||
|
||||
export interface RequestHandler {
|
||||
(err: boolean, body: Message, res: Packet): void;
|
||||
request_seq?: number;
|
||||
}
|
||||
|
||||
export interface ResponseBodyHandler {
|
||||
(err: boolean, body?: any): void;
|
||||
request_seq?: number;
|
||||
}
|
||||
|
||||
export interface ExceptionInfo {
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface BreakResponse {
|
||||
script?: ScriptDesc;
|
||||
exception?: ExceptionInfo;
|
||||
sourceLine: number;
|
||||
sourceLineText: string;
|
||||
sourceColumn: number;
|
||||
}
|
||||
|
||||
export function SourceInfo(body: BreakResponse): string;
|
||||
|
||||
export class Client extends events.EventEmitter {
|
||||
protocol: Protocol;
|
||||
scripts: ScriptDesc[];
|
||||
handles: ScriptDesc[];
|
||||
breakpoints: Breakpoint[];
|
||||
currentSourceLine: number;
|
||||
currentSourceColumn: number;
|
||||
currentSourceLineText: string;
|
||||
currentFrame: number;
|
||||
currentScript: string;
|
||||
|
||||
connect(port: number, host: string): void;
|
||||
req(req: any, cb: RequestHandler): void;
|
||||
reqFrameEval(code: string, frame: number, cb: RequestHandler): void;
|
||||
mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void;
|
||||
setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void;
|
||||
clearBreakpoint(rq: Request, cb: RequestHandler): void;
|
||||
listbreakpoints(cb: RequestHandler): void;
|
||||
reqSource(from: number, to: number, cb: RequestHandler): void;
|
||||
reqScripts(cb: any): void;
|
||||
reqContinue(cb: RequestHandler): void;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,59 @@
|
|||
/// <reference path="node.d.ts" />
|
||||
/// <reference types="node" />
|
||||
/// <reference path="session.ts" />
|
||||
// used in fs.writeSync
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
namespace ts.server {
|
||||
const readline: NodeJS.ReadLine = require("readline");
|
||||
const fs: typeof NodeJS.fs = require("fs");
|
||||
interface ReadLineOptions {
|
||||
input: NodeJS.ReadableStream;
|
||||
output?: NodeJS.WritableStream;
|
||||
terminal?: boolean;
|
||||
historySize?: number;
|
||||
}
|
||||
|
||||
interface Key {
|
||||
sequence?: string;
|
||||
name?: string;
|
||||
ctrl?: boolean;
|
||||
meta?: boolean;
|
||||
shift?: boolean;
|
||||
}
|
||||
|
||||
interface Stats {
|
||||
isFile(): boolean;
|
||||
isDirectory(): boolean;
|
||||
isBlockDevice(): boolean;
|
||||
isCharacterDevice(): boolean;
|
||||
isSymbolicLink(): boolean;
|
||||
isFIFO(): boolean;
|
||||
isSocket(): boolean;
|
||||
dev: number;
|
||||
ino: number;
|
||||
mode: number;
|
||||
nlink: number;
|
||||
uid: number;
|
||||
gid: number;
|
||||
rdev: number;
|
||||
size: number;
|
||||
blksize: number;
|
||||
blocks: number;
|
||||
atime: Date;
|
||||
mtime: Date;
|
||||
ctime: Date;
|
||||
birthtime: Date;
|
||||
}
|
||||
|
||||
const readline: {
|
||||
createInterface(options: ReadLineOptions): NodeJS.EventEmitter;
|
||||
} = require("readline");
|
||||
const fs: {
|
||||
openSync(path: string, options: string): number;
|
||||
close(fd: number): void;
|
||||
writeSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
writeSync(fd: number, data: any, position?: number, enconding?: string): number;
|
||||
statSync(path: string): Stats;
|
||||
stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||
} = require("fs");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
"pretty": true,
|
||||
"out": "../../built/local/tsserver.js",
|
||||
"sourceMap": true,
|
||||
"stripInternal": true
|
||||
"stripInternal": true,
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"../services/shims.ts",
|
||||
"../services/utilities.ts",
|
||||
"node.d.ts",
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"session.ts",
|
||||
|
|
17
src/server/tsconfig.library.json
Normal file
17
src/server/tsconfig.library.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"out": "../../built/local/tsserverlibrary.js",
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"declaration": true,
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"session.ts"
|
||||
]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\parser.ts" />
|
||||
|
||||
namespace ts {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/// <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" />
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\harness\virtualFileSystem.ts" />
|
||||
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
/// <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 */
|
||||
}
|
||||
|
||||
namespace ts {
|
||||
function diagnosticToString(diagnostic: Diagnostic) {
|
||||
let output = "";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path='..\..\..\src\harness\harness.ts' />
|
||||
/// <reference path="..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/// <reference path="..\..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
/// <reference path="..\..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
|
||||
interface ClassificationEntry {
|
||||
value: any;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference path="..\..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\..\src\services\patternMatcher.ts" />
|
||||
|
||||
describe("PatternMatcher", function () {
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
/// <reference path="..\..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
|
||||
declare namespace chai.assert {
|
||||
/* tslint:disable no-unused-variable */
|
||||
function deepEqual(actual: any, expected: any): void;
|
||||
/* tslint:enable no-unused-variable */
|
||||
}
|
||||
/// <reference path="..\..\..\..\src\harness\harnessLanguageService.ts" />
|
||||
|
||||
describe("PreProcessFile:", function () {
|
||||
function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void {
|
||||
|
|
Loading…
Reference in a new issue