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