Skip to content

Commit cece39b

Browse files
committedMay 14, 2024·
remove vulnerable package and fix KXI-45460
1 parent 1901b16 commit cece39b

File tree

3 files changed

+100
-94
lines changed

3 files changed

+100
-94
lines changed
 

‎esbuild.js

+20-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
const { build } = require("esbuild");
2-
const { copy } = require("esbuild-plugin-copy");
2+
const fs = require("fs");
3+
const path = require("path");
4+
const glob = require("glob");
5+
6+
function copyFiles(srcPattern, destDir) {
7+
glob.sync(srcPattern).forEach((file) => {
8+
const destFile = path.join(destDir, path.basename(file));
9+
fs.copyFileSync(file, destFile);
10+
});
11+
}
312

413
const baseConfig = {
514
bundle: true,
@@ -32,33 +41,6 @@ const webviewConfig = {
3241
entryPoints: ["./src/webview/main.ts"],
3342
external: ["vscode"],
3443
outfile: "./out/webview.js",
35-
plugins: [
36-
copy({
37-
resolveFrom: "cwd",
38-
assets: [
39-
{
40-
from: ["src/webview/styles/*.css"],
41-
to: ["./out"],
42-
},
43-
{
44-
from: ["node_modules/ag-grid-community/styles/ag-grid.min.css"],
45-
to: ["./out"],
46-
},
47-
{
48-
from: [
49-
"node_modules/ag-grid-community/styles/ag-theme-alpine.min.css",
50-
],
51-
to: ["./out"],
52-
},
53-
{
54-
from: [
55-
"node_modules/ag-grid-community/dist/ag-grid-community.min.js",
56-
],
57-
to: ["./out"],
58-
},
59-
],
60-
}),
61-
],
6244
};
6345

6446
(async () => {
@@ -68,6 +50,16 @@ const webviewConfig = {
6850
await build(serverConfig);
6951
console.log("server build complete");
7052
await build(webviewConfig);
53+
copyFiles("src/webview/styles/*.css", "./out");
54+
copyFiles("node_modules/ag-grid-community/styles/ag-grid.min.css", "./out");
55+
copyFiles(
56+
"node_modules/ag-grid-community/styles/ag-theme-alpine.min.css",
57+
"./out",
58+
);
59+
copyFiles(
60+
"node_modules/ag-grid-community/dist/ag-grid-community.min.js",
61+
"./out",
62+
);
7163
console.log("build complete");
7264
} catch (err) {
7365
process.stderr.write(err.stderr);

‎package-lock.json

+61-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+19-14
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@
333333
"command": "kdb.datasource.import.ds",
334334
"title": "Import Datasource from old format"
335335
},
336+
{
337+
"category": "KX",
338+
"command": "kdb.terminal.run",
339+
"title": "Run q file in a new q instance",
340+
"icon": "$(debug-alt)"
341+
},
336342
{
337343
"category": "KX",
338344
"command": "kdb.terminal.start",
@@ -341,25 +347,25 @@
341347
{
342348
"category": "KX",
343349
"command": "kdb.execute.selectedQuery",
344-
"title": "Execute Current Selection",
350+
"title": "KX: Execute Current Selection",
345351
"icon": "$(run-below)"
346352
},
347353
{
348354
"category": "KX",
349355
"command": "kdb.execute.fileQuery",
350-
"title": "Execute Entire File",
356+
"title": "KX: Execute Entire File",
351357
"icon": "$(run)"
352358
},
353359
{
354360
"category": "KX",
355361
"command": "kdb.execute.pythonScratchpadQuery",
356-
"title": "Execute Current Selection in Insights Scratchpad",
362+
"title": "KX: Execute Current Python Selection",
357363
"icon": "$(run-below)"
358364
},
359365
{
360366
"category": "KX",
361367
"command": "kdb.execute.pythonFileScratchpadQuery",
362-
"title": "Execute Entire File in Insights Scratchpad",
368+
"title": "KX: Execute Entire Python File",
363369
"icon": "$(run)"
364370
},
365371
{
@@ -394,19 +400,19 @@
394400
"command": "kdb.execute.pythonScratchpadQuery",
395401
"key": "ctrl+d",
396402
"mac": "cmd+d",
397-
"when": "editorLangId == python"
403+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
398404
},
399405
{
400406
"command": "kdb.execute.pythonFileScratchpadQuery",
401407
"key": "ctrl+shift+d",
402408
"mac": "cmd+shift+d",
403-
"when": "editorLangId == python"
409+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
404410
},
405411
{
406412
"command": "kdb.terminal.run",
407413
"key": "ctrl+shift+r",
408414
"mac": "cmd+shift+r",
409-
"when": "editorLangId == q"
415+
"when": "editorLangId == q && !(resourceFilename =~ /.kdb.q/)"
410416
}
411417
],
412418
"snippets": [
@@ -701,17 +707,17 @@
701707
{
702708
"command": "kdb.terminal.run",
703709
"group": "q@2",
704-
"when": "editorLangId == q"
710+
"when": "editorLangId == q && !(resourceFilename =~ /.kdb.q/)"
705711
},
706712
{
707713
"command": "kdb.execute.pythonFileScratchpadQuery",
708714
"group": "q@0",
709-
"when": "editorLangId == python"
715+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
710716
},
711717
{
712718
"command": "kdb.execute.pythonScratchpadQuery",
713719
"group": "q@1",
714-
"when": "editorLangId == python"
720+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
715721
}
716722
],
717723
"editor/context": [
@@ -728,17 +734,17 @@
728734
{
729735
"command": "kdb.terminal.run",
730736
"group": "q@2",
731-
"when": "editorLangId == q"
737+
"when": "editorLangId == q && !(resourceFilename =~ /.kdb.q/)"
732738
},
733739
{
734740
"command": "kdb.execute.pythonFileScratchpadQuery",
735741
"group": "q@0",
736-
"when": "editorLangId == python"
742+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
737743
},
738744
{
739745
"command": "kdb.execute.pythonScratchpadQuery",
740746
"group": "q@1",
741-
"when": "editorLangId == python"
747+
"when": "editorLangId == python && (resourceFilename =~ /.kdb.py/ || kdb.insightsConnected)"
742748
}
743749
]
744750
},
@@ -829,7 +835,6 @@
829835
"axios": "^1.6.8",
830836
"chevrotain": "^10.5.0",
831837
"csv-parser": "^3.0.0",
832-
"esbuild-plugin-copy": "^2.1.1",
833838
"extract-zip": "^2.0.1",
834839
"fs-extra": "^11.2.0",
835840
"fuse.js": "^7.0.0",

0 commit comments

Comments
 (0)
Please sign in to comment.