chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -15,9 +15,8 @@ const internalPackagePrefix = "@earendil-works/pi-";
|
||||
const internalPackageNames = new Set(["@earendil-works/chord"]);
|
||||
const installPackageName = "@earendil-works/pi-coding-agent-install";
|
||||
const allowedInstallScriptPackages = new Map([
|
||||
["@google/genai@1.52.0", "preinstall is a no-op in the published package"],
|
||||
["esbuild@0.28.1", "postinstall selects and verifies the platform-specific esbuild binary"],
|
||||
["protobufjs@7.6.5", "postinstall only warns about protobufjs version scheme mismatches"],
|
||||
["@google/genai@2.21.0", "preinstall is a no-op in the published package"],
|
||||
["protobufjs@7.6.6", "postinstall only warns about protobufjs version scheme mismatches"],
|
||||
]);
|
||||
|
||||
const args = new Set(process.argv.slice(2));
|
||||
@@ -211,22 +210,36 @@ function addInternalWorkspace(installLockPackages, addedPaths, queue, name, work
|
||||
addedPaths.add(outputPath);
|
||||
|
||||
for (const dependencyName of Object.keys(packageDependencies(packageJson))) {
|
||||
queue.push({ name: dependencyName, from: outputPath });
|
||||
queue.push({
|
||||
name: dependencyName,
|
||||
sourceFrom: workspace.lockPath,
|
||||
sourceBase: workspace.lockPath,
|
||||
outputBase: outputPath,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addExternalPackage(lockPackages, installLockPackages, addedPaths, queue, name, from) {
|
||||
const lockPath = resolveExternalDependency(lockPackages, name, from);
|
||||
if (addedPaths.has(lockPath)) {
|
||||
function addExternalPackage(lockPackages, installLockPackages, addedPaths, queue, item) {
|
||||
const sourceLockPath = resolveExternalDependency(lockPackages, item.name, item.sourceFrom);
|
||||
const outputLockPath =
|
||||
item.sourceBase && sourceLockPath.startsWith(`${item.sourceBase}/`)
|
||||
? [item.outputBase, sourceLockPath.slice(item.sourceBase.length + 1)].filter(Boolean).join("/")
|
||||
: sourceLockPath;
|
||||
if (addedPaths.has(outputLockPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const entry = lockPackages[lockPath];
|
||||
installLockPackages[lockPath] = copyLockEntry(entry);
|
||||
addedPaths.add(lockPath);
|
||||
const entry = lockPackages[sourceLockPath];
|
||||
installLockPackages[outputLockPath] = copyLockEntry(entry);
|
||||
addedPaths.add(outputLockPath);
|
||||
|
||||
for (const dependencyName of Object.keys(packageDependencies(entry))) {
|
||||
queue.push({ name: dependencyName, from: lockPath });
|
||||
queue.push({
|
||||
name: dependencyName,
|
||||
sourceFrom: sourceLockPath,
|
||||
sourceBase: item.sourceBase,
|
||||
outputBase: item.outputBase,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,12 +363,6 @@ function validateGeneratedFiles(installerPackageJson, installLock, internalNames
|
||||
}
|
||||
}
|
||||
|
||||
const platformPackageCount = Object.values(installLock.packages).filter((entry) => entry.os || entry.cpu || entry.libc)
|
||||
.length;
|
||||
if (platformPackageCount === 0) {
|
||||
errors.push("no platform-specific optional dependency entries found");
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new Error(`Generated installer lock failed validation:\n${errors.map((error) => ` - ${error}`).join("\n")}`);
|
||||
}
|
||||
@@ -376,7 +383,10 @@ function generateInstallLock() {
|
||||
};
|
||||
const addedPaths = new Set([""]);
|
||||
const internalNames = new Set();
|
||||
const queue = Object.keys(packageDependencies(installerPackageJson)).map((name) => ({ name, from: "" }));
|
||||
const queue = Object.keys(packageDependencies(installerPackageJson)).map((name) => ({
|
||||
name,
|
||||
sourceFrom: "",
|
||||
}));
|
||||
|
||||
while (queue.length > 0) {
|
||||
const item = queue.shift();
|
||||
@@ -394,7 +404,7 @@ function generateInstallLock() {
|
||||
continue;
|
||||
}
|
||||
|
||||
addExternalPackage(lockPackages, installLockPackages, addedPaths, queue, item.name, item.from);
|
||||
addExternalPackage(lockPackages, installLockPackages, addedPaths, queue, item);
|
||||
}
|
||||
|
||||
const installLock = {
|
||||
|
||||
Reference in New Issue
Block a user