@b12k/gitleaks 8.30.1-v.2 → 8.30.1-v.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,19 @@
1
- import extract_zip from "extract-zip";
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
2
3
  import { extract } from "tar";
3
4
  import { logError } from "./log.js";
5
+ const execFileAsync = promisify(execFile);
4
6
  async function extractArchive(archivePath, targetDirectoryPath) {
5
- if (archivePath.endsWith('.zip')) return void await extract_zip(archivePath, {
6
- dir: targetDirectoryPath
7
- });
7
+ if (archivePath.endsWith('.zip')) {
8
+ const quotedArchivePath = `'${archivePath.replaceAll("'", "''")}'`;
9
+ const quotedTargetDirectoryPath = `'${targetDirectoryPath.replaceAll("'", "''")}'`;
10
+ await execFileAsync('powershell.exe', [
11
+ '-NoProfile',
12
+ '-Command',
13
+ `Expand-Archive -LiteralPath ${quotedArchivePath} -DestinationPath ${quotedTargetDirectoryPath} -Force`
14
+ ]);
15
+ return;
16
+ }
8
17
  if (archivePath.endsWith('.tar.gz')) return void await extract({
9
18
  cwd: targetDirectoryPath,
10
19
  file: archivePath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b12k/gitleaks",
3
- "version": "8.30.1-v.2",
3
+ "version": "8.30.1-v.4",
4
4
  "description": "The missing NPM wrapper for Gitleaks",
5
5
  "keywords": [
6
6
  "api-keys",
@@ -1,6 +1,7 @@
1
1
  import path from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
2
3
 
3
4
  const directory = import.meta.dirname;
4
5
  // eslint-disable-next-line n/no-process-exit
5
6
  if (!directory.includes('node_modules')) process.exit(0);
6
- await import(path.join(directory, '../dist/postinstall.js'));
7
+ await import(pathToFileURL(path.join(directory, '../dist/postinstall.js')));