@vercel/python-analysis 0.1.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 (54) hide show
  1. package/LICENSE +202 -0
  2. package/dist/index.d.ts +22 -0
  3. package/dist/index.js +107 -0
  4. package/dist/manifest/package.d.ts +166 -0
  5. package/dist/manifest/package.js +422 -0
  6. package/dist/manifest/pep440.d.ts +6 -0
  7. package/dist/manifest/pep440.js +63 -0
  8. package/dist/manifest/pep508.d.ts +64 -0
  9. package/dist/manifest/pep508.js +70 -0
  10. package/dist/manifest/pipfile/schema.d.ts +40 -0
  11. package/dist/manifest/pipfile/schema.js +44 -0
  12. package/dist/manifest/pipfile/schema.zod.d.ts +606 -0
  13. package/dist/manifest/pipfile/schema.zod.js +97 -0
  14. package/dist/manifest/pipfile/types.d.ts +77 -0
  15. package/dist/manifest/pipfile/types.js +16 -0
  16. package/dist/manifest/pipfile-parser.d.ts +35 -0
  17. package/dist/manifest/pipfile-parser.js +262 -0
  18. package/dist/manifest/pyproject/schema.d.ts +50 -0
  19. package/dist/manifest/pyproject/schema.js +56 -0
  20. package/dist/manifest/pyproject/schema.zod.d.ts +767 -0
  21. package/dist/manifest/pyproject/schema.zod.js +94 -0
  22. package/dist/manifest/pyproject/types.d.ts +93 -0
  23. package/dist/manifest/pyproject/types.js +16 -0
  24. package/dist/manifest/python-selector.d.ts +123 -0
  25. package/dist/manifest/python-selector.js +185 -0
  26. package/dist/manifest/python-specifiers.d.ts +76 -0
  27. package/dist/manifest/python-specifiers.js +156 -0
  28. package/dist/manifest/requirement/schema.d.ts +28 -0
  29. package/dist/manifest/requirement/schema.js +35 -0
  30. package/dist/manifest/requirement/schema.zod.d.ts +76 -0
  31. package/dist/manifest/requirement/schema.zod.js +49 -0
  32. package/dist/manifest/requirement/types.d.ts +50 -0
  33. package/dist/manifest/requirement/types.js +16 -0
  34. package/dist/manifest/requirements-txt-parser.d.ts +55 -0
  35. package/dist/manifest/requirements-txt-parser.js +400 -0
  36. package/dist/manifest/uv-config/schema.d.ts +22 -0
  37. package/dist/manifest/uv-config/schema.js +35 -0
  38. package/dist/manifest/uv-config/schema.zod.d.ts +140 -0
  39. package/dist/manifest/uv-config/schema.zod.js +48 -0
  40. package/dist/manifest/uv-config/types.d.ts +48 -0
  41. package/dist/manifest/uv-config/types.js +16 -0
  42. package/dist/manifest/uv-python-version-parser.d.ts +28 -0
  43. package/dist/manifest/uv-python-version-parser.js +268 -0
  44. package/dist/types.d.ts +17 -0
  45. package/dist/types.js +16 -0
  46. package/dist/util/config.d.ts +20 -0
  47. package/dist/util/config.js +100 -0
  48. package/dist/util/error.d.ts +39 -0
  49. package/dist/util/error.js +54 -0
  50. package/dist/util/fs.d.ts +25 -0
  51. package/dist/util/fs.js +75 -0
  52. package/dist/util/type.d.ts +7 -0
  53. package/dist/util/type.js +30 -0
  54. package/package.json +43 -0
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var requirements_txt_parser_exports = {};
20
+ __export(requirements_txt_parser_exports, {
21
+ convertRequirementsToPyprojectToml: () => convertRequirementsToPyprojectToml,
22
+ parseRequirementsFile: () => parseRequirementsFile
23
+ });
24
+ module.exports = __toCommonJS(requirements_txt_parser_exports);
25
+ var import_node_path = require("node:path");
26
+ var import_pip_requirements_js = require("pip-requirements-js");
27
+ var import_pep508 = require("./pep508");
28
+ const PRIMARY_INDEX_NAME = "primary";
29
+ const EXTRA_INDEX_PREFIX = "extra-";
30
+ function parseGitUrl(url) {
31
+ if (!url.startsWith("git+")) {
32
+ return null;
33
+ }
34
+ let remaining = url.slice(4);
35
+ let egg;
36
+ const fragmentIdx = remaining.indexOf("#");
37
+ if (fragmentIdx !== -1) {
38
+ const fragment = remaining.slice(fragmentIdx + 1);
39
+ remaining = remaining.slice(0, fragmentIdx);
40
+ for (const part of fragment.split("&")) {
41
+ const [key, value] = part.split("=");
42
+ if (key === "egg" && value) {
43
+ egg = value;
44
+ }
45
+ }
46
+ }
47
+ let ref;
48
+ const lastSlashIdx = remaining.lastIndexOf("/");
49
+ const atIdx = remaining.indexOf("@", lastSlashIdx > 0 ? lastSlashIdx : 0);
50
+ if (atIdx !== -1 && atIdx > remaining.indexOf("://")) {
51
+ ref = remaining.slice(atIdx + 1);
52
+ remaining = remaining.slice(0, atIdx);
53
+ }
54
+ return {
55
+ url: remaining,
56
+ ref,
57
+ egg
58
+ };
59
+ }
60
+ function isGitUrl(url) {
61
+ return url.startsWith("git+");
62
+ }
63
+ function extractPipArguments(fileContent) {
64
+ const options = {
65
+ requirementFiles: [],
66
+ constraintFiles: [],
67
+ extraIndexUrls: []
68
+ };
69
+ const lines = fileContent.split(/\r?\n/);
70
+ const cleanedLines = [];
71
+ for (let i = 0; i < lines.length; i++) {
72
+ const line = lines[i];
73
+ const trimmed = line.trim();
74
+ if (trimmed === "" || trimmed.startsWith("#")) {
75
+ cleanedLines.push(line);
76
+ continue;
77
+ }
78
+ let fullLine = trimmed;
79
+ let linesConsumed = 0;
80
+ while (fullLine.endsWith("\\") && i + linesConsumed + 1 < lines.length) {
81
+ linesConsumed++;
82
+ fullLine = fullLine.slice(0, -1) + lines[i + linesConsumed].trim();
83
+ }
84
+ const extracted = tryExtractPipArgument(fullLine, options);
85
+ if (extracted) {
86
+ i += linesConsumed;
87
+ } else {
88
+ const strippedLine = stripInlineHashes(fullLine);
89
+ if (strippedLine !== fullLine) {
90
+ cleanedLines.push(strippedLine);
91
+ } else {
92
+ cleanedLines.push(line);
93
+ for (let j = 1; j <= linesConsumed; j++) {
94
+ cleanedLines.push(lines[i + j]);
95
+ }
96
+ }
97
+ i += linesConsumed;
98
+ }
99
+ }
100
+ return {
101
+ cleanedContent: cleanedLines.join("\n"),
102
+ options
103
+ };
104
+ }
105
+ function tryExtractPipArgument(line, options) {
106
+ if (line.startsWith("--requirement")) {
107
+ const path = extractArgValue(line, "--requirement");
108
+ if (path) {
109
+ options.requirementFiles.push(path);
110
+ return true;
111
+ }
112
+ }
113
+ if (line.startsWith("--constraint")) {
114
+ const path = extractArgValue(line, "--constraint");
115
+ if (path) {
116
+ options.constraintFiles.push(path);
117
+ return true;
118
+ }
119
+ }
120
+ if (line.startsWith("--index-url")) {
121
+ const url = extractArgValue(line, "--index-url");
122
+ if (url) {
123
+ options.indexUrl = url;
124
+ return true;
125
+ }
126
+ }
127
+ if (line.startsWith("-i ") || line === "-i") {
128
+ const match = line.match(/^-i\s+(\S+)/);
129
+ if (match) {
130
+ options.indexUrl = match[1];
131
+ return true;
132
+ }
133
+ }
134
+ if (line.startsWith("--extra-index-url")) {
135
+ const url = extractArgValue(line, "--extra-index-url");
136
+ if (url) {
137
+ options.extraIndexUrls.push(url);
138
+ return true;
139
+ }
140
+ }
141
+ return false;
142
+ }
143
+ function stripInlineHashes(line) {
144
+ return line.replace(/\s+--hash=\S+/g, "").trim();
145
+ }
146
+ function extractInlineHashes(line) {
147
+ const hashes = [];
148
+ const hashRegex = /--hash=(\S+)/g;
149
+ let match;
150
+ while ((match = hashRegex.exec(line)) != null) {
151
+ hashes.push(match[1]);
152
+ }
153
+ return hashes;
154
+ }
155
+ function extractArgValue(line, option) {
156
+ if (line.startsWith(`${option}=`)) {
157
+ const value = line.slice(option.length + 1).trim();
158
+ return value || null;
159
+ }
160
+ if (line.startsWith(`${option} `) || line.startsWith(`${option} `)) {
161
+ const value = line.slice(option.length).trim();
162
+ return value || null;
163
+ }
164
+ return null;
165
+ }
166
+ function convertRequirementsToPyprojectToml(fileContent, readFile) {
167
+ const pyproject = {};
168
+ const parsed = parseRequirementsFile(fileContent, readFile);
169
+ const deps = [];
170
+ const sources = {};
171
+ for (const req of parsed.requirements) {
172
+ deps.push((0, import_pep508.formatPep508)(req));
173
+ if (req.source) {
174
+ if (Object.prototype.hasOwnProperty.call(sources, req.name)) {
175
+ sources[req.name].push(req.source);
176
+ } else {
177
+ sources[req.name] = [req.source];
178
+ }
179
+ }
180
+ }
181
+ if (deps.length > 0) {
182
+ pyproject.project = {
183
+ dependencies: deps
184
+ };
185
+ }
186
+ const uv = {};
187
+ const indexes = buildIndexEntries(parsed.pipOptions);
188
+ if (indexes.length > 0) {
189
+ uv.index = indexes;
190
+ }
191
+ if (Object.keys(sources).length > 0) {
192
+ uv.sources = sources;
193
+ }
194
+ if (Object.keys(uv).length > 0) {
195
+ pyproject.tool = { uv };
196
+ }
197
+ return pyproject;
198
+ }
199
+ function buildIndexEntries(pipOptions) {
200
+ const indexes = [];
201
+ if (pipOptions.indexUrl) {
202
+ indexes.push({
203
+ name: PRIMARY_INDEX_NAME,
204
+ url: pipOptions.indexUrl,
205
+ default: true
206
+ });
207
+ }
208
+ for (let i = 0; i < pipOptions.extraIndexUrls.length; i++) {
209
+ indexes.push({
210
+ name: `${EXTRA_INDEX_PREFIX}${i + 1}`,
211
+ url: pipOptions.extraIndexUrls[i]
212
+ });
213
+ }
214
+ return indexes;
215
+ }
216
+ function parseRequirementsFile(fileContent, readFile) {
217
+ const visited = /* @__PURE__ */ new Set();
218
+ return parseRequirementsFileInternal(fileContent, readFile, visited);
219
+ }
220
+ function parseRequirementsFileInternal(fileContent, readFile, visited) {
221
+ const { cleanedContent, options } = extractPipArguments(fileContent);
222
+ const hashMap = buildHashMap(fileContent);
223
+ const requirements = (0, import_pip_requirements_js.parsePipRequirementsFile)(cleanedContent);
224
+ const normalized = [];
225
+ const mergedOptions = {
226
+ requirementFiles: [...options.requirementFiles],
227
+ constraintFiles: [...options.constraintFiles],
228
+ indexUrl: options.indexUrl,
229
+ extraIndexUrls: [...options.extraIndexUrls]
230
+ };
231
+ for (const req of requirements) {
232
+ if (req.type === "RequirementsFile") {
233
+ mergedOptions.requirementFiles.push(req.path);
234
+ continue;
235
+ }
236
+ if (req.type === "ConstraintsFile") {
237
+ mergedOptions.constraintFiles.push(req.path);
238
+ continue;
239
+ }
240
+ const norm = normalizeRequirement(req);
241
+ if (norm != null) {
242
+ const hashes = hashMap.get(norm.name.toLowerCase());
243
+ if (hashes && hashes.length > 0) {
244
+ norm.hashes = hashes;
245
+ }
246
+ normalized.push(norm);
247
+ }
248
+ }
249
+ if (readFile) {
250
+ for (const refPath of mergedOptions.requirementFiles) {
251
+ const refPathKey = (0, import_node_path.normalize)(refPath);
252
+ if (visited.has(refPathKey)) {
253
+ continue;
254
+ }
255
+ visited.add(refPathKey);
256
+ const refContent = readFile(refPath);
257
+ if (refContent != null) {
258
+ const refParsed = parseRequirementsFileInternal(
259
+ refContent,
260
+ readFile,
261
+ visited
262
+ );
263
+ const existingNames = new Set(
264
+ normalized.map((r) => r.name.toLowerCase())
265
+ );
266
+ for (const req of refParsed.requirements) {
267
+ if (!existingNames.has(req.name.toLowerCase())) {
268
+ normalized.push(req);
269
+ existingNames.add(req.name.toLowerCase());
270
+ }
271
+ }
272
+ if (refParsed.pipOptions.indexUrl) {
273
+ mergedOptions.indexUrl = refParsed.pipOptions.indexUrl;
274
+ }
275
+ for (const url of refParsed.pipOptions.extraIndexUrls) {
276
+ if (!mergedOptions.extraIndexUrls.includes(url)) {
277
+ mergedOptions.extraIndexUrls.push(url);
278
+ }
279
+ }
280
+ for (const constraintPath of refParsed.pipOptions.constraintFiles) {
281
+ if (!mergedOptions.constraintFiles.includes(constraintPath)) {
282
+ mergedOptions.constraintFiles.push(constraintPath);
283
+ }
284
+ }
285
+ }
286
+ }
287
+ }
288
+ return {
289
+ requirements: normalized,
290
+ pipOptions: mergedOptions
291
+ };
292
+ }
293
+ function buildHashMap(fileContent) {
294
+ const hashMap = /* @__PURE__ */ new Map();
295
+ const lines = fileContent.split(/\r?\n/);
296
+ for (let i = 0; i < lines.length; i++) {
297
+ let line = lines[i].trim();
298
+ if (line === "" || line.startsWith("#") || line.startsWith("-")) {
299
+ continue;
300
+ }
301
+ while (line.endsWith("\\") && i + 1 < lines.length) {
302
+ i++;
303
+ line = line.slice(0, -1) + lines[i].trim();
304
+ }
305
+ const hashes = extractInlineHashes(line);
306
+ if (hashes.length === 0) {
307
+ continue;
308
+ }
309
+ const packageMatch = line.match(/^([a-zA-Z0-9][-a-zA-Z0-9._]*)/);
310
+ if (packageMatch) {
311
+ const packageName = packageMatch[1].toLowerCase();
312
+ hashMap.set(packageName, hashes);
313
+ }
314
+ }
315
+ return hashMap;
316
+ }
317
+ function normalizeRequirement(req) {
318
+ if (req.type === "RequirementsFile" || req.type === "ConstraintsFile") {
319
+ return null;
320
+ }
321
+ if (req.type === "ProjectURL") {
322
+ return normalizeProjectURLRequirement(req);
323
+ }
324
+ if (req.type === "ProjectName") {
325
+ return normalizeProjectNameRequirement(req);
326
+ }
327
+ return null;
328
+ }
329
+ function normalizeProjectNameRequirement(req) {
330
+ const normalized = {
331
+ name: req.name
332
+ };
333
+ if (req.extras && req.extras.length > 0) {
334
+ normalized.extras = req.extras;
335
+ }
336
+ if (req.versionSpec && req.versionSpec.length > 0) {
337
+ normalized.version = req.versionSpec.map((spec) => `${spec.operator}${spec.version}`).join(",");
338
+ }
339
+ if (req.environmentMarkerTree) {
340
+ normalized.markers = formatEnvironmentMarkers(req.environmentMarkerTree);
341
+ }
342
+ return normalized;
343
+ }
344
+ function normalizeProjectURLRequirement(req) {
345
+ const normalized = {
346
+ name: req.name
347
+ };
348
+ if (req.extras && req.extras.length > 0) {
349
+ normalized.extras = req.extras;
350
+ }
351
+ if (req.environmentMarkerTree) {
352
+ normalized.markers = formatEnvironmentMarkers(req.environmentMarkerTree);
353
+ }
354
+ if (isGitUrl(req.url)) {
355
+ const parsed = parseGitUrl(req.url);
356
+ if (parsed) {
357
+ const source = {
358
+ git: parsed.url
359
+ };
360
+ if (parsed.ref) {
361
+ source.rev = parsed.ref;
362
+ }
363
+ if (parsed.editable) {
364
+ source.editable = true;
365
+ }
366
+ normalized.source = source;
367
+ }
368
+ }
369
+ normalized.url = req.url;
370
+ return normalized;
371
+ }
372
+ function formatEnvironmentMarkers(marker) {
373
+ if (isEnvironmentMarkerNode(marker)) {
374
+ const left = formatEnvironmentMarkers(marker.left);
375
+ const right = formatEnvironmentMarkers(marker.right);
376
+ return `(${left}) ${marker.operator} (${right})`;
377
+ }
378
+ const leaf = marker;
379
+ const leftStr = formatMarkerValue(leaf.left);
380
+ const rightStr = formatMarkerValue(leaf.right);
381
+ return `${leftStr} ${leaf.operator} ${rightStr}`;
382
+ }
383
+ function isEnvironmentMarkerNode(marker) {
384
+ if (typeof marker !== "object" || marker == null) {
385
+ return false;
386
+ }
387
+ const op = marker.operator;
388
+ return op === "and" || op === "or";
389
+ }
390
+ function formatMarkerValue(value) {
391
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
392
+ return value;
393
+ }
394
+ return value;
395
+ }
396
+ // Annotate the CommonJS export names for ESM import in node:
397
+ 0 && (module.exports = {
398
+ convertRequirementsToPyprojectToml,
399
+ parseRequirementsFile
400
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Zod schemas for uv configuration types.
3
+ *
4
+ * Types are defined in types.ts (source of truth).
5
+ * Schemas are generated by ts-to-zod and re-exported here with proper typing.
6
+ *
7
+ * @module uv-config/schema
8
+ */
9
+ import type { z } from 'zod';
10
+ import type { UvConfig, UvConfigWorkspace, UvIndexEntry } from './types';
11
+ /**
12
+ * Schema for uv workspace configuration.
13
+ */
14
+ export declare const UvConfigWorkspaceSchema: z.ZodType<UvConfigWorkspace, z.ZodTypeDef, UvConfigWorkspace>;
15
+ /**
16
+ * Schema for uv index entry configuration.
17
+ */
18
+ export declare const UvIndexEntrySchema: z.ZodType<UvIndexEntry, z.ZodTypeDef, UvIndexEntry>;
19
+ /**
20
+ * Schema for [tool.uv] section in pyproject.toml or uv.toml.
21
+ */
22
+ export declare const UvConfigSchema: z.ZodType<UvConfig, z.ZodTypeDef, UvConfig>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var schema_exports = {};
20
+ __export(schema_exports, {
21
+ UvConfigSchema: () => UvConfigSchema,
22
+ UvConfigWorkspaceSchema: () => UvConfigWorkspaceSchema,
23
+ UvIndexEntrySchema: () => UvIndexEntrySchema
24
+ });
25
+ module.exports = __toCommonJS(schema_exports);
26
+ var import_schema = require("./schema.zod");
27
+ const UvConfigWorkspaceSchema = import_schema.uvConfigWorkspaceSchema.passthrough();
28
+ const UvIndexEntrySchema = import_schema.uvIndexEntrySchema.passthrough();
29
+ const UvConfigSchema = import_schema.uvConfigSchema.passthrough();
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ UvConfigSchema,
33
+ UvConfigWorkspaceSchema,
34
+ UvIndexEntrySchema
35
+ });
@@ -0,0 +1,140 @@
1
+ import { z } from 'zod';
2
+ export declare const uvConfigWorkspaceSchema: z.ZodObject<{
3
+ members: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ members?: string[] | undefined;
7
+ exclude?: string[] | undefined;
8
+ }, {
9
+ members?: string[] | undefined;
10
+ exclude?: string[] | undefined;
11
+ }>;
12
+ export declare const uvIndexEntrySchema: z.ZodObject<{
13
+ name: z.ZodString;
14
+ url: z.ZodString;
15
+ default: z.ZodOptional<z.ZodBoolean>;
16
+ explicit: z.ZodOptional<z.ZodBoolean>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ name: string;
19
+ url: string;
20
+ default?: boolean | undefined;
21
+ explicit?: boolean | undefined;
22
+ }, {
23
+ name: string;
24
+ url: string;
25
+ default?: boolean | undefined;
26
+ explicit?: boolean | undefined;
27
+ }>;
28
+ export declare const uvConfigSchema: z.ZodObject<{
29
+ sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
30
+ index: z.ZodOptional<z.ZodString>;
31
+ git: z.ZodOptional<z.ZodString>;
32
+ rev: z.ZodOptional<z.ZodString>;
33
+ path: z.ZodOptional<z.ZodString>;
34
+ editable: z.ZodOptional<z.ZodBoolean>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ index?: string | undefined;
37
+ git?: string | undefined;
38
+ rev?: string | undefined;
39
+ path?: string | undefined;
40
+ editable?: boolean | undefined;
41
+ }, {
42
+ index?: string | undefined;
43
+ git?: string | undefined;
44
+ rev?: string | undefined;
45
+ path?: string | undefined;
46
+ editable?: boolean | undefined;
47
+ }>, z.ZodArray<z.ZodObject<{
48
+ index: z.ZodOptional<z.ZodString>;
49
+ git: z.ZodOptional<z.ZodString>;
50
+ rev: z.ZodOptional<z.ZodString>;
51
+ path: z.ZodOptional<z.ZodString>;
52
+ editable: z.ZodOptional<z.ZodBoolean>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ index?: string | undefined;
55
+ git?: string | undefined;
56
+ rev?: string | undefined;
57
+ path?: string | undefined;
58
+ editable?: boolean | undefined;
59
+ }, {
60
+ index?: string | undefined;
61
+ git?: string | undefined;
62
+ rev?: string | undefined;
63
+ path?: string | undefined;
64
+ editable?: boolean | undefined;
65
+ }>, "many">]>>>;
66
+ index: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
+ name: z.ZodString;
68
+ url: z.ZodString;
69
+ default: z.ZodOptional<z.ZodBoolean>;
70
+ explicit: z.ZodOptional<z.ZodBoolean>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ name: string;
73
+ url: string;
74
+ default?: boolean | undefined;
75
+ explicit?: boolean | undefined;
76
+ }, {
77
+ name: string;
78
+ url: string;
79
+ default?: boolean | undefined;
80
+ explicit?: boolean | undefined;
81
+ }>, "many">>;
82
+ workspace: z.ZodOptional<z.ZodObject<{
83
+ members: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
84
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ members?: string[] | undefined;
87
+ exclude?: string[] | undefined;
88
+ }, {
89
+ members?: string[] | undefined;
90
+ exclude?: string[] | undefined;
91
+ }>>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ sources?: Record<string, {
94
+ index?: string | undefined;
95
+ git?: string | undefined;
96
+ rev?: string | undefined;
97
+ path?: string | undefined;
98
+ editable?: boolean | undefined;
99
+ } | {
100
+ index?: string | undefined;
101
+ git?: string | undefined;
102
+ rev?: string | undefined;
103
+ path?: string | undefined;
104
+ editable?: boolean | undefined;
105
+ }[]> | undefined;
106
+ index?: {
107
+ name: string;
108
+ url: string;
109
+ default?: boolean | undefined;
110
+ explicit?: boolean | undefined;
111
+ }[] | undefined;
112
+ workspace?: {
113
+ members?: string[] | undefined;
114
+ exclude?: string[] | undefined;
115
+ } | undefined;
116
+ }, {
117
+ sources?: Record<string, {
118
+ index?: string | undefined;
119
+ git?: string | undefined;
120
+ rev?: string | undefined;
121
+ path?: string | undefined;
122
+ editable?: boolean | undefined;
123
+ } | {
124
+ index?: string | undefined;
125
+ git?: string | undefined;
126
+ rev?: string | undefined;
127
+ path?: string | undefined;
128
+ editable?: boolean | undefined;
129
+ }[]> | undefined;
130
+ index?: {
131
+ name: string;
132
+ url: string;
133
+ default?: boolean | undefined;
134
+ explicit?: boolean | undefined;
135
+ }[] | undefined;
136
+ workspace?: {
137
+ members?: string[] | undefined;
138
+ exclude?: string[] | undefined;
139
+ } | undefined;
140
+ }>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var schema_zod_exports = {};
20
+ __export(schema_zod_exports, {
21
+ uvConfigSchema: () => uvConfigSchema,
22
+ uvConfigWorkspaceSchema: () => uvConfigWorkspaceSchema,
23
+ uvIndexEntrySchema: () => uvIndexEntrySchema
24
+ });
25
+ module.exports = __toCommonJS(schema_zod_exports);
26
+ var import_zod = require("zod");
27
+ var import_schema = require("./../requirement/schema.zod");
28
+ const uvConfigWorkspaceSchema = import_zod.z.object({
29
+ members: import_zod.z.array(import_zod.z.string()).optional(),
30
+ exclude: import_zod.z.array(import_zod.z.string()).optional()
31
+ });
32
+ const uvIndexEntrySchema = import_zod.z.object({
33
+ name: import_zod.z.string(),
34
+ url: import_zod.z.string(),
35
+ default: import_zod.z.boolean().optional(),
36
+ explicit: import_zod.z.boolean().optional()
37
+ });
38
+ const uvConfigSchema = import_zod.z.object({
39
+ sources: import_zod.z.record(import_zod.z.union([import_schema.dependencySourceSchema, import_zod.z.array(import_schema.dependencySourceSchema)])).optional(),
40
+ index: import_zod.z.array(uvIndexEntrySchema).optional(),
41
+ workspace: uvConfigWorkspaceSchema.optional()
42
+ });
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ uvConfigSchema,
46
+ uvConfigWorkspaceSchema,
47
+ uvIndexEntrySchema
48
+ });
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Pure TypeScript interface definitions for uv configuration types.
3
+ *
4
+ * These interfaces serve as the source of truth for types.
5
+ * Zod schemas are generated from these using ts-to-zod.
6
+ *
7
+ * @module uv-config/types
8
+ */
9
+ import type { DependencySource } from '../requirement/types';
10
+ /**
11
+ * uv workspace configuration.
12
+ * @passthrough
13
+ */
14
+ export interface UvConfigWorkspace {
15
+ members?: string[];
16
+ exclude?: string[];
17
+ }
18
+ /**
19
+ * uv index entry configuration.
20
+ * @passthrough
21
+ */
22
+ export interface UvIndexEntry {
23
+ name: string;
24
+ url: string;
25
+ /** Mark this index as the default (replaces PyPI) */
26
+ default?: boolean;
27
+ /** Mark this index as explicit (must be explicitly referenced per-package) */
28
+ explicit?: boolean;
29
+ }
30
+ /**
31
+ * [tool.uv] section in pyproject.toml or uv.toml.
32
+ * @passthrough
33
+ */
34
+ export interface UvConfig {
35
+ /**
36
+ * Dependency sources mapping package names to their source configurations.
37
+ * Used for git, path, and custom index sources.
38
+ */
39
+ sources?: Record<string, DependencySource | DependencySource[]>;
40
+ /**
41
+ * Custom package indexes.
42
+ */
43
+ index?: UvIndexEntry[];
44
+ /**
45
+ * Workspace configuration.
46
+ */
47
+ workspace?: UvConfigWorkspace;
48
+ }