Merge pull request #3145 from github/dependabot/npm_and_yarn/extensions/ql-vscode/tmp-0.2.1

Bump tmp from 0.1.0 to 0.2.1 in /extensions/ql-vscode
This commit is contained in:
Koen Vlaswinkel
2023-12-14 16:28:02 +01:00
committed by GitHub
13 changed files with 58 additions and 88 deletions

View File

@@ -36,7 +36,7 @@
"source-map-support": "^0.5.21",
"stream-json": "^1.7.3",
"styled-components": "^6.0.2",
"tmp": "^0.1.0",
"tmp": "^0.2.1",
"tmp-promise": "^3.0.2",
"tree-kill": "^1.2.2",
"unzipper": "^0.10.5",
@@ -8584,18 +8584,6 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@vscode/vsce/node_modules/tmp": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dev": true,
"dependencies": {
"rimraf": "^3.0.0"
},
"engines": {
"node": ">=8.17.0"
}
},
"node_modules/@vscode/webview-ui-toolkit": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@vscode/webview-ui-toolkit/-/webview-ui-toolkit-1.4.0.tgz",
@@ -28352,25 +28340,6 @@
}
},
"node_modules/tmp": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==",
"dependencies": {
"rimraf": "^2.6.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tmp-promise": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"dependencies": {
"tmp": "^0.2.0"
}
},
"node_modules/tmp-promise/node_modules/tmp": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
@@ -28381,34 +28350,12 @@
"node": ">=8.17.0"
}
},
"node_modules/tmp/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"node_modules/tmp-promise": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/tmp/node_modules/rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
"tmp": "^0.2.0"
}
},
"node_modules/tmpl": {

View File

@@ -1938,7 +1938,7 @@
"source-map-support": "^0.5.21",
"stream-json": "^1.7.3",
"styled-components": "^6.0.2",
"tmp": "^0.1.0",
"tmp": "^0.2.1",
"tmp-promise": "^3.0.2",
"tree-kill": "^1.2.2",
"unzipper": "^0.10.5",

View File

@@ -9,7 +9,9 @@ import {
describe("isLikelyDatabaseRoot", () => {
let dir: tmp.DirResult;
beforeEach(() => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
});
afterEach(() => {
@@ -54,7 +56,9 @@ describe("isLikelyDatabaseRoot", () => {
describe("isLikelyDbLanguageFolder", () => {
let dir: tmp.DirResult;
beforeEach(() => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
});
afterEach(() => {

View File

@@ -10,7 +10,9 @@ describe("getInitialQueryContents", () => {
let language: QueryLanguage;
beforeEach(() => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
language = QueryLanguage.Cpp;
const contents = dump({

View File

@@ -1,5 +1,4 @@
import { Uri, workspace } from "vscode";
import * as tmp from "tmp";
import { CodeQLCliServer } from "../../../../src/codeql-cli/cli";
import { getActivatedExtension } from "../../global.helper";
import { mkdirSync, writeFileSync } from "fs";
@@ -10,7 +9,9 @@ import {
import { ExtensionPack } from "../../../../src/model-editor/shared/extension-pack";
import { join } from "path";
import { extLogger } from "../../../../src/common/logging/vscode";
import { homedir } from "os";
import { homedir, tmpdir } from "os";
import { mkdir, rm } from "fs-extra";
import { nanoid } from "nanoid";
import { QueryLanguage } from "../../../../src/common/query-language";
const dummyExtensionPackContents = `
@@ -49,21 +50,23 @@ extensions:
describe("modeled-method-fs", () => {
let tmpDir: string;
let tmpDirRemoveCallback: (() => void) | undefined;
let tmpDirRemoveCallback: (() => Promise<void>) | undefined;
let workspacePath: string;
let cli: CodeQLCliServer;
beforeEach(async () => {
// On windows, make sure to use a temp directory that isn't an alias and therefore won't be canonicalised by CodeQL.
// The tmp package doesn't support this, so we have to do it manually.
// See https://github.com/github/vscode-codeql/pull/2605 for more context.
const t = tmp.dirSync({
dir:
process.platform === "win32"
? join(homedir(), "AppData", "Local", "Temp")
: undefined,
});
tmpDir = t.name;
tmpDirRemoveCallback = t.removeCallback;
const systemTmpDir =
process.platform === "win32"
? join(homedir(), "AppData", "Local", "Temp")
: tmpdir();
tmpDir = join(systemTmpDir, `codeql-vscode-test-${nanoid(8)}`);
await mkdir(tmpDir, { recursive: true });
tmpDirRemoveCallback = async () => {
await rm(tmpDir, { recursive: true });
};
const workspaceFolder = {
uri: Uri.file(join(tmpDir, "workspace")),
@@ -89,8 +92,8 @@ describe("modeled-method-fs", () => {
await cli.packInstall(packUsingExtensionsPath);
});
afterEach(() => {
tmpDirRemoveCallback?.();
afterEach(async () => {
await tmpDirRemoveCallback?.();
});
function writeExtensionPackFiles(

View File

@@ -19,7 +19,9 @@ let removeStorage: tmp.DirResult["removeCallback"] | undefined;
export async function beforeAllAction() {
// Create the temp directory to be used as extension local storage.
const dir = tmp.dirSync();
const dir = tmp.dirSync({
unsafeCleanup: true,
});
let storagePath = realpathSync(dir.name);
if (storagePath.substring(0, 2).match(/[A-Z]:/)) {
storagePath =

View File

@@ -83,7 +83,9 @@ describe("FilePathDiscovery", () => {
let discovery: TestFilePathDiscovery;
beforeEach(() => {
const t = tmp.dirSync();
const t = tmp.dirSync({
unsafeCleanup: true,
});
tmpDir = normalizePath(t.name);
tmpDirRemoveCallback = t.removeCallback;

View File

@@ -52,7 +52,9 @@ describe("local databases", () => {
let extensionContextStoragePath: string;
beforeEach(() => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
updateSpy = jest.fn(() => Promise.resolve(undefined));
registerSpy = jest.fn(() => Promise.resolve(undefined));

View File

@@ -25,7 +25,9 @@ describe("QlPackGenerator", () => {
let dir: tmp.DirResult;
beforeEach(async () => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
language = "ruby";
packFolderPath = Uri.file(

View File

@@ -31,7 +31,9 @@ describe("Query pack discovery", () => {
let discovery: QueryDiscovery;
beforeEach(() => {
const t = tmp.dirSync();
const t = tmp.dirSync({
unsafeCleanup: true,
});
tmpDir = t.name;
tmpDirRemoveCallback = t.removeCallback;

View File

@@ -18,7 +18,9 @@ describe("Query pack discovery", () => {
let discovery: QueryPackDiscovery;
beforeEach(() => {
const t = tmp.dirSync();
const t = tmp.dirSync({
unsafeCleanup: true,
});
tmpDir = t.name;
tmpDirRemoveCallback = t.removeCallback;

View File

@@ -14,7 +14,9 @@ describe("prepareCodeTour", () => {
>;
beforeEach(() => {
dir = tmp.dirSync();
dir = tmp.dirSync({
unsafeCleanup: true,
});
const mockWorkspaceFolders = [
{

View File

@@ -18,7 +18,7 @@ describe("local-databases-ui", () => {
describe("fixDbUri", () => {
const fixDbUri = (DatabaseUI.prototype as any).fixDbUri;
it("should choose current directory normally", async () => {
const dir = dirSync().name;
const dir = dirSync({ unsafeCleanup: true }).name;
const uri = await fixDbUri(Uri.file(dir));
expect(uri.toString()).toBe(Uri.file(dir).toString());
});
@@ -30,7 +30,7 @@ describe("local-databases-ui", () => {
});
it("should choose parent directory when db-* is selected", async () => {
const dir = dirSync().name;
const dir = dirSync({ unsafeCleanup: true }).name;
const dbDir = join(dir, "db-javascript");
await mkdirs(dbDir);
@@ -39,7 +39,7 @@ describe("local-databases-ui", () => {
});
it("should choose parent's parent directory when file selected is in db-*", async () => {
const dir = dirSync().name;
const dir = dirSync({ unsafeCleanup: true }).name;
const dbDir = join(dir, "db-javascript");
const file = join(dbDir, "nested");
await mkdirs(dbDir);
@@ -51,7 +51,7 @@ describe("local-databases-ui", () => {
it("should handle a parent whose name is db-*", async () => {
// fixes https://github.com/github/vscode-codeql/issues/482
const dir = dirSync().name;
const dir = dirSync({ unsafeCleanup: true }).name;
const parentDir = join(dir, "db-hucairz");
const dbDir = join(parentDir, "db-javascript");
const file = join(dbDir, "nested");
@@ -64,7 +64,7 @@ describe("local-databases-ui", () => {
});
it("should delete orphaned databases", async () => {
const storageDir = dirSync().name;
const storageDir = dirSync({ unsafeCleanup: true }).name;
const db1 = createDatabase(storageDir, "db1-imported", QueryLanguage.Cpp);
const db2 = createDatabase(
storageDir,