Skip to content

Commit 7989e69

Browse files
authored
Remove crypto from tasks (microsoft#70837)
1 parent dc92537 commit 7989e69

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

  • src/vs/workbench/contrib/tasks/node

src/vs/workbench/contrib/tasks/node/tasks.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,31 @@
55

66
import * as nls from 'vs/nls';
77

8-
import * as crypto from 'crypto';
9-
108
import * as Objects from 'vs/base/common/objects';
119

1210
import { TaskIdentifier, KeyedTaskIdentifier, TaskDefinition } from 'vs/workbench/contrib/tasks/common/tasks';
1311
import { TaskDefinitionRegistry } from 'vs/workbench/contrib/tasks/common/taskDefinitionRegistry';
1412

1513
namespace KeyedTaskIdentifier {
16-
export function create(value: TaskIdentifier): KeyedTaskIdentifier {
17-
const hash = crypto.createHash('md5');
18-
hash.update(JSON.stringify(value));
19-
let result = { _key: hash.digest('hex'), type: value.taskType };
20-
Objects.assign(result, value);
14+
function sortedStringify(literal: any): string {
15+
const keys = Object.keys(literal).sort();
16+
let result: string = '';
17+
for (let position in keys) {
18+
let stringified = literal[keys[position]];
19+
if (stringified instanceof Object) {
20+
stringified = sortedStringify(test);
21+
} else if (typeof stringified === 'string') {
22+
stringified = stringified.replace(/,/g, ',,');
23+
}
24+
result += keys[position] + ',' + stringified + ',';
25+
}
2126
return result;
2227
}
28+
export function create(value: TaskIdentifier): KeyedTaskIdentifier {
29+
const resultKey = sortedStringify(value);
30+
console.log(resultKey);
31+
return { _key: resultKey, type: value.taskType };
32+
}
2333
}
2434

2535
namespace TaskDefinition {

0 commit comments

Comments
 (0)