@agntn/registries 0.2.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/LICENSE +21 -0
- package/README.md +303 -0
- package/dist/_chunks/cached-registry.d.mts +35 -0
- package/dist/_chunks/cached-registry.d.mts.map +1 -0
- package/dist/_chunks/errors.d.mts +90 -0
- package/dist/_chunks/errors.d.mts.map +1 -0
- package/dist/_chunks/helpers.mjs +95 -0
- package/dist/_chunks/helpers.mjs.map +1 -0
- package/dist/_chunks/index.d.mts +142 -0
- package/dist/_chunks/index.d.mts.map +1 -0
- package/dist/_chunks/index2.d.mts +50 -0
- package/dist/_chunks/index2.d.mts.map +1 -0
- package/dist/_chunks/index3.d.mts +18 -0
- package/dist/_chunks/index3.d.mts.map +1 -0
- package/dist/_chunks/lockfile.d.mts +50 -0
- package/dist/_chunks/lockfile.d.mts.map +1 -0
- package/dist/_chunks/paths.d.mts +11 -0
- package/dist/_chunks/paths.d.mts.map +1 -0
- package/dist/_chunks/purl.mjs +192 -0
- package/dist/_chunks/purl.mjs.map +1 -0
- package/dist/_chunks/registries.mjs +1197 -0
- package/dist/_chunks/registries.mjs.map +1 -0
- package/dist/_chunks/registry.d.mts +39 -0
- package/dist/_chunks/registry.d.mts.map +1 -0
- package/dist/_chunks/registry.mjs +201 -0
- package/dist/_chunks/registry.mjs.map +1 -0
- package/dist/_chunks/storage.d.mts +22 -0
- package/dist/_chunks/storage.d.mts.map +1 -0
- package/dist/_chunks/types.d.mts +73 -0
- package/dist/_chunks/types.d.mts.map +1 -0
- package/dist/ai.d.mts +35 -0
- package/dist/ai.d.mts.map +1 -0
- package/dist/ai.mjs +50 -0
- package/dist/ai.mjs.map +1 -0
- package/dist/cache/cached-registry.d.mts +4 -0
- package/dist/cache/cached-registry.mjs +92 -0
- package/dist/cache/cached-registry.mjs.map +1 -0
- package/dist/cache/index.d.mts +8 -0
- package/dist/cache/index.mjs +12 -0
- package/dist/cache/index.mjs.map +1 -0
- package/dist/cache/lockfile.d.mts +2 -0
- package/dist/cache/lockfile.mjs +68 -0
- package/dist/cache/lockfile.mjs.map +1 -0
- package/dist/cache/paths.d.mts +2 -0
- package/dist/cache/paths.mjs +26 -0
- package/dist/cache/paths.mjs.map +1 -0
- package/dist/cache/storage.d.mts +2 -0
- package/dist/cache/storage.mjs +40 -0
- package/dist/cache/storage.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +19 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/commands/cache.d.mts +7 -0
- package/dist/commands/cache.d.mts.map +1 -0
- package/dist/commands/cache.mjs +80 -0
- package/dist/commands/cache.mjs.map +1 -0
- package/dist/commands/deps.d.mts +23 -0
- package/dist/commands/deps.d.mts.map +1 -0
- package/dist/commands/deps.mjs +72 -0
- package/dist/commands/deps.mjs.map +1 -0
- package/dist/commands/info.d.mts +26 -0
- package/dist/commands/info.d.mts.map +1 -0
- package/dist/commands/info.mjs +54 -0
- package/dist/commands/info.mjs.map +1 -0
- package/dist/commands/maintainers.d.mts +23 -0
- package/dist/commands/maintainers.d.mts.map +1 -0
- package/dist/commands/maintainers.mjs +46 -0
- package/dist/commands/maintainers.mjs.map +1 -0
- package/dist/commands/shared.d.mts +27 -0
- package/dist/commands/shared.d.mts.map +1 -0
- package/dist/commands/shared.mjs +69 -0
- package/dist/commands/shared.mjs.map +1 -0
- package/dist/commands/versions.d.mts +31 -0
- package/dist/commands/versions.d.mts.map +1 -0
- package/dist/commands/versions.mjs +58 -0
- package/dist/commands/versions.mjs.map +1 -0
- package/dist/core/index.d.mts +4 -0
- package/dist/core/index.mjs +3 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.mjs +10 -0
- package/dist/registries/index.d.mts +4 -0
- package/dist/registries/index.mjs +4 -0
- package/dist/types.d.mts +3 -0
- package/dist/types.mjs +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { i as Package } from "../_chunks/types.mjs";
|
|
2
|
+
import { t as Registry } from "../_chunks/registry.mjs";
|
|
3
|
+
import * as citty from "citty";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/info.d.ts
|
|
6
|
+
declare function outputPackageInfo(pkg: Package, name: string, reg: Registry): void;
|
|
7
|
+
declare const _default: citty.CommandDef<{
|
|
8
|
+
readonly purl: {
|
|
9
|
+
readonly type: "positional";
|
|
10
|
+
readonly description: "Package PURL (e.g. pkg:npm/lodash, cargo/serde@1.0)";
|
|
11
|
+
readonly required: true;
|
|
12
|
+
};
|
|
13
|
+
readonly json: {
|
|
14
|
+
readonly type: "boolean";
|
|
15
|
+
readonly description: "Output as JSON";
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
readonly "no-cache": {
|
|
19
|
+
readonly type: "boolean";
|
|
20
|
+
readonly description: "Bypass cache, fetch fresh data";
|
|
21
|
+
readonly default: false;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { _default as default, outputPackageInfo };
|
|
26
|
+
//# sourceMappingURL=info.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.mts","names":[],"sources":["../../src/commands/info.ts"],"mappings":";;;;;iBAOgB,iBAAA,CAAkB,GAAA,EAAK,OAAA,EAAS,IAAA,UAAc,GAAA,EAAK,QAAA;AAAA,cA8BlE,QAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import "../_chunks/registry.mjs";
|
|
2
|
+
import "../_chunks/purl.mjs";
|
|
3
|
+
import "../_chunks/registries.mjs";
|
|
4
|
+
import { o as resolveDocsUrl } from "../_chunks/helpers.mjs";
|
|
5
|
+
import { resolvePURL, sharedArgs, withErrorHandling } from "./shared.mjs";
|
|
6
|
+
import { defineCommand } from "citty";
|
|
7
|
+
import consola from "consola";
|
|
8
|
+
function outputPackageInfo(pkg, name, reg) {
|
|
9
|
+
const urls = reg.urls();
|
|
10
|
+
const registryUrl = urls.registry(name);
|
|
11
|
+
const docsUrl = resolveDocsUrl(pkg, urls, pkg.latestVersion || void 0);
|
|
12
|
+
const showDocs = Boolean(docsUrl) && docsUrl !== pkg.homepage && docsUrl !== pkg.repository && docsUrl !== registryUrl;
|
|
13
|
+
consola.log("");
|
|
14
|
+
consola.log(` \x1b[1m\x1b[36m${pkg.name}\x1b[0m${pkg.latestVersion ? `\x1b[90m@${pkg.latestVersion}\x1b[0m` : ""}`);
|
|
15
|
+
if (pkg.description) consola.log(` ${pkg.description}`);
|
|
16
|
+
consola.log("");
|
|
17
|
+
if (pkg.licenses) consola.log(` \x1b[90mLicense:\x1b[0m ${pkg.licenses}`);
|
|
18
|
+
if (pkg.repository) consola.log(` \x1b[90mRepository:\x1b[0m ${pkg.repository}`);
|
|
19
|
+
if (pkg.homepage) consola.log(` \x1b[90mHomepage:\x1b[0m ${pkg.homepage}`);
|
|
20
|
+
if (showDocs) consola.log(` \x1b[90mDocs:\x1b[0m ${docsUrl}`);
|
|
21
|
+
consola.log(` \x1b[90mRegistry:\x1b[0m ${registryUrl}`);
|
|
22
|
+
if (pkg.keywords.length > 0) consola.log(` \x1b[90mKeywords:\x1b[0m ${pkg.keywords.join(", ")}`);
|
|
23
|
+
if (pkg.namespace) consola.log(` \x1b[90mNamespace:\x1b[0m ${pkg.namespace}`);
|
|
24
|
+
consola.log(` \x1b[90mEcosystem:\x1b[0m ${reg.ecosystem()}`);
|
|
25
|
+
consola.log("");
|
|
26
|
+
}
|
|
27
|
+
var info_default = defineCommand({
|
|
28
|
+
meta: {
|
|
29
|
+
name: "info",
|
|
30
|
+
description: "Show package metadata"
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
...sharedArgs,
|
|
34
|
+
purl: {
|
|
35
|
+
type: "positional",
|
|
36
|
+
description: "Package PURL (e.g. pkg:npm/lodash, cargo/serde@1.0)",
|
|
37
|
+
required: true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async run({ args }) {
|
|
41
|
+
await withErrorHandling(async () => {
|
|
42
|
+
const [reg, name] = resolvePURL(args.purl, !args["no-cache"]);
|
|
43
|
+
const pkg = await reg.fetchPackage(name);
|
|
44
|
+
if (args.json) {
|
|
45
|
+
console.log(JSON.stringify(pkg, null, 2));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
outputPackageInfo(pkg, name, reg);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export { info_default as default, outputPackageInfo };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=info.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.mjs","names":[],"sources":["../../src/commands/info.ts"],"sourcesContent":["import type { Package } from \"../core/types.ts\";\nimport type { Registry } from \"../core/registry.ts\";\nimport { defineCommand } from \"citty\";\nimport consola from \"consola\";\nimport { resolveDocsUrl } from \"../helpers.ts\";\nimport { sharedArgs, resolvePURL, withErrorHandling } from \"./shared.ts\";\n\nexport function outputPackageInfo(pkg: Package, name: string, reg: Registry): void {\n const urls = reg.urls();\n const registryUrl = urls.registry(name);\n const docsUrl = resolveDocsUrl(pkg, urls, pkg.latestVersion || undefined);\n const showDocs =\n Boolean(docsUrl) &&\n docsUrl !== pkg.homepage &&\n docsUrl !== pkg.repository &&\n docsUrl !== registryUrl;\n\n consola.log(\"\");\n consola.log(\n ` \\x1b[1m\\x1b[36m${pkg.name}\\x1b[0m${pkg.latestVersion ? `\\x1b[90m@${pkg.latestVersion}\\x1b[0m` : \"\"}`,\n );\n if (pkg.description) {\n consola.log(` ${pkg.description}`);\n }\n consola.log(\"\");\n\n if (pkg.licenses) consola.log(` \\x1b[90mLicense:\\x1b[0m ${pkg.licenses}`);\n if (pkg.repository) consola.log(` \\x1b[90mRepository:\\x1b[0m ${pkg.repository}`);\n if (pkg.homepage) consola.log(` \\x1b[90mHomepage:\\x1b[0m ${pkg.homepage}`);\n if (showDocs) consola.log(` \\x1b[90mDocs:\\x1b[0m ${docsUrl}`);\n consola.log(` \\x1b[90mRegistry:\\x1b[0m ${registryUrl}`);\n if (pkg.keywords.length > 0) {\n consola.log(` \\x1b[90mKeywords:\\x1b[0m ${pkg.keywords.join(\", \")}`);\n }\n if (pkg.namespace) consola.log(` \\x1b[90mNamespace:\\x1b[0m ${pkg.namespace}`);\n consola.log(` \\x1b[90mEcosystem:\\x1b[0m ${reg.ecosystem()}`);\n consola.log(\"\");\n}\n\nexport default defineCommand({\n meta: {\n name: \"info\",\n description: \"Show package metadata\",\n },\n args: {\n ...sharedArgs,\n purl: {\n type: \"positional\",\n description: \"Package PURL (e.g. pkg:npm/lodash, cargo/serde@1.0)\",\n required: true,\n },\n },\n async run({ args }) {\n await withErrorHandling(async () => {\n const [reg, name] = resolvePURL(args.purl, !args[\"no-cache\"]);\n const pkg = await reg.fetchPackage(name);\n\n if (args.json) {\n console.log(JSON.stringify(pkg, null, 2));\n return;\n }\n\n outputPackageInfo(pkg, name, reg);\n });\n },\n});\n"],"mappings":";;;;;;;AAOA,SAAgB,kBAAkB,KAAc,MAAc,KAAqB;CACjF,MAAM,OAAO,IAAI,MAAM;CACvB,MAAM,cAAc,KAAK,SAAS,KAAK;CACvC,MAAM,UAAU,eAAe,KAAK,MAAM,IAAI,iBAAiB,KAAA,EAAU;CACzE,MAAM,WACJ,QAAQ,QAAQ,IAChB,YAAY,IAAI,YAChB,YAAY,IAAI,cAChB,YAAY;AAEd,SAAQ,IAAI,GAAG;AACf,SAAQ,IACN,oBAAoB,IAAI,KAAK,SAAS,IAAI,gBAAgB,YAAY,IAAI,cAAc,WAAW,KACpG;AACD,KAAI,IAAI,YACN,SAAQ,IAAI,KAAK,IAAI,cAAc;AAErC,SAAQ,IAAI,GAAG;AAEf,KAAI,IAAI,SAAU,SAAQ,IAAI,gCAAgC,IAAI,WAAW;AAC7E,KAAI,IAAI,WAAY,SAAQ,IAAI,gCAAgC,IAAI,aAAa;AACjF,KAAI,IAAI,SAAU,SAAQ,IAAI,gCAAgC,IAAI,WAAW;AAC7E,KAAI,SAAU,SAAQ,IAAI,gCAAgC,UAAU;AACpE,SAAQ,IAAI,gCAAgC,cAAc;AAC1D,KAAI,IAAI,SAAS,SAAS,EACxB,SAAQ,IAAI,gCAAgC,IAAI,SAAS,KAAK,KAAK,GAAG;AAExE,KAAI,IAAI,UAAW,SAAQ,IAAI,gCAAgC,IAAI,YAAY;AAC/E,SAAQ,IAAI,gCAAgC,IAAI,WAAW,GAAG;AAC9D,SAAQ,IAAI,GAAG;;AAGjB,IAAA,eAAe,cAAc;CAC3B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;;EAEb;CACD,MAAM,IAAI,EAAE,QAAQ;AAClB,QAAM,kBAAkB,YAAY;GAClC,MAAM,CAAC,KAAK,QAAQ,YAAY,KAAK,MAAM,CAAC,KAAK,YAAY;GAC7D,MAAM,MAAM,MAAM,IAAI,aAAa,KAAK;AAExC,OAAI,KAAK,MAAM;AACb,YAAQ,IAAI,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;AACzC;;AAGF,qBAAkB,KAAK,MAAM,IAAI;IACjC;;CAEL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as citty from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/maintainers.d.ts
|
|
4
|
+
declare const _default: citty.CommandDef<{
|
|
5
|
+
readonly purl: {
|
|
6
|
+
readonly type: "positional";
|
|
7
|
+
readonly description: "Package PURL (e.g. pkg:npm/lodash, gem/rails)";
|
|
8
|
+
readonly required: true;
|
|
9
|
+
};
|
|
10
|
+
readonly json: {
|
|
11
|
+
readonly type: "boolean";
|
|
12
|
+
readonly description: "Output as JSON";
|
|
13
|
+
readonly default: false;
|
|
14
|
+
};
|
|
15
|
+
readonly "no-cache": {
|
|
16
|
+
readonly type: "boolean";
|
|
17
|
+
readonly description: "Bypass cache, fetch fresh data";
|
|
18
|
+
readonly default: false;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { _default as default };
|
|
23
|
+
//# sourceMappingURL=maintainers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintainers.d.mts","names":[],"sources":["../../src/commands/maintainers.ts"],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "../_chunks/registry.mjs";
|
|
2
|
+
import "../_chunks/purl.mjs";
|
|
3
|
+
import "../_chunks/registries.mjs";
|
|
4
|
+
import { resolvePURL, sharedArgs, withErrorHandling } from "./shared.mjs";
|
|
5
|
+
import { defineCommand } from "citty";
|
|
6
|
+
import consola from "consola";
|
|
7
|
+
var maintainers_default = defineCommand({
|
|
8
|
+
meta: {
|
|
9
|
+
name: "maintainers",
|
|
10
|
+
description: "List package maintainers"
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
...sharedArgs,
|
|
14
|
+
purl: {
|
|
15
|
+
type: "positional",
|
|
16
|
+
description: "Package PURL (e.g. pkg:npm/lodash, gem/rails)",
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
async run({ args }) {
|
|
21
|
+
await withErrorHandling(async () => {
|
|
22
|
+
const [reg, name] = resolvePURL(args.purl, !args["no-cache"]);
|
|
23
|
+
const maintainers = await reg.fetchMaintainers(name);
|
|
24
|
+
if (args.json) {
|
|
25
|
+
console.log(JSON.stringify(maintainers, null, 2));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
consola.log("");
|
|
29
|
+
consola.log(` \x1b[1m${name}\x1b[0m — ${maintainers.length} maintainer${maintainers.length === 1 ? "" : "s"}`);
|
|
30
|
+
consola.log("");
|
|
31
|
+
for (const m of maintainers) {
|
|
32
|
+
const nameStr = m.name || m.login || "unknown";
|
|
33
|
+
const parts = [nameStr];
|
|
34
|
+
if (m.login && m.login !== nameStr) parts.push(`\x1b[90m(${m.login})\x1b[0m`);
|
|
35
|
+
if (m.email) parts.push(`\x1b[90m<${m.email}>\x1b[0m`);
|
|
36
|
+
if (m.role) parts.push(`\x1b[36m[${m.role}]\x1b[0m`);
|
|
37
|
+
consola.log(` ${parts.join(" ")}`);
|
|
38
|
+
if (m.url) consola.log(` \x1b[90m${m.url}\x1b[0m`);
|
|
39
|
+
}
|
|
40
|
+
consola.log("");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { maintainers_default as default };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=maintainers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintainers.mjs","names":[],"sources":["../../src/commands/maintainers.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport consola from \"consola\";\nimport { sharedArgs, resolvePURL, withErrorHandling } from \"./shared.ts\";\n\nexport default defineCommand({\n meta: {\n name: \"maintainers\",\n description: \"List package maintainers\",\n },\n args: {\n ...sharedArgs,\n purl: {\n type: \"positional\",\n description: \"Package PURL (e.g. pkg:npm/lodash, gem/rails)\",\n required: true,\n },\n },\n async run({ args }) {\n await withErrorHandling(async () => {\n const [reg, name] = resolvePURL(args.purl, !args[\"no-cache\"]);\n const maintainers = await reg.fetchMaintainers(name);\n\n if (args.json) {\n console.log(JSON.stringify(maintainers, null, 2));\n return;\n }\n\n consola.log(\"\");\n consola.log(\n ` \\x1b[1m${name}\\x1b[0m — ${maintainers.length} maintainer${maintainers.length === 1 ? \"\" : \"s\"}`,\n );\n consola.log(\"\");\n\n for (const m of maintainers) {\n const nameStr = m.name || m.login || \"unknown\";\n const parts: string[] = [nameStr];\n if (m.login && m.login !== nameStr) parts.push(`\\x1b[90m(${m.login})\\x1b[0m`);\n if (m.email) parts.push(`\\x1b[90m<${m.email}>\\x1b[0m`);\n if (m.role) parts.push(`\\x1b[36m[${m.role}]\\x1b[0m`);\n consola.log(` ${parts.join(\" \")}`);\n if (m.url) consola.log(` \\x1b[90m${m.url}\\x1b[0m`);\n }\n consola.log(\"\");\n });\n },\n});\n"],"mappings":";;;;;;AAIA,IAAA,sBAAe,cAAc;CAC3B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;;EAEb;CACD,MAAM,IAAI,EAAE,QAAQ;AAClB,QAAM,kBAAkB,YAAY;GAClC,MAAM,CAAC,KAAK,QAAQ,YAAY,KAAK,MAAM,CAAC,KAAK,YAAY;GAC7D,MAAM,cAAc,MAAM,IAAI,iBAAiB,KAAK;AAEpD,OAAI,KAAK,MAAM;AACb,YAAQ,IAAI,KAAK,UAAU,aAAa,MAAM,EAAE,CAAC;AACjD;;AAGF,WAAQ,IAAI,GAAG;AACf,WAAQ,IACN,YAAY,KAAK,YAAY,YAAY,OAAO,aAAa,YAAY,WAAW,IAAI,KAAK,MAC9F;AACD,WAAQ,IAAI,GAAG;AAEf,QAAK,MAAM,KAAK,aAAa;IAC3B,MAAM,UAAU,EAAE,QAAQ,EAAE,SAAS;IACrC,MAAM,QAAkB,CAAC,QAAQ;AACjC,QAAI,EAAE,SAAS,EAAE,UAAU,QAAS,OAAM,KAAK,YAAY,EAAE,MAAM,UAAU;AAC7E,QAAI,EAAE,MAAO,OAAM,KAAK,YAAY,EAAE,MAAM,UAAU;AACtD,QAAI,EAAE,KAAM,OAAM,KAAK,YAAY,EAAE,KAAK,UAAU;AACpD,YAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,GAAG;AACnC,QAAI,EAAE,IAAK,SAAQ,IAAI,eAAe,EAAE,IAAI,SAAS;;AAEvD,WAAQ,IAAI,GAAG;IACf;;CAEL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "../_chunks/types.mjs";
|
|
2
|
+
import { t as Registry } from "../_chunks/registry.mjs";
|
|
3
|
+
import "../_chunks/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/shared.d.ts
|
|
6
|
+
declare const sharedArgs: {
|
|
7
|
+
readonly json: {
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
readonly description: "Output as JSON";
|
|
10
|
+
readonly default: false;
|
|
11
|
+
};
|
|
12
|
+
readonly "no-cache": {
|
|
13
|
+
readonly type: "boolean";
|
|
14
|
+
readonly description: "Bypass cache, fetch fresh data";
|
|
15
|
+
readonly default: false;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a PURL string or shorthand into [registry, name, version].
|
|
20
|
+
* Uses CachedRegistry unless --no-cache is set.
|
|
21
|
+
*/
|
|
22
|
+
declare function resolvePURL(input: string, useCache?: boolean): [Registry, string, string];
|
|
23
|
+
/** Run a command with standard error handling. */
|
|
24
|
+
declare function withErrorHandling(fn: () => Promise<void>): Promise<void>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { resolvePURL, sharedArgs, withErrorHandling };
|
|
27
|
+
//# sourceMappingURL=shared.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.mts","names":[],"sources":["../../src/commands/shared.ts"],"mappings":";;;;;cAaa,UAAA;EAAA;;;;;;;;;;;;;;;iBAiBG,WAAA,CAAY,KAAA,UAAe,QAAA,cAAmB,QAAA;AAA9D;AAAA,iBAkBsB,iBAAA,CAAkB,EAAA,QAAU,OAAA,SAAgB,OAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { c as HTTPError, f as RateLimitError, l as InvalidPURLError, n as create, p as UnknownEcosystemError, r as ecosystems, u as NotFoundError } from "../_chunks/registry.mjs";
|
|
2
|
+
import { i as parsePURL, n as createFromPURL, r as fullName } from "../_chunks/purl.mjs";
|
|
3
|
+
import "../_chunks/registries.mjs";
|
|
4
|
+
import { CachedRegistry } from "../cache/cached-registry.mjs";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
const sharedArgs = {
|
|
7
|
+
json: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
description: "Output as JSON",
|
|
10
|
+
default: false
|
|
11
|
+
},
|
|
12
|
+
"no-cache": {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Bypass cache, fetch fresh data",
|
|
15
|
+
default: false
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a PURL string or shorthand into [registry, name, version].
|
|
20
|
+
* Uses CachedRegistry unless --no-cache is set.
|
|
21
|
+
*/
|
|
22
|
+
function resolvePURL(input, useCache = true) {
|
|
23
|
+
let purl = input;
|
|
24
|
+
if (!purl.startsWith("pkg:")) purl = `pkg:${purl}`;
|
|
25
|
+
if (useCache) {
|
|
26
|
+
const parsed = parsePURL(purl);
|
|
27
|
+
const baseURL = parsed.qualifiers["repository_url"] ?? "";
|
|
28
|
+
return [
|
|
29
|
+
new CachedRegistry(create(parsed.type, baseURL || void 0)),
|
|
30
|
+
fullName(parsed),
|
|
31
|
+
parsed.version
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
return createFromPURL(purl);
|
|
35
|
+
}
|
|
36
|
+
/** Run a command with standard error handling. */
|
|
37
|
+
async function withErrorHandling(fn) {
|
|
38
|
+
try {
|
|
39
|
+
await fn();
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (error instanceof NotFoundError) {
|
|
42
|
+
consola.error(`Package not found: ${error.ecosystem}/${error.packageName}${error.version ? `@${error.version}` : ""}`);
|
|
43
|
+
return process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (error instanceof UnknownEcosystemError) {
|
|
46
|
+
consola.error(`Unknown ecosystem: ${error.ecosystem}`);
|
|
47
|
+
consola.info(`Supported: ${ecosystems().join(", ")}`);
|
|
48
|
+
return process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
if (error instanceof InvalidPURLError) {
|
|
51
|
+
consola.error(`Invalid PURL: ${error.purl}`);
|
|
52
|
+
consola.info("Examples: pkg:npm/lodash, npm/lodash@4.17.21, pkg:cargo/serde");
|
|
53
|
+
return process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
if (error instanceof RateLimitError) {
|
|
56
|
+
consola.error(`Rate limited by registry. Retry after ${error.retryAfter}s`);
|
|
57
|
+
return process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
if (error instanceof HTTPError) {
|
|
60
|
+
consola.error(`Registry request failed: HTTP ${error.statusCode} (${error.url})`);
|
|
61
|
+
if (error.isServerError()) consola.info("The registry may be temporarily unavailable. Try again later.");
|
|
62
|
+
return process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export { resolvePURL, sharedArgs, withErrorHandling };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=shared.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","names":[],"sources":["../../src/commands/shared.ts"],"sourcesContent":["import consola from \"consola\";\nimport { createFromPURL, parsePURL, fullName } from \"../core/purl.ts\";\nimport { create, ecosystems, type Registry } from \"../core/registry.ts\";\nimport {\n HTTPError,\n NotFoundError,\n RateLimitError,\n UnknownEcosystemError,\n InvalidPURLError,\n} from \"../core/errors.ts\";\nimport { CachedRegistry } from \"../cache/cached-registry.ts\";\nimport \"../registries/index.ts\";\n\nexport const sharedArgs = {\n json: {\n type: \"boolean\" as const,\n description: \"Output as JSON\",\n default: false,\n },\n \"no-cache\": {\n type: \"boolean\" as const,\n description: \"Bypass cache, fetch fresh data\",\n default: false,\n },\n} as const;\n\n/**\n * Resolve a PURL string or shorthand into [registry, name, version].\n * Uses CachedRegistry unless --no-cache is set.\n */\nexport function resolvePURL(input: string, useCache = true): [Registry, string, string] {\n let purl = input;\n if (!purl.startsWith(\"pkg:\")) {\n purl = `pkg:${purl}`;\n }\n\n if (useCache) {\n const parsed = parsePURL(purl);\n const baseURL = parsed.qualifiers[\"repository_url\"] ?? \"\";\n const inner = create(parsed.type, baseURL || undefined);\n const reg = new CachedRegistry(inner);\n return [reg, fullName(parsed), parsed.version];\n }\n\n return createFromPURL(purl);\n}\n\n/** Run a command with standard error handling. */\nexport async function withErrorHandling(fn: () => Promise<void>): Promise<void> {\n try {\n await fn();\n } catch (error) {\n if (error instanceof NotFoundError) {\n consola.error(\n `Package not found: ${error.ecosystem}/${error.packageName}${error.version ? `@${error.version}` : \"\"}`,\n );\n return process.exit(1);\n }\n if (error instanceof UnknownEcosystemError) {\n consola.error(`Unknown ecosystem: ${error.ecosystem}`);\n consola.info(`Supported: ${ecosystems().join(\", \")}`);\n return process.exit(1);\n }\n if (error instanceof InvalidPURLError) {\n consola.error(`Invalid PURL: ${error.purl}`);\n consola.info(\"Examples: pkg:npm/lodash, npm/lodash@4.17.21, pkg:cargo/serde\");\n return process.exit(1);\n }\n if (error instanceof RateLimitError) {\n consola.error(`Rate limited by registry. Retry after ${error.retryAfter}s`);\n return process.exit(1);\n }\n if (error instanceof HTTPError) {\n consola.error(`Registry request failed: HTTP ${error.statusCode} (${error.url})`);\n if (error.isServerError()) {\n consola.info(\"The registry may be temporarily unavailable. Try again later.\");\n }\n return process.exit(1);\n }\n throw error;\n }\n}\n"],"mappings":";;;;;AAaA,MAAa,aAAa;CACxB,MAAM;EACJ,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;;CAEZ;;;;;AAMD,SAAgB,YAAY,OAAe,WAAW,MAAkC;CACtF,IAAI,OAAO;AACX,KAAI,CAAC,KAAK,WAAW,OAAO,CAC1B,QAAO,OAAO;AAGhB,KAAI,UAAU;EACZ,MAAM,SAAS,UAAU,KAAK;EAC9B,MAAM,UAAU,OAAO,WAAW,qBAAqB;AAGvD,SAAO;GADK,IAAI,eADF,OAAO,OAAO,MAAM,WAAW,KAAA,EAAU,CAClB;GACxB,SAAS,OAAO;GAAE,OAAO;GAAQ;;AAGhD,QAAO,eAAe,KAAK;;;AAI7B,eAAsB,kBAAkB,IAAwC;AAC9E,KAAI;AACF,QAAM,IAAI;UACH,OAAO;AACd,MAAI,iBAAiB,eAAe;AAClC,WAAQ,MACN,sBAAsB,MAAM,UAAU,GAAG,MAAM,cAAc,MAAM,UAAU,IAAI,MAAM,YAAY,KACpG;AACD,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,uBAAuB;AAC1C,WAAQ,MAAM,sBAAsB,MAAM,YAAY;AACtD,WAAQ,KAAK,cAAc,YAAY,CAAC,KAAK,KAAK,GAAG;AACrD,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,kBAAkB;AACrC,WAAQ,MAAM,iBAAiB,MAAM,OAAO;AAC5C,WAAQ,KAAK,gEAAgE;AAC7E,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,gBAAgB;AACnC,WAAQ,MAAM,yCAAyC,MAAM,WAAW,GAAG;AAC3E,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,WAAW;AAC9B,WAAQ,MAAM,iCAAiC,MAAM,WAAW,IAAI,MAAM,IAAI,GAAG;AACjF,OAAI,MAAM,eAAe,CACvB,SAAQ,KAAK,gEAAgE;AAE/E,UAAO,QAAQ,KAAK,EAAE;;AAExB,QAAM"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { l as Version } from "../_chunks/types.mjs";
|
|
2
|
+
import * as citty from "citty";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/versions.d.ts
|
|
5
|
+
declare function selectRecentVersions(versions: Version[], limit: number): Version[];
|
|
6
|
+
declare const _default: citty.CommandDef<{
|
|
7
|
+
readonly purl: {
|
|
8
|
+
readonly type: "positional";
|
|
9
|
+
readonly description: "Package PURL (e.g. pkg:npm/lodash, cargo/serde)";
|
|
10
|
+
readonly required: true;
|
|
11
|
+
};
|
|
12
|
+
readonly limit: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly alias: "l";
|
|
15
|
+
readonly description: "Max versions to show";
|
|
16
|
+
readonly default: "20";
|
|
17
|
+
};
|
|
18
|
+
readonly json: {
|
|
19
|
+
readonly type: "boolean";
|
|
20
|
+
readonly description: "Output as JSON";
|
|
21
|
+
readonly default: false;
|
|
22
|
+
};
|
|
23
|
+
readonly "no-cache": {
|
|
24
|
+
readonly type: "boolean";
|
|
25
|
+
readonly description: "Bypass cache, fetch fresh data";
|
|
26
|
+
readonly default: false;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { _default as default, selectRecentVersions };
|
|
31
|
+
//# sourceMappingURL=versions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.mts","names":[],"sources":["../../src/commands/versions.ts"],"mappings":";;;;iBAKgB,oBAAA,CAAqB,QAAA,EAAU,OAAA,IAAW,KAAA,WAAgB,OAAA;AAAA,cAQzE,QAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "../_chunks/registry.mjs";
|
|
2
|
+
import "../_chunks/purl.mjs";
|
|
3
|
+
import "../_chunks/registries.mjs";
|
|
4
|
+
import { resolvePURL, sharedArgs, withErrorHandling } from "./shared.mjs";
|
|
5
|
+
import { defineCommand } from "citty";
|
|
6
|
+
import consola from "consola";
|
|
7
|
+
function selectRecentVersions(versions, limit) {
|
|
8
|
+
return versions.toSorted((a, b) => {
|
|
9
|
+
if (a.publishedAt === null) return b.publishedAt === null ? 0 : 1;
|
|
10
|
+
if (b.publishedAt === null) return -1;
|
|
11
|
+
return b.publishedAt.getTime() - a.publishedAt.getTime();
|
|
12
|
+
}).slice(0, limit);
|
|
13
|
+
}
|
|
14
|
+
var versions_default = defineCommand({
|
|
15
|
+
meta: {
|
|
16
|
+
name: "versions",
|
|
17
|
+
description: "List package versions"
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
...sharedArgs,
|
|
21
|
+
purl: {
|
|
22
|
+
type: "positional",
|
|
23
|
+
description: "Package PURL (e.g. pkg:npm/lodash, cargo/serde)",
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
limit: {
|
|
27
|
+
type: "string",
|
|
28
|
+
alias: "l",
|
|
29
|
+
description: "Max versions to show",
|
|
30
|
+
default: "20"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async run({ args }) {
|
|
34
|
+
await withErrorHandling(async () => {
|
|
35
|
+
const [reg, name] = resolvePURL(args.purl, !args["no-cache"]);
|
|
36
|
+
const versions = await reg.fetchVersions(name);
|
|
37
|
+
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
38
|
+
const shown = selectRecentVersions(versions, limit);
|
|
39
|
+
if (args.json) {
|
|
40
|
+
console.log(JSON.stringify(shown, null, 2));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
consola.log("");
|
|
44
|
+
consola.log(` \x1b[1m${name}\x1b[0m — ${versions.length} version${versions.length === 1 ? "" : "s"}`);
|
|
45
|
+
consola.log("");
|
|
46
|
+
for (const v of shown) {
|
|
47
|
+
const status = v.status ? ` \x1b[33m[${v.status}]\x1b[0m` : "";
|
|
48
|
+
const date = v.publishedAt ? ` \x1b[90m${v.publishedAt.toISOString().slice(0, 10)}\x1b[0m` : "";
|
|
49
|
+
consola.log(` ${v.number}${status}${date}`);
|
|
50
|
+
}
|
|
51
|
+
if (versions.length > limit) consola.log(`\n \x1b[90m... and ${versions.length - limit} more (use --limit to show more)\x1b[0m`);
|
|
52
|
+
consola.log("");
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export { versions_default as default, selectRecentVersions };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=versions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.mjs","names":[],"sources":["../../src/commands/versions.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport consola from \"consola\";\nimport type { Version } from \"../core/types.ts\";\n\nimport { sharedArgs, resolvePURL, withErrorHandling } from \"./shared.ts\";\nexport function selectRecentVersions(versions: Version[], limit: number): Version[] {\n return versions\n .toSorted((a, b) => {\n if (a.publishedAt === null) return b.publishedAt === null ? 0 : 1;\n if (b.publishedAt === null) return -1;\n return b.publishedAt.getTime() - a.publishedAt.getTime();\n })\n .slice(0, limit);\n}\n\nexport default defineCommand({\n meta: {\n name: \"versions\",\n description: \"List package versions\",\n },\n args: {\n ...sharedArgs,\n purl: {\n type: \"positional\",\n description: \"Package PURL (e.g. pkg:npm/lodash, cargo/serde)\",\n required: true,\n },\n limit: {\n type: \"string\",\n alias: \"l\",\n description: \"Max versions to show\",\n default: \"20\",\n },\n },\n async run({ args }) {\n await withErrorHandling(async () => {\n const [reg, name] = resolvePURL(args.purl, !args[\"no-cache\"]);\n const versions = await reg.fetchVersions(name);\n const limit = Number.parseInt(args.limit, 10) || 20;\n const shown = selectRecentVersions(versions, limit);\n\n if (args.json) {\n console.log(JSON.stringify(shown, null, 2));\n return;\n }\n\n consola.log(\"\");\n consola.log(\n ` \\x1b[1m${name}\\x1b[0m — ${versions.length} version${versions.length === 1 ? \"\" : \"s\"}`,\n );\n consola.log(\"\");\n\n for (const v of shown) {\n const status = v.status ? ` \\x1b[33m[${v.status}]\\x1b[0m` : \"\";\n const date = v.publishedAt\n ? ` \\x1b[90m${v.publishedAt.toISOString().slice(0, 10)}\\x1b[0m`\n : \"\";\n consola.log(` ${v.number}${status}${date}`);\n }\n\n if (versions.length > limit) {\n consola.log(\n `\\n \\x1b[90m... and ${versions.length - limit} more (use --limit to show more)\\x1b[0m`,\n );\n }\n consola.log(\"\");\n });\n },\n});\n"],"mappings":";;;;;;AAKA,SAAgB,qBAAqB,UAAqB,OAA0B;AAClF,QAAO,SACJ,UAAU,GAAG,MAAM;AAClB,MAAI,EAAE,gBAAgB,KAAM,QAAO,EAAE,gBAAgB,OAAO,IAAI;AAChE,MAAI,EAAE,gBAAgB,KAAM,QAAO;AACnC,SAAO,EAAE,YAAY,SAAS,GAAG,EAAE,YAAY,SAAS;GACxD,CACD,MAAM,GAAG,MAAM;;AAGpB,IAAA,mBAAe,cAAc;CAC3B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;GACX;EACD,OAAO;GACL,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;;EAEZ;CACD,MAAM,IAAI,EAAE,QAAQ;AAClB,QAAM,kBAAkB,YAAY;GAClC,MAAM,CAAC,KAAK,QAAQ,YAAY,KAAK,MAAM,CAAC,KAAK,YAAY;GAC7D,MAAM,WAAW,MAAM,IAAI,cAAc,KAAK;GAC9C,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,GAAG,IAAI;GACjD,MAAM,QAAQ,qBAAqB,UAAU,MAAM;AAEnD,OAAI,KAAK,MAAM;AACb,YAAQ,IAAI,KAAK,UAAU,OAAO,MAAM,EAAE,CAAC;AAC3C;;AAGF,WAAQ,IAAI,GAAG;AACf,WAAQ,IACN,YAAY,KAAK,YAAY,SAAS,OAAO,UAAU,SAAS,WAAW,IAAI,KAAK,MACrF;AACD,WAAQ,IAAI,GAAG;AAEf,QAAK,MAAM,KAAK,OAAO;IACrB,MAAM,SAAS,EAAE,SAAS,aAAa,EAAE,OAAO,YAAY;IAC5D,MAAM,OAAO,EAAE,cACX,aAAa,EAAE,YAAY,aAAa,CAAC,MAAM,GAAG,GAAG,CAAC,WACtD;AACJ,YAAQ,IAAI,KAAK,EAAE,SAAS,SAAS,OAAO;;AAG9C,OAAI,SAAS,SAAS,MACpB,SAAQ,IACN,uBAAuB,SAAS,SAAS,MAAM,yCAChD;AAEH,WAAQ,IAAI,GAAG;IACf;;CAEL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as ParsedPURL, c as URLBuilder, i as Package, l as Version, n as Dependency, o as RateLimiter, r as Maintainer, s as Scope, t as ClientOptions, u as VersionStatus } from "../_chunks/types.mjs";
|
|
2
|
+
import { a as register, i as has, n as create, o as Client, r as ecosystems, s as defaultClient, t as Registry } from "../_chunks/registry.mjs";
|
|
3
|
+
import { a as RateLimitError, c as combineLicenses, d as createFromPURL, f as fullName, i as PkioError, l as normalizeLicense, n as InvalidPURLError, o as UnknownEcosystemError, p as parsePURL, r as NotFoundError, s as normalizeRepositoryURL, t as HTTPError, u as buildPURL } from "../_chunks/errors.mjs";
|
|
4
|
+
export { Client, type ClientOptions, type Dependency, HTTPError, InvalidPURLError, type Maintainer, NotFoundError, type Package, type ParsedPURL, PkioError, RateLimitError, type RateLimiter, Registry, type Scope, type URLBuilder, UnknownEcosystemError, type Version, type VersionStatus, buildPURL, combineLicenses, create, createFromPURL, defaultClient, ecosystems, fullName, has, normalizeLicense, normalizeRepositoryURL, parsePURL, register };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as register, c as HTTPError, d as PkioError, f as RateLimitError, i as has, l as InvalidPURLError, n as create, o as Client, p as UnknownEcosystemError, r as ecosystems, s as defaultClient, t as Registry, u as NotFoundError } from "../_chunks/registry.mjs";
|
|
2
|
+
import { a as normalizeRepositoryURL, i as parsePURL, n as createFromPURL, o as combineLicenses, r as fullName, s as normalizeLicense, t as buildPURL } from "../_chunks/purl.mjs";
|
|
3
|
+
export { Client, HTTPError, InvalidPURLError, NotFoundError, PkioError, RateLimitError, Registry, UnknownEcosystemError, buildPURL, combineLicenses, create, createFromPURL, defaultClient, ecosystems, fullName, has, normalizeLicense, normalizeRepositoryURL, parsePURL, register };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a as ParsedPURL, c as URLBuilder, i as Package, l as Version, n as Dependency, o as RateLimiter, r as Maintainer, s as Scope, t as ClientOptions, u as VersionStatus } from "./_chunks/types.mjs";
|
|
2
|
+
import { a as register, i as has, n as create, o as Client, r as ecosystems, s as defaultClient, t as Registry } from "./_chunks/registry.mjs";
|
|
3
|
+
import { a as CargoRegistry, i as PyPIRegistry, n as PackagistRegistry, o as NpmRegistry, r as RubyGemsRegistry, t as AlpmRegistry } from "./_chunks/index.mjs";
|
|
4
|
+
import { a as RateLimitError, c as combineLicenses, d as createFromPURL, f as fullName, i as PkioError, l as normalizeLicense, n as InvalidPURLError, o as UnknownEcosystemError, p as parsePURL, r as NotFoundError, s as normalizeRepositoryURL, t as HTTPError, u as buildPURL } from "./_chunks/errors.mjs";
|
|
5
|
+
import { a as fetchVersionsFromPURL, c as selectVersion, i as fetchPackageFromPURL, n as fetchDependenciesFromPURL, o as resolveDocsUrl, r as fetchMaintainersFromPURL, s as resolveReadmeUrl, t as bulkFetchPackages } from "./_chunks/index2.mjs";
|
|
6
|
+
import { t as getCacheDir } from "./_chunks/paths.mjs";
|
|
7
|
+
import { a as getEcosystemStorage, i as disposeStorage, n as computeIntegrity, o as getStorage, r as configureStorage, t as clearStorage } from "./_chunks/storage.mjs";
|
|
8
|
+
import { t as CachedRegistry } from "./_chunks/cached-registry.mjs";
|
|
9
|
+
import { a as cacheKey, c as pruneStale, d as setEntry, f as writeLockfile, i as LockfileEntry, l as readLockfile, n as EntryType, o as getFreshEntry, r as Lockfile, s as isFresh, t as DEFAULT_TTL, u as removeEntry } from "./_chunks/lockfile.mjs";
|
|
10
|
+
import { n as createCached, t as CreateCachedOptions } from "./_chunks/index3.mjs";
|
|
11
|
+
export { AlpmRegistry, CachedRegistry, CargoRegistry, Client, ClientOptions, CreateCachedOptions, DEFAULT_TTL, Dependency, EntryType, HTTPError, InvalidPURLError, Lockfile, LockfileEntry, Maintainer, NotFoundError, NpmRegistry, Package, PackagistRegistry, ParsedPURL, PkioError, PyPIRegistry, RateLimitError, RateLimiter, Registry, RubyGemsRegistry, Scope, URLBuilder, UnknownEcosystemError, Version, VersionStatus, buildPURL, bulkFetchPackages, cacheKey, clearStorage, combineLicenses, computeIntegrity, configureStorage, create, createCached, createFromPURL, defaultClient, disposeStorage, ecosystems, fetchDependenciesFromPURL, fetchMaintainersFromPURL, fetchPackageFromPURL, fetchVersionsFromPURL, fullName, getCacheDir, getEcosystemStorage, getFreshEntry, getStorage, has, isFresh, normalizeLicense, normalizeRepositoryURL, parsePURL, pruneStale, readLockfile, register, removeEntry, resolveDocsUrl, resolveReadmeUrl, selectVersion, setEntry, writeLockfile };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as register, c as HTTPError, d as PkioError, f as RateLimitError, i as has, l as InvalidPURLError, n as create, o as Client, p as UnknownEcosystemError, r as ecosystems, s as defaultClient, t as Registry, u as NotFoundError } from "./_chunks/registry.mjs";
|
|
2
|
+
import { a as normalizeRepositoryURL, i as parsePURL, n as createFromPURL, o as combineLicenses, r as fullName, s as normalizeLicense, t as buildPURL } from "./_chunks/purl.mjs";
|
|
3
|
+
import { a as CargoRegistry, i as PyPIRegistry, n as PackagistRegistry, o as NpmRegistry, r as RubyGemsRegistry, t as AlpmRegistry } from "./_chunks/registries.mjs";
|
|
4
|
+
import { a as fetchVersionsFromPURL, c as selectVersion, i as fetchPackageFromPURL, n as fetchDependenciesFromPURL, o as resolveDocsUrl, r as fetchMaintainersFromPURL, s as resolveReadmeUrl, t as bulkFetchPackages } from "./_chunks/helpers.mjs";
|
|
5
|
+
import { getCacheDir } from "./cache/paths.mjs";
|
|
6
|
+
import { clearStorage, computeIntegrity, configureStorage, disposeStorage, getEcosystemStorage, getStorage } from "./cache/storage.mjs";
|
|
7
|
+
import { DEFAULT_TTL, cacheKey, getFreshEntry, isFresh, pruneStale, readLockfile, removeEntry, setEntry, writeLockfile } from "./cache/lockfile.mjs";
|
|
8
|
+
import { CachedRegistry } from "./cache/cached-registry.mjs";
|
|
9
|
+
import { createCached } from "./cache/index.mjs";
|
|
10
|
+
export { AlpmRegistry, CachedRegistry, CargoRegistry, Client, DEFAULT_TTL, HTTPError, InvalidPURLError, NotFoundError, NpmRegistry, PackagistRegistry, PkioError, PyPIRegistry, RateLimitError, Registry, RubyGemsRegistry, UnknownEcosystemError, buildPURL, bulkFetchPackages, cacheKey, clearStorage, combineLicenses, computeIntegrity, configureStorage, create, createCached, createFromPURL, defaultClient, disposeStorage, ecosystems, fetchDependenciesFromPURL, fetchMaintainersFromPURL, fetchPackageFromPURL, fetchVersionsFromPURL, fullName, getCacheDir, getEcosystemStorage, getFreshEntry, getStorage, has, isFresh, normalizeLicense, normalizeRepositoryURL, parsePURL, pruneStale, readLockfile, register, removeEntry, resolveDocsUrl, resolveReadmeUrl, selectVersion, setEntry, writeLockfile };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../_chunks/types.mjs";
|
|
2
|
+
import "../_chunks/registry.mjs";
|
|
3
|
+
import { a as CargoRegistry, i as PyPIRegistry, n as PackagistRegistry, o as NpmRegistry, r as RubyGemsRegistry, t as AlpmRegistry } from "../_chunks/index.mjs";
|
|
4
|
+
export { AlpmRegistry, CargoRegistry, NpmRegistry, PackagistRegistry, PyPIRegistry, RubyGemsRegistry };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../_chunks/registry.mjs";
|
|
2
|
+
import "../_chunks/purl.mjs";
|
|
3
|
+
import { a as CargoRegistry, i as PyPIRegistry, n as PackagistRegistry, o as NpmRegistry, r as RubyGemsRegistry, t as AlpmRegistry } from "../_chunks/registries.mjs";
|
|
4
|
+
export { AlpmRegistry, CargoRegistry, NpmRegistry, PackagistRegistry, PyPIRegistry, RubyGemsRegistry };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ParsedPURL, c as URLBuilder, i as Package, l as Version, n as Dependency, o as RateLimiter, r as Maintainer, s as Scope, t as ClientOptions, u as VersionStatus } from "./_chunks/types.mjs";
|
|
2
|
+
import { t as Registry } from "./_chunks/registry.mjs";
|
|
3
|
+
export { type ClientOptions, type Dependency, type Maintainer, type Package, type ParsedPURL, type RateLimiter, type Registry, type Scope, type URLBuilder, type Version, type VersionStatus };
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agntn/registries",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Universal package registry client. Query npm, PyPI, crates.io, RubyGems, Packagist and more with a single PURL-native API.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"crates",
|
|
7
|
+
"metadata",
|
|
8
|
+
"npm",
|
|
9
|
+
"package-registry",
|
|
10
|
+
"packagist",
|
|
11
|
+
"purl",
|
|
12
|
+
"pypi",
|
|
13
|
+
"rubygems",
|
|
14
|
+
"universal"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/agntn/registries#readme",
|
|
17
|
+
"bugs": "https://github.com/agntn/registries/issues",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "oritwoen (https://github.com/oritwoen)",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/agntn/registries.git"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"registries": "./dist/cli.mjs"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"sideEffects": [
|
|
32
|
+
"./src/index.ts",
|
|
33
|
+
"./src/registries/index.ts",
|
|
34
|
+
"./dist/index.mjs",
|
|
35
|
+
"./dist/registries/index.mjs"
|
|
36
|
+
],
|
|
37
|
+
"main": "./dist/index.mjs",
|
|
38
|
+
"types": "./dist/index.d.mts",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.mts",
|
|
42
|
+
"import": "./dist/index.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./ai": {
|
|
45
|
+
"types": "./dist/ai.d.mts",
|
|
46
|
+
"import": "./dist/ai.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./registries": {
|
|
49
|
+
"types": "./dist/registries/index.d.mts",
|
|
50
|
+
"import": "./dist/registries/index.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./cache": {
|
|
53
|
+
"types": "./dist/cache/index.d.mts",
|
|
54
|
+
"import": "./dist/cache/index.mjs"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"citty": "^0.2.1",
|
|
62
|
+
"consola": "^3.4.2",
|
|
63
|
+
"ofetch": "^1.5.1",
|
|
64
|
+
"unstorage": "^1.17.4"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^25.3.0",
|
|
68
|
+
"ai": "^6.0.116",
|
|
69
|
+
"changelogen": "^0.6.2",
|
|
70
|
+
"obuild": "^0.4.31",
|
|
71
|
+
"oxfmt": "^0.36.0",
|
|
72
|
+
"oxlint": "^1.51.0",
|
|
73
|
+
"typescript": "^5.8.3",
|
|
74
|
+
"vitest": "^4.0.0",
|
|
75
|
+
"zod": "^4.3.6"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"ai": "^6.0.116",
|
|
79
|
+
"zod": "^4.3.6"
|
|
80
|
+
},
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"ai": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"zod": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=22.6.0"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "obuild",
|
|
94
|
+
"dev:prepare": "obuild --stub",
|
|
95
|
+
"fmt": "oxlint . --fix && oxfmt .",
|
|
96
|
+
"lint": "oxlint . && oxfmt --check .",
|
|
97
|
+
"typecheck": "tsc --noEmit",
|
|
98
|
+
"test": "vitest",
|
|
99
|
+
"test:run": "vitest run",
|
|
100
|
+
"release": "pnpm test:run && pnpm build && changelogen --release --push"
|
|
101
|
+
}
|
|
102
|
+
}
|