Skip to content

Commit e779931

Browse files
committed
Subsume tsserverlibrary.*
1 parent dbdc383 commit e779931

File tree

10 files changed

+63
-108
lines changed

10 files changed

+63
-108
lines changed

.github/workflows/new-release-branch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
2222
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
2323
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
24-
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
24+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserver.d.ts
2525
sed -i -e 's/const version = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts
2626
npm install
2727
gulp LKG
@@ -30,7 +30,7 @@ jobs:
3030
git add package.json
3131
git add src/compiler/corePublic.ts
3232
git add tests/baselines/reference/api/typescript.d.ts
33-
git add tests/baselines/reference/api/tsserverlibrary.d.ts
33+
git add tests/baselines/reference/api/tsserver.d.ts
3434
git add ./lib
3535
git config user.email "[email protected]"
3636
git config user.name "TypeScript Bot"

.github/workflows/set-version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
2828
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
2929
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
30-
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
30+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserver.d.ts
3131
sed -i -e 's/const version = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
3232
npm install
3333
gulp LKG
@@ -36,7 +36,7 @@ jobs:
3636
git add package.json
3737
git add src/compiler/corePublic.ts
3838
git add tests/baselines/reference/api/typescript.d.ts
39-
git add tests/baselines/reference/api/tsserverlibrary.d.ts
39+
git add tests/baselines/reference/api/tsserver.d.ts
4040
git add ./lib
4141
git config user.email "[email protected]"
4242
git config user.name "TypeScript Bot"

Gulpfile.js

Lines changed: 52 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,55 @@ task("watch-services").flags = {
215215
" --built": "Compile using the built version of the compiler."
216216
};
217217

218-
const buildServer = () => buildProject("src/tsserver", cmdLineOptions);
218+
const buildServer = (() => {
219+
// build tsserver.out.js
220+
const buildServerOut = () => buildProject("src/tsserver/tsconfig.json", cmdLineOptions);
221+
222+
// create tsserver.js
223+
const createServerJs = () => src("built/local/tsserver.out.js")
224+
.pipe(newer("built/local/tsserver.js"))
225+
.pipe(sourcemaps.init({ loadMaps: true }))
226+
.pipe(prependFile(copyright))
227+
.pipe(rename("tsserver.js"))
228+
.pipe(sourcemaps.write(".", { includeContent: false, destPath: "built/local" }))
229+
.pipe(dest("built/local"));
230+
231+
// create tsserver.d.ts
232+
const createServerDts = () => src("built/local/tsserver.out.d.ts")
233+
.pipe(newer("built/local/tsserver.d.ts"))
234+
.pipe(prependFile(copyright))
235+
.pipe(transform(content => content.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4")))
236+
.pipe(append("\nexport = ts;\nexport as namespace ts;"))
237+
.pipe(rename("tsserver.d.ts"))
238+
.pipe(dest("built/local"));
239+
240+
return series(
241+
buildServerOut,
242+
createServerJs,
243+
createServerDts,
244+
);
245+
})();
219246
task("tsserver", series(preBuild, buildServer));
220247
task("tsserver").description = "Builds the language server";
221248
task("tsserver").flags = {
222249
" --built": "Compile using the built version of the compiler."
223250
};
224251

225-
const cleanServer = () => cleanProject("src/tsserver");
252+
const cleanServer = async () => {
253+
await cleanProject("src/tsserver");
254+
if (fs.existsSync("built/local/tsserver.tsconfig.json")) {
255+
await cleanProject("built/local/tsserver.tsconfig.json");
256+
}
257+
await del([
258+
"built/local/tsserver.out.js",
259+
"built/local/tsserver.out.js.map",
260+
"built/local/tsserver.out.d.ts",
261+
"built/local/tsserver.out.tsbuildinfo",
262+
"built/local/tsserver.js",
263+
"built/local/tsserver.js.map",
264+
"built/local/tsserver.d.ts",
265+
]);
266+
};
226267
cleanTasks.push(cleanServer);
227268
task("clean-tsserver", cleanServer);
228269
task("clean-tsserver").description = "Cleans outputs for the language server";
@@ -249,76 +290,8 @@ task("watch-min").flags = {
249290
" --built": "Compile using the built version of the compiler."
250291
};
251292

252-
const buildLssl = (() => {
253-
// build tsserverlibrary.out.js
254-
const buildServerLibraryOut = () => buildProject("src/tsserverlibrary/tsconfig.json", cmdLineOptions);
255-
256-
// create tsserverlibrary.js
257-
const createServerLibraryJs = () => src("built/local/tsserverlibrary.out.js")
258-
.pipe(newer("built/local/tsserverlibrary.js"))
259-
.pipe(sourcemaps.init({ loadMaps: true }))
260-
.pipe(prependFile(copyright))
261-
.pipe(rename("tsserverlibrary.js"))
262-
.pipe(sourcemaps.write(".", { includeContent: false, destPath: "built/local" }))
263-
.pipe(dest("built/local"));
264-
265-
// create tsserverlibrary.d.ts
266-
const createServerLibraryDts = () => src("built/local/tsserverlibrary.out.d.ts")
267-
.pipe(newer("built/local/tsserverlibrary.d.ts"))
268-
.pipe(prependFile(copyright))
269-
.pipe(transform(content => content.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4")))
270-
.pipe(append("\nexport = ts;\nexport as namespace ts;"))
271-
.pipe(rename("tsserverlibrary.d.ts"))
272-
.pipe(dest("built/local"));
273-
274-
return series(
275-
buildServerLibraryOut,
276-
createServerLibraryJs,
277-
createServerLibraryDts,
278-
);
279-
})();
280-
task("lssl", series(preBuild, buildLssl));
281-
task("lssl").description = "Builds language service server library";
282-
task("lssl").flags = {
283-
" --built": "Compile using the built version of the compiler."
284-
};
285-
286-
const cleanLssl = async () => {
287-
if (fs.existsSync("built/local/tsserverlibrary.tsconfig.json")) {
288-
await cleanProject("built/local/tsserverlibrary.tsconfig.json");
289-
}
290-
await del([
291-
"built/local/tsserverlibrary.out.js",
292-
"built/local/tsserverlibrary.out.d.ts",
293-
"built/local/tsserverlibrary.out.tsbuildinfo",
294-
"built/local/tsserverlibrary.js",
295-
"built/local/tsserverlibrary.d.ts",
296-
]);
297-
};
298-
cleanTasks.push(cleanLssl);
299-
task("clean-lssl", cleanLssl);
300-
task("clean-lssl").description = "Clean outputs for the language service server library";
301-
302-
const watchLssl = () => watch([
303-
"src/compiler/tsconfig.json",
304-
"src/compiler/**/*.ts",
305-
"src/jsTyping/tsconfig.json",
306-
"src/jsTyping/**/*.ts",
307-
"src/services/tsconfig.json",
308-
"src/services/**/*.ts",
309-
"src/server/tsconfig.json",
310-
"src/server/**/*.ts",
311-
"src/tsserver/tsconfig.json",
312-
"src/tsserver/**/*.ts",
313-
], buildLssl);
314-
task("watch-lssl", series(preBuild, parallel(watchLib, watchDiagnostics, watchLssl)));
315-
task("watch-lssl").description = "Watch for changes and rebuild tsserverlibrary only";
316-
task("watch-lssl").flags = {
317-
" --built": "Compile using the built version of the compiler."
318-
};
319-
320293
const buildTests = () => buildProject("src/testRunner");
321-
task("tests", series(preBuild, parallel(buildLssl, buildTests)));
294+
task("tests", series(preBuild, parallel(buildServer, buildTests)));
322295
task("tests").description = "Builds the test infrastructure";
323296
task("tests").flags = {
324297
" --built": "Compile using the built version of the compiler."
@@ -412,7 +385,7 @@ const cleanTypesMap = () => del("built/local/typesMap.json");
412385
cleanTasks.push(cleanTypesMap);
413386

414387
// Drop a copy of diagnosticMessages.generated.json into the built/local folder. This allows
415-
// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
388+
// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
416389
// pipeline that generates the localization artifacts that are then fed into the translation process.
417390
const builtLocalDiagnosticMessagesGeneratedJson = "built/local/diagnosticMessages.generated.json";
418391
const copyBuiltLocalDiagnosticMessages = () => src(diagnosticMessagesGeneratedJson)
@@ -428,13 +401,13 @@ task("other-outputs").description = "Builds miscelaneous scripts and documents d
428401

429402
const buildFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("build")); };
430403
const buildFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("build")); };
431-
task("local", series(buildFoldStart, preBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs), buildFoldEnd));
404+
task("local", series(buildFoldStart, preBuild, parallel(localize, buildTsc, buildServer, buildServices, buildOtherOutputs), buildFoldEnd));
432405
task("local").description = "Builds the full compiler and services";
433406
task("local").flags = {
434407
" --built": "Compile using the built version of the compiler."
435408
};
436409

437-
task("watch-local", series(preBuild, parallel(watchLib, watchDiagnostics, watchTsc, watchServices, watchServer, watchLssl)));
410+
task("watch-local", series(preBuild, parallel(watchLib, watchDiagnostics, watchTsc, watchServices, watchServer)));
438411
task("watch-local").description = "Watches for changes to projects in src/ (but does not execute tests).";
439412
task("watch-local").flags = {
440413
" --built": "Compile using the built version of the compiler."
@@ -444,7 +417,7 @@ const generateCodeCoverage = () => exec("istanbul", ["cover", "node_modules/moch
444417
task("generate-code-coverage", series(preBuild, buildTests, generateCodeCoverage));
445418
task("generate-code-coverage").description = "Generates code coverage data via istanbul";
446419

447-
const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
420+
const preTest = parallel(buildTsc, buildTests, buildServices, buildServer);
448421
preTest.displayName = "preTest";
449422

450423
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();
@@ -529,7 +502,7 @@ const cleanInstrumenter = () => cleanProject("src/instrumenter");
529502
cleanTasks.push(cleanInstrumenter);
530503

531504
const tscInstrumented = () => exec(process.execPath, ["built/local/instrumenter.js", "record", cmdLineOptions.tests || "iocapture", "built/local"]);
532-
task("tsc-instrumented", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildLoggedIO, buildInstrumenter), tscInstrumented));
505+
task("tsc-instrumented", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLoggedIO, buildInstrumenter), tscInstrumented));
533506
task("tsc-instrumented").description = "Builds an instrumented tsc.js";
534507
task("tsc-instrumented").flags = {
535508
"-t --tests=<testname>": "The test to run."
@@ -563,10 +536,9 @@ const produceLKG = async () => {
563536
"built/local/typescriptServices.js",
564537
"built/local/typescriptServices.d.ts",
565538
"built/local/tsserver.js",
539+
"built/local/tsserver.d.ts",
566540
"built/local/typescript.js",
567541
"built/local/typescript.d.ts",
568-
"built/local/tsserverlibrary.js",
569-
"built/local/tsserverlibrary.d.ts",
570542
"built/local/typingsInstaller.js",
571543
"built/local/cancellationToken.js"
572544
].concat(libs.map(lib => lib.target));
@@ -584,7 +556,7 @@ const produceLKG = async () => {
584556
}
585557
};
586558

587-
task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs, buildReleaseTsc), produceLKG));
559+
task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildOtherOutputs, buildReleaseTsc), produceLKG));
588560
task("LKG").description = "Makes a new LKG out of the built js files";
589561
task("LKG").flags = {
590562
" --built": "Compile using the built version of the compiler.",
@@ -630,7 +602,7 @@ const watchRuntests = () => watch(["built/local/*.js", "tests/cases/**/*.ts", "t
630602
await runConsoleTests("built/local/run.js", "min", /*runInParallel*/ true, /*watchMode*/ true);
631603
}
632604
});
633-
task("watch", series(preBuild, preTest, parallel(watchLib, watchDiagnostics, watchServices, watchLssl, watchTests, watchRuntests)));
605+
task("watch", series(preBuild, preTest, parallel(watchLib, watchDiagnostics, watchServices, watchServer, watchTests, watchRuntests)));
634606
task("watch").description = "Watches for changes and rebuilds and runs tests in parallel.";
635607
task("watch").flags = {
636608
"-t --tests=<regex>": "Pattern for tests to run. Forces tests to be run in a single worker.",

scripts/configureLanguageServiceBuild.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ function main(): void {
4545
const toRemove = [
4646
// JS Files
4747
"tsserver.js",
48-
"tsserverlibrary.js",
4948
"typescriptServices.js",
5049
"typingsInstaller.js",
5150
"tsc.js",
5251
// DTS files
5352
"typescriptServices.d.ts",
54-
"tsserverlibrary.d.ts"
53+
"tsserver.d.ts"
5554
];
5655

5756
// Get a link to the main dependency JS file

scripts/produceLKG.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,15 @@ async function buildProtocol() {
5757
async function copyScriptOutputs() {
5858
await copyWithCopyright("cancellationToken.js");
5959
await copyWithCopyright("tsc.release.js", "tsc.js");
60-
await copyWithCopyright("tsserver.js");
61-
await copyFromBuiltLocal("tsserverlibrary.js"); // copyright added by build
60+
await copyFromBuiltLocal("tsserver.js"); // copyright added by build
6261
await copyFromBuiltLocal("typescript.js"); // copyright added by build
6362
await copyFromBuiltLocal("typescriptServices.js"); // copyright added by build
6463
await copyWithCopyright("typingsInstaller.js");
6564
await copyWithCopyright("watchGuard.js");
6665
}
6766

6867
async function copyDeclarationOutputs() {
69-
await copyFromBuiltLocal("tsserverlibrary.d.ts"); // copyright added by build
68+
await copyFromBuiltLocal("tsserver.d.ts"); // copyright added by build
7069
await copyFromBuiltLocal("typescript.d.ts"); // copyright added by build
7170
await copyFromBuiltLocal("typescriptServices.d.ts"); // copyright added by build
7271
}

src/testRunner/unittests/publicApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("unittests:: Public APIs", () => {
2828
});
2929

3030
describe("for the language server", () => {
31-
verifyApi("tsserverlibrary.d.ts");
31+
verifyApi("tsserver.d.ts");
3232
});
3333
});
3434

src/tsserver/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "../tsconfig-library-base",
33

44
"compilerOptions": {
5-
"outFile": "../../built/local/tsserver.js",
5+
"outFile": "../../built/local/tsserver.out.js",
6+
"sourceMap": true,
67
"types": [
78
"node"
89
]
@@ -11,6 +12,7 @@
1112
"server.ts"
1213
],
1314
"references": [
15+
{ "path": "../shims", "prepend": true },
1416
{ "path": "../compiler", "prepend": true },
1517
{ "path": "../services", "prepend": true },
1618
{ "path": "../jsTyping", "prepend": true },

src/tsserverlibrary/tsconfig.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/tsserverlibrary/tsserverlibrary.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)