Skip to content

Commit 4444951

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/yauzl-concurrent
2 parents 7a1f157 + e824fda commit 4444951

File tree

7 files changed

+223
-139
lines changed

7 files changed

+223
-139
lines changed

extensions/ql-vscode/package-lock.json

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

extensions/ql-vscode/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,6 @@
19401940
"tmp": "^0.2.1",
19411941
"tmp-promise": "^3.0.2",
19421942
"tree-kill": "^1.2.2",
1943-
"unzipper": "^0.10.5",
19441943
"vscode-extension-telemetry": "^0.1.6",
19451944
"vscode-jsonrpc": "^8.0.2",
19461945
"vscode-languageclient": "^8.0.2",

extensions/ql-vscode/scripts/source-map.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { spawnSync } from "child_process";
2020
import { basename, resolve } from "path";
2121
import { pathExists, readJSON } from "fs-extra";
2222
import { RawSourceMap, SourceMapConsumer } from "source-map";
23-
import { Open } from "unzipper";
23+
import { unzipToDirectorySequentially } from "../src/common/unzip";
2424

2525
if (process.argv.length !== 4) {
2626
console.error(
@@ -78,10 +78,10 @@ async function extractSourceMap() {
7878
releaseAssetsDirectory,
7979
]);
8080

81-
const file = await Open.file(
81+
await unzipToDirectorySequentially(
8282
resolve(releaseAssetsDirectory, sourcemapAsset.name),
83+
sourceMapsDirectory,
8384
);
84-
await file.extract({ path: sourceMapsDirectory });
8585
} else {
8686
const workflowRuns = runGhJSON<WorkflowRunListItem[]>([
8787
"run",

extensions/ql-vscode/src/common/files.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,23 @@ export async function readDirFullPaths(path: string): Promise<string[]> {
9191
* Symbolic links are ignored.
9292
*
9393
* @param dir the directory to walk
94+
* @param includeDirectories whether to include directories in the results
9495
*
9596
* @return An iterator of the full path to all files recursively found in the directory.
9697
*/
9798
export async function* walkDirectory(
9899
dir: string,
100+
includeDirectories = false,
99101
): AsyncIterableIterator<string> {
100102
const seenFiles = new Set<string>();
101103
for await (const d of await opendir(dir)) {
102104
const entry = join(dir, d.name);
103105
seenFiles.add(entry);
104106
if (d.isDirectory()) {
105-
yield* walkDirectory(entry);
107+
if (includeDirectories) {
108+
yield entry;
109+
}
110+
yield* walkDirectory(entry, includeDirectories);
106111
} else if (d.isFile()) {
107112
yield entry;
108113
}

extensions/ql-vscode/src/common/unzip.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ export function readZipEntries(zipFile: ZipFile): Promise<ZipEntry[]> {
3131

3232
zipFile.readEntry();
3333
zipFile.on("entry", (entry: ZipEntry) => {
34-
if (/\/$/.test(entry.fileName)) {
35-
// Directory file names end with '/'
36-
// We don't need to do anything for directories.
37-
} else {
38-
files.push(entry);
39-
}
34+
files.push(entry);
4035

4136
zipFile.readEntry();
4237
});

0 commit comments

Comments
 (0)