link-cache 0.4.0 → 0.4.1
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/README.md +3 -2
- package/link-cache/index.mjs +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@ Two tools:
|
|
|
8
8
|
the committed `link-cache.jsonc` cache and lychee's derived `.lycheecache` in
|
|
9
9
|
sync.
|
|
10
10
|
- **`link-cache`** — inspect and prune the cache: list the oldest entries, prune
|
|
11
|
-
a count or percentage (optionally scoped by URL regex
|
|
12
|
-
|
|
11
|
+
a count or percentage (optionally scoped by URL regex; `manual` entries are
|
|
12
|
+
exempt — they retire via their `expires` date), or print a summary (status,
|
|
13
|
+
provenance, ages). (`refcache` is a deprecated alias.)
|
|
13
14
|
|
|
14
15
|
With a committed `lychee.toml` and `link-cache.jsonc`, these give a site a
|
|
15
16
|
self-contained, cached link-checking setup: fast reruns, and diffs that reflect
|
package/link-cache/index.mjs
CHANGED
|
@@ -244,7 +244,12 @@ export function runOps(
|
|
|
244
244
|
if (op.kind === 'list') {
|
|
245
245
|
out.push(formatList(current(), Number(op.value), { now }));
|
|
246
246
|
} else if (op.kind === 'prune') {
|
|
247
|
-
|
|
247
|
+
// Manual entries are exempt: pruning schedules re-checks for
|
|
248
|
+
// lychee-verified entries, while a manual entry's lifecycle is owned by
|
|
249
|
+
// its author and its `expires` date — and under prune-refresh rotation
|
|
250
|
+
// re-confirmed seeds keep their original timestamp, so they'd otherwise
|
|
251
|
+
// age to the front and get evicted mid-lifecycle.
|
|
252
|
+
const cur = current().filter((e) => e.via !== 'manual');
|
|
248
253
|
const k = resolvePruneCount(op.value, cur.length);
|
|
249
254
|
for (const victim of selectOldest(cur, k)) removed.add(victim.index);
|
|
250
255
|
pruned += k;
|
|
@@ -351,7 +356,8 @@ while \`-p 5 -l 5\` lists the next 5 after pruning.
|
|
|
351
356
|
|
|
352
357
|
-l, --list NUM list the NUM oldest entries
|
|
353
358
|
-m, --match REGEX scope all operations to URLs matching REGEX
|
|
354
|
-
-p, --prune NUM[%] drop the NUM (or NUM%) oldest entries, then
|
|
359
|
+
-p, --prune NUM[%] drop the NUM (or NUM%) oldest non-manual entries, then
|
|
360
|
+
rewrite (manual entries retire via their expires date)
|
|
355
361
|
-s, --summary print a summary (counts, ages, status, via, histogram)
|
|
356
362
|
-h, --help show this help
|
|
357
363
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "link-cache",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Zero-dependency helper CLIs for cached Lychee link-checking around an owned JSONC cache (link-cache.jsonc) with provenance: lychee-norm-cache (run + sync caches) and link-cache (inspect/prune).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lychee",
|