Skip to content

Commit 5393301

Browse files
authored
Move to latest compiler, NodeJS 20.9.0, es2022 and exports statements. (#1502)
* WIP * More version updates * More code cleanup * Convert client to export property * Fix imports * Get test oto work again * Update Readme.md * Revert timeout
1 parent 6d2a392 commit 5393301

File tree

109 files changed

+461
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+461
-519
lines changed

.tsconfigrc.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const general = {
3636
* rely on webpack to package everything correctly.
3737
*/
3838
compilerOptions: {
39-
module: 'commonjs',
40-
moduleResolution: 'node'
39+
module: 'node16',
40+
moduleResolution: 'node16'
4141
}
4242
};
4343

@@ -367,8 +367,8 @@ const compileCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
367367
declarationMap: true,
368368
noUnusedLocals: true,
369369
noUnusedParameters: true,
370-
target: 'es2020',
371-
lib: [ 'es2020' ],
370+
target: 'es2022',
371+
lib: [ 'es2022' ],
372372
});
373373

374374
/** @type ProjectOptions */
@@ -386,8 +386,8 @@ const watchCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
386386
noUnusedLocals: false,
387387
noUnusedParameters: false,
388388
assumeChangesOnlyAffectDirectDependencies: true,
389-
target: 'es2020',
390-
lib: [ 'es2020' ],
389+
target: 'es2022',
390+
lib: [ 'es2022' ],
391391
});
392392

393393
/** @type ProjectOptions */
@@ -404,8 +404,8 @@ const publishCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
404404
declarationMap: false,
405405
noUnusedLocals: true,
406406
noUnusedParameters: true,
407-
target: 'es2020',
408-
lib: [ 'es2020' ]
407+
target: 'es2022',
408+
lib: [ 'es2022' ]
409409

410410
});
411411

@@ -425,6 +425,7 @@ const umdCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
425425
noUnusedParameters: true,
426426
target: 'es5',
427427
module: 'umd',
428+
moduleResolution: 'node',
428429
lib: [ 'es2015' ],
429430
});
430431

@@ -471,6 +472,7 @@ const esmPublishCompilerOptions = CompilerOptions.assign(defaultCompilerOptions,
471472
sourceMap: false,
472473
target: 'es6',
473474
module: 'es6',
475+
moduleResolution: 'node',
474476
lib: [ 'es2015' ]
475477
});
476478

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ After cloning the repository, run `npm install` to install dependencies and `npm
3636

3737
## Next (10.0.0-next.* Client and 10.0.0-next.* Server)
3838

39+
- Upgraded to newer libraries, compilers and package.json exports rules:
40+
- Compiler upgraded to `5.5.x`.
41+
- Libs now depend on NodeJS `20.9.0` and `es2022`.
42+
- `vscode-jsonrpc`, `vscode-languageserver-protocol`, `vscode-languageclient` and `vscode-languageserver` now use the `exports` property instead of having a `main` and `typings` property. This might need adoption in tsconfig.json files around the `module` and `moduleResolution`. The LSP libraries currently use `node16` for both values.
3943
- added proposed CodeActionKind.RefactorMove
4044
- snippet support in Workspace edits
4145
- support to control the parallelism of the dispatch requests and notification. This is a breaking change since it allows notification handlers to return a promise to control this.

build/bin/runBrowserTests.js

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,37 +77,42 @@ async function runTests(location) {
7777
}
7878
});
7979
server.listen(8080, '127.0.0.1', async () => {
80-
let failCount = 0;
81-
const browser = await playwright['chromium'].launch({ headless: true, devtools: false });
82-
const context = await browser.newContext();
83-
const page = await context.newPage();
84-
const emitter = new events.EventEmitter();
85-
emitter.on('fail', () => {
86-
failCount++;
87-
});
88-
emitter.on('end', async () => {
89-
process.exitCode = failCount === 0 ? 0 : 1;
90-
await browser.close();
91-
server.close((err) => {
92-
if (err) {
93-
reject(err);
94-
} else {
95-
resolve();
96-
}
80+
try {
81+
let failCount = 0;
82+
const browser = await playwright['chromium'].launch({ headless: true, devtools: false });
83+
const context = await browser.newContext();
84+
const page = await context.newPage();
85+
// page.setDefaultTimeout(1000000);
86+
const emitter = new events.EventEmitter();
87+
emitter.on('fail', () => {
88+
failCount++;
89+
});
90+
emitter.on('end', async () => {
91+
process.exitCode = failCount === 0 ? 0 : 1;
92+
await browser.close();
93+
server.close((err) => {
94+
if (err) {
95+
reject(err);
96+
} else {
97+
resolve();
98+
}
99+
});
100+
});
101+
const echoRunner = new EchoRunner(emitter, 'Chromium');
102+
if (process.platform === 'win32') {
103+
new mocha.reporters.List(echoRunner);
104+
} else {
105+
new mocha.reporters.Spec(echoRunner);
106+
}
107+
await page.exposeFunction('mocha_report', (type, data1, data2) => {
108+
emitter.emit(type, data1, data2);
97109
});
98-
});
99-
const echoRunner = new EchoRunner(emitter, 'Chromium');
100-
if (process.platform === 'win32') {
101-
new mocha.reporters.List(echoRunner);
102-
} else {
103-
new mocha.reporters.Spec(echoRunner);
104-
}
105-
await page.exposeFunction('mocha_report', (type, data1, data2) => {
106-
emitter.emit(type, data1, data2);
107-
});
108110

109-
const target = new url.URL(location);
110-
page.goto(target.href);
111+
const target = new url.URL(location);
112+
page.goto(target.href);
113+
} catch (error) {
114+
console.error(error);
115+
}
111116
});
112117
});
113118
}

build/bin/webpack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* Copyright (c) Microsoft Corporation. All rights reserved.
44
* Licensed under the MIT License. See License.txt in the project root for license information.
55
*--------------------------------------------------------------------------------------------*/
6-
require('../../node_modules/webpack/bin/webpack.js')
6+
require('../../node_modules/webpack/bin/webpack.js');

client-node-tests/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"main": "./extension.js",
1818
"contributes": {},
1919
"scripts": {
20-
"clean": "node ../node_modules/rimraf/dist/esm/bin.mjs lib",
21-
"compile": "node ../build/bin/tsc -b ./tsconfig.json",
22-
"watch": "node ../build/bin/tsc -b ./tsconfig.watch.json -w",
23-
"lint": "node ../node_modules/eslint/bin/eslint.js --ext ts src",
20+
"clean": "rimraf lib",
21+
"compile": "tsc -b ./tsconfig.json",
22+
"watch": "tsc -b ./tsconfig.watch.json -w",
23+
"lint": "eslint --ext ts src",
2424
"test": "node ../build/bin/symlink-tests.js && node lib/runTests.js",
2525
"all": "npm run clean && npm run compile && npm run lint && npm run test",
2626
"symlink:publish": "node ../build/bin/symlink-client-tests-publish.js",
27-
"compile:publish": "node ../build/bin/tsc -b ./tsconfig.publish.json",
27+
"compile:publish": "tsc -b ./tsconfig.publish.json",
2828
"test:publish": "node lib/runTests.js",
2929
"all:publish": "git clean -xfd . && npm install && npm run symlink:publish && npm run compile:publish && npm run test:publish"
3030
},

client-node-tests/src/converter.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import { strictEqual, deepEqual, ok } from 'assert';
77

88
import * as proto from 'vscode-languageclient';
9-
import * as codeConverter from 'vscode-languageclient/lib/common/codeConverter';
10-
import * as protocolConverter from 'vscode-languageclient/lib/common/protocolConverter';
11-
import ProtocolCompletionItem from 'vscode-languageclient/lib/common/protocolCompletionItem';
12-
import ProtocolInlayHint from 'vscode-languageclient/lib/common/protocolInlayHint';
13-
import { DiagnosticCode, ProtocolDiagnostic } from 'vscode-languageclient/lib/common/protocolDiagnostic';
14-
import * as Is from 'vscode-languageclient/lib/common/utils/is';
15-
import * as async from 'vscode-languageclient/lib/common/utils/async';
9+
import * as codeConverter from 'vscode-languageclient/$test/common/codeConverter';
10+
import * as protocolConverter from 'vscode-languageclient/$test/common/protocolConverter';
11+
import ProtocolCompletionItem from 'vscode-languageclient/$test/common/protocolCompletionItem';
12+
import ProtocolInlayHint from 'vscode-languageclient/$test/common/protocolInlayHint';
13+
import { DiagnosticCode, ProtocolDiagnostic } from 'vscode-languageclient/$test/common/protocolDiagnostic';
14+
import * as Is from 'vscode-languageclient/$test/common/utils/is';
15+
import * as async from 'vscode-languageclient/$test/common/utils/async';
1616

1717
import * as vscode from 'vscode';
1818

client-node-tests/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path';
2-
import * as Mocha from 'mocha';
2+
import Mocha from 'mocha';
33
import { glob } from 'glob';
44

55
export function run(testsRoot: string, cb: (error: any, failures?: number) => void): void {

client-node-tests/src/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as vscode from 'vscode';
1010
import * as lsclient from 'vscode-languageclient/node';
1111
import * as proto from 'vscode-languageserver-protocol';
1212
import { MemoryFileSystemProvider } from './memoryFileSystemProvider';
13-
import { vsdiag, DiagnosticProviderMiddleware } from 'vscode-languageclient/lib/common/diagnostic';
13+
import { vsdiag, DiagnosticProviderMiddleware } from 'vscode-languageclient';
1414

1515
namespace GotNotifiedRequest {
1616
export const method: 'testing/gotNotified' = 'testing/gotNotified';

client-node-tests/src/tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"compilerOptions": {
3-
"module": "commonjs",
4-
"moduleResolution": "node",
3+
"module": "node16",
4+
"moduleResolution": "node16",
55
"rootDir": ".",
66
"types": [
77
"node",
88
"vscode",
99
"mocha"
1010
],
1111
"lib": [
12-
"es2020",
12+
"es2022",
1313
"webworker"
1414
],
1515
"strict": true,
@@ -22,7 +22,7 @@
2222
"declarationMap": true,
2323
"noUnusedLocals": true,
2424
"noUnusedParameters": true,
25-
"target": "es2020",
25+
"target": "es2022",
2626
"outDir": "../lib",
2727
"tsBuildInfoFile": "../lib/compile.tsbuildInfo",
2828
"incremental": true

client-node-tests/src/tsconfig.publish.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"compilerOptions": {
3-
"module": "commonjs",
4-
"moduleResolution": "node",
3+
"module": "node16",
4+
"moduleResolution": "node16",
55
"rootDir": ".",
66
"types": [
77
"node",
88
"vscode",
99
"mocha"
1010
],
1111
"lib": [
12-
"es2020",
12+
"es2022",
1313
"webworker"
1414
],
1515
"strict": true,
@@ -22,7 +22,7 @@
2222
"declarationMap": false,
2323
"noUnusedLocals": true,
2424
"noUnusedParameters": true,
25-
"target": "es2020",
25+
"target": "es2022",
2626
"outDir": "../lib",
2727
"tsBuildInfoFile": "../lib/publish.tsbuildInfo",
2828
"incremental": true

0 commit comments

Comments
 (0)