Skip to content

Commit 8daac3f

Browse files
authored
2.0.1 (#37)
* 2.0.0 * fixups from 2.0.0 rollout * 2.0.1
1 parent 41894e2 commit 8daac3f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-socket-security",
33
"displayName": "Socket Security",
44
"description": "Editor integration with Socket Security",
5-
"version": "1.1.5",
5+
"version": "2.0.1",
66
"private": true,
77
"preview": false,
88
"categories": [

src/lifecycle/uninstall.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// if this is updated, update purl scripts
2+
import fs from 'fs'
3+
import os from 'os'
4+
import path from 'path'
5+
const cacheDir = path.resolve(os.homedir(), '.socket', 'vscode')
6+
try {
7+
fs.rmSync(cacheDir, { recursive: true, force: true })
8+
} catch {}

src/ui/decorations.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ class DecorationManagerForPURL {
202202
// we don't need to watch for builtin or local packages
203203
this.isBuiltin = isBuiltin(name, eco)
204204
this.isLocalPackage = isLocalPackage(name, eco);
205+
if (this.isBuiltin || this.isLocalPackage) {
206+
return
207+
}
205208
this.subscriptionCallback = ((data) => {
206209
this.packageData = data;
207210
this.#eagerDecoration();
@@ -380,7 +383,10 @@ class DecorationManagerForDocument {
380383
this.currentDocUpdate.abort();
381384
this.currentDocUpdate = new AbortController();
382385
const thisDocUpdateSignal = this.currentDocUpdate.signal;
383-
const externals = await parseExternals(doc);
386+
let externals;
387+
try {
388+
externals = await parseExternals(doc);
389+
} catch {}
384390
if (!externals) return;
385391
logger.debug(`Parsed externals for ${docURI}:`, externals.size, 'externals found, aborted:', thisDocUpdateSignal.aborted);
386392
logger.debug([...externals.keys()].join(', '));
@@ -482,11 +488,11 @@ class DecorationManagerForDocument {
482488
}
483489
}
484490
const getPURLParts = (purl: SimPURL) => {
485-
const groups = /^pkg:(?<eco>[^\/]+)\/(?<name>.+)$/v.exec(purl)?.groups
486-
return groups as {
491+
const groups = /^pkg:(?<eco>[^\/]+)\/(?<name>.*)$/v.exec(purl)?.groups
492+
return (groups as {
487493
eco: string;
488494
name: string;
489-
}
495+
}) ?? { eco: 'unknown', name: 'unknown' }
490496
}
491497
/**
492498
* VSCode makes strong guarantee about 1<->1 text document URI to TextDocument mapping.

0 commit comments

Comments
 (0)