@checkly/playwright-core 1.51.17-beta.2 → 1.54.2-beta.1

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 (376) hide show
  1. package/ThirdPartyNotices.txt +65 -123
  2. package/browsers.json +16 -14
  3. package/index.js +1 -1
  4. package/lib/androidServerImpl.js +47 -50
  5. package/lib/browserServerImpl.js +89 -69
  6. package/lib/checkly/escapeRegExp.js +23 -27
  7. package/lib/checkly/fetch.js +64 -46
  8. package/lib/checkly/secretsFilter.js +49 -35
  9. package/lib/cli/driver.js +71 -69
  10. package/lib/cli/program.js +400 -359
  11. package/lib/cli/programWithTestStub.js +51 -45
  12. package/lib/client/accessibility.js +31 -32
  13. package/lib/client/android.js +151 -242
  14. package/lib/client/api.js +135 -283
  15. package/lib/client/artifact.js +39 -36
  16. package/lib/client/browser.js +96 -71
  17. package/lib/client/browserContext.js +314 -345
  18. package/lib/client/browserType.js +103 -127
  19. package/lib/client/cdpSession.js +29 -31
  20. package/lib/client/channelOwner.js +89 -112
  21. package/lib/client/clientHelper.js +48 -39
  22. package/lib/client/clientInstrumentation.js +40 -37
  23. package/lib/client/clientStackTrace.js +41 -37
  24. package/lib/client/clock.js +36 -36
  25. package/lib/client/connection.js +188 -214
  26. package/lib/client/consoleMessage.js +31 -28
  27. package/lib/client/coverage.js +25 -22
  28. package/lib/client/dialog.js +30 -31
  29. package/lib/client/download.js +25 -25
  30. package/lib/client/electron.js +80 -77
  31. package/lib/client/elementHandle.js +120 -159
  32. package/lib/client/errors.js +53 -53
  33. package/lib/client/eventEmitter.js +124 -121
  34. package/lib/client/events.js +72 -68
  35. package/lib/client/fetch.js +166 -190
  36. package/lib/client/fileChooser.js +25 -24
  37. package/lib/client/fileUtils.js +31 -28
  38. package/lib/client/frame.js +207 -306
  39. package/lib/client/harRouter.js +42 -52
  40. package/lib/client/input.js +42 -69
  41. package/lib/client/jsHandle.js +54 -69
  42. package/lib/client/jsonPipe.js +27 -23
  43. package/lib/client/localUtils.js +29 -29
  44. package/lib/client/locator.js +145 -237
  45. package/lib/client/network.js +282 -307
  46. package/lib/client/page.js +269 -318
  47. package/lib/client/platform.js +46 -43
  48. package/lib/client/playwright.js +51 -76
  49. package/lib/client/selectors.js +45 -63
  50. package/lib/client/stream.js +29 -25
  51. package/lib/client/timeoutSettings.js +55 -41
  52. package/lib/client/tracing.js +49 -96
  53. package/lib/client/types.js +26 -22
  54. package/lib/client/video.js +35 -27
  55. package/lib/client/waiter.js +69 -88
  56. package/lib/client/webError.js +25 -23
  57. package/lib/client/webSocket.js +43 -56
  58. package/lib/client/worker.js +48 -56
  59. package/lib/client/writableStream.js +27 -23
  60. package/lib/generated/bindingsControllerSource.js +28 -0
  61. package/lib/generated/clockSource.js +26 -6
  62. package/lib/generated/consoleApiSource.js +26 -6
  63. package/lib/generated/injectedScriptSource.js +26 -6
  64. package/lib/generated/pollingRecorderSource.js +26 -6
  65. package/lib/generated/storageScriptSource.js +28 -0
  66. package/lib/generated/utilityScriptSource.js +26 -6
  67. package/lib/generated/webSocketMockSource.js +333 -5
  68. package/lib/inProcessFactory.js +51 -53
  69. package/lib/inprocess.js +2 -19
  70. package/lib/outofprocess.js +51 -46
  71. package/lib/protocol/serializers.js +153 -134
  72. package/lib/protocol/validator.js +2807 -2739
  73. package/lib/protocol/validatorPrimitives.js +114 -73
  74. package/lib/remote/playwrightConnection.js +88 -242
  75. package/lib/remote/playwrightServer.js +305 -92
  76. package/lib/server/accessibility.js +44 -37
  77. package/lib/server/android/android.js +251 -241
  78. package/lib/server/android/backendAdb.js +87 -82
  79. package/lib/server/artifact.js +78 -55
  80. package/lib/server/bidi/bidiBrowser.js +297 -158
  81. package/lib/server/bidi/bidiChromium.js +119 -89
  82. package/lib/server/bidi/bidiConnection.js +66 -83
  83. package/lib/server/bidi/bidiExecutionContext.js +129 -113
  84. package/lib/server/bidi/bidiFirefox.js +86 -76
  85. package/lib/server/bidi/bidiInput.js +106 -117
  86. package/lib/server/bidi/bidiNetworkManager.js +142 -159
  87. package/lib/server/bidi/bidiOverCdp.js +57 -58
  88. package/lib/server/bidi/bidiPage.js +260 -260
  89. package/lib/server/bidi/bidiPdf.js +52 -86
  90. package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
  91. package/lib/server/bidi/third_party/bidiDeserializer.js +55 -50
  92. package/lib/server/bidi/third_party/bidiKeyboard.js +236 -220
  93. package/lib/server/bidi/third_party/bidiProtocol.js +22 -137
  94. package/lib/server/bidi/third_party/bidiProtocolCore.js +152 -0
  95. package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
  96. package/lib/server/bidi/third_party/bidiSerializer.js +67 -63
  97. package/lib/server/bidi/third_party/firefoxPrefs.js +141 -119
  98. package/lib/server/browser.js +93 -95
  99. package/lib/server/browserContext.js +419 -429
  100. package/lib/server/browserType.js +186 -216
  101. package/lib/server/callLog.js +47 -44
  102. package/lib/server/chromium/chromium.js +235 -203
  103. package/lib/server/chromium/chromiumSwitches.js +100 -67
  104. package/lib/server/chromium/crAccessibility.js +157 -131
  105. package/lib/server/chromium/crBrowser.js +310 -292
  106. package/lib/server/chromium/crConnection.js +95 -121
  107. package/lib/server/chromium/crCoverage.js +121 -131
  108. package/lib/server/chromium/crDevTools.js +60 -51
  109. package/lib/server/chromium/crDragDrop.js +68 -84
  110. package/lib/server/chromium/crExecutionContext.js +89 -83
  111. package/lib/server/chromium/crInput.js +118 -113
  112. package/lib/server/chromium/crNetworkManager.js +274 -375
  113. package/lib/server/chromium/crPage.js +536 -593
  114. package/lib/server/chromium/crPdf.js +54 -86
  115. package/lib/server/chromium/crProtocolHelper.js +92 -80
  116. package/lib/server/chromium/crServiceWorker.js +84 -73
  117. package/lib/server/chromium/defaultFontFamilies.js +152 -135
  118. package/lib/server/chromium/protocol.d.js +16 -0
  119. package/lib/server/chromium/videoRecorder.js +66 -99
  120. package/lib/server/clock.js +107 -83
  121. package/lib/server/codegen/csharp.js +192 -162
  122. package/lib/server/codegen/java.js +156 -129
  123. package/lib/server/codegen/javascript.js +163 -148
  124. package/lib/server/codegen/jsonl.js +32 -28
  125. package/lib/server/codegen/language.js +75 -52
  126. package/lib/server/codegen/languages.js +65 -27
  127. package/lib/server/codegen/python.js +141 -126
  128. package/lib/server/codegen/types.js +15 -4
  129. package/lib/server/console.js +28 -32
  130. package/lib/server/cookieStore.js +108 -86
  131. package/lib/server/debugController.js +147 -151
  132. package/lib/server/debugger.js +86 -78
  133. package/lib/server/deviceDescriptors.js +37 -24
  134. package/lib/server/deviceDescriptorsSource.json +238 -128
  135. package/lib/server/dialog.js +84 -39
  136. package/lib/server/dispatchers/androidDispatcher.js +257 -148
  137. package/lib/server/dispatchers/artifactDispatcher.js +79 -79
  138. package/lib/server/dispatchers/browserContextDispatcher.js +289 -259
  139. package/lib/server/dispatchers/browserDispatcher.js +96 -148
  140. package/lib/server/dispatchers/browserTypeDispatcher.js +50 -41
  141. package/lib/server/dispatchers/cdpSessionDispatcher.js +35 -39
  142. package/lib/server/dispatchers/debugControllerDispatcher.js +65 -83
  143. package/lib/server/dispatchers/dialogDispatcher.js +34 -31
  144. package/lib/server/dispatchers/dispatcher.js +208 -248
  145. package/lib/server/dispatchers/electronDispatcher.js +66 -70
  146. package/lib/server/dispatchers/elementHandlerDispatcher.js +164 -216
  147. package/lib/server/dispatchers/frameDispatcher.js +211 -272
  148. package/lib/server/dispatchers/jsHandleDispatcher.js +63 -75
  149. package/lib/server/dispatchers/jsonPipeDispatcher.js +37 -38
  150. package/lib/server/dispatchers/localUtilsDispatcher.js +121 -119
  151. package/lib/server/dispatchers/networkDispatchers.js +117 -128
  152. package/lib/server/dispatchers/pageDispatcher.js +256 -248
  153. package/lib/server/dispatchers/playwrightDispatcher.js +92 -87
  154. package/lib/server/dispatchers/streamDispatcher.js +52 -48
  155. package/lib/server/dispatchers/tracingDispatcher.js +47 -52
  156. package/lib/server/dispatchers/webSocketRouteDispatcher.js +126 -150
  157. package/lib/server/dispatchers/writableStreamDispatcher.js +65 -43
  158. package/lib/server/dom.js +485 -582
  159. package/lib/server/download.js +47 -37
  160. package/lib/server/electron/electron.js +216 -243
  161. package/lib/server/electron/loader.js +9 -37
  162. package/lib/server/errors.js +47 -46
  163. package/lib/server/fetch.js +317 -360
  164. package/lib/server/fileChooser.js +25 -24
  165. package/lib/server/fileUploadUtils.js +66 -60
  166. package/lib/server/firefox/ffAccessibility.js +153 -131
  167. package/lib/server/firefox/ffBrowser.js +268 -305
  168. package/lib/server/firefox/ffConnection.js +63 -84
  169. package/lib/server/firefox/ffExecutionContext.js +92 -73
  170. package/lib/server/firefox/ffInput.js +82 -84
  171. package/lib/server/firefox/ffNetworkManager.js +137 -114
  172. package/lib/server/firefox/ffPage.js +261 -293
  173. package/lib/server/firefox/firefox.js +80 -72
  174. package/lib/server/firefox/protocol.d.js +16 -0
  175. package/lib/server/formData.js +107 -35
  176. package/lib/server/frameSelectors.js +98 -114
  177. package/lib/server/frames.js +845 -1055
  178. package/lib/server/har/harRecorder.js +85 -77
  179. package/lib/server/har/harTracer.js +290 -223
  180. package/lib/server/harBackend.js +80 -80
  181. package/lib/server/helper.js +55 -59
  182. package/lib/server/index.js +59 -99
  183. package/lib/server/input.js +151 -189
  184. package/lib/server/instrumentation.js +57 -44
  185. package/lib/server/javascript.js +133 -134
  186. package/lib/server/launchApp.js +113 -75
  187. package/lib/server/localUtils.js +150 -142
  188. package/lib/server/macEditingCommands.js +141 -137
  189. package/lib/server/network.js +299 -303
  190. package/lib/server/page.js +513 -544
  191. package/lib/server/pipeTransport.js +49 -45
  192. package/lib/server/playwright.js +58 -67
  193. package/lib/server/progress.js +137 -68
  194. package/lib/server/protocolError.js +34 -31
  195. package/lib/server/recorder/chat.js +70 -86
  196. package/lib/server/recorder/recorderApp.js +341 -176
  197. package/lib/server/recorder/recorderInTraceViewer.js +65 -94
  198. package/lib/server/recorder/recorderRunner.js +93 -116
  199. package/lib/server/recorder/recorderSignalProcessor.js +83 -0
  200. package/lib/server/recorder/recorderUtils.js +104 -47
  201. package/lib/server/recorder/throttledFile.js +42 -30
  202. package/lib/server/recorder.js +395 -275
  203. package/lib/server/registry/browserFetcher.js +106 -101
  204. package/lib/server/registry/dependencies.js +245 -196
  205. package/lib/server/registry/index.js +930 -803
  206. package/lib/server/registry/nativeDeps.js +1073 -464
  207. package/lib/server/registry/oopDownloadBrowserMain.js +57 -75
  208. package/lib/server/screenshotter.js +160 -191
  209. package/lib/server/selectors.js +90 -51
  210. package/lib/server/socksClientCertificatesInterceptor.js +171 -186
  211. package/lib/server/socksInterceptor.js +62 -70
  212. package/lib/server/trace/recorder/snapshotter.js +76 -102
  213. package/lib/server/trace/recorder/snapshotterInjected.js +238 -217
  214. package/lib/server/trace/recorder/tracing.js +354 -362
  215. package/lib/server/trace/test/inMemorySnapshotter.js +46 -52
  216. package/lib/server/trace/viewer/traceViewer.js +160 -147
  217. package/lib/server/transport.js +119 -134
  218. package/lib/server/types.js +26 -22
  219. package/lib/server/usKeyboardLayout.js +135 -545
  220. package/lib/server/utils/ascii.js +39 -26
  221. package/lib/server/utils/comparators.js +105 -103
  222. package/lib/server/utils/crypto.js +157 -112
  223. package/lib/server/utils/debug.js +36 -32
  224. package/lib/server/utils/debugLogger.js +77 -48
  225. package/lib/server/utils/env.js +52 -37
  226. package/lib/server/utils/eventsHelper.js +29 -28
  227. package/lib/server/utils/expectUtils.js +31 -26
  228. package/lib/server/utils/fileUtils.js +123 -136
  229. package/lib/server/utils/happyEyeballs.js +141 -126
  230. package/lib/server/utils/hostPlatform.js +84 -120
  231. package/lib/server/utils/httpServer.js +106 -121
  232. package/lib/server/utils/image_tools/colorUtils.js +42 -51
  233. package/lib/server/utils/image_tools/compare.js +44 -43
  234. package/lib/server/utils/image_tools/imageChannel.js +38 -30
  235. package/lib/server/utils/image_tools/stats.js +40 -40
  236. package/lib/server/utils/linuxUtils.js +50 -37
  237. package/lib/server/utils/network.js +152 -96
  238. package/lib/server/utils/nodePlatform.js +87 -79
  239. package/lib/server/utils/pipeTransport.js +44 -42
  240. package/lib/server/utils/processLauncher.js +111 -121
  241. package/lib/server/utils/profiler.js +52 -39
  242. package/lib/server/utils/socksProxy.js +280 -339
  243. package/lib/server/utils/spawnAsync.js +37 -41
  244. package/lib/server/utils/task.js +31 -38
  245. package/lib/server/utils/userAgent.js +73 -66
  246. package/lib/server/utils/wsServer.js +68 -75
  247. package/lib/server/utils/zipFile.js +36 -37
  248. package/lib/server/utils/zones.js +37 -34
  249. package/lib/server/webkit/protocol.d.js +16 -0
  250. package/lib/server/webkit/webkit.js +77 -61
  251. package/lib/server/webkit/wkAccessibility.js +161 -118
  252. package/lib/server/webkit/wkBrowser.js +193 -184
  253. package/lib/server/webkit/wkConnection.js +59 -83
  254. package/lib/server/webkit/wkExecutionContext.js +85 -70
  255. package/lib/server/webkit/wkInput.js +97 -95
  256. package/lib/server/webkit/wkInterceptableRequest.js +102 -95
  257. package/lib/server/webkit/wkPage.js +568 -667
  258. package/lib/server/webkit/wkProvisionalPage.js +45 -56
  259. package/lib/server/webkit/wkWorkers.js +79 -79
  260. package/lib/utils/expectUtils.js +31 -26
  261. package/lib/utils/isomorphic/ariaSnapshot.js +149 -152
  262. package/lib/utils/isomorphic/assert.js +28 -22
  263. package/lib/utils/isomorphic/colors.js +66 -59
  264. package/lib/utils/isomorphic/cssParser.js +120 -125
  265. package/lib/utils/isomorphic/cssTokenizer.js +436 -364
  266. package/lib/utils/isomorphic/headers.js +38 -37
  267. package/lib/utils/isomorphic/locatorGenerators.js +358 -357
  268. package/lib/utils/isomorphic/locatorParser.js +96 -105
  269. package/lib/utils/isomorphic/locatorUtils.js +63 -44
  270. package/lib/utils/isomorphic/manualPromise.js +46 -39
  271. package/lib/utils/isomorphic/mimeType.js +447 -25
  272. package/lib/utils/isomorphic/multimap.js +34 -27
  273. package/lib/utils/isomorphic/protocolFormatter.js +68 -0
  274. package/lib/utils/isomorphic/protocolMetainfo.js +321 -0
  275. package/lib/utils/isomorphic/recorderUtils.js +140 -181
  276. package/lib/utils/isomorphic/rtti.js +35 -33
  277. package/lib/utils/isomorphic/selectorParser.js +182 -193
  278. package/lib/utils/isomorphic/semaphore.js +27 -24
  279. package/lib/utils/isomorphic/stackTrace.js +87 -98
  280. package/lib/utils/isomorphic/stringUtils.js +98 -112
  281. package/lib/utils/isomorphic/time.js +46 -22
  282. package/lib/utils/isomorphic/timeoutRunner.js +53 -53
  283. package/lib/utils/isomorphic/traceUtils.js +37 -41
  284. package/lib/utils/isomorphic/types.js +15 -4
  285. package/lib/utils/isomorphic/urlMatch.js +113 -67
  286. package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
  287. package/lib/utils.js +101 -443
  288. package/lib/utilsBundle.js +101 -52
  289. package/lib/utilsBundleImpl/index.js +160 -150
  290. package/lib/zipBundle.js +32 -23
  291. package/lib/zipBundleImpl.js +4 -4
  292. package/package.json +1 -1
  293. package/types/protocol.d.ts +1267 -1057
  294. package/types/types.d.ts +131 -29
  295. package/lib/common/socksProxy.js +0 -569
  296. package/lib/common/timeoutSettings.js +0 -73
  297. package/lib/common/types.js +0 -5
  298. package/lib/image_tools/colorUtils.js +0 -98
  299. package/lib/image_tools/compare.js +0 -108
  300. package/lib/image_tools/imageChannel.js +0 -70
  301. package/lib/image_tools/stats.js +0 -102
  302. package/lib/protocol/debug.js +0 -27
  303. package/lib/protocol/transport.js +0 -82
  304. package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
  305. package/lib/server/isomorphic/utilityScriptSerializers.js +0 -229
  306. package/lib/server/recorder/contextRecorder.js +0 -290
  307. package/lib/server/recorder/recorderCollection.js +0 -104
  308. package/lib/server/recorder/recorderFrontend.js +0 -5
  309. package/lib/server/storageScript.js +0 -160
  310. package/lib/server/timeoutSettings.js +0 -74
  311. package/lib/third_party/diff_match_patch.js +0 -2222
  312. package/lib/utils/ascii.js +0 -31
  313. package/lib/utils/comparators.js +0 -171
  314. package/lib/utils/crypto.js +0 -174
  315. package/lib/utils/debug.js +0 -46
  316. package/lib/utils/debugLogger.js +0 -91
  317. package/lib/utils/env.js +0 -49
  318. package/lib/utils/eventsHelper.js +0 -38
  319. package/lib/utils/fileUtils.js +0 -205
  320. package/lib/utils/happy-eyeballs.js +0 -210
  321. package/lib/utils/headers.js +0 -52
  322. package/lib/utils/hostPlatform.js +0 -133
  323. package/lib/utils/httpServer.js +0 -237
  324. package/lib/utils/index.js +0 -368
  325. package/lib/utils/linuxUtils.js +0 -78
  326. package/lib/utils/manualPromise.js +0 -109
  327. package/lib/utils/multimap.js +0 -75
  328. package/lib/utils/network.js +0 -160
  329. package/lib/utils/processLauncher.js +0 -248
  330. package/lib/utils/profiler.js +0 -53
  331. package/lib/utils/rtti.js +0 -44
  332. package/lib/utils/semaphore.js +0 -51
  333. package/lib/utils/spawnAsync.js +0 -45
  334. package/lib/utils/stackTrace.js +0 -121
  335. package/lib/utils/task.js +0 -58
  336. package/lib/utils/time.js +0 -37
  337. package/lib/utils/timeoutRunner.js +0 -66
  338. package/lib/utils/traceUtils.js +0 -44
  339. package/lib/utils/userAgent.js +0 -105
  340. package/lib/utils/wsServer.js +0 -127
  341. package/lib/utils/zipFile.js +0 -75
  342. package/lib/utils/zones.js +0 -62
  343. package/lib/vite/htmlReport/index.html +0 -69
  344. package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +0 -24
  345. package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
  346. package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  347. package/lib/vite/recorder/assets/index-ELPgmkwA.js +0 -184
  348. package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
  349. package/lib/vite/recorder/index.html +0 -29
  350. package/lib/vite/recorder/playwright-logo.svg +0 -9
  351. package/lib/vite/traceViewer/assets/codeMirrorModule-gU1OOCQO.js +0 -24
  352. package/lib/vite/traceViewer/assets/defaultSettingsView-B5n_FjMx.js +0 -1
  353. package/lib/vite/traceViewer/assets/inspectorTab-6Tru8Mn_.js +0 -235
  354. package/lib/vite/traceViewer/assets/workbench-B_Nj4NA2.js +0 -25
  355. package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
  356. package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
  357. package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  358. package/lib/vite/traceViewer/defaultSettingsView.CO3FR0CX.css +0 -1
  359. package/lib/vite/traceViewer/embedded.DpNPH6mk.js +0 -2
  360. package/lib/vite/traceViewer/embedded.html +0 -18
  361. package/lib/vite/traceViewer/embedded.mLhjB5IF.css +0 -1
  362. package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
  363. package/lib/vite/traceViewer/index.CuE3SYGw.js +0 -2
  364. package/lib/vite/traceViewer/index.html +0 -47
  365. package/lib/vite/traceViewer/inspectorTab.CXDulcFG.css +0 -1
  366. package/lib/vite/traceViewer/playwright-logo.svg +0 -9
  367. package/lib/vite/traceViewer/recorder.BD-uZJs7.js +0 -2
  368. package/lib/vite/traceViewer/recorder.html +0 -17
  369. package/lib/vite/traceViewer/recorder.tn0RQdqM.css +0 -0
  370. package/lib/vite/traceViewer/snapshot.html +0 -21
  371. package/lib/vite/traceViewer/sw.bundle.js +0 -3
  372. package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
  373. package/lib/vite/traceViewer/uiMode.DHrNgddz.js +0 -5
  374. package/lib/vite/traceViewer/uiMode.html +0 -21
  375. package/lib/vite/traceViewer/workbench.B9vIAzH9.css +0 -1
  376. package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
@@ -1,55 +1,48 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "InvalidSelectorError", {
7
- enumerable: true,
8
- get: function () {
9
- return _cssParser.InvalidSelectorError;
10
- }
11
- });
12
- exports.customCSSNames = void 0;
13
- Object.defineProperty(exports, "isInvalidSelectorError", {
14
- enumerable: true,
15
- get: function () {
16
- return _cssParser.isInvalidSelectorError;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var selectorParser_exports = {};
20
+ __export(selectorParser_exports, {
21
+ InvalidSelectorError: () => import_cssParser2.InvalidSelectorError,
22
+ customCSSNames: () => customCSSNames,
23
+ isInvalidSelectorError: () => import_cssParser2.isInvalidSelectorError,
24
+ parseAttributeSelector: () => parseAttributeSelector,
25
+ parseSelector: () => parseSelector,
26
+ splitSelectorByFrame: () => splitSelectorByFrame,
27
+ stringifySelector: () => stringifySelector,
28
+ visitAllSelectorParts: () => visitAllSelectorParts
18
29
  });
19
- exports.parseAttributeSelector = parseAttributeSelector;
20
- exports.parseSelector = parseSelector;
21
- exports.splitSelectorByFrame = splitSelectorByFrame;
22
- exports.stringifySelector = stringifySelector;
23
- exports.visitAllSelectorParts = visitAllSelectorParts;
24
- var _cssParser = require("./cssParser");
25
- /**
26
- * Copyright (c) Microsoft Corporation.
27
- *
28
- * Licensed under the Apache License, Version 2.0 (the "License");
29
- * you may not use this file except in compliance with the License.
30
- * You may obtain a copy of the License at
31
- *
32
- * http://www.apache.org/licenses/LICENSE-2.0
33
- *
34
- * Unless required by applicable law or agreed to in writing, software
35
- * distributed under the License is distributed on an "AS IS" BASIS,
36
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37
- * See the License for the specific language governing permissions and
38
- * limitations under the License.
39
- */
40
-
41
- const kNestedSelectorNames = new Set(['internal:has', 'internal:has-not', 'internal:and', 'internal:or', 'internal:chain', 'left-of', 'right-of', 'above', 'below', 'near']);
42
- const kNestedSelectorNamesWithDistance = new Set(['left-of', 'right-of', 'above', 'below', 'near']);
43
- const customCSSNames = exports.customCSSNames = new Set(['not', 'is', 'where', 'has', 'scope', 'light', 'visible', 'text', 'text-matches', 'text-is', 'has-text', 'above', 'below', 'right-of', 'left-of', 'near', 'nth-match']);
30
+ module.exports = __toCommonJS(selectorParser_exports);
31
+ var import_cssParser = require("./cssParser");
32
+ var import_cssParser2 = require("./cssParser");
33
+ const kNestedSelectorNames = /* @__PURE__ */ new Set(["internal:has", "internal:has-not", "internal:and", "internal:or", "internal:chain", "left-of", "right-of", "above", "below", "near"]);
34
+ const kNestedSelectorNamesWithDistance = /* @__PURE__ */ new Set(["left-of", "right-of", "above", "below", "near"]);
35
+ const customCSSNames = /* @__PURE__ */ new Set(["not", "is", "where", "has", "scope", "light", "visible", "text", "text-matches", "text-is", "has-text", "above", "below", "right-of", "left-of", "near", "nth-match"]);
44
36
  function parseSelector(selector) {
45
37
  const parsedStrings = parseSelectorString(selector);
46
38
  const parts = [];
47
39
  for (const part of parsedStrings.parts) {
48
- if (part.name === 'css' || part.name === 'css:light') {
49
- if (part.name === 'css:light') part.body = ':light(' + part.body + ')';
50
- const parsedCSS = (0, _cssParser.parseCSS)(part.body, customCSSNames);
40
+ if (part.name === "css" || part.name === "css:light") {
41
+ if (part.name === "css:light")
42
+ part.body = ":light(" + part.body + ")";
43
+ const parsedCSS = (0, import_cssParser.parseCSS)(part.body, customCSSNames);
51
44
  parts.push({
52
- name: 'css',
45
+ name: "css",
53
46
  body: parsedCSS.selector,
54
47
  source: part.body
55
48
  });
@@ -59,37 +52,30 @@ function parseSelector(selector) {
59
52
  let innerSelector;
60
53
  let distance;
61
54
  try {
62
- const unescaped = JSON.parse('[' + part.body + ']');
63
- if (!Array.isArray(unescaped) || unescaped.length < 1 || unescaped.length > 2 || typeof unescaped[0] !== 'string') throw new _cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
55
+ const unescaped = JSON.parse("[" + part.body + "]");
56
+ if (!Array.isArray(unescaped) || unescaped.length < 1 || unescaped.length > 2 || typeof unescaped[0] !== "string")
57
+ throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
64
58
  innerSelector = unescaped[0];
65
59
  if (unescaped.length === 2) {
66
- if (typeof unescaped[1] !== 'number' || !kNestedSelectorNamesWithDistance.has(part.name)) throw new _cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
60
+ if (typeof unescaped[1] !== "number" || !kNestedSelectorNamesWithDistance.has(part.name))
61
+ throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
67
62
  distance = unescaped[1];
68
63
  }
69
64
  } catch (e) {
70
- throw new _cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
65
+ throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
71
66
  }
72
- const nested = {
73
- name: part.name,
74
- source: part.body,
75
- body: {
76
- parsed: parseSelector(innerSelector),
77
- distance
78
- }
79
- };
80
- const lastFrame = [...nested.body.parsed.parts].reverse().find(part => part.name === 'internal:control' && part.body === 'enter-frame');
67
+ const nested = { name: part.name, source: part.body, body: { parsed: parseSelector(innerSelector), distance } };
68
+ const lastFrame = [...nested.body.parsed.parts].reverse().find((part2) => part2.name === "internal:control" && part2.body === "enter-frame");
81
69
  const lastFrameIndex = lastFrame ? nested.body.parsed.parts.indexOf(lastFrame) : -1;
82
- // Allow nested selectors to start with the same frame selector.
83
- if (lastFrameIndex !== -1 && selectorPartsEqual(nested.body.parsed.parts.slice(0, lastFrameIndex + 1), parts.slice(0, lastFrameIndex + 1))) nested.body.parsed.parts.splice(0, lastFrameIndex + 1);
70
+ if (lastFrameIndex !== -1 && selectorPartsEqual(nested.body.parsed.parts.slice(0, lastFrameIndex + 1), parts.slice(0, lastFrameIndex + 1)))
71
+ nested.body.parsed.parts.splice(0, lastFrameIndex + 1);
84
72
  parts.push(nested);
85
73
  continue;
86
74
  }
87
- parts.push({
88
- ...part,
89
- source: part.body
90
- });
75
+ parts.push({ ...part, source: part.body });
91
76
  }
92
- if (kNestedSelectorNames.has(parts[0].name)) throw new _cssParser.InvalidSelectorError(`"${parts[0].name}" selector cannot be first`);
77
+ if (kNestedSelectorNames.has(parts[0].name))
78
+ throw new import_cssParser.InvalidSelectorError(`"${parts[0].name}" selector cannot be first`);
93
79
  return {
94
80
  capture: parsedStrings.capture,
95
81
  parts
@@ -104,46 +90,49 @@ function splitSelectorByFrame(selectorText) {
104
90
  let chunkStartIndex = 0;
105
91
  for (let i = 0; i < selector.parts.length; ++i) {
106
92
  const part = selector.parts[i];
107
- if (part.name === 'internal:control' && part.body === 'enter-frame') {
108
- if (!chunk.parts.length) throw new _cssParser.InvalidSelectorError('Selector cannot start with entering frame, select the iframe first');
93
+ if (part.name === "internal:control" && part.body === "enter-frame") {
94
+ if (!chunk.parts.length)
95
+ throw new import_cssParser.InvalidSelectorError("Selector cannot start with entering frame, select the iframe first");
109
96
  result.push(chunk);
110
- chunk = {
111
- parts: []
112
- };
97
+ chunk = { parts: [] };
113
98
  chunkStartIndex = i + 1;
114
99
  continue;
115
100
  }
116
- if (selector.capture === i) chunk.capture = i - chunkStartIndex;
101
+ if (selector.capture === i)
102
+ chunk.capture = i - chunkStartIndex;
117
103
  chunk.parts.push(part);
118
104
  }
119
- if (!chunk.parts.length) throw new _cssParser.InvalidSelectorError(`Selector cannot end with entering frame, while parsing selector ${selectorText}`);
105
+ if (!chunk.parts.length)
106
+ throw new import_cssParser.InvalidSelectorError(`Selector cannot end with entering frame, while parsing selector ${selectorText}`);
120
107
  result.push(chunk);
121
- if (typeof selector.capture === 'number' && typeof result[result.length - 1].capture !== 'number') throw new _cssParser.InvalidSelectorError(`Can not capture the selector before diving into the frame. Only use * after the last frame has been selected`);
108
+ if (typeof selector.capture === "number" && typeof result[result.length - 1].capture !== "number")
109
+ throw new import_cssParser.InvalidSelectorError(`Can not capture the selector before diving into the frame. Only use * after the last frame has been selected`);
122
110
  return result;
123
111
  }
124
112
  function selectorPartsEqual(list1, list2) {
125
- return stringifySelector({
126
- parts: list1
127
- }) === stringifySelector({
128
- parts: list2
129
- });
113
+ return stringifySelector({ parts: list1 }) === stringifySelector({ parts: list2 });
130
114
  }
131
115
  function stringifySelector(selector, forceEngineName) {
132
- if (typeof selector === 'string') return selector;
116
+ if (typeof selector === "string")
117
+ return selector;
133
118
  return selector.parts.map((p, i) => {
134
119
  let includeEngine = true;
135
120
  if (!forceEngineName && i !== selector.capture) {
136
- if (p.name === 'css') includeEngine = false;else if (p.name === 'xpath' && p.source.startsWith('//') || p.source.startsWith('..')) includeEngine = false;
121
+ if (p.name === "css")
122
+ includeEngine = false;
123
+ else if (p.name === "xpath" && p.source.startsWith("//") || p.source.startsWith(".."))
124
+ includeEngine = false;
137
125
  }
138
- const prefix = includeEngine ? p.name + '=' : '';
139
- return `${i === selector.capture ? '*' : ''}${prefix}${p.source}`;
140
- }).join(' >> ');
126
+ const prefix = includeEngine ? p.name + "=" : "";
127
+ return `${i === selector.capture ? "*" : ""}${prefix}${p.source}`;
128
+ }).join(" >> ");
141
129
  }
142
130
  function visitAllSelectorParts(selector, visitor) {
143
- const visit = (selector, nested) => {
144
- for (const part of selector.parts) {
131
+ const visit = (selector2, nested) => {
132
+ for (const part of selector2.parts) {
145
133
  visitor(part, nested);
146
- if (kNestedSelectorNames.has(part.name)) visit(part.body.parsed, true);
134
+ if (kNestedSelectorNames.has(part.name))
135
+ visit(part.body.parsed, true);
147
136
  }
148
137
  };
149
138
  visit(selector, false);
@@ -152,48 +141,41 @@ function parseSelectorString(selector) {
152
141
  let index = 0;
153
142
  let quote;
154
143
  let start = 0;
155
- const result = {
156
- parts: []
157
- };
144
+ const result = { parts: [] };
158
145
  const append = () => {
159
146
  const part = selector.substring(start, index).trim();
160
- const eqIndex = part.indexOf('=');
147
+ const eqIndex = part.indexOf("=");
161
148
  let name;
162
149
  let body;
163
150
  if (eqIndex !== -1 && part.substring(0, eqIndex).trim().match(/^[a-zA-Z_0-9-+:*]+$/)) {
164
151
  name = part.substring(0, eqIndex).trim();
165
152
  body = part.substring(eqIndex + 1);
166
153
  } else if (part.length > 1 && part[0] === '"' && part[part.length - 1] === '"') {
167
- name = 'text';
154
+ name = "text";
168
155
  body = part;
169
156
  } else if (part.length > 1 && part[0] === "'" && part[part.length - 1] === "'") {
170
- name = 'text';
157
+ name = "text";
171
158
  body = part;
172
- } else if (/^\(*\/\//.test(part) || part.startsWith('..')) {
173
- // If selector starts with '//' or '//' prefixed with multiple opening
174
- // parenthesis, consider xpath. @see https://github.com/microsoft/playwright/issues/817
175
- // If selector starts with '..', consider xpath as well.
176
- name = 'xpath';
159
+ } else if (/^\(*\/\//.test(part) || part.startsWith("..")) {
160
+ name = "xpath";
177
161
  body = part;
178
162
  } else {
179
- name = 'css';
163
+ name = "css";
180
164
  body = part;
181
165
  }
182
166
  let capture = false;
183
- if (name[0] === '*') {
167
+ if (name[0] === "*") {
184
168
  capture = true;
185
169
  name = name.substring(1);
186
170
  }
187
- result.parts.push({
188
- name,
189
- body
190
- });
171
+ result.parts.push({ name, body });
191
172
  if (capture) {
192
- if (result.capture !== undefined) throw new _cssParser.InvalidSelectorError(`Only one of the selectors can capture using * modifier`);
173
+ if (result.capture !== void 0)
174
+ throw new import_cssParser.InvalidSelectorError(`Only one of the selectors can capture using * modifier`);
193
175
  result.capture = result.parts.length - 1;
194
176
  }
195
177
  };
196
- if (!selector.includes('>>')) {
178
+ if (!selector.includes(">>")) {
197
179
  index = selector.length;
198
180
  append();
199
181
  return result;
@@ -201,20 +183,19 @@ function parseSelectorString(selector) {
201
183
  const shouldIgnoreTextSelectorQuote = () => {
202
184
  const prefix = selector.substring(start, index);
203
185
  const match = prefix.match(/^\s*text\s*=(.*)$/);
204
- // Must be a text selector with some text before the quote.
205
186
  return !!match && !!match[1];
206
187
  };
207
188
  while (index < selector.length) {
208
189
  const c = selector[index];
209
- if (c === '\\' && index + 1 < selector.length) {
190
+ if (c === "\\" && index + 1 < selector.length) {
210
191
  index += 2;
211
192
  } else if (c === quote) {
212
- quote = undefined;
193
+ quote = void 0;
213
194
  index++;
214
- } else if (!quote && (c === '"' || c === '\'' || c === '`') && !shouldIgnoreTextSelectorQuote()) {
195
+ } else if (!quote && (c === '"' || c === "'" || c === "`") && !shouldIgnoreTextSelectorQuote()) {
215
196
  quote = c;
216
197
  index++;
217
- } else if (!quote && c === '>' && selector[index + 1] === '>') {
198
+ } else if (!quote && c === ">" && selector[index + 1] === ">") {
218
199
  append();
219
200
  index += 2;
220
201
  start = index;
@@ -228,170 +209,178 @@ function parseSelectorString(selector) {
228
209
  function parseAttributeSelector(selector, allowUnquotedStrings) {
229
210
  let wp = 0;
230
211
  let EOL = selector.length === 0;
231
- const next = () => selector[wp] || '';
212
+ const next = () => selector[wp] || "";
232
213
  const eat1 = () => {
233
- const result = next();
214
+ const result2 = next();
234
215
  ++wp;
235
216
  EOL = wp >= selector.length;
236
- return result;
217
+ return result2;
237
218
  };
238
- const syntaxError = stage => {
239
- if (EOL) throw new _cssParser.InvalidSelectorError(`Unexpected end of selector while parsing selector \`${selector}\``);
240
- throw new _cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - unexpected symbol "${next()}" at position ${wp}` + (stage ? ' during ' + stage : ''));
219
+ const syntaxError = (stage) => {
220
+ if (EOL)
221
+ throw new import_cssParser.InvalidSelectorError(`Unexpected end of selector while parsing selector \`${selector}\``);
222
+ throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - unexpected symbol "${next()}" at position ${wp}` + (stage ? " during " + stage : ""));
241
223
  };
242
224
  function skipSpaces() {
243
- while (!EOL && /\s/.test(next())) eat1();
225
+ while (!EOL && /\s/.test(next()))
226
+ eat1();
244
227
  }
245
228
  function isCSSNameChar(char) {
246
- // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
247
- return char >= '\u0080' // non-ascii
248
- || char >= '\u0030' && char <= '\u0039' // digit
249
- || char >= '\u0041' && char <= '\u005a' // uppercase letter
250
- || char >= '\u0061' && char <= '\u007a' // lowercase letter
251
- || char >= '\u0030' && char <= '\u0039' // digit
252
- || char === '\u005f' // "_"
253
- || char === '\u002d'; // "-"
229
+ return char >= "\x80" || char >= "0" && char <= "9" || char >= "A" && char <= "Z" || char >= "a" && char <= "z" || char >= "0" && char <= "9" || char === "_" || char === "-";
254
230
  }
255
231
  function readIdentifier() {
256
- let result = '';
232
+ let result2 = "";
257
233
  skipSpaces();
258
- while (!EOL && isCSSNameChar(next())) result += eat1();
259
- return result;
234
+ while (!EOL && isCSSNameChar(next()))
235
+ result2 += eat1();
236
+ return result2;
260
237
  }
261
238
  function readQuotedString(quote) {
262
- let result = eat1();
263
- if (result !== quote) syntaxError('parsing quoted string');
239
+ let result2 = eat1();
240
+ if (result2 !== quote)
241
+ syntaxError("parsing quoted string");
264
242
  while (!EOL && next() !== quote) {
265
- if (next() === '\\') eat1();
266
- result += eat1();
243
+ if (next() === "\\")
244
+ eat1();
245
+ result2 += eat1();
267
246
  }
268
- if (next() !== quote) syntaxError('parsing quoted string');
269
- result += eat1();
270
- return result;
247
+ if (next() !== quote)
248
+ syntaxError("parsing quoted string");
249
+ result2 += eat1();
250
+ return result2;
271
251
  }
272
252
  function readRegularExpression() {
273
- if (eat1() !== '/') syntaxError('parsing regular expression');
274
- let source = '';
253
+ if (eat1() !== "/")
254
+ syntaxError("parsing regular expression");
255
+ let source = "";
275
256
  let inClass = false;
276
- // https://262.ecma-international.org/11.0/#sec-literals-regular-expression-literals
277
257
  while (!EOL) {
278
- if (next() === '\\') {
258
+ if (next() === "\\") {
279
259
  source += eat1();
280
- if (EOL) syntaxError('parsing regular expression');
281
- } else if (inClass && next() === ']') {
260
+ if (EOL)
261
+ syntaxError("parsing regular expression");
262
+ } else if (inClass && next() === "]") {
282
263
  inClass = false;
283
- } else if (!inClass && next() === '[') {
264
+ } else if (!inClass && next() === "[") {
284
265
  inClass = true;
285
- } else if (!inClass && next() === '/') {
266
+ } else if (!inClass && next() === "/") {
286
267
  break;
287
268
  }
288
269
  source += eat1();
289
270
  }
290
- if (eat1() !== '/') syntaxError('parsing regular expression');
291
- let flags = '';
292
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
293
- while (!EOL && next().match(/[dgimsuy]/)) flags += eat1();
271
+ if (eat1() !== "/")
272
+ syntaxError("parsing regular expression");
273
+ let flags = "";
274
+ while (!EOL && next().match(/[dgimsuy]/))
275
+ flags += eat1();
294
276
  try {
295
277
  return new RegExp(source, flags);
296
278
  } catch (e) {
297
- throw new _cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\`: ${e.message}`);
279
+ throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\`: ${e.message}`);
298
280
  }
299
281
  }
300
282
  function readAttributeToken() {
301
- let token = '';
283
+ let token = "";
302
284
  skipSpaces();
303
- if (next() === `'` || next() === `"`) token = readQuotedString(next()).slice(1, -1);else token = readIdentifier();
304
- if (!token) syntaxError('parsing property path');
285
+ if (next() === `'` || next() === `"`)
286
+ token = readQuotedString(next()).slice(1, -1);
287
+ else
288
+ token = readIdentifier();
289
+ if (!token)
290
+ syntaxError("parsing property path");
305
291
  return token;
306
292
  }
307
293
  function readOperator() {
308
294
  skipSpaces();
309
- let op = '';
310
- if (!EOL) op += eat1();
311
- if (!EOL && op !== '=') op += eat1();
312
- if (!['=', '*=', '^=', '$=', '|=', '~='].includes(op)) syntaxError('parsing operator');
295
+ let op = "";
296
+ if (!EOL)
297
+ op += eat1();
298
+ if (!EOL && op !== "=")
299
+ op += eat1();
300
+ if (!["=", "*=", "^=", "$=", "|=", "~="].includes(op))
301
+ syntaxError("parsing operator");
313
302
  return op;
314
303
  }
315
304
  function readAttribute() {
316
- // skip leading [
317
305
  eat1();
318
-
319
- // read attribute name:
320
- // foo.bar
321
- // 'foo' . "ba zz"
322
306
  const jsonPath = [];
323
307
  jsonPath.push(readAttributeToken());
324
308
  skipSpaces();
325
- while (next() === '.') {
309
+ while (next() === ".") {
326
310
  eat1();
327
311
  jsonPath.push(readAttributeToken());
328
312
  skipSpaces();
329
313
  }
330
- // check property is truthy: [enabled]
331
- if (next() === ']') {
314
+ if (next() === "]") {
332
315
  eat1();
333
- return {
334
- name: jsonPath.join('.'),
335
- jsonPath,
336
- op: '<truthy>',
337
- value: null,
338
- caseSensitive: false
339
- };
316
+ return { name: jsonPath.join("."), jsonPath, op: "<truthy>", value: null, caseSensitive: false };
340
317
  }
341
318
  const operator = readOperator();
342
- let value = undefined;
319
+ let value = void 0;
343
320
  let caseSensitive = true;
344
321
  skipSpaces();
345
- if (next() === '/') {
346
- if (operator !== '=') throw new _cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with regular expression`);
322
+ if (next() === "/") {
323
+ if (operator !== "=")
324
+ throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with regular expression`);
347
325
  value = readRegularExpression();
348
326
  } else if (next() === `'` || next() === `"`) {
349
327
  value = readQuotedString(next()).slice(1, -1);
350
328
  skipSpaces();
351
- if (next() === 'i' || next() === 'I') {
329
+ if (next() === "i" || next() === "I") {
352
330
  caseSensitive = false;
353
331
  eat1();
354
- } else if (next() === 's' || next() === 'S') {
332
+ } else if (next() === "s" || next() === "S") {
355
333
  caseSensitive = true;
356
334
  eat1();
357
335
  }
358
336
  } else {
359
- value = '';
360
- while (!EOL && (isCSSNameChar(next()) || next() === '+' || next() === '.')) value += eat1();
361
- if (value === 'true') {
337
+ value = "";
338
+ while (!EOL && (isCSSNameChar(next()) || next() === "+" || next() === "."))
339
+ value += eat1();
340
+ if (value === "true") {
362
341
  value = true;
363
- } else if (value === 'false') {
342
+ } else if (value === "false") {
364
343
  value = false;
365
344
  } else {
366
345
  if (!allowUnquotedStrings) {
367
346
  value = +value;
368
- if (Number.isNaN(value)) syntaxError('parsing attribute value');
347
+ if (Number.isNaN(value))
348
+ syntaxError("parsing attribute value");
369
349
  }
370
350
  }
371
351
  }
372
352
  skipSpaces();
373
- if (next() !== ']') syntaxError('parsing attribute value');
353
+ if (next() !== "]")
354
+ syntaxError("parsing attribute value");
374
355
  eat1();
375
- if (operator !== '=' && typeof value !== 'string') throw new _cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with non-string matching value - ${value}`);
376
- return {
377
- name: jsonPath.join('.'),
378
- jsonPath,
379
- op: operator,
380
- value,
381
- caseSensitive
382
- };
356
+ if (operator !== "=" && typeof value !== "string")
357
+ throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with non-string matching value - ${value}`);
358
+ return { name: jsonPath.join("."), jsonPath, op: operator, value, caseSensitive };
383
359
  }
384
360
  const result = {
385
- name: '',
361
+ name: "",
386
362
  attributes: []
387
363
  };
388
364
  result.name = readIdentifier();
389
365
  skipSpaces();
390
- while (next() === '[') {
366
+ while (next() === "[") {
391
367
  result.attributes.push(readAttribute());
392
368
  skipSpaces();
393
369
  }
394
- if (!EOL) syntaxError(undefined);
395
- if (!result.name && !result.attributes.length) throw new _cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - selector cannot be empty`);
370
+ if (!EOL)
371
+ syntaxError(void 0);
372
+ if (!result.name && !result.attributes.length)
373
+ throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - selector cannot be empty`);
396
374
  return result;
397
- }
375
+ }
376
+ // Annotate the CommonJS export names for ESM import in node:
377
+ 0 && (module.exports = {
378
+ InvalidSelectorError,
379
+ customCSSNames,
380
+ isInvalidSelectorError,
381
+ parseAttributeSelector,
382
+ parseSelector,
383
+ splitSelectorByFrame,
384
+ stringifySelector,
385
+ visitAllSelectorParts
386
+ });
@@ -1,29 +1,29 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var semaphore_exports = {};
20
+ __export(semaphore_exports, {
21
+ Semaphore: () => Semaphore
5
22
  });
6
- exports.Semaphore = void 0;
7
- var _manualPromise = require("./manualPromise");
8
- /**
9
- * Copyright (c) Microsoft Corporation.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
-
23
+ module.exports = __toCommonJS(semaphore_exports);
24
+ var import_manualPromise = require("./manualPromise");
24
25
  class Semaphore {
25
26
  constructor(max) {
26
- this._max = void 0;
27
27
  this._acquired = 0;
28
28
  this._queue = [];
29
29
  this._max = max;
@@ -32,7 +32,7 @@ class Semaphore {
32
32
  this._max = max;
33
33
  }
34
34
  acquire() {
35
- const lock = new _manualPromise.ManualPromise();
35
+ const lock = new import_manualPromise.ManualPromise();
36
36
  this._queue.push(lock);
37
37
  this._flush();
38
38
  return lock;
@@ -48,4 +48,7 @@ class Semaphore {
48
48
  }
49
49
  }
50
50
  }
51
- exports.Semaphore = Semaphore;
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ Semaphore
54
+ });