MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / removeOptionalEsbuildDeps

Function removeOptionalEsbuildDeps

install/install.ts:296–316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294};
295
296function removeOptionalEsbuildDeps() {
297 const yarnGlobalPath = exec('yarn global dir').output?.trim() || '';
298 if (!yarnGlobalPath) return false;
299 const pkgjson = `${yarnGlobalPath}/package.json`;
300 const data = existsSync(pkgjson) ? require(pkgjson) : {};
301 data.resolutions ||= {};
302 Object.assign(data.resolutions, Object.fromEntries([
303 '@esbuild/linux-loong64',
304 'esbuild-windows-32',
305 ...['android', 'darwin', 'freebsd', 'windows']
306 .flatMap((i) => [`${i}-64`, `${i}-arm64`])
307 .map((i) => `esbuild-${i}`),
308 ...['32', 'arm', 'mips64', 'ppc64', 'riscv64', 's390x']
309 .map((i) => `esbuild-linux-${i}`),
310 ...['netbsd', 'openbsd', 'sunos']
311 .map((i) => `esbuild-${i}-64`),
312 ].map((i) => [i, 'link:/dev/null'])));
313 exec(`mkdir -p ${yarnGlobalPath}`);
314 writeFileSync(pkgjson, JSON.stringify(data, null, 2));
315 return true;
316}
317
318function rollbackResolveField() {
319 const yarnGlobalPath = exec('yarn global dir').output?.trim() || '';

Callers 1

StepsFunction · 0.85

Calls 1

execFunction · 0.70

Tested by

no test coverage detected