8000 chore: Update npm modules (#710) · tsingwong/vscode-leetcode@ff46c33 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff46c33

Browse files
authored
chore: Update npm modules (LeetCode-OpenSource#710)
1 parent 0fcf9f1 commit ff46c33

File tree

7 files changed

+211
-2353
lines changed

7 files changed

+211
-2353
lines changed

package-lock.json

Lines changed: 192 additions & 2329 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,24 +672,23 @@
672672
"lint": "tslint --project tsconfig.json -e src/*.d.ts -t verbose"
673673
},
674674
"devDependencies": {
675-
"@types/fs-extra": "5.0.0",
676-
"@types/highlight.js": "^9.12.3",
677-
"@types/lodash": "^4.14.123",
675+
"@types/fs-extra": "^9.0.11",
676+
"@types/lodash": "^4.14.170",
678677
"@types/markdown-it": "0.0.7",
679678
"@types/mocha": "^2.2.42",
680-
"@types/node": "^7.0.43",
679+
"@types/node": "^14.14.33",
681680
"@types/require-from-string": "^1.2.0",
682681
"@types/vscode": "1.42.0",
683-
"tslint": "^5.9.1",
684-
"typescript": "^2.6.1"
682+
"tslint": "^5.20.1",
683+
"typescript": "^4.3.2"
685684
},
686685
"dependencies": {
687-
"fs-extra": "^6.0.1",
688-
"highlight.js": "^9.15.6",
689-
"lodash": "^4.17.19",
686+
"fs-extra": "^10.0.0",
687+
"highlight.js": "^10.7.2",
688+
"lodash": "^4.17.21",
690689
"markdown-it": "^8.4.2",
691690
"require-from-string": "^2.0.2",
692-
"unescape-js": "^1.1.1",
691+
"unescape-js": "^1.1.4",
693692
"vsc-leetcode-cli": "2.8.0"
694693
}
695694
}

src/leetCodeManager.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class LeetCodeManager extends EventEmitter {
8383
env: createEnvOption(),
8484
});
8585

86-
childProc.stdout.on("data", async (data: string | Buffer) => {
86+
childProc.stdout?.on("data", async (data: string | Buffer) => {
8787
data = data.toString();
8888
leetCodeChannel.append(data);
8989
if (data.includes("twoFactorCode")) {
@@ -96,19 +96,19 @@ class LeetCodeManager extends EventEmitter {
9696
childProc.kill();
9797
return resolve(undefined);
9898
}
99-
childProc.stdin.write(`${twoFactor}\n`);
99+
childProc.stdin?.write(`${twoFactor}\n`);
100100
}
101101
const successMatch: RegExpMatchArray | null = data.match(this.successRegex);
102102
if (successMatch && successMatch[1]) {
103-
childProc.stdin.end();
103+
childProc.stdin?.end();
104104
return resolve(successMatch[1]);
105105
} else if (data.match(this.failRegex)) {
106-
childProc.stdin.end();
106+
childProc.stdin?.end();
107107
return reject(new Error("Faile to login"));
108108
}
109109
});
110110

111-
childProc.stderr.on("data", (data: string | Buffer) => leetCodeChannel.append(data.toString()));
111+
childProc.stderr?.on("data", (data: string | Buffer) => leetCodeChannel.append(data.toString()));
112112

113113
childProc.on("error", reject);
114114
const name: string | undefined = await vscode.window.showInputBox({
@@ -120,7 +120,7 @@ class LeetCodeManager extends EventEmitter {
120120
childProc.kill();
121121
return resolve(undefined);
122122
}
123-
childProc.stdin.write(`${name}\n`);
123+
childProc.stdin?.write(`${name}\n`);
124124
const pwd: string | undefined = await vscode.window.showInputBox({
125125
prompt: isByCookie ? "Enter cookie" : "Enter password.",
126126
password: true,
@@ -131,7 +131,7 @@ class LeetCodeManager extends EventEmitter {
131131
childProc.kill();
132132
return resolve(undefined);
133133
}
134-
childProc.stdin.write(`${pwd}\n`);
134+
childProc.stdin?.write(`${pwd}\n`);
135135
});
136136
if (userName) {
137137
vscode.window.showInformationMessage(`Successfully ${inMessage}.`);

src/utils/cpUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export async function executeCommand(command: string, args: string[], options: c
1515

1616
const childProc: cp.ChildProcess = cp.spawn(command, args, { ...options, env: createEnvOption() });
1717

18-
childProc.stdout.on("data", (data: string | Buffer) => {
18+
childProc.stdout?.on("data", (data: string | Buffer) => {
1919
data = data.toString();
2020
result = result.concat(data);
2121
leetCodeChannel.append(data);
2222
});
2323

24-
childProc.stderr.on("data", (data: string | Buffer) => leetCodeChannel.append(data.toString()));
24+
childProc.stderr?.on("data", (data: string | Buffer) => leetCodeChannel.append(data.toString()));
2525

2626
childProc.on("error", reject);
2727

@@ -42,7 +42,7 @@ export async function executeCommand(command: string, args: string[], options: c
4242
export async function executeCommandWithProgress(message: string, command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {
4343
let result: string = "";
4444
await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async (p: vscode.Progress<{}>) => {
45-
return new Promise(async (resolve: () => void, reject: (e: Error) => void): Promise<void> => {
45+
return new Promise<void>(async (resolve: () => void, reject: (e: Error) => void): Promise<void> => {
4646
p.report({ message });
4747
try {
4848
result = await executeCommand(command, args, options);

src/webview/leetCodePreviewProvider.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
130130

131131
protected onDidDisposeWebview(): void {
132132
super.onDidDisposeWebview();
133-
delete this.node;
134-
delete this.description;
135133
this.sideMode = false;
136134
}
137135

src/webview/leetCodeSolutionProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class LeetCodeSolutionProvider extends LeetCodeWebview {
6464

6565
protected onDidDisposeWebview(): void {
6666
super.onDidDisposeWebview();
67-
delete this.solution;
6867
}
6968

7069
private parseSolution(raw: string): Solution {

src/webview/leetCodeSubmissionProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class LeetCodeSubmissionProvider extends LeetCodeWebview {
5959

6060
protected onDidDisposeWebview(): void {
6161
super.onDidDisposeWebview();
62-
delete this.result;
6362
}
6463

6564
private async showKeybindingsHint(): Promise<void> {

0 commit comments

Comments
 (0)
0