remote-native-search-tools-config.mjs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { resolve } from "node:path";
  2. import process from "node:process";
  3. import {
  4. NATIVE_SEARCH_DEPENDENCIES_DIR,
  5. resolveNativeSearchBuildPlan,
  6. resolveNativeSearchPrebuiltPlan,
  7. } from "./native-search-tools-config.mjs";
  8. export const LEGACY_REMOTE_RIPGREP_VERSION = "v13.0.0-10";
  9. export const LEGACY_REMOTE_RIPGREP_ARCHIVE_SHA256_BY_TARGET = Object.freeze({
  10. "darwin-arm64": "de44338ca53677968bdd7403ddc1cf9c735e708f7b63e3b34367f9411010a7db",
  11. "darwin-x64": "3b501c05ff9b1d24ae8897dd1c6b5bf842fd12a6f7114264407ac42bc222b25b",
  12. "linux-arm64": "705fc9bcd14baa18bd4dda8fe0651bff440fc0fb934fcdb8e745a85efd7b2afa",
  13. "linux-x64": "ef820a62c1d6fdc396646762ff0f0e47e127947073ed8b5aa4ceea8b61cb1659",
  14. "win32-arm64": "6c12d2c95073a4b981e5706981f42327b6359fc4cd7449ebd11f6769768dea97",
  15. "win32-x64": "7b35b95cf3d7f92d8fe087006899617b1b5a6dac4bbed5d4f6ace6f0934799dc",
  16. });
  17. export function resolveRemoteNativeSearchPrebuiltPlan({
  18. platform = process.platform,
  19. arch = process.arch,
  20. outputDir,
  21. dependenciesDir = NATIVE_SEARCH_DEPENDENCIES_DIR,
  22. } = {}) {
  23. const buildPlan = resolveNativeSearchBuildPlan({ platform, arch, outputDir });
  24. if (buildPlan.platform === "linux") {
  25. return resolveNativeSearchPrebuiltPlan({ platform, arch, outputDir, dependenciesDir });
  26. }
  27. if (buildPlan.platform !== "darwin") {
  28. throw new Error(`unsupported remote native search target ${buildPlan.platformKey}`);
  29. }
  30. // macOS remote retains rg13; Desktop and SEA use the default rg14 plan.
  31. const release = LEGACY_REMOTE_RIPGREP_VERSION;
  32. const archiveTarget = `${buildPlan.arch === "arm64" ? "aarch64" : "x86_64"}-apple-darwin.tar.gz`;
  33. const releaseFileName = `ripgrep-${release}-${archiveTarget}`;
  34. return {
  35. platform: buildPlan.platform,
  36. arch: buildPlan.arch,
  37. platformKey: buildPlan.platformKey,
  38. outputDir: buildPlan.outputDir,
  39. runtimeToolIds: ["ripgrep"],
  40. producerOutputIds: [],
  41. binaries: { ripgrep: buildPlan.rgPath },
  42. rgPath: buildPlan.rgPath,
  43. artifacts: [
  44. {
  45. toolId: "ripgrep",
  46. version: "13.0.0",
  47. release,
  48. releaseFileName,
  49. archiveExt: "tar.gz",
  50. archiveSha256: LEGACY_REMOTE_RIPGREP_ARCHIVE_SHA256_BY_TARGET[buildPlan.platformKey],
  51. binaryName: "rg",
  52. binaryPath: buildPlan.rgPath,
  53. archivePath: resolve(dependenciesDir, `ripgrep-${release}`, releaseFileName),
  54. source: "official",
  55. },
  56. ],
  57. };
  58. }