Almost working?

This commit is contained in:
Ryan Cavanaugh committed 2018-06-10 19:28:38 -07:00
1 parent 19fe86a8c1
commit ab10b86205
74 files changed
+377 -273

No files matched your search

+140 -114
View File
@@ -11,6 +11,7 @@ var ts = require("./lib/typescript");
const getDirSize = require("./scripts/build/getDirSize");
// Variables
var parserDirectory = "src/parser/";
var compilerDirectory = "src/compiler/";
var serverDirectory = "src/server/";
var harnessDirectory = "src/harness/";
@@ -29,6 +30,9 @@ var thirdParty = "ThirdPartyNoticeText.txt";
var defaultTestTimeout = 40000;
// Task to build the tests infrastructure using the built compiler
var run = path.join(builtLocalDirectory, "run.js");
// add node_modules to path so we don't need global modules, prefer the modules by adding them first
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
if (process.env.path !== undefined) {
@@ -79,6 +83,17 @@ function filesFromConfig(configPath) {
return configFileContent.fileNames;
}
/** @param configPath {string} */
function filesAndOutputFromConfig(configPath) {
const config = readJson(configPath);
const configFileContent = ts.parseJsonConfigFileContent(config, ts.sys, path.dirname(configPath));
if (configFileContent.errors && configFileContent.errors.length) {
reportDiagnostics(configFileContent.errors);
throw new Error("An error occurred during parse.");
}
return { files: configFileContent.fileNames, output: configFileContent.options.outFile };
}
function toNs(diff) {
return diff[0] * 1e9 + diff[1];
}
@@ -102,17 +117,55 @@ function measure(marker) {
}
function removeConstModifierFromEnumDeclarations(text) {
return text.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
return text.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
}
var compilerSources = filesFromConfig("./src/compiler/tsconfig.json");
var servicesSources = filesFromConfig("./src/services/tsconfig.json");
var cancellationTokenSources = filesFromConfig(path.join(serverDirectory, "cancellationToken/tsconfig.json"));
var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typingsInstaller/tsconfig.json"));
var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json"));
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"));
var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json"));
var harnessSources = filesFromConfig("./src/harness/tsconfig.json");
compileOutputConfigFile('src/parser/tsconfig.json');
compileOutputConfigFile('src/compiler/tsconfig.json');
compileOutputConfigFile('src/services/tsconfig.json');
compileOutputConfigFile('src/typescriptServices/tsconfig.json', [], [copyright], function () {
jake.cpR(servicesFile, nodePackageFile, { silent: true });
prependFile(copyright, standaloneDefinitionsFile);
// Stanalone/web definition file using global 'ts' namespace
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, { silent: true });
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
definitionFileContents = removeConstModifierFromEnumDeclarations(definitionFileContents);
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
// Official node package definition file, pointed to by 'typings' in package.json
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
var nodeDefinitionsFileContents = definitionFileContents + "\nexport = ts;";
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
// Node package definition file to be distributed without the package. Created by replacing
// 'ts' namespace with '"typescript"' as a module.
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
});
compileOutputConfigFile('src/core/tsconfig.json');
compileOutputConfigFile('src/harness/tsconfig.json');
compileOutputConfigFile('src/testRunner/tsconfig.json');
compileOutputConfigFile('src/tsc/tsconfig.json', [], [copyright]);
compileOutputConfigFile('src/server/tsconfig.json', [], [copyright]);
compileOutputConfigFile('src/tsserver/tsconfig.json', [], [copyright]);
compileOutputConfigFile('src/tsserverLibrary/tsconfig.json', [], [], function () {
prependFile(copyright, tsserverLibraryDefinitionFile);
// Appending exports at the end of the server library
var tsserverLibraryDefinitionFileContents =
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
"\nexport = ts;" +
"\nexport as namespace ts;";
tsserverLibraryDefinitionFileContents = removeConstModifierFromEnumDeclarations(tsserverLibraryDefinitionFileContents);
fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents);
});
compileOutputConfigFile('src/typingsInstaller/tsconfig.json');
compileOutputConfigFile('src/typingsInstallerCore/tsconfig.json');
compileOutputConfigFile('src/watchGuard/tsconfig.json');
compileConfigFile('built/local/cancellationToken.js', [], 'src/cancellationToken/tsconfig.json', [copyright]);
var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json');
@@ -173,6 +226,51 @@ var compilerFilename = "tsc.js";
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
function compileOutputConfigFile(configFile, prereqs, prefixes, callback) {
const info = filesAndOutputFromConfig(configFile);
compileConfigFile(info.output, prereqs, configFile, prefixes, false, callback);
}
function compileConfigFile(outFile, prereqs, configFile, prefixes, useBuiltCompiler = false, callback) {
const allPrereqs = filesFromConfig(configFile).concat(prereqs || []).concat(configFile);
outFile = outFile.replace(/\//g, "\\");
file(outFile, allPrereqs, function () {
const startCompileTime = mark();
const compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
const cmd = `${host} ${compilerPath} -b -v ${configFile}`;
console.log(cmd + "\n");
var ex = jake.createExec([cmd]);
// Add listeners for output and error
ex.addListener("stdout", function (output) {
process.stdout.write(output);
});
ex.addListener("stderr", function (error) {
process.stderr.write(error);
});
ex.addListener("cmdEnd", function () {
if (!useDebugMode && prefixes && fs.existsSync(outFile)) {
for (var i in prefixes) {
prependFile(prefixes[i], outFile);
}
}
if (callback) {
callback();
}
measure(startCompileTime);
complete();
});
ex.addListener("error", function () {
fs.unlinkSync(outFile);
fail("Compilation of " + outFile + " unsuccessful");
measure(startCompileTime);
});
ex.run();
}, { async: true });
}
/**
* Compiles a file from a list of sources
* @param {string} outFile the target file name
@@ -194,7 +292,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
* @param {function(): void} [callback] a function to execute after the compilation process ends
*/
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
file(outFile, prereqs, function() {
file(outFile, prereqs, function () {
var startCompileTime = mark();
opts = opts || {};
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
@@ -245,7 +343,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
if (opts.stripInternal) {
options += " --stripInternal";
}
options += " --target es5";
options += " --target es5";
if (opts.lib) {
options += " --lib " + opts.lib;
}
@@ -310,29 +408,18 @@ task("lib", libraryTargets);
// Generate diagnostics
var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js");
var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts");
var processDiagnosticMessagesSources = filesFromConfig("./scripts/processDiagnosticMessages.tsconfig.json");
var diagnosticMessagesJson = path.join(parserDirectory, "diagnosticMessages.json");
var diagnosticInfoMapTs = path.join(parserDirectory, "diagnosticInformationMap.generated.ts");
compileConfigFile(processDiagnosticMessagesJs, [], "./scripts/processDiagnosticMessages.tsconfig.json")
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json");
var generatedDiagnosticMessagesJSON = path.join(parserDirectory, "diagnosticMessages.generated.json");
var builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "diagnosticMessages.generated.json");
file(processDiagnosticMessagesTs);
// processDiagnosticMessages script
compileFile(processDiagnosticMessagesJs,
processDiagnosticMessagesSources,
processDiagnosticMessagesSources,
[],
/*useBuiltCompiler*/ false);
// Localize diagnostics script
var generateLocalizedDiagnosticMessagesJs = path.join(scriptsDirectory, "generateLocalizedDiagnosticMessages.js");
var generateLocalizedDiagnosticMessagesTs = path.join(scriptsDirectory, "generateLocalizedDiagnosticMessages.ts");
file(generateLocalizedDiagnosticMessagesTs);
compileFile(generateLocalizedDiagnosticMessagesJs,
[generateLocalizedDiagnosticMessagesTs],
[generateLocalizedDiagnosticMessagesTs],
@@ -373,11 +460,11 @@ compileFile(buildProtocolJs,
/*useBuiltCompiler*/ false,
{ noOutFile: true, lib: "es6" });
file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts], function() {
file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts], function () {
var protocolTs = path.join(serverDirectory, "protocol.ts");
var cmd = host + " " + buildProtocolJs + " "+ protocolTs + " " + typescriptServicesDts + " " + buildProtocolDts;
var cmd = host + " " + buildProtocolJs + " " + protocolTs + " " + typescriptServicesDts + " " + buildProtocolDts;
console.log(cmd);
var ex = jake.createExec([cmd]);
// Add listeners for output and error
@@ -390,6 +477,9 @@ file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts]
ex.addListener("cmdEnd", function () {
complete();
});
ex.addListener("error", function (e, status) {
fail("Process exited with code " + status);
});
ex.run();
}, { async: true });
@@ -482,65 +572,22 @@ task("importDefinitelyTypedTests", [importDefinitelyTypedTestsJs], function () {
exec(cmd);
}, { async: true });
// Local target to build the compiler and services
var tscFile = path.join(builtLocalDirectory, compilerFilename);
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
var tscFile = path.join(builtLocalDirectory, "tsc.js");
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js");
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/[copyright],
/*useBuiltCompiler*/ true,
/*opts*/ {
noOutFile: false,
generateDeclarations: true,
preserveConstEnums: true,
keepComments: true,
noResolve: false,
stripInternal: true
},
/*callback*/ function () {
jake.cpR(servicesFile, nodePackageFile, { silent: true });
prependFile(copyright, standaloneDefinitionsFile);
// Stanalone/web definition file using global 'ts' namespace
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, { silent: true });
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
definitionFileContents = removeConstModifierFromEnumDeclarations(definitionFileContents);
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
// Official node package definition file, pointed to by 'typings' in package.json
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
var nodeDefinitionsFileContents = definitionFileContents + "\nexport = ts;";
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
// Node package definition file to be distributed without the package. Created by replacing
// 'ts' namespace with '"typescript"' as a module.
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
});
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
file(typescriptServicesDts, [servicesFile]);
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: true, lib: "es6" });
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6" });
var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js");
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6" });
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true, lib: "es6" });
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
file(typesMapOutputPath, /** @type {*} */(function() {
file(typesMapOutputPath, /** @type {*} */(function () {
var content = fs.readFileSync(path.join(serverDirectory, 'typesMap.json'));
// Validate that it's valid JSON
try {
@@ -550,25 +597,6 @@ file(typesMapOutputPath, /** @type {*} */(function() {
}
fs.writeFileSync(typesMapOutputPath, content);
}));
compileFile(
tsserverLibraryFile,
languageServiceLibrarySources,
[builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets),
/*prefixes*/[copyright],
/*useBuiltCompiler*/ true,
{ noOutFile: false, generateDeclarations: true, stripInternal: true, preserveConstEnums: true, keepComments: true },
/*callback*/ function () {
prependFile(copyright, tsserverLibraryDefinitionFile);
// Appending exports at the end of the server library
var tsserverLibraryDefinitionFileContents =
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
"\nexport = ts;" +
"\nexport as namespace ts;";
tsserverLibraryDefinitionFileContents = removeConstModifierFromEnumDeclarations(tsserverLibraryDefinitionFileContents);
fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents);
});
// Local target to build the language service server library
desc("Builds language service server library");
@@ -586,7 +614,7 @@ task("build-fold-end", [], function () {
// Local target to build the compiler and services
desc("Builds the full compiler and services");
task("local", ["build-fold-start", "generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile, buildProtocolDts, builtGeneratedDiagnosticMessagesJSON, "lssl", "localize", "build-fold-end"]);
task("local", ["build-fold-start", "generate-diagnostics", "lib", tscFile, servicesFile, typingsInstallerFile, nodeDefinitionsFile, serverFile, buildProtocolDts, builtGeneratedDiagnosticMessagesJSON, run, "lssl", "localize", "build-fold-end"]);
// Local target to build only tsc.js
desc("Builds only the compiler");
@@ -655,7 +683,15 @@ task("LKG", ["clean", "release", "local"].concat(libraryTargets), () => {
}
// Copy all the targets into the LKG directory
jake.mkdirP(LKGDirectory);
expectedFiles.forEach(f => jake.cpR(f, LKGDirectory));
expectedFiles.forEach(f => {
if (f.endsWith(".d.ts")) {
// remove-internal all the .d.ts files
jake.createExec([host, "node_modules/remove-internal/lib/cli.js", f, "--outdir", LKGDirectory]).run();
}
else {
jake.cpR(f, LKGDirectory);
}
});
const sizeAfter = getDirSize(LKGDirectory);
if (sizeAfter > (sizeBefore * 1.10)) {
@@ -666,16 +702,6 @@ task("LKG", ["clean", "release", "local"].concat(libraryTargets), () => {
// Test directory
directory(builtLocalDirectory);
// Task to build the tests infrastructure using the built compiler
var run = path.join(builtLocalDirectory, "run.js");
compileFile(
/*outFile*/ run,
/*source*/ harnessSources,
/*prereqs*/[builtLocalDirectory, tscFile, tsserverLibraryFile].concat(libraryTargets).concat(servicesSources).concat(harnessSources),
/*prefixes*/[],
/*useBuiltCompiler:*/ true,
/*opts*/ { types: ["node", "mocha", "chai"], lib: "es6" });
var internalTests = "internal/";
var localBaseline = "tests/baselines/local/";
@@ -888,12 +914,12 @@ function runConsoleTests(defaultReporter, runInParallel) {
}
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], function () {
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory, run], function () {
runConsoleTests('min', /*runInParallel*/ true);
}, { async: true });
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true bail=false dirty=false.");
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
task("runtests", ["build-rules", "tests", builtLocalDirectory, run], function () {
runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false);
}, { async: true });
@@ -911,7 +937,7 @@ var nodeServerInFile = "tests/webTestServer.ts";
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true, lib: "es6" });
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
task("browserify", [], function() {
task("browserify", [], function () {
// Shell out to `gulp`, since we do the work to handle sourcemaps correctly w/o inline maps there
var cmd = 'gulp browserify --silent';
exec(cmd);
@@ -921,7 +947,7 @@ desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is
task("runtests-browser", ["browserify", nodeServerOutFile], function () {
cleanTestDirs();
host = "node";
var browser = process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome");
var browser = process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome");
var runners = process.env.runners || process.env.runner || process.env.ru;
var tests = process.env.test || process.env.tests || process.env.t;
var light = process.env.light || false;
+11 -4
View File
@@ -46,7 +46,7 @@ class DeclarationsWalker {
if (!s) {
return;
}
if (s.name === "Array") {
if (s.name === "Array" || s.name === "ReadOnlyArray") {
// we should process type argument instead
return this.processType((<any>type).typeArguments[0]);
}
@@ -55,7 +55,7 @@ class DeclarationsWalker {
if (declarations) {
for (const decl of declarations) {
const sourceFile = decl.getSourceFile();
if (sourceFile === this.protocolFile || path.basename(sourceFile.fileName) === "lib.d.ts") {
if (sourceFile === this.protocolFile || /lib\.(.*)\.d.ts/.test(path.basename(sourceFile.fileName))) {
return;
}
if (decl.kind === ts.SyntaxKind.EnumDeclaration && !isStringEnum(decl as ts.EnumDeclaration)) {
@@ -131,13 +131,20 @@ function writeProtocolFile(outputFile: string, protocolTs: string, typeScriptSer
const program = ts.createProgram([protocolTs, typeScriptServicesDts], options);
let protocolDts: string | undefined;
program.emit(program.getSourceFile(protocolTs), (file, content) => {
const emitResult = program.emit(program.getSourceFile(protocolTs), (file, content) => {
if (endsWith(file, ".d.ts")) {
protocolDts = content;
}
});
if (protocolDts === undefined) {
throw new Error(`Declaration file for protocol.ts is not generated`)
const diagHost: ts.FormatDiagnosticsHost = {
getCanonicalFileName: function (f) { return f; },
getCurrentDirectory: function() { return '.'; },
getNewLine: function() { return "\r\n"; }
}
const diags = emitResult.diagnostics.map(d => ts.formatDiagnostic(d, diagHost)).join("\r\n");
throw new Error(`Declaration file for protocol.ts is not generated:\r\n${diags}`);
}
return protocolDts;
}
-1
View File
@@ -6,7 +6,6 @@
"files": [
"binder.ts",
"symbolWalker.ts",
"moduleNameResolver.ts",
"checker.ts",
"factory.ts",
"visitor.ts",
+1
View File
@@ -15,6 +15,7 @@
{ "path": "../parser" },
{ "path": "../compiler" },
{ "path": "../services" },
{ "path": "../jsTyping" },
{ "path": "../server" },
{ "path": "../typingsInstallerCore" }
],
File renamed without changes.
File renamed without changes.
File renamed without changes.
+23
View File
@@ -0,0 +1,23 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outFile": "../../built/local/jsTyping.js",
"types": [
"node"
],
"lib": [
"es6",
"scripthost"
]
},
"references": [
{ "path": "../core" },
{ "path": "../parser" }
],
"files": [
"shared.ts",
"types.ts",
"jsTyping.ts",
"semver.ts"
]
}
+110
View File
@@ -0,0 +1,110 @@
declare namespace ts.server {
export type ActionSet = "action::set";
export type ActionInvalidate = "action::invalidate";
export type ActionPackageInstalled = "action::packageInstalled";
export type EventTypesRegistry = "event::typesRegistry";
export type EventBeginInstallTypes = "event::beginInstallTypes";
export type EventEndInstallTypes = "event::endInstallTypes";
export type EventInitializationFailed = "event::initializationFailed";
export interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
" __sortedArrayBrand": any;
}
export interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
}
export interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
}
/* @internal */
export type TypingInstallerRequestUnion = DiscoverTypings | CloseProject | TypesRegistryRequest | InstallPackageRequest;
export interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
readonly fileNames: string[];
readonly projectRootPath: Path;
readonly compilerOptions: CompilerOptions;
readonly typeAcquisition: TypeAcquisition;
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly cachePath?: string;
readonly kind: "discover";
}
export interface CloseProject extends TypingInstallerRequestWithProjectName {
readonly kind: "closeProject";
}
export interface TypesRegistryRequest {
readonly kind: "typesRegistry";
}
export interface InstallPackageRequest extends TypingInstallerRequestWithProjectName {
readonly kind: "installPackage";
readonly fileName: Path;
readonly packageName: string;
readonly projectRootPath: Path;
}
/* @internal */
export interface TypesRegistryResponse extends TypingInstallerResponse {
readonly kind: EventTypesRegistry;
readonly typesRegistry: MapLike<MapLike<string>>;
}
export interface PackageInstalledResponse extends ProjectResponse {
readonly kind: ActionPackageInstalled;
readonly success: boolean;
readonly message: string;
}
export interface InitializationFailedResponse extends TypingInstallerResponse {
readonly kind: EventInitializationFailed;
readonly message: string;
}
export interface ProjectResponse extends TypingInstallerResponse {
readonly projectName: string;
}
export interface InvalidateCachedTypings extends ProjectResponse {
readonly kind: ActionInvalidate;
}
export interface InstallTypes extends ProjectResponse {
readonly kind: EventBeginInstallTypes | EventEndInstallTypes;
readonly eventId: number;
readonly typingsInstallerVersion: string;
readonly packagesToInstall: ReadonlyArray<string>;
}
export interface BeginInstallTypes extends InstallTypes {
readonly kind: EventBeginInstallTypes;
}
export interface EndInstallTypes extends InstallTypes {
readonly kind: EventEndInstallTypes;
readonly installSuccess: boolean;
}
/* @internal */
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
useCaseSensitiveFileNames: boolean;
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
}
export interface SetTypings extends ProjectResponse {
readonly typeAcquisition: TypeAcquisition;
readonly compilerOptions: CompilerOptions;
readonly typings: string[];
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly kind: ActionSet;
}
/* @internal */
export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse;
}
File renamed without changes.
+2 -1
View File
@@ -10,7 +10,8 @@
"scanner.ts",
"utilities.ts",
"parser.ts",
"commandLineParser.ts"
"commandLineParser.ts",
"moduleNameResolver.ts"
],
"references": [
{ "path": "../core" }
+1 -1
View File
@@ -12,11 +12,11 @@
{ "path": "../core" },
{ "path": "../parser" },
{ "path": "../compiler" },
{ "path": "../jsTyping" },
{ "path": "../services" }
],
"files": [
"types.ts",
"shared.ts",
"utilities.ts",
"protocol.ts",
"scriptInfo.ts",
-108
View File
@@ -17,112 +17,4 @@ declare namespace ts.server {
trace?(s: string): void;
require?(initialPath: string, moduleName: string): RequireResult;
}
export interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
" __sortedArrayBrand": any;
}
export interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
}
/* @internal */
export type TypingInstallerRequestUnion = DiscoverTypings | CloseProject | TypesRegistryRequest | InstallPackageRequest;
export interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
readonly fileNames: string[];
readonly projectRootPath: Path;
readonly compilerOptions: CompilerOptions;
readonly typeAcquisition: TypeAcquisition;
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly cachePath?: string;
readonly kind: "discover";
}
export interface CloseProject extends TypingInstallerRequestWithProjectName {
readonly kind: "closeProject";
}
export interface TypesRegistryRequest {
readonly kind: "typesRegistry";
}
export interface InstallPackageRequest extends TypingInstallerRequestWithProjectName {
readonly kind: "installPackage";
readonly fileName: Path;
readonly packageName: string;
readonly projectRootPath: Path;
}
export type ActionSet = "action::set";
export type ActionInvalidate = "action::invalidate";
export type ActionPackageInstalled = "action::packageInstalled";
export type EventTypesRegistry = "event::typesRegistry";
export type EventBeginInstallTypes = "event::beginInstallTypes";
export type EventEndInstallTypes = "event::endInstallTypes";
export type EventInitializationFailed = "event::initializationFailed";
export interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
}
/* @internal */
export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse;
/* @internal */
export interface TypesRegistryResponse extends TypingInstallerResponse {
readonly kind: EventTypesRegistry;
readonly typesRegistry: MapLike<MapLike<string>>;
}
export interface PackageInstalledResponse extends ProjectResponse {
readonly kind: ActionPackageInstalled;
readonly success: boolean;
readonly message: string;
}
export interface InitializationFailedResponse extends TypingInstallerResponse {
readonly kind: EventInitializationFailed;
readonly message: string;
}
export interface ProjectResponse extends TypingInstallerResponse {
readonly projectName: string;
}
export interface SetTypings extends ProjectResponse {
readonly typeAcquisition: TypeAcquisition;
readonly compilerOptions: CompilerOptions;
readonly typings: string[];
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly kind: ActionSet;
}
export interface InvalidateCachedTypings extends ProjectResponse {
readonly kind: ActionInvalidate;
}
export interface InstallTypes extends ProjectResponse {
readonly kind: EventBeginInstallTypes | EventEndInstallTypes;
readonly eventId: number;
readonly typingsInstallerVersion: string;
readonly packagesToInstall: ReadonlyArray<string>;
}
export interface BeginInstallTypes extends InstallTypes {
readonly kind: EventBeginInstallTypes;
}
export interface EndInstallTypes extends InstallTypes {
readonly kind: EventEndInstallTypes;
readonly installSuccess: boolean;
}
/* @internal */
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
useCaseSensitiveFileNames: boolean;
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
}
}
+3 -4
View File
@@ -1,12 +1,13 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outFile": "../../built/local/typescriptServices.js"
"outFile": "../../built/local/services.js"
},
"references": [
{ "path": "../core" },
{ "path": "../parser" },
{ "path": "../compiler" }
{ "path": "../compiler" },
{ "path": "../jsTyping" },
],
"files": [
"types.ts",
@@ -21,8 +22,6 @@
"getEditsForFileRename.ts",
"goToDefinition.ts",
"jsDoc.ts",
"semver.ts",
"jsTyping.ts",
"navigateTo.ts",
"navigationBar.ts",
"organizeImports.ts",
+58 -4
View File
@@ -4,6 +4,7 @@
"outFile": "../../built/local/run.js",
"composite": false,
"declaration": false,
"declarationMap": false,
"types": [
"node", "mocha", "chai"
],
@@ -17,10 +18,10 @@
{ "path": "../parser", "prepend": true },
{ "path": "../compiler", "prepend": true },
{ "path": "../services", "prepend": true },
{ "path": "../jsTyping", "prepend": true },
{ "path": "../server", "prepend": true },
{ "path": "../harness", "prepend": true },
{ "path": "../unittests", "prepend": true },
{ "path": "../typingsInstallerCore", "prepend": true }
{ "path": "../typingsInstallerCore", "prepend": true },
{ "path": "../harness", "prepend": true }
],
"files": [
@@ -35,6 +36,59 @@
"parallel/worker.ts",
"parallel/shared.ts",
"runner.ts"
"runner.ts",
"unittests/extractTestHelpers.ts",
"unittests/tsserverProjectSystem.ts",
"unittests/typingsInstaller.ts",
"unittests/asserts.ts",
"unittests/base64.ts",
"unittests/builder.ts",
"unittests/cancellableLanguageServiceOperations.ts",
"unittests/commandLineParsing.ts",
"unittests/compileOnSave.ts",
"unittests/configurationExtension.ts",
"unittests/convertCompilerOptionsFromJson.ts",
"unittests/convertToBase64.ts",
"unittests/convertTypeAcquisitionFromJson.ts",
"unittests/customTransforms.ts",
"unittests/extractConstants.ts",
"unittests/extractFunctions.ts",
"unittests/extractRanges.ts",
"unittests/hostNewLineSupport.ts",
"unittests/incrementalParser.ts",
"unittests/initializeTSConfig.ts",
"unittests/jsDocParsing.ts",
"unittests/languageService.ts",
"unittests/matchFiles.ts",
"unittests/moduleResolution.ts",
"unittests/organizeImports.ts",
"unittests/paths.ts",
"unittests/printer.ts",
"unittests/programMissingFiles.ts",
"unittests/programNoParseFalsyFileNames.ts",
"unittests/projectErrors.ts",
"unittests/projectReferences.ts",
"unittests/publicApi.ts",
"unittests/reuseProgramStructure.ts",
"unittests/session.ts",
"unittests/symbolWalker.ts",
"unittests/telemetry.ts",
"unittests/textChanges.ts",
"unittests/textStorage.ts",
"unittests/transform.ts",
"unittests/transpile.ts",
"unittests/tsbuild.ts",
"unittests/tsconfigParsing.ts",
"unittests/tscWatchMode.ts",
"unittests/versionCache.ts",
"unittests/evaluation/asyncArrow.ts",
"unittests/evaluation/asyncGenerator.ts",
"unittests/evaluation/forAwaitOf.ts",
"unittests/services/colorization.ts",
"unittests/services/documentRegistry.ts",
"unittests/services/patternMatcher.ts",
"unittests/services/preProcessFile.ts"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -197,7 +197,7 @@ and grew 1cm per day`;
before(() => {
// Use scanner.ts, decent size, does not change frequently
const testFileName = "src/compiler/scanner.ts";
const testFileName = "src/parser/scanner.ts";
testContent = Harness.IO.readFile(testFileName)!;
const totalChars = testContent.length;
assert.isTrue(totalChars > 0, "Failed to read test file.");
+1
View File
@@ -5,6 +5,7 @@
"target": "es5",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"composite": true,
"noEmitOnError": true,
+1
View File
@@ -15,6 +15,7 @@
{ "path": "../parser", "prepend": true },
{ "path": "../compiler", "prepend": true },
{ "path": "../services", "prepend": true },
{ "path": "../jsTyping", "prepend": true },
{ "path": "../server", "prepend": true }
]
}
+2 -1
View File
@@ -2,7 +2,7 @@
"extends": "../tsconfig-base",
"compilerOptions": {
"outFile": "../../built/local/tsserverGlobalLibrary.js",
"outFile": "../../built/local/tsserverlibrary.js",
"types": [
"node"
]
@@ -13,6 +13,7 @@
{ "path": "../parser", "prepend": true },
{ "path": "../compiler", "prepend": true },
{ "path": "../services", "prepend": true },
{ "path": "../jsTyping", "prepend": true },
{ "path": "../server", "prepend": true }
]
}
+1
View File
@@ -0,0 +1 @@
// Delete soon
+20
View File
@@ -0,0 +1,20 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outFile": "../../built/local/typescriptServices.js",
"types": [
"node"
]
},
"files": [
"empty.ts"
],
"references": [
{ "path": "../core", "prepend": true },
{ "path": "../parser", "prepend": true },
{ "path": "../compiler", "prepend": true },
{ "path": "../jsTyping", "prepend": true },
{ "path": "../services", "prepend": true },
]
}
+1 -6
View File
@@ -14,12 +14,7 @@
"references": [
{ "path": "../core", "prepend": true },
{ "path": "../parser", "prepend": true },
/* todo - only need jsTyping and semver from this compilation! */
{ "path": "../compiler", "prepend": true },
{ "path": "../services", "prepend": true },
{ "path": "../server", "prepend": true },
{ "path": "../jsTyping", "prepend": true },
{ "path": "../typingsInstallerCore", "prepend": true }
],
"files": [
+1 -5
View File
@@ -13,11 +13,7 @@
"references": [
{ "path": "../core" },
{ "path": "../parser" },
/* todo - only need jsTyping and semver from this compilation! */
{ "path": "../compiler" },
{ "path": "../services" },
{ "path": "../server" }
{ "path": "../jsTyping" }
],
"files": [
"typingsInstaller.ts"
-23
View File
@@ -1,23 +0,0 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outFile": "../../built/local/unittests.js",
"types": [
"node", "mocha", "chai"
],
"lib": [
"es6",
"scripthost"
]
},
"references": [
{ "path": "../core" },
{ "path": "../parser" },
{ "path": "../compiler" },
{ "path": "../services" },
{ "path": "../server" },
{ "path": "../typingsInstallerCore" },
{ "path": "../harness" }
],
"include": ["*.ts", "**/*.ts"]
}