@elaraai/e3 1.0.109 → 1.0.110
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/src/environment-capture.d.ts +27 -57
- package/dist/src/environment-capture.d.ts.map +1 -1
- package/dist/src/environment-capture.js +86 -455
- package/dist/src/environment-capture.js.map +1 -1
- package/dist/src/environment-capture.spec.js +215 -5
- package/dist/src/environment-capture.spec.js.map +1 -1
- package/dist/src/environment-npm-lock.d.ts +77 -0
- package/dist/src/environment-npm-lock.d.ts.map +1 -0
- package/dist/src/environment-npm-lock.js +209 -0
- package/dist/src/environment-npm-lock.js.map +1 -0
- package/dist/src/environment-uv-lock.d.ts +312 -0
- package/dist/src/environment-uv-lock.d.ts.map +1 -0
- package/dist/src/environment-uv-lock.js +494 -0
- package/dist/src/environment-uv-lock.js.map +1 -0
- package/dist/src/export.d.ts.map +1 -1
- package/dist/src/export.js +12 -3
- package/dist/src/export.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/runner.d.ts +14 -2
- package/dist/src/runner.d.ts.map +1 -1
- package/dist/src/runner.js +16 -4
- package/dist/src/runner.js.map +1 -1
- package/dist/src/stock-platforms.spec.js +7 -1
- package/dist/src/stock-platforms.spec.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* What an export reads of an npm lock: the governing root of a node project,
|
|
7
|
+
* the workspace member a name refers to, and the local members a member's
|
|
8
|
+
* environment carries, with the lock checked against them. Pure reads of the
|
|
9
|
+
* lock and the manifests: nothing is packed here (`environment-capture.ts`
|
|
10
|
+
* packs what these name).
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from 'node:fs';
|
|
13
|
+
import * as path from 'node:path';
|
|
14
|
+
import { StringType, compareFor } from '@elaraai/east';
|
|
15
|
+
/** Orders the paths a lock holds through East, by code point. */
|
|
16
|
+
const byCodePoint = compareFor(StringType);
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Node (npm workspace) dependency-closure capture (#280)
|
|
19
|
+
//
|
|
20
|
+
// A `{ node: { project } }` declaration is either a self-contained project
|
|
21
|
+
// (its own lockfile — captured byte-identically to before) or an npm
|
|
22
|
+
// workspace member. For a member we capture the ROOT package.json + lockfile
|
|
23
|
+
// plus an `npm pack` tarball per LOCAL closure member; the materializer
|
|
24
|
+
// (#276) reconstructs a closure-only workspace and `npm ci`s it.
|
|
25
|
+
//
|
|
26
|
+
// Unlike python's `uv pip check`, `npm ci` is NOT a loud oracle — it will
|
|
27
|
+
// silently install a member's unlocked deps from the registry — so the
|
|
28
|
+
// closure walk validates the lock at export (N4/N5) rather than relying on
|
|
29
|
+
// a run-time gate. pnpm workspaces are refused here (N8) until #284.
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
const NODE_LOCKFILES = ['package-lock.json', 'npm-shrinkwrap.json', 'pnpm-lock.yaml'];
|
|
32
|
+
/** Walk up from `start` to the nearest npm lockfile (not pnpm/yarn); null if none.
|
|
33
|
+
* @internal */
|
|
34
|
+
export function findNpmRoot(start) {
|
|
35
|
+
const names = ['package-lock.json', 'npm-shrinkwrap.json'];
|
|
36
|
+
let dir = start;
|
|
37
|
+
for (;;) {
|
|
38
|
+
const found = names.find((f) => fs.existsSync(path.join(dir, f)));
|
|
39
|
+
if (found)
|
|
40
|
+
return { root: dir, lock: JSON.parse(fs.readFileSync(path.join(dir, found), 'utf-8')) };
|
|
41
|
+
const parent = path.dirname(dir);
|
|
42
|
+
if (parent === dir)
|
|
43
|
+
return null;
|
|
44
|
+
dir = parent;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The local npm-workspace member a name refers to — the package a `{ custom }`
|
|
49
|
+
* platform or an `East.importFunction(pkg, …)` names (#652) — resolved the
|
|
50
|
+
* way `captureAutoEnvironment` resolves it: the governing npm lockfile
|
|
51
|
+
* above `anchorDir`, matched by `package.json` name, workspace members only
|
|
52
|
+
* (never an installed dependency). The python twin is
|
|
53
|
+
* `pythonWorkspaceMember`.
|
|
54
|
+
*
|
|
55
|
+
* @param name - The package name as referenced (`@scope/name` or bare)
|
|
56
|
+
* @param anchorDir - Directory the workspace is resolved from (the export cwd)
|
|
57
|
+
* @returns The member's directory and its `package.json` version, or null
|
|
58
|
+
* when there is no npm workspace above `anchorDir` or the name is not a
|
|
59
|
+
* local member (a registry package, a typo)
|
|
60
|
+
*/
|
|
61
|
+
export function nodeWorkspaceMember(name, anchorDir) {
|
|
62
|
+
const found = findNpmRoot(anchorDir);
|
|
63
|
+
if (!found)
|
|
64
|
+
return null;
|
|
65
|
+
const entry = Object.entries(found.lock.packages ?? {}).find(([p, v]) => p !== '' && !p.includes('node_modules/') && v.name === name && v.link !== true);
|
|
66
|
+
if (!entry)
|
|
67
|
+
return null;
|
|
68
|
+
const dir = path.join(found.root, ...entry[0].split('/'));
|
|
69
|
+
let version = null;
|
|
70
|
+
try {
|
|
71
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
|
|
72
|
+
if (typeof pkg.version === 'string')
|
|
73
|
+
version = pkg.version;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
/* no readable package.json: the exporter records its own default */
|
|
77
|
+
}
|
|
78
|
+
return { dir, version };
|
|
79
|
+
}
|
|
80
|
+
/** Workspace-relative POSIX path from the root to a dir. */
|
|
81
|
+
function posixRel(root, dir) {
|
|
82
|
+
return path.relative(root, dir).split(path.sep).join('/');
|
|
83
|
+
}
|
|
84
|
+
/** The union of every dependency section's package names. */
|
|
85
|
+
function allDepNames(e) {
|
|
86
|
+
if (!e)
|
|
87
|
+
return [];
|
|
88
|
+
return [
|
|
89
|
+
...Object.keys(e.dependencies ?? {}),
|
|
90
|
+
...Object.keys(e.devDependencies ?? {}),
|
|
91
|
+
...Object.keys(e.optionalDependencies ?? {}),
|
|
92
|
+
...Object.keys(e.peerDependencies ?? {}),
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Detect whether `project` is a self-contained node project or an npm
|
|
97
|
+
* workspace member, and locate the governing root.
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
* @throws {Error} N1 (no lockfile anywhere), N8 (pnpm workspace — unsupported
|
|
101
|
+
* yet), N3 (project is the workspace root), N2 (not a member of the workspace)
|
|
102
|
+
*/
|
|
103
|
+
export function discoverNodeRoot(project, owner) {
|
|
104
|
+
const ownLock = NODE_LOCKFILES.find((f) => fs.existsSync(path.join(project, f)));
|
|
105
|
+
if (ownLock) {
|
|
106
|
+
// A workspace ROOT also has its own lockfile — but capturing it packs the
|
|
107
|
+
// (usually code-less) root, not a member. Reject: the environment belongs
|
|
108
|
+
// on a member.
|
|
109
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(project, 'package.json'), 'utf-8'));
|
|
110
|
+
if (Array.isArray(pkg.workspaces) && pkg.workspaces.length > 0) {
|
|
111
|
+
throw new Error(`Environment for '${owner}': declare the environment on a workspace member, not the workspace root '${project}'`);
|
|
112
|
+
}
|
|
113
|
+
return { mode: 'single', lockName: ownLock };
|
|
114
|
+
}
|
|
115
|
+
let dir = path.dirname(project);
|
|
116
|
+
for (;;) {
|
|
117
|
+
const found = NODE_LOCKFILES.find((f) => fs.existsSync(path.join(dir, f)));
|
|
118
|
+
if (found) {
|
|
119
|
+
if (found === 'pnpm-lock.yaml') {
|
|
120
|
+
throw new Error(`Environment for '${owner}': pnpm workspaces are not yet supported as environments — use npm workspaces or a single-project env`);
|
|
121
|
+
}
|
|
122
|
+
const root = dir;
|
|
123
|
+
if (path.resolve(root) === path.resolve(project)) {
|
|
124
|
+
throw new Error(`Environment for '${owner}': declare the environment on a workspace member, not the workspace root '${root}'`);
|
|
125
|
+
}
|
|
126
|
+
const lock = JSON.parse(fs.readFileSync(path.join(root, found), 'utf-8'));
|
|
127
|
+
const subject = posixRel(root, project);
|
|
128
|
+
if (!lock.packages || !(subject in lock.packages)) {
|
|
129
|
+
throw new Error(`Environment for '${owner}': '${project}' is not a member of the workspace at '${root}' — add it to "workspaces" and refresh the lockfile, or run 'npm install' in '${project}' for a standalone env`);
|
|
130
|
+
}
|
|
131
|
+
return { mode: 'workspace', root, lock, subject };
|
|
132
|
+
}
|
|
133
|
+
const parent = path.dirname(dir);
|
|
134
|
+
if (parent === dir)
|
|
135
|
+
break;
|
|
136
|
+
dir = parent;
|
|
137
|
+
}
|
|
138
|
+
throw new Error(`Environment for '${owner}': no lockfile in '${project}' or any parent — run 'npm install' there, or add it to a workspace and lock at the root`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The transitive closure of LOCAL workspace members reachable from `subject`,
|
|
142
|
+
* with export-time lock validation.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
* @returns Closure members (workspace-relative path + package name), sorted by path
|
|
146
|
+
* @throws {Error} N4 (a member's on-disk manifest drifted from the lock — npm
|
|
147
|
+
* ci would silently install unlocked deps), N5 (a dep shadows a workspace
|
|
148
|
+
* member name from the registry), N6 (root depends on a member), N7 (a local
|
|
149
|
+
* dep resolves outside the workspace)
|
|
150
|
+
*/
|
|
151
|
+
export function npmClosure(lock, root, subject, owner) {
|
|
152
|
+
const pkgs = lock.packages ?? {};
|
|
153
|
+
const memberNames = new Set(Object.entries(pkgs)
|
|
154
|
+
.filter(([p, e]) => p !== '' && !p.includes('node_modules/') && typeof e.name === 'string')
|
|
155
|
+
.map(([, e]) => e.name));
|
|
156
|
+
// N6: the root manifest must not depend on a workspace member.
|
|
157
|
+
for (const dep of allDepNames(pkgs[''])) {
|
|
158
|
+
if (memberNames.has(dep)) {
|
|
159
|
+
throw new Error(`Environment for '${owner}': the workspace root depends on member '${dep}' — move member deps into the members that need them`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const resolveDep = (fromPath, dep) => {
|
|
163
|
+
let dir = fromPath;
|
|
164
|
+
for (;;) {
|
|
165
|
+
const key = `${dir ? dir + '/' : ''}node_modules/${dep}`;
|
|
166
|
+
if (pkgs[key])
|
|
167
|
+
return pkgs[key];
|
|
168
|
+
if (!dir)
|
|
169
|
+
return null;
|
|
170
|
+
dir = dir.split('/').slice(0, -1).join('/');
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const included = new Map(); // memberPath -> name
|
|
174
|
+
const seen = new Set();
|
|
175
|
+
const queue = [subject];
|
|
176
|
+
while (queue.length > 0) {
|
|
177
|
+
const memberPath = queue.shift();
|
|
178
|
+
if (seen.has(memberPath))
|
|
179
|
+
continue;
|
|
180
|
+
seen.add(memberPath);
|
|
181
|
+
const entry = pkgs[memberPath];
|
|
182
|
+
if (!entry)
|
|
183
|
+
continue;
|
|
184
|
+
included.set(memberPath, entry.name ?? path.basename(memberPath));
|
|
185
|
+
// N4: the locked dep sections must match the on-disk manifest.
|
|
186
|
+
const onDisk = JSON.parse(fs.readFileSync(path.join(root, ...memberPath.split('/'), 'package.json'), 'utf-8'));
|
|
187
|
+
for (const section of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
188
|
+
if (JSON.stringify(onDisk[section] ?? {}) !== JSON.stringify(entry[section] ?? {})) {
|
|
189
|
+
throw new Error(`Environment for '${owner}': '${memberPath}/package.json' ${section} differ from the lockfile — run 'npm install' to refresh the lock before exporting`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const dep of allDepNames(entry)) {
|
|
193
|
+
const resolved = resolveDep(memberPath, dep);
|
|
194
|
+
if (resolved?.link) {
|
|
195
|
+
const target = resolved.resolved ?? '';
|
|
196
|
+
if (target === '' || target.startsWith('..') || path.isAbsolute(target)) {
|
|
197
|
+
throw new Error(`Environment for '${owner}': local dependency '${dep}' of '${memberPath}' resolves outside the workspace ('${target}')`);
|
|
198
|
+
}
|
|
199
|
+
queue.push(target);
|
|
200
|
+
}
|
|
201
|
+
else if (memberNames.has(dep)) {
|
|
202
|
+
// N5: name collides with a workspace member but came from the registry.
|
|
203
|
+
throw new Error(`Environment for '${owner}': '${dep}' in '${memberPath}' is satisfied from the registry, not the workspace — align its version to the workspace member (or rename)`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return [...included.entries()].map(([p, name]) => ({ path: p, name })).sort((a, b) => byCodePoint(a.path, b.path));
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=environment-npm-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-npm-lock.js","sourceRoot":"","sources":["../../src/environment-npm-lock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,iEAAiE;AACjE,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAE3C,8EAA8E;AAC9E,yDAAyD;AACzD,EAAE;AACF,2EAA2E;AAC3E,qEAAqE;AACrE,6EAA6E;AAC7E,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,2EAA2E;AAC3E,qEAAqE;AACrE,8EAA8E;AAE9E,MAAM,cAAc,GAAG,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,CAAU,CAAC;AAe/F;gBACgB;AAChB,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,KAAK,GAAG,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;IAC3D,IAAI,GAA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,KAAK,CAAC,oBAAoB,KAAK,wBAAwB,GAAG,SAAS,UAAU,sCAAsC,MAAM,IAAI,CAAC,CAAC;gBAC3I,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;iBAAM,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,wEAAwE;gBACxE,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,OAAO,GAAG,SAAS,UAAU,6GAA6G,CAAC,CAAC;YACvL,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACrH,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/** One package of a uv lock. */
|
|
6
|
+
export interface UvLockPackage {
|
|
7
|
+
name: string;
|
|
8
|
+
source?: Record<string, string>;
|
|
9
|
+
dependencies?: Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
extra?: string[];
|
|
12
|
+
}>;
|
|
13
|
+
'optional-dependencies'?: Record<string, Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
extra?: string[];
|
|
16
|
+
}>>;
|
|
17
|
+
'dev-dependencies'?: Record<string, Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
extra?: string[];
|
|
20
|
+
}>>;
|
|
21
|
+
}
|
|
22
|
+
/** A uv lock, for what a capture reads of it. */
|
|
23
|
+
export interface UvLock {
|
|
24
|
+
version?: number;
|
|
25
|
+
/** The workspace's own: its members, and the settings it was resolved
|
|
26
|
+
* under that resolve a distribution otherwise than its dependents ask. */
|
|
27
|
+
manifest?: {
|
|
28
|
+
members?: string[];
|
|
29
|
+
overrides?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
specifier?: string;
|
|
32
|
+
}>;
|
|
33
|
+
excludes?: string[];
|
|
34
|
+
};
|
|
35
|
+
package?: UvLockPackage[];
|
|
36
|
+
}
|
|
37
|
+
/** Canonicalize a path for identity comparison — realpath when it exists,
|
|
38
|
+
* case-folded on win32 (uv.lock stores portable forward-slash relatives).
|
|
39
|
+
* @internal */
|
|
40
|
+
export declare function canonicalPath(p: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* A python distribution's name as PEP 503 writes it: lowercase, runs of `-`,
|
|
43
|
+
* `_` and `.` as one `-`.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* uv.lock stores canonical names while a `{ custom }` platform ref uses the
|
|
47
|
+
* import-style name (`platform_module`), so both sides must canonicalize
|
|
48
|
+
* before comparison (#391 — a strict match silently derived NO environment for
|
|
49
|
+
* any underscore-named member, leaving its source edits out of the task hash
|
|
50
|
+
* and serving stale cached outputs). e3-core names a tier's distributions by
|
|
51
|
+
* it too, and the image's script that writes a tier's manifest
|
|
52
|
+
* (`tier/tier-manifest.py` in `@elaraai/e3-core`) writes the same rule in
|
|
53
|
+
* python: a name both sides spell otherwise is no longer told to be the
|
|
54
|
+
* tier's.
|
|
55
|
+
*
|
|
56
|
+
* @param name - The name, as a lock, a manifest or a directory spells it
|
|
57
|
+
* @returns The canonical name
|
|
58
|
+
* @example
|
|
59
|
+
* canonicalPythonName('Typing_Extensions'); // 'typing-extensions'
|
|
60
|
+
*/
|
|
61
|
+
export declare function canonicalPythonName(name: string): string;
|
|
62
|
+
/** The on-disk directory a lock `source` points at, with its kind — or null
|
|
63
|
+
* for registry/git/url sources (installed by uv sync, not captured), and for
|
|
64
|
+
* a local archive (`path`), which no environment takes.
|
|
65
|
+
* @internal */
|
|
66
|
+
export declare function localSource(root: string, source: Record<string, string> | undefined): {
|
|
67
|
+
dir: string;
|
|
68
|
+
kind: 'editable' | 'directory' | 'virtual';
|
|
69
|
+
} | null;
|
|
70
|
+
/** A package a walk of a lock starts from: its name, and the extras it is
|
|
71
|
+
* installed with. */
|
|
72
|
+
export interface LockStart {
|
|
73
|
+
/** Its name, as the lock or a manifest spells it */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** The extras it is installed with; none unless given */
|
|
76
|
+
readonly extras?: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Every package of a lock that `starts` reach by what they depend on, each
|
|
80
|
+
* name once, in the order reached, with each of its entries: a name the lock
|
|
81
|
+
* locks at several versions, one for each platform it forks for, has
|
|
82
|
+
* several.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* A package is walked as an install takes it: through its dependencies, and
|
|
86
|
+
* the optional groups of the extras the dependency that reached it asked for;
|
|
87
|
+
* an extra another dependency asks for is walked when that one reaches it. So
|
|
88
|
+
* an extra of a registry package that nothing asks for is never walked, nor
|
|
89
|
+
* what only it names. A package `whole` says so of is walked through every
|
|
90
|
+
* group it names, its development groups among them, whatever reached it: a
|
|
91
|
+
* workspace's own package, whose walk may over-reach, since over-capture only
|
|
92
|
+
* over-invalidates.
|
|
93
|
+
*
|
|
94
|
+
* A registry package's dependency may be a local package: the lock resolves a
|
|
95
|
+
* name the workspace holds to the workspace's package.
|
|
96
|
+
*
|
|
97
|
+
* @internal
|
|
98
|
+
* @param lock - The lock
|
|
99
|
+
* @param starts - The packages to start from, with their extras
|
|
100
|
+
* @param whole - Whether a package is walked through every group it names;
|
|
101
|
+
* none is unless given
|
|
102
|
+
* @returns Each package reached, by its PEP 503 name, with its entries; none
|
|
103
|
+
* for a name the lock does not hold
|
|
104
|
+
* @example
|
|
105
|
+
* for (const { name, packages } of lockWalk(lock, [{ name: 'elaraai-east-py-datascience', extras: ['torch'] }])) needed.add(name);
|
|
106
|
+
*/
|
|
107
|
+
export declare function lockWalk(lock: UvLock, starts: Iterable<LockStart>, whole?: (pkg: UvLockPackage) => boolean): Generator<{
|
|
108
|
+
name: string;
|
|
109
|
+
packages: UvLockPackage[];
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Find the workspace/standalone root governing `project` and the lock
|
|
113
|
+
* package (`subject`) whose local source resolves to it.
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
* @throws {Error} P3 (no lock in project or any ancestor), P5 (unsupported
|
|
117
|
+
* lock version), P4 (lock does not list a package at `project`)
|
|
118
|
+
*/
|
|
119
|
+
export declare function discoverPythonRoot(project: string, owner: string): {
|
|
120
|
+
root: string;
|
|
121
|
+
lock: UvLock;
|
|
122
|
+
subject: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The LOCAL packages reachable from an environment's subjects, and from the
|
|
126
|
+
* registry distributions it requires beside them — the set whose sdists must
|
|
127
|
+
* ride the environment.
|
|
128
|
+
*
|
|
129
|
+
* Walks a local package through `dependencies` plus every optional-dependency
|
|
130
|
+
* and dev-dependency group (over-capture is sound: it only over-invalidates),
|
|
131
|
+
* and a registry package as an install takes it: through its dependencies
|
|
132
|
+
* and the extras asked of it ({@link lockWalk}). A registry package is
|
|
133
|
+
* installed from the lock, and a local package it depends on rides as an
|
|
134
|
+
* sdist, as the installs take no local package from a registry. A
|
|
135
|
+
* `path=<archive>` source the walk reaches is refused — never one only an
|
|
136
|
+
* extra nothing asks for names — and a virtual package contributes its deps
|
|
137
|
+
* but no sdist.
|
|
138
|
+
*
|
|
139
|
+
* @internal
|
|
140
|
+
* @param subjects - The members the environment is of, by the lock's names
|
|
141
|
+
* @param required - The registry distributions it requires beside them, with
|
|
142
|
+
* the extras each is installed with
|
|
143
|
+
* @returns The buildable closure members, sorted by name
|
|
144
|
+
* @throws {Error} P6 (dangling edge), P7 (subject not packaged), P8 (source
|
|
145
|
+
* dir missing), P9 (local archive dependency)
|
|
146
|
+
*/
|
|
147
|
+
export declare function pythonClosure(lock: UvLock, root: string, subjects: readonly string[], owner: string, required?: readonly LockStart[]): Array<{
|
|
148
|
+
name: string;
|
|
149
|
+
dir: string;
|
|
150
|
+
}>;
|
|
151
|
+
/**
|
|
152
|
+
* Walk up from `start` to the nearest `uv.lock`, parse and version-check it.
|
|
153
|
+
* Returns the governing workspace/standalone root + parsed lock, or null when
|
|
154
|
+
* no lock exists in `start` or any ancestor (no uv workspace to derive from).
|
|
155
|
+
*
|
|
156
|
+
* @internal
|
|
157
|
+
* @throws {Error} if a lock is found but its version is unsupported
|
|
158
|
+
*/
|
|
159
|
+
export declare function findUvLock(start: string, owner: string): {
|
|
160
|
+
root: string;
|
|
161
|
+
lock: UvLock;
|
|
162
|
+
} | null;
|
|
163
|
+
/**
|
|
164
|
+
* The registry distributions a workspace member's environment installs beside
|
|
165
|
+
* the member's own dependencies: the runtime's, and those of the stock
|
|
166
|
+
* platform packages its task's runner names, as the lock pins them.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* A workspace commonly lists these on its root alone, which an environment
|
|
170
|
+
* that installs a member's dependencies would otherwise leave out. A stock
|
|
171
|
+
* platform package `east-py-std` is the distribution `elaraai-east-py-std`.
|
|
172
|
+
* One the lock does not hold, or holds as a local package, is not named: the
|
|
173
|
+
* first comes from wherever the task runs, the second rides as an sdist.
|
|
174
|
+
*
|
|
175
|
+
* Each is named with the extras the workspace declares it with, on its root
|
|
176
|
+
* or on any member (`elaraai-east-py-datascience[lightning]`): a member
|
|
177
|
+
* whose task names the platform, and does not list the distribution itself,
|
|
178
|
+
* runs with what the workspace asked of it, torch among it.
|
|
179
|
+
*
|
|
180
|
+
* One the lock holds as a local archive (`path`) is refused, as a member's
|
|
181
|
+
* own is: an install would otherwise take a registry's copy of it.
|
|
182
|
+
*
|
|
183
|
+
* @internal
|
|
184
|
+
* @param root - The workspace root
|
|
185
|
+
* @param lock - Its lock
|
|
186
|
+
* @param platforms - The platform packages the runner names
|
|
187
|
+
* @param owner - The declaring task or function, which a refusal names
|
|
188
|
+
* @returns The distributions, by PEP 503 name and with their extras, sorted
|
|
189
|
+
* @throws {Error} When the lock holds one of them as a local archive
|
|
190
|
+
*/
|
|
191
|
+
export declare function pythonRequires(root: string, lock: UvLock, platforms: readonly string[], owner: string): string[];
|
|
192
|
+
/**
|
|
193
|
+
* A required distribution, as {@link pythonRequires} names one: its name, and
|
|
194
|
+
* the extras it is installed with.
|
|
195
|
+
*
|
|
196
|
+
* @param required - A name, or a name with its extras
|
|
197
|
+
* (`elaraai-east-py-datascience[lightning,torch]`)
|
|
198
|
+
* @returns Its name and extras; null for what is neither, which its reader
|
|
199
|
+
* refuses in its own words
|
|
200
|
+
* @example
|
|
201
|
+
* readRequiredDistribution('elaraai-east-py-datascience[torch]'); // { name: 'elaraai-east-py-datascience', extras: ['torch'] }
|
|
202
|
+
*/
|
|
203
|
+
export declare function readRequiredDistribution(required: string): {
|
|
204
|
+
name: string;
|
|
205
|
+
extras: string[];
|
|
206
|
+
} | null;
|
|
207
|
+
/**
|
|
208
|
+
* The packages of a workspace's lock, by the lock's names, that the sync
|
|
209
|
+
* installing an environment's required distributions leaves out: every one it
|
|
210
|
+
* installs from an index, a repository or a URL but those the required
|
|
211
|
+
* distributions need, with their extras, and what those depend on.
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* So that sync installs the required distributions as the lock pins them and
|
|
215
|
+
* from where the lock pins them — an explicit index of the workspace's
|
|
216
|
+
* among them, which no install that resolves again from a registry reads —
|
|
217
|
+
* and nothing else. A local package one of them depends on rides as an sdist
|
|
218
|
+
* ({@link pythonClosure}), and no sync of an environment installs a local
|
|
219
|
+
* package: none is taken from a registry.
|
|
220
|
+
*
|
|
221
|
+
* What a distribution needs is read from the lock for every platform it was
|
|
222
|
+
* resolved for, its markers aside: one a platform does not need is in no
|
|
223
|
+
* install for that platform, which the sync decides.
|
|
224
|
+
*
|
|
225
|
+
* @internal
|
|
226
|
+
* @param lockText - The lock, as `uv.lock` holds it
|
|
227
|
+
* @param requires - The required distributions, each a name or a name with
|
|
228
|
+
* its extras (`elaraai-east-py-datascience[lightning,torch]`), as
|
|
229
|
+
* {@link pythonRequires} names them
|
|
230
|
+
* @returns The names, sorted
|
|
231
|
+
* @throws {Error} When the lock is not of the version this reads, or a
|
|
232
|
+
* required distribution is not a name with or without extras
|
|
233
|
+
* @example
|
|
234
|
+
* const leftOut = pythonLeftOut(await readFile('uv.lock', 'utf8'), ['elaraai-east-py-datascience[torch]']);
|
|
235
|
+
* // uv sync --frozen --inexact --all-packages ... --no-install-package <each>
|
|
236
|
+
*/
|
|
237
|
+
export declare function pythonLeftOut(lockText: string, requires: readonly string[]): string[];
|
|
238
|
+
/**
|
|
239
|
+
* A required distribution, as {@link pythonRequires} names one, as a walk of
|
|
240
|
+
* the lock starts from it.
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
243
|
+
* @param required - A name, or a name with its extras
|
|
244
|
+
* @returns The distribution, with its extras
|
|
245
|
+
* @throws {Error} When it is neither
|
|
246
|
+
*/
|
|
247
|
+
export declare function requiredStart(required: string): LockStart;
|
|
248
|
+
/**
|
|
249
|
+
* The settings a workspace's lock was resolved under that resolve a
|
|
250
|
+
* distribution otherwise than a package depending on it asks: what its
|
|
251
|
+
* `override-dependencies` name, whose version may be one a dependent's
|
|
252
|
+
* requirement does not allow, and what its `exclude-dependencies` name, which
|
|
253
|
+
* nothing installs though a dependent requires it.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* The lock records both in its manifest, and a sync of it installs as they
|
|
257
|
+
* say. A check of what is installed against each distribution's own
|
|
258
|
+
* requirements, as `uv pip check` makes, knows neither, so an environment
|
|
259
|
+
* materialized from the lock is checked with them.
|
|
260
|
+
*
|
|
261
|
+
* @internal
|
|
262
|
+
* @param lockText - The lock, as `uv.lock` holds it
|
|
263
|
+
* @returns The distributions overridden, and those excluded, each by PEP 503
|
|
264
|
+
* name, sorted
|
|
265
|
+
* @throws {Error} When the lock is not of the version this reads
|
|
266
|
+
* @example
|
|
267
|
+
* // Under `override-dependencies = ["shap>=0.51.0"]`
|
|
268
|
+
* pythonLockSettings(await readFile('uv.lock', 'utf8')); // { overrides: ['shap'], excludes: [] }
|
|
269
|
+
*/
|
|
270
|
+
export declare function pythonLockSettings(lockText: string): {
|
|
271
|
+
overrides: string[];
|
|
272
|
+
excludes: string[];
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* The local uv-workspace member a name refers to — the package a `{ custom }`
|
|
276
|
+
* platform or an `East.importFunction(pkg, …)` names (#652) — resolved the
|
|
277
|
+
* way `captureAutoEnvironment` resolves it: the governing `uv.lock`
|
|
278
|
+
* above `anchorDir`, matched by PEP 503 canonical name, local sources only.
|
|
279
|
+
*
|
|
280
|
+
* @param name - The package name as referenced (import-style or canonical)
|
|
281
|
+
* @param anchorDir - Directory the workspace is resolved from (the export cwd)
|
|
282
|
+
* @param owner - The referencing task/function name, for error messages
|
|
283
|
+
* @returns The member's directory and its `pyproject.toml` version, or null
|
|
284
|
+
* when there is no uv workspace above `anchorDir` or the name is not a
|
|
285
|
+
* local member (a registry package, a typo)
|
|
286
|
+
*/
|
|
287
|
+
export declare function pythonWorkspaceMember(name: string, anchorDir: string, owner: string): {
|
|
288
|
+
dir: string;
|
|
289
|
+
version: string | null;
|
|
290
|
+
} | null;
|
|
291
|
+
/**
|
|
292
|
+
* Where a python workspace member's code can come from (#1459): the governing
|
|
293
|
+
* workspace's root — whose `uv.lock` and `pyproject.toml` pin everything else
|
|
294
|
+
* — and the directories of the member and of every local package it depends
|
|
295
|
+
* on, transitively, as `captureAutoEnvironment` walks them ({@link lockWalk}).
|
|
296
|
+
* What the export cache keys a member's manifests on.
|
|
297
|
+
*
|
|
298
|
+
* Unlike the environment's walk this refuses nothing: a virtual package's
|
|
299
|
+
* directory counts, and a registry or archive package is pinned by the lock.
|
|
300
|
+
*
|
|
301
|
+
* @param name - The package name as referenced (import-style or canonical)
|
|
302
|
+
* @param anchorDir - Directory the workspace is resolved from (the export cwd)
|
|
303
|
+
* @param owner - The referencing task/function name, for error messages
|
|
304
|
+
* @returns The workspace root and the closure's directories, sorted, or null
|
|
305
|
+
* when there is no uv workspace above `anchorDir` or the name is not a
|
|
306
|
+
* local member
|
|
307
|
+
*/
|
|
308
|
+
export declare function pythonMemberSources(name: string, anchorDir: string, owner: string): {
|
|
309
|
+
root: string;
|
|
310
|
+
dirs: string[];
|
|
311
|
+
} | null;
|
|
312
|
+
//# sourceMappingURL=environment-uv-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-uv-lock.d.ts","sourceRoot":"","sources":["../../src/environment-uv-lock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyCH,gCAAgC;AAChC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC,CAAC;IACpF,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC,CAAC;CAChF;AACD,iDAAiD;AACjD,MAAM,WAAW,MAAM;IACrB,OAA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