Repository: microsoft/playwright
File: packages/playwright-core/src/server/registry/index.ts (TypeScript)

Code before:
    'win-x64': ['Playwright.exe'],
  },
  'ffmpeg': {
    '<unknown>': undefined,
    'linux-x64': ['ffmpeg-linux'],
    'linux-arm64': ['ffmpeg-linux'],
    'mac-x64': ['ffmpeg-mac'],
    'mac-arm64': ['ffmpeg-mac'],
    'win-x64': ['ffmpeg-win64.exe'],
  },
  'winldd': {
    '<unknown>': undefined,
    'linux-x64': undefined,
    'linux-arm64': undefined,
    'mac-x64': undefined,
    'mac-arm64': undefined,
    'win-x64': ['PrintDeps.exe'],
  },
};

type DownloadPathFunction = (params: BrowsersJSONDescriptor) => { path: string, mirrors: string[] };

function cftUrl(suffix: string): DownloadPathFunction {
  return ({ browserVersion }) => {
    return {
      path: `${browserVersion}/${suffix}`,
      mirrors: [
        'https://cdn.playwright.dev/chrome-for-testing-public',
      ],
    };
  };
}

type DownloadPaths = Record<HostPlatform, string | DownloadPathFunction | undefined>;
const DOWNLOAD_PATHS: Record<string, DownloadPaths> = {
  'chromium': {
    '<unknown>': undefined,
    'ubuntu18.04-x64': undefined,
    'ubuntu20.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu22.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu24.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu18.04-arm64': undefined,
    'ubuntu20.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'ubuntu22.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'ubuntu24.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian11-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian11-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian12-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian12-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian13-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian13-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',

Review comment (suggestion):
@dgozman This change requests all mirrors update their locations? For example

https://cdn.npmmirror.com/binaries/chrome-for-testing/145.0.7632.6/mac-arm64/chrome-mac-arm64.zip (OK)

vs

https://cdn.npmmirror.com/binaries/chrome-for-testing/builds/cft/145.0.7632.6/mac-arm64/chrome-mac-arm64.zip (404)

---

See also https://github.com/cnpm/cnpmcore/issues/965#issuecomment-3965006972

Code after:
    'win-x64': ['Playwright.exe'],
  },
  'ffmpeg': {
    '<unknown>': undefined,
    'linux-x64': ['ffmpeg-linux'],
    'linux-arm64': ['ffmpeg-linux'],
    'mac-x64': ['ffmpeg-mac'],
    'mac-arm64': ['ffmpeg-mac'],
    'win-x64': ['ffmpeg-win64.exe'],
  },
  'winldd': {
    '<unknown>': undefined,
    'linux-x64': undefined,
    'linux-arm64': undefined,
    'mac-x64': undefined,
    'mac-arm64': undefined,
    'win-x64': ['PrintDeps.exe'],
  },
};

type DownloadPathFunction = (params: BrowsersJSONDescriptor) => { path: string, mirrors: string[] };

function cftUrl(suffix: string): DownloadPathFunction {
  return ({ browserVersion }) => {
    return {
      path: `builds/cft/${browserVersion}/${suffix}`,
      mirrors: [
        'https://cdn.playwright.dev',
      ],
    };
  };
}

type DownloadPaths = Record<HostPlatform, string | DownloadPathFunction | undefined>;
const DOWNLOAD_PATHS: Record<string, DownloadPaths> = {
  'chromium': {
    '<unknown>': undefined,
    'ubuntu18.04-x64': undefined,
    'ubuntu20.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu22.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu24.04-x64': cftUrl('linux64/chrome-linux64.zip'),
    'ubuntu18.04-arm64': undefined,
    'ubuntu20.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'ubuntu22.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'ubuntu24.04-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian11-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian11-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian12-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian12-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
    'debian13-x64': cftUrl('linux64/chrome-linux64.zip'),
    'debian13-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',