@mulmoclaude/core 7.5.0 → 7.7.0
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.
- package/dist/collection/index.cjs +3 -3
- package/dist/collection/index.js +3 -3
- package/dist/collection/registry/server/index.cjs +3 -3
- package/dist/collection/registry/server/index.js +3 -3
- package/dist/collection/server/index.cjs +2 -2
- package/dist/collection/server/index.js +2 -2
- package/dist/collection-watchers/index.cjs +4 -4
- package/dist/collection-watchers/index.js +4 -4
- package/dist/{discovery-CY4pvgo9.cjs → discovery-BSvWBOGB.cjs} +4 -4
- package/dist/discovery-BSvWBOGB.cjs.map +1 -0
- package/dist/{discovery-CImpaG95.js → discovery-DEhLlDVW.js} +4 -4
- package/dist/discovery-DEhLlDVW.js.map +1 -0
- package/dist/{dist-BmO4oSQy.js → dist--searOB5.js} +2 -2
- package/dist/dist--searOB5.js.map +1 -0
- package/dist/{dist-734JaRYi.cjs → dist-CdSEjlVx.cjs} +2 -2
- package/dist/dist-CdSEjlVx.cjs.map +1 -0
- package/dist/errorMessage-B-iVKe5R.cjs +1 -0
- package/dist/errorMessage-D-HWCI2W.js +1 -0
- package/dist/{errors-B9mCEVG9.cjs → errors-B7ShVbIB.cjs} +2 -2
- package/dist/{errors-B9mCEVG9.cjs.map → errors-B7ShVbIB.cjs.map} +1 -1
- package/dist/{errors-0QwjDxsv.js → errors-BbH5CeKm.js} +2 -2
- package/dist/{errors-0QwjDxsv.js.map → errors-BbH5CeKm.js.map} +1 -1
- package/dist/feeds/server/index.cjs +5 -5
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +5 -5
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/google/index.cjs +3 -3
- package/dist/google/index.js +3 -3
- package/dist/{listen-uiEnXcW9.js → listen-Bm8N0g9o.js} +2 -2
- package/dist/{listen-uiEnXcW9.js.map → listen-Bm8N0g9o.js.map} +1 -1
- package/dist/{listen-OmfLDX1l.cjs → listen-OGOFPIdk.cjs} +2 -2
- package/dist/{listen-OmfLDX1l.cjs.map → listen-OGOFPIdk.cjs.map} +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-CRTk34EC.cjs → notifier-8R05SHLj.cjs} +2 -2
- package/dist/{notifier-CRTk34EC.cjs.map → notifier-8R05SHLj.cjs.map} +1 -1
- package/dist/{notifier-htdf4ekH.js → notifier-D7TmVus0.js} +2 -2
- package/dist/{notifier-htdf4ekH.js.map → notifier-D7TmVus0.js.map} +1 -1
- package/dist/plugin-vue/index.cjs +1 -1
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +1 -1
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/prompt-files/index.cjs +1 -1
- package/dist/prompt-files/index.js +1 -1
- package/dist/{promptSafety-CjxafW2b.cjs → promptSafety-CF6OCtor.cjs} +2 -2
- package/dist/{promptSafety-CjxafW2b.cjs.map → promptSafety-CF6OCtor.cjs.map} +1 -1
- package/dist/{promptSafety-B8LECAkY.js → promptSafety-CYU_kLUL.js} +2 -2
- package/dist/{promptSafety-B8LECAkY.js.map → promptSafety-CYU_kLUL.js.map} +1 -1
- package/dist/remote-host/index.cjs +1 -1
- package/dist/remote-host/index.js +1 -1
- package/dist/remote-host/server/index.cjs +4 -4
- package/dist/remote-host/server/index.js +4 -4
- package/dist/{remote-host-TiMhcW1o.js → remote-host-BiCg_ioB.js} +2 -2
- package/dist/{remote-host-TiMhcW1o.js.map → remote-host-BiCg_ioB.js.map} +1 -1
- package/dist/{remote-host-11euEZKP.cjs → remote-host-neXWDACl.cjs} +2 -2
- package/dist/{remote-host-11euEZKP.cjs.map → remote-host-neXWDACl.cjs.map} +1 -1
- package/dist/remote-view/index.cjs +1 -1
- package/dist/remote-view/index.js +1 -1
- package/dist/runtime-plugins/extract.d.ts +6 -0
- package/dist/runtime-plugins/fetchPackage.d.ts +15 -2
- package/dist/runtime-plugins/index.cjs +177 -23
- package/dist/runtime-plugins/index.cjs.map +1 -1
- package/dist/runtime-plugins/index.js +179 -25
- package/dist/runtime-plugins/index.js.map +1 -1
- package/dist/runtime-plugins/install.d.ts +3 -2
- package/dist/runtime-plugins/installSource.d.ts +3 -0
- package/dist/runtime-plugins/ledger.d.ts +1 -1
- package/dist/runtime-plugins/load.d.ts +2 -5
- package/dist/scheduler/index.cjs +2 -2
- package/dist/scheduler/index.js +2 -2
- package/dist/{server-BXtSbL-b.cjs → server-BxwOUg_l.cjs} +5 -5
- package/dist/{server-BXtSbL-b.cjs.map → server-BxwOUg_l.cjs.map} +1 -1
- package/dist/{server-B5TZjZN9.js → server-C3HNV-PG.js} +5 -5
- package/dist/{server-B5TZjZN9.js.map → server-C3HNV-PG.js.map} +1 -1
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/whisper/index.cjs +2 -2
- package/dist/whisper/index.js +2 -2
- package/dist/wiki/index.cjs +1 -1
- package/dist/wiki/index.js +1 -1
- package/dist/workspace-setup/index.js +1 -1
- package/dist/workspace-setup/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/discovery-CImpaG95.js.map +0 -1
- package/dist/discovery-CY4pvgo9.cjs.map +0 -1
- package/dist/dist-734JaRYi.cjs.map +0 -1
- package/dist/dist-BmO4oSQy.js.map +0 -1
- package/dist/errorMessage-D0kR547_.cjs +0 -1
- package/dist/errorMessage-TpKxrmeo.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as isRecord, i as hasStringProp } from "../dist
|
|
1
|
+
import { c as isRecord, i as hasStringProp } from "../dist--searOB5.js";
|
|
2
2
|
import { n as isWithinRoot, r as realpathSyncOrNull, t as isInsideRoot } from "../containment-D_vAa6eT.js";
|
|
3
3
|
import { t as writeJsonAtomic } from "../json-BizOSThv.js";
|
|
4
4
|
import { n as writeFileAtomic } from "../atomic-C3NMg6-j.js";
|
|
5
5
|
import { isPluginFactory } from "gui-chat-protocol";
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { closeSync, constants, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
9
|
+
import { constants as constants$1, mkdir, mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
11
|
import { pathToFileURL } from "node:url";
|
|
12
12
|
import { createGunzip } from "node:zlib";
|
|
@@ -139,6 +139,53 @@ function extractTgz(tgzAbs, destDir) {
|
|
|
139
139
|
throw err;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
var removeQuietly = (dir) => {
|
|
143
|
+
try {
|
|
144
|
+
rmSync(dir, {
|
|
145
|
+
recursive: true,
|
|
146
|
+
force: true
|
|
147
|
+
});
|
|
148
|
+
} catch {}
|
|
149
|
+
};
|
|
150
|
+
function publishStaged(staging, destDir) {
|
|
151
|
+
try {
|
|
152
|
+
renameSync(staging, destDir);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
removeQuietly(staging);
|
|
155
|
+
if (!isCacheValid(destDir)) throw err;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Unpack `bytes` (a gzipped npm tarball) to `destDir` so that no reader ever sees a partial tree, even
|
|
159
|
+
* with two processes (MulmoClaude and MulmoTerminal on one workspace) unpacking the same folder at once:
|
|
160
|
+
* into a unique sibling folder, completed with the marker, then renamed into place. The bytes are the
|
|
161
|
+
* ones the caller already read and keyed the folder by, so what is unpacked is what the key names. */
|
|
162
|
+
function extractBytesAtomically(bytes, destDir) {
|
|
163
|
+
if (isCacheValid(destDir)) return;
|
|
164
|
+
const parent = path.dirname(destDir);
|
|
165
|
+
mkdirSync(parent, { recursive: true });
|
|
166
|
+
const staging = mkdtempSync(path.join(parent, `.${path.basename(destDir)}-`));
|
|
167
|
+
try {
|
|
168
|
+
execFileSync("tar", [
|
|
169
|
+
"-xzf",
|
|
170
|
+
"-",
|
|
171
|
+
"-C",
|
|
172
|
+
staging,
|
|
173
|
+
"--strip-components=1"
|
|
174
|
+
], {
|
|
175
|
+
input: bytes,
|
|
176
|
+
stdio: [
|
|
177
|
+
"pipe",
|
|
178
|
+
"pipe",
|
|
179
|
+
"pipe"
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
writeMarker(path.join(staging, EXTRACT_MARKER));
|
|
183
|
+
publishStaged(staging, destDir);
|
|
184
|
+
} catch (err) {
|
|
185
|
+
removeQuietly(staging);
|
|
186
|
+
throw err;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
142
189
|
// src/runtime-plugins/containment.ts
|
|
143
190
|
/** True when `file` exists and, with every link followed, is inside `root`. */
|
|
144
191
|
function resolvesInside(file, root) {
|
|
@@ -310,9 +357,50 @@ function ensureInsideBase(candidate, base) {
|
|
|
310
357
|
/** Make a ledger entry's cache directory ready to load: both of its paths anchored inside their
|
|
311
358
|
* roots, its tgz present, and the tgz extracted unless a complete extract is already there.
|
|
312
359
|
* Returns the cache directory, or null (logged) when the entry cannot be loaded. */
|
|
360
|
+
var MAX_PACKAGE_FILE_BYTES = 52428800;
|
|
361
|
+
var READ_CHUNK_BYTES$1 = 65536;
|
|
362
|
+
var READ_FLAGS$1 = constants.O_RDONLY | (constants.O_NONBLOCK ?? 0);
|
|
363
|
+
function readChunks(fileHandle, maxBytes) {
|
|
364
|
+
const chunks = [];
|
|
365
|
+
let received = 0;
|
|
366
|
+
for (;;) {
|
|
367
|
+
const chunk = Buffer.alloc(READ_CHUNK_BYTES$1);
|
|
368
|
+
const bytesRead = readSync(fileHandle, chunk, 0, READ_CHUNK_BYTES$1, null);
|
|
369
|
+
if (bytesRead === 0) return Buffer.concat(chunks, received);
|
|
370
|
+
received += bytesRead;
|
|
371
|
+
if (received > maxBytes) return null;
|
|
372
|
+
chunks.push(chunk.subarray(0, bytesRead));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/** The package file's bytes, or null when it is not a regular file or grows past the limit while read. */
|
|
376
|
+
function readPackageFile$1(tgzAbs) {
|
|
377
|
+
const fileHandle = openSync(tgzAbs, READ_FLAGS$1);
|
|
378
|
+
try {
|
|
379
|
+
return fstatSync(fileHandle).isFile() ? readChunks(fileHandle, MAX_PACKAGE_FILE_BYTES) : null;
|
|
380
|
+
} finally {
|
|
381
|
+
closeSync(fileHandle);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function loggedPackageBytes(tgzAbs, entry, log) {
|
|
385
|
+
try {
|
|
386
|
+
const bytes = readPackageFile$1(tgzAbs);
|
|
387
|
+
if (bytes === null) log.warn("tgz is not a package file within the size limit — skipping", {
|
|
388
|
+
name: entry.name,
|
|
389
|
+
tgz: entry.tgz
|
|
390
|
+
});
|
|
391
|
+
return bytes;
|
|
392
|
+
} catch (err) {
|
|
393
|
+
log.error("tgz unreadable — skipping", {
|
|
394
|
+
name: entry.name,
|
|
395
|
+
tgz: entry.tgz,
|
|
396
|
+
error: String(err)
|
|
397
|
+
});
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
313
401
|
function prepareLedgerEntry(entry, roots, log) {
|
|
314
402
|
const tgzAbs = path.join(roots.pluginsDir, entry.tgz);
|
|
315
|
-
const
|
|
403
|
+
const versionDir = path.join(roots.cacheDir, entry.name, entry.version);
|
|
316
404
|
if (!ensureInsideBase(tgzAbs, roots.pluginsDir)) {
|
|
317
405
|
log.warn("ledger entry tgz escapes plugins root — skipping", {
|
|
318
406
|
name: entry.name,
|
|
@@ -320,7 +408,7 @@ function prepareLedgerEntry(entry, roots, log) {
|
|
|
320
408
|
});
|
|
321
409
|
return null;
|
|
322
410
|
}
|
|
323
|
-
if (!ensureInsideBase(
|
|
411
|
+
if (!ensureInsideBase(versionDir, roots.cacheDir)) {
|
|
324
412
|
log.warn("ledger entry escapes plugin cache root — skipping", {
|
|
325
413
|
name: entry.name,
|
|
326
414
|
version: entry.version
|
|
@@ -334,8 +422,11 @@ function prepareLedgerEntry(entry, roots, log) {
|
|
|
334
422
|
});
|
|
335
423
|
return null;
|
|
336
424
|
}
|
|
425
|
+
const bytes = loggedPackageBytes(tgzAbs, entry, log);
|
|
426
|
+
if (bytes === null) return null;
|
|
427
|
+
const cachePath = path.join(versionDir, createHash("sha256").update(bytes).digest("hex"));
|
|
337
428
|
if (!isCacheValid(cachePath)) try {
|
|
338
|
-
|
|
429
|
+
extractBytesAtomically(bytes, cachePath);
|
|
339
430
|
log.info("extracted", {
|
|
340
431
|
name: entry.name,
|
|
341
432
|
version: entry.version
|
|
@@ -437,6 +528,8 @@ var GITHUB_OWNER = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/;
|
|
|
437
528
|
var GITHUB_REPO = /^[A-Za-z0-9._-]{1,100}$/;
|
|
438
529
|
var GITHUB_TAG = /^[A-Za-z0-9._+/-]+$/;
|
|
439
530
|
var GITHUB_PREFIX = "github:";
|
|
531
|
+
var FILE_PREFIX = "file:";
|
|
532
|
+
var PACKAGE_FILE_SUFFIX = ".tgz";
|
|
440
533
|
var refuse$1 = (error) => ({
|
|
441
534
|
ok: false,
|
|
442
535
|
error
|
|
@@ -489,11 +582,11 @@ function parseNpm(input) {
|
|
|
489
582
|
var isGithubTag = (tag) => tag.length <= MAX_TAG_LENGTH && GITHUB_TAG.test(tag) && !tag.split("/").some((part) => part === "" || part === "." || part === "..");
|
|
490
583
|
function parseGithub(rest) {
|
|
491
584
|
const hash = rest.indexOf("#");
|
|
492
|
-
const
|
|
585
|
+
const ownerRepo = hash === -1 ? rest : rest.slice(0, hash);
|
|
493
586
|
const tag = hash === -1 ? null : rest.slice(hash + 1);
|
|
494
|
-
const [owner = "", repo = "", ...extra] =
|
|
495
|
-
if (extra.length > 0 || !GITHUB_OWNER.test(owner)) return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(
|
|
496
|
-
if (!GITHUB_REPO.test(repo) || repo === "." || repo === "..") return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(
|
|
587
|
+
const [owner = "", repo = "", ...extra] = ownerRepo.split("/");
|
|
588
|
+
if (extra.length > 0 || !GITHUB_OWNER.test(owner)) return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(ownerRepo)}`);
|
|
589
|
+
if (!GITHUB_REPO.test(repo) || repo === "." || repo === "..") return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(ownerRepo)}`);
|
|
497
590
|
if (tag !== null && !isGithubTag(tag)) return refuse$1(`not a release tag: ${JSON.stringify(tag)}`);
|
|
498
591
|
return {
|
|
499
592
|
ok: true,
|
|
@@ -505,15 +598,32 @@ function parseGithub(rest) {
|
|
|
505
598
|
}
|
|
506
599
|
};
|
|
507
600
|
}
|
|
601
|
+
function parseFile(rest) {
|
|
602
|
+
if (rest === "") return refuse$1("a file: source names no file");
|
|
603
|
+
if (rest.includes("\0")) return refuse$1("a file: source contains a NUL byte");
|
|
604
|
+
if (!path.isAbsolute(rest)) return refuse$1(`a file: source must be an absolute path: ${JSON.stringify(rest)}`);
|
|
605
|
+
if (!rest.endsWith(PACKAGE_FILE_SUFFIX)) return refuse$1(`a file: source must name a ${PACKAGE_FILE_SUFFIX} package file: ${JSON.stringify(rest)}`);
|
|
606
|
+
return {
|
|
607
|
+
ok: true,
|
|
608
|
+
source: {
|
|
609
|
+
kind: "file",
|
|
610
|
+
path: path.normalize(rest)
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
508
614
|
function parseInstallSource(input) {
|
|
509
615
|
if (typeof input !== "string") return refuse$1("an install source is a string");
|
|
510
616
|
const trimmed = input.trim();
|
|
511
617
|
if (trimmed === "") return refuse$1("an install source is empty");
|
|
512
|
-
|
|
618
|
+
if (trimmed.startsWith(GITHUB_PREFIX)) return parseGithub(trimmed.slice(7));
|
|
619
|
+
if (trimmed.startsWith(FILE_PREFIX)) return parseFile(trimmed.slice(5));
|
|
620
|
+
return parseNpm(trimmed);
|
|
513
621
|
}
|
|
514
622
|
/** The ledger's `source` field for what was actually installed: the resolved version or tag. */
|
|
515
623
|
function sourceLabel(source, resolved) {
|
|
516
|
-
|
|
624
|
+
if (source.kind === "npm") return `npm:${source.name}@${resolved}`;
|
|
625
|
+
if (source.kind === "github") return `github:${source.owner}/${source.repo}#${resolved}`;
|
|
626
|
+
return `${FILE_PREFIX}${source.path}`;
|
|
517
627
|
}
|
|
518
628
|
/** The file name `npm pack` gives the package — `@scope/name` 1.2.3 → `scope-name-1.2.3.tgz`. */
|
|
519
629
|
var packageFileName = (name, version) => `${name.replace(/^@/, "").replaceAll("/", "-")}-${version}.tgz`;
|
|
@@ -813,7 +923,62 @@ async function fetchGithub(source, deps) {
|
|
|
813
923
|
resolved: asset.tag
|
|
814
924
|
};
|
|
815
925
|
}
|
|
816
|
-
var
|
|
926
|
+
var errorCode = (err) => err instanceof Error && "code" in err && typeof err.code === "string" ? err.code : String(err);
|
|
927
|
+
var READ_FLAGS = constants$1.O_RDONLY | (constants$1.O_NONBLOCK ?? 0);
|
|
928
|
+
var READ_CHUNK_BYTES = 65536;
|
|
929
|
+
/** Reads to the end, refusing as soon as more than `maxBytes` arrive: never holds more than one chunk past it.
|
|
930
|
+
* Once `signal` aborts, no further read is started. */
|
|
931
|
+
async function readAtMost(reader, maxBytes, what, signal) {
|
|
932
|
+
const chunks = [];
|
|
933
|
+
let received = 0;
|
|
934
|
+
for (;;) {
|
|
935
|
+
if (signal?.aborted) throw new DownloadError(`${what}: reading stopped at the deadline`);
|
|
936
|
+
const chunk = Buffer.alloc(READ_CHUNK_BYTES);
|
|
937
|
+
const { bytesRead } = await reader.read(chunk, 0, READ_CHUNK_BYTES, null);
|
|
938
|
+
if (bytesRead === 0) return Buffer.concat(chunks, received);
|
|
939
|
+
received += bytesRead;
|
|
940
|
+
if (received > maxBytes) throw new DownloadError(`${what} is larger than ${maxBytes} bytes`);
|
|
941
|
+
chunks.push(chunk.subarray(0, bytesRead));
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
/** Rejects with a DownloadError once `timeoutMs` pass, and aborts the signal `work` was given so it starts
|
|
945
|
+
* nothing more. A read already stuck in the kernel cannot be cancelled from Node — closing its handle waits
|
|
946
|
+
* for it — so at most that one read stays in flight, and its handle closes once it returns. */
|
|
947
|
+
function withDeadline(work, timeoutMs, what) {
|
|
948
|
+
const controller = new AbortController();
|
|
949
|
+
let timer;
|
|
950
|
+
const late = new Promise((_resolve, reject) => {
|
|
951
|
+
timer = setTimeout(() => {
|
|
952
|
+
controller.abort();
|
|
953
|
+
reject(new DownloadError(`${what} took longer than ${timeoutMs} ms to read`));
|
|
954
|
+
}, timeoutMs);
|
|
955
|
+
});
|
|
956
|
+
return Promise.race([work(controller.signal), late]).finally(() => clearTimeout(timer));
|
|
957
|
+
}
|
|
958
|
+
async function readPackageFile(file, maxBytes, signal) {
|
|
959
|
+
const handle = await open(file, READ_FLAGS).catch((err) => {
|
|
960
|
+
throw new DownloadError(`${file} could not be read (${errorCode(err)})`);
|
|
961
|
+
});
|
|
962
|
+
try {
|
|
963
|
+
const info = await handle.stat();
|
|
964
|
+
if (!info.isFile()) throw new DownloadError(`${file} is not a file`);
|
|
965
|
+
if (info.size > maxBytes) throw new DownloadError(`${file} is larger than ${maxBytes} bytes`);
|
|
966
|
+
return await readAtMost(handle, maxBytes, file, signal);
|
|
967
|
+
} finally {
|
|
968
|
+
await handle.close().catch(() => void 0);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
async function fetchFile(source) {
|
|
972
|
+
return {
|
|
973
|
+
bytes: await withDeadline((signal) => readPackageFile(source.path, PACKAGE_LIMITS.maxBytes, signal), PACKAGE_LIMITS.timeoutMs, source.path),
|
|
974
|
+
resolved: source.path
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function fetchPackage(source, deps) {
|
|
978
|
+
if (source.kind === "npm") return fetchNpm(source, deps);
|
|
979
|
+
if (source.kind === "github") return fetchGithub(source, deps);
|
|
980
|
+
return fetchFile(source);
|
|
981
|
+
}
|
|
817
982
|
// src/runtime-plugins/inspect.ts
|
|
818
983
|
var TEMP_PREFIX = ".inspect-";
|
|
819
984
|
var MAX_UNPACKED_BYTES = 268435456;
|
|
@@ -924,16 +1089,6 @@ async function preparePlan(source, deps) {
|
|
|
924
1089
|
raw: ledger.raw
|
|
925
1090
|
};
|
|
926
1091
|
}
|
|
927
|
-
async function dropStaleCache(plan, raw, paths) {
|
|
928
|
-
const sameVersion = parseLedger(raw).filter((entry) => entry.name === plan.name && entry.version === plan.version);
|
|
929
|
-
if (sameVersion.length > 0 && sameVersion.every((entry) => entry.tgz === plan.tgz)) return;
|
|
930
|
-
const cacheDir = paths.cacheDir ?? path.join(paths.pluginsDir, ".cache");
|
|
931
|
-
const stale = path.join(cacheDir, plan.name, plan.version);
|
|
932
|
-
if (ensureInsideBase(stale, cacheDir)) await rm(stale, {
|
|
933
|
-
recursive: true,
|
|
934
|
-
force: true
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
1092
|
async function writePackageFile(plan, bytes, pluginsDir) {
|
|
938
1093
|
const tgzPath = path.join(pluginsDir, plan.tgz);
|
|
939
1094
|
const fileWasThere = existsSync(tgzPath);
|
|
@@ -955,7 +1110,6 @@ async function commit(plan, bytes, raw, deps) {
|
|
|
955
1110
|
source: plan.source
|
|
956
1111
|
};
|
|
957
1112
|
try {
|
|
958
|
-
await dropStaleCache(plan, raw, deps.paths);
|
|
959
1113
|
await writeLedger(deps.paths.ledgerPath, withLedgerEntry(raw, entry));
|
|
960
1114
|
} catch (err) {
|
|
961
1115
|
if (!fileWasThere) await rm(tgzPath, { force: true });
|
|
@@ -973,7 +1127,7 @@ var failure = (err, action) => {
|
|
|
973
1127
|
error: `${action} failed: ${err instanceof Error ? err.message : String(err)}`
|
|
974
1128
|
};
|
|
975
1129
|
};
|
|
976
|
-
/** Install what `input` names (`<npm name>[@<version or dist-tag>]
|
|
1130
|
+
/** Install what `input` names (`<npm name>[@<version or dist-tag>]`, `github:<owner>/<repo>[#<tag>]`, or `file:<absolute path>.tgz`). */
|
|
977
1131
|
async function installRuntimePlugin(input, deps) {
|
|
978
1132
|
const parsed = parseInstallSource(input);
|
|
979
1133
|
if (!parsed.ok) return {
|