@agntn/registries 0.3.0 → 0.3.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.
Files changed (110) hide show
  1. package/README.md +26 -3
  2. package/dist/THIRD-PARTY-LICENSES.md +36 -0
  3. package/dist/_chunks/cache.mjs +15 -0
  4. package/dist/{cache/index.mjs.map → _chunks/cache.mjs.map} +1 -1
  5. package/dist/{commands/cache.mjs → _chunks/cache2.mjs} +6 -8
  6. package/dist/_chunks/cache2.mjs.map +1 -0
  7. package/dist/{cache → _chunks}/cached-registry.mjs +12 -8
  8. package/dist/_chunks/cached-registry.mjs.map +1 -0
  9. package/dist/{commands → _chunks}/deps.mjs +19 -13
  10. package/dist/_chunks/deps.mjs.map +1 -0
  11. package/dist/_chunks/helpers.mjs +53 -19
  12. package/dist/_chunks/helpers.mjs.map +1 -1
  13. package/dist/_chunks/index.d.mts +9 -23
  14. package/dist/_chunks/index.d.mts.map +1 -1
  15. package/dist/_chunks/index2.d.mts +181 -0
  16. package/dist/_chunks/index2.d.mts.map +1 -0
  17. package/dist/_chunks/index3.d.mts +188 -0
  18. package/dist/_chunks/index3.d.mts.map +1 -0
  19. package/dist/_chunks/info.mjs +105 -0
  20. package/dist/_chunks/info.mjs.map +1 -0
  21. package/dist/_chunks/libs/typebox.mjs +278 -0
  22. package/dist/_chunks/libs/typebox.mjs.map +1 -0
  23. package/dist/_chunks/lockfile.mjs +183 -0
  24. package/dist/_chunks/lockfile.mjs.map +1 -0
  25. package/dist/_chunks/maintainers.mjs +53 -0
  26. package/dist/_chunks/maintainers.mjs.map +1 -0
  27. package/dist/_chunks/mcp.mjs +15 -0
  28. package/dist/_chunks/mcp.mjs.map +1 -0
  29. package/dist/_chunks/registries.mjs +514 -245
  30. package/dist/_chunks/registries.mjs.map +1 -1
  31. package/dist/_chunks/registry.d.mts +121 -10
  32. package/dist/_chunks/registry.d.mts.map +1 -1
  33. package/dist/_chunks/registry.mjs +121 -31
  34. package/dist/_chunks/registry.mjs.map +1 -1
  35. package/dist/{commands → _chunks}/shared.mjs +15 -8
  36. package/dist/_chunks/shared.mjs.map +1 -0
  37. package/dist/_chunks/tool-operations.mjs +63 -0
  38. package/dist/_chunks/tool-operations.mjs.map +1 -0
  39. package/dist/_chunks/version.mjs +4 -0
  40. package/dist/_chunks/version.mjs.map +1 -0
  41. package/dist/{commands → _chunks}/versions.mjs +10 -9
  42. package/dist/_chunks/versions.mjs.map +1 -0
  43. package/dist/ai.d.mts +4 -4
  44. package/dist/ai.mjs +0 -1
  45. package/dist/ai.mjs.map +1 -1
  46. package/dist/cache/index.d.mts +3 -23
  47. package/dist/cache/index.mjs +4 -11
  48. package/dist/cli.mjs +9 -7
  49. package/dist/cli.mjs.map +1 -1
  50. package/dist/index.d.mts +4 -56
  51. package/dist/index.mjs +4 -7
  52. package/dist/mcp.d.mts +7 -0
  53. package/dist/mcp.d.mts.map +1 -0
  54. package/dist/mcp.mjs +155 -0
  55. package/dist/mcp.mjs.map +1 -0
  56. package/dist/registries/index.d.mts +0 -1
  57. package/dist/registries/index.mjs +0 -1
  58. package/dist/tool-operations.d.mts +36 -0
  59. package/dist/tool-operations.d.mts.map +1 -0
  60. package/dist/tool-operations.mjs +5 -0
  61. package/package.json +55 -9
  62. package/packages/omp/extensions/registries.ts +112 -0
  63. package/packages/pi/extensions/registries.ts +125 -0
  64. package/dist/_chunks/errors.d.mts +0 -90
  65. package/dist/_chunks/errors.d.mts.map +0 -1
  66. package/dist/_chunks/purl.mjs +0 -200
  67. package/dist/_chunks/purl.mjs.map +0 -1
  68. package/dist/_chunks/types.d.mts +0 -73
  69. package/dist/_chunks/types.d.mts.map +0 -1
  70. package/dist/cache/cached-registry.d.mts +0 -35
  71. package/dist/cache/cached-registry.d.mts.map +0 -1
  72. package/dist/cache/cached-registry.mjs.map +0 -1
  73. package/dist/cache/index.d.mts.map +0 -1
  74. package/dist/cache/lockfile.d.mts +0 -50
  75. package/dist/cache/lockfile.d.mts.map +0 -1
  76. package/dist/cache/lockfile.mjs +0 -68
  77. package/dist/cache/lockfile.mjs.map +0 -1
  78. package/dist/cache/paths.d.mts +0 -11
  79. package/dist/cache/paths.d.mts.map +0 -1
  80. package/dist/cache/paths.mjs +0 -26
  81. package/dist/cache/paths.mjs.map +0 -1
  82. package/dist/cache/storage.d.mts +0 -22
  83. package/dist/cache/storage.d.mts.map +0 -1
  84. package/dist/cache/storage.mjs +0 -40
  85. package/dist/cache/storage.mjs.map +0 -1
  86. package/dist/commands/cache.d.mts +0 -7
  87. package/dist/commands/cache.d.mts.map +0 -1
  88. package/dist/commands/cache.mjs.map +0 -1
  89. package/dist/commands/deps.d.mts +0 -23
  90. package/dist/commands/deps.d.mts.map +0 -1
  91. package/dist/commands/deps.mjs.map +0 -1
  92. package/dist/commands/info.d.mts +0 -26
  93. package/dist/commands/info.d.mts.map +0 -1
  94. package/dist/commands/info.mjs +0 -54
  95. package/dist/commands/info.mjs.map +0 -1
  96. package/dist/commands/maintainers.d.mts +0 -23
  97. package/dist/commands/maintainers.d.mts.map +0 -1
  98. package/dist/commands/maintainers.mjs +0 -46
  99. package/dist/commands/maintainers.mjs.map +0 -1
  100. package/dist/commands/shared.d.mts +0 -27
  101. package/dist/commands/shared.d.mts.map +0 -1
  102. package/dist/commands/shared.mjs.map +0 -1
  103. package/dist/commands/versions.d.mts +0 -31
  104. package/dist/commands/versions.d.mts.map +0 -1
  105. package/dist/commands/versions.mjs.map +0 -1
  106. package/dist/core/index.d.mts +0 -4
  107. package/dist/core/index.mjs +0 -3
  108. package/dist/index.d.mts.map +0 -1
  109. package/dist/types.d.mts +0 -3
  110. package/dist/types.mjs +0 -1
@@ -0,0 +1,112 @@
1
+ import { existsSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ import type { AgentToolResult, ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
5
+
6
+ import type * as RegistryTools from "../../../dist/tool-operations.d.mts";
7
+
8
+ const sourceModulePath = fileURLToPath(new URL("../../../src/tool-operations.ts", import.meta.url));
9
+ let toolOperationsPromise: Promise<typeof RegistryTools> | undefined;
10
+
11
+ function loadToolOperations(): Promise<typeof RegistryTools> {
12
+ toolOperationsPromise ??= (
13
+ existsSync(sourceModulePath)
14
+ ? import("../../../src/tool-operations.ts")
15
+ : import("../../../dist/tool-operations.mjs")
16
+ ) as Promise<typeof RegistryTools>;
17
+ return toolOperationsPromise;
18
+ }
19
+
20
+ type RegistryToolResult = AgentToolResult<unknown>;
21
+
22
+ export default function registriesExtension(pi: ExtensionAPI): void {
23
+ const { Type } = pi.typebox;
24
+ const PURL = Type.String({
25
+ minLength: 1,
26
+ maxLength: 2_048,
27
+ description: "Package URL, for example pkg:npm/lodash or pkg:pypi/requests@2.32.3",
28
+ });
29
+ const PURLParams = Type.Object({ purl: PURL }, { additionalProperties: false });
30
+ const BulkPackagesParams = Type.Object(
31
+ {
32
+ purls: Type.Array(PURL, { minItems: 1, maxItems: 50 }),
33
+ concurrency: Type.Optional(Type.Integer({ minimum: 1, maximum: 50 })),
34
+ },
35
+ { additionalProperties: false },
36
+ );
37
+ const EmptyParams = Type.Object({}, { additionalProperties: false });
38
+
39
+ pi.setLabel("Registries");
40
+
41
+ pi.registerTool({
42
+ name: "registries_package",
43
+ label: "Registry Package",
44
+ description: "Fetch normalized metadata for one package URL",
45
+ parameters: PURLParams,
46
+ approval: "read",
47
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
48
+ const { packageOperation } = await loadToolOperations();
49
+ return packageOperation(params, signal);
50
+ },
51
+ });
52
+
53
+ pi.registerTool({
54
+ name: "registries_versions",
55
+ label: "Registry Versions",
56
+ description: "List normalized versions for one package URL",
57
+ parameters: PURLParams,
58
+ approval: "read",
59
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
60
+ const { versionsOperation } = await loadToolOperations();
61
+ return versionsOperation(params, signal);
62
+ },
63
+ });
64
+
65
+ pi.registerTool({
66
+ name: "registries_dependencies",
67
+ label: "Registry Dependencies",
68
+ description: "List dependencies for a versioned package URL",
69
+ parameters: PURLParams,
70
+ approval: "read",
71
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
72
+ const { dependenciesOperation } = await loadToolOperations();
73
+ return dependenciesOperation(params, signal);
74
+ },
75
+ });
76
+
77
+ pi.registerTool({
78
+ name: "registries_maintainers",
79
+ label: "Registry Maintainers",
80
+ description: "List normalized maintainers for one package URL",
81
+ parameters: PURLParams,
82
+ approval: "read",
83
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
84
+ const { maintainersOperation } = await loadToolOperations();
85
+ return maintainersOperation(params, signal);
86
+ },
87
+ });
88
+
89
+ pi.registerTool({
90
+ name: "registries_bulk_packages",
91
+ label: "Registry Bulk Packages",
92
+ description: "Fetch normalized metadata for up to 50 package URLs",
93
+ parameters: BulkPackagesParams,
94
+ approval: "read",
95
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
96
+ const { bulkPackagesOperation } = await loadToolOperations();
97
+ return bulkPackagesOperation(params, signal);
98
+ },
99
+ });
100
+
101
+ pi.registerTool({
102
+ name: "registries_ecosystems",
103
+ label: "Registry Ecosystems",
104
+ description: "List package ecosystems registered by this package",
105
+ parameters: EmptyParams,
106
+ approval: "read",
107
+ async execute(): Promise<RegistryToolResult> {
108
+ const { ecosystemsOperation } = await loadToolOperations();
109
+ return ecosystemsOperation();
110
+ },
111
+ });
112
+ }
@@ -0,0 +1,125 @@
1
+ import { existsSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ import type { AgentToolResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
5
+ import { Type } from "typebox";
6
+
7
+ import type * as RegistryTools from "../../../dist/tool-operations.d.mts";
8
+
9
+ const sourceModuleUrl = new URL("../../../src/tool-operations.ts", import.meta.url);
10
+ const distributionModuleUrl = new URL("../../../dist/tool-operations.mjs", import.meta.url);
11
+ let toolOperationsPromise: Promise<typeof RegistryTools> | undefined;
12
+
13
+ function loadToolOperations(): Promise<typeof RegistryTools> {
14
+ toolOperationsPromise ??= import(
15
+ existsSync(fileURLToPath(sourceModuleUrl)) ? sourceModuleUrl.href : distributionModuleUrl.href
16
+ ) as Promise<typeof RegistryTools>;
17
+ return toolOperationsPromise;
18
+ }
19
+
20
+ const PURL = Type.String({
21
+ minLength: 1,
22
+ maxLength: 2_048,
23
+ description: "Package URL, for example pkg:npm/lodash or pkg:pypi/requests@2.32.3",
24
+ });
25
+ const PURLParams = Type.Object({ purl: PURL }, { additionalProperties: false });
26
+ const BulkPackagesParams = Type.Object(
27
+ {
28
+ purls: Type.Array(PURL, { minItems: 1, maxItems: 50 }),
29
+ concurrency: Type.Optional(Type.Integer({ minimum: 1, maximum: 50 })),
30
+ },
31
+ { additionalProperties: false },
32
+ );
33
+ const EmptyParams = Type.Object({}, { additionalProperties: false });
34
+
35
+ type RegistryToolResult = AgentToolResult<unknown>;
36
+
37
+ export default function registriesExtension(pi: ExtensionAPI): void {
38
+ pi.registerTool({
39
+ name: "registries_package",
40
+ label: "Registry Package",
41
+ description: "Fetch normalized metadata for one package URL",
42
+ promptSnippet: "Use registries_package to inspect normalized package metadata.",
43
+ promptGuidelines: [
44
+ "Use registries_package with a PURL such as pkg:npm/lodash or pkg:pypi/requests.",
45
+ ],
46
+ parameters: PURLParams,
47
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
48
+ const { packageOperation } = await loadToolOperations();
49
+ return packageOperation(params, signal);
50
+ },
51
+ });
52
+
53
+ pi.registerTool({
54
+ name: "registries_versions",
55
+ label: "Registry Versions",
56
+ description: "List normalized versions for one package URL",
57
+ promptSnippet: "Use registries_versions to inspect package releases.",
58
+ promptGuidelines: ["Use registries_versions when release dates, integrity, or status matter."],
59
+ parameters: PURLParams,
60
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
61
+ const { versionsOperation } = await loadToolOperations();
62
+ return versionsOperation(params, signal);
63
+ },
64
+ });
65
+
66
+ pi.registerTool({
67
+ name: "registries_dependencies",
68
+ label: "Registry Dependencies",
69
+ description: "List dependencies for a versioned package URL",
70
+ promptSnippet: "Use registries_dependencies to inspect one package release.",
71
+ promptGuidelines: [
72
+ "Use registries_dependencies with a versioned PURL such as pkg:npm/lodash@4.17.21.",
73
+ ],
74
+ parameters: PURLParams,
75
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
76
+ const { dependenciesOperation } = await loadToolOperations();
77
+ return dependenciesOperation(params, signal);
78
+ },
79
+ });
80
+
81
+ pi.registerTool({
82
+ name: "registries_maintainers",
83
+ label: "Registry Maintainers",
84
+ description: "List normalized maintainers for one package URL",
85
+ promptSnippet: "Use registries_maintainers to inspect package ownership.",
86
+ promptGuidelines: [
87
+ "Use registries_maintainers to retrieve the identities published by the package registry.",
88
+ ],
89
+ parameters: PURLParams,
90
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
91
+ const { maintainersOperation } = await loadToolOperations();
92
+ return maintainersOperation(params, signal);
93
+ },
94
+ });
95
+
96
+ pi.registerTool({
97
+ name: "registries_bulk_packages",
98
+ label: "Registry Bulk Packages",
99
+ description: "Fetch normalized metadata for up to 50 package URLs",
100
+ promptSnippet: "Use registries_bulk_packages to inspect several packages concurrently.",
101
+ promptGuidelines: [
102
+ "Use registries_bulk_packages for independent package lookups; failed packages are absent from the result.",
103
+ ],
104
+ parameters: BulkPackagesParams,
105
+ async execute(_toolCallId, params, signal): Promise<RegistryToolResult> {
106
+ const { bulkPackagesOperation } = await loadToolOperations();
107
+ return bulkPackagesOperation(params, signal);
108
+ },
109
+ });
110
+
111
+ pi.registerTool({
112
+ name: "registries_ecosystems",
113
+ label: "Registry Ecosystems",
114
+ description: "List package ecosystems registered by this package",
115
+ promptSnippet: "Use registries_ecosystems to discover supported package URL types.",
116
+ promptGuidelines: [
117
+ "Use registries_ecosystems before choosing a PURL type when ecosystem support is uncertain.",
118
+ ],
119
+ parameters: EmptyParams,
120
+ async execute(): Promise<RegistryToolResult> {
121
+ const { ecosystemsOperation } = await loadToolOperations();
122
+ return ecosystemsOperation();
123
+ },
124
+ });
125
+ }
@@ -1,90 +0,0 @@
1
- import { a as ParsedPURL } from "./types.mjs";
2
- import { o as Client, t as Registry } from "./registry.mjs";
3
-
4
- //#region src/core/purl.d.ts
5
- /**
6
- * Parse a PURL string into its components.
7
- *
8
- * Format: `pkg:<type>/<namespace>/<name>@<version>?<qualifiers>#<subpath>`
9
- *
10
- * @see https://github.com/package-url/purl-spec (ECMA-427)
11
- */
12
- declare function parsePURL(purlStr: string): ParsedPURL;
13
- /** Build the full name from namespace + name (e.g., "@scope/pkg" for npm). */
14
- declare function fullName(parsed: ParsedPURL): string;
15
- /** Create a registry instance from a PURL, returning [registry, name, version]. */
16
- declare function createFromPURL(purlStr: string, client?: Client): [Registry, string, string];
17
- /** Build a PURL string from components. Inverse of `parsePURL`. */
18
- declare function buildPURL(parts: {
19
- type: string;
20
- name: string;
21
- version?: string;
22
- namespace?: string;
23
- qualifiers?: Record<string, string>;
24
- subpath?: string;
25
- }): string;
26
- //#endregion
27
- //#region src/core/license.d.ts
28
- /**
29
- * Normalize a license string to SPDX expression.
30
- *
31
- * Handles common variations: "MIT License" → "MIT", "Apache 2.0" → "Apache-2.0".
32
- * Passes through already-valid SPDX identifiers unchanged.
33
- */
34
- declare function normalizeLicense(raw: string | null | undefined): string;
35
- /**
36
- * Combine multiple license strings into a single SPDX expression.
37
- *
38
- * Default operator is OR (disjunctive, user picks one).
39
- * Pass "AND" for ecosystems where multiple licenses mean all apply (e.g. Arch Linux).
40
- */
41
- declare function combineLicenses(licenses: (string | null | undefined)[], operator?: "OR" | "AND"): string;
42
- //#endregion
43
- //#region src/core/repository.d.ts
44
- /**
45
- * Normalize a repository URL to a clean HTTPS git URL.
46
- *
47
- * Handles various formats:
48
- * - "git+https://github.com/foo/bar.git" → "https://github.com/foo/bar"
49
- * - "git://github.com/foo/bar" → "https://github.com/foo/bar"
50
- * - "ssh://git@github.com/foo/bar.git" → "https://github.com/foo/bar"
51
- * - "github:foo/bar" → "https://github.com/foo/bar"
52
- * - { url: "..." } → extracted and normalized
53
- */
54
- declare function normalizeRepositoryURL(raw: unknown): string;
55
- //#endregion
56
- //#region src/core/errors.d.ts
57
- /** Custom error types for registry operations. */
58
- declare class PkioError extends Error {
59
- constructor(message: string, options?: ErrorOptions);
60
- }
61
- declare class HTTPError extends PkioError {
62
- readonly statusCode: number;
63
- readonly url: string;
64
- readonly body: string;
65
- constructor(statusCode: number, url: string, body: string);
66
- isNotFound(): boolean;
67
- isRateLimit(): boolean;
68
- isServerError(): boolean;
69
- }
70
- declare class NotFoundError extends PkioError {
71
- readonly ecosystem: string;
72
- readonly packageName: string;
73
- readonly version: string;
74
- constructor(ecosystem: string, packageName: string, version?: string);
75
- }
76
- declare class RateLimitError extends PkioError {
77
- readonly retryAfter: number;
78
- constructor(retryAfter: number);
79
- }
80
- declare class UnknownEcosystemError extends PkioError {
81
- readonly ecosystem: string;
82
- constructor(ecosystem: string);
83
- }
84
- declare class InvalidPURLError extends PkioError {
85
- readonly purl: string;
86
- constructor(purl: string, reason: string);
87
- }
88
- //#endregion
89
- export { RateLimitError as a, combineLicenses as c, createFromPURL as d, fullName as f, PkioError as i, normalizeLicense as l, InvalidPURLError as n, UnknownEcosystemError as o, parsePURL as p, NotFoundError as r, normalizeRepositoryURL as s, HTTPError as t, buildPURL as u };
90
- //# sourceMappingURL=errors.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.mts","names":[],"sources":["../../src/core/purl.ts","../../src/core/license.ts","../../src/core/repository.ts","../../src/core/errors.ts"],"mappings":";;;;;AAuBA;;;;;AA4FA;iBA5FgB,SAAA,CAAU,OAAA,WAAkB,UAAA;;iBA4F5B,QAAA,CAAS,MAAA,EAAQ,UAAA;;iBAQjB,cAAA,CAAe,OAAA,UAAiB,MAAA,GAAS,MAAA,IAAU,QAAA;;iBAQnD,SAAA,CAAU,KAAA;EACxB,IAAA;EACA,IAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA,GAAa,MAAA;EACb,OAAA;AAAA;;;;;;;AAlHF;;iBCjBgB,gBAAA,CAAiB,GAAA;;;AD6GjC;;;;iBCpDgB,eAAA,CACd,QAAA,iCACA,QAAA;;;;;;;AD1CF;;;;;AA4FA;iBEzGgB,sBAAA,CAAuB,GAAA;;;;cCR1B,SAAA,SAAkB,KAAA;cACjB,OAAA,UAAiB,OAAA,GAAU,YAAA;AAAA;AAAA,cAM5B,SAAA,SAAkB,SAAA;EAAA,SACpB,UAAA;EAAA,SACA,GAAA;EAAA,SACA,IAAA;cAEG,UAAA,UAAoB,GAAA,UAAa,IAAA;EAQ7C,UAAA,CAAA;EAIA,WAAA,CAAA;EAIA,aAAA,CAAA;AAAA;AAAA,cAKW,aAAA,SAAsB,SAAA;EAAA,SACxB,SAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA;cAEG,SAAA,UAAmB,WAAA,UAAqB,OAAA;AAAA;AAAA,cAUzC,cAAA,SAAuB,SAAA;EAAA,SACzB,UAAA;cAEG,UAAA;AAAA;AAAA,cAOD,qBAAA,SAA8B,SAAA;EAAA,SAChC,SAAA;cAEG,SAAA;AAAA;AAAA,cAOD,gBAAA,SAAyB,SAAA;EAAA,SAC3B,IAAA;cAEG,IAAA,UAAc,MAAA;AAAA"}
@@ -1,200 +0,0 @@
1
- import { l as InvalidPURLError, n as create } from "./registry.mjs";
2
- /**
3
- * Normalize a license string to SPDX expression.
4
- *
5
- * Handles common variations: "MIT License" → "MIT", "Apache 2.0" → "Apache-2.0".
6
- * Passes through already-valid SPDX identifiers unchanged.
7
- */
8
- function normalizeLicense(raw) {
9
- if (!raw) return "";
10
- const trimmed = raw.trim();
11
- if (!trimmed) return "";
12
- const lower = trimmed.toLowerCase();
13
- const known = LICENSE_MAP.get(lower);
14
- if (known) return known;
15
- return trimmed;
16
- }
17
- const LICENSE_MAP = new Map([
18
- ["mit license", "MIT"],
19
- ["mit", "MIT"],
20
- ["apache license 2.0", "Apache-2.0"],
21
- ["apache 2.0", "Apache-2.0"],
22
- ["apache-2.0", "Apache-2.0"],
23
- ["apache license, version 2.0", "Apache-2.0"],
24
- ["apache2", "Apache-2.0"],
25
- ["bsd-2-clause", "BSD-2-Clause"],
26
- ["bsd-3-clause", "BSD-3-Clause"],
27
- ["bsd 2-clause", "BSD-2-Clause"],
28
- ["bsd 3-clause", "BSD-3-Clause"],
29
- ["simplified bsd license", "BSD-2-Clause"],
30
- ["new bsd license", "BSD-3-Clause"],
31
- ["isc license", "ISC"],
32
- ["isc", "ISC"],
33
- ["gpl-2.0", "GPL-2.0-only"],
34
- ["gpl-3.0", "GPL-3.0-only"],
35
- ["gpl-2.0-only", "GPL-2.0-only"],
36
- ["gpl-3.0-only", "GPL-3.0-only"],
37
- ["lgpl-2.1", "LGPL-2.1-only"],
38
- ["lgpl-3.0", "LGPL-3.0-only"],
39
- ["mpl-2.0", "MPL-2.0"],
40
- ["mozilla public license 2.0", "MPL-2.0"],
41
- ["unlicense", "Unlicense"],
42
- ["the unlicense", "Unlicense"],
43
- ["cc0-1.0", "CC0-1.0"],
44
- ["cc0", "CC0-1.0"],
45
- ["public domain", "Unlicense"],
46
- ["zlib", "Zlib"],
47
- ["wtfpl", "WTFPL"],
48
- ["artistic-2.0", "Artistic-2.0"],
49
- ["boost software license 1.0", "BSL-1.0"],
50
- ["bsl-1.0", "BSL-1.0"]
51
- ]);
52
- /**
53
- * Combine multiple license strings into a single SPDX expression.
54
- *
55
- * Default operator is OR (disjunctive, user picks one).
56
- * Pass "AND" for ecosystems where multiple licenses mean all apply (e.g. Arch Linux).
57
- */
58
- function combineLicenses(licenses, operator = "OR") {
59
- const normalized = licenses.map((l) => normalizeLicense(l)).filter(Boolean);
60
- if (normalized.length === 0) return "";
61
- if (normalized.length === 1) return normalized[0];
62
- return normalized.join(` ${operator} `);
63
- }
64
- /**
65
- * Normalize a repository URL to a clean HTTPS git URL.
66
- *
67
- * Handles various formats:
68
- * - "git+https://github.com/foo/bar.git" → "https://github.com/foo/bar"
69
- * - "git://github.com/foo/bar" → "https://github.com/foo/bar"
70
- * - "ssh://git@github.com/foo/bar.git" → "https://github.com/foo/bar"
71
- * - "github:foo/bar" → "https://github.com/foo/bar"
72
- * - { url: "..." } → extracted and normalized
73
- */
74
- function normalizeRepositoryURL(raw) {
75
- if (!raw) return "";
76
- let url;
77
- if (typeof raw === "string") url = raw;
78
- else if (typeof raw === "object" && raw !== null) {
79
- const obj = raw;
80
- if (typeof obj["url"] === "string") url = obj["url"];
81
- else return "";
82
- } else return "";
83
- url = url.trim();
84
- if (!url) return "";
85
- if (url.startsWith("github:")) url = `https://github.com/${url.slice(7)}`;
86
- if (url.startsWith("gitlab:")) url = `https://gitlab.com/${url.slice(7)}`;
87
- if (url.startsWith("bitbucket:")) url = `https://bitbucket.org/${url.slice(10)}`;
88
- if (url.startsWith("git+")) url = url.slice(4);
89
- if (url.startsWith("git://")) url = "https://" + url.slice(6);
90
- if (url.startsWith("ssh://git@")) url = "https://" + url.slice(10);
91
- const sshMatch = url.match(/^git@([^:]+):(.+)$/);
92
- if (sshMatch) url = `https://${sshMatch[1]}/${sshMatch[2]}`;
93
- if (url.endsWith("/")) url = url.slice(0, -1);
94
- if (url.endsWith(".git")) url = url.slice(0, -4);
95
- return url;
96
- }
97
- const QUALIFIER_KEY_PATTERN = /^[a-z][a-z0-9._-]*$/;
98
- /** Decode a percent-encoded PURL component, throwing InvalidPURLError on malformed sequences. */
99
- function decodePURLComponent(purlStr, value) {
100
- try {
101
- return decodeURIComponent(value);
102
- } catch {
103
- throw new InvalidPURLError(purlStr, "malformed percent-encoding");
104
- }
105
- }
106
- /**
107
- * Parse a PURL string into its components.
108
- *
109
- * Format: `pkg:<type>/<namespace>/<name>@<version>?<qualifiers>#<subpath>`
110
- *
111
- * @see https://github.com/package-url/purl-spec (ECMA-427)
112
- */
113
- function parsePURL(purlStr) {
114
- if (!purlStr.startsWith("pkg:")) throw new InvalidPURLError(purlStr, "must start with \"pkg:\"");
115
- let remainder = purlStr.slice(4);
116
- let subpath = "";
117
- const hashIdx = remainder.indexOf("#");
118
- if (hashIdx !== -1) {
119
- subpath = remainder.slice(hashIdx + 1).split("/").map((s) => decodePURLComponent(purlStr, s)).join("/");
120
- remainder = remainder.slice(0, hashIdx);
121
- }
122
- const qualifiers = {};
123
- const queryIdx = remainder.indexOf("?");
124
- if (queryIdx !== -1) {
125
- const queryStr = remainder.slice(queryIdx + 1);
126
- remainder = remainder.slice(0, queryIdx);
127
- for (const pair of queryStr.split("&")) {
128
- const eqIdx = pair.indexOf("=");
129
- if (eqIdx !== -1) qualifiers[decodePURLComponent(purlStr, pair.slice(0, eqIdx))] = decodePURLComponent(purlStr, pair.slice(eqIdx + 1));
130
- }
131
- }
132
- let version = "";
133
- const lastSlashBeforeVersion = remainder.lastIndexOf("/");
134
- const lastAtIdx = remainder.lastIndexOf("@");
135
- if (lastAtIdx !== -1 && lastAtIdx > lastSlashBeforeVersion) {
136
- version = decodePURLComponent(purlStr, remainder.slice(lastAtIdx + 1));
137
- remainder = remainder.slice(0, lastAtIdx);
138
- }
139
- const slashIdx = remainder.indexOf("/");
140
- if (slashIdx === -1) throw new InvalidPURLError(purlStr, "missing type/name separator");
141
- const type = remainder.slice(0, slashIdx).toLowerCase();
142
- if (!type) throw new InvalidPURLError(purlStr, "empty type");
143
- const rest = remainder.slice(slashIdx + 1);
144
- if (!rest) throw new InvalidPURLError(purlStr, "empty name");
145
- const lastSlashIdx = rest.lastIndexOf("/");
146
- let namespace = "";
147
- let name;
148
- if (lastSlashIdx !== -1) {
149
- namespace = rest.slice(0, lastSlashIdx).split("/").map((s) => decodePURLComponent(purlStr, s)).join("/");
150
- name = decodePURLComponent(purlStr, rest.slice(lastSlashIdx + 1));
151
- } else name = decodePURLComponent(purlStr, rest);
152
- if (type === "pypi") name = name.toLowerCase().replace(/[-_.]+/g, "-");
153
- if (type === "alpm") name = name.toLowerCase();
154
- return {
155
- type,
156
- namespace,
157
- name,
158
- version,
159
- qualifiers,
160
- subpath
161
- };
162
- }
163
- /** Build the full name from namespace + name (e.g., "@scope/pkg" for npm). */
164
- function fullName(parsed) {
165
- if (parsed.namespace) return `${parsed.namespace}/${parsed.name}`;
166
- return parsed.name;
167
- }
168
- /** Create a registry instance from a PURL, returning [registry, name, version]. */
169
- function createFromPURL(purlStr, client) {
170
- const parsed = parsePURL(purlStr);
171
- const baseURL = parsed.qualifiers["repository_url"] ?? "";
172
- return [
173
- create(parsed.type, baseURL || void 0, client),
174
- fullName(parsed),
175
- parsed.version
176
- ];
177
- }
178
- /** Build a PURL string from components. Inverse of `parsePURL`. */
179
- function buildPURL(parts) {
180
- let purl = `pkg:${parts.type}/`;
181
- if (parts.namespace) purl += `${parts.namespace.split("/").map((s) => encodeURIComponent(s)).join("/")}/`;
182
- purl += encodeURIComponent(parts.name);
183
- if (parts.version) purl += `@${encodeURIComponent(parts.version)}`;
184
- if (parts.qualifiers && Object.keys(parts.qualifiers).length > 0) {
185
- const qualifiers = /* @__PURE__ */ new Map();
186
- for (const [key, value] of Object.entries(parts.qualifiers)) {
187
- const canonicalKey = key.toLowerCase();
188
- if (!QUALIFIER_KEY_PATTERN.test(canonicalKey)) throw new InvalidPURLError(purl, `invalid qualifier key "${key}"`);
189
- if (qualifiers.has(canonicalKey)) throw new InvalidPURLError(purl, `duplicate qualifier key "${canonicalKey}"`);
190
- qualifiers.set(canonicalKey, value);
191
- }
192
- const qs = [...qualifiers].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
193
- purl += `?${qs}`;
194
- }
195
- if (parts.subpath) purl += `#${parts.subpath.split("/").map((s) => encodeURIComponent(s)).join("/")}`;
196
- return purl;
197
- }
198
- export { normalizeRepositoryURL as a, parsePURL as i, createFromPURL as n, combineLicenses as o, fullName as r, normalizeLicense as s, buildPURL as t };
199
-
200
- //# sourceMappingURL=purl.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"purl.mjs","names":[],"sources":["../../src/core/license.ts","../../src/core/repository.ts","../../src/core/purl.ts"],"sourcesContent":["/**\n * Normalize a license string to SPDX expression.\n *\n * Handles common variations: \"MIT License\" → \"MIT\", \"Apache 2.0\" → \"Apache-2.0\".\n * Passes through already-valid SPDX identifiers unchanged.\n */\nexport function normalizeLicense(raw: string | null | undefined): string {\n if (!raw) return \"\";\n\n const trimmed = raw.trim();\n if (!trimmed) return \"\";\n\n // Common mappings\n const lower = trimmed.toLowerCase();\n const known = LICENSE_MAP.get(lower);\n if (known) return known;\n\n // Already looks like SPDX — return as-is\n return trimmed;\n}\n\nconst LICENSE_MAP = new Map<string, string>([\n [\"mit license\", \"MIT\"],\n [\"mit\", \"MIT\"],\n [\"apache license 2.0\", \"Apache-2.0\"],\n [\"apache 2.0\", \"Apache-2.0\"],\n [\"apache-2.0\", \"Apache-2.0\"],\n [\"apache license, version 2.0\", \"Apache-2.0\"],\n [\"apache2\", \"Apache-2.0\"],\n [\"bsd-2-clause\", \"BSD-2-Clause\"],\n [\"bsd-3-clause\", \"BSD-3-Clause\"],\n [\"bsd 2-clause\", \"BSD-2-Clause\"],\n [\"bsd 3-clause\", \"BSD-3-Clause\"],\n [\"simplified bsd license\", \"BSD-2-Clause\"],\n [\"new bsd license\", \"BSD-3-Clause\"],\n [\"isc license\", \"ISC\"],\n [\"isc\", \"ISC\"],\n [\"gpl-2.0\", \"GPL-2.0-only\"],\n [\"gpl-3.0\", \"GPL-3.0-only\"],\n [\"gpl-2.0-only\", \"GPL-2.0-only\"],\n [\"gpl-3.0-only\", \"GPL-3.0-only\"],\n [\"lgpl-2.1\", \"LGPL-2.1-only\"],\n [\"lgpl-3.0\", \"LGPL-3.0-only\"],\n [\"mpl-2.0\", \"MPL-2.0\"],\n [\"mozilla public license 2.0\", \"MPL-2.0\"],\n [\"unlicense\", \"Unlicense\"],\n [\"the unlicense\", \"Unlicense\"],\n [\"cc0-1.0\", \"CC0-1.0\"],\n [\"cc0\", \"CC0-1.0\"],\n [\"public domain\", \"Unlicense\"],\n [\"zlib\", \"Zlib\"],\n [\"wtfpl\", \"WTFPL\"],\n [\"artistic-2.0\", \"Artistic-2.0\"],\n [\"boost software license 1.0\", \"BSL-1.0\"],\n [\"bsl-1.0\", \"BSL-1.0\"],\n]);\n\n/**\n * Combine multiple license strings into a single SPDX expression.\n *\n * Default operator is OR (disjunctive, user picks one).\n * Pass \"AND\" for ecosystems where multiple licenses mean all apply (e.g. Arch Linux).\n */\nexport function combineLicenses(\n licenses: (string | null | undefined)[],\n operator: \"OR\" | \"AND\" = \"OR\",\n): string {\n const normalized = licenses.map((l) => normalizeLicense(l)).filter(Boolean);\n\n if (normalized.length === 0) return \"\";\n if (normalized.length === 1) return normalized[0]!;\n return normalized.join(` ${operator} `);\n}\n","/**\n * Normalize a repository URL to a clean HTTPS git URL.\n *\n * Handles various formats:\n * - \"git+https://github.com/foo/bar.git\" → \"https://github.com/foo/bar\"\n * - \"git://github.com/foo/bar\" → \"https://github.com/foo/bar\"\n * - \"ssh://git@github.com/foo/bar.git\" → \"https://github.com/foo/bar\"\n * - \"github:foo/bar\" → \"https://github.com/foo/bar\"\n * - { url: \"...\" } → extracted and normalized\n */\nexport function normalizeRepositoryURL(raw: unknown): string {\n if (!raw) return \"\";\n\n let url: string;\n\n if (typeof raw === \"string\") {\n url = raw;\n } else if (typeof raw === \"object\" && raw !== null) {\n const obj = raw as Record<string, unknown>;\n if (typeof obj[\"url\"] === \"string\") {\n url = obj[\"url\"];\n } else {\n return \"\";\n }\n } else {\n return \"\";\n }\n\n url = url.trim();\n if (!url) return \"\";\n\n // GitHub shorthand: \"github:user/repo\"\n if (url.startsWith(\"github:\")) {\n url = `https://github.com/${url.slice(7)}`;\n }\n\n // GitLab shorthand\n if (url.startsWith(\"gitlab:\")) {\n url = `https://gitlab.com/${url.slice(7)}`;\n }\n\n // Bitbucket shorthand\n if (url.startsWith(\"bitbucket:\")) {\n url = `https://bitbucket.org/${url.slice(10)}`;\n }\n\n // Strip \"git+\" prefix\n if (url.startsWith(\"git+\")) {\n url = url.slice(4);\n }\n\n // Convert git:// to https://\n if (url.startsWith(\"git://\")) {\n url = \"https://\" + url.slice(6);\n }\n\n // Convert ssh://git@host/... to https://host/...\n if (url.startsWith(\"ssh://git@\")) {\n url = \"https://\" + url.slice(10);\n }\n\n // Convert git@host:user/repo to https://host/user/repo\n const sshMatch = url.match(/^git@([^:]+):(.+)$/);\n if (sshMatch) {\n url = `https://${sshMatch[1]}/${sshMatch[2]}`;\n }\n\n // Strip trailing slash first so \".git/\" doesn't survive\n if (url.endsWith(\"/\")) {\n url = url.slice(0, -1);\n }\n\n // Strip .git suffix\n if (url.endsWith(\".git\")) {\n url = url.slice(0, -4);\n }\n\n return url;\n}\n","import type { ParsedPURL } from \"./types.ts\";\nimport type { Client } from \"./client.ts\";\nimport { create, type Registry } from \"./registry.ts\";\nimport { InvalidPURLError } from \"./errors.ts\";\n\nconst QUALIFIER_KEY_PATTERN = /^[a-z][a-z0-9._-]*$/;\n\n/** Decode a percent-encoded PURL component, throwing InvalidPURLError on malformed sequences. */\nfunction decodePURLComponent(purlStr: string, value: string): string {\n try {\n return decodeURIComponent(value);\n } catch {\n throw new InvalidPURLError(purlStr, \"malformed percent-encoding\");\n }\n}\n\n/**\n * Parse a PURL string into its components.\n *\n * Format: `pkg:<type>/<namespace>/<name>@<version>?<qualifiers>#<subpath>`\n *\n * @see https://github.com/package-url/purl-spec (ECMA-427)\n */\nexport function parsePURL(purlStr: string): ParsedPURL {\n if (!purlStr.startsWith(\"pkg:\")) {\n throw new InvalidPURLError(purlStr, 'must start with \"pkg:\"');\n }\n\n let remainder = purlStr.slice(4); // strip 'pkg:'\n\n // Extract subpath\n let subpath = \"\";\n const hashIdx = remainder.indexOf(\"#\");\n if (hashIdx !== -1) {\n subpath = remainder\n .slice(hashIdx + 1)\n .split(\"/\")\n .map((s) => decodePURLComponent(purlStr, s))\n .join(\"/\");\n remainder = remainder.slice(0, hashIdx);\n }\n\n // Extract qualifiers\n const qualifiers: Record<string, string> = {};\n const queryIdx = remainder.indexOf(\"?\");\n if (queryIdx !== -1) {\n const queryStr = remainder.slice(queryIdx + 1);\n remainder = remainder.slice(0, queryIdx);\n for (const pair of queryStr.split(\"&\")) {\n const eqIdx = pair.indexOf(\"=\");\n if (eqIdx !== -1) {\n qualifiers[decodePURLComponent(purlStr, pair.slice(0, eqIdx))] = decodePURLComponent(\n purlStr,\n pair.slice(eqIdx + 1),\n );\n }\n }\n }\n\n // Extract version — the version separator is the last '@' that appears\n // after the last '/', so scoped names like 'npm/@vue/core' are not mistaken\n // for having a version.\n let version = \"\";\n const lastSlashBeforeVersion = remainder.lastIndexOf(\"/\");\n const lastAtIdx = remainder.lastIndexOf(\"@\");\n if (lastAtIdx !== -1 && lastAtIdx > lastSlashBeforeVersion) {\n version = decodePURLComponent(purlStr, remainder.slice(lastAtIdx + 1));\n remainder = remainder.slice(0, lastAtIdx);\n }\n\n // Extract type\n const slashIdx = remainder.indexOf(\"/\");\n if (slashIdx === -1) {\n throw new InvalidPURLError(purlStr, \"missing type/name separator\");\n }\n\n const type = remainder.slice(0, slashIdx).toLowerCase();\n if (!type) {\n throw new InvalidPURLError(purlStr, \"empty type\");\n }\n\n const rest = remainder.slice(slashIdx + 1);\n if (!rest) {\n throw new InvalidPURLError(purlStr, \"empty name\");\n }\n\n // Extract namespace and name\n const lastSlashIdx = rest.lastIndexOf(\"/\");\n let namespace = \"\";\n let name: string;\n\n if (lastSlashIdx !== -1) {\n namespace = rest\n .slice(0, lastSlashIdx)\n .split(\"/\")\n .map((s) => decodePURLComponent(purlStr, s))\n .join(\"/\");\n name = decodePURLComponent(purlStr, rest.slice(lastSlashIdx + 1));\n } else {\n name = decodePURLComponent(purlStr, rest);\n }\n\n // Ecosystem-specific normalization per PURL spec\n if (type === \"pypi\") {\n name = name.toLowerCase().replace(/[-_.]+/g, \"-\");\n }\n\n if (type === \"alpm\") {\n name = name.toLowerCase();\n }\n\n return { type, namespace, name, version, qualifiers, subpath };\n}\n\n/** Build the full name from namespace + name (e.g., \"@scope/pkg\" for npm). */\nexport function fullName(parsed: ParsedPURL): string {\n if (parsed.namespace) {\n return `${parsed.namespace}/${parsed.name}`;\n }\n return parsed.name;\n}\n\n/** Create a registry instance from a PURL, returning [registry, name, version]. */\nexport function createFromPURL(purlStr: string, client?: Client): [Registry, string, string] {\n const parsed = parsePURL(purlStr);\n const baseURL = parsed.qualifiers[\"repository_url\"] ?? \"\";\n const reg = create(parsed.type, baseURL || undefined, client);\n return [reg, fullName(parsed), parsed.version];\n}\n\n/** Build a PURL string from components. Inverse of `parsePURL`. */\nexport function buildPURL(parts: {\n type: string;\n name: string;\n version?: string;\n namespace?: string;\n qualifiers?: Record<string, string>;\n subpath?: string;\n}): string {\n let purl = `pkg:${parts.type}/`;\n if (parts.namespace) {\n purl += `${parts.namespace\n .split(\"/\")\n .map((s) => encodeURIComponent(s))\n .join(\"/\")}/`;\n }\n purl += encodeURIComponent(parts.name);\n if (parts.version) {\n purl += `@${encodeURIComponent(parts.version)}`;\n }\n if (parts.qualifiers && Object.keys(parts.qualifiers).length > 0) {\n const qualifiers = new Map<string, string>();\n for (const [key, value] of Object.entries(parts.qualifiers)) {\n const canonicalKey = key.toLowerCase();\n if (!QUALIFIER_KEY_PATTERN.test(canonicalKey)) {\n throw new InvalidPURLError(purl, `invalid qualifier key \"${key}\"`);\n }\n if (qualifiers.has(canonicalKey)) {\n throw new InvalidPURLError(purl, `duplicate qualifier key \"${canonicalKey}\"`);\n }\n qualifiers.set(canonicalKey, value);\n }\n const qs = [...qualifiers]\n .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join(\"&\");\n purl += `?${qs}`;\n }\n if (parts.subpath) {\n purl += `#${parts.subpath\n .split(\"/\")\n .map((s) => encodeURIComponent(s))\n .join(\"/\")}`;\n }\n return purl;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBAAiB,KAAwC;AACv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AK,UAAU,OAAO,QAAQ,MAAM,WAAW,EAAE;GAC3D,MAAM,eAAe,IAAI,aAAa;AACtC,OAAI,CAAC,sBAAsB,KAAK,aAAa,CAC3C,OAAM,IAAI,iBAAiB,MAAM,0BAA0B,IAAI,GAAG;AAEpE,OAAI,WAAW,IAAI,aAAa,CAC9B,OAAM,IAAI,iBAAiB,MAAM,4BAA4B,aAAa,GAAG;AAE/E,cAAW,IAAI,cAAc,MAAM;;EAErC,MAAM,KAAK,CAAC,GAAG,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,WAAY,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI,EAAG,CACrE,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,mBAAmB,MAAM,GAAG,CAC5D,KAAK,IAAI;AACZ,UAAQ,IAAI;;AAEd,KAAI,MAAM,QACR,SAAQ,IAAI,MAAM,QACf,MAAM,IAAI,CACV,KAAK,MAAM,mBAAmB,EAAE,CAAC,CACjC,KAAK,IAAI;AAEd,QAAO"}
@@ -1,73 +0,0 @@
1
- //#region src/core/types.d.ts
2
- /** Normalized package metadata returned by any registry. */
3
- interface Package {
4
- name: string;
5
- description: string;
6
- homepage: string;
7
- documentation: string;
8
- repository: string;
9
- licenses: string;
10
- keywords: string[];
11
- namespace: string;
12
- latestVersion: string;
13
- metadata: Record<string, unknown>;
14
- }
15
- /** A single version entry of a package. */
16
- interface Version {
17
- number: string;
18
- publishedAt: Date | null;
19
- licenses: string;
20
- integrity: string;
21
- status: VersionStatus;
22
- metadata: Record<string, unknown>;
23
- }
24
- /** Dependency of a package version. */
25
- interface Dependency {
26
- name: string;
27
- requirements: string;
28
- scope: Scope;
29
- optional: boolean;
30
- }
31
- /** Maintainer / author of a package. */
32
- interface Maintainer {
33
- uuid: string;
34
- login: string;
35
- name: string;
36
- email: string;
37
- url: string;
38
- role: string;
39
- }
40
- type VersionStatus = "" | "yanked" | "deprecated" | "retracted";
41
- type Scope = "runtime" | "development" | "test" | "build" | "optional";
42
- /** URL builder for a specific registry. */
43
- interface URLBuilder {
44
- registry(name: string, version?: string): string;
45
- download(name: string, version: string): string;
46
- documentation(name: string, version?: string): string;
47
- readme(name: string, version?: string): string;
48
- purl(name: string, version?: string): string;
49
- }
50
- /** Options for the HTTP client. */
51
- interface ClientOptions {
52
- maxRetries?: number;
53
- baseDelay?: number;
54
- timeout?: number;
55
- rateLimiter?: RateLimiter;
56
- userAgent?: string;
57
- }
58
- /** Rate limiter interface — bring your own implementation. */
59
- interface RateLimiter {
60
- wait(signal?: AbortSignal): Promise<void>;
61
- }
62
- /** Parsed PURL components. */
63
- interface ParsedPURL {
64
- type: string;
65
- namespace: string;
66
- name: string;
67
- version: string;
68
- qualifiers: Record<string, string>;
69
- subpath: string;
70
- }
71
- //#endregion
72
- export { ParsedPURL as a, URLBuilder as c, Package as i, Version as l, Dependency as n, RateLimiter as o, Maintainer as r, Scope as s, ClientOptions as t, VersionStatus as u };
73
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/core/types.ts"],"mappings":";;UACiB,OAAA;EACf,IAAA;EACA,WAAA;EACA,QAAA;EACA,aAAA;EACA,UAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EACA,aAAA;EACA,QAAA,EAAU,MAAA;AAAA;;UAIK,OAAA;EACf,MAAA;EACA,WAAA,EAAa,IAAA;EACb,QAAA;EACA,SAAA;EACA,MAAA,EAAQ,aAAA;EACR,QAAA,EAAU,MAAA;AAAA;;UAIK,UAAA;EACf,IAAA;EACA,YAAA;EACA,KAAA,EAAO,KAAA;EACP,QAAA;AAAA;;UAIe,UAAA;EACf,IAAA;EACA,KAAA;EACA,IAAA;EACA,KAAA;EACA,GAAA;EACA,IAAA;AAAA;AAAA,KAGU,aAAA;AAAA,KACA,KAAA;;UAGK,UAAA;EACf,QAAA,CAAS,IAAA,UAAc,OAAA;EACvB,QAAA,CAAS,IAAA,UAAc,OAAA;EACvB,aAAA,CAAc,IAAA,UAAc,OAAA;EAC5B,MAAA,CAAO,IAAA,UAAc,OAAA;EACrB,IAAA,CAAK,IAAA,UAAc,OAAA;AAAA;AAlBrB;AAAA,UAsBiB,aAAA;EACf,UAAA;EACA,SAAA;EACA,OAAA;EACA,WAAA,GAAc,WAAA;EACd,SAAA;AAAA;;UAIe,WAAA;EACf,IAAA,CAAK,MAAA,GAAS,WAAA,GAAc,OAAA;AAAA;AAvB9B;AAAA,UA2BiB,UAAA;EACf,IAAA;EACA,SAAA;EACA,IAAA;EACA,OAAA;EACA,UAAA,EAAY,MAAA;EACZ,OAAA;AAAA"}