






















@@ -1,10 +1,14 @@
1-import { spawnSync } from "node:child_process";
21import { createHash } from "node:crypto";
32import fs from "node:fs";
43import path from "node:path";
54import { performance } from "node:perf_hooks";
65import { pathToFileURL } from "node:url";
76import semverSatisfies from "semver/functions/satisfies.js";
7+import {
8+createBundledRuntimeDependencyInstallArgs,
9+createBundledRuntimeDependencyInstallEnv,
10+runBundledRuntimeDependencyNpmInstall,
11+} from "./lib/bundled-runtime-deps-install.mjs";
812import { resolveNpmRunner } from "./npm-runner.mjs";
9131014const TRANSIENT_TEMP_REMOVE_ERROR_CODES = new Set(["EBUSY", "ENOTEMPTY", "EPERM"]);
@@ -905,39 +909,17 @@ function createRuntimeInstallManifest(pluginId, pinnedGroups) {
905909}
906910907911function runNpmInstall(params) {
908-const npmEnv = {
909- ...(params.npmRunner.env ?? process.env),
910-CI: "1",
911-npm_config_audit: "false",
912-npm_config_dry_run: "false",
913-npm_config_fetch_retries: process.env.npm_config_fetch_retries ?? "5",
914-npm_config_fetch_retry_maxtimeout: process.env.npm_config_fetch_retry_maxtimeout ?? "120000",
915-npm_config_fetch_retry_mintimeout: process.env.npm_config_fetch_retry_mintimeout ?? "10000",
916-npm_config_fetch_timeout: process.env.npm_config_fetch_timeout ?? "300000",
917-npm_config_fund: "false",
918-npm_config_legacy_peer_deps: "true",
919-npm_config_loglevel: "error",
920-npm_config_package_lock: "false",
921-npm_config_progress: "false",
922-npm_config_save: "false",
923-npm_config_yes: "true",
924-};
925-const runSpawnSync = params.spawnSyncImpl ?? spawnSync;
926-const result = runSpawnSync(params.npmRunner.command, params.npmRunner.args, {
912+return runBundledRuntimeDependencyNpmInstall({
927913cwd: params.cwd,
928-encoding: "utf8",
929-env: npmEnv,
930-shell: params.npmRunner.shell,
914+npmRunner: params.npmRunner,
915+env: createBundledRuntimeDependencyInstallEnv(params.npmRunner.env ?? process.env, {
916+ci: true,
917+quiet: true,
918+}),
919+spawnSyncImpl: params.spawnSyncImpl,
931920stdio: ["ignore", "pipe", "pipe"],
932921timeout: params.timeoutMs ?? 5 * 60 * 1000,
933-windowsHide: true,
934-windowsVerbatimArguments: params.npmRunner.windowsVerbatimArguments,
935922});
936-if (result.status === 0) {
937-return;
938-}
939-const output = [result.stderr, result.stdout].filter(Boolean).join("\n").trim();
940-throw new Error(output || "npm install failed");
941923}
942924943925function resolveLegacyRuntimeDepsStampPath(pluginDir) {
@@ -1203,7 +1185,11 @@ function installPluginRuntimeDeps(params) {
12031185runNpmInstall({
12041186cwd: tempInstallDir,
12051187npmRunner: resolveNpmRunner({
1206-npmArgs: ["install", "--no-audit", "--no-fund", "--ignore-scripts", "--silent"],
1188+npmArgs: createBundledRuntimeDependencyInstallArgs([], {
1189+noAudit: true,
1190+noFund: true,
1191+silent: true,
1192+}),
12071193}),
12081194});
12091195}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。