← Files RivetARCHIVED FILE
node_modules/rivet-design/dist/services/packageManagerProcess.js
2.49 KB · Nov 7, 2026 · 13:16 UTC
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.spawnProcessSync = exports.spawnProcess = exports.describeProcessCommand = exports.resolveProcessInvocation = void 0;
const child_process_1 = require("child_process");
const subprocessEnvironment_1 = require("../utils/subprocessEnvironment");
const OperatingSystemServices_1 = require("./OperatingSystemServices");
const NATIVE_WINDOWS_PACKAGE_MANAGERS = new Set([
'bun',
]);
const buildWindowsPackageManagerCommand = (packageManager, args) => NATIVE_WINDOWS_PACKAGE_MANAGERS.has(packageManager)
? (0, OperatingSystemServices_1.buildWindowsShellCommand)({ executable: packageManager, args })
: (0, OperatingSystemServices_1.buildWindowsBatchShimCommand)({ executable: packageManager, args });
const resolveProcessInvocation = (command, platform = process.platform) => {
if ('executable' in command) {
return {
file: command.executable,
args: command.args,
isShellRequired: false,
};
}
if (platform === 'win32') {
return {
file: buildWindowsPackageManagerCommand(command.packageManager, command.args),
args: [],
isShellRequired: true,
};
}
return {
file: command.packageManager,
args: command.args,
isShellRequired: false,
};
};
exports.resolveProcessInvocation = resolveProcessInvocation;
const describeProcessCommand = (command) => 'executable' in command ? command.executable : command.packageManager;
exports.describeProcessCommand = describeProcessCommand;
const spawnProcess = (command, options) => {
const invocation = (0, exports.resolveProcessInvocation)(command);
return (0, child_process_1.spawn)(invocation.file, invocation.args, {
...options,
env: options.env ?? (0, subprocessEnvironment_1.subprocessEnvironment)('packageManager'),
shell: invocation.isShellRequired,
windowsHide: true,
});
};
exports.spawnProcess = spawnProcess;
const spawnProcessSync = (command, options) => {
const invocation = (0, exports.resolveProcessInvocation)(command);
return (0, child_process_1.spawnSync)(invocation.file, invocation.args, {
...options,
env: options.env ?? (0, subprocessEnvironment_1.subprocessEnvironment)('packageManager'),
encoding: 'utf8',
shell: invocation.isShellRequired,
windowsHide: true,
});
};
exports.spawnProcessSync = spawnProcessSync;
//# sourceMappingURL=packageManagerProcess.js.mapSHA-256: eff4e12e1c0c38797f7c57aeaf5bdd0820ff563312bc625706659c88a2c747d8