@vercel/python-analysis 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +76 -12
- package/dist/index.d.ts +4 -3
- package/dist/index.js +73 -11
- package/dist/manifest/package.d.ts +2 -0
- package/dist/manifest/pep508.d.ts +19 -0
- package/dist/manifest/pyproject/schema.zod.d.ts +46 -4
- package/dist/manifest/pyproject/types.d.ts +12 -2
- package/dist/manifest/python-specifiers.d.ts +2 -0
- package/dist/manifest/uv-config/schema.zod.d.ts +3 -0
- package/dist/manifest/uv-config/types.d.ts +5 -0
- package/dist/manifest/uv-lock-parser.d.ts +4 -0
- package/dist/manifest/wheel-compat.d.ts +15 -1
- package/dist/semantic/entrypoints.d.ts +7 -6
- package/dist/wasm/vercel_python_analysis.core.wasm +0 -0
- package/dist/wasm/vercel_python_analysis.d.ts +3 -1
- package/dist/wasm/vercel_python_analysis.js +320 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,15 +63,17 @@ __export(src_exports, {
|
|
|
63
63
|
UvConfigWorkspaceSchema: () => UvConfigWorkspaceSchema,
|
|
64
64
|
UvIndexEntrySchema: () => UvIndexEntrySchema,
|
|
65
65
|
classifyPackages: () => classifyPackages,
|
|
66
|
-
containsAppOrHandler: () => containsAppOrHandler,
|
|
67
66
|
containsTopLevelCallable: () => containsTopLevelCallable,
|
|
68
67
|
createMinimalManifest: () => createMinimalManifest,
|
|
69
68
|
discoverPythonPackage: () => discoverPythonPackage,
|
|
69
|
+
evaluateMarker: () => evaluateMarker,
|
|
70
70
|
extendDistRecord: () => extendDistRecord,
|
|
71
|
+
findAppOrHandler: () => findAppOrHandler,
|
|
71
72
|
getStringConstant: () => getStringConstant,
|
|
72
73
|
isPrivatePackageSource: () => isPrivatePackageSource,
|
|
73
74
|
isWheelCompatible: () => isWheelCompatible,
|
|
74
75
|
normalizePackageName: () => normalizePackageName2,
|
|
76
|
+
parsePep508: () => parsePep508,
|
|
75
77
|
parseUvLock: () => parseUvLock,
|
|
76
78
|
scanDistributions: () => scanDistributions,
|
|
77
79
|
selectPython: () => selectPython,
|
|
@@ -202,12 +204,12 @@ async function importWasmModule() {
|
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
// src/semantic/entrypoints.ts
|
|
205
|
-
async function
|
|
207
|
+
async function findAppOrHandler(source) {
|
|
206
208
|
if (!source.includes("app") && !source.includes("application") && !source.includes("handler") && !source.includes("Handler")) {
|
|
207
|
-
return
|
|
209
|
+
return null;
|
|
208
210
|
}
|
|
209
211
|
const mod = await importWasmModule();
|
|
210
|
-
return mod.
|
|
212
|
+
return mod.findAppOrHandler(source) ?? null;
|
|
211
213
|
}
|
|
212
214
|
async function containsTopLevelCallable(source, name) {
|
|
213
215
|
if (!source.includes(name)) {
|
|
@@ -265,6 +267,41 @@ function mergeExtras(existing, additional) {
|
|
|
265
267
|
}
|
|
266
268
|
return result.size > 0 ? Array.from(result) : void 0;
|
|
267
269
|
}
|
|
270
|
+
function wasmEntryToRequirement(entry) {
|
|
271
|
+
const req = {
|
|
272
|
+
name: entry.name || ""
|
|
273
|
+
};
|
|
274
|
+
if (entry.versionSpec) {
|
|
275
|
+
req.version = entry.versionSpec;
|
|
276
|
+
}
|
|
277
|
+
if (entry.extras.length > 0) {
|
|
278
|
+
req.extras = entry.extras;
|
|
279
|
+
}
|
|
280
|
+
if (entry.markers) {
|
|
281
|
+
req.markers = entry.markers;
|
|
282
|
+
}
|
|
283
|
+
if (entry.url) {
|
|
284
|
+
req.url = entry.url;
|
|
285
|
+
}
|
|
286
|
+
return req;
|
|
287
|
+
}
|
|
288
|
+
async function parsePep508(depOrDeps) {
|
|
289
|
+
const wasm = await importWasmModule();
|
|
290
|
+
if (Array.isArray(depOrDeps)) {
|
|
291
|
+
return depOrDeps.map((dep) => {
|
|
292
|
+
try {
|
|
293
|
+
return wasmEntryToRequirement(wasm.parsePep508(dep));
|
|
294
|
+
} catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
return wasmEntryToRequirement(wasm.parsePep508(depOrDeps));
|
|
301
|
+
} catch {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
268
305
|
|
|
269
306
|
// src/manifest/dist-metadata.ts
|
|
270
307
|
async function readDistInfoFile(distInfoDir, filename) {
|
|
@@ -919,7 +956,8 @@ var uvIndexEntrySchema = import_zod3.z.object({
|
|
|
919
956
|
var uvConfigSchema = import_zod3.z.object({
|
|
920
957
|
sources: import_zod3.z.record(import_zod3.z.union([dependencySourceSchema, import_zod3.z.array(dependencySourceSchema)])).optional(),
|
|
921
958
|
index: import_zod3.z.array(uvIndexEntrySchema).optional(),
|
|
922
|
-
workspace: uvConfigWorkspaceSchema.optional()
|
|
959
|
+
workspace: uvConfigWorkspaceSchema.optional(),
|
|
960
|
+
"dev-dependencies": import_zod3.z.array(import_zod3.z.string()).optional()
|
|
923
961
|
});
|
|
924
962
|
|
|
925
963
|
// src/manifest/pyproject/schema.zod.ts
|
|
@@ -960,7 +998,16 @@ var pyProjectProjectSchema = import_zod4.z.object({
|
|
|
960
998
|
scripts: import_zod4.z.record(import_zod4.z.string()).optional(),
|
|
961
999
|
entry_points: import_zod4.z.record(import_zod4.z.record(import_zod4.z.string())).optional()
|
|
962
1000
|
});
|
|
963
|
-
var
|
|
1001
|
+
var dependencyGroupIncludeSchema = import_zod4.z.object({
|
|
1002
|
+
"include-group": import_zod4.z.string()
|
|
1003
|
+
});
|
|
1004
|
+
var dependencyGroupEntrySchema = import_zod4.z.union([
|
|
1005
|
+
import_zod4.z.string(),
|
|
1006
|
+
dependencyGroupIncludeSchema
|
|
1007
|
+
]);
|
|
1008
|
+
var pyProjectDependencyGroupsSchema = import_zod4.z.record(
|
|
1009
|
+
import_zod4.z.array(dependencyGroupEntrySchema)
|
|
1010
|
+
);
|
|
964
1011
|
var pyProjectToolSectionSchema = import_zod4.z.object({
|
|
965
1012
|
uv: uvConfigSchema.optional()
|
|
966
1013
|
});
|
|
@@ -1627,7 +1674,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1627
1674
|
constraints.push({
|
|
1628
1675
|
request: pythonVersionConfig.data,
|
|
1629
1676
|
source: pythonVersionConfig.path,
|
|
1630
|
-
prettySource: pythonVersionConfig.path
|
|
1677
|
+
prettySource: pythonVersionConfig.path,
|
|
1678
|
+
specifier: pythonVersionConfig.specifier
|
|
1631
1679
|
});
|
|
1632
1680
|
hasPythonVersionFile = true;
|
|
1633
1681
|
break;
|
|
@@ -1642,7 +1690,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1642
1690
|
constraints.push({
|
|
1643
1691
|
request: [request],
|
|
1644
1692
|
source: manifest.path,
|
|
1645
|
-
prettySource: `"requires-python" key in ${manifest.path}
|
|
1693
|
+
prettySource: `"requires-python" key in ${manifest.path}`,
|
|
1694
|
+
specifier: manifestRequiresPython
|
|
1646
1695
|
});
|
|
1647
1696
|
}
|
|
1648
1697
|
} else {
|
|
@@ -1654,7 +1703,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1654
1703
|
constraints.push({
|
|
1655
1704
|
request: [request],
|
|
1656
1705
|
source: workspaceManifest.path,
|
|
1657
|
-
prettySource: `"requires-python" key in ${workspaceManifest.path}
|
|
1706
|
+
prettySource: `"requires-python" key in ${workspaceManifest.path}`,
|
|
1707
|
+
specifier: workspaceRequiresPython
|
|
1658
1708
|
});
|
|
1659
1709
|
}
|
|
1660
1710
|
}
|
|
@@ -1935,7 +1985,8 @@ async function maybeLoadPythonRequest(root, subdir) {
|
|
|
1935
1985
|
return {
|
|
1936
1986
|
kind: ".python-version" /* PythonVersion */,
|
|
1937
1987
|
path: dotPythonVersionRelPath,
|
|
1938
|
-
data: pyreq
|
|
1988
|
+
data: pyreq,
|
|
1989
|
+
specifier: data.trim()
|
|
1939
1990
|
};
|
|
1940
1991
|
}
|
|
1941
1992
|
|
|
@@ -1980,7 +2031,8 @@ function parseUvLock(content, path4) {
|
|
|
1980
2031
|
name: pkg.name,
|
|
1981
2032
|
version: pkg.version,
|
|
1982
2033
|
source: pkg.source,
|
|
1983
|
-
wheels: (pkg.wheels ?? []).map((w) => ({ url: w.url }))
|
|
2034
|
+
wheels: (pkg.wheels ?? []).map((w) => ({ url: w.url })),
|
|
2035
|
+
...pkg.dependencies ? { dependencies: pkg.dependencies } : {}
|
|
1984
2036
|
}));
|
|
1985
2037
|
return { version: parsed.version, packages };
|
|
1986
2038
|
}
|
|
@@ -2049,6 +2101,16 @@ async function isWheelCompatible(wheelFilename, pythonMajor, pythonMinor, osName
|
|
|
2049
2101
|
osMinor
|
|
2050
2102
|
);
|
|
2051
2103
|
}
|
|
2104
|
+
async function evaluateMarker(marker, pythonMajor, pythonMinor, sysPlatform, platformMachine) {
|
|
2105
|
+
const mod = await importWasmModule();
|
|
2106
|
+
return mod.evaluateMarker(
|
|
2107
|
+
marker,
|
|
2108
|
+
pythonMajor,
|
|
2109
|
+
pythonMinor,
|
|
2110
|
+
sysPlatform,
|
|
2111
|
+
platformMachine
|
|
2112
|
+
);
|
|
2113
|
+
}
|
|
2052
2114
|
|
|
2053
2115
|
// src/manifest/python-selector.ts
|
|
2054
2116
|
function selectPython(constraints, available) {
|
|
@@ -2356,15 +2418,17 @@ var HashDigestSchema = hashDigestSchema;
|
|
|
2356
2418
|
UvConfigWorkspaceSchema,
|
|
2357
2419
|
UvIndexEntrySchema,
|
|
2358
2420
|
classifyPackages,
|
|
2359
|
-
containsAppOrHandler,
|
|
2360
2421
|
containsTopLevelCallable,
|
|
2361
2422
|
createMinimalManifest,
|
|
2362
2423
|
discoverPythonPackage,
|
|
2424
|
+
evaluateMarker,
|
|
2363
2425
|
extendDistRecord,
|
|
2426
|
+
findAppOrHandler,
|
|
2364
2427
|
getStringConstant,
|
|
2365
2428
|
isPrivatePackageSource,
|
|
2366
2429
|
isWheelCompatible,
|
|
2367
2430
|
normalizePackageName,
|
|
2431
|
+
parsePep508,
|
|
2368
2432
|
parseUvLock,
|
|
2369
2433
|
scanDistributions,
|
|
2370
2434
|
selectPython,
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @vercel/python-analysis
|
|
8
8
|
*/
|
|
9
|
-
export {
|
|
9
|
+
export { findAppOrHandler, containsTopLevelCallable, getStringConstant, } from './semantic/entrypoints';
|
|
10
10
|
export type { Distribution, DistributionIndex, PackagePath, DirectUrlInfo, } from './manifest/dist-metadata';
|
|
11
11
|
export { extendDistRecord, scanDistributions } from './manifest/dist-metadata';
|
|
12
12
|
export type { PythonConfig, PythonConfigs, PythonLockFile, PythonManifest, PythonManifestOrigin, PythonPackage, PythonVersionConfig, } from './manifest/package';
|
|
@@ -14,16 +14,17 @@ export { discoverPythonPackage, PythonConfigKind, PythonLockFileKind, PythonMani
|
|
|
14
14
|
export { createMinimalManifest, stringifyManifest, type CreateMinimalManifestOptions, } from './manifest/serialize';
|
|
15
15
|
export type { ClassifyPackagesOptions, PackageClassification, UvLockFile, UvLockPackage, UvLockPackageSource, UvLockWheel, } from './manifest/uv-lock-parser';
|
|
16
16
|
export { classifyPackages, isPrivatePackageSource, normalizePackageName, parseUvLock, } from './manifest/uv-lock-parser';
|
|
17
|
-
export { isWheelCompatible } from './manifest/wheel-compat';
|
|
17
|
+
export { evaluateMarker, isWheelCompatible, } from './manifest/wheel-compat';
|
|
18
18
|
export type { PythonSelectionResult, PythonVersionSelectionResult, } from './manifest/python-selector';
|
|
19
19
|
export { selectPython, selectPythonVersion } from './manifest/python-selector';
|
|
20
20
|
export { PythonAnalysisError } from './util/error';
|
|
21
21
|
export { LicenseObjectSchema, LicenseSchema, PersonSchema, PyProjectBuildSystemSchema, PyProjectDependencyGroupsSchema, PyProjectProjectSchema, PyProjectToolSectionSchema, PyProjectTomlSchema, ReadmeObjectSchema, ReadmeSchema, } from './manifest/pyproject/schema';
|
|
22
|
-
export type { License, LicenseObject, Person, PyProjectBuildSystem, PyProjectDependencyGroups, PyProjectProject, PyProjectToml, PyProjectToolSection, Readme, ReadmeObject, } from './manifest/pyproject/types';
|
|
22
|
+
export type { DependencyGroupEntry, DependencyGroupInclude, License, LicenseObject, Person, PyProjectBuildSystem, PyProjectDependencyGroups, PyProjectProject, PyProjectToml, PyProjectToolSection, Readme, ReadmeObject, } from './manifest/pyproject/types';
|
|
23
23
|
export { UvConfigSchema, UvConfigWorkspaceSchema, UvIndexEntrySchema, } from './manifest/uv-config/schema';
|
|
24
24
|
export type { UvConfig, UvConfigWorkspace, UvIndexEntry, } from './manifest/uv-config/types';
|
|
25
25
|
export { PipfileDependencyDetailSchema, PipfileDependencySchema, PipfileLikeSchema, PipfileLockLikeSchema, PipfileLockMetaSchema, PipfileSourceSchema, } from './manifest/pipfile/schema';
|
|
26
26
|
export type { PipfileDependency, PipfileDependencyDetail, PipfileLike, PipfileLockLike, PipfileLockMeta, PipfileSource, } from './manifest/pipfile/types';
|
|
27
27
|
export { DependencySourceSchema, HashDigestSchema, NormalizedRequirementSchema, } from './manifest/requirement/schema';
|
|
28
28
|
export type { DependencySource, HashDigest, NormalizedRequirement, } from './manifest/requirement/types';
|
|
29
|
+
export { parsePep508 } from './manifest/pep508';
|
|
29
30
|
export { PythonBuild, PythonConstraint, PythonImplementation, PythonPlatformRequest, PythonRequest, PythonVariant, PythonVersion, PythonVersionRequest, UnknownPythonImplementation, } from './manifest/python-specifiers';
|
package/dist/index.js
CHANGED
|
@@ -120,12 +120,12 @@ async function importWasmModule() {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// src/semantic/entrypoints.ts
|
|
123
|
-
async function
|
|
123
|
+
async function findAppOrHandler(source) {
|
|
124
124
|
if (!source.includes("app") && !source.includes("application") && !source.includes("handler") && !source.includes("Handler")) {
|
|
125
|
-
return
|
|
125
|
+
return null;
|
|
126
126
|
}
|
|
127
127
|
const mod = await importWasmModule();
|
|
128
|
-
return mod.
|
|
128
|
+
return mod.findAppOrHandler(source) ?? null;
|
|
129
129
|
}
|
|
130
130
|
async function containsTopLevelCallable(source, name) {
|
|
131
131
|
if (!source.includes(name)) {
|
|
@@ -183,6 +183,41 @@ function mergeExtras(existing, additional) {
|
|
|
183
183
|
}
|
|
184
184
|
return result.size > 0 ? Array.from(result) : void 0;
|
|
185
185
|
}
|
|
186
|
+
function wasmEntryToRequirement(entry) {
|
|
187
|
+
const req = {
|
|
188
|
+
name: entry.name || ""
|
|
189
|
+
};
|
|
190
|
+
if (entry.versionSpec) {
|
|
191
|
+
req.version = entry.versionSpec;
|
|
192
|
+
}
|
|
193
|
+
if (entry.extras.length > 0) {
|
|
194
|
+
req.extras = entry.extras;
|
|
195
|
+
}
|
|
196
|
+
if (entry.markers) {
|
|
197
|
+
req.markers = entry.markers;
|
|
198
|
+
}
|
|
199
|
+
if (entry.url) {
|
|
200
|
+
req.url = entry.url;
|
|
201
|
+
}
|
|
202
|
+
return req;
|
|
203
|
+
}
|
|
204
|
+
async function parsePep508(depOrDeps) {
|
|
205
|
+
const wasm = await importWasmModule();
|
|
206
|
+
if (Array.isArray(depOrDeps)) {
|
|
207
|
+
return depOrDeps.map((dep) => {
|
|
208
|
+
try {
|
|
209
|
+
return wasmEntryToRequirement(wasm.parsePep508(dep));
|
|
210
|
+
} catch {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
return wasmEntryToRequirement(wasm.parsePep508(depOrDeps));
|
|
217
|
+
} catch {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
186
221
|
|
|
187
222
|
// src/manifest/dist-metadata.ts
|
|
188
223
|
async function readDistInfoFile(distInfoDir, filename) {
|
|
@@ -840,7 +875,8 @@ var uvIndexEntrySchema = z3.object({
|
|
|
840
875
|
var uvConfigSchema = z3.object({
|
|
841
876
|
sources: z3.record(z3.union([dependencySourceSchema, z3.array(dependencySourceSchema)])).optional(),
|
|
842
877
|
index: z3.array(uvIndexEntrySchema).optional(),
|
|
843
|
-
workspace: uvConfigWorkspaceSchema.optional()
|
|
878
|
+
workspace: uvConfigWorkspaceSchema.optional(),
|
|
879
|
+
"dev-dependencies": z3.array(z3.string()).optional()
|
|
844
880
|
});
|
|
845
881
|
|
|
846
882
|
// src/manifest/pyproject/schema.zod.ts
|
|
@@ -881,7 +917,16 @@ var pyProjectProjectSchema = z4.object({
|
|
|
881
917
|
scripts: z4.record(z4.string()).optional(),
|
|
882
918
|
entry_points: z4.record(z4.record(z4.string())).optional()
|
|
883
919
|
});
|
|
884
|
-
var
|
|
920
|
+
var dependencyGroupIncludeSchema = z4.object({
|
|
921
|
+
"include-group": z4.string()
|
|
922
|
+
});
|
|
923
|
+
var dependencyGroupEntrySchema = z4.union([
|
|
924
|
+
z4.string(),
|
|
925
|
+
dependencyGroupIncludeSchema
|
|
926
|
+
]);
|
|
927
|
+
var pyProjectDependencyGroupsSchema = z4.record(
|
|
928
|
+
z4.array(dependencyGroupEntrySchema)
|
|
929
|
+
);
|
|
885
930
|
var pyProjectToolSectionSchema = z4.object({
|
|
886
931
|
uv: uvConfigSchema.optional()
|
|
887
932
|
});
|
|
@@ -1548,7 +1593,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1548
1593
|
constraints.push({
|
|
1549
1594
|
request: pythonVersionConfig.data,
|
|
1550
1595
|
source: pythonVersionConfig.path,
|
|
1551
|
-
prettySource: pythonVersionConfig.path
|
|
1596
|
+
prettySource: pythonVersionConfig.path,
|
|
1597
|
+
specifier: pythonVersionConfig.specifier
|
|
1552
1598
|
});
|
|
1553
1599
|
hasPythonVersionFile = true;
|
|
1554
1600
|
break;
|
|
@@ -1563,7 +1609,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1563
1609
|
constraints.push({
|
|
1564
1610
|
request: [request],
|
|
1565
1611
|
source: manifest.path,
|
|
1566
|
-
prettySource: `"requires-python" key in ${manifest.path}
|
|
1612
|
+
prettySource: `"requires-python" key in ${manifest.path}`,
|
|
1613
|
+
specifier: manifestRequiresPython
|
|
1567
1614
|
});
|
|
1568
1615
|
}
|
|
1569
1616
|
} else {
|
|
@@ -1575,7 +1622,8 @@ function computeRequiresPython(manifest, workspaceManifest, configs) {
|
|
|
1575
1622
|
constraints.push({
|
|
1576
1623
|
request: [request],
|
|
1577
1624
|
source: workspaceManifest.path,
|
|
1578
|
-
prettySource: `"requires-python" key in ${workspaceManifest.path}
|
|
1625
|
+
prettySource: `"requires-python" key in ${workspaceManifest.path}`,
|
|
1626
|
+
specifier: workspaceRequiresPython
|
|
1579
1627
|
});
|
|
1580
1628
|
}
|
|
1581
1629
|
}
|
|
@@ -1856,7 +1904,8 @@ async function maybeLoadPythonRequest(root, subdir) {
|
|
|
1856
1904
|
return {
|
|
1857
1905
|
kind: ".python-version" /* PythonVersion */,
|
|
1858
1906
|
path: dotPythonVersionRelPath,
|
|
1859
|
-
data: pyreq
|
|
1907
|
+
data: pyreq,
|
|
1908
|
+
specifier: data.trim()
|
|
1860
1909
|
};
|
|
1861
1910
|
}
|
|
1862
1911
|
|
|
@@ -1901,7 +1950,8 @@ function parseUvLock(content, path4) {
|
|
|
1901
1950
|
name: pkg.name,
|
|
1902
1951
|
version: pkg.version,
|
|
1903
1952
|
source: pkg.source,
|
|
1904
|
-
wheels: (pkg.wheels ?? []).map((w) => ({ url: w.url }))
|
|
1953
|
+
wheels: (pkg.wheels ?? []).map((w) => ({ url: w.url })),
|
|
1954
|
+
...pkg.dependencies ? { dependencies: pkg.dependencies } : {}
|
|
1905
1955
|
}));
|
|
1906
1956
|
return { version: parsed.version, packages };
|
|
1907
1957
|
}
|
|
@@ -1970,6 +2020,16 @@ async function isWheelCompatible(wheelFilename, pythonMajor, pythonMinor, osName
|
|
|
1970
2020
|
osMinor
|
|
1971
2021
|
);
|
|
1972
2022
|
}
|
|
2023
|
+
async function evaluateMarker(marker, pythonMajor, pythonMinor, sysPlatform, platformMachine) {
|
|
2024
|
+
const mod = await importWasmModule();
|
|
2025
|
+
return mod.evaluateMarker(
|
|
2026
|
+
marker,
|
|
2027
|
+
pythonMajor,
|
|
2028
|
+
pythonMinor,
|
|
2029
|
+
sysPlatform,
|
|
2030
|
+
platformMachine
|
|
2031
|
+
);
|
|
2032
|
+
}
|
|
1973
2033
|
|
|
1974
2034
|
// src/manifest/python-selector.ts
|
|
1975
2035
|
function selectPython(constraints, available) {
|
|
@@ -2276,15 +2336,17 @@ export {
|
|
|
2276
2336
|
UvConfigWorkspaceSchema,
|
|
2277
2337
|
UvIndexEntrySchema,
|
|
2278
2338
|
classifyPackages,
|
|
2279
|
-
containsAppOrHandler,
|
|
2280
2339
|
containsTopLevelCallable,
|
|
2281
2340
|
createMinimalManifest,
|
|
2282
2341
|
discoverPythonPackage,
|
|
2342
|
+
evaluateMarker,
|
|
2283
2343
|
extendDistRecord,
|
|
2344
|
+
findAppOrHandler,
|
|
2284
2345
|
getStringConstant,
|
|
2285
2346
|
isPrivatePackageSource,
|
|
2286
2347
|
isWheelCompatible,
|
|
2287
2348
|
normalizePackageName2 as normalizePackageName,
|
|
2349
|
+
parsePep508,
|
|
2288
2350
|
parseUvLock,
|
|
2289
2351
|
scanDistributions,
|
|
2290
2352
|
selectPython,
|
|
@@ -98,6 +98,8 @@ export interface PythonVersionConfig {
|
|
|
98
98
|
path: RelPath;
|
|
99
99
|
/** Parsed Python version requests from the file. */
|
|
100
100
|
data: PythonRequest[];
|
|
101
|
+
/** Raw version string from the file (e.g. "3.12", ">=3.12,<3.13"). */
|
|
102
|
+
specifier: string;
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* Union type for all Python configuration file types.
|
|
@@ -62,3 +62,22 @@ export declare function formatPep508(req: NormalizedRequirement): string;
|
|
|
62
62
|
* @returns Merged extras array, or undefined if both inputs are empty/undefined
|
|
63
63
|
*/
|
|
64
64
|
export declare function mergeExtras(existing: string[] | undefined, additional: string[] | string | undefined): string[] | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Parse a single PEP 508 dependency string into a NormalizedRequirement.
|
|
67
|
+
*
|
|
68
|
+
* Uses the uv-pep508 Rust crate via WASM for spec-compliant parsing.
|
|
69
|
+
*
|
|
70
|
+
* @param dep - A PEP 508 dependency string (e.g., "flask[async]>=2.0 ; python_version >= '3.8'")
|
|
71
|
+
* @returns The parsed requirement, or null if parsing fails
|
|
72
|
+
*/
|
|
73
|
+
export declare function parsePep508(dep: string): Promise<NormalizedRequirement | null>;
|
|
74
|
+
/**
|
|
75
|
+
* Parse multiple PEP 508 dependency strings in a single batch.
|
|
76
|
+
*
|
|
77
|
+
* Loads the WASM module once and parses all strings synchronously,
|
|
78
|
+
* avoiding per-item async overhead.
|
|
79
|
+
*
|
|
80
|
+
* @param deps - Array of PEP 508 dependency strings
|
|
81
|
+
* @returns Array of parsed requirements (null for entries that fail to parse)
|
|
82
|
+
*/
|
|
83
|
+
export declare function parsePep508(deps: string[]): Promise<(NormalizedRequirement | null)[]>;
|
|
@@ -174,7 +174,27 @@ export declare const pyProjectProjectSchema: z.ZodObject<{
|
|
|
174
174
|
scripts?: Record<string, string> | undefined;
|
|
175
175
|
entry_points?: Record<string, Record<string, string>> | undefined;
|
|
176
176
|
}>;
|
|
177
|
-
export declare const
|
|
177
|
+
export declare const dependencyGroupIncludeSchema: z.ZodObject<{
|
|
178
|
+
'include-group': z.ZodString;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
'include-group': string;
|
|
181
|
+
}, {
|
|
182
|
+
'include-group': string;
|
|
183
|
+
}>;
|
|
184
|
+
export declare const dependencyGroupEntrySchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
185
|
+
'include-group': z.ZodString;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
'include-group': string;
|
|
188
|
+
}, {
|
|
189
|
+
'include-group': string;
|
|
190
|
+
}>]>;
|
|
191
|
+
export declare const pyProjectDependencyGroupsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
192
|
+
'include-group': z.ZodString;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
'include-group': string;
|
|
195
|
+
}, {
|
|
196
|
+
'include-group': string;
|
|
197
|
+
}>]>, "many">>;
|
|
178
198
|
export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
179
199
|
uv: z.ZodOptional<z.ZodObject<{
|
|
180
200
|
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
@@ -243,6 +263,7 @@ export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
|
243
263
|
members?: string[] | undefined;
|
|
244
264
|
exclude?: string[] | undefined;
|
|
245
265
|
}>>;
|
|
266
|
+
'dev-dependencies': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
246
267
|
}, "strip", z.ZodTypeAny, {
|
|
247
268
|
sources?: Record<string, {
|
|
248
269
|
index?: string | undefined;
|
|
@@ -268,6 +289,7 @@ export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
|
268
289
|
members?: string[] | undefined;
|
|
269
290
|
exclude?: string[] | undefined;
|
|
270
291
|
} | undefined;
|
|
292
|
+
'dev-dependencies'?: string[] | undefined;
|
|
271
293
|
}, {
|
|
272
294
|
sources?: Record<string, {
|
|
273
295
|
index?: string | undefined;
|
|
@@ -293,6 +315,7 @@ export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
|
293
315
|
members?: string[] | undefined;
|
|
294
316
|
exclude?: string[] | undefined;
|
|
295
317
|
} | undefined;
|
|
318
|
+
'dev-dependencies'?: string[] | undefined;
|
|
296
319
|
}>>;
|
|
297
320
|
}, "strip", z.ZodTypeAny, {
|
|
298
321
|
uv?: {
|
|
@@ -320,6 +343,7 @@ export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
|
320
343
|
members?: string[] | undefined;
|
|
321
344
|
exclude?: string[] | undefined;
|
|
322
345
|
} | undefined;
|
|
346
|
+
'dev-dependencies'?: string[] | undefined;
|
|
323
347
|
} | undefined;
|
|
324
348
|
}, {
|
|
325
349
|
uv?: {
|
|
@@ -347,6 +371,7 @@ export declare const pyProjectToolSectionSchema: z.ZodObject<{
|
|
|
347
371
|
members?: string[] | undefined;
|
|
348
372
|
exclude?: string[] | undefined;
|
|
349
373
|
} | undefined;
|
|
374
|
+
'dev-dependencies'?: string[] | undefined;
|
|
350
375
|
} | undefined;
|
|
351
376
|
}>;
|
|
352
377
|
export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
@@ -475,7 +500,13 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
475
500
|
'build-backend'?: string | undefined;
|
|
476
501
|
'backend-path'?: string[] | undefined;
|
|
477
502
|
}>>;
|
|
478
|
-
'dependency-groups': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString,
|
|
503
|
+
'dependency-groups': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
504
|
+
'include-group': z.ZodString;
|
|
505
|
+
}, "strip", z.ZodTypeAny, {
|
|
506
|
+
'include-group': string;
|
|
507
|
+
}, {
|
|
508
|
+
'include-group': string;
|
|
509
|
+
}>]>, "many">>>;
|
|
479
510
|
tool: z.ZodOptional<z.ZodObject<{
|
|
480
511
|
uv: z.ZodOptional<z.ZodObject<{
|
|
481
512
|
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
@@ -544,6 +575,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
544
575
|
members?: string[] | undefined;
|
|
545
576
|
exclude?: string[] | undefined;
|
|
546
577
|
}>>;
|
|
578
|
+
'dev-dependencies': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
547
579
|
}, "strip", z.ZodTypeAny, {
|
|
548
580
|
sources?: Record<string, {
|
|
549
581
|
index?: string | undefined;
|
|
@@ -569,6 +601,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
569
601
|
members?: string[] | undefined;
|
|
570
602
|
exclude?: string[] | undefined;
|
|
571
603
|
} | undefined;
|
|
604
|
+
'dev-dependencies'?: string[] | undefined;
|
|
572
605
|
}, {
|
|
573
606
|
sources?: Record<string, {
|
|
574
607
|
index?: string | undefined;
|
|
@@ -594,6 +627,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
594
627
|
members?: string[] | undefined;
|
|
595
628
|
exclude?: string[] | undefined;
|
|
596
629
|
} | undefined;
|
|
630
|
+
'dev-dependencies'?: string[] | undefined;
|
|
597
631
|
}>>;
|
|
598
632
|
}, "strip", z.ZodTypeAny, {
|
|
599
633
|
uv?: {
|
|
@@ -621,6 +655,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
621
655
|
members?: string[] | undefined;
|
|
622
656
|
exclude?: string[] | undefined;
|
|
623
657
|
} | undefined;
|
|
658
|
+
'dev-dependencies'?: string[] | undefined;
|
|
624
659
|
} | undefined;
|
|
625
660
|
}, {
|
|
626
661
|
uv?: {
|
|
@@ -648,6 +683,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
648
683
|
members?: string[] | undefined;
|
|
649
684
|
exclude?: string[] | undefined;
|
|
650
685
|
} | undefined;
|
|
686
|
+
'dev-dependencies'?: string[] | undefined;
|
|
651
687
|
} | undefined;
|
|
652
688
|
}>>;
|
|
653
689
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -686,7 +722,9 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
686
722
|
'build-backend'?: string | undefined;
|
|
687
723
|
'backend-path'?: string[] | undefined;
|
|
688
724
|
} | undefined;
|
|
689
|
-
'dependency-groups'?: Record<string, string
|
|
725
|
+
'dependency-groups'?: Record<string, (string | {
|
|
726
|
+
'include-group': string;
|
|
727
|
+
})[]> | undefined;
|
|
690
728
|
tool?: {
|
|
691
729
|
uv?: {
|
|
692
730
|
sources?: Record<string, {
|
|
@@ -713,6 +751,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
713
751
|
members?: string[] | undefined;
|
|
714
752
|
exclude?: string[] | undefined;
|
|
715
753
|
} | undefined;
|
|
754
|
+
'dev-dependencies'?: string[] | undefined;
|
|
716
755
|
} | undefined;
|
|
717
756
|
} | undefined;
|
|
718
757
|
}, {
|
|
@@ -751,7 +790,9 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
751
790
|
'build-backend'?: string | undefined;
|
|
752
791
|
'backend-path'?: string[] | undefined;
|
|
753
792
|
} | undefined;
|
|
754
|
-
'dependency-groups'?: Record<string, string
|
|
793
|
+
'dependency-groups'?: Record<string, (string | {
|
|
794
|
+
'include-group': string;
|
|
795
|
+
})[]> | undefined;
|
|
755
796
|
tool?: {
|
|
756
797
|
uv?: {
|
|
757
798
|
sources?: Record<string, {
|
|
@@ -778,6 +819,7 @@ export declare const pyProjectTomlSchema: z.ZodObject<{
|
|
|
778
819
|
members?: string[] | undefined;
|
|
779
820
|
exclude?: string[] | undefined;
|
|
780
821
|
} | undefined;
|
|
822
|
+
'dev-dependencies'?: string[] | undefined;
|
|
781
823
|
} | undefined;
|
|
782
824
|
} | undefined;
|
|
783
825
|
}>;
|
|
@@ -71,9 +71,19 @@ export interface PyProjectProject {
|
|
|
71
71
|
entry_points?: Record<string, Record<string, string>>;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* PEP 735 include-group directive: `{include-group: "other-group"}`.
|
|
75
75
|
*/
|
|
76
|
-
export
|
|
76
|
+
export interface DependencyGroupInclude {
|
|
77
|
+
'include-group': string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A single entry in a dependency group: either a PEP 508 string or an include directive.
|
|
81
|
+
*/
|
|
82
|
+
export type DependencyGroupEntry = string | DependencyGroupInclude;
|
|
83
|
+
/**
|
|
84
|
+
* [dependency-groups] per PEP 735.
|
|
85
|
+
*/
|
|
86
|
+
export type PyProjectDependencyGroups = Record<string, DependencyGroupEntry[]>;
|
|
77
87
|
/**
|
|
78
88
|
* [tool.FOO] section.
|
|
79
89
|
* @passthrough
|
|
@@ -55,6 +55,8 @@ export interface PythonConstraint {
|
|
|
55
55
|
source: string;
|
|
56
56
|
/** Human-readable description of where this constraint came from. */
|
|
57
57
|
prettySource: string;
|
|
58
|
+
/** Raw version specifier string from the source file (e.g. ">=3.12", "3.12"). */
|
|
59
|
+
specifier?: string;
|
|
58
60
|
}
|
|
59
61
|
export type PythonVersion = {
|
|
60
62
|
major: number;
|
|
@@ -95,6 +95,7 @@ export declare const uvConfigSchema: z.ZodObject<{
|
|
|
95
95
|
members?: string[] | undefined;
|
|
96
96
|
exclude?: string[] | undefined;
|
|
97
97
|
}>>;
|
|
98
|
+
'dev-dependencies': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
98
99
|
}, "strip", z.ZodTypeAny, {
|
|
99
100
|
sources?: Record<string, {
|
|
100
101
|
index?: string | undefined;
|
|
@@ -120,6 +121,7 @@ export declare const uvConfigSchema: z.ZodObject<{
|
|
|
120
121
|
members?: string[] | undefined;
|
|
121
122
|
exclude?: string[] | undefined;
|
|
122
123
|
} | undefined;
|
|
124
|
+
'dev-dependencies'?: string[] | undefined;
|
|
123
125
|
}, {
|
|
124
126
|
sources?: Record<string, {
|
|
125
127
|
index?: string | undefined;
|
|
@@ -145,4 +147,5 @@ export declare const uvConfigSchema: z.ZodObject<{
|
|
|
145
147
|
members?: string[] | undefined;
|
|
146
148
|
exclude?: string[] | undefined;
|
|
147
149
|
} | undefined;
|
|
150
|
+
'dev-dependencies'?: string[] | undefined;
|
|
148
151
|
}>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Check if a wheel filename is compatible with a given platform.
|
|
3
3
|
*
|
|
4
4
|
* Uses uv's `WheelFilename::is_compatible()` and `Tags::from_env()` via WASM
|
|
5
|
-
*
|
|
5
|
+
* -- the same logic uv uses for resolution.
|
|
6
6
|
*
|
|
7
7
|
* @param wheelFilename - The wheel filename (e.g. "numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.whl")
|
|
8
8
|
* @param pythonMajor - Python major version (e.g. 3)
|
|
@@ -14,3 +14,17 @@
|
|
|
14
14
|
* @returns true if the wheel is compatible with the platform
|
|
15
15
|
*/
|
|
16
16
|
export declare function isWheelCompatible(wheelFilename: string, pythonMajor: number, pythonMinor: number, osName: string, archName: string, osMajor: number, osMinor: number): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Evaluate a PEP 508 environment marker against a target environment.
|
|
19
|
+
*
|
|
20
|
+
* Uses uv's `MarkerTree::evaluate()` via WASM -- the same logic uv uses
|
|
21
|
+
* for dependency resolution.
|
|
22
|
+
*
|
|
23
|
+
* @param marker - PEP 508 marker expression (e.g. "sys_platform == 'win32'")
|
|
24
|
+
* @param pythonMajor - Python major version (e.g. 3)
|
|
25
|
+
* @param pythonMinor - Python minor version (e.g. 12)
|
|
26
|
+
* @param sysPlatform - sys_platform value: "linux", "win32", "darwin"
|
|
27
|
+
* @param platformMachine - platform_machine value: "x86_64", "aarch64", etc.
|
|
28
|
+
* @returns true if the marker is satisfied for the target environment
|
|
29
|
+
*/
|
|
30
|
+
export declare function evaluateMarker(marker: string, pythonMajor: number, pythonMinor: number, sysPlatform: string, platformMachine: string): Promise<boolean>;
|
|
@@ -12,21 +12,22 @@
|
|
|
12
12
|
* accurate AST analysis without requiring a Python runtime.
|
|
13
13
|
*
|
|
14
14
|
* @param source - The Python source code to analyze
|
|
15
|
-
* @returns Promise that resolves to
|
|
16
|
-
*
|
|
15
|
+
* @returns Promise that resolves to the matched variable name (e.g. "app",
|
|
16
|
+
* "application", "handler"), or null if not found.
|
|
17
|
+
* Returns null for invalid Python syntax.
|
|
17
18
|
*
|
|
18
19
|
* @example
|
|
19
20
|
* ```typescript
|
|
20
|
-
* import {
|
|
21
|
+
* import { findAppOrHandler } from '@vercel/python-analysis';
|
|
21
22
|
*
|
|
22
|
-
* const
|
|
23
|
+
* const name = await findAppOrHandler(`
|
|
23
24
|
* from flask import Flask
|
|
24
25
|
* app = Flask(__name__)
|
|
25
26
|
* `);
|
|
26
|
-
* console.log(
|
|
27
|
+
* console.log(name); // "app"
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
|
-
export declare function
|
|
30
|
+
export declare function findAppOrHandler(source: string): Promise<string | null>;
|
|
30
31
|
/**
|
|
31
32
|
* Check if a top-level callable with the given name exists in Python source.
|
|
32
33
|
*
|
|
Binary file
|
|
@@ -116,7 +116,7 @@ export interface ImportObject {
|
|
|
116
116
|
'wasi:random/insecure-seed@0.2.6': typeof WasiRandomInsecureSeed,
|
|
117
117
|
}
|
|
118
118
|
export interface Root {
|
|
119
|
-
|
|
119
|
+
findAppOrHandler(source: string): string | undefined,
|
|
120
120
|
getStringConstant(source: string, name: string): string | undefined,
|
|
121
121
|
containsTopLevelCallable(source: string, name: string): boolean,
|
|
122
122
|
parseDistMetadata(content: Uint8Array): DistMetadata,
|
|
@@ -124,7 +124,9 @@ export interface Root {
|
|
|
124
124
|
parseDirectUrl(content: string): DirectUrlInfo,
|
|
125
125
|
normalizePackageName(name: string): string,
|
|
126
126
|
parseRequirementsTxt(content: string, workingDir: string | undefined, filename: string | undefined): ParsedRequirementsTxt,
|
|
127
|
+
parsePep508(dep: string): ParsedReqEntry,
|
|
127
128
|
isWheelCompatible(wheelFilename: string, pythonMajor: number, pythonMinor: number, osName: string, archName: string, osMajor: number, osMinor: number): boolean,
|
|
129
|
+
evaluateMarker(marker: string, pythonMajor: number, pythonMinor: number, sysPlatform: string, platformMachine: string): boolean,
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
/**
|
|
@@ -3452,6 +3452,7 @@ let gen = (function* _initGenerator () {
|
|
|
3452
3452
|
let postReturn3;
|
|
3453
3453
|
let postReturn4;
|
|
3454
3454
|
let postReturn5;
|
|
3455
|
+
let postReturn6;
|
|
3455
3456
|
function trampoline0(handle) {
|
|
3456
3457
|
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
3457
3458
|
if (handleEntry.own) {
|
|
@@ -3641,34 +3642,58 @@ let gen = (function* _initGenerator () {
|
|
|
3641
3642
|
'9': trampoline22,
|
|
3642
3643
|
},
|
|
3643
3644
|
}));
|
|
3644
|
-
postReturn0 = exports1['
|
|
3645
|
+
postReturn0 = exports1['cabi_post_evaluate-marker'];
|
|
3645
3646
|
postReturn1 = exports1['cabi_post_parse-dist-metadata'];
|
|
3646
3647
|
postReturn2 = exports1['cabi_post_parse-record'];
|
|
3647
3648
|
postReturn3 = exports1['cabi_post_parse-direct-url'];
|
|
3648
3649
|
postReturn4 = exports1['cabi_post_normalize-package-name'];
|
|
3649
3650
|
postReturn5 = exports1['cabi_post_parse-requirements-txt'];
|
|
3650
|
-
|
|
3651
|
+
postReturn6 = exports1['cabi_post_parse-pep508'];
|
|
3652
|
+
let exports1FindAppOrHandler;
|
|
3651
3653
|
|
|
3652
|
-
function
|
|
3654
|
+
function findAppOrHandler(arg0) {
|
|
3653
3655
|
var ptr0 = utf8Encode(arg0, realloc0, memory0);
|
|
3654
3656
|
var len0 = utf8EncodedLen;
|
|
3655
|
-
_debugLog('[iface="
|
|
3656
|
-
funcName: '
|
|
3657
|
+
_debugLog('[iface="find-app-or-handler", function="find-app-or-handler"][Instruction::CallWasm] enter', {
|
|
3658
|
+
funcName: 'find-app-or-handler',
|
|
3657
3659
|
paramCount: 2,
|
|
3658
3660
|
async: false,
|
|
3659
|
-
postReturn:
|
|
3661
|
+
postReturn: true,
|
|
3660
3662
|
});
|
|
3661
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, '
|
|
3662
|
-
const ret =
|
|
3663
|
+
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1FindAppOrHandler');
|
|
3664
|
+
const ret = exports1FindAppOrHandler(ptr0, len0);
|
|
3663
3665
|
endCurrentTask(0);
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3666
|
+
let variant2;
|
|
3667
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
3668
|
+
case 0: {
|
|
3669
|
+
variant2 = undefined;
|
|
3670
|
+
break;
|
|
3671
|
+
}
|
|
3672
|
+
case 1: {
|
|
3673
|
+
var ptr1 = dataView(memory0).getUint32(ret + 4, true);
|
|
3674
|
+
var len1 = dataView(memory0).getUint32(ret + 8, true);
|
|
3675
|
+
var result1 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr1, len1));
|
|
3676
|
+
variant2 = result1;
|
|
3677
|
+
break;
|
|
3678
|
+
}
|
|
3679
|
+
default: {
|
|
3680
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
_debugLog('[iface="find-app-or-handler", function="find-app-or-handler"][Instruction::Return]', {
|
|
3684
|
+
funcName: 'find-app-or-handler',
|
|
3667
3685
|
paramCount: 1,
|
|
3668
3686
|
async: false,
|
|
3669
|
-
postReturn:
|
|
3687
|
+
postReturn: true
|
|
3670
3688
|
});
|
|
3671
|
-
|
|
3689
|
+
const retCopy = variant2;
|
|
3690
|
+
|
|
3691
|
+
let cstate = getOrCreateAsyncState(0);
|
|
3692
|
+
cstate.mayLeave = false;
|
|
3693
|
+
postReturn0(ret);
|
|
3694
|
+
cstate.mayLeave = true;
|
|
3695
|
+
return retCopy;
|
|
3696
|
+
|
|
3672
3697
|
}
|
|
3673
3698
|
let exports1GetStringConstant;
|
|
3674
3699
|
|
|
@@ -4836,6 +4861,221 @@ let gen = (function* _initGenerator () {
|
|
|
4836
4861
|
|
|
4837
4862
|
|
|
4838
4863
|
|
|
4864
|
+
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
4865
|
+
throw new ComponentError(retCopy.val);
|
|
4866
|
+
}
|
|
4867
|
+
return retCopy.val;
|
|
4868
|
+
|
|
4869
|
+
}
|
|
4870
|
+
let exports1ParsePep508;
|
|
4871
|
+
|
|
4872
|
+
function parsePep508(arg0) {
|
|
4873
|
+
var ptr0 = utf8Encode(arg0, realloc0, memory0);
|
|
4874
|
+
var len0 = utf8EncodedLen;
|
|
4875
|
+
_debugLog('[iface="parse-pep508", function="parse-pep508"][Instruction::CallWasm] enter', {
|
|
4876
|
+
funcName: 'parse-pep508',
|
|
4877
|
+
paramCount: 2,
|
|
4878
|
+
async: false,
|
|
4879
|
+
postReturn: true,
|
|
4880
|
+
});
|
|
4881
|
+
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1ParsePep508');
|
|
4882
|
+
const ret = exports1ParsePep508(ptr0, len0);
|
|
4883
|
+
endCurrentTask(0);
|
|
4884
|
+
let variant22;
|
|
4885
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
4886
|
+
case 0: {
|
|
4887
|
+
let variant2;
|
|
4888
|
+
switch (dataView(memory0).getUint8(ret + 4, true)) {
|
|
4889
|
+
case 0: {
|
|
4890
|
+
variant2 = undefined;
|
|
4891
|
+
break;
|
|
4892
|
+
}
|
|
4893
|
+
case 1: {
|
|
4894
|
+
var ptr1 = dataView(memory0).getUint32(ret + 8, true);
|
|
4895
|
+
var len1 = dataView(memory0).getUint32(ret + 12, true);
|
|
4896
|
+
var result1 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr1, len1));
|
|
4897
|
+
variant2 = result1;
|
|
4898
|
+
break;
|
|
4899
|
+
}
|
|
4900
|
+
default: {
|
|
4901
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
var ptr3 = dataView(memory0).getUint32(ret + 16, true);
|
|
4905
|
+
var len3 = dataView(memory0).getUint32(ret + 20, true);
|
|
4906
|
+
var result3 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr3, len3));
|
|
4907
|
+
var len5 = dataView(memory0).getUint32(ret + 28, true);
|
|
4908
|
+
var base5 = dataView(memory0).getUint32(ret + 24, true);
|
|
4909
|
+
var result5 = [];
|
|
4910
|
+
for (let i = 0; i < len5; i++) {
|
|
4911
|
+
const base = base5 + i * 8;
|
|
4912
|
+
var ptr4 = dataView(memory0).getUint32(base + 0, true);
|
|
4913
|
+
var len4 = dataView(memory0).getUint32(base + 4, true);
|
|
4914
|
+
var result4 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr4, len4));
|
|
4915
|
+
result5.push(result4);
|
|
4916
|
+
}
|
|
4917
|
+
let variant7;
|
|
4918
|
+
switch (dataView(memory0).getUint8(ret + 32, true)) {
|
|
4919
|
+
case 0: {
|
|
4920
|
+
variant7 = undefined;
|
|
4921
|
+
break;
|
|
4922
|
+
}
|
|
4923
|
+
case 1: {
|
|
4924
|
+
var ptr6 = dataView(memory0).getUint32(ret + 36, true);
|
|
4925
|
+
var len6 = dataView(memory0).getUint32(ret + 40, true);
|
|
4926
|
+
var result6 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr6, len6));
|
|
4927
|
+
variant7 = result6;
|
|
4928
|
+
break;
|
|
4929
|
+
}
|
|
4930
|
+
default: {
|
|
4931
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
4932
|
+
}
|
|
4933
|
+
}
|
|
4934
|
+
let variant9;
|
|
4935
|
+
switch (dataView(memory0).getUint8(ret + 44, true)) {
|
|
4936
|
+
case 0: {
|
|
4937
|
+
variant9 = undefined;
|
|
4938
|
+
break;
|
|
4939
|
+
}
|
|
4940
|
+
case 1: {
|
|
4941
|
+
var ptr8 = dataView(memory0).getUint32(ret + 48, true);
|
|
4942
|
+
var len8 = dataView(memory0).getUint32(ret + 52, true);
|
|
4943
|
+
var result8 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr8, len8));
|
|
4944
|
+
variant9 = result8;
|
|
4945
|
+
break;
|
|
4946
|
+
}
|
|
4947
|
+
default: {
|
|
4948
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
let variant11;
|
|
4952
|
+
switch (dataView(memory0).getUint8(ret + 56, true)) {
|
|
4953
|
+
case 0: {
|
|
4954
|
+
variant11 = undefined;
|
|
4955
|
+
break;
|
|
4956
|
+
}
|
|
4957
|
+
case 1: {
|
|
4958
|
+
var ptr10 = dataView(memory0).getUint32(ret + 60, true);
|
|
4959
|
+
var len10 = dataView(memory0).getUint32(ret + 64, true);
|
|
4960
|
+
var result10 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr10, len10));
|
|
4961
|
+
variant11 = result10;
|
|
4962
|
+
break;
|
|
4963
|
+
}
|
|
4964
|
+
default: {
|
|
4965
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
4966
|
+
}
|
|
4967
|
+
}
|
|
4968
|
+
var len13 = dataView(memory0).getUint32(ret + 72, true);
|
|
4969
|
+
var base13 = dataView(memory0).getUint32(ret + 68, true);
|
|
4970
|
+
var result13 = [];
|
|
4971
|
+
for (let i = 0; i < len13; i++) {
|
|
4972
|
+
const base = base13 + i * 8;
|
|
4973
|
+
var ptr12 = dataView(memory0).getUint32(base + 0, true);
|
|
4974
|
+
var len12 = dataView(memory0).getUint32(base + 4, true);
|
|
4975
|
+
var result12 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr12, len12));
|
|
4976
|
+
result13.push(result12);
|
|
4977
|
+
}
|
|
4978
|
+
var bool14 = dataView(memory0).getUint8(ret + 76, true);
|
|
4979
|
+
let variant18;
|
|
4980
|
+
switch (dataView(memory0).getUint8(ret + 80, true)) {
|
|
4981
|
+
case 0: {
|
|
4982
|
+
variant18 = undefined;
|
|
4983
|
+
break;
|
|
4984
|
+
}
|
|
4985
|
+
case 1: {
|
|
4986
|
+
var ptr15 = dataView(memory0).getUint32(ret + 84, true);
|
|
4987
|
+
var len15 = dataView(memory0).getUint32(ret + 88, true);
|
|
4988
|
+
var result15 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr15, len15));
|
|
4989
|
+
let variant17;
|
|
4990
|
+
switch (dataView(memory0).getUint8(ret + 92, true)) {
|
|
4991
|
+
case 0: {
|
|
4992
|
+
variant17 = undefined;
|
|
4993
|
+
break;
|
|
4994
|
+
}
|
|
4995
|
+
case 1: {
|
|
4996
|
+
var ptr16 = dataView(memory0).getUint32(ret + 96, true);
|
|
4997
|
+
var len16 = dataView(memory0).getUint32(ret + 100, true);
|
|
4998
|
+
var result16 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr16, len16));
|
|
4999
|
+
variant17 = result16;
|
|
5000
|
+
break;
|
|
5001
|
+
}
|
|
5002
|
+
default: {
|
|
5003
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
variant18 = {
|
|
5007
|
+
url: result15,
|
|
5008
|
+
rev: variant17,
|
|
5009
|
+
};
|
|
5010
|
+
break;
|
|
5011
|
+
}
|
|
5012
|
+
default: {
|
|
5013
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
5014
|
+
}
|
|
5015
|
+
}
|
|
5016
|
+
let variant20;
|
|
5017
|
+
switch (dataView(memory0).getUint8(ret + 104, true)) {
|
|
5018
|
+
case 0: {
|
|
5019
|
+
variant20 = undefined;
|
|
5020
|
+
break;
|
|
5021
|
+
}
|
|
5022
|
+
case 1: {
|
|
5023
|
+
var ptr19 = dataView(memory0).getUint32(ret + 108, true);
|
|
5024
|
+
var len19 = dataView(memory0).getUint32(ret + 112, true);
|
|
5025
|
+
var result19 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr19, len19));
|
|
5026
|
+
variant20 = result19;
|
|
5027
|
+
break;
|
|
5028
|
+
}
|
|
5029
|
+
default: {
|
|
5030
|
+
throw new TypeError('invalid variant discriminant for option');
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
variant22= {
|
|
5034
|
+
tag: 'ok',
|
|
5035
|
+
val: {
|
|
5036
|
+
name: variant2,
|
|
5037
|
+
pep508: result3,
|
|
5038
|
+
extras: result5,
|
|
5039
|
+
markers: variant7,
|
|
5040
|
+
versionSpec: variant9,
|
|
5041
|
+
url: variant11,
|
|
5042
|
+
hashes: result13,
|
|
5043
|
+
editable: bool14 == 0 ? false : (bool14 == 1 ? true : throwInvalidBool()),
|
|
5044
|
+
vcs: variant18,
|
|
5045
|
+
givenUrl: variant20,
|
|
5046
|
+
}
|
|
5047
|
+
};
|
|
5048
|
+
break;
|
|
5049
|
+
}
|
|
5050
|
+
case 1: {
|
|
5051
|
+
var ptr21 = dataView(memory0).getUint32(ret + 4, true);
|
|
5052
|
+
var len21 = dataView(memory0).getUint32(ret + 8, true);
|
|
5053
|
+
var result21 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr21, len21));
|
|
5054
|
+
variant22= {
|
|
5055
|
+
tag: 'err',
|
|
5056
|
+
val: result21
|
|
5057
|
+
};
|
|
5058
|
+
break;
|
|
5059
|
+
}
|
|
5060
|
+
default: {
|
|
5061
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
_debugLog('[iface="parse-pep508", function="parse-pep508"][Instruction::Return]', {
|
|
5065
|
+
funcName: 'parse-pep508',
|
|
5066
|
+
paramCount: 1,
|
|
5067
|
+
async: false,
|
|
5068
|
+
postReturn: true
|
|
5069
|
+
});
|
|
5070
|
+
const retCopy = variant22;
|
|
5071
|
+
|
|
5072
|
+
let cstate = getOrCreateAsyncState(0);
|
|
5073
|
+
cstate.mayLeave = false;
|
|
5074
|
+
postReturn6(ret);
|
|
5075
|
+
cstate.mayLeave = true;
|
|
5076
|
+
|
|
5077
|
+
|
|
5078
|
+
|
|
4839
5079
|
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
4840
5080
|
throw new ComponentError(retCopy.val);
|
|
4841
5081
|
}
|
|
@@ -4905,7 +5145,70 @@ let gen = (function* _initGenerator () {
|
|
|
4905
5145
|
return retCopy.val;
|
|
4906
5146
|
|
|
4907
5147
|
}
|
|
4908
|
-
|
|
5148
|
+
let exports1EvaluateMarker;
|
|
5149
|
+
|
|
5150
|
+
function evaluateMarker(arg0, arg1, arg2, arg3, arg4) {
|
|
5151
|
+
var ptr0 = utf8Encode(arg0, realloc0, memory0);
|
|
5152
|
+
var len0 = utf8EncodedLen;
|
|
5153
|
+
var ptr1 = utf8Encode(arg3, realloc0, memory0);
|
|
5154
|
+
var len1 = utf8EncodedLen;
|
|
5155
|
+
var ptr2 = utf8Encode(arg4, realloc0, memory0);
|
|
5156
|
+
var len2 = utf8EncodedLen;
|
|
5157
|
+
_debugLog('[iface="evaluate-marker", function="evaluate-marker"][Instruction::CallWasm] enter', {
|
|
5158
|
+
funcName: 'evaluate-marker',
|
|
5159
|
+
paramCount: 8,
|
|
5160
|
+
async: false,
|
|
5161
|
+
postReturn: true,
|
|
5162
|
+
});
|
|
5163
|
+
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1EvaluateMarker');
|
|
5164
|
+
const ret = exports1EvaluateMarker(ptr0, len0, toUint8(arg1), toUint8(arg2), ptr1, len1, ptr2, len2);
|
|
5165
|
+
endCurrentTask(0);
|
|
5166
|
+
let variant5;
|
|
5167
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
5168
|
+
case 0: {
|
|
5169
|
+
var bool3 = dataView(memory0).getUint8(ret + 4, true);
|
|
5170
|
+
variant5= {
|
|
5171
|
+
tag: 'ok',
|
|
5172
|
+
val: bool3 == 0 ? false : (bool3 == 1 ? true : throwInvalidBool())
|
|
5173
|
+
};
|
|
5174
|
+
break;
|
|
5175
|
+
}
|
|
5176
|
+
case 1: {
|
|
5177
|
+
var ptr4 = dataView(memory0).getUint32(ret + 4, true);
|
|
5178
|
+
var len4 = dataView(memory0).getUint32(ret + 8, true);
|
|
5179
|
+
var result4 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr4, len4));
|
|
5180
|
+
variant5= {
|
|
5181
|
+
tag: 'err',
|
|
5182
|
+
val: result4
|
|
5183
|
+
};
|
|
5184
|
+
break;
|
|
5185
|
+
}
|
|
5186
|
+
default: {
|
|
5187
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
5188
|
+
}
|
|
5189
|
+
}
|
|
5190
|
+
_debugLog('[iface="evaluate-marker", function="evaluate-marker"][Instruction::Return]', {
|
|
5191
|
+
funcName: 'evaluate-marker',
|
|
5192
|
+
paramCount: 1,
|
|
5193
|
+
async: false,
|
|
5194
|
+
postReturn: true
|
|
5195
|
+
});
|
|
5196
|
+
const retCopy = variant5;
|
|
5197
|
+
|
|
5198
|
+
let cstate = getOrCreateAsyncState(0);
|
|
5199
|
+
cstate.mayLeave = false;
|
|
5200
|
+
postReturn0(ret);
|
|
5201
|
+
cstate.mayLeave = true;
|
|
5202
|
+
|
|
5203
|
+
|
|
5204
|
+
|
|
5205
|
+
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
5206
|
+
throw new ComponentError(retCopy.val);
|
|
5207
|
+
}
|
|
5208
|
+
return retCopy.val;
|
|
5209
|
+
|
|
5210
|
+
}
|
|
5211
|
+
exports1FindAppOrHandler = exports1['find-app-or-handler'];
|
|
4909
5212
|
exports1GetStringConstant = exports1['get-string-constant'];
|
|
4910
5213
|
exports1ContainsTopLevelCallable = exports1['contains-top-level-callable'];
|
|
4911
5214
|
exports1ParseDistMetadata = exports1['parse-dist-metadata'];
|
|
@@ -4913,9 +5216,11 @@ let gen = (function* _initGenerator () {
|
|
|
4913
5216
|
exports1ParseDirectUrl = exports1['parse-direct-url'];
|
|
4914
5217
|
exports1NormalizePackageName = exports1['normalize-package-name'];
|
|
4915
5218
|
exports1ParseRequirementsTxt = exports1['parse-requirements-txt'];
|
|
5219
|
+
exports1ParsePep508 = exports1['parse-pep508'];
|
|
4916
5220
|
exports1IsWheelCompatible = exports1['is-wheel-compatible'];
|
|
5221
|
+
exports1EvaluateMarker = exports1['evaluate-marker'];
|
|
4917
5222
|
|
|
4918
|
-
return {
|
|
5223
|
+
return { containsTopLevelCallable, evaluateMarker, findAppOrHandler, getStringConstant, isWheelCompatible, normalizePackageName, parseDirectUrl, parseDistMetadata, parsePep508, parseRecord, parseRequirementsTxt, };
|
|
4919
5224
|
})();
|
|
4920
5225
|
let promise, resolve, reject;
|
|
4921
5226
|
function runNext (value) {
|