patchright-bun-core 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. package/README.md +2 -2
  2. package/ThirdPartyNotices.txt +3551 -4075
  3. package/bin/install_media_pack.ps1 +5 -5
  4. package/bin/install_webkit_wsl.ps1 +32 -32
  5. package/bin/reinstall_chrome_beta_linux.sh +42 -42
  6. package/bin/reinstall_chrome_beta_mac.sh +13 -13
  7. package/bin/reinstall_chrome_beta_win.ps1 +24 -24
  8. package/bin/reinstall_chrome_stable_linux.sh +42 -42
  9. package/bin/reinstall_chrome_stable_mac.sh +12 -12
  10. package/bin/reinstall_chrome_stable_win.ps1 +24 -24
  11. package/bin/reinstall_msedge_beta_linux.sh +48 -48
  12. package/bin/reinstall_msedge_beta_mac.sh +11 -11
  13. package/bin/reinstall_msedge_beta_win.ps1 +23 -23
  14. package/bin/reinstall_msedge_dev_linux.sh +48 -48
  15. package/bin/reinstall_msedge_dev_mac.sh +11 -11
  16. package/bin/reinstall_msedge_dev_win.ps1 +23 -23
  17. package/bin/reinstall_msedge_stable_linux.sh +48 -48
  18. package/bin/reinstall_msedge_stable_mac.sh +11 -11
  19. package/bin/reinstall_msedge_stable_win.ps1 +23 -23
  20. package/browsers.json +81 -79
  21. package/cli.js +18 -18
  22. package/index.d.ts +17 -17
  23. package/index.js +32 -32
  24. package/index.mjs +28 -28
  25. package/lib/androidServerImpl.js +65 -65
  26. package/lib/bootstrap.js +77 -0
  27. package/lib/browserServerImpl.js +120 -120
  28. package/lib/cli/browserActions.js +308 -0
  29. package/lib/cli/driver.js +98 -97
  30. package/lib/cli/installActions.js +171 -0
  31. package/lib/cli/program.js +225 -589
  32. package/lib/cli/programWithTestStub.js +74 -74
  33. package/lib/client/android.js +361 -361
  34. package/lib/client/api.js +137 -137
  35. package/lib/client/artifact.js +79 -79
  36. package/lib/client/browser.js +169 -161
  37. package/lib/client/browserContext.js +563 -582
  38. package/lib/client/browserType.js +153 -185
  39. package/lib/client/cdpSession.js +55 -51
  40. package/lib/client/channelOwner.js +194 -194
  41. package/lib/client/clientHelper.js +64 -64
  42. package/lib/client/clientInstrumentation.js +55 -55
  43. package/lib/client/clientStackTrace.js +69 -69
  44. package/lib/client/clock.js +68 -68
  45. package/lib/client/{webSocket.js → connect.js} +143 -93
  46. package/lib/client/connection.js +322 -318
  47. package/lib/client/consoleMessage.js +61 -58
  48. package/lib/client/coverage.js +44 -44
  49. package/lib/client/debugger.js +57 -0
  50. package/lib/client/dialog.js +63 -56
  51. package/lib/client/disposable.js +76 -0
  52. package/lib/client/download.js +62 -62
  53. package/lib/client/electron.js +139 -138
  54. package/lib/client/elementHandle.js +281 -284
  55. package/lib/client/errors.js +77 -77
  56. package/lib/client/eventEmitter.js +314 -314
  57. package/lib/client/events.js +103 -103
  58. package/lib/client/fetch.js +367 -368
  59. package/lib/client/fileChooser.js +46 -46
  60. package/lib/client/fileUtils.js +34 -34
  61. package/lib/client/frame.js +404 -409
  62. package/lib/client/harRouter.js +99 -87
  63. package/lib/client/input.js +84 -84
  64. package/lib/client/jsHandle.js +105 -109
  65. package/lib/client/jsonPipe.js +39 -39
  66. package/lib/client/localUtils.js +60 -60
  67. package/lib/client/locator.js +367 -369
  68. package/lib/client/network.js +750 -747
  69. package/lib/client/page.js +731 -745
  70. package/lib/client/platform.js +74 -77
  71. package/lib/client/playwright.js +71 -71
  72. package/lib/client/screencast.js +88 -0
  73. package/lib/client/selectors.js +57 -55
  74. package/lib/client/stream.js +39 -39
  75. package/lib/client/timeoutSettings.js +79 -79
  76. package/lib/client/tracing.js +126 -119
  77. package/lib/client/types.js +28 -28
  78. package/lib/client/video.js +52 -59
  79. package/lib/client/waiter.js +142 -142
  80. package/lib/client/webError.js +39 -39
  81. package/lib/client/worker.js +85 -85
  82. package/lib/client/writableStream.js +39 -39
  83. package/lib/generated/bindingsControllerSource.js +28 -28
  84. package/lib/generated/clockSource.js +28 -28
  85. package/lib/generated/injectedScriptSource.js +28 -28
  86. package/lib/generated/pollingRecorderSource.js +28 -28
  87. package/lib/generated/storageScriptSource.js +28 -28
  88. package/lib/generated/utilityScriptSource.js +28 -28
  89. package/lib/generated/webSocketMockSource.js +336 -336
  90. package/lib/inProcessFactory.js +60 -60
  91. package/lib/inprocess.js +3 -3
  92. package/lib/mcpBundle.js +78 -84
  93. package/lib/mcpBundleImpl.js +91 -0
  94. package/lib/outofprocess.js +76 -76
  95. package/lib/protocol/serializers.js +197 -197
  96. package/lib/protocol/validator.js +3067 -2969
  97. package/lib/protocol/validatorPrimitives.js +193 -193
  98. package/lib/remote/playwrightConnection.js +131 -129
  99. package/lib/remote/playwrightPipeServer.js +100 -0
  100. package/lib/remote/playwrightServer.js +339 -334
  101. package/lib/remote/playwrightWebSocketServer.js +73 -0
  102. package/lib/remote/serverTransport.js +96 -0
  103. package/lib/server/android/android.js +465 -465
  104. package/lib/server/android/backendAdb.js +177 -177
  105. package/lib/server/artifact.js +127 -127
  106. package/lib/server/bidi/bidiBrowser.js +571 -549
  107. package/lib/server/bidi/bidiChromium.js +162 -148
  108. package/lib/server/bidi/bidiConnection.js +213 -213
  109. package/lib/server/bidi/bidiDeserializer.js +116 -116
  110. package/lib/server/bidi/bidiExecutionContext.js +267 -267
  111. package/lib/server/bidi/bidiFirefox.js +128 -128
  112. package/lib/server/bidi/bidiInput.js +146 -146
  113. package/lib/server/bidi/bidiNetworkManager.js +411 -383
  114. package/lib/server/bidi/bidiOverCdp.js +102 -102
  115. package/lib/server/bidi/bidiPage.js +599 -583
  116. package/lib/server/bidi/bidiPdf.js +106 -106
  117. package/lib/server/bidi/third_party/bidiCommands.d.js +22 -22
  118. package/lib/server/bidi/third_party/bidiKeyboard.js +256 -256
  119. package/lib/server/bidi/third_party/bidiProtocol.js +24 -24
  120. package/lib/server/bidi/third_party/bidiProtocolCore.js +180 -180
  121. package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -42
  122. package/lib/server/bidi/third_party/bidiSerializer.js +148 -148
  123. package/lib/server/bidi/third_party/firefoxPrefs.js +261 -259
  124. package/lib/server/browser.js +212 -149
  125. package/lib/server/browserContext.js +741 -702
  126. package/lib/server/browserType.js +338 -336
  127. package/lib/server/callLog.js +82 -82
  128. package/lib/server/chromium/chromium.js +399 -395
  129. package/lib/server/chromium/chromiumSwitches.js +104 -104
  130. package/lib/server/chromium/crBrowser.js +528 -511
  131. package/lib/server/chromium/crConnection.js +197 -197
  132. package/lib/server/chromium/crCoverage.js +235 -235
  133. package/lib/server/chromium/crDevTools.js +111 -111
  134. package/lib/server/chromium/crDragDrop.js +131 -131
  135. package/lib/server/chromium/crExecutionContext.js +146 -146
  136. package/lib/server/chromium/crInput.js +187 -187
  137. package/lib/server/chromium/crNetworkManager.js +707 -707
  138. package/lib/server/chromium/crPage.js +963 -1001
  139. package/lib/server/chromium/crPdf.js +121 -121
  140. package/lib/server/chromium/crProtocolHelper.js +145 -145
  141. package/lib/server/chromium/crServiceWorker.js +137 -136
  142. package/lib/server/chromium/defaultFontFamilies.js +162 -162
  143. package/lib/server/chromium/protocol.d.js +16 -16
  144. package/lib/server/clock.js +149 -149
  145. package/lib/server/codegen/csharp.js +327 -327
  146. package/lib/server/codegen/java.js +274 -274
  147. package/lib/server/codegen/javascript.js +247 -247
  148. package/lib/server/codegen/jsonl.js +52 -52
  149. package/lib/server/codegen/language.js +132 -132
  150. package/lib/server/codegen/languages.js +68 -68
  151. package/lib/server/codegen/python.js +279 -279
  152. package/lib/server/codegen/types.js +16 -16
  153. package/lib/server/console.js +61 -57
  154. package/lib/server/cookieStore.js +206 -206
  155. package/lib/server/debugController.js +197 -191
  156. package/lib/server/debugger.js +112 -119
  157. package/lib/server/deviceDescriptors.js +39 -39
  158. package/lib/server/deviceDescriptorsSource.json +1778 -1778
  159. package/lib/server/dialog.js +116 -116
  160. package/lib/server/dispatchers/androidDispatcher.js +325 -325
  161. package/lib/server/dispatchers/artifactDispatcher.js +118 -118
  162. package/lib/server/dispatchers/browserContextDispatcher.js +381 -384
  163. package/lib/server/dispatchers/browserDispatcher.js +124 -118
  164. package/lib/server/dispatchers/browserTypeDispatcher.js +71 -64
  165. package/lib/server/dispatchers/cdpSessionDispatcher.js +47 -44
  166. package/lib/server/dispatchers/debugControllerDispatcher.js +78 -78
  167. package/lib/server/dispatchers/debuggerDispatcher.js +84 -0
  168. package/lib/server/dispatchers/dialogDispatcher.js +47 -47
  169. package/lib/server/dispatchers/dispatcher.js +364 -364
  170. package/lib/server/dispatchers/disposableDispatcher.js +39 -0
  171. package/lib/server/dispatchers/electronDispatcher.js +90 -89
  172. package/lib/server/dispatchers/elementHandlerDispatcher.js +181 -181
  173. package/lib/server/dispatchers/frameDispatcher.js +227 -227
  174. package/lib/server/dispatchers/jsHandleDispatcher.js +85 -85
  175. package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -58
  176. package/lib/server/dispatchers/localUtilsDispatcher.js +185 -149
  177. package/lib/server/dispatchers/networkDispatchers.js +214 -213
  178. package/lib/server/dispatchers/pageDispatcher.js +456 -393
  179. package/lib/server/dispatchers/playwrightDispatcher.js +108 -108
  180. package/lib/server/dispatchers/streamDispatcher.js +67 -67
  181. package/lib/server/dispatchers/tracingDispatcher.js +68 -68
  182. package/lib/server/dispatchers/webSocketRouteDispatcher.js +164 -165
  183. package/lib/server/dispatchers/writableStreamDispatcher.js +79 -79
  184. package/lib/server/disposable.js +41 -0
  185. package/lib/server/dom.js +833 -815
  186. package/lib/server/download.js +71 -70
  187. package/lib/server/electron/electron.js +278 -273
  188. package/lib/server/electron/loader.js +29 -29
  189. package/lib/server/errors.js +69 -69
  190. package/lib/server/fetch.js +621 -621
  191. package/lib/server/fileChooser.js +43 -43
  192. package/lib/server/fileUploadUtils.js +84 -84
  193. package/lib/server/firefox/ffBrowser.js +408 -418
  194. package/lib/server/firefox/ffConnection.js +142 -142
  195. package/lib/server/firefox/ffExecutionContext.js +150 -150
  196. package/lib/server/firefox/ffInput.js +175 -159
  197. package/lib/server/firefox/ffNetworkManager.js +256 -256
  198. package/lib/server/firefox/ffPage.js +494 -497
  199. package/lib/server/firefox/firefox.js +114 -114
  200. package/lib/server/firefox/protocol.d.js +16 -16
  201. package/lib/server/formData.js +147 -147
  202. package/lib/server/frameSelectors.js +160 -160
  203. package/lib/server/frames.js +1500 -1471
  204. package/lib/server/har/harRecorder.js +147 -147
  205. package/lib/server/har/harTracer.js +608 -607
  206. package/lib/server/harBackend.js +157 -157
  207. package/lib/server/helper.js +96 -96
  208. package/lib/server/index.js +58 -58
  209. package/lib/server/input.js +322 -277
  210. package/lib/server/instrumentation.js +77 -72
  211. package/lib/server/javascript.js +291 -291
  212. package/lib/server/launchApp.js +127 -128
  213. package/lib/server/localUtils.js +214 -214
  214. package/lib/server/macEditingCommands.js +143 -143
  215. package/lib/server/network.js +668 -667
  216. package/lib/server/overlay.js +138 -0
  217. package/lib/server/page.js +890 -830
  218. package/lib/server/pipeTransport.js +89 -89
  219. package/lib/server/playwright.js +69 -69
  220. package/lib/server/progress.js +138 -132
  221. package/lib/server/protocolError.js +52 -52
  222. package/lib/server/recorder/chat.js +161 -161
  223. package/lib/server/recorder/recorderApp.js +367 -366
  224. package/lib/server/recorder/recorderRunner.js +138 -138
  225. package/lib/server/recorder/recorderSignalProcessor.js +83 -83
  226. package/lib/server/recorder/recorderUtils.js +157 -157
  227. package/lib/server/recorder/throttledFile.js +57 -57
  228. package/lib/server/recorder.js +535 -499
  229. package/lib/server/registry/browserFetcher.js +177 -177
  230. package/lib/server/registry/dependencies.js +371 -371
  231. package/lib/server/registry/index.js +1395 -1422
  232. package/lib/server/registry/nativeDeps.js +1281 -1280
  233. package/lib/server/registry/oopDownloadBrowserMain.js +127 -127
  234. package/lib/server/screencast.js +137 -190
  235. package/lib/server/screenshotter.js +333 -333
  236. package/lib/server/selectors.js +112 -112
  237. package/lib/server/socksClientCertificatesInterceptor.js +383 -383
  238. package/lib/server/socksInterceptor.js +95 -95
  239. package/lib/server/trace/recorder/snapshotter.js +147 -147
  240. package/lib/server/trace/recorder/snapshotterInjected.js +561 -561
  241. package/lib/server/trace/recorder/tracing.js +655 -604
  242. package/lib/server/trace/viewer/traceViewer.js +244 -245
  243. package/lib/server/transport.js +254 -254
  244. package/lib/server/types.js +28 -28
  245. package/lib/server/usKeyboardLayout.js +152 -145
  246. package/lib/server/utils/ascii.js +44 -44
  247. package/lib/server/utils/comparators.js +139 -139
  248. package/lib/server/utils/crypto.js +216 -216
  249. package/lib/server/utils/debug.js +42 -42
  250. package/lib/server/utils/debugLogger.js +122 -122
  251. package/lib/server/utils/disposable.js +32 -0
  252. package/lib/server/utils/env.js +73 -73
  253. package/lib/server/utils/eventsHelper.js +41 -39
  254. package/lib/server/utils/expectUtils.js +123 -123
  255. package/lib/server/utils/fileUtils.js +205 -191
  256. package/lib/server/utils/happyEyeballs.js +210 -207
  257. package/lib/server/utils/hostPlatform.js +123 -123
  258. package/lib/server/utils/httpServer.js +205 -203
  259. package/lib/server/utils/image_tools/colorUtils.js +89 -89
  260. package/lib/server/utils/image_tools/compare.js +109 -109
  261. package/lib/server/utils/image_tools/imageChannel.js +78 -78
  262. package/lib/server/utils/image_tools/stats.js +102 -102
  263. package/lib/server/utils/linuxUtils.js +71 -71
  264. package/lib/server/utils/network.js +243 -242
  265. package/lib/server/utils/nodePlatform.js +148 -154
  266. package/lib/server/utils/pipeTransport.js +84 -84
  267. package/lib/server/utils/processLauncher.js +243 -241
  268. package/lib/server/utils/profiler.js +65 -65
  269. package/lib/server/utils/socksProxy.js +511 -511
  270. package/lib/server/utils/spawnAsync.js +41 -41
  271. package/lib/server/utils/task.js +51 -51
  272. package/lib/server/utils/userAgent.js +98 -98
  273. package/lib/server/utils/wsServer.js +121 -121
  274. package/lib/server/utils/zipFile.js +74 -74
  275. package/lib/server/utils/zones.js +57 -57
  276. package/lib/server/videoRecorder.js +194 -124
  277. package/lib/server/webkit/protocol.d.js +16 -16
  278. package/lib/server/webkit/webkit.js +108 -108
  279. package/lib/server/webkit/wkBrowser.js +330 -335
  280. package/lib/server/webkit/wkConnection.js +144 -144
  281. package/lib/server/webkit/wkExecutionContext.js +154 -154
  282. package/lib/server/webkit/wkInput.js +181 -181
  283. package/lib/server/webkit/wkInterceptableRequest.js +197 -197
  284. package/lib/server/webkit/wkPage.js +1161 -1158
  285. package/lib/server/webkit/wkProvisionalPage.js +83 -83
  286. package/lib/server/webkit/wkWorkers.js +106 -105
  287. package/lib/serverRegistry.js +156 -0
  288. package/lib/third_party/pixelmatch.js +255 -255
  289. package/lib/tools/backend/browserBackend.js +79 -0
  290. package/lib/tools/backend/common.js +63 -0
  291. package/lib/tools/backend/config.js +41 -0
  292. package/lib/tools/backend/console.js +66 -0
  293. package/lib/tools/backend/context.js +296 -0
  294. package/lib/tools/backend/cookies.js +152 -0
  295. package/lib/tools/backend/devtools.js +69 -0
  296. package/lib/tools/backend/dialogs.js +59 -0
  297. package/lib/tools/backend/evaluate.js +64 -0
  298. package/lib/tools/backend/files.js +60 -0
  299. package/lib/tools/backend/form.js +64 -0
  300. package/lib/tools/backend/keyboard.js +155 -0
  301. package/lib/tools/backend/logFile.js +95 -0
  302. package/lib/tools/backend/mouse.js +168 -0
  303. package/lib/tools/backend/navigate.js +106 -0
  304. package/lib/tools/backend/network.js +135 -0
  305. package/lib/tools/backend/pdf.js +48 -0
  306. package/lib/tools/backend/response.js +305 -0
  307. package/lib/tools/backend/route.js +140 -0
  308. package/lib/tools/backend/runCode.js +77 -0
  309. package/lib/tools/backend/screenshot.js +88 -0
  310. package/lib/tools/backend/sessionLog.js +74 -0
  311. package/lib/tools/backend/snapshot.js +208 -0
  312. package/lib/tools/backend/storage.js +68 -0
  313. package/lib/tools/backend/tab.js +445 -0
  314. package/lib/tools/backend/tabs.js +67 -0
  315. package/lib/tools/backend/tool.js +47 -0
  316. package/lib/tools/backend/tools.js +102 -0
  317. package/lib/tools/backend/tracing.js +78 -0
  318. package/lib/tools/backend/utils.js +83 -0
  319. package/lib/tools/backend/verify.js +151 -0
  320. package/lib/tools/backend/video.js +98 -0
  321. package/lib/tools/backend/wait.js +63 -0
  322. package/lib/tools/backend/webstorage.js +223 -0
  323. package/lib/tools/cli-client/cli.js +6 -0
  324. package/lib/tools/cli-client/help.json +399 -0
  325. package/lib/tools/cli-client/minimist.js +128 -0
  326. package/lib/tools/cli-client/program.js +350 -0
  327. package/lib/tools/cli-client/registry.js +176 -0
  328. package/lib/tools/cli-client/session.js +289 -0
  329. package/lib/tools/cli-client/skill/SKILL.md +328 -0
  330. package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
  331. package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
  332. package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
  333. package/lib/tools/cli-client/skill/references/running-code.md +231 -0
  334. package/lib/tools/cli-client/skill/references/session-management.md +169 -0
  335. package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
  336. package/lib/tools/cli-client/skill/references/test-generation.md +88 -0
  337. package/lib/tools/cli-client/skill/references/tracing.md +139 -0
  338. package/lib/tools/cli-client/skill/references/video-recording.md +143 -0
  339. package/lib/tools/cli-daemon/command.js +73 -0
  340. package/lib/tools/cli-daemon/commands.js +956 -0
  341. package/lib/tools/cli-daemon/daemon.js +157 -0
  342. package/lib/tools/cli-daemon/helpGenerator.js +177 -0
  343. package/lib/tools/cli-daemon/program.js +129 -0
  344. package/lib/tools/dashboard/appIcon.png +0 -0
  345. package/lib/tools/dashboard/dashboardApp.js +284 -0
  346. package/lib/tools/dashboard/dashboardController.js +296 -0
  347. package/lib/tools/exports.js +60 -0
  348. package/lib/tools/mcp/browserFactory.js +233 -0
  349. package/lib/tools/mcp/cdpRelay.js +352 -0
  350. package/lib/tools/mcp/cli-stub.js +7 -0
  351. package/lib/tools/mcp/config.d.js +16 -0
  352. package/lib/tools/mcp/config.js +446 -0
  353. package/lib/tools/mcp/configIni.js +189 -0
  354. package/lib/{server/trace/viewer/traceParser.js → tools/mcp/extensionContextFactory.js} +55 -72
  355. package/lib/tools/mcp/index.js +62 -0
  356. package/lib/tools/mcp/log.js +35 -0
  357. package/lib/tools/mcp/program.js +107 -0
  358. package/lib/tools/mcp/protocol.js +28 -0
  359. package/lib/tools/mcp/watchdog.js +44 -0
  360. package/lib/tools/trace/SKILL.md +171 -0
  361. package/lib/tools/trace/installSkill.js +48 -0
  362. package/lib/tools/trace/traceActions.js +142 -0
  363. package/lib/tools/trace/traceAttachments.js +69 -0
  364. package/lib/tools/trace/traceCli.js +87 -0
  365. package/lib/tools/trace/traceConsole.js +97 -0
  366. package/lib/tools/trace/traceErrors.js +55 -0
  367. package/lib/tools/trace/traceOpen.js +69 -0
  368. package/lib/tools/trace/traceParser.js +96 -0
  369. package/lib/tools/trace/traceRequests.js +182 -0
  370. package/lib/tools/trace/traceScreenshot.js +68 -0
  371. package/lib/tools/trace/traceSnapshot.js +149 -0
  372. package/lib/tools/trace/traceUtils.js +153 -0
  373. package/lib/tools/utils/connect.js +32 -0
  374. package/lib/tools/utils/mcp/http.js +152 -0
  375. package/lib/tools/utils/mcp/server.js +230 -0
  376. package/lib/tools/utils/mcp/tool.js +47 -0
  377. package/lib/tools/utils/socketConnection.js +108 -0
  378. package/lib/utils/isomorphic/ariaSnapshot.js +455 -455
  379. package/lib/utils/isomorphic/assert.js +31 -31
  380. package/lib/utils/isomorphic/colors.js +72 -72
  381. package/lib/utils/isomorphic/cssParser.js +245 -245
  382. package/lib/utils/isomorphic/cssTokenizer.js +1051 -1051
  383. package/lib/utils/isomorphic/formatUtils.js +64 -0
  384. package/lib/utils/isomorphic/headers.js +53 -53
  385. package/lib/{server/utils → utils/isomorphic}/imageUtils.js +141 -141
  386. package/lib/utils/isomorphic/jsonSchema.js +89 -0
  387. package/lib/utils/isomorphic/locatorGenerators.js +689 -689
  388. package/lib/utils/isomorphic/locatorParser.js +176 -176
  389. package/lib/utils/isomorphic/locatorUtils.js +81 -81
  390. package/lib/utils/isomorphic/lruCache.js +51 -51
  391. package/lib/utils/isomorphic/manualPromise.js +114 -114
  392. package/lib/utils/isomorphic/mimeType.js +464 -459
  393. package/lib/utils/isomorphic/multimap.js +80 -80
  394. package/lib/utils/isomorphic/protocolFormatter.js +81 -81
  395. package/lib/utils/isomorphic/protocolMetainfo.js +351 -330
  396. package/lib/utils/isomorphic/rtti.js +43 -43
  397. package/lib/utils/isomorphic/selectorParser.js +386 -386
  398. package/lib/utils/isomorphic/semaphore.js +54 -54
  399. package/lib/utils/isomorphic/stackTrace.js +158 -158
  400. package/lib/utils/isomorphic/stringUtils.js +204 -204
  401. package/lib/utils/isomorphic/time.js +49 -49
  402. package/lib/utils/isomorphic/timeoutRunner.js +66 -66
  403. package/lib/utils/isomorphic/trace/entries.js +16 -16
  404. package/lib/utils/isomorphic/trace/snapshotRenderer.js +492 -499
  405. package/lib/utils/isomorphic/trace/snapshotServer.js +120 -120
  406. package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -89
  407. package/lib/utils/isomorphic/trace/traceLoader.js +132 -131
  408. package/lib/utils/isomorphic/trace/traceModel.js +366 -365
  409. package/lib/utils/isomorphic/trace/traceModernizer.js +401 -400
  410. package/lib/utils/isomorphic/{traceUtils.js → trace/traceUtils.js} +58 -58
  411. package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -16
  412. package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -16
  413. package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -16
  414. package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -16
  415. package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -16
  416. package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -16
  417. package/lib/utils/isomorphic/types.js +16 -16
  418. package/lib/utils/isomorphic/urlMatch.js +243 -190
  419. package/lib/utils/isomorphic/utilityScriptSerializers.js +262 -251
  420. package/lib/utils/isomorphic/yaml.js +84 -84
  421. package/lib/utils.js +115 -111
  422. package/lib/utilsBundle.js +91 -109
  423. package/lib/utilsBundleImpl/index.js +217 -218
  424. package/lib/utilsBundleImpl/xdg-open +1066 -1066
  425. package/lib/vite/dashboard/assets/index-BAOybkp8.js +50 -0
  426. package/lib/vite/dashboard/assets/index-CZAYOG76.css +1 -0
  427. package/lib/vite/dashboard/index.html +28 -0
  428. package/lib/vite/htmlReport/index.html +16 -84
  429. package/lib/vite/htmlReport/report.css +1 -0
  430. package/lib/vite/htmlReport/report.js +72 -0
  431. package/lib/vite/recorder/assets/{codeMirrorModule-DadYNm1I.js → codeMirrorModule-C8KMvO9L.js} +32 -32
  432. package/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +1 -1
  433. package/lib/vite/recorder/assets/index-BSjZa4pk.css +1 -1
  434. package/lib/vite/recorder/assets/index-CqAYX1I3.js +193 -0
  435. package/lib/vite/recorder/index.html +29 -29
  436. package/lib/vite/recorder/playwright-logo.svg +9 -9
  437. package/lib/vite/traceViewer/assets/{codeMirrorModule-a5XoALAZ.js → codeMirrorModule-DS0FLvoc.js} +32 -32
  438. package/lib/vite/traceViewer/assets/defaultSettingsView-GTWI-W_B.js +262 -0
  439. package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -9
  440. package/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -1
  441. package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
  442. package/lib/vite/traceViewer/{index.BVu7tZDe.css → index.CzXZzn5A.css} +1 -1
  443. package/lib/vite/traceViewer/{index.Bk2uYQRV.js → index.Dtstcb7U.js} +2 -2
  444. package/lib/vite/traceViewer/index.html +43 -43
  445. package/lib/vite/traceViewer/manifest.webmanifest +16 -16
  446. package/lib/vite/traceViewer/playwright-logo.svg +9 -9
  447. package/lib/vite/traceViewer/snapshot.html +21 -21
  448. package/lib/vite/traceViewer/sw.bundle.js +5 -5
  449. package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -1
  450. package/lib/vite/traceViewer/uiMode.Vipi55dB.js +6 -0
  451. package/lib/vite/traceViewer/uiMode.html +17 -17
  452. package/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -32
  453. package/lib/zipBundle.js +34 -34
  454. package/lib/zipBundleImpl.js +5 -5
  455. package/lib/zodBundle.js +39 -0
  456. package/lib/zodBundleImpl.js +40 -0
  457. package/package.json +6 -1
  458. package/types/protocol.d.ts +24720 -23824
  459. package/types/structs.d.ts +45 -45
  460. package/types/types.d.ts +23623 -22843
  461. package/lib/client/pageAgent.js +0 -64
  462. package/lib/mcpBundleImpl/index.js +0 -147
  463. package/lib/server/agent/actionRunner.js +0 -335
  464. package/lib/server/agent/actions.js +0 -128
  465. package/lib/server/agent/codegen.js +0 -111
  466. package/lib/server/agent/context.js +0 -150
  467. package/lib/server/agent/expectTools.js +0 -156
  468. package/lib/server/agent/pageAgent.js +0 -204
  469. package/lib/server/agent/performTools.js +0 -262
  470. package/lib/server/agent/tool.js +0 -109
  471. package/lib/server/dispatchers/pageAgentDispatcher.js +0 -96
  472. package/lib/vite/recorder/assets/index-BhTWtUlo.js +0 -193
  473. package/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js +0 -266
  474. package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +0 -1
  475. package/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js +0 -5
@@ -1,1422 +1,1395 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var registry_exports = {};
30
- __export(registry_exports, {
31
- Registry: () => Registry,
32
- browserDirectoryToMarkerFilePath: () => browserDirectoryToMarkerFilePath,
33
- buildPlaywrightCLICommand: () => buildPlaywrightCLICommand,
34
- findChromiumChannelBestEffort: () => findChromiumChannelBestEffort,
35
- installBrowsersForNpmInstall: () => installBrowsersForNpmInstall,
36
- registry: () => registry,
37
- registryDirectory: () => registryDirectory,
38
- writeDockerVersion: () => import_dependencies3.writeDockerVersion
39
- });
40
- module.exports = __toCommonJS(registry_exports);
41
- var import_fs = __toESM(require("fs"));
42
- var import_os = __toESM(require("os"));
43
- var import_path = __toESM(require("path"));
44
- var util = __toESM(require("util"));
45
- var import_browserFetcher = require("./browserFetcher");
46
- var import_dependencies = require("./dependencies");
47
- var import_dependencies2 = require("./dependencies");
48
- var import_utils = require("../../utils");
49
- var import_ascii = require("../utils/ascii");
50
- var import_debugLogger = require("../utils/debugLogger");
51
- var import_hostPlatform = require("../utils/hostPlatform");
52
- var import_network = require("../utils/network");
53
- var import_spawnAsync = require("../utils/spawnAsync");
54
- var import_userAgent = require("../utils/userAgent");
55
- var import_utilsBundle = require("../../utilsBundle");
56
- var import_fileUtils = require("../utils/fileUtils");
57
- var import_dependencies3 = require("./dependencies");
58
- const PACKAGE_PATH = import_path.default.join(__dirname, "..", "..", "..");
59
- const BIN_PATH = import_path.default.join(__dirname, "..", "..", "..", "bin");
60
- const PLAYWRIGHT_CDN_MIRRORS = [
61
- "https://cdn.playwright.dev/dbazure/download/playwright",
62
- // ESRP CDN
63
- "https://playwright.download.prss.microsoft.com/dbazure/download/playwright",
64
- // Directly hit ESRP CDN
65
- "https://cdn.playwright.dev"
66
- // Hit the Storage Bucket directly
67
- ];
68
- if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
69
- for (let i = 0; i < PLAYWRIGHT_CDN_MIRRORS.length; i++) {
70
- const cdn = PLAYWRIGHT_CDN_MIRRORS[i];
71
- if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
72
- const parsedCDN = new URL(cdn);
73
- parsedCDN.hostname = parsedCDN.hostname + ".does-not-resolve.playwright.dev";
74
- PLAYWRIGHT_CDN_MIRRORS[i] = parsedCDN.toString();
75
- }
76
- }
77
- }
78
- const EXECUTABLE_PATHS = {
79
- "chromium": {
80
- "<unknown>": void 0,
81
- "linux-x64": ["chrome-linux64", "chrome"],
82
- "linux-arm64": ["chrome-linux", "chrome"],
83
- // non-cft build
84
- "mac-x64": ["chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
85
- "mac-arm64": ["chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
86
- "win-x64": ["chrome-win64", "chrome.exe"]
87
- },
88
- "chromium-headless-shell": {
89
- "<unknown>": void 0,
90
- "linux-x64": ["chrome-headless-shell-linux64", "chrome-headless-shell"],
91
- "linux-arm64": ["chrome-linux", "headless_shell"],
92
- // non-cft build
93
- "mac-x64": ["chrome-headless-shell-mac-x64", "chrome-headless-shell"],
94
- "mac-arm64": ["chrome-headless-shell-mac-arm64", "chrome-headless-shell"],
95
- "win-x64": ["chrome-headless-shell-win64", "chrome-headless-shell.exe"]
96
- },
97
- "chromium-tip-of-tree": {
98
- "<unknown>": void 0,
99
- "linux-x64": ["chrome-linux64", "chrome"],
100
- "linux-arm64": ["chrome-linux", "chrome"],
101
- // non-cft build
102
- "mac-x64": ["chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
103
- "mac-arm64": ["chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
104
- "win-x64": ["chrome-win64", "chrome.exe"]
105
- },
106
- "chromium-tip-of-tree-headless-shell": {
107
- "<unknown>": void 0,
108
- "linux-x64": ["chrome-headless-shell-linux64", "chrome-headless-shell"],
109
- "linux-arm64": ["chrome-linux", "headless_shell"],
110
- // non-cft build
111
- "mac-x64": ["chrome-headless-shell-mac-x64", "chrome-headless-shell"],
112
- "mac-arm64": ["chrome-headless-shell-mac-arm64", "chrome-headless-shell"],
113
- "win-x64": ["chrome-headless-shell-win64", "chrome-headless-shell.exe"]
114
- },
115
- "firefox": {
116
- "<unknown>": void 0,
117
- "linux-x64": ["firefox", "firefox"],
118
- "linux-arm64": ["firefox", "firefox"],
119
- "mac-x64": ["firefox", "Nightly.app", "Contents", "MacOS", "firefox"],
120
- "mac-arm64": ["firefox", "Nightly.app", "Contents", "MacOS", "firefox"],
121
- "win-x64": ["firefox", "firefox.exe"]
122
- },
123
- "webkit": {
124
- "<unknown>": void 0,
125
- "linux-x64": ["pw_run.sh"],
126
- "linux-arm64": ["pw_run.sh"],
127
- "mac-x64": ["pw_run.sh"],
128
- "mac-arm64": ["pw_run.sh"],
129
- "win-x64": ["Playwright.exe"]
130
- },
131
- "ffmpeg": {
132
- "<unknown>": void 0,
133
- "linux-x64": ["ffmpeg-linux"],
134
- "linux-arm64": ["ffmpeg-linux"],
135
- "mac-x64": ["ffmpeg-mac"],
136
- "mac-arm64": ["ffmpeg-mac"],
137
- "win-x64": ["ffmpeg-win64.exe"]
138
- },
139
- "winldd": {
140
- "<unknown>": void 0,
141
- "linux-x64": void 0,
142
- "linux-arm64": void 0,
143
- "mac-x64": void 0,
144
- "mac-arm64": void 0,
145
- "win-x64": ["PrintDeps.exe"]
146
- }
147
- };
148
- function cftUrl(suffix) {
149
- return ({ browserVersion }) => {
150
- return {
151
- path: `${browserVersion}/${suffix}`,
152
- mirrors: [
153
- "https://cdn.playwright.dev/chrome-for-testing-public"
154
- ]
155
- };
156
- };
157
- }
158
- const DOWNLOAD_PATHS = {
159
- "chromium": {
160
- "<unknown>": void 0,
161
- "ubuntu18.04-x64": void 0,
162
- "ubuntu20.04-x64": cftUrl("linux64/chrome-linux64.zip"),
163
- "ubuntu22.04-x64": cftUrl("linux64/chrome-linux64.zip"),
164
- "ubuntu24.04-x64": cftUrl("linux64/chrome-linux64.zip"),
165
- "ubuntu18.04-arm64": void 0,
166
- "ubuntu20.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
167
- "ubuntu22.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
168
- "ubuntu24.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
169
- "debian11-x64": cftUrl("linux64/chrome-linux64.zip"),
170
- "debian11-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
171
- "debian12-x64": cftUrl("linux64/chrome-linux64.zip"),
172
- "debian12-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
173
- "debian13-x64": cftUrl("linux64/chrome-linux64.zip"),
174
- "debian13-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
175
- "mac10.13": cftUrl("mac-x64/chrome-mac-x64.zip"),
176
- "mac10.14": cftUrl("mac-x64/chrome-mac-x64.zip"),
177
- "mac10.15": cftUrl("mac-x64/chrome-mac-x64.zip"),
178
- "mac11": cftUrl("mac-x64/chrome-mac-x64.zip"),
179
- "mac11-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
180
- "mac12": cftUrl("mac-x64/chrome-mac-x64.zip"),
181
- "mac12-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
182
- "mac13": cftUrl("mac-x64/chrome-mac-x64.zip"),
183
- "mac13-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
184
- "mac14": cftUrl("mac-x64/chrome-mac-x64.zip"),
185
- "mac14-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
186
- "mac15": cftUrl("mac-x64/chrome-mac-x64.zip"),
187
- "mac15-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
188
- "win64": cftUrl("win64/chrome-win64.zip")
189
- },
190
- "chromium-headless-shell": {
191
- "<unknown>": void 0,
192
- "ubuntu18.04-x64": void 0,
193
- "ubuntu20.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
194
- "ubuntu22.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
195
- "ubuntu24.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
196
- "ubuntu18.04-arm64": void 0,
197
- "ubuntu20.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
198
- "ubuntu22.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
199
- "ubuntu24.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
200
- "debian11-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
201
- "debian11-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
202
- "debian12-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
203
- "debian12-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
204
- "debian13-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
205
- "debian13-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
206
- "mac10.13": void 0,
207
- "mac10.14": void 0,
208
- "mac10.15": void 0,
209
- "mac11": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
210
- "mac11-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
211
- "mac12": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
212
- "mac12-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
213
- "mac13": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
214
- "mac13-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
215
- "mac14": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
216
- "mac14-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
217
- "mac15": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
218
- "mac15-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
219
- "win64": cftUrl("win64/chrome-headless-shell-win64.zip")
220
- },
221
- "chromium-tip-of-tree": {
222
- "<unknown>": void 0,
223
- "ubuntu18.04-x64": void 0,
224
- "ubuntu20.04-x64": cftUrl("linux64/chrome-linux64.zip"),
225
- "ubuntu22.04-x64": cftUrl("linux64/chrome-linux64.zip"),
226
- "ubuntu24.04-x64": cftUrl("linux64/chrome-linux64.zip"),
227
- "ubuntu18.04-arm64": void 0,
228
- "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
229
- "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
230
- "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
231
- "debian11-x64": cftUrl("linux64/chrome-linux64.zip"),
232
- "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
233
- "debian12-x64": cftUrl("linux64/chrome-linux64.zip"),
234
- "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
235
- "debian13-x64": cftUrl("linux64/chrome-linux64.zip"),
236
- "debian13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
237
- "mac10.13": cftUrl("mac-x64/chrome-mac-x64.zip"),
238
- "mac10.14": cftUrl("mac-x64/chrome-mac-x64.zip"),
239
- "mac10.15": cftUrl("mac-x64/chrome-mac-x64.zip"),
240
- "mac11": cftUrl("mac-x64/chrome-mac-x64.zip"),
241
- "mac11-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
242
- "mac12": cftUrl("mac-x64/chrome-mac-x64.zip"),
243
- "mac12-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
244
- "mac13": cftUrl("mac-x64/chrome-mac-x64.zip"),
245
- "mac13-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
246
- "mac14": cftUrl("mac-x64/chrome-mac-x64.zip"),
247
- "mac14-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
248
- "mac15": cftUrl("mac-x64/chrome-mac-x64.zip"),
249
- "mac15-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
250
- "win64": cftUrl("win64/chrome-win64.zip")
251
- },
252
- "chromium-tip-of-tree-headless-shell": {
253
- "<unknown>": void 0,
254
- "ubuntu18.04-x64": void 0,
255
- "ubuntu20.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
256
- "ubuntu22.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
257
- "ubuntu24.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
258
- "ubuntu18.04-arm64": void 0,
259
- "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
260
- "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
261
- "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
262
- "debian11-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
263
- "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
264
- "debian12-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
265
- "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
266
- "debian13-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
267
- "debian13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
268
- "mac10.13": void 0,
269
- "mac10.14": void 0,
270
- "mac10.15": void 0,
271
- "mac11": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
272
- "mac11-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
273
- "mac12": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
274
- "mac12-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
275
- "mac13": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
276
- "mac13-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
277
- "mac14": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
278
- "mac14-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
279
- "mac15": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
280
- "mac15-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
281
- "win64": cftUrl("win64/chrome-headless-shell-win64.zip")
282
- },
283
- "firefox": {
284
- "<unknown>": void 0,
285
- "ubuntu18.04-x64": void 0,
286
- "ubuntu20.04-x64": "builds/firefox/%s/firefox-ubuntu-20.04.zip",
287
- "ubuntu22.04-x64": "builds/firefox/%s/firefox-ubuntu-22.04.zip",
288
- "ubuntu24.04-x64": "builds/firefox/%s/firefox-ubuntu-24.04.zip",
289
- "ubuntu18.04-arm64": void 0,
290
- "ubuntu20.04-arm64": "builds/firefox/%s/firefox-ubuntu-20.04-arm64.zip",
291
- "ubuntu22.04-arm64": "builds/firefox/%s/firefox-ubuntu-22.04-arm64.zip",
292
- "ubuntu24.04-arm64": "builds/firefox/%s/firefox-ubuntu-24.04-arm64.zip",
293
- "debian11-x64": "builds/firefox/%s/firefox-debian-11.zip",
294
- "debian11-arm64": "builds/firefox/%s/firefox-debian-11-arm64.zip",
295
- "debian12-x64": "builds/firefox/%s/firefox-debian-12.zip",
296
- "debian12-arm64": "builds/firefox/%s/firefox-debian-12-arm64.zip",
297
- "debian13-x64": "builds/firefox/%s/firefox-debian-13.zip",
298
- "debian13-arm64": "builds/firefox/%s/firefox-debian-13-arm64.zip",
299
- "mac10.13": "builds/firefox/%s/firefox-mac.zip",
300
- "mac10.14": "builds/firefox/%s/firefox-mac.zip",
301
- "mac10.15": "builds/firefox/%s/firefox-mac.zip",
302
- "mac11": "builds/firefox/%s/firefox-mac.zip",
303
- "mac11-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
304
- "mac12": "builds/firefox/%s/firefox-mac.zip",
305
- "mac12-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
306
- "mac13": "builds/firefox/%s/firefox-mac.zip",
307
- "mac13-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
308
- "mac14": "builds/firefox/%s/firefox-mac.zip",
309
- "mac14-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
310
- "mac15": "builds/firefox/%s/firefox-mac.zip",
311
- "mac15-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
312
- "win64": "builds/firefox/%s/firefox-win64.zip"
313
- },
314
- "firefox-beta": {
315
- "<unknown>": void 0,
316
- "ubuntu18.04-x64": void 0,
317
- "ubuntu20.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-20.04.zip",
318
- "ubuntu22.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04.zip",
319
- "ubuntu24.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04.zip",
320
- "ubuntu18.04-arm64": void 0,
321
- "ubuntu20.04-arm64": void 0,
322
- "ubuntu22.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04-arm64.zip",
323
- "ubuntu24.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04-arm64.zip",
324
- "debian11-x64": "builds/firefox-beta/%s/firefox-beta-debian-11.zip",
325
- "debian11-arm64": "builds/firefox-beta/%s/firefox-beta-debian-11-arm64.zip",
326
- "debian12-x64": "builds/firefox-beta/%s/firefox-beta-debian-12.zip",
327
- "debian12-arm64": "builds/firefox-beta/%s/firefox-beta-debian-12-arm64.zip",
328
- "debian13-x64": "builds/firefox-beta/%s/firefox-beta-debian-12.zip",
329
- "debian13-arm64": "builds/firefox-beta/%s/firefox-beta-debian-12-arm64.zip",
330
- "mac10.13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
331
- "mac10.14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
332
- "mac10.15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
333
- "mac11": "builds/firefox-beta/%s/firefox-beta-mac.zip",
334
- "mac11-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
335
- "mac12": "builds/firefox-beta/%s/firefox-beta-mac.zip",
336
- "mac12-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
337
- "mac13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
338
- "mac13-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
339
- "mac14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
340
- "mac14-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
341
- "mac15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
342
- "mac15-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
343
- "win64": "builds/firefox-beta/%s/firefox-beta-win64.zip"
344
- },
345
- "webkit": {
346
- "<unknown>": void 0,
347
- "ubuntu18.04-x64": void 0,
348
- "ubuntu20.04-x64": "builds/webkit/%s/webkit-ubuntu-20.04.zip",
349
- "ubuntu22.04-x64": "builds/webkit/%s/webkit-ubuntu-22.04.zip",
350
- "ubuntu24.04-x64": "builds/webkit/%s/webkit-ubuntu-24.04.zip",
351
- "ubuntu18.04-arm64": void 0,
352
- "ubuntu20.04-arm64": "builds/webkit/%s/webkit-ubuntu-20.04-arm64.zip",
353
- "ubuntu22.04-arm64": "builds/webkit/%s/webkit-ubuntu-22.04-arm64.zip",
354
- "ubuntu24.04-arm64": "builds/webkit/%s/webkit-ubuntu-24.04-arm64.zip",
355
- "debian11-x64": "builds/webkit/%s/webkit-debian-11.zip",
356
- "debian11-arm64": "builds/webkit/%s/webkit-debian-11-arm64.zip",
357
- "debian12-x64": "builds/webkit/%s/webkit-debian-12.zip",
358
- "debian12-arm64": "builds/webkit/%s/webkit-debian-12-arm64.zip",
359
- "debian13-x64": "builds/webkit/%s/webkit-debian-13.zip",
360
- "debian13-arm64": "builds/webkit/%s/webkit-debian-13-arm64.zip",
361
- "mac10.13": void 0,
362
- "mac10.14": void 0,
363
- "mac10.15": void 0,
364
- "mac11": void 0,
365
- "mac11-arm64": void 0,
366
- "mac12": void 0,
367
- "mac12-arm64": void 0,
368
- "mac13": void 0,
369
- "mac13-arm64": void 0,
370
- "mac14": "builds/webkit/%s/webkit-mac-14.zip",
371
- "mac14-arm64": "builds/webkit/%s/webkit-mac-14-arm64.zip",
372
- "mac15": "builds/webkit/%s/webkit-mac-15.zip",
373
- "mac15-arm64": "builds/webkit/%s/webkit-mac-15-arm64.zip",
374
- "win64": "builds/webkit/%s/webkit-win64.zip"
375
- },
376
- "ffmpeg": {
377
- "<unknown>": void 0,
378
- "ubuntu18.04-x64": void 0,
379
- "ubuntu20.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
380
- "ubuntu22.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
381
- "ubuntu24.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
382
- "ubuntu18.04-arm64": void 0,
383
- "ubuntu20.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
384
- "ubuntu22.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
385
- "ubuntu24.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
386
- "debian11-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
387
- "debian11-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
388
- "debian12-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
389
- "debian12-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
390
- "debian13-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
391
- "debian13-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
392
- "mac10.13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
393
- "mac10.14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
394
- "mac10.15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
395
- "mac11": "builds/ffmpeg/%s/ffmpeg-mac.zip",
396
- "mac11-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
397
- "mac12": "builds/ffmpeg/%s/ffmpeg-mac.zip",
398
- "mac12-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
399
- "mac13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
400
- "mac13-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
401
- "mac14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
402
- "mac14-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
403
- "mac15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
404
- "mac15-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
405
- "win64": "builds/ffmpeg/%s/ffmpeg-win64.zip"
406
- },
407
- "winldd": {
408
- "<unknown>": void 0,
409
- "ubuntu18.04-x64": void 0,
410
- "ubuntu20.04-x64": void 0,
411
- "ubuntu22.04-x64": void 0,
412
- "ubuntu24.04-x64": void 0,
413
- "ubuntu18.04-arm64": void 0,
414
- "ubuntu20.04-arm64": void 0,
415
- "ubuntu22.04-arm64": void 0,
416
- "ubuntu24.04-arm64": void 0,
417
- "debian11-x64": void 0,
418
- "debian11-arm64": void 0,
419
- "debian12-x64": void 0,
420
- "debian12-arm64": void 0,
421
- "debian13-x64": void 0,
422
- "debian13-arm64": void 0,
423
- "mac10.13": void 0,
424
- "mac10.14": void 0,
425
- "mac10.15": void 0,
426
- "mac11": void 0,
427
- "mac11-arm64": void 0,
428
- "mac12": void 0,
429
- "mac12-arm64": void 0,
430
- "mac13": void 0,
431
- "mac13-arm64": void 0,
432
- "mac14": void 0,
433
- "mac14-arm64": void 0,
434
- "mac15": void 0,
435
- "mac15-arm64": void 0,
436
- "win64": "builds/winldd/%s/winldd-win64.zip"
437
- },
438
- "android": {
439
- "<unknown>": "builds/android/%s/android.zip",
440
- "ubuntu18.04-x64": void 0,
441
- "ubuntu20.04-x64": "builds/android/%s/android.zip",
442
- "ubuntu22.04-x64": "builds/android/%s/android.zip",
443
- "ubuntu24.04-x64": "builds/android/%s/android.zip",
444
- "ubuntu18.04-arm64": void 0,
445
- "ubuntu20.04-arm64": "builds/android/%s/android.zip",
446
- "ubuntu22.04-arm64": "builds/android/%s/android.zip",
447
- "ubuntu24.04-arm64": "builds/android/%s/android.zip",
448
- "debian11-x64": "builds/android/%s/android.zip",
449
- "debian11-arm64": "builds/android/%s/android.zip",
450
- "debian12-x64": "builds/android/%s/android.zip",
451
- "debian12-arm64": "builds/android/%s/android.zip",
452
- "debian13-x64": "builds/android/%s/android.zip",
453
- "debian13-arm64": "builds/android/%s/android.zip",
454
- "mac10.13": "builds/android/%s/android.zip",
455
- "mac10.14": "builds/android/%s/android.zip",
456
- "mac10.15": "builds/android/%s/android.zip",
457
- "mac11": "builds/android/%s/android.zip",
458
- "mac11-arm64": "builds/android/%s/android.zip",
459
- "mac12": "builds/android/%s/android.zip",
460
- "mac12-arm64": "builds/android/%s/android.zip",
461
- "mac13": "builds/android/%s/android.zip",
462
- "mac13-arm64": "builds/android/%s/android.zip",
463
- "mac14": "builds/android/%s/android.zip",
464
- "mac14-arm64": "builds/android/%s/android.zip",
465
- "mac15": "builds/android/%s/android.zip",
466
- "mac15-arm64": "builds/android/%s/android.zip",
467
- "win64": "builds/android/%s/android.zip"
468
- }
469
- };
470
- const registryDirectory = (() => {
471
- let result;
472
- const envDefined = (0, import_utils.getFromENV)("PLAYWRIGHT_BROWSERS_PATH");
473
- if (envDefined === "0") {
474
- result = import_path.default.join(__dirname, "..", "..", "..", ".local-browsers");
475
- } else if (envDefined) {
476
- result = envDefined;
477
- } else {
478
- let cacheDirectory;
479
- if (process.platform === "linux")
480
- cacheDirectory = process.env.XDG_CACHE_HOME || import_path.default.join(import_os.default.homedir(), ".cache");
481
- else if (process.platform === "darwin")
482
- cacheDirectory = import_path.default.join(import_os.default.homedir(), "Library", "Caches");
483
- else if (process.platform === "win32")
484
- cacheDirectory = process.env.LOCALAPPDATA || import_path.default.join(import_os.default.homedir(), "AppData", "Local");
485
- else
486
- throw new Error("Unsupported platform: " + process.platform);
487
- result = import_path.default.join(cacheDirectory, "ms-playwright");
488
- }
489
- if (!import_path.default.isAbsolute(result)) {
490
- result = import_path.default.resolve((0, import_utils.getFromENV)("INIT_CWD") || process.cwd(), result);
491
- }
492
- return result;
493
- })();
494
- function isBrowserDirectory(browserDirectory) {
495
- const baseName = import_path.default.basename(browserDirectory);
496
- for (const browserName of allDownloadableDirectoriesThatEverExisted) {
497
- if (baseName.startsWith(browserName.replace(/-/g, "_") + "-"))
498
- return true;
499
- }
500
- return false;
501
- }
502
- function readDescriptors(browsersJSON) {
503
- return browsersJSON["browsers"].map((obj) => {
504
- const name = obj.name;
505
- const revisionOverride = (obj.revisionOverrides || {})[import_hostPlatform.hostPlatform];
506
- const revision = revisionOverride || obj.revision;
507
- const browserDirectoryPrefix = revisionOverride ? `${name}_${import_hostPlatform.hostPlatform}_special` : `${name}`;
508
- const descriptor = {
509
- name,
510
- revision,
511
- hasRevisionOverride: !!revisionOverride,
512
- // We only put browser version for the supported operating systems.
513
- browserVersion: revisionOverride ? void 0 : obj.browserVersion,
514
- title: obj["title"],
515
- installByDefault: !!obj.installByDefault,
516
- // Method `isBrowserDirectory` determines directory to be browser iff
517
- // it starts with some browser name followed by '-'. Some browser names
518
- // are prefixes of others, e.g. 'webkit' is a prefix of `webkit-technology-preview`.
519
- // To avoid older registries erroneously removing 'webkit-technology-preview', we have to
520
- // ensure that browser folders to never include dashes inside.
521
- dir: import_path.default.join(registryDirectory, browserDirectoryPrefix.replace(/-/g, "_") + "-" + revision)
522
- };
523
- return descriptor;
524
- });
525
- }
526
- const allDownloadableDirectoriesThatEverExisted = ["android", "chromium", "firefox", "webkit", "ffmpeg", "firefox-beta", "chromium-tip-of-tree", "chromium-headless-shell", "chromium-tip-of-tree-headless-shell", "winldd"];
527
- const chromiumAliases = ["bidi-chromium", "chrome-for-testing"];
528
- class Registry {
529
- constructor(browsersJSON) {
530
- const descriptors = readDescriptors(browsersJSON);
531
- const findExecutablePath = (dir, name) => {
532
- const tokens = EXECUTABLE_PATHS[name][import_hostPlatform.shortPlatform];
533
- return tokens ? import_path.default.join(dir, ...tokens) : void 0;
534
- };
535
- const executablePathOrDie = (name, e, installByDefault, sdkLanguage) => {
536
- if (!e)
537
- throw new Error(`${name} is not supported on ${import_hostPlatform.hostPlatform}`);
538
- const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install${installByDefault ? "" : " " + name}`);
539
- if (!(0, import_fileUtils.canAccessFile)(e)) {
540
- const currentDockerVersion = (0, import_dependencies.readDockerVersionSync)();
541
- const preferredDockerVersion = currentDockerVersion ? (0, import_dependencies.dockerVersion)(currentDockerVersion.dockerImageNameTemplate) : null;
542
- const isOutdatedDockerImage = currentDockerVersion && preferredDockerVersion && currentDockerVersion.dockerImageName !== preferredDockerVersion.dockerImageName;
543
- const prettyMessage = isOutdatedDockerImage ? [
544
- `Looks like ${sdkLanguage === "javascript" ? "Playwright Test or " : ""}Playwright was just updated to ${preferredDockerVersion.driverVersion}.`,
545
- `Please update docker image as well.`,
546
- `- current: ${currentDockerVersion.dockerImageName}`,
547
- `- required: ${preferredDockerVersion.dockerImageName}`,
548
- ``,
549
- `<3 Playwright Team`
550
- ].join("\n") : [
551
- `Looks like ${sdkLanguage === "javascript" ? "Playwright Test or " : ""}Playwright was just installed or updated.`,
552
- `Please run the following command to download new browser${installByDefault ? "s" : ""}:`,
553
- ``,
554
- ` ${installCommand}`,
555
- ``,
556
- `<3 Playwright Team`
557
- ].join("\n");
558
- throw new Error(`Executable doesn't exist at ${e}
559
- ${(0, import_ascii.wrapInASCIIBox)(prettyMessage, 1)}`);
560
- }
561
- return e;
562
- };
563
- this._executables = [];
564
- const chromium = descriptors.find((d) => d.name === "chromium");
565
- const chromiumExecutable = findExecutablePath(chromium.dir, "chromium");
566
- this._executables.push({
567
- name: "chromium",
568
- browserName: "chromium",
569
- directory: chromium.dir,
570
- executablePath: () => chromiumExecutable,
571
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumExecutable, chromium.installByDefault, sdkLanguage),
572
- installType: chromium.installByDefault ? "download-by-default" : "download-on-demand",
573
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromium.dir, ["chrome-linux"], [], ["chrome-win"]),
574
- downloadURLs: this._downloadURLs(chromium),
575
- title: chromium.title,
576
- revision: chromium.revision,
577
- browserVersion: chromium.browserVersion,
578
- _install: (force) => this._downloadExecutable(chromium, force, chromiumExecutable),
579
- _dependencyGroup: "chromium",
580
- _isHermeticInstallation: true
581
- });
582
- const chromiumHeadlessShell = descriptors.find((d) => d.name === "chromium-headless-shell");
583
- const chromiumHeadlessShellExecutable = findExecutablePath(chromiumHeadlessShell.dir, "chromium-headless-shell");
584
- this._executables.push({
585
- name: "chromium-headless-shell",
586
- browserName: "chromium",
587
- directory: chromiumHeadlessShell.dir,
588
- executablePath: () => chromiumHeadlessShellExecutable,
589
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumHeadlessShellExecutable, chromiumHeadlessShell.installByDefault, sdkLanguage),
590
- installType: chromiumHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
591
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
592
- downloadURLs: this._downloadURLs(chromiumHeadlessShell),
593
- title: chromiumHeadlessShell.title,
594
- revision: chromiumHeadlessShell.revision,
595
- browserVersion: chromiumHeadlessShell.browserVersion,
596
- _install: (force) => this._downloadExecutable(chromiumHeadlessShell, force, chromiumHeadlessShellExecutable),
597
- _dependencyGroup: "chromium",
598
- _isHermeticInstallation: true
599
- });
600
- const chromiumTipOfTreeHeadlessShell = descriptors.find((d) => d.name === "chromium-tip-of-tree-headless-shell");
601
- const chromiumTipOfTreeHeadlessShellExecutable = findExecutablePath(chromiumTipOfTreeHeadlessShell.dir, "chromium-tip-of-tree-headless-shell");
602
- this._executables.push({
603
- name: "chromium-tip-of-tree-headless-shell",
604
- browserName: "chromium",
605
- directory: chromiumTipOfTreeHeadlessShell.dir,
606
- executablePath: () => chromiumTipOfTreeHeadlessShellExecutable,
607
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumTipOfTreeHeadlessShellExecutable, chromiumTipOfTreeHeadlessShell.installByDefault, sdkLanguage),
608
- installType: chromiumTipOfTreeHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
609
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTreeHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
610
- downloadURLs: this._downloadURLs(chromiumTipOfTreeHeadlessShell),
611
- title: chromiumTipOfTreeHeadlessShell.title,
612
- revision: chromiumTipOfTreeHeadlessShell.revision,
613
- browserVersion: chromiumTipOfTreeHeadlessShell.browserVersion,
614
- _install: (force) => this._downloadExecutable(chromiumTipOfTreeHeadlessShell, force, chromiumTipOfTreeHeadlessShellExecutable),
615
- _dependencyGroup: "chromium",
616
- _isHermeticInstallation: true
617
- });
618
- const chromiumTipOfTree = descriptors.find((d) => d.name === "chromium-tip-of-tree");
619
- const chromiumTipOfTreeExecutable = findExecutablePath(chromiumTipOfTree.dir, "chromium-tip-of-tree");
620
- this._executables.push({
621
- name: "chromium-tip-of-tree",
622
- browserName: "chromium",
623
- directory: chromiumTipOfTree.dir,
624
- executablePath: () => chromiumTipOfTreeExecutable,
625
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium-tip-of-tree", chromiumTipOfTreeExecutable, chromiumTipOfTree.installByDefault, sdkLanguage),
626
- installType: chromiumTipOfTree.installByDefault ? "download-by-default" : "download-on-demand",
627
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTree.dir, ["chrome-linux"], [], ["chrome-win"]),
628
- downloadURLs: this._downloadURLs(chromiumTipOfTree),
629
- title: chromiumTipOfTree.title,
630
- revision: chromiumTipOfTree.revision,
631
- browserVersion: chromiumTipOfTree.browserVersion,
632
- _install: (force) => this._downloadExecutable(chromiumTipOfTree, force, chromiumTipOfTreeExecutable),
633
- _dependencyGroup: "chromium",
634
- _isHermeticInstallation: true
635
- });
636
- this._executables.push(this._createChromiumChannel("chrome", {
637
- "linux": "/opt/google/chrome/chrome",
638
- "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
639
- "win32": `\\Google\\Chrome\\Application\\chrome.exe`
640
- }, () => this._installChromiumChannel("chrome", {
641
- "linux": "reinstall_chrome_stable_linux.sh",
642
- "darwin": "reinstall_chrome_stable_mac.sh",
643
- "win32": "reinstall_chrome_stable_win.ps1"
644
- })));
645
- this._executables.push(this._createChromiumChannel("chrome-beta", {
646
- "linux": "/opt/google/chrome-beta/chrome",
647
- "darwin": "/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",
648
- "win32": `\\Google\\Chrome Beta\\Application\\chrome.exe`
649
- }, () => this._installChromiumChannel("chrome-beta", {
650
- "linux": "reinstall_chrome_beta_linux.sh",
651
- "darwin": "reinstall_chrome_beta_mac.sh",
652
- "win32": "reinstall_chrome_beta_win.ps1"
653
- })));
654
- this._executables.push(this._createChromiumChannel("chrome-dev", {
655
- "linux": "/opt/google/chrome-unstable/chrome",
656
- "darwin": "/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",
657
- "win32": `\\Google\\Chrome Dev\\Application\\chrome.exe`
658
- }));
659
- this._executables.push(this._createChromiumChannel("chrome-canary", {
660
- "linux": "/opt/google/chrome-canary/chrome",
661
- "darwin": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
662
- "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
663
- }));
664
- this._executables.push(this._createChromiumChannel("msedge", {
665
- "linux": "/opt/microsoft/msedge/msedge",
666
- "darwin": "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
667
- "win32": `\\Microsoft\\Edge\\Application\\msedge.exe`
668
- }, () => this._installMSEdgeChannel("msedge", {
669
- "linux": "reinstall_msedge_stable_linux.sh",
670
- "darwin": "reinstall_msedge_stable_mac.sh",
671
- "win32": "reinstall_msedge_stable_win.ps1"
672
- })));
673
- this._executables.push(this._createChromiumChannel("msedge-beta", {
674
- "linux": "/opt/microsoft/msedge-beta/msedge",
675
- "darwin": "/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",
676
- "win32": `\\Microsoft\\Edge Beta\\Application\\msedge.exe`
677
- }, () => this._installMSEdgeChannel("msedge-beta", {
678
- "darwin": "reinstall_msedge_beta_mac.sh",
679
- "linux": "reinstall_msedge_beta_linux.sh",
680
- "win32": "reinstall_msedge_beta_win.ps1"
681
- })));
682
- this._executables.push(this._createChromiumChannel("msedge-dev", {
683
- "linux": "/opt/microsoft/msedge-dev/msedge",
684
- "darwin": "/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",
685
- "win32": `\\Microsoft\\Edge Dev\\Application\\msedge.exe`
686
- }, () => this._installMSEdgeChannel("msedge-dev", {
687
- "darwin": "reinstall_msedge_dev_mac.sh",
688
- "linux": "reinstall_msedge_dev_linux.sh",
689
- "win32": "reinstall_msedge_dev_win.ps1"
690
- })));
691
- this._executables.push(this._createChromiumChannel("msedge-canary", {
692
- "linux": "",
693
- "darwin": "/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",
694
- "win32": `\\Microsoft\\Edge SxS\\Application\\msedge.exe`
695
- }));
696
- this._executables.push(this._createBidiFirefoxChannel("moz-firefox", {
697
- "linux": "/snap/bin/firefox",
698
- "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
699
- "win32": "\\Mozilla Firefox\\firefox.exe"
700
- }));
701
- this._executables.push(this._createBidiFirefoxChannel("moz-firefox-beta", {
702
- "linux": "/opt/firefox-beta/firefox",
703
- "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
704
- "win32": "\\Mozilla Firefox\\firefox.exe"
705
- }));
706
- this._executables.push(this._createBidiFirefoxChannel("moz-firefox-nightly", {
707
- "linux": "/opt/firefox-nightly/firefox",
708
- "darwin": "/Applications/Firefox Nightly.app/Contents/MacOS/firefox",
709
- "win32": "\\Mozilla Firefox\\firefox.exe"
710
- }));
711
- this._executables.push(this._createBidiChromiumChannel("bidi-chrome-stable", {
712
- "linux": "/opt/google/chrome/chrome",
713
- "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
714
- "win32": `\\Google\\Chrome\\Application\\chrome.exe`
715
- }));
716
- this._executables.push(this._createBidiChromiumChannel("bidi-chrome-canary", {
717
- "linux": "/opt/google/chrome-canary/chrome",
718
- "darwin": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
719
- "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
720
- }));
721
- const firefox = descriptors.find((d) => d.name === "firefox");
722
- const firefoxExecutable = findExecutablePath(firefox.dir, "firefox");
723
- this._executables.push({
724
- name: "firefox",
725
- browserName: "firefox",
726
- directory: firefox.dir,
727
- executablePath: () => firefoxExecutable,
728
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox", firefoxExecutable, firefox.installByDefault, sdkLanguage),
729
- installType: firefox.installByDefault ? "download-by-default" : "download-on-demand",
730
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefox.dir, ["firefox"], [], ["firefox"]),
731
- downloadURLs: this._downloadURLs(firefox),
732
- title: firefox.title,
733
- revision: firefox.revision,
734
- browserVersion: firefox.browserVersion,
735
- _install: (force) => this._downloadExecutable(firefox, force, firefoxExecutable),
736
- _dependencyGroup: "firefox",
737
- _isHermeticInstallation: true
738
- });
739
- const firefoxBeta = descriptors.find((d) => d.name === "firefox-beta");
740
- const firefoxBetaExecutable = findExecutablePath(firefoxBeta.dir, "firefox");
741
- this._executables.push({
742
- name: "firefox-beta",
743
- browserName: "firefox",
744
- directory: firefoxBeta.dir,
745
- executablePath: () => firefoxBetaExecutable,
746
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox-beta", firefoxBetaExecutable, firefoxBeta.installByDefault, sdkLanguage),
747
- installType: firefoxBeta.installByDefault ? "download-by-default" : "download-on-demand",
748
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefoxBeta.dir, ["firefox"], [], ["firefox"]),
749
- downloadURLs: this._downloadURLs(firefoxBeta),
750
- title: firefoxBeta.title,
751
- revision: firefoxBeta.revision,
752
- browserVersion: firefoxBeta.browserVersion,
753
- _install: (force) => this._downloadExecutable(firefoxBeta, force, firefoxBetaExecutable),
754
- _dependencyGroup: "firefox",
755
- _isHermeticInstallation: true
756
- });
757
- const webkit = descriptors.find((d) => d.name === "webkit");
758
- const webkitExecutable = findExecutablePath(webkit.dir, "webkit");
759
- const webkitLinuxLddDirectories = [
760
- import_path.default.join("minibrowser-gtk"),
761
- import_path.default.join("minibrowser-gtk", "bin"),
762
- import_path.default.join("minibrowser-gtk", "lib"),
763
- import_path.default.join("minibrowser-gtk", "sys", "lib"),
764
- import_path.default.join("minibrowser-wpe"),
765
- import_path.default.join("minibrowser-wpe", "bin"),
766
- import_path.default.join("minibrowser-wpe", "lib"),
767
- import_path.default.join("minibrowser-wpe", "sys", "lib")
768
- ];
769
- this._executables.push({
770
- name: "webkit",
771
- browserName: "webkit",
772
- directory: webkit.dir,
773
- executablePath: () => webkitExecutable,
774
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("webkit", webkitExecutable, webkit.installByDefault, sdkLanguage),
775
- installType: webkit.installByDefault ? "download-by-default" : "download-on-demand",
776
- _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, webkit.dir, webkitLinuxLddDirectories, ["libGLESv2.so.2", "libx264.so"], [""]),
777
- downloadURLs: this._downloadURLs(webkit),
778
- title: webkit.title,
779
- revision: webkit.revision,
780
- browserVersion: webkit.browserVersion,
781
- _install: (force) => this._downloadExecutable(webkit, force, webkitExecutable),
782
- _dependencyGroup: "webkit",
783
- _isHermeticInstallation: true
784
- });
785
- this._executables.push({
786
- name: "webkit-wsl",
787
- browserName: "webkit",
788
- directory: webkit.dir,
789
- executablePath: () => webkitExecutable,
790
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("webkit", webkitExecutable, webkit.installByDefault, sdkLanguage),
791
- installType: "download-on-demand",
792
- title: "Webkit in WSL",
793
- _validateHostRequirements: (sdkLanguage) => Promise.resolve(),
794
- _isHermeticInstallation: true,
795
- _install: async () => {
796
- if (process.platform !== "win32")
797
- throw new Error(`WebKit via WSL is only supported on Windows`);
798
- const script = import_path.default.join(BIN_PATH, "install_webkit_wsl.ps1");
799
- const { code } = await (0, import_spawnAsync.spawnAsync)("powershell.exe", [
800
- "-ExecutionPolicy",
801
- "Bypass",
802
- "-File",
803
- script
804
- ], {
805
- stdio: "inherit"
806
- });
807
- if (code !== 0)
808
- throw new Error(`Failed to install WebKit via WSL`);
809
- }
810
- });
811
- const ffmpeg = descriptors.find((d) => d.name === "ffmpeg");
812
- const ffmpegExecutable = findExecutablePath(ffmpeg.dir, "ffmpeg");
813
- this._executables.push({
814
- name: "ffmpeg",
815
- browserName: void 0,
816
- directory: ffmpeg.dir,
817
- executablePath: () => ffmpegExecutable,
818
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("ffmpeg", ffmpegExecutable, ffmpeg.installByDefault, sdkLanguage),
819
- installType: ffmpeg.installByDefault ? "download-by-default" : "download-on-demand",
820
- _validateHostRequirements: () => Promise.resolve(),
821
- downloadURLs: this._downloadURLs(ffmpeg),
822
- title: ffmpeg.title,
823
- revision: ffmpeg.revision,
824
- _install: (force) => this._downloadExecutable(ffmpeg, force, ffmpegExecutable),
825
- _dependencyGroup: "tools",
826
- _isHermeticInstallation: true
827
- });
828
- const winldd = descriptors.find((d) => d.name === "winldd");
829
- const winlddExecutable = findExecutablePath(winldd.dir, "winldd");
830
- this._executables.push({
831
- name: "winldd",
832
- browserName: void 0,
833
- directory: winldd.dir,
834
- executablePath: () => winlddExecutable,
835
- executablePathOrDie: (sdkLanguage) => executablePathOrDie("winldd", winlddExecutable, winldd.installByDefault, sdkLanguage),
836
- installType: process.platform === "win32" ? "download-by-default" : "none",
837
- _validateHostRequirements: () => Promise.resolve(),
838
- downloadURLs: this._downloadURLs(winldd),
839
- title: winldd.title,
840
- revision: winldd.revision,
841
- _install: (force) => this._downloadExecutable(winldd, force, winlddExecutable),
842
- _dependencyGroup: "tools",
843
- _isHermeticInstallation: true
844
- });
845
- const android = descriptors.find((d) => d.name === "android");
846
- this._executables.push({
847
- name: "android",
848
- browserName: void 0,
849
- directory: android.dir,
850
- executablePath: () => void 0,
851
- executablePathOrDie: () => "",
852
- installType: "download-on-demand",
853
- _validateHostRequirements: () => Promise.resolve(),
854
- downloadURLs: this._downloadURLs(android),
855
- title: android.title,
856
- revision: android.revision,
857
- _install: (force) => this._downloadExecutable(android, force),
858
- _dependencyGroup: "tools",
859
- _isHermeticInstallation: true
860
- });
861
- }
862
- _createChromiumChannel(name, lookAt, install) {
863
- const executablePath = (sdkLanguage, shouldThrow) => {
864
- const suffix = lookAt[process.platform];
865
- if (!suffix) {
866
- if (shouldThrow)
867
- throw new Error(`Chromium distribution '${name}' is not supported on ${process.platform}`);
868
- return void 0;
869
- }
870
- const prefixes = process.platform === "win32" ? [
871
- process.env.LOCALAPPDATA,
872
- process.env.PROGRAMFILES,
873
- process.env["PROGRAMFILES(X86)"],
874
- // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
875
- process.env.HOMEDRIVE + "\\Program Files",
876
- process.env.HOMEDRIVE + "\\Program Files (x86)"
877
- ].filter(Boolean) : [""];
878
- for (const prefix of prefixes) {
879
- const executablePath2 = import_path.default.join(prefix, suffix);
880
- if ((0, import_fileUtils.canAccessFile)(executablePath2))
881
- return executablePath2;
882
- }
883
- if (!shouldThrow)
884
- return void 0;
885
- const location = prefixes.length ? ` at ${import_path.default.join(prefixes[0], suffix)}` : ``;
886
- const installation = install ? `
887
- Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
888
- throw new Error(`Chromium distribution '${name}' is not found${location}${installation}`);
889
- };
890
- return {
891
- name,
892
- browserName: "chromium",
893
- directory: void 0,
894
- executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
895
- executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
896
- installType: install ? "install-script" : "none",
897
- _validateHostRequirements: () => Promise.resolve(),
898
- _isHermeticInstallation: false,
899
- _install: install
900
- };
901
- }
902
- _createBidiFirefoxChannel(name, lookAt, install) {
903
- const executablePath = (sdkLanguage, shouldThrow) => {
904
- const suffix = lookAt[process.platform];
905
- if (!suffix) {
906
- if (shouldThrow)
907
- throw new Error(`Firefox distribution '${name}' is not supported on ${process.platform}`);
908
- return void 0;
909
- }
910
- const prefixes = process.platform === "win32" ? [
911
- process.env.LOCALAPPDATA,
912
- process.env.PROGRAMFILES,
913
- process.env["PROGRAMFILES(X86)"],
914
- // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
915
- process.env.HOMEDRIVE + "\\Program Files",
916
- process.env.HOMEDRIVE + "\\Program Files (x86)"
917
- ].filter(Boolean) : [""];
918
- for (const prefix of prefixes) {
919
- const executablePath2 = import_path.default.join(prefix, suffix);
920
- if ((0, import_fileUtils.canAccessFile)(executablePath2))
921
- return executablePath2;
922
- }
923
- if (shouldThrow)
924
- throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths. ${`Tried paths:
925
- ${prefixes.map((p) => import_path.default.join(p, suffix)).join("\n ")}`}`);
926
- return void 0;
927
- };
928
- return {
929
- name,
930
- browserName: "firefox",
931
- directory: void 0,
932
- executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
933
- executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
934
- installType: "none",
935
- _validateHostRequirements: () => Promise.resolve(),
936
- _isHermeticInstallation: true,
937
- _install: install
938
- };
939
- }
940
- _createBidiChromiumChannel(name, lookAt) {
941
- const executablePath = (sdkLanguage, shouldThrow) => {
942
- const suffix = lookAt[process.platform];
943
- if (!suffix) {
944
- if (shouldThrow)
945
- throw new Error(`Chromium distribution '${name}' is not supported on ${process.platform}`);
946
- return void 0;
947
- }
948
- const prefixes = process.platform === "win32" ? [
949
- process.env.LOCALAPPDATA,
950
- process.env.PROGRAMFILES,
951
- process.env["PROGRAMFILES(X86)"],
952
- // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
953
- process.env.HOMEDRIVE + "\\Program Files",
954
- process.env.HOMEDRIVE + "\\Program Files (x86)"
955
- ].filter(Boolean) : [""];
956
- for (const prefix of prefixes) {
957
- const executablePath2 = import_path.default.join(prefix, suffix);
958
- if ((0, import_fileUtils.canAccessFile)(executablePath2))
959
- return executablePath2;
960
- }
961
- if (!shouldThrow)
962
- return void 0;
963
- const location = prefixes.length ? ` at ${import_path.default.join(prefixes[0], suffix)}` : ``;
964
- throw new Error(`Chromium distribution '${name}' is not found${location}`);
965
- };
966
- return {
967
- name,
968
- browserName: "chromium",
969
- directory: void 0,
970
- executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
971
- executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
972
- installType: "none",
973
- _validateHostRequirements: () => Promise.resolve(),
974
- _isHermeticInstallation: false
975
- };
976
- }
977
- executables() {
978
- return this._executables;
979
- }
980
- findExecutable(name) {
981
- return this._executables.find((b) => b.name === name);
982
- }
983
- defaultExecutables() {
984
- return this._executables.filter((e) => e.installType === "download-by-default");
985
- }
986
- _dedupe(executables) {
987
- return Array.from(new Set(executables));
988
- }
989
- async _validateHostRequirements(sdkLanguage, browserDirectory, linuxLddDirectories, dlOpenLibraries, windowsExeAndDllDirectories) {
990
- if (import_os.default.platform() === "linux")
991
- return await (0, import_dependencies2.validateDependenciesLinux)(sdkLanguage, linuxLddDirectories.map((d) => import_path.default.join(browserDirectory, d)), dlOpenLibraries);
992
- if (import_os.default.platform() === "win32" && import_os.default.arch() === "x64")
993
- return await (0, import_dependencies2.validateDependenciesWindows)(sdkLanguage, windowsExeAndDllDirectories.map((d) => import_path.default.join(browserDirectory, d)));
994
- }
995
- async installDeps(executablesToInstallDeps, dryRun) {
996
- const executables = this._dedupe(executablesToInstallDeps);
997
- const targets = /* @__PURE__ */ new Set();
998
- for (const executable of executables) {
999
- if (executable._dependencyGroup)
1000
- targets.add(executable._dependencyGroup);
1001
- }
1002
- targets.add("tools");
1003
- if (import_os.default.platform() === "win32")
1004
- return await (0, import_dependencies2.installDependenciesWindows)(targets, dryRun);
1005
- if (import_os.default.platform() === "linux")
1006
- return await (0, import_dependencies2.installDependenciesLinux)(targets, dryRun);
1007
- }
1008
- async install(executablesToInstall, options) {
1009
- const executables = this._dedupe(executablesToInstall);
1010
- await import_fs.default.promises.mkdir(registryDirectory, { recursive: true });
1011
- const lockfilePath = import_path.default.join(registryDirectory, "__dirlock");
1012
- const linksDir = import_path.default.join(registryDirectory, ".links");
1013
- let releaseLock;
1014
- try {
1015
- releaseLock = await import_utilsBundle.lockfile.lock(registryDirectory, {
1016
- retries: {
1017
- // Retry 20 times during 10 minutes with
1018
- // exponential back-off.
1019
- // See documentation at: https://www.npmjs.com/package/retry#retrytimeoutsoptions
1020
- retries: 20,
1021
- factor: 1.27579
1022
- },
1023
- onCompromised: (err) => {
1024
- throw new Error(`${err.message} Path: ${lockfilePath}`);
1025
- },
1026
- lockfilePath
1027
- });
1028
- await import_fs.default.promises.mkdir(linksDir, { recursive: true });
1029
- await import_fs.default.promises.writeFile(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH)), PACKAGE_PATH);
1030
- if (!(0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_GC"))
1031
- await this._validateInstallationCache(linksDir);
1032
- for (const executable of executables) {
1033
- if (!executable._install)
1034
- throw new Error(`ERROR: Playwright does not support installing ${executable.name}`);
1035
- const { embedderName } = (0, import_userAgent.getEmbedderName)();
1036
- if (!(0, import_utils.getAsBooleanFromENV)("CI") && !executable._isHermeticInstallation && !options?.force && executable.executablePath(embedderName)) {
1037
- const command = buildPlaywrightCLICommand(embedderName, "install --force " + executable.name);
1038
- process.stderr.write("\n" + (0, import_ascii.wrapInASCIIBox)([
1039
- `ATTENTION: "${executable.name}" is already installed on the system!`,
1040
- ``,
1041
- `"${executable.name}" installation is not hermetic; installing newer version`,
1042
- `requires *removal* of a current installation first.`,
1043
- ``,
1044
- `To *uninstall* current version and re-install latest "${executable.name}":`,
1045
- ``,
1046
- `- Close all running instances of "${executable.name}", if any`,
1047
- `- Use "--force" to install browser:`,
1048
- ``,
1049
- ` ${command}`,
1050
- ``,
1051
- `<3 Playwright Team`
1052
- ].join("\n"), 1) + "\n\n");
1053
- return;
1054
- }
1055
- await executable._install(!!options?.force);
1056
- }
1057
- } catch (e) {
1058
- if (e.code === "ELOCKED") {
1059
- const rmCommand = process.platform === "win32" ? "rm -R" : "rm -rf";
1060
- throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)([
1061
- `An active lockfile is found at:`,
1062
- ``,
1063
- ` ${lockfilePath}`,
1064
- ``,
1065
- `Either:`,
1066
- `- wait a few minutes if other Playwright is installing browsers in parallel`,
1067
- `- remove lock manually with:`,
1068
- ``,
1069
- ` ${rmCommand} ${lockfilePath}`,
1070
- ``,
1071
- `<3 Playwright Team`
1072
- ].join("\n"), 1));
1073
- } else {
1074
- throw e;
1075
- }
1076
- } finally {
1077
- if (releaseLock)
1078
- await releaseLock();
1079
- }
1080
- }
1081
- async uninstall(all) {
1082
- const linksDir = import_path.default.join(registryDirectory, ".links");
1083
- if (all) {
1084
- const links = await import_fs.default.promises.readdir(linksDir).catch(() => []);
1085
- for (const link of links)
1086
- await import_fs.default.promises.unlink(import_path.default.join(linksDir, link));
1087
- } else {
1088
- await import_fs.default.promises.unlink(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH))).catch(() => {
1089
- });
1090
- }
1091
- await this._validateInstallationCache(linksDir);
1092
- return {
1093
- numberOfBrowsersLeft: (await import_fs.default.promises.readdir(registryDirectory).catch(() => [])).filter((browserDirectory) => isBrowserDirectory(browserDirectory)).length
1094
- };
1095
- }
1096
- async validateHostRequirementsForExecutablesIfNeeded(executables, sdkLanguage) {
1097
- if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS")) {
1098
- process.stderr.write("Skipping host requirements validation logic because `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS` env variable is set.\n");
1099
- return;
1100
- }
1101
- for (const executable of executables)
1102
- await this._validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage);
1103
- }
1104
- async _validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage) {
1105
- const kMaximumReValidationPeriod = 30 * 24 * 60 * 60 * 1e3;
1106
- if (!executable.directory)
1107
- return;
1108
- const markerFile = import_path.default.join(executable.directory, "DEPENDENCIES_VALIDATED");
1109
- if (await import_fs.default.promises.stat(markerFile).then((stat) => Date.now() - stat.mtime.getTime() < kMaximumReValidationPeriod).catch(() => false))
1110
- return;
1111
- import_debugLogger.debugLogger.log("install", `validating host requirements for "${executable.name}"`);
1112
- try {
1113
- await executable._validateHostRequirements(sdkLanguage);
1114
- import_debugLogger.debugLogger.log("install", `validation passed for ${executable.name}`);
1115
- } catch (error) {
1116
- import_debugLogger.debugLogger.log("install", `validation failed for ${executable.name}`);
1117
- throw error;
1118
- }
1119
- await import_fs.default.promises.writeFile(markerFile, "").catch(() => {
1120
- });
1121
- }
1122
- _downloadURLs(descriptor) {
1123
- const paths = DOWNLOAD_PATHS[descriptor.name];
1124
- const downloadPathTemplate = paths[import_hostPlatform.hostPlatform] || paths["<unknown>"];
1125
- if (!downloadPathTemplate)
1126
- return [];
1127
- let downloadPath;
1128
- let mirrors;
1129
- if (typeof downloadPathTemplate === "function") {
1130
- const result = downloadPathTemplate(descriptor);
1131
- downloadPath = result.path;
1132
- mirrors = result.mirrors;
1133
- } else {
1134
- downloadPath = util.format(downloadPathTemplate, descriptor.revision);
1135
- mirrors = PLAYWRIGHT_CDN_MIRRORS;
1136
- }
1137
- let downloadHostEnv;
1138
- if (descriptor.name.startsWith("chromium"))
1139
- downloadHostEnv = "PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST";
1140
- else if (descriptor.name.startsWith("firefox"))
1141
- downloadHostEnv = "PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST";
1142
- else if (descriptor.name.startsWith("webkit"))
1143
- downloadHostEnv = "PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST";
1144
- const customHostOverride = downloadHostEnv && (0, import_utils.getFromENV)(downloadHostEnv) || (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_HOST");
1145
- if (customHostOverride)
1146
- mirrors = [customHostOverride];
1147
- return mirrors.map((mirror) => `${mirror}/${downloadPath}`);
1148
- }
1149
- async _downloadExecutable(descriptor, force, executablePath) {
1150
- const downloadURLs = this._downloadURLs(descriptor);
1151
- if (!downloadURLs.length)
1152
- throw new Error(`ERROR: Playwright does not support ${descriptor.name} on ${import_hostPlatform.hostPlatform}`);
1153
- if (!import_hostPlatform.isOfficiallySupportedPlatform)
1154
- (0, import_browserFetcher.logPolitely)(`BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ${import_hostPlatform.hostPlatform}.`);
1155
- if (descriptor.hasRevisionOverride) {
1156
- const message = `You are using a frozen ${descriptor.name} browser which does not receive updates anymore on ${import_hostPlatform.hostPlatform}. Please update to the latest version of your operating system to test up-to-date browsers.`;
1157
- if (process.env.GITHUB_ACTIONS)
1158
- console.log(`::warning title=Playwright::${message}`);
1159
- else
1160
- (0, import_browserFetcher.logPolitely)(message);
1161
- }
1162
- const title = this.calculateDownloadTitle(descriptor);
1163
- const downloadFileName = `playwright-download-${descriptor.name}-${import_hostPlatform.hostPlatform}-${descriptor.revision}.zip`;
1164
- const downloadSocketTimeoutEnv = (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT");
1165
- const downloadSocketTimeout = +(downloadSocketTimeoutEnv || "0") || import_network.NET_DEFAULT_TIMEOUT;
1166
- await (0, import_browserFetcher.downloadBrowserWithProgressBar)(title, descriptor.dir, executablePath, downloadURLs, downloadFileName, downloadSocketTimeout, force).catch((e) => {
1167
- throw new Error(`Failed to download ${title}, caused by
1168
- ${e.stack}`);
1169
- });
1170
- }
1171
- calculateDownloadTitle(descriptor) {
1172
- const title = descriptor.title ?? descriptor.name.split("-").map((word) => {
1173
- return word === "ffmpeg" ? "FFmpeg" : word.charAt(0).toUpperCase() + word.slice(1);
1174
- }).join(" ");
1175
- const version = descriptor.browserVersion ? " " + descriptor.browserVersion : "";
1176
- return `${title}${version} (playwright ${descriptor.name} v${descriptor.revision})`;
1177
- }
1178
- async _installMSEdgeChannel(channel, scripts) {
1179
- const scriptArgs = [];
1180
- if (process.platform !== "linux") {
1181
- const products = lowercaseAllKeys(JSON.parse(await (0, import_network.fetchData)(void 0, { url: "https://edgeupdates.microsoft.com/api/products" })));
1182
- const productName = {
1183
- "msedge": "Stable",
1184
- "msedge-beta": "Beta",
1185
- "msedge-dev": "Dev"
1186
- }[channel];
1187
- const product = products.find((product2) => product2.product === productName);
1188
- const searchConfig = {
1189
- darwin: { platform: "MacOS", arch: "universal", artifact: "pkg" },
1190
- win32: { platform: "Windows", arch: "x64", artifact: "msi" }
1191
- }[process.platform];
1192
- const release = searchConfig ? product.releases.find((release2) => release2.platform === searchConfig.platform && release2.architecture === searchConfig.arch && release2.artifacts.length > 0) : null;
1193
- const artifact = release ? release.artifacts.find((artifact2) => artifact2.artifactname === searchConfig.artifact) : null;
1194
- if (artifact)
1195
- scriptArgs.push(
1196
- artifact.location
1197
- /* url */
1198
- );
1199
- else
1200
- throw new Error(`Cannot install ${channel} on ${process.platform}`);
1201
- }
1202
- await this._installChromiumChannel(channel, scripts, scriptArgs);
1203
- }
1204
- async _installChromiumChannel(channel, scripts, scriptArgs = []) {
1205
- const scriptName = scripts[process.platform];
1206
- if (!scriptName)
1207
- throw new Error(`Cannot install ${channel} on ${process.platform}`);
1208
- const cwd = BIN_PATH;
1209
- const isPowerShell = scriptName.endsWith(".ps1");
1210
- if (isPowerShell) {
1211
- const args = [
1212
- "-ExecutionPolicy",
1213
- "Bypass",
1214
- "-File",
1215
- import_path.default.join(BIN_PATH, scriptName),
1216
- ...scriptArgs
1217
- ];
1218
- const { code } = await (0, import_spawnAsync.spawnAsync)("powershell.exe", args, { cwd, stdio: "inherit" });
1219
- if (code !== 0)
1220
- throw new Error(`Failed to install ${channel}`);
1221
- } else {
1222
- const { command, args, elevatedPermissions } = await (0, import_dependencies.transformCommandsForRoot)([`bash "${import_path.default.join(BIN_PATH, scriptName)}" ${scriptArgs.join("")}`]);
1223
- if (elevatedPermissions)
1224
- console.log("Switching to root user to install dependencies...");
1225
- const { code } = await (0, import_spawnAsync.spawnAsync)(command, args, { cwd, stdio: "inherit" });
1226
- if (code !== 0)
1227
- throw new Error(`Failed to install ${channel}`);
1228
- }
1229
- }
1230
- async listInstalledBrowsers() {
1231
- const linksDir = import_path.default.join(registryDirectory, ".links");
1232
- const { browsers } = await this._traverseBrowserInstallations(linksDir);
1233
- return browsers.filter((browser) => import_fs.default.existsSync(browser.browserPath));
1234
- }
1235
- async _validateInstallationCache(linksDir) {
1236
- const { browsers, brokenLinks } = await this._traverseBrowserInstallations(linksDir);
1237
- await this._deleteStaleBrowsers(browsers);
1238
- await this._deleteBrokenInstallations(brokenLinks);
1239
- }
1240
- async _traverseBrowserInstallations(linksDir) {
1241
- const browserList = [];
1242
- const brokenLinks = [];
1243
- for (const fileName of await import_fs.default.promises.readdir(linksDir)) {
1244
- const linkPath = import_path.default.join(linksDir, fileName);
1245
- let linkTarget = "";
1246
- try {
1247
- linkTarget = (await import_fs.default.promises.readFile(linkPath)).toString();
1248
- const browsersJSON = require(import_path.default.join(linkTarget, "browsers.json"));
1249
- const descriptors = readDescriptors(browsersJSON);
1250
- for (const browserName of allDownloadableDirectoriesThatEverExisted) {
1251
- const descriptor = descriptors.find((d) => d.name === browserName);
1252
- if (!descriptor)
1253
- continue;
1254
- const browserPath = descriptor.dir;
1255
- const browserVersion = parseInt(descriptor.revision, 10);
1256
- browserList.push({
1257
- browserName,
1258
- browserVersion,
1259
- browserPath,
1260
- referenceDir: linkTarget
1261
- });
1262
- }
1263
- } catch (e) {
1264
- brokenLinks.push(linkPath);
1265
- }
1266
- }
1267
- return { browsers: browserList, brokenLinks };
1268
- }
1269
- async _deleteStaleBrowsers(browserList) {
1270
- const usedBrowserPaths = /* @__PURE__ */ new Set();
1271
- for (const browser of browserList) {
1272
- const { browserName, browserVersion, browserPath } = browser;
1273
- const shouldHaveMarkerFile = browserName === "chromium" && (browserVersion >= 786218 || browserVersion < 3e5) || browserName === "firefox" && browserVersion >= 1128 || browserName === "webkit" && browserVersion >= 1307 || // All new applications have a marker file right away.
1274
- browserName !== "firefox" && browserName !== "chromium" && browserName !== "webkit";
1275
- if (!shouldHaveMarkerFile || await (0, import_fileUtils.existsAsync)(browserDirectoryToMarkerFilePath(browserPath)))
1276
- usedBrowserPaths.add(browserPath);
1277
- }
1278
- let downloadedBrowsers = (await import_fs.default.promises.readdir(registryDirectory)).map((file) => import_path.default.join(registryDirectory, file));
1279
- downloadedBrowsers = downloadedBrowsers.filter((file) => isBrowserDirectory(file));
1280
- const directories = new Set(downloadedBrowsers);
1281
- for (const browserDirectory of usedBrowserPaths)
1282
- directories.delete(browserDirectory);
1283
- for (const directory of directories)
1284
- (0, import_browserFetcher.logPolitely)("Removing unused browser at " + directory);
1285
- await (0, import_fileUtils.removeFolders)([...directories]);
1286
- }
1287
- async _deleteBrokenInstallations(brokenLinks) {
1288
- for (const linkPath of brokenLinks)
1289
- await import_fs.default.promises.unlink(linkPath).catch((e) => {
1290
- });
1291
- }
1292
- _defaultBrowsersToInstall(options) {
1293
- let executables = this.defaultExecutables();
1294
- if (options.shell === "no")
1295
- executables = executables.filter((e) => e.name !== "chromium-headless-shell" && e.name !== "chromium-tip-of-tree-headless-shell");
1296
- if (options.shell === "only")
1297
- executables = executables.filter((e) => e.name !== "chromium" && e.name !== "chromium-tip-of-tree");
1298
- return executables;
1299
- }
1300
- suggestedBrowsersToInstall() {
1301
- const names = this.executables().filter((e) => e.installType !== "none").map((e) => e.name);
1302
- names.push(...chromiumAliases);
1303
- return names.sort().join(", ");
1304
- }
1305
- isChromiumAlias(name) {
1306
- return chromiumAliases.includes(name);
1307
- }
1308
- resolveBrowsers(aliases, options) {
1309
- if (aliases.length === 0)
1310
- return this._defaultBrowsersToInstall(options);
1311
- const faultyArguments = [];
1312
- const executables = [];
1313
- const handleArgument = (arg) => {
1314
- const executable = this.findExecutable(arg);
1315
- if (!executable || executable.installType === "none")
1316
- faultyArguments.push(arg);
1317
- else
1318
- executables.push(executable);
1319
- if (executable?.browserName)
1320
- executables.push(this.findExecutable("ffmpeg"));
1321
- };
1322
- for (const alias of aliases) {
1323
- if (alias === "chromium" || chromiumAliases.includes(alias)) {
1324
- if (options.shell !== "only")
1325
- handleArgument("chromium");
1326
- if (options.shell !== "no")
1327
- handleArgument("chromium-headless-shell");
1328
- } else if (alias === "chromium-tip-of-tree") {
1329
- if (options.shell !== "only")
1330
- handleArgument("chromium-tip-of-tree");
1331
- if (options.shell !== "no")
1332
- handleArgument("chromium-tip-of-tree-headless-shell");
1333
- } else {
1334
- handleArgument(alias);
1335
- }
1336
- }
1337
- if (process.platform === "win32")
1338
- executables.push(this.findExecutable("winldd"));
1339
- if (faultyArguments.length)
1340
- throw new Error(`Invalid installation targets: ${faultyArguments.map((name) => `'${name}'`).join(", ")}. Expecting one of: ${this.suggestedBrowsersToInstall()}`);
1341
- return executables;
1342
- }
1343
- }
1344
- function browserDirectoryToMarkerFilePath(browserDirectory) {
1345
- return import_path.default.join(browserDirectory, "INSTALLATION_COMPLETE");
1346
- }
1347
- function buildPlaywrightCLICommand(sdkLanguage, parameters) {
1348
- switch (sdkLanguage) {
1349
- case "python":
1350
- return `playwright ${parameters}`;
1351
- case "java":
1352
- return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="${parameters}"`;
1353
- case "csharp":
1354
- return `pwsh bin/Debug/netX/playwright.ps1 ${parameters}`;
1355
- default: {
1356
- const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
1357
- return `${packageManagerCommand} playwright ${parameters}`;
1358
- }
1359
- }
1360
- }
1361
- async function installBrowsersForNpmInstall(browsers) {
1362
- if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")) {
1363
- (0, import_browserFetcher.logPolitely)("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
1364
- return false;
1365
- }
1366
- const executables = [];
1367
- if (process.platform === "win32")
1368
- executables.push(registry.findExecutable("winldd"));
1369
- for (const browserName of browsers) {
1370
- const executable = registry.findExecutable(browserName);
1371
- if (!executable || executable.installType === "none")
1372
- throw new Error(`Cannot install ${browserName}`);
1373
- executables.push(executable);
1374
- }
1375
- await registry.install(executables);
1376
- }
1377
- function findChromiumChannelBestEffort(sdkLanguage) {
1378
- let channel = null;
1379
- for (const name of ["chromium", "chrome", "msedge"]) {
1380
- try {
1381
- registry.findExecutable(name).executablePathOrDie(sdkLanguage);
1382
- channel = name === "chromium" ? void 0 : name;
1383
- break;
1384
- } catch (e) {
1385
- }
1386
- }
1387
- if (channel === null) {
1388
- const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install chromium`);
1389
- const prettyMessage = [
1390
- `No chromium-based browser found on the system.`,
1391
- `Please run the following command to download one:`,
1392
- ``,
1393
- ` ${installCommand}`,
1394
- ``,
1395
- `<3 Playwright Team`
1396
- ].join("\n");
1397
- throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)(prettyMessage, 1));
1398
- }
1399
- return channel;
1400
- }
1401
- function lowercaseAllKeys(json) {
1402
- if (typeof json !== "object" || !json)
1403
- return json;
1404
- if (Array.isArray(json))
1405
- return json.map(lowercaseAllKeys);
1406
- const result = {};
1407
- for (const [key, value] of Object.entries(json))
1408
- result[key.toLowerCase()] = lowercaseAllKeys(value);
1409
- return result;
1410
- }
1411
- const registry = new Registry(require("../../../browsers.json"));
1412
- // Annotate the CommonJS export names for ESM import in node:
1413
- 0 && (module.exports = {
1414
- Registry,
1415
- browserDirectoryToMarkerFilePath,
1416
- buildPlaywrightCLICommand,
1417
- findChromiumChannelBestEffort,
1418
- installBrowsersForNpmInstall,
1419
- registry,
1420
- registryDirectory,
1421
- writeDockerVersion
1422
- });
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var registry_exports = {};
30
+ __export(registry_exports, {
31
+ Registry: () => Registry,
32
+ browserDirectoryToMarkerFilePath: () => browserDirectoryToMarkerFilePath,
33
+ buildPlaywrightCLICommand: () => buildPlaywrightCLICommand,
34
+ defaultCacheDirectory: () => defaultCacheDirectory,
35
+ defaultRegistryDirectory: () => defaultRegistryDirectory,
36
+ findChromiumChannelBestEffort: () => findChromiumChannelBestEffort,
37
+ installBrowsersForNpmInstall: () => installBrowsersForNpmInstall,
38
+ registry: () => registry,
39
+ registryDirectory: () => registryDirectory,
40
+ writeDockerVersion: () => import_dependencies3.writeDockerVersion
41
+ });
42
+ module.exports = __toCommonJS(registry_exports);
43
+ var import_fs = __toESM(require("fs"));
44
+ var import_os = __toESM(require("os"));
45
+ var import_path = __toESM(require("path"));
46
+ var util = __toESM(require("util"));
47
+ var import_browserFetcher = require("./browserFetcher");
48
+ var import_dependencies = require("./dependencies");
49
+ var import_dependencies2 = require("./dependencies");
50
+ var import_utils = require("../../utils");
51
+ var import_ascii = require("../utils/ascii");
52
+ var import_debugLogger = require("../utils/debugLogger");
53
+ var import_hostPlatform = require("../utils/hostPlatform");
54
+ var import_network = require("../utils/network");
55
+ var import_spawnAsync = require("../utils/spawnAsync");
56
+ var import_userAgent = require("../utils/userAgent");
57
+ var import_utilsBundle = require("../../utilsBundle");
58
+ var import_fileUtils = require("../utils/fileUtils");
59
+ var import_dependencies3 = require("./dependencies");
60
+ const PACKAGE_PATH = import_path.default.join(__dirname, "..", "..", "..");
61
+ const BIN_PATH = import_path.default.join(__dirname, "..", "..", "..", "bin");
62
+ const PLAYWRIGHT_CDN_MIRRORS = [
63
+ "https://cdn.playwright.dev/dbazure/download/playwright",
64
+ // ESRP CDN
65
+ "https://playwright.download.prss.microsoft.com/dbazure/download/playwright",
66
+ // Directly hit ESRP CDN
67
+ "https://cdn.playwright.dev"
68
+ // Hit the Storage Bucket directly
69
+ ];
70
+ if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
71
+ for (let i = 0; i < PLAYWRIGHT_CDN_MIRRORS.length; i++) {
72
+ const cdn = PLAYWRIGHT_CDN_MIRRORS[i];
73
+ if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
74
+ const parsedCDN = new URL(cdn);
75
+ parsedCDN.hostname = parsedCDN.hostname + ".does-not-resolve.playwright.dev";
76
+ PLAYWRIGHT_CDN_MIRRORS[i] = parsedCDN.toString();
77
+ }
78
+ }
79
+ }
80
+ const EXECUTABLE_PATHS = {
81
+ "chromium": {
82
+ "<unknown>": void 0,
83
+ "linux-x64": ["chrome-linux64", "chrome"],
84
+ "linux-arm64": ["chrome-linux", "chrome"],
85
+ // non-cft build
86
+ "mac-x64": ["chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
87
+ "mac-arm64": ["chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
88
+ "win-x64": ["chrome-win64", "chrome.exe"]
89
+ },
90
+ "chromium-headless-shell": {
91
+ "<unknown>": void 0,
92
+ "linux-x64": ["chrome-headless-shell-linux64", "chrome-headless-shell"],
93
+ "linux-arm64": ["chrome-linux", "headless_shell"],
94
+ // non-cft build
95
+ "mac-x64": ["chrome-headless-shell-mac-x64", "chrome-headless-shell"],
96
+ "mac-arm64": ["chrome-headless-shell-mac-arm64", "chrome-headless-shell"],
97
+ "win-x64": ["chrome-headless-shell-win64", "chrome-headless-shell.exe"]
98
+ },
99
+ "chromium-tip-of-tree": {
100
+ "<unknown>": void 0,
101
+ "linux-x64": ["chrome-linux64", "chrome"],
102
+ "linux-arm64": ["chrome-linux", "chrome"],
103
+ // non-cft build
104
+ "mac-x64": ["chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
105
+ "mac-arm64": ["chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"],
106
+ "win-x64": ["chrome-win64", "chrome.exe"]
107
+ },
108
+ "chromium-tip-of-tree-headless-shell": {
109
+ "<unknown>": void 0,
110
+ "linux-x64": ["chrome-headless-shell-linux64", "chrome-headless-shell"],
111
+ "linux-arm64": ["chrome-linux", "headless_shell"],
112
+ // non-cft build
113
+ "mac-x64": ["chrome-headless-shell-mac-x64", "chrome-headless-shell"],
114
+ "mac-arm64": ["chrome-headless-shell-mac-arm64", "chrome-headless-shell"],
115
+ "win-x64": ["chrome-headless-shell-win64", "chrome-headless-shell.exe"]
116
+ },
117
+ "firefox": {
118
+ "<unknown>": void 0,
119
+ "linux-x64": ["firefox", "firefox"],
120
+ "linux-arm64": ["firefox", "firefox"],
121
+ "mac-x64": ["firefox", "Nightly.app", "Contents", "MacOS", "firefox"],
122
+ "mac-arm64": ["firefox", "Nightly.app", "Contents", "MacOS", "firefox"],
123
+ "win-x64": ["firefox", "firefox.exe"]
124
+ },
125
+ "webkit": {
126
+ "<unknown>": void 0,
127
+ "linux-x64": ["pw_run.sh"],
128
+ "linux-arm64": ["pw_run.sh"],
129
+ "mac-x64": ["pw_run.sh"],
130
+ "mac-arm64": ["pw_run.sh"],
131
+ "win-x64": ["Playwright.exe"]
132
+ },
133
+ "ffmpeg": {
134
+ "<unknown>": void 0,
135
+ "linux-x64": ["ffmpeg-linux"],
136
+ "linux-arm64": ["ffmpeg-linux"],
137
+ "mac-x64": ["ffmpeg-mac"],
138
+ "mac-arm64": ["ffmpeg-mac"],
139
+ "win-x64": ["ffmpeg-win64.exe"]
140
+ },
141
+ "winldd": {
142
+ "<unknown>": void 0,
143
+ "linux-x64": void 0,
144
+ "linux-arm64": void 0,
145
+ "mac-x64": void 0,
146
+ "mac-arm64": void 0,
147
+ "win-x64": ["PrintDeps.exe"]
148
+ }
149
+ };
150
+ function cftUrl(suffix) {
151
+ return ({ browserVersion }) => {
152
+ return {
153
+ path: `builds/cft/${browserVersion}/${suffix}`,
154
+ mirrors: [
155
+ "https://cdn.playwright.dev"
156
+ ]
157
+ };
158
+ };
159
+ }
160
+ const DOWNLOAD_PATHS = {
161
+ "chromium": {
162
+ "<unknown>": void 0,
163
+ "ubuntu18.04-x64": void 0,
164
+ "ubuntu20.04-x64": cftUrl("linux64/chrome-linux64.zip"),
165
+ "ubuntu22.04-x64": cftUrl("linux64/chrome-linux64.zip"),
166
+ "ubuntu24.04-x64": cftUrl("linux64/chrome-linux64.zip"),
167
+ "ubuntu18.04-arm64": void 0,
168
+ "ubuntu20.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
169
+ "ubuntu22.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
170
+ "ubuntu24.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
171
+ "debian11-x64": cftUrl("linux64/chrome-linux64.zip"),
172
+ "debian11-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
173
+ "debian12-x64": cftUrl("linux64/chrome-linux64.zip"),
174
+ "debian12-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
175
+ "debian13-x64": cftUrl("linux64/chrome-linux64.zip"),
176
+ "debian13-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
177
+ "mac10.13": cftUrl("mac-x64/chrome-mac-x64.zip"),
178
+ "mac10.14": cftUrl("mac-x64/chrome-mac-x64.zip"),
179
+ "mac10.15": cftUrl("mac-x64/chrome-mac-x64.zip"),
180
+ "mac11": cftUrl("mac-x64/chrome-mac-x64.zip"),
181
+ "mac11-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
182
+ "mac12": cftUrl("mac-x64/chrome-mac-x64.zip"),
183
+ "mac12-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
184
+ "mac13": cftUrl("mac-x64/chrome-mac-x64.zip"),
185
+ "mac13-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
186
+ "mac14": cftUrl("mac-x64/chrome-mac-x64.zip"),
187
+ "mac14-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
188
+ "mac15": cftUrl("mac-x64/chrome-mac-x64.zip"),
189
+ "mac15-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
190
+ "win64": cftUrl("win64/chrome-win64.zip")
191
+ },
192
+ "chromium-headless-shell": {
193
+ "<unknown>": void 0,
194
+ "ubuntu18.04-x64": void 0,
195
+ "ubuntu20.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
196
+ "ubuntu22.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
197
+ "ubuntu24.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
198
+ "ubuntu18.04-arm64": void 0,
199
+ "ubuntu20.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
200
+ "ubuntu22.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
201
+ "ubuntu24.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
202
+ "debian11-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
203
+ "debian11-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
204
+ "debian12-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
205
+ "debian12-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
206
+ "debian13-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
207
+ "debian13-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
208
+ "mac10.13": void 0,
209
+ "mac10.14": void 0,
210
+ "mac10.15": void 0,
211
+ "mac11": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
212
+ "mac11-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
213
+ "mac12": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
214
+ "mac12-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
215
+ "mac13": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
216
+ "mac13-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
217
+ "mac14": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
218
+ "mac14-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
219
+ "mac15": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
220
+ "mac15-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
221
+ "win64": cftUrl("win64/chrome-headless-shell-win64.zip")
222
+ },
223
+ "chromium-tip-of-tree": {
224
+ "<unknown>": void 0,
225
+ "ubuntu18.04-x64": void 0,
226
+ "ubuntu20.04-x64": cftUrl("linux64/chrome-linux64.zip"),
227
+ "ubuntu22.04-x64": cftUrl("linux64/chrome-linux64.zip"),
228
+ "ubuntu24.04-x64": cftUrl("linux64/chrome-linux64.zip"),
229
+ "ubuntu18.04-arm64": void 0,
230
+ "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
231
+ "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
232
+ "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
233
+ "debian11-x64": cftUrl("linux64/chrome-linux64.zip"),
234
+ "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
235
+ "debian12-x64": cftUrl("linux64/chrome-linux64.zip"),
236
+ "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
237
+ "debian13-x64": cftUrl("linux64/chrome-linux64.zip"),
238
+ "debian13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
239
+ "mac10.13": cftUrl("mac-x64/chrome-mac-x64.zip"),
240
+ "mac10.14": cftUrl("mac-x64/chrome-mac-x64.zip"),
241
+ "mac10.15": cftUrl("mac-x64/chrome-mac-x64.zip"),
242
+ "mac11": cftUrl("mac-x64/chrome-mac-x64.zip"),
243
+ "mac11-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
244
+ "mac12": cftUrl("mac-x64/chrome-mac-x64.zip"),
245
+ "mac12-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
246
+ "mac13": cftUrl("mac-x64/chrome-mac-x64.zip"),
247
+ "mac13-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
248
+ "mac14": cftUrl("mac-x64/chrome-mac-x64.zip"),
249
+ "mac14-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
250
+ "mac15": cftUrl("mac-x64/chrome-mac-x64.zip"),
251
+ "mac15-arm64": cftUrl("mac-arm64/chrome-mac-arm64.zip"),
252
+ "win64": cftUrl("win64/chrome-win64.zip")
253
+ },
254
+ "chromium-tip-of-tree-headless-shell": {
255
+ "<unknown>": void 0,
256
+ "ubuntu18.04-x64": void 0,
257
+ "ubuntu20.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
258
+ "ubuntu22.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
259
+ "ubuntu24.04-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
260
+ "ubuntu18.04-arm64": void 0,
261
+ "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
262
+ "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
263
+ "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
264
+ "debian11-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
265
+ "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
266
+ "debian12-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
267
+ "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
268
+ "debian13-x64": cftUrl("linux64/chrome-headless-shell-linux64.zip"),
269
+ "debian13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
270
+ "mac10.13": void 0,
271
+ "mac10.14": void 0,
272
+ "mac10.15": void 0,
273
+ "mac11": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
274
+ "mac11-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
275
+ "mac12": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
276
+ "mac12-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
277
+ "mac13": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
278
+ "mac13-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
279
+ "mac14": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
280
+ "mac14-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
281
+ "mac15": cftUrl("mac-x64/chrome-headless-shell-mac-x64.zip"),
282
+ "mac15-arm64": cftUrl("mac-arm64/chrome-headless-shell-mac-arm64.zip"),
283
+ "win64": cftUrl("win64/chrome-headless-shell-win64.zip")
284
+ },
285
+ "firefox": {
286
+ "<unknown>": void 0,
287
+ "ubuntu18.04-x64": void 0,
288
+ "ubuntu20.04-x64": "builds/firefox/%s/firefox-ubuntu-20.04.zip",
289
+ "ubuntu22.04-x64": "builds/firefox/%s/firefox-ubuntu-22.04.zip",
290
+ "ubuntu24.04-x64": "builds/firefox/%s/firefox-ubuntu-24.04.zip",
291
+ "ubuntu18.04-arm64": void 0,
292
+ "ubuntu20.04-arm64": "builds/firefox/%s/firefox-ubuntu-20.04-arm64.zip",
293
+ "ubuntu22.04-arm64": "builds/firefox/%s/firefox-ubuntu-22.04-arm64.zip",
294
+ "ubuntu24.04-arm64": "builds/firefox/%s/firefox-ubuntu-24.04-arm64.zip",
295
+ "debian11-x64": "builds/firefox/%s/firefox-debian-11.zip",
296
+ "debian11-arm64": "builds/firefox/%s/firefox-debian-11-arm64.zip",
297
+ "debian12-x64": "builds/firefox/%s/firefox-debian-12.zip",
298
+ "debian12-arm64": "builds/firefox/%s/firefox-debian-12-arm64.zip",
299
+ "debian13-x64": "builds/firefox/%s/firefox-debian-13.zip",
300
+ "debian13-arm64": "builds/firefox/%s/firefox-debian-13-arm64.zip",
301
+ "mac10.13": "builds/firefox/%s/firefox-mac.zip",
302
+ "mac10.14": "builds/firefox/%s/firefox-mac.zip",
303
+ "mac10.15": "builds/firefox/%s/firefox-mac.zip",
304
+ "mac11": "builds/firefox/%s/firefox-mac.zip",
305
+ "mac11-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
306
+ "mac12": "builds/firefox/%s/firefox-mac.zip",
307
+ "mac12-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
308
+ "mac13": "builds/firefox/%s/firefox-mac.zip",
309
+ "mac13-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
310
+ "mac14": "builds/firefox/%s/firefox-mac.zip",
311
+ "mac14-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
312
+ "mac15": "builds/firefox/%s/firefox-mac.zip",
313
+ "mac15-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
314
+ "win64": "builds/firefox/%s/firefox-win64.zip"
315
+ },
316
+ "firefox-beta": {
317
+ "<unknown>": void 0,
318
+ "ubuntu18.04-x64": void 0,
319
+ "ubuntu20.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-20.04.zip",
320
+ "ubuntu22.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04.zip",
321
+ "ubuntu24.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04.zip",
322
+ "ubuntu18.04-arm64": void 0,
323
+ "ubuntu20.04-arm64": void 0,
324
+ "ubuntu22.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04-arm64.zip",
325
+ "ubuntu24.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04-arm64.zip",
326
+ "debian11-x64": "builds/firefox-beta/%s/firefox-beta-debian-11.zip",
327
+ "debian11-arm64": "builds/firefox-beta/%s/firefox-beta-debian-11-arm64.zip",
328
+ "debian12-x64": "builds/firefox-beta/%s/firefox-beta-debian-12.zip",
329
+ "debian12-arm64": "builds/firefox-beta/%s/firefox-beta-debian-12-arm64.zip",
330
+ "debian13-x64": "builds/firefox-beta/%s/firefox-beta-debian-12.zip",
331
+ "debian13-arm64": "builds/firefox-beta/%s/firefox-beta-debian-12-arm64.zip",
332
+ "mac10.13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
333
+ "mac10.14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
334
+ "mac10.15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
335
+ "mac11": "builds/firefox-beta/%s/firefox-beta-mac.zip",
336
+ "mac11-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
337
+ "mac12": "builds/firefox-beta/%s/firefox-beta-mac.zip",
338
+ "mac12-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
339
+ "mac13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
340
+ "mac13-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
341
+ "mac14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
342
+ "mac14-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
343
+ "mac15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
344
+ "mac15-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
345
+ "win64": "builds/firefox-beta/%s/firefox-beta-win64.zip"
346
+ },
347
+ "webkit": {
348
+ "<unknown>": void 0,
349
+ "ubuntu18.04-x64": void 0,
350
+ "ubuntu20.04-x64": "builds/webkit/%s/webkit-ubuntu-20.04.zip",
351
+ "ubuntu22.04-x64": "builds/webkit/%s/webkit-ubuntu-22.04.zip",
352
+ "ubuntu24.04-x64": "builds/webkit/%s/webkit-ubuntu-24.04.zip",
353
+ "ubuntu18.04-arm64": void 0,
354
+ "ubuntu20.04-arm64": "builds/webkit/%s/webkit-ubuntu-20.04-arm64.zip",
355
+ "ubuntu22.04-arm64": "builds/webkit/%s/webkit-ubuntu-22.04-arm64.zip",
356
+ "ubuntu24.04-arm64": "builds/webkit/%s/webkit-ubuntu-24.04-arm64.zip",
357
+ "debian11-x64": "builds/webkit/%s/webkit-debian-11.zip",
358
+ "debian11-arm64": "builds/webkit/%s/webkit-debian-11-arm64.zip",
359
+ "debian12-x64": "builds/webkit/%s/webkit-debian-12.zip",
360
+ "debian12-arm64": "builds/webkit/%s/webkit-debian-12-arm64.zip",
361
+ "debian13-x64": "builds/webkit/%s/webkit-debian-13.zip",
362
+ "debian13-arm64": "builds/webkit/%s/webkit-debian-13-arm64.zip",
363
+ "mac10.13": void 0,
364
+ "mac10.14": void 0,
365
+ "mac10.15": void 0,
366
+ "mac11": void 0,
367
+ "mac11-arm64": void 0,
368
+ "mac12": void 0,
369
+ "mac12-arm64": void 0,
370
+ "mac13": void 0,
371
+ "mac13-arm64": void 0,
372
+ "mac14": "builds/webkit/%s/webkit-mac-14.zip",
373
+ "mac14-arm64": "builds/webkit/%s/webkit-mac-14-arm64.zip",
374
+ "mac15": "builds/webkit/%s/webkit-mac-15.zip",
375
+ "mac15-arm64": "builds/webkit/%s/webkit-mac-15-arm64.zip",
376
+ "win64": "builds/webkit/%s/webkit-win64.zip"
377
+ },
378
+ "ffmpeg": {
379
+ "<unknown>": void 0,
380
+ "ubuntu18.04-x64": void 0,
381
+ "ubuntu20.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
382
+ "ubuntu22.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
383
+ "ubuntu24.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
384
+ "ubuntu18.04-arm64": void 0,
385
+ "ubuntu20.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
386
+ "ubuntu22.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
387
+ "ubuntu24.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
388
+ "debian11-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
389
+ "debian11-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
390
+ "debian12-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
391
+ "debian12-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
392
+ "debian13-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
393
+ "debian13-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
394
+ "mac10.13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
395
+ "mac10.14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
396
+ "mac10.15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
397
+ "mac11": "builds/ffmpeg/%s/ffmpeg-mac.zip",
398
+ "mac11-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
399
+ "mac12": "builds/ffmpeg/%s/ffmpeg-mac.zip",
400
+ "mac12-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
401
+ "mac13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
402
+ "mac13-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
403
+ "mac14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
404
+ "mac14-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
405
+ "mac15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
406
+ "mac15-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
407
+ "win64": "builds/ffmpeg/%s/ffmpeg-win64.zip"
408
+ },
409
+ "winldd": {
410
+ "<unknown>": void 0,
411
+ "ubuntu18.04-x64": void 0,
412
+ "ubuntu20.04-x64": void 0,
413
+ "ubuntu22.04-x64": void 0,
414
+ "ubuntu24.04-x64": void 0,
415
+ "ubuntu18.04-arm64": void 0,
416
+ "ubuntu20.04-arm64": void 0,
417
+ "ubuntu22.04-arm64": void 0,
418
+ "ubuntu24.04-arm64": void 0,
419
+ "debian11-x64": void 0,
420
+ "debian11-arm64": void 0,
421
+ "debian12-x64": void 0,
422
+ "debian12-arm64": void 0,
423
+ "debian13-x64": void 0,
424
+ "debian13-arm64": void 0,
425
+ "mac10.13": void 0,
426
+ "mac10.14": void 0,
427
+ "mac10.15": void 0,
428
+ "mac11": void 0,
429
+ "mac11-arm64": void 0,
430
+ "mac12": void 0,
431
+ "mac12-arm64": void 0,
432
+ "mac13": void 0,
433
+ "mac13-arm64": void 0,
434
+ "mac14": void 0,
435
+ "mac14-arm64": void 0,
436
+ "mac15": void 0,
437
+ "mac15-arm64": void 0,
438
+ "win64": "builds/winldd/%s/winldd-win64.zip"
439
+ },
440
+ "android": {
441
+ "<unknown>": "builds/android/%s/android.zip",
442
+ "ubuntu18.04-x64": void 0,
443
+ "ubuntu20.04-x64": "builds/android/%s/android.zip",
444
+ "ubuntu22.04-x64": "builds/android/%s/android.zip",
445
+ "ubuntu24.04-x64": "builds/android/%s/android.zip",
446
+ "ubuntu18.04-arm64": void 0,
447
+ "ubuntu20.04-arm64": "builds/android/%s/android.zip",
448
+ "ubuntu22.04-arm64": "builds/android/%s/android.zip",
449
+ "ubuntu24.04-arm64": "builds/android/%s/android.zip",
450
+ "debian11-x64": "builds/android/%s/android.zip",
451
+ "debian11-arm64": "builds/android/%s/android.zip",
452
+ "debian12-x64": "builds/android/%s/android.zip",
453
+ "debian12-arm64": "builds/android/%s/android.zip",
454
+ "debian13-x64": "builds/android/%s/android.zip",
455
+ "debian13-arm64": "builds/android/%s/android.zip",
456
+ "mac10.13": "builds/android/%s/android.zip",
457
+ "mac10.14": "builds/android/%s/android.zip",
458
+ "mac10.15": "builds/android/%s/android.zip",
459
+ "mac11": "builds/android/%s/android.zip",
460
+ "mac11-arm64": "builds/android/%s/android.zip",
461
+ "mac12": "builds/android/%s/android.zip",
462
+ "mac12-arm64": "builds/android/%s/android.zip",
463
+ "mac13": "builds/android/%s/android.zip",
464
+ "mac13-arm64": "builds/android/%s/android.zip",
465
+ "mac14": "builds/android/%s/android.zip",
466
+ "mac14-arm64": "builds/android/%s/android.zip",
467
+ "mac15": "builds/android/%s/android.zip",
468
+ "mac15-arm64": "builds/android/%s/android.zip",
469
+ "win64": "builds/android/%s/android.zip"
470
+ }
471
+ };
472
+ const defaultCacheDirectory = (() => {
473
+ if (process.platform === "linux")
474
+ return process.env.XDG_CACHE_HOME || import_path.default.join(import_os.default.homedir(), ".cache");
475
+ if (process.platform === "darwin")
476
+ return import_path.default.join(import_os.default.homedir(), "Library", "Caches");
477
+ if (process.platform === "win32")
478
+ return process.env.LOCALAPPDATA || import_path.default.join(import_os.default.homedir(), "AppData", "Local");
479
+ throw new Error("Unsupported platform: " + process.platform);
480
+ })();
481
+ const defaultRegistryDirectory = import_path.default.join(defaultCacheDirectory, "ms-playwright");
482
+ const registryDirectory = (() => {
483
+ let result;
484
+ const envDefined = (0, import_utils.getFromENV)("PLAYWRIGHT_BROWSERS_PATH");
485
+ if (envDefined === "0")
486
+ result = import_path.default.join(__dirname, "..", "..", "..", ".local-browsers");
487
+ else if (envDefined)
488
+ result = envDefined;
489
+ else
490
+ result = defaultRegistryDirectory;
491
+ if (!import_path.default.isAbsolute(result)) {
492
+ result = import_path.default.resolve((0, import_utils.getFromENV)("INIT_CWD") || process.cwd(), result);
493
+ }
494
+ return result;
495
+ })();
496
+ function isBrowserDirectory(browserDirectory) {
497
+ const baseName = import_path.default.basename(browserDirectory);
498
+ for (const browserName of allDownloadableDirectoriesThatEverExisted) {
499
+ if (baseName.startsWith(browserName.replace(/-/g, "_") + "-"))
500
+ return true;
501
+ }
502
+ return false;
503
+ }
504
+ function readDescriptors(browsersJSON) {
505
+ return browsersJSON["browsers"].map((obj) => {
506
+ const name = obj.name;
507
+ const revisionOverride = (obj.revisionOverrides || {})[import_hostPlatform.hostPlatform];
508
+ const revision = revisionOverride || obj.revision;
509
+ const browserDirectoryPrefix = revisionOverride ? `${name}_${import_hostPlatform.hostPlatform}_special` : `${name}`;
510
+ const descriptor = {
511
+ name,
512
+ revision,
513
+ hasRevisionOverride: !!revisionOverride,
514
+ // We only put browser version for the supported operating systems.
515
+ browserVersion: revisionOverride ? void 0 : obj.browserVersion,
516
+ title: obj["title"],
517
+ installByDefault: !!obj.installByDefault,
518
+ // Method `isBrowserDirectory` determines directory to be browser iff
519
+ // it starts with some browser name followed by '-'. Some browser names
520
+ // are prefixes of others, e.g. 'webkit' is a prefix of `webkit-technology-preview`.
521
+ // To avoid older registries erroneously removing 'webkit-technology-preview', we have to
522
+ // ensure that browser folders to never include dashes inside.
523
+ dir: import_path.default.join(registryDirectory, browserDirectoryPrefix.replace(/-/g, "_") + "-" + revision)
524
+ };
525
+ return descriptor;
526
+ });
527
+ }
528
+ const allDownloadableDirectoriesThatEverExisted = ["android", "chromium", "firefox", "webkit", "ffmpeg", "firefox-beta", "chromium-tip-of-tree", "chromium-headless-shell", "chromium-tip-of-tree-headless-shell", "winldd"];
529
+ const chromiumAliases = ["chrome-for-testing"];
530
+ class Registry {
531
+ constructor(browsersJSON) {
532
+ const descriptors = readDescriptors(browsersJSON);
533
+ const findExecutablePath = (dir, name) => {
534
+ const tokens = EXECUTABLE_PATHS[name][import_hostPlatform.shortPlatform];
535
+ return tokens ? import_path.default.join(dir, ...tokens) : void 0;
536
+ };
537
+ const executablePathOrDie = (name, e, installByDefault, sdkLanguage) => {
538
+ if (!e)
539
+ throw new Error(`${name} is not supported on ${import_hostPlatform.hostPlatform}`);
540
+ const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install${installByDefault ? "" : " " + name}`);
541
+ if (!(0, import_fileUtils.canAccessFile)(e)) {
542
+ const currentDockerVersion = (0, import_dependencies.readDockerVersionSync)();
543
+ const preferredDockerVersion = currentDockerVersion ? (0, import_dependencies.dockerVersion)(currentDockerVersion.dockerImageNameTemplate) : null;
544
+ const isOutdatedDockerImage = currentDockerVersion && preferredDockerVersion && currentDockerVersion.dockerImageName !== preferredDockerVersion.dockerImageName;
545
+ const isFfmpeg = name === "ffmpeg";
546
+ let prettyMessage;
547
+ if (isOutdatedDockerImage) {
548
+ prettyMessage = [
549
+ `Looks like Playwright was just updated to ${preferredDockerVersion.driverVersion}.`,
550
+ `Please update docker image as well.`,
551
+ `- current: ${currentDockerVersion.dockerImageName}`,
552
+ `- required: ${preferredDockerVersion.dockerImageName}`,
553
+ ``,
554
+ `<3 Playwright Team`
555
+ ].join("\n");
556
+ } else if (isFfmpeg) {
557
+ prettyMessage = [
558
+ `Video rendering requires ffmpeg binary.`,
559
+ `Downloading it will not affect any of the system-wide settings.`,
560
+ `Please run the following command:`,
561
+ ``,
562
+ ` ${buildPlaywrightCLICommand(sdkLanguage, "install ffmpeg")}`,
563
+ ``,
564
+ `<3 Playwright Team`
565
+ ].join("\n");
566
+ } else {
567
+ prettyMessage = [
568
+ `Looks like Playwright was just installed or updated.`,
569
+ `Please run the following command to download new browser${installByDefault ? "s" : ""}:`,
570
+ ``,
571
+ ` ${installCommand}`,
572
+ ``,
573
+ `<3 Playwright Team`
574
+ ].join("\n");
575
+ }
576
+ throw new Error(`Executable doesn't exist at ${e}
577
+ ${(0, import_ascii.wrapInASCIIBox)(prettyMessage, 1)}`);
578
+ }
579
+ return e;
580
+ };
581
+ this._executables = [];
582
+ const chromium = descriptors.find((d) => d.name === "chromium");
583
+ const chromiumExecutable = findExecutablePath(chromium.dir, "chromium");
584
+ this._executables.push({
585
+ name: "chromium",
586
+ browserName: "chromium",
587
+ directory: chromium.dir,
588
+ executablePath: () => chromiumExecutable,
589
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumExecutable, chromium.installByDefault, sdkLanguage),
590
+ installType: chromium.installByDefault ? "download-by-default" : "download-on-demand",
591
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromium.dir, ["chrome-linux"], [], ["chrome-win"]),
592
+ downloadURLs: this._downloadURLs(chromium),
593
+ title: chromium.title,
594
+ revision: chromium.revision,
595
+ browserVersion: chromium.browserVersion,
596
+ _install: (force) => this._downloadExecutable(chromium, force, chromiumExecutable),
597
+ _dependencyGroup: "chromium",
598
+ _isHermeticInstallation: true
599
+ });
600
+ const chromiumHeadlessShell = descriptors.find((d) => d.name === "chromium-headless-shell");
601
+ const chromiumHeadlessShellExecutable = findExecutablePath(chromiumHeadlessShell.dir, "chromium-headless-shell");
602
+ this._executables.push({
603
+ name: "chromium-headless-shell",
604
+ browserName: "chromium",
605
+ directory: chromiumHeadlessShell.dir,
606
+ executablePath: () => chromiumHeadlessShellExecutable,
607
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumHeadlessShellExecutable, chromiumHeadlessShell.installByDefault, sdkLanguage),
608
+ installType: chromiumHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
609
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
610
+ downloadURLs: this._downloadURLs(chromiumHeadlessShell),
611
+ title: chromiumHeadlessShell.title,
612
+ revision: chromiumHeadlessShell.revision,
613
+ browserVersion: chromiumHeadlessShell.browserVersion,
614
+ _install: (force) => this._downloadExecutable(chromiumHeadlessShell, force, chromiumHeadlessShellExecutable),
615
+ _dependencyGroup: "chromium",
616
+ _isHermeticInstallation: true
617
+ });
618
+ const chromiumTipOfTreeHeadlessShell = descriptors.find((d) => d.name === "chromium-tip-of-tree-headless-shell");
619
+ const chromiumTipOfTreeHeadlessShellExecutable = findExecutablePath(chromiumTipOfTreeHeadlessShell.dir, "chromium-tip-of-tree-headless-shell");
620
+ this._executables.push({
621
+ name: "chromium-tip-of-tree-headless-shell",
622
+ browserName: "chromium",
623
+ directory: chromiumTipOfTreeHeadlessShell.dir,
624
+ executablePath: () => chromiumTipOfTreeHeadlessShellExecutable,
625
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumTipOfTreeHeadlessShellExecutable, chromiumTipOfTreeHeadlessShell.installByDefault, sdkLanguage),
626
+ installType: chromiumTipOfTreeHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
627
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTreeHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
628
+ downloadURLs: this._downloadURLs(chromiumTipOfTreeHeadlessShell),
629
+ title: chromiumTipOfTreeHeadlessShell.title,
630
+ revision: chromiumTipOfTreeHeadlessShell.revision,
631
+ browserVersion: chromiumTipOfTreeHeadlessShell.browserVersion,
632
+ _install: (force) => this._downloadExecutable(chromiumTipOfTreeHeadlessShell, force, chromiumTipOfTreeHeadlessShellExecutable),
633
+ _dependencyGroup: "chromium",
634
+ _isHermeticInstallation: true
635
+ });
636
+ const chromiumTipOfTree = descriptors.find((d) => d.name === "chromium-tip-of-tree");
637
+ const chromiumTipOfTreeExecutable = findExecutablePath(chromiumTipOfTree.dir, "chromium-tip-of-tree");
638
+ this._executables.push({
639
+ name: "chromium-tip-of-tree",
640
+ browserName: "chromium",
641
+ directory: chromiumTipOfTree.dir,
642
+ executablePath: () => chromiumTipOfTreeExecutable,
643
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium-tip-of-tree", chromiumTipOfTreeExecutable, chromiumTipOfTree.installByDefault, sdkLanguage),
644
+ installType: chromiumTipOfTree.installByDefault ? "download-by-default" : "download-on-demand",
645
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTree.dir, ["chrome-linux"], [], ["chrome-win"]),
646
+ downloadURLs: this._downloadURLs(chromiumTipOfTree),
647
+ title: chromiumTipOfTree.title,
648
+ revision: chromiumTipOfTree.revision,
649
+ browserVersion: chromiumTipOfTree.browserVersion,
650
+ _install: (force) => this._downloadExecutable(chromiumTipOfTree, force, chromiumTipOfTreeExecutable),
651
+ _dependencyGroup: "chromium",
652
+ _isHermeticInstallation: true
653
+ });
654
+ this._executables.push(this._createChromiumChannel("chrome", {
655
+ "linux": "/opt/google/chrome/chrome",
656
+ "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
657
+ "win32": `\\Google\\Chrome\\Application\\chrome.exe`
658
+ }, () => this._installChromiumChannel("chrome", {
659
+ "linux": "reinstall_chrome_stable_linux.sh",
660
+ "darwin": "reinstall_chrome_stable_mac.sh",
661
+ "win32": "reinstall_chrome_stable_win.ps1"
662
+ })));
663
+ this._executables.push(this._createChromiumChannel("chrome-beta", {
664
+ "linux": "/opt/google/chrome-beta/chrome",
665
+ "darwin": "/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",
666
+ "win32": `\\Google\\Chrome Beta\\Application\\chrome.exe`
667
+ }, () => this._installChromiumChannel("chrome-beta", {
668
+ "linux": "reinstall_chrome_beta_linux.sh",
669
+ "darwin": "reinstall_chrome_beta_mac.sh",
670
+ "win32": "reinstall_chrome_beta_win.ps1"
671
+ })));
672
+ this._executables.push(this._createChromiumChannel("chrome-dev", {
673
+ "linux": "/opt/google/chrome-unstable/chrome",
674
+ "darwin": "/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",
675
+ "win32": `\\Google\\Chrome Dev\\Application\\chrome.exe`
676
+ }));
677
+ this._executables.push(this._createChromiumChannel("chrome-canary", {
678
+ "linux": "/opt/google/chrome-canary/chrome",
679
+ "darwin": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
680
+ "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
681
+ }));
682
+ this._executables.push(this._createChromiumChannel("msedge", {
683
+ "linux": "/opt/microsoft/msedge/msedge",
684
+ "darwin": "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
685
+ "win32": `\\Microsoft\\Edge\\Application\\msedge.exe`
686
+ }, () => this._installMSEdgeChannel("msedge", {
687
+ "linux": "reinstall_msedge_stable_linux.sh",
688
+ "darwin": "reinstall_msedge_stable_mac.sh",
689
+ "win32": "reinstall_msedge_stable_win.ps1"
690
+ })));
691
+ this._executables.push(this._createChromiumChannel("msedge-beta", {
692
+ "linux": "/opt/microsoft/msedge-beta/msedge",
693
+ "darwin": "/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",
694
+ "win32": `\\Microsoft\\Edge Beta\\Application\\msedge.exe`
695
+ }, () => this._installMSEdgeChannel("msedge-beta", {
696
+ "darwin": "reinstall_msedge_beta_mac.sh",
697
+ "linux": "reinstall_msedge_beta_linux.sh",
698
+ "win32": "reinstall_msedge_beta_win.ps1"
699
+ })));
700
+ this._executables.push(this._createChromiumChannel("msedge-dev", {
701
+ "linux": "/opt/microsoft/msedge-dev/msedge",
702
+ "darwin": "/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",
703
+ "win32": `\\Microsoft\\Edge Dev\\Application\\msedge.exe`
704
+ }, () => this._installMSEdgeChannel("msedge-dev", {
705
+ "darwin": "reinstall_msedge_dev_mac.sh",
706
+ "linux": "reinstall_msedge_dev_linux.sh",
707
+ "win32": "reinstall_msedge_dev_win.ps1"
708
+ })));
709
+ this._executables.push(this._createChromiumChannel("msedge-canary", {
710
+ "linux": "",
711
+ "darwin": "/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",
712
+ "win32": `\\Microsoft\\Edge SxS\\Application\\msedge.exe`
713
+ }));
714
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox", {
715
+ "linux": "/snap/bin/firefox",
716
+ "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
717
+ "win32": "\\Mozilla Firefox\\firefox.exe"
718
+ }));
719
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox-beta", {
720
+ "linux": "/opt/firefox-beta/firefox",
721
+ "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
722
+ "win32": "\\Mozilla Firefox\\firefox.exe"
723
+ }));
724
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox-nightly", {
725
+ "linux": "/opt/firefox-nightly/firefox",
726
+ "darwin": "/Applications/Firefox Nightly.app/Contents/MacOS/firefox",
727
+ "win32": "\\Mozilla Firefox\\firefox.exe"
728
+ }));
729
+ const firefox = descriptors.find((d) => d.name === "firefox");
730
+ const firefoxExecutable = findExecutablePath(firefox.dir, "firefox");
731
+ this._executables.push({
732
+ name: "firefox",
733
+ browserName: "firefox",
734
+ directory: firefox.dir,
735
+ executablePath: () => firefoxExecutable,
736
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox", firefoxExecutable, firefox.installByDefault, sdkLanguage),
737
+ installType: firefox.installByDefault ? "download-by-default" : "download-on-demand",
738
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefox.dir, ["firefox"], [], ["firefox"]),
739
+ downloadURLs: this._downloadURLs(firefox),
740
+ title: firefox.title,
741
+ revision: firefox.revision,
742
+ browserVersion: firefox.browserVersion,
743
+ _install: (force) => this._downloadExecutable(firefox, force, firefoxExecutable),
744
+ _dependencyGroup: "firefox",
745
+ _isHermeticInstallation: true
746
+ });
747
+ const firefoxBeta = descriptors.find((d) => d.name === "firefox-beta");
748
+ const firefoxBetaExecutable = findExecutablePath(firefoxBeta.dir, "firefox");
749
+ this._executables.push({
750
+ name: "firefox-beta",
751
+ browserName: "firefox",
752
+ directory: firefoxBeta.dir,
753
+ executablePath: () => firefoxBetaExecutable,
754
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox-beta", firefoxBetaExecutable, firefoxBeta.installByDefault, sdkLanguage),
755
+ installType: firefoxBeta.installByDefault ? "download-by-default" : "download-on-demand",
756
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefoxBeta.dir, ["firefox"], [], ["firefox"]),
757
+ downloadURLs: this._downloadURLs(firefoxBeta),
758
+ title: firefoxBeta.title,
759
+ revision: firefoxBeta.revision,
760
+ browserVersion: firefoxBeta.browserVersion,
761
+ _install: (force) => this._downloadExecutable(firefoxBeta, force, firefoxBetaExecutable),
762
+ _dependencyGroup: "firefox",
763
+ _isHermeticInstallation: true
764
+ });
765
+ const webkit = descriptors.find((d) => d.name === "webkit");
766
+ const webkitExecutable = findExecutablePath(webkit.dir, "webkit");
767
+ const webkitLinuxLddDirectories = [
768
+ import_path.default.join("minibrowser-gtk"),
769
+ import_path.default.join("minibrowser-gtk", "bin"),
770
+ import_path.default.join("minibrowser-gtk", "lib"),
771
+ import_path.default.join("minibrowser-gtk", "sys", "lib"),
772
+ import_path.default.join("minibrowser-wpe"),
773
+ import_path.default.join("minibrowser-wpe", "bin"),
774
+ import_path.default.join("minibrowser-wpe", "lib"),
775
+ import_path.default.join("minibrowser-wpe", "sys", "lib")
776
+ ];
777
+ this._executables.push({
778
+ name: "webkit",
779
+ browserName: "webkit",
780
+ directory: webkit.dir,
781
+ executablePath: () => webkitExecutable,
782
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("webkit", webkitExecutable, webkit.installByDefault, sdkLanguage),
783
+ installType: webkit.installByDefault ? "download-by-default" : "download-on-demand",
784
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, webkit.dir, webkitLinuxLddDirectories, ["libGLESv2.so.2", "libx264.so"], [""]),
785
+ downloadURLs: this._downloadURLs(webkit),
786
+ title: webkit.title,
787
+ revision: webkit.revision,
788
+ browserVersion: webkit.browserVersion,
789
+ _install: (force) => this._downloadExecutable(webkit, force, webkitExecutable),
790
+ _dependencyGroup: "webkit",
791
+ _isHermeticInstallation: true
792
+ });
793
+ this._executables.push({
794
+ name: "webkit-wsl",
795
+ browserName: "webkit",
796
+ directory: webkit.dir,
797
+ executablePath: () => webkitExecutable,
798
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("webkit", webkitExecutable, webkit.installByDefault, sdkLanguage),
799
+ installType: "download-on-demand",
800
+ title: "Webkit in WSL",
801
+ _validateHostRequirements: (sdkLanguage) => Promise.resolve(),
802
+ _isHermeticInstallation: true,
803
+ _install: async () => {
804
+ if (process.platform !== "win32")
805
+ throw new Error(`WebKit via WSL is only supported on Windows`);
806
+ const script = import_path.default.join(BIN_PATH, "install_webkit_wsl.ps1");
807
+ const { code } = await (0, import_spawnAsync.spawnAsync)("powershell.exe", [
808
+ "-ExecutionPolicy",
809
+ "Bypass",
810
+ "-File",
811
+ script
812
+ ], {
813
+ stdio: "inherit"
814
+ });
815
+ if (code !== 0)
816
+ throw new Error(`Failed to install WebKit via WSL`);
817
+ }
818
+ });
819
+ const ffmpeg = descriptors.find((d) => d.name === "ffmpeg");
820
+ const ffmpegExecutable = findExecutablePath(ffmpeg.dir, "ffmpeg");
821
+ this._executables.push({
822
+ name: "ffmpeg",
823
+ browserName: void 0,
824
+ directory: ffmpeg.dir,
825
+ executablePath: () => ffmpegExecutable,
826
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("ffmpeg", ffmpegExecutable, ffmpeg.installByDefault, sdkLanguage),
827
+ installType: ffmpeg.installByDefault ? "download-by-default" : "download-on-demand",
828
+ _validateHostRequirements: () => Promise.resolve(),
829
+ downloadURLs: this._downloadURLs(ffmpeg),
830
+ title: ffmpeg.title,
831
+ revision: ffmpeg.revision,
832
+ _install: (force) => this._downloadExecutable(ffmpeg, force, ffmpegExecutable),
833
+ _dependencyGroup: "tools",
834
+ _isHermeticInstallation: true
835
+ });
836
+ const winldd = descriptors.find((d) => d.name === "winldd");
837
+ const winlddExecutable = findExecutablePath(winldd.dir, "winldd");
838
+ this._executables.push({
839
+ name: "winldd",
840
+ browserName: void 0,
841
+ directory: winldd.dir,
842
+ executablePath: () => winlddExecutable,
843
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("winldd", winlddExecutable, winldd.installByDefault, sdkLanguage),
844
+ installType: process.platform === "win32" ? "download-by-default" : "none",
845
+ _validateHostRequirements: () => Promise.resolve(),
846
+ downloadURLs: this._downloadURLs(winldd),
847
+ title: winldd.title,
848
+ revision: winldd.revision,
849
+ _install: (force) => this._downloadExecutable(winldd, force, winlddExecutable),
850
+ _dependencyGroup: "tools",
851
+ _isHermeticInstallation: true
852
+ });
853
+ const android = descriptors.find((d) => d.name === "android");
854
+ this._executables.push({
855
+ name: "android",
856
+ browserName: void 0,
857
+ directory: android.dir,
858
+ executablePath: () => void 0,
859
+ executablePathOrDie: () => "",
860
+ installType: "download-on-demand",
861
+ _validateHostRequirements: () => Promise.resolve(),
862
+ downloadURLs: this._downloadURLs(android),
863
+ title: android.title,
864
+ revision: android.revision,
865
+ _install: (force) => this._downloadExecutable(android, force),
866
+ _dependencyGroup: "tools",
867
+ _isHermeticInstallation: true
868
+ });
869
+ }
870
+ _createChromiumChannel(name, lookAt, install) {
871
+ const executablePath = (sdkLanguage, shouldThrow) => {
872
+ const suffix = lookAt[process.platform];
873
+ if (!suffix) {
874
+ if (shouldThrow)
875
+ throw new Error(`Chromium distribution '${name}' is not supported on ${process.platform}`);
876
+ return void 0;
877
+ }
878
+ const prefixes = process.platform === "win32" ? [
879
+ process.env.LOCALAPPDATA,
880
+ process.env.PROGRAMFILES,
881
+ process.env["PROGRAMFILES(X86)"],
882
+ // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
883
+ process.env.HOMEDRIVE + "\\Program Files",
884
+ process.env.HOMEDRIVE + "\\Program Files (x86)"
885
+ ].filter(Boolean) : [""];
886
+ for (const prefix of prefixes) {
887
+ const executablePath2 = import_path.default.join(prefix, suffix);
888
+ if ((0, import_fileUtils.canAccessFile)(executablePath2))
889
+ return executablePath2;
890
+ }
891
+ if (!shouldThrow)
892
+ return void 0;
893
+ const location = prefixes.length ? ` at ${import_path.default.join(prefixes[0], suffix)}` : ``;
894
+ const installation = install ? `
895
+ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
896
+ throw new Error(`Chromium distribution '${name}' is not found${location}${installation}`);
897
+ };
898
+ return {
899
+ name,
900
+ browserName: "chromium",
901
+ directory: void 0,
902
+ executablePath: () => executablePath("", false),
903
+ executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
904
+ installType: install ? "install-script" : "none",
905
+ _validateHostRequirements: () => Promise.resolve(),
906
+ _isHermeticInstallation: false,
907
+ _install: install
908
+ };
909
+ }
910
+ _createBidiFirefoxChannel(name, lookAt, install) {
911
+ const executablePath = (sdkLanguage, shouldThrow) => {
912
+ const suffix = lookAt[process.platform];
913
+ if (!suffix) {
914
+ if (shouldThrow)
915
+ throw new Error(`Firefox distribution '${name}' is not supported on ${process.platform}`);
916
+ return void 0;
917
+ }
918
+ const prefixes = process.platform === "win32" ? [
919
+ process.env.LOCALAPPDATA,
920
+ process.env.PROGRAMFILES,
921
+ process.env["PROGRAMFILES(X86)"],
922
+ // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
923
+ process.env.HOMEDRIVE + "\\Program Files",
924
+ process.env.HOMEDRIVE + "\\Program Files (x86)"
925
+ ].filter(Boolean) : [""];
926
+ for (const prefix of prefixes) {
927
+ const executablePath2 = import_path.default.join(prefix, suffix);
928
+ if ((0, import_fileUtils.canAccessFile)(executablePath2))
929
+ return executablePath2;
930
+ }
931
+ if (shouldThrow)
932
+ throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths. ${`Tried paths:
933
+ ${prefixes.map((p) => import_path.default.join(p, suffix)).join("\n ")}`}`);
934
+ return void 0;
935
+ };
936
+ return {
937
+ name,
938
+ browserName: "firefox",
939
+ directory: void 0,
940
+ executablePath: () => executablePath("", false),
941
+ executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
942
+ installType: "none",
943
+ _validateHostRequirements: () => Promise.resolve(),
944
+ _isHermeticInstallation: true,
945
+ _install: install
946
+ };
947
+ }
948
+ executables() {
949
+ return this._executables;
950
+ }
951
+ findExecutable(name) {
952
+ return this._executables.find((b) => b.name === name);
953
+ }
954
+ defaultExecutables() {
955
+ return this._executables.filter((e) => e.installType === "download-by-default");
956
+ }
957
+ _dedupe(executables) {
958
+ return Array.from(new Set(executables));
959
+ }
960
+ async _validateHostRequirements(sdkLanguage, browserDirectory, linuxLddDirectories, dlOpenLibraries, windowsExeAndDllDirectories) {
961
+ if (import_os.default.platform() === "linux")
962
+ return await (0, import_dependencies2.validateDependenciesLinux)(sdkLanguage, linuxLddDirectories.map((d) => import_path.default.join(browserDirectory, d)), dlOpenLibraries);
963
+ if (import_os.default.platform() === "win32" && import_os.default.arch() === "x64")
964
+ return await (0, import_dependencies2.validateDependenciesWindows)(sdkLanguage, windowsExeAndDllDirectories.map((d) => import_path.default.join(browserDirectory, d)));
965
+ }
966
+ async installDeps(executablesToInstallDeps, dryRun) {
967
+ const executables = this._dedupe(executablesToInstallDeps);
968
+ const targets = /* @__PURE__ */ new Set();
969
+ for (const executable of executables) {
970
+ if (executable._dependencyGroup)
971
+ targets.add(executable._dependencyGroup);
972
+ }
973
+ targets.add("tools");
974
+ if (import_os.default.platform() === "win32")
975
+ return await (0, import_dependencies2.installDependenciesWindows)(targets, dryRun);
976
+ if (import_os.default.platform() === "linux")
977
+ return await (0, import_dependencies2.installDependenciesLinux)(targets, dryRun);
978
+ }
979
+ async install(executablesToInstall, options) {
980
+ const executables = this._dedupe(executablesToInstall);
981
+ await import_fs.default.promises.mkdir(registryDirectory, { recursive: true });
982
+ const lockfilePath = import_path.default.join(registryDirectory, "__dirlock");
983
+ const linksDir = import_path.default.join(registryDirectory, ".links");
984
+ let releaseLock;
985
+ try {
986
+ releaseLock = await import_utilsBundle.lockfile.lock(registryDirectory, {
987
+ retries: {
988
+ // Retry 20 times during 10 minutes with
989
+ // exponential back-off.
990
+ // See documentation at: https://www.npmjs.com/package/retry#retrytimeoutsoptions
991
+ retries: 20,
992
+ factor: 1.27579
993
+ },
994
+ onCompromised: (err) => {
995
+ throw new Error(`${err.message} Path: ${lockfilePath}`);
996
+ },
997
+ lockfilePath
998
+ });
999
+ await import_fs.default.promises.mkdir(linksDir, { recursive: true });
1000
+ await import_fs.default.promises.writeFile(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH)), PACKAGE_PATH);
1001
+ if (!(0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_GC"))
1002
+ await this._validateInstallationCache(linksDir);
1003
+ for (const executable of executables) {
1004
+ if (!executable._install)
1005
+ throw new Error(`ERROR: Playwright does not support installing ${executable.name}`);
1006
+ if (!(0, import_utils.getAsBooleanFromENV)("CI") && !executable._isHermeticInstallation && !options?.force && executable.executablePath()) {
1007
+ const { embedderName } = (0, import_userAgent.getEmbedderName)();
1008
+ const command = buildPlaywrightCLICommand(embedderName, "install --force " + executable.name);
1009
+ process.stderr.write("\n" + (0, import_ascii.wrapInASCIIBox)([
1010
+ `ATTENTION: "${executable.name}" is already installed on the system!`,
1011
+ ``,
1012
+ `"${executable.name}" installation is not hermetic; installing newer version`,
1013
+ `requires *removal* of a current installation first.`,
1014
+ ``,
1015
+ `To *uninstall* current version and re-install latest "${executable.name}":`,
1016
+ ``,
1017
+ `- Close all running instances of "${executable.name}", if any`,
1018
+ `- Use "--force" to install browser:`,
1019
+ ``,
1020
+ ` ${command}`,
1021
+ ``,
1022
+ `<3 Playwright Team`
1023
+ ].join("\n"), 1) + "\n\n");
1024
+ return;
1025
+ }
1026
+ await executable._install(!!options?.force);
1027
+ }
1028
+ } catch (e) {
1029
+ if (e.code === "ELOCKED") {
1030
+ const rmCommand = process.platform === "win32" ? "rm -R" : "rm -rf";
1031
+ throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)([
1032
+ `An active lockfile is found at:`,
1033
+ ``,
1034
+ ` ${lockfilePath}`,
1035
+ ``,
1036
+ `Either:`,
1037
+ `- wait a few minutes if other Playwright is installing browsers in parallel`,
1038
+ `- remove lock manually with:`,
1039
+ ``,
1040
+ ` ${rmCommand} ${lockfilePath}`,
1041
+ ``,
1042
+ `<3 Playwright Team`
1043
+ ].join("\n"), 1));
1044
+ } else {
1045
+ throw e;
1046
+ }
1047
+ } finally {
1048
+ if (releaseLock)
1049
+ await releaseLock();
1050
+ }
1051
+ }
1052
+ async uninstall(all) {
1053
+ const linksDir = import_path.default.join(registryDirectory, ".links");
1054
+ if (all) {
1055
+ const links = await import_fs.default.promises.readdir(linksDir).catch(() => []);
1056
+ for (const link of links)
1057
+ await import_fs.default.promises.unlink(import_path.default.join(linksDir, link));
1058
+ } else {
1059
+ await import_fs.default.promises.unlink(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH))).catch(() => {
1060
+ });
1061
+ }
1062
+ await this._validateInstallationCache(linksDir);
1063
+ return {
1064
+ numberOfBrowsersLeft: (await import_fs.default.promises.readdir(registryDirectory).catch(() => [])).filter((browserDirectory) => isBrowserDirectory(browserDirectory)).length
1065
+ };
1066
+ }
1067
+ async validateHostRequirementsForExecutablesIfNeeded(executables, sdkLanguage) {
1068
+ if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS")) {
1069
+ process.stderr.write("Skipping host requirements validation logic because `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS` env variable is set.\n");
1070
+ return;
1071
+ }
1072
+ for (const executable of executables)
1073
+ await this._validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage);
1074
+ }
1075
+ async _validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage) {
1076
+ const kMaximumReValidationPeriod = 30 * 24 * 60 * 60 * 1e3;
1077
+ if (!executable.directory)
1078
+ return;
1079
+ const markerFile = import_path.default.join(executable.directory, "DEPENDENCIES_VALIDATED");
1080
+ if (await import_fs.default.promises.stat(markerFile).then((stat) => Date.now() - stat.mtime.getTime() < kMaximumReValidationPeriod).catch(() => false))
1081
+ return;
1082
+ import_debugLogger.debugLogger.log("install", `validating host requirements for "${executable.name}"`);
1083
+ try {
1084
+ await executable._validateHostRequirements(sdkLanguage);
1085
+ import_debugLogger.debugLogger.log("install", `validation passed for ${executable.name}`);
1086
+ } catch (error) {
1087
+ import_debugLogger.debugLogger.log("install", `validation failed for ${executable.name}`);
1088
+ throw error;
1089
+ }
1090
+ await import_fs.default.promises.writeFile(markerFile, "").catch(() => {
1091
+ });
1092
+ }
1093
+ _downloadURLs(descriptor) {
1094
+ const paths = DOWNLOAD_PATHS[descriptor.name];
1095
+ const downloadPathTemplate = paths[import_hostPlatform.hostPlatform] || paths["<unknown>"];
1096
+ if (!downloadPathTemplate)
1097
+ return [];
1098
+ let downloadPath;
1099
+ let mirrors;
1100
+ if (typeof downloadPathTemplate === "function") {
1101
+ const result = downloadPathTemplate(descriptor);
1102
+ downloadPath = result.path;
1103
+ mirrors = result.mirrors;
1104
+ } else {
1105
+ downloadPath = util.format(downloadPathTemplate, descriptor.revision);
1106
+ mirrors = PLAYWRIGHT_CDN_MIRRORS;
1107
+ }
1108
+ let downloadHostEnv;
1109
+ if (descriptor.name.startsWith("chromium"))
1110
+ downloadHostEnv = "PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST";
1111
+ else if (descriptor.name.startsWith("firefox"))
1112
+ downloadHostEnv = "PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST";
1113
+ else if (descriptor.name.startsWith("webkit"))
1114
+ downloadHostEnv = "PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST";
1115
+ const customHostOverride = downloadHostEnv && (0, import_utils.getFromENV)(downloadHostEnv) || (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_HOST");
1116
+ if (customHostOverride)
1117
+ mirrors = [customHostOverride];
1118
+ return mirrors.map((mirror) => `${mirror}/${downloadPath}`);
1119
+ }
1120
+ async _downloadExecutable(descriptor, force, executablePath) {
1121
+ const downloadURLs = this._downloadURLs(descriptor);
1122
+ if (!downloadURLs.length)
1123
+ throw new Error(`ERROR: Playwright does not support ${descriptor.name} on ${import_hostPlatform.hostPlatform}`);
1124
+ if (!import_hostPlatform.isOfficiallySupportedPlatform)
1125
+ (0, import_browserFetcher.logPolitely)(`BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ${import_hostPlatform.hostPlatform}.`);
1126
+ if (descriptor.hasRevisionOverride) {
1127
+ const message = `You are using a frozen ${descriptor.name} browser which does not receive updates anymore on ${import_hostPlatform.hostPlatform}. Please update to the latest version of your operating system to test up-to-date browsers.`;
1128
+ if (process.env.GITHUB_ACTIONS)
1129
+ console.log(`::warning title=Playwright::${message}`);
1130
+ else
1131
+ (0, import_browserFetcher.logPolitely)(message);
1132
+ }
1133
+ const title = this.calculateDownloadTitle(descriptor);
1134
+ const downloadFileName = `playwright-download-${descriptor.name}-${import_hostPlatform.hostPlatform}-${descriptor.revision}.zip`;
1135
+ const downloadSocketTimeoutEnv = (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT");
1136
+ const downloadSocketTimeout = +(downloadSocketTimeoutEnv || "0") || import_network.NET_DEFAULT_TIMEOUT;
1137
+ await (0, import_browserFetcher.downloadBrowserWithProgressBar)(title, descriptor.dir, executablePath, downloadURLs, downloadFileName, downloadSocketTimeout, force).catch((e) => {
1138
+ throw new Error(`Failed to download ${title}, caused by
1139
+ ${e.stack}`);
1140
+ });
1141
+ }
1142
+ calculateDownloadTitle(descriptor) {
1143
+ const title = descriptor.title ?? descriptor.name.split("-").map((word) => {
1144
+ return word === "ffmpeg" ? "FFmpeg" : word.charAt(0).toUpperCase() + word.slice(1);
1145
+ }).join(" ");
1146
+ const version = descriptor.browserVersion ? " " + descriptor.browserVersion : "";
1147
+ return `${title}${version} (playwright ${descriptor.name} v${descriptor.revision})`;
1148
+ }
1149
+ async _installMSEdgeChannel(channel, scripts) {
1150
+ const scriptArgs = [];
1151
+ if (process.platform !== "linux") {
1152
+ const products = lowercaseAllKeys(JSON.parse(await (0, import_network.fetchData)(void 0, { url: "https://edgeupdates.microsoft.com/api/products" })));
1153
+ const productName = {
1154
+ "msedge": "Stable",
1155
+ "msedge-beta": "Beta",
1156
+ "msedge-dev": "Dev"
1157
+ }[channel];
1158
+ const product = products.find((product2) => product2.product === productName);
1159
+ const searchConfig = {
1160
+ darwin: { platform: "MacOS", arch: "universal", artifact: "pkg" },
1161
+ win32: { platform: "Windows", arch: "x64", artifact: "msi" }
1162
+ }[process.platform];
1163
+ const release = searchConfig ? product.releases.find((release2) => release2.platform === searchConfig.platform && release2.architecture === searchConfig.arch && release2.artifacts.length > 0) : null;
1164
+ const artifact = release ? release.artifacts.find((artifact2) => artifact2.artifactname === searchConfig.artifact) : null;
1165
+ if (artifact)
1166
+ scriptArgs.push(
1167
+ artifact.location
1168
+ /* url */
1169
+ );
1170
+ else
1171
+ throw new Error(`Cannot install ${channel} on ${process.platform}`);
1172
+ }
1173
+ await this._installChromiumChannel(channel, scripts, scriptArgs);
1174
+ }
1175
+ async _installChromiumChannel(channel, scripts, scriptArgs = []) {
1176
+ const scriptName = scripts[process.platform];
1177
+ if (!scriptName)
1178
+ throw new Error(`Cannot install ${channel} on ${process.platform}`);
1179
+ const cwd = BIN_PATH;
1180
+ const isPowerShell = scriptName.endsWith(".ps1");
1181
+ if (isPowerShell) {
1182
+ const args = [
1183
+ "-ExecutionPolicy",
1184
+ "Bypass",
1185
+ "-File",
1186
+ import_path.default.join(BIN_PATH, scriptName),
1187
+ ...scriptArgs
1188
+ ];
1189
+ const { code } = await (0, import_spawnAsync.spawnAsync)("powershell.exe", args, { cwd, stdio: "inherit" });
1190
+ if (code !== 0)
1191
+ throw new Error(`Failed to install ${channel}`);
1192
+ } else {
1193
+ const { command, args, elevatedPermissions } = await (0, import_dependencies.transformCommandsForRoot)([`bash "${import_path.default.join(BIN_PATH, scriptName)}" ${scriptArgs.join("")}`]);
1194
+ if (elevatedPermissions)
1195
+ console.log("Switching to root user to install dependencies...");
1196
+ const { code } = await (0, import_spawnAsync.spawnAsync)(command, args, { cwd, stdio: "inherit" });
1197
+ if (code !== 0)
1198
+ throw new Error(`Failed to install ${channel}`);
1199
+ }
1200
+ }
1201
+ async listInstalledBrowsers() {
1202
+ const linksDir = import_path.default.join(registryDirectory, ".links");
1203
+ const { browsers } = await this._traverseBrowserInstallations(linksDir);
1204
+ return browsers.filter((browser) => import_fs.default.existsSync(browser.browserPath));
1205
+ }
1206
+ async _validateInstallationCache(linksDir) {
1207
+ const { browsers, brokenLinks } = await this._traverseBrowserInstallations(linksDir);
1208
+ await this._deleteStaleBrowsers(browsers);
1209
+ await this._deleteBrokenInstallations(brokenLinks);
1210
+ }
1211
+ async _traverseBrowserInstallations(linksDir) {
1212
+ const browserList = [];
1213
+ const brokenLinks = [];
1214
+ for (const fileName of await import_fs.default.promises.readdir(linksDir)) {
1215
+ const linkPath = import_path.default.join(linksDir, fileName);
1216
+ let linkTarget = "";
1217
+ try {
1218
+ linkTarget = (await import_fs.default.promises.readFile(linkPath)).toString();
1219
+ const browsersJSON = require(import_path.default.join(linkTarget, "browsers.json"));
1220
+ const descriptors = readDescriptors(browsersJSON);
1221
+ for (const browserName of allDownloadableDirectoriesThatEverExisted) {
1222
+ const descriptor = descriptors.find((d) => d.name === browserName);
1223
+ if (!descriptor)
1224
+ continue;
1225
+ const browserPath = descriptor.dir;
1226
+ const browserVersion = parseInt(descriptor.revision, 10);
1227
+ browserList.push({
1228
+ browserName,
1229
+ browserVersion,
1230
+ browserPath,
1231
+ referenceDir: linkTarget
1232
+ });
1233
+ }
1234
+ } catch (e) {
1235
+ brokenLinks.push(linkPath);
1236
+ }
1237
+ }
1238
+ return { browsers: browserList, brokenLinks };
1239
+ }
1240
+ async _deleteStaleBrowsers(browserList) {
1241
+ const usedBrowserPaths = /* @__PURE__ */ new Set();
1242
+ for (const browser of browserList) {
1243
+ const { browserName, browserVersion, browserPath } = browser;
1244
+ const shouldHaveMarkerFile = browserName === "chromium" && (browserVersion >= 786218 || browserVersion < 3e5) || browserName === "firefox" && browserVersion >= 1128 || browserName === "webkit" && browserVersion >= 1307 || // All new applications have a marker file right away.
1245
+ browserName !== "firefox" && browserName !== "chromium" && browserName !== "webkit";
1246
+ if (!shouldHaveMarkerFile || await (0, import_fileUtils.existsAsync)(browserDirectoryToMarkerFilePath(browserPath)))
1247
+ usedBrowserPaths.add(browserPath);
1248
+ }
1249
+ let downloadedBrowsers = (await import_fs.default.promises.readdir(registryDirectory)).map((file) => import_path.default.join(registryDirectory, file));
1250
+ downloadedBrowsers = downloadedBrowsers.filter((file) => isBrowserDirectory(file));
1251
+ const directories = new Set(downloadedBrowsers);
1252
+ for (const browserDirectory of usedBrowserPaths)
1253
+ directories.delete(browserDirectory);
1254
+ for (const directory of directories)
1255
+ (0, import_browserFetcher.logPolitely)("Removing unused browser at " + directory);
1256
+ await (0, import_fileUtils.removeFolders)([...directories]);
1257
+ }
1258
+ async _deleteBrokenInstallations(brokenLinks) {
1259
+ for (const linkPath of brokenLinks)
1260
+ await import_fs.default.promises.unlink(linkPath).catch((e) => {
1261
+ });
1262
+ }
1263
+ _defaultBrowsersToInstall(options) {
1264
+ let executables = this.defaultExecutables();
1265
+ if (options.shell === "no")
1266
+ executables = executables.filter((e) => e.name !== "chromium-headless-shell" && e.name !== "chromium-tip-of-tree-headless-shell");
1267
+ if (options.shell === "only")
1268
+ executables = executables.filter((e) => e.name !== "chromium" && e.name !== "chromium-tip-of-tree");
1269
+ return executables;
1270
+ }
1271
+ suggestedBrowsersToInstall() {
1272
+ const names = this.executables().filter((e) => e.installType !== "none").map((e) => e.name);
1273
+ names.push(...chromiumAliases);
1274
+ return names.sort().join(", ");
1275
+ }
1276
+ isChromiumAlias(name) {
1277
+ return chromiumAliases.includes(name);
1278
+ }
1279
+ resolveBrowsers(aliases, options) {
1280
+ if (aliases.length === 0)
1281
+ return this._defaultBrowsersToInstall(options);
1282
+ const faultyArguments = [];
1283
+ const executables = [];
1284
+ const handleArgument = (arg) => {
1285
+ const executable = this.findExecutable(arg);
1286
+ if (!executable || executable.installType === "none")
1287
+ faultyArguments.push(arg);
1288
+ else
1289
+ executables.push(executable);
1290
+ if (executable?.browserName)
1291
+ executables.push(this.findExecutable("ffmpeg"));
1292
+ };
1293
+ for (const alias of aliases) {
1294
+ if (alias === "chromium" || chromiumAliases.includes(alias)) {
1295
+ if (options.shell !== "only")
1296
+ handleArgument("chromium");
1297
+ if (options.shell !== "no")
1298
+ handleArgument("chromium-headless-shell");
1299
+ } else if (alias === "chromium-tip-of-tree") {
1300
+ if (options.shell !== "only")
1301
+ handleArgument("chromium-tip-of-tree");
1302
+ if (options.shell !== "no")
1303
+ handleArgument("chromium-tip-of-tree-headless-shell");
1304
+ } else {
1305
+ handleArgument(alias);
1306
+ }
1307
+ }
1308
+ if (process.platform === "win32")
1309
+ executables.push(this.findExecutable("winldd"));
1310
+ if (faultyArguments.length)
1311
+ throw new Error(`Invalid installation targets: ${faultyArguments.map((name) => `'${name}'`).join(", ")}. Expecting one of: ${this.suggestedBrowsersToInstall()}`);
1312
+ return executables;
1313
+ }
1314
+ }
1315
+ function browserDirectoryToMarkerFilePath(browserDirectory) {
1316
+ return import_path.default.join(browserDirectory, "INSTALLATION_COMPLETE");
1317
+ }
1318
+ function buildPlaywrightCLICommand(sdkLanguage, parameters) {
1319
+ switch (sdkLanguage) {
1320
+ case "python":
1321
+ return `playwright ${parameters}`;
1322
+ case "java":
1323
+ return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="${parameters}"`;
1324
+ case "csharp":
1325
+ return `pwsh bin/Debug/netX/playwright.ps1 ${parameters}`;
1326
+ default: {
1327
+ const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
1328
+ return `${packageManagerCommand} playwright ${parameters}`;
1329
+ }
1330
+ }
1331
+ }
1332
+ async function installBrowsersForNpmInstall(browsers) {
1333
+ if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")) {
1334
+ (0, import_browserFetcher.logPolitely)("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
1335
+ return false;
1336
+ }
1337
+ const executables = [];
1338
+ if (process.platform === "win32")
1339
+ executables.push(registry.findExecutable("winldd"));
1340
+ for (const browserName of browsers) {
1341
+ const executable = registry.findExecutable(browserName);
1342
+ if (!executable || executable.installType === "none")
1343
+ throw new Error(`Cannot install ${browserName}`);
1344
+ executables.push(executable);
1345
+ }
1346
+ await registry.install(executables);
1347
+ }
1348
+ function findChromiumChannelBestEffort(sdkLanguage) {
1349
+ let channel = null;
1350
+ for (const name of ["chromium", "chrome", "msedge"]) {
1351
+ try {
1352
+ registry.findExecutable(name).executablePathOrDie(sdkLanguage);
1353
+ channel = name === "chromium" ? void 0 : name;
1354
+ break;
1355
+ } catch (e) {
1356
+ }
1357
+ }
1358
+ if (channel === null) {
1359
+ const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install chromium`);
1360
+ const prettyMessage = [
1361
+ `No chromium-based browser found on the system.`,
1362
+ `Please run the following command to download one:`,
1363
+ ``,
1364
+ ` ${installCommand}`,
1365
+ ``,
1366
+ `<3 Playwright Team`
1367
+ ].join("\n");
1368
+ throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)(prettyMessage, 1));
1369
+ }
1370
+ return channel;
1371
+ }
1372
+ function lowercaseAllKeys(json) {
1373
+ if (typeof json !== "object" || !json)
1374
+ return json;
1375
+ if (Array.isArray(json))
1376
+ return json.map(lowercaseAllKeys);
1377
+ const result = {};
1378
+ for (const [key, value] of Object.entries(json))
1379
+ result[key.toLowerCase()] = lowercaseAllKeys(value);
1380
+ return result;
1381
+ }
1382
+ const registry = new Registry(require("../../../browsers.json"));
1383
+ // Annotate the CommonJS export names for ESM import in node:
1384
+ 0 && (module.exports = {
1385
+ Registry,
1386
+ browserDirectoryToMarkerFilePath,
1387
+ buildPlaywrightCLICommand,
1388
+ defaultCacheDirectory,
1389
+ defaultRegistryDirectory,
1390
+ findChromiumChannelBestEffort,
1391
+ installBrowsersForNpmInstall,
1392
+ registry,
1393
+ registryDirectory,
1394
+ writeDockerVersion
1395
+ });