diff --git a/Jakefile.js b/Jakefile.js index a6483355c73..704be5a15bd 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -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|] 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; diff --git a/scripts/buildProtocol.ts b/scripts/buildProtocol.ts index 65bb0f01083..7d32473f723 100644 --- a/scripts/buildProtocol.ts +++ b/scripts/buildProtocol.ts @@ -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((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; } diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 8a7ba50c62c..718de7e257a 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -6,7 +6,6 @@ "files": [ "binder.ts", "symbolWalker.ts", - "moduleNameResolver.ts", "checker.ts", "factory.ts", "visitor.ts", diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index a2f12e244af..b1f2558f861 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -15,6 +15,7 @@ { "path": "../parser" }, { "path": "../compiler" }, { "path": "../services" }, + { "path": "../jsTyping" }, { "path": "../server" }, { "path": "../typingsInstallerCore" } ], diff --git a/src/services/jsTyping.ts b/src/jsTyping/jsTyping.ts similarity index 100% rename from src/services/jsTyping.ts rename to src/jsTyping/jsTyping.ts diff --git a/src/services/semver.ts b/src/jsTyping/semver.ts similarity index 100% rename from src/services/semver.ts rename to src/jsTyping/semver.ts diff --git a/src/server/shared.ts b/src/jsTyping/shared.ts similarity index 100% rename from src/server/shared.ts rename to src/jsTyping/shared.ts diff --git a/src/jsTyping/tsconfig.json b/src/jsTyping/tsconfig.json new file mode 100644 index 00000000000..86ebfe8af5a --- /dev/null +++ b/src/jsTyping/tsconfig.json @@ -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" + ] +} diff --git a/src/jsTyping/types.ts b/src/jsTyping/types.ts new file mode 100644 index 00000000000..4e00c2eb6f5 --- /dev/null +++ b/src/jsTyping/types.ts @@ -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 extends ReadonlyArray { + " __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; + 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>; + } + + 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; + } + + 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; + readonly kind: ActionSet; + } + + /* @internal */ + export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse; +} diff --git a/src/compiler/moduleNameResolver.ts b/src/parser/moduleNameResolver.ts similarity index 100% rename from src/compiler/moduleNameResolver.ts rename to src/parser/moduleNameResolver.ts diff --git a/src/parser/tsconfig.json b/src/parser/tsconfig.json index 4ccdc05fd27..05c61d02408 100644 --- a/src/parser/tsconfig.json +++ b/src/parser/tsconfig.json @@ -10,7 +10,8 @@ "scanner.ts", "utilities.ts", "parser.ts", - "commandLineParser.ts" + "commandLineParser.ts", + "moduleNameResolver.ts" ], "references": [ { "path": "../core" } diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 2448371dc3e..ba301c28341 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -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", diff --git a/src/server/types.ts b/src/server/types.ts index 184a121522e..ce68a33d3b7 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -17,112 +17,4 @@ declare namespace ts.server { trace?(s: string): void; require?(initialPath: string, moduleName: string): RequireResult; } - - export interface SortedReadonlyArray extends ReadonlyArray { - " __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; - 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>; - } - - 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; - 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; - } - - 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; - } } diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 7b0b5bc6bc6..7149a3dc009 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -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", diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index cfde1107387..fd5c98561f0 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -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" ] } diff --git a/src/unittests/asserts.ts b/src/testRunner/unittests/asserts.ts similarity index 100% rename from src/unittests/asserts.ts rename to src/testRunner/unittests/asserts.ts diff --git a/src/unittests/base64.ts b/src/testRunner/unittests/base64.ts similarity index 100% rename from src/unittests/base64.ts rename to src/testRunner/unittests/base64.ts diff --git a/src/unittests/builder.ts b/src/testRunner/unittests/builder.ts similarity index 100% rename from src/unittests/builder.ts rename to src/testRunner/unittests/builder.ts diff --git a/src/unittests/cancellableLanguageServiceOperations.ts b/src/testRunner/unittests/cancellableLanguageServiceOperations.ts similarity index 100% rename from src/unittests/cancellableLanguageServiceOperations.ts rename to src/testRunner/unittests/cancellableLanguageServiceOperations.ts diff --git a/src/unittests/commandLineParsing.ts b/src/testRunner/unittests/commandLineParsing.ts similarity index 100% rename from src/unittests/commandLineParsing.ts rename to src/testRunner/unittests/commandLineParsing.ts diff --git a/src/unittests/compileOnSave.ts b/src/testRunner/unittests/compileOnSave.ts similarity index 100% rename from src/unittests/compileOnSave.ts rename to src/testRunner/unittests/compileOnSave.ts diff --git a/src/unittests/configurationExtension.ts b/src/testRunner/unittests/configurationExtension.ts similarity index 100% rename from src/unittests/configurationExtension.ts rename to src/testRunner/unittests/configurationExtension.ts diff --git a/src/unittests/convertCompilerOptionsFromJson.ts b/src/testRunner/unittests/convertCompilerOptionsFromJson.ts similarity index 100% rename from src/unittests/convertCompilerOptionsFromJson.ts rename to src/testRunner/unittests/convertCompilerOptionsFromJson.ts diff --git a/src/unittests/convertToBase64.ts b/src/testRunner/unittests/convertToBase64.ts similarity index 100% rename from src/unittests/convertToBase64.ts rename to src/testRunner/unittests/convertToBase64.ts diff --git a/src/unittests/convertTypeAcquisitionFromJson.ts b/src/testRunner/unittests/convertTypeAcquisitionFromJson.ts similarity index 100% rename from src/unittests/convertTypeAcquisitionFromJson.ts rename to src/testRunner/unittests/convertTypeAcquisitionFromJson.ts diff --git a/src/unittests/customTransforms.ts b/src/testRunner/unittests/customTransforms.ts similarity index 100% rename from src/unittests/customTransforms.ts rename to src/testRunner/unittests/customTransforms.ts diff --git a/src/unittests/evaluation/asyncArrow.ts b/src/testRunner/unittests/evaluation/asyncArrow.ts similarity index 100% rename from src/unittests/evaluation/asyncArrow.ts rename to src/testRunner/unittests/evaluation/asyncArrow.ts diff --git a/src/unittests/evaluation/asyncGenerator.ts b/src/testRunner/unittests/evaluation/asyncGenerator.ts similarity index 100% rename from src/unittests/evaluation/asyncGenerator.ts rename to src/testRunner/unittests/evaluation/asyncGenerator.ts diff --git a/src/unittests/evaluation/forAwaitOf.ts b/src/testRunner/unittests/evaluation/forAwaitOf.ts similarity index 100% rename from src/unittests/evaluation/forAwaitOf.ts rename to src/testRunner/unittests/evaluation/forAwaitOf.ts diff --git a/src/unittests/extractConstants.ts b/src/testRunner/unittests/extractConstants.ts similarity index 100% rename from src/unittests/extractConstants.ts rename to src/testRunner/unittests/extractConstants.ts diff --git a/src/unittests/extractFunctions.ts b/src/testRunner/unittests/extractFunctions.ts similarity index 100% rename from src/unittests/extractFunctions.ts rename to src/testRunner/unittests/extractFunctions.ts diff --git a/src/unittests/extractRanges.ts b/src/testRunner/unittests/extractRanges.ts similarity index 100% rename from src/unittests/extractRanges.ts rename to src/testRunner/unittests/extractRanges.ts diff --git a/src/unittests/extractTestHelpers.ts b/src/testRunner/unittests/extractTestHelpers.ts similarity index 100% rename from src/unittests/extractTestHelpers.ts rename to src/testRunner/unittests/extractTestHelpers.ts diff --git a/src/unittests/hostNewLineSupport.ts b/src/testRunner/unittests/hostNewLineSupport.ts similarity index 100% rename from src/unittests/hostNewLineSupport.ts rename to src/testRunner/unittests/hostNewLineSupport.ts diff --git a/src/unittests/incrementalParser.ts b/src/testRunner/unittests/incrementalParser.ts similarity index 100% rename from src/unittests/incrementalParser.ts rename to src/testRunner/unittests/incrementalParser.ts diff --git a/src/unittests/initializeTSConfig.ts b/src/testRunner/unittests/initializeTSConfig.ts similarity index 100% rename from src/unittests/initializeTSConfig.ts rename to src/testRunner/unittests/initializeTSConfig.ts diff --git a/src/unittests/jsDocParsing.ts b/src/testRunner/unittests/jsDocParsing.ts similarity index 100% rename from src/unittests/jsDocParsing.ts rename to src/testRunner/unittests/jsDocParsing.ts diff --git a/src/unittests/languageService.ts b/src/testRunner/unittests/languageService.ts similarity index 100% rename from src/unittests/languageService.ts rename to src/testRunner/unittests/languageService.ts diff --git a/src/unittests/matchFiles.ts b/src/testRunner/unittests/matchFiles.ts similarity index 100% rename from src/unittests/matchFiles.ts rename to src/testRunner/unittests/matchFiles.ts diff --git a/src/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts similarity index 100% rename from src/unittests/moduleResolution.ts rename to src/testRunner/unittests/moduleResolution.ts diff --git a/src/unittests/organizeImports.ts b/src/testRunner/unittests/organizeImports.ts similarity index 100% rename from src/unittests/organizeImports.ts rename to src/testRunner/unittests/organizeImports.ts diff --git a/src/unittests/paths.ts b/src/testRunner/unittests/paths.ts similarity index 100% rename from src/unittests/paths.ts rename to src/testRunner/unittests/paths.ts diff --git a/src/unittests/printer.ts b/src/testRunner/unittests/printer.ts similarity index 100% rename from src/unittests/printer.ts rename to src/testRunner/unittests/printer.ts diff --git a/src/unittests/programMissingFiles.ts b/src/testRunner/unittests/programMissingFiles.ts similarity index 100% rename from src/unittests/programMissingFiles.ts rename to src/testRunner/unittests/programMissingFiles.ts diff --git a/src/unittests/programNoParseFalsyFileNames.ts b/src/testRunner/unittests/programNoParseFalsyFileNames.ts similarity index 100% rename from src/unittests/programNoParseFalsyFileNames.ts rename to src/testRunner/unittests/programNoParseFalsyFileNames.ts diff --git a/src/unittests/projectErrors.ts b/src/testRunner/unittests/projectErrors.ts similarity index 100% rename from src/unittests/projectErrors.ts rename to src/testRunner/unittests/projectErrors.ts diff --git a/src/unittests/projectReferences.ts b/src/testRunner/unittests/projectReferences.ts similarity index 100% rename from src/unittests/projectReferences.ts rename to src/testRunner/unittests/projectReferences.ts diff --git a/src/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts similarity index 100% rename from src/unittests/publicApi.ts rename to src/testRunner/unittests/publicApi.ts diff --git a/src/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts similarity index 100% rename from src/unittests/reuseProgramStructure.ts rename to src/testRunner/unittests/reuseProgramStructure.ts diff --git a/src/unittests/services/colorization.ts b/src/testRunner/unittests/services/colorization.ts similarity index 100% rename from src/unittests/services/colorization.ts rename to src/testRunner/unittests/services/colorization.ts diff --git a/src/unittests/services/documentRegistry.ts b/src/testRunner/unittests/services/documentRegistry.ts similarity index 100% rename from src/unittests/services/documentRegistry.ts rename to src/testRunner/unittests/services/documentRegistry.ts diff --git a/src/unittests/services/patternMatcher.ts b/src/testRunner/unittests/services/patternMatcher.ts similarity index 100% rename from src/unittests/services/patternMatcher.ts rename to src/testRunner/unittests/services/patternMatcher.ts diff --git a/src/unittests/services/preProcessFile.ts b/src/testRunner/unittests/services/preProcessFile.ts similarity index 100% rename from src/unittests/services/preProcessFile.ts rename to src/testRunner/unittests/services/preProcessFile.ts diff --git a/src/unittests/session.ts b/src/testRunner/unittests/session.ts similarity index 100% rename from src/unittests/session.ts rename to src/testRunner/unittests/session.ts diff --git a/src/unittests/symbolWalker.ts b/src/testRunner/unittests/symbolWalker.ts similarity index 100% rename from src/unittests/symbolWalker.ts rename to src/testRunner/unittests/symbolWalker.ts diff --git a/src/unittests/telemetry.ts b/src/testRunner/unittests/telemetry.ts similarity index 100% rename from src/unittests/telemetry.ts rename to src/testRunner/unittests/telemetry.ts diff --git a/src/unittests/textChanges.ts b/src/testRunner/unittests/textChanges.ts similarity index 100% rename from src/unittests/textChanges.ts rename to src/testRunner/unittests/textChanges.ts diff --git a/src/unittests/textStorage.ts b/src/testRunner/unittests/textStorage.ts similarity index 100% rename from src/unittests/textStorage.ts rename to src/testRunner/unittests/textStorage.ts diff --git a/src/unittests/transform.ts b/src/testRunner/unittests/transform.ts similarity index 100% rename from src/unittests/transform.ts rename to src/testRunner/unittests/transform.ts diff --git a/src/unittests/transpile.ts b/src/testRunner/unittests/transpile.ts similarity index 100% rename from src/unittests/transpile.ts rename to src/testRunner/unittests/transpile.ts diff --git a/src/unittests/tsbuild.ts b/src/testRunner/unittests/tsbuild.ts similarity index 100% rename from src/unittests/tsbuild.ts rename to src/testRunner/unittests/tsbuild.ts diff --git a/src/unittests/tscWatchMode.ts b/src/testRunner/unittests/tscWatchMode.ts similarity index 100% rename from src/unittests/tscWatchMode.ts rename to src/testRunner/unittests/tscWatchMode.ts diff --git a/src/unittests/tsconfigParsing.ts b/src/testRunner/unittests/tsconfigParsing.ts similarity index 100% rename from src/unittests/tsconfigParsing.ts rename to src/testRunner/unittests/tsconfigParsing.ts diff --git a/src/unittests/tsserverProjectSystem.ts b/src/testRunner/unittests/tsserverProjectSystem.ts similarity index 100% rename from src/unittests/tsserverProjectSystem.ts rename to src/testRunner/unittests/tsserverProjectSystem.ts diff --git a/src/unittests/typingsInstaller.ts b/src/testRunner/unittests/typingsInstaller.ts similarity index 100% rename from src/unittests/typingsInstaller.ts rename to src/testRunner/unittests/typingsInstaller.ts diff --git a/src/unittests/versionCache.ts b/src/testRunner/unittests/versionCache.ts similarity index 97% rename from src/unittests/versionCache.ts rename to src/testRunner/unittests/versionCache.ts index cc534b6fa5b..82d6dafa1cf 100644 --- a/src/unittests/versionCache.ts +++ b/src/testRunner/unittests/versionCache.ts @@ -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."); diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index 463d9b9da36..8055b82b503 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -5,6 +5,7 @@ "target": "es5", "declaration": true, + "declarationMap": true, "sourceMap": true, "composite": true, "noEmitOnError": true, diff --git a/src/tsserver/tsconfig.json b/src/tsserver/tsconfig.json index 52d98dcf5b3..58b55126148 100644 --- a/src/tsserver/tsconfig.json +++ b/src/tsserver/tsconfig.json @@ -15,6 +15,7 @@ { "path": "../parser", "prepend": true }, { "path": "../compiler", "prepend": true }, { "path": "../services", "prepend": true }, + { "path": "../jsTyping", "prepend": true }, { "path": "../server", "prepend": true } ] } diff --git a/src/tsserverLibrary/tsconfig.json b/src/tsserverLibrary/tsconfig.json index 459504b5173..f7b9ff39ee3 100644 --- a/src/tsserverLibrary/tsconfig.json +++ b/src/tsserverLibrary/tsconfig.json @@ -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 } ] } diff --git a/src/typescriptServices/empty.ts b/src/typescriptServices/empty.ts new file mode 100644 index 00000000000..f911d153339 --- /dev/null +++ b/src/typescriptServices/empty.ts @@ -0,0 +1 @@ +// Delete soon \ No newline at end of file diff --git a/src/typescriptServices/tsconfig.json b/src/typescriptServices/tsconfig.json new file mode 100644 index 00000000000..c8267fa8280 --- /dev/null +++ b/src/typescriptServices/tsconfig.json @@ -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 }, + ] +} diff --git a/src/typingsInstaller/tsconfig.json b/src/typingsInstaller/tsconfig.json index c3451c75a52..e8af91d6a91 100644 --- a/src/typingsInstaller/tsconfig.json +++ b/src/typingsInstaller/tsconfig.json @@ -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": [ diff --git a/src/typingsInstallerCore/tsconfig.json b/src/typingsInstallerCore/tsconfig.json index 90a40cd8302..1c72a4e3008 100644 --- a/src/typingsInstallerCore/tsconfig.json +++ b/src/typingsInstallerCore/tsconfig.json @@ -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" diff --git a/src/unittests/tsconfig.json b/src/unittests/tsconfig.json deleted file mode 100644 index 95c8f478994..00000000000 --- a/src/unittests/tsconfig.json +++ /dev/null @@ -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"] -}