@darkrymit/crunes-cli 0.11.0 → 0.11.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.
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  addMarketplace
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-AWQ3C7MQ.js";
4
+ import "./chunk-M66PQTTU.js";
4
5
  import "./chunk-2Q3KLBE6.js";
5
6
  import {
6
7
  init_require_shim
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  searchMarketplaces
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-AWQ3C7MQ.js";
4
+ import "./chunk-M66PQTTU.js";
4
5
  import "./chunk-2Q3KLBE6.js";
5
6
  import {
6
7
  init_require_shim
@@ -1,3 +1,6 @@
1
+ import {
2
+ fo
3
+ } from "./chunk-M66PQTTU.js";
1
4
  import {
2
5
  ensureStoreDirs,
3
6
  getMarketplaceCacheDir,
@@ -71,7 +74,7 @@ async function downloadMarketplaceJson(classified) {
71
74
  if (!tarball) throw new Error(`npm pack produced no tarball for ${classified.resolved}`);
72
75
  const extractDir = path.join(tmp, "extracted");
73
76
  await fs.mkdir(extractDir, { recursive: true });
74
- await execFileAsync("tar", ["-xzf", path.join(tmp, tarball), "-C", extractDir, "--strip-components=1"], { shell: process.platform === "win32" });
77
+ await fo({ file: path.join(tmp, tarball), cwd: extractDir, strip: 1 });
75
78
  const raw = await fs.readFile(path.join(extractDir, ".crunes-plugin", "marketplace.json"), "utf8");
76
79
  return JSON.parse(raw);
77
80
  } finally {
@@ -102,7 +105,8 @@ async function fetchMarketplace(name, entry) {
102
105
  const cacheDir = getMarketplaceCacheDir(name);
103
106
  try {
104
107
  const data = JSON.parse(await fs.readFile(path.join(cacheDir, "marketplace.json"), "utf8"));
105
- return { data, resolvedPath: cacheDir };
108
+ const resolvedPath = classified.type === "github" ? `github:${classified.resolved}` : cacheDir;
109
+ return { data, resolvedPath };
106
110
  } catch (err) {
107
111
  if (err.code === "ENOENT") throw new Error(`Marketplace "${name}" not cached. Run: crunes marketplace update ${name}`);
108
112
  throw err;
@@ -209,6 +213,10 @@ async function resolveFromMarketplace(marketplaceName, pluginName) {
209
213
  }
210
214
  function resolvePluginSource(source, marketplaceResolvedPath) {
211
215
  if (!isLocalPath(source)) return source;
216
+ if (marketplaceResolvedPath.startsWith("github:")) {
217
+ const subpath = source.replace(/^\.?[\\/]+/, "").replace(/\\/g, "/");
218
+ return subpath ? `${marketplaceResolvedPath}#${subpath}` : marketplaceResolvedPath;
219
+ }
212
220
  if (marketplaceResolvedPath.startsWith("http://") || marketplaceResolvedPath.startsWith("https://")) {
213
221
  return new URL(source, marketplaceResolvedPath).href;
214
222
  }