UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

31 lines (30 loc) • 1.18 kB
import { i as runtimeProcessDependencyEntrypoints } from "./runtime-process-manifest-DmUAODRC.mjs"; import { n as resolveRuntimeDependencyEntrypointUrl } from "./runtime-process-dependency-url-DZ5qlXt3.mjs"; import fs from "node:fs"; import { fileURLToPath } from "node:url"; //#region src/infra/npm-command.ts /** Runs the packaged npm CLI with the current JavaScript runtime. */ function resolveBundledNpmCommand(e) { let t = runtimeProcessDependencyEntrypoints.npm.specifier; try { const n = fileURLToPath(resolveRuntimeDependencyEntrypointUrl("npm", import.meta.url)); t = n; if (!fs.statSync(n).isFile()) throw new Error("Not a regular file"); return [ process.execPath, n, ...e ]; } catch (e) { throw Object.assign(new Error(`Bundled npm CLI is missing: ${t}. Reinstall OpenClaw to restore npm/bin/npm-cli.js.`, { cause: e }), { code: "BUNDLED_NPM_CLI_NOT_FOUND", name: "BundledNpmCliNotFoundError" }); } } /** Bun must run the packaged CLI directly; npm's executable requires Node. */ function resolveNpmCommand(e) { return process.versions.bun ? resolveBundledNpmCommand(e) : ["npm", ...e]; } //#endregion export { resolveNpmCommand as t };