Skip to content

Commit

Permalink
Update all libraries to latest (#120)
Browse files Browse the repository at this point in the history
* Update all libraries to latest

* Fix webpackage configuration

* Declare @azure/functions-core as externals since it's a runtime dependency (microsoft/ApplicationInsights-node.js#1102)
  • Loading branch information
billyma authored Feb 28, 2024
1 parent b70588d commit 40cbe9a
Show file tree
Hide file tree
Showing 11 changed files with 4,069 additions and 2,345 deletions.
2,621 changes: 2,376 additions & 245 deletions client/package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"url": "https://git.soma.salesforce.com/bma/slds-validation-vscode"
},
"engines": {
"vscode": "^1.51.0"
"vscode": "^1.86.0"
},
"dependencies": {
"applicationinsights": "1.0.7",
"vscode-languageclient": "6.1.3"
"applicationinsights": "2.9.4",
"vscode-languageclient": "9.0.1"
},
"devDependencies": {
"@types/vscode": "^1.51.0",
"vscode-test": "1.3.0"
"@types/vscode": "^1.86.0",
"@vscode/test-electron": "2.3.9"
}
}
2 changes: 1 addition & 1 deletion client/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'use strict';

import * as vscode from 'vscode';
import { LanguageClient } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/node';
import { ContextKey, SLDSContext } from './../context';

export class Commands {
Expand Down
16 changes: 9 additions & 7 deletions client/src/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import * as vscode from 'vscode';
import { ContextKey } from './contextKey';
import { LanguageClient } from 'vscode-languageclient';
import { LanguageClient, State } from 'vscode-languageclient/node';

const CONFIG_KEY: string = 'salesforcedx-vscode-slds';

Expand Down Expand Up @@ -66,12 +66,14 @@ export class SLDSContext {
}

private syncContextWithServer(keys: Iterable<ContextKey>): void {
this.languageClient.onReady().then(() => {
for (let key of keys) {
const contextKey: ContextKey = <ContextKey>key;
const value = SLDSContext.isEnable(contextKey);
if (SLDSContext.shouldNotifyServerOfContextChange(contextKey)) {
this.languageClient.sendNotification('state/updateState', { key, value });
this.languageClient.onDidChangeState((s) => {
if (s.newState == State.Running) {
for (let key of keys) {
const contextKey: ContextKey = <ContextKey>key;
const value = SLDSContext.isEnable(contextKey);
if (SLDSContext.shouldNotifyServerOfContextChange(contextKey)) {
this.languageClient.sendNotification('state/updateState', { key, value });
}
}
}
});
Expand Down
5 changes: 3 additions & 2 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'use strict';

import * as vscode from 'vscode';
import { LanguageClient, Disposable } from 'vscode-languageclient';
import { LanguageClient, Disposable } from 'vscode-languageclient/node';
import { createLanguageClient } from './sldsLanguageClient';
import * as componentsProvider from './sldsComponentsProvider';
import * as utilitiesProvider from './sldsUtilitiesProvider';
Expand All @@ -29,7 +29,8 @@ export async function activate(context: vscode.ExtensionContext) {
// SLDS validation language client
outputChannel.append(`Starting SLDS ... `);
const languageClient : LanguageClient = createLanguageClient(context, outputChannel);
context.subscriptions.push(languageClient.start());
languageClient.start()
context.subscriptions.push(languageClient);

// SLDS Commands
outputChannel.append(`registering commands ... `);
Expand Down
4 changes: 2 additions & 2 deletions client/src/sldsLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as path from 'path';
import * as net from 'net';
import * as child_process from "child_process";
import { workspace, ExtensionContext, OutputChannel } from 'vscode';
import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient';
import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient/node';
import { Transform, TransformCallback } from 'stream';
import { shouldSendPayloadToServer } from './utilities';

Expand Down Expand Up @@ -105,7 +105,7 @@ function createServerPromise(context: ExtensionContext, outputChannel: OutputCha

private data: Array<Buffer> = [];

_transform(chunk: Buffer, encoding: string, callback: TransformCallback) {
_transform(chunk: Buffer, encoding: BufferEncoding, callback: TransformCallback) {
const contentLength = /^Content-Length: /;
let buf: string = Buffer.from(chunk).toString();

Expand Down
2 changes: 1 addition & 1 deletion client/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import * as path from 'path';

import { runTests } from 'vscode-test';
import { runTests } from '@vscode/test-electron';

async function main() {
try {
Expand Down
54 changes: 25 additions & 29 deletions client/test/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,34 @@

import * as path from 'path';
import Mocha from 'mocha';
import { glob } from 'glob';
import * as glob from 'glob';

export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd'
});
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
});

const testsRoot = path.resolve(__dirname, '..');
const testsRoot = path.resolve(__dirname, '..');

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}
return new Promise((c, e) => {
const files = glob.globSync('**/**.test.js', { cwd: testsRoot });

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
});
}
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
}
Loading

0 comments on commit 40cbe9a

Please sign in to comment.