@voltstack/vpm 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38326,18 +38326,38 @@ var extractZip = async (archive, target) => {
38326
38326
  throw new Error(`Failed to extract zip archive ${archive}: ${result.error?.message ?? "unzip exited non-zero"}`);
38327
38327
  }
38328
38328
  };
38329
+ var sniffFormat = (archive) => {
38330
+ const buf = Buffer.alloc(4);
38331
+ const fd = fs14.openSync(archive, "r");
38332
+ try {
38333
+ fs14.readSync(fd, buf, 0, 4, 0);
38334
+ } finally {
38335
+ fs14.closeSync(fd);
38336
+ }
38337
+ if (buf[0] === 40 && buf[1] === 181 && buf[2] === 47 && buf[3] === 253) {
38338
+ return "zst";
38339
+ }
38340
+ if (buf[0] === 31 && buf[1] === 139) {
38341
+ return "gz";
38342
+ }
38343
+ if (buf[0] === 80 && buf[1] === 75) {
38344
+ return "zip";
38345
+ }
38346
+ return null;
38347
+ };
38329
38348
  var extractArchive = async (archive, target) => {
38330
- const lower = archive.toLowerCase();
38331
38349
  logger.debug(`extracting ${archive} -> ${target}`);
38332
- if (lower.endsWith(".tar.zst")) {
38350
+ const lower = archive.toLowerCase();
38351
+ const format = sniffFormat(archive) ?? (lower.endsWith(".tar.zst") ? "zst" : lower.endsWith(".tar.gz") || lower.endsWith(".tgz") ? "gz" : lower.endsWith(".zip") ? "zip" : null);
38352
+ if (format === "zst") {
38333
38353
  await extractTarZst(archive, target);
38334
38354
  return;
38335
38355
  }
38336
- if (lower.endsWith(".tar.gz") || lower.endsWith(".tgz")) {
38356
+ if (format === "gz") {
38337
38357
  await extractTarGzip(archive, target);
38338
38358
  return;
38339
38359
  }
38340
- if (lower.endsWith(".zip")) {
38360
+ if (format === "zip") {
38341
38361
  await extractZip(archive, target);
38342
38362
  return;
38343
38363
  }
@@ -38801,7 +38821,7 @@ var register13 = (program2) => {
38801
38821
  // src/index.ts
38802
38822
  var buildProgram = () => {
38803
38823
  const program2 = new Command();
38804
- program2.name("vpm").description("VoltCloud plugin registry CLI").version("1.0.1", "-v, --version", "output the current version").option("--registry <url>", "override the registry URL").option("--console <url>", "override the console URL").option("--verbose", "enable verbose logging").hook("preAction", (thisCommand) => {
38824
+ program2.name("vpm").description("VoltCloud plugin registry CLI").version("1.0.2", "-v, --version", "output the current version").option("--registry <url>", "override the registry URL").option("--console <url>", "override the console URL").option("--verbose", "enable verbose logging").hook("preAction", (thisCommand) => {
38805
38825
  const opts = thisCommand.opts();
38806
38826
  if (opts.verbose) {
38807
38827
  setVerbose(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltstack/vpm",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "VoltCloud plugin registry CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",