patchright-core 1.48.2

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 (333) hide show
  1. package/README.md +3 -0
  2. package/ThirdPartyNotices.txt +1548 -0
  3. package/bin/PrintDeps.exe +0 -0
  4. package/bin/README.md +2 -0
  5. package/bin/install_media_pack.ps1 +5 -0
  6. package/bin/reinstall_chrome_beta_linux.sh +40 -0
  7. package/bin/reinstall_chrome_beta_mac.sh +13 -0
  8. package/bin/reinstall_chrome_beta_win.ps1 +24 -0
  9. package/bin/reinstall_chrome_stable_linux.sh +40 -0
  10. package/bin/reinstall_chrome_stable_mac.sh +12 -0
  11. package/bin/reinstall_chrome_stable_win.ps1 +24 -0
  12. package/bin/reinstall_msedge_beta_linux.sh +40 -0
  13. package/bin/reinstall_msedge_beta_mac.sh +11 -0
  14. package/bin/reinstall_msedge_beta_win.ps1 +23 -0
  15. package/bin/reinstall_msedge_dev_linux.sh +40 -0
  16. package/bin/reinstall_msedge_dev_mac.sh +11 -0
  17. package/bin/reinstall_msedge_dev_win.ps1 +23 -0
  18. package/bin/reinstall_msedge_stable_linux.sh +40 -0
  19. package/bin/reinstall_msedge_stable_mac.sh +11 -0
  20. package/bin/reinstall_msedge_stable_win.ps1 +24 -0
  21. package/browsers.json +57 -0
  22. package/cli.js +18 -0
  23. package/index.d.ts +17 -0
  24. package/index.js +33 -0
  25. package/index.mjs +28 -0
  26. package/lib/androidServerImpl.js +69 -0
  27. package/lib/browserServerImpl.js +92 -0
  28. package/lib/cli/driver.js +95 -0
  29. package/lib/cli/program.js +589 -0
  30. package/lib/cli/programWithTestStub.js +67 -0
  31. package/lib/client/accessibility.js +50 -0
  32. package/lib/client/android.js +473 -0
  33. package/lib/client/api.js +285 -0
  34. package/lib/client/artifact.js +79 -0
  35. package/lib/client/browser.js +145 -0
  36. package/lib/client/browserContext.js +583 -0
  37. package/lib/client/browserType.js +241 -0
  38. package/lib/client/cdpSession.js +53 -0
  39. package/lib/client/channelOwner.js +235 -0
  40. package/lib/client/clientHelper.js +57 -0
  41. package/lib/client/clientInstrumentation.js +50 -0
  42. package/lib/client/clock.js +69 -0
  43. package/lib/client/connection.js +333 -0
  44. package/lib/client/consoleMessage.js +55 -0
  45. package/lib/client/coverage.js +41 -0
  46. package/lib/client/dialog.js +57 -0
  47. package/lib/client/download.js +62 -0
  48. package/lib/client/electron.js +135 -0
  49. package/lib/client/elementHandle.js +321 -0
  50. package/lib/client/errors.js +77 -0
  51. package/lib/client/eventEmitter.js +314 -0
  52. package/lib/client/events.js +94 -0
  53. package/lib/client/fetch.js +391 -0
  54. package/lib/client/fileChooser.js +45 -0
  55. package/lib/client/frame.js +504 -0
  56. package/lib/client/harRouter.js +99 -0
  57. package/lib/client/input.js +111 -0
  58. package/lib/client/jsHandle.js +121 -0
  59. package/lib/client/jsonPipe.js +35 -0
  60. package/lib/client/localUtils.js +36 -0
  61. package/lib/client/locator.js +441 -0
  62. package/lib/client/network.js +762 -0
  63. package/lib/client/page.js +770 -0
  64. package/lib/client/playwright.js +80 -0
  65. package/lib/client/selectors.js +67 -0
  66. package/lib/client/stream.js +54 -0
  67. package/lib/client/tracing.js +134 -0
  68. package/lib/client/types.js +24 -0
  69. package/lib/client/video.js +51 -0
  70. package/lib/client/waiter.js +158 -0
  71. package/lib/client/webError.js +37 -0
  72. package/lib/client/worker.js +71 -0
  73. package/lib/client/writableStream.js +54 -0
  74. package/lib/common/socksProxy.js +569 -0
  75. package/lib/common/timeoutSettings.js +73 -0
  76. package/lib/common/types.js +5 -0
  77. package/lib/generated/clockSource.js +7 -0
  78. package/lib/generated/consoleApiSource.js +7 -0
  79. package/lib/generated/injectedScriptSource.js +7 -0
  80. package/lib/generated/pollingRecorderSource.js +7 -0
  81. package/lib/generated/utilityScriptSource.js +7 -0
  82. package/lib/generated/webSocketMockSource.js +7 -0
  83. package/lib/image_tools/colorUtils.js +98 -0
  84. package/lib/image_tools/compare.js +108 -0
  85. package/lib/image_tools/imageChannel.js +70 -0
  86. package/lib/image_tools/stats.js +102 -0
  87. package/lib/inProcessFactory.js +54 -0
  88. package/lib/inprocess.js +20 -0
  89. package/lib/outofprocess.js +67 -0
  90. package/lib/protocol/debug.js +27 -0
  91. package/lib/protocol/serializers.js +173 -0
  92. package/lib/protocol/transport.js +82 -0
  93. package/lib/protocol/validator.js +2760 -0
  94. package/lib/protocol/validatorPrimitives.js +139 -0
  95. package/lib/remote/playwrightConnection.js +274 -0
  96. package/lib/remote/playwrightServer.js +110 -0
  97. package/lib/server/accessibility.js +62 -0
  98. package/lib/server/android/android.js +441 -0
  99. package/lib/server/android/backendAdb.js +172 -0
  100. package/lib/server/artifact.js +104 -0
  101. package/lib/server/bidi/bidiBrowser.js +311 -0
  102. package/lib/server/bidi/bidiChromium.js +124 -0
  103. package/lib/server/bidi/bidiConnection.js +206 -0
  104. package/lib/server/bidi/bidiExecutionContext.js +159 -0
  105. package/lib/server/bidi/bidiFirefox.js +104 -0
  106. package/lib/server/bidi/bidiInput.js +158 -0
  107. package/lib/server/bidi/bidiNetworkManager.js +338 -0
  108. package/lib/server/bidi/bidiOverCdp.js +103 -0
  109. package/lib/server/bidi/bidiPage.js +529 -0
  110. package/lib/server/bidi/bidiPdf.js +140 -0
  111. package/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
  112. package/lib/server/bidi/third_party/bidiKeyboard.js +238 -0
  113. package/lib/server/bidi/third_party/bidiProtocol.js +139 -0
  114. package/lib/server/bidi/third_party/bidiSerializer.js +144 -0
  115. package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
  116. package/lib/server/browser.js +148 -0
  117. package/lib/server/browserContext.js +666 -0
  118. package/lib/server/browserType.js +335 -0
  119. package/lib/server/chromium/appIcon.png +0 -0
  120. package/lib/server/chromium/chromium.js +350 -0
  121. package/lib/server/chromium/chromiumSwitches.js +36 -0
  122. package/lib/server/chromium/crAccessibility.js +237 -0
  123. package/lib/server/chromium/crBrowser.js +522 -0
  124. package/lib/server/chromium/crConnection.js +228 -0
  125. package/lib/server/chromium/crCoverage.js +246 -0
  126. package/lib/server/chromium/crDevTools.js +104 -0
  127. package/lib/server/chromium/crDragDrop.js +143 -0
  128. package/lib/server/chromium/crExecutionContext.js +149 -0
  129. package/lib/server/chromium/crInput.js +171 -0
  130. package/lib/server/chromium/crNetworkManager.js +809 -0
  131. package/lib/server/chromium/crPage.js +1235 -0
  132. package/lib/server/chromium/crPdf.js +153 -0
  133. package/lib/server/chromium/crProtocolHelper.js +133 -0
  134. package/lib/server/chromium/crServiceWorker.js +111 -0
  135. package/lib/server/chromium/defaultFontFamilies.js +145 -0
  136. package/lib/server/chromium/videoRecorder.js +155 -0
  137. package/lib/server/clock.js +133 -0
  138. package/lib/server/codegen/csharp.js +299 -0
  139. package/lib/server/codegen/java.js +235 -0
  140. package/lib/server/codegen/javascript.js +223 -0
  141. package/lib/server/codegen/jsonl.js +47 -0
  142. package/lib/server/codegen/language.js +88 -0
  143. package/lib/server/codegen/languages.js +30 -0
  144. package/lib/server/codegen/python.js +265 -0
  145. package/lib/server/codegen/types.js +5 -0
  146. package/lib/server/console.js +57 -0
  147. package/lib/server/cookieStore.js +185 -0
  148. package/lib/server/debugController.js +234 -0
  149. package/lib/server/debugger.js +132 -0
  150. package/lib/server/deviceDescriptors.js +26 -0
  151. package/lib/server/deviceDescriptorsSource.json +1669 -0
  152. package/lib/server/dialog.js +71 -0
  153. package/lib/server/dispatchers/androidDispatcher.js +193 -0
  154. package/lib/server/dispatchers/artifactDispatcher.js +118 -0
  155. package/lib/server/dispatchers/browserContextDispatcher.js +368 -0
  156. package/lib/server/dispatchers/browserDispatcher.js +170 -0
  157. package/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
  158. package/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
  159. package/lib/server/dispatchers/debugControllerDispatcher.js +103 -0
  160. package/lib/server/dispatchers/dialogDispatcher.js +44 -0
  161. package/lib/server/dispatchers/dispatcher.js +395 -0
  162. package/lib/server/dispatchers/electronDispatcher.js +93 -0
  163. package/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
  164. package/lib/server/dispatchers/frameDispatcher.js +286 -0
  165. package/lib/server/dispatchers/jsHandleDispatcher.js +97 -0
  166. package/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
  167. package/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
  168. package/lib/server/dispatchers/networkDispatchers.js +221 -0
  169. package/lib/server/dispatchers/pageDispatcher.js +367 -0
  170. package/lib/server/dispatchers/playwrightDispatcher.js +107 -0
  171. package/lib/server/dispatchers/selectorsDispatcher.js +36 -0
  172. package/lib/server/dispatchers/streamDispatcher.js +62 -0
  173. package/lib/server/dispatchers/tracingDispatcher.js +54 -0
  174. package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
  175. package/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
  176. package/lib/server/dom.js +845 -0
  177. package/lib/server/download.js +60 -0
  178. package/lib/server/electron/electron.js +296 -0
  179. package/lib/server/electron/loader.js +57 -0
  180. package/lib/server/errors.js +68 -0
  181. package/lib/server/fetch.js +656 -0
  182. package/lib/server/fileChooser.js +42 -0
  183. package/lib/server/fileUploadUtils.js +75 -0
  184. package/lib/server/firefox/ffAccessibility.js +216 -0
  185. package/lib/server/firefox/ffBrowser.js +460 -0
  186. package/lib/server/firefox/ffConnection.js +168 -0
  187. package/lib/server/firefox/ffExecutionContext.js +135 -0
  188. package/lib/server/firefox/ffInput.js +150 -0
  189. package/lib/server/firefox/ffNetworkManager.js +233 -0
  190. package/lib/server/firefox/ffPage.js +559 -0
  191. package/lib/server/firefox/firefox.js +99 -0
  192. package/lib/server/formData.js +75 -0
  193. package/lib/server/frameSelectors.js +171 -0
  194. package/lib/server/frames.js +1808 -0
  195. package/lib/server/har/harRecorder.js +139 -0
  196. package/lib/server/har/harTracer.js +542 -0
  197. package/lib/server/helper.js +103 -0
  198. package/lib/server/index.js +114 -0
  199. package/lib/server/input.js +310 -0
  200. package/lib/server/instrumentation.js +70 -0
  201. package/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
  202. package/lib/server/javascript.js +299 -0
  203. package/lib/server/launchApp.js +91 -0
  204. package/lib/server/macEditingCommands.js +139 -0
  205. package/lib/server/network.js +617 -0
  206. package/lib/server/page.js +819 -0
  207. package/lib/server/pipeTransport.js +85 -0
  208. package/lib/server/playwright.js +88 -0
  209. package/lib/server/progress.js +102 -0
  210. package/lib/server/protocolError.js +49 -0
  211. package/lib/server/recorder/contextRecorder.js +299 -0
  212. package/lib/server/recorder/recorderApp.js +196 -0
  213. package/lib/server/recorder/recorderCollection.js +116 -0
  214. package/lib/server/recorder/recorderFrontend.js +5 -0
  215. package/lib/server/recorder/recorderInTraceViewer.js +144 -0
  216. package/lib/server/recorder/recorderRunner.js +155 -0
  217. package/lib/server/recorder/recorderUtils.js +112 -0
  218. package/lib/server/recorder/throttledFile.js +46 -0
  219. package/lib/server/recorder.js +329 -0
  220. package/lib/server/registry/browserFetcher.js +168 -0
  221. package/lib/server/registry/dependencies.js +322 -0
  222. package/lib/server/registry/index.js +1005 -0
  223. package/lib/server/registry/nativeDeps.js +490 -0
  224. package/lib/server/registry/oopDownloadBrowserMain.js +138 -0
  225. package/lib/server/screenshotter.js +348 -0
  226. package/lib/server/selectors.js +73 -0
  227. package/lib/server/socksClientCertificatesInterceptor.js +340 -0
  228. package/lib/server/socksInterceptor.js +100 -0
  229. package/lib/server/trace/recorder/snapshotter.js +172 -0
  230. package/lib/server/trace/recorder/snapshotterInjected.js +493 -0
  231. package/lib/server/trace/recorder/tracing.js +542 -0
  232. package/lib/server/trace/test/inMemorySnapshotter.js +93 -0
  233. package/lib/server/trace/viewer/traceViewer.js +213 -0
  234. package/lib/server/transport.js +191 -0
  235. package/lib/server/types.js +24 -0
  236. package/lib/server/usKeyboardLayout.js +555 -0
  237. package/lib/server/webkit/webkit.js +87 -0
  238. package/lib/server/webkit/wkAccessibility.js +194 -0
  239. package/lib/server/webkit/wkBrowser.js +329 -0
  240. package/lib/server/webkit/wkConnection.js +173 -0
  241. package/lib/server/webkit/wkExecutionContext.js +143 -0
  242. package/lib/server/webkit/wkInput.js +169 -0
  243. package/lib/server/webkit/wkInterceptableRequest.js +162 -0
  244. package/lib/server/webkit/wkPage.js +1219 -0
  245. package/lib/server/webkit/wkProvisionalPage.js +94 -0
  246. package/lib/server/webkit/wkWorkers.js +104 -0
  247. package/lib/third_party/diff_match_patch.js +2222 -0
  248. package/lib/third_party/pixelmatch.js +255 -0
  249. package/lib/utils/ascii.js +31 -0
  250. package/lib/utils/comparators.js +171 -0
  251. package/lib/utils/crypto.js +174 -0
  252. package/lib/utils/debug.js +46 -0
  253. package/lib/utils/debugLogger.js +91 -0
  254. package/lib/utils/env.js +49 -0
  255. package/lib/utils/eventsHelper.js +38 -0
  256. package/lib/utils/expectUtils.js +33 -0
  257. package/lib/utils/fileUtils.js +205 -0
  258. package/lib/utils/happy-eyeballs.js +194 -0
  259. package/lib/utils/headers.js +52 -0
  260. package/lib/utils/hostPlatform.js +133 -0
  261. package/lib/utils/httpServer.js +237 -0
  262. package/lib/utils/index.js +368 -0
  263. package/lib/utils/isomorphic/cssParser.js +250 -0
  264. package/lib/utils/isomorphic/cssTokenizer.js +979 -0
  265. package/lib/utils/isomorphic/locatorGenerators.js +642 -0
  266. package/lib/utils/isomorphic/locatorParser.js +179 -0
  267. package/lib/utils/isomorphic/locatorUtils.js +62 -0
  268. package/lib/utils/isomorphic/mimeType.js +29 -0
  269. package/lib/utils/isomorphic/recorderUtils.js +195 -0
  270. package/lib/utils/isomorphic/selectorParser.js +397 -0
  271. package/lib/utils/isomorphic/stringUtils.js +139 -0
  272. package/lib/utils/isomorphic/traceUtils.js +39 -0
  273. package/lib/utils/isomorphic/urlMatch.js +120 -0
  274. package/lib/utils/linuxUtils.js +78 -0
  275. package/lib/utils/manualPromise.js +109 -0
  276. package/lib/utils/multimap.js +75 -0
  277. package/lib/utils/network.js +160 -0
  278. package/lib/utils/processLauncher.js +248 -0
  279. package/lib/utils/profiler.js +53 -0
  280. package/lib/utils/rtti.js +44 -0
  281. package/lib/utils/semaphore.js +51 -0
  282. package/lib/utils/spawnAsync.js +45 -0
  283. package/lib/utils/stackTrace.js +121 -0
  284. package/lib/utils/task.js +58 -0
  285. package/lib/utils/time.js +37 -0
  286. package/lib/utils/timeoutRunner.js +66 -0
  287. package/lib/utils/traceUtils.js +44 -0
  288. package/lib/utils/userAgent.js +105 -0
  289. package/lib/utils/wsServer.js +127 -0
  290. package/lib/utils/zipFile.js +75 -0
  291. package/lib/utils/zones.js +62 -0
  292. package/lib/utilsBundle.js +82 -0
  293. package/lib/utilsBundleImpl/index.js +53 -0
  294. package/lib/utilsBundleImpl/xdg-open +1066 -0
  295. package/lib/vite/htmlReport/index.html +66 -0
  296. package/lib/vite/recorder/assets/codeMirrorModule-baozm8ur.js +24 -0
  297. package/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
  298. package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  299. package/lib/vite/recorder/assets/index-2ElAIWFB.js +42 -0
  300. package/lib/vite/recorder/assets/index-BW-aOBcL.css +1 -0
  301. package/lib/vite/recorder/index.html +29 -0
  302. package/lib/vite/recorder/playwright-logo.svg +9 -0
  303. package/lib/vite/traceViewer/assets/codeMirrorModule-Bh1rfd2w.js +24 -0
  304. package/lib/vite/traceViewer/assets/inspectorTab-7GHnKvSD.js +64 -0
  305. package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +1 -0
  306. package/lib/vite/traceViewer/assets/workbench-DPQnTHYP.js +9 -0
  307. package/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +9 -0
  308. package/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +1 -0
  309. package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  310. package/lib/vite/traceViewer/embedded.BlHoW5LY.js +2 -0
  311. package/lib/vite/traceViewer/embedded.html +18 -0
  312. package/lib/vite/traceViewer/embedded.w7WN2u1R.css +1 -0
  313. package/lib/vite/traceViewer/index.CrbWWHbf.css +1 -0
  314. package/lib/vite/traceViewer/index.DaWVfou1.js +2 -0
  315. package/lib/vite/traceViewer/index.html +29 -0
  316. package/lib/vite/traceViewer/inspectorTab.DLjBDrQR.css +1 -0
  317. package/lib/vite/traceViewer/playwright-logo.svg +9 -0
  318. package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
  319. package/lib/vite/traceViewer/recorder.C4zxcvd2.js +2 -0
  320. package/lib/vite/traceViewer/recorder.html +17 -0
  321. package/lib/vite/traceViewer/snapshot.html +21 -0
  322. package/lib/vite/traceViewer/sw.bundle.js +3 -0
  323. package/lib/vite/traceViewer/uiMode.CAYqod-m.css +1 -0
  324. package/lib/vite/traceViewer/uiMode.html +20 -0
  325. package/lib/vite/traceViewer/uiMode.mTXWniJb.js +5 -0
  326. package/lib/vite/traceViewer/workbench.D3JVcA9K.css +1 -0
  327. package/lib/vite/traceViewer/xtermModule.DSXBckUd.css +32 -0
  328. package/lib/zipBundle.js +25 -0
  329. package/lib/zipBundleImpl.js +5 -0
  330. package/package.json +44 -0
  331. package/types/protocol.d.ts +21571 -0
  332. package/types/structs.d.ts +45 -0
  333. package/types/types.d.ts +22519 -0
@@ -0,0 +1,642 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PythonLocatorFactory = exports.JsonlLocatorFactory = exports.JavaScriptLocatorFactory = exports.JavaLocatorFactory = exports.CSharpLocatorFactory = void 0;
7
+ exports.asLocator = asLocator;
8
+ exports.asLocators = asLocators;
9
+ var _stringUtils = require("./stringUtils");
10
+ var _selectorParser = require("./selectorParser");
11
+ /**
12
+ * Copyright (c) Microsoft Corporation.
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
26
+
27
+ function asLocator(lang, selector, isFrameLocator = false) {
28
+ return asLocators(lang, selector, isFrameLocator)[0];
29
+ }
30
+ function asLocators(lang, selector, isFrameLocator = false, maxOutputSize = 20, preferredQuote) {
31
+ try {
32
+ return innerAsLocators(new generators[lang](preferredQuote), (0, _selectorParser.parseSelector)(selector), isFrameLocator, maxOutputSize);
33
+ } catch (e) {
34
+ // Tolerate invalid input.
35
+ return [selector];
36
+ }
37
+ }
38
+ function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize = 20) {
39
+ const parts = [...parsed.parts];
40
+ const tokens = [];
41
+ let nextBase = isFrameLocator ? 'frame-locator' : 'page';
42
+ for (let index = 0; index < parts.length; index++) {
43
+ const part = parts[index];
44
+ const base = nextBase;
45
+ nextBase = 'locator';
46
+ if (part.name === 'nth') {
47
+ if (part.body === '0') tokens.push([factory.generateLocator(base, 'first', ''), factory.generateLocator(base, 'nth', '0')]);else if (part.body === '-1') tokens.push([factory.generateLocator(base, 'last', ''), factory.generateLocator(base, 'nth', '-1')]);else tokens.push([factory.generateLocator(base, 'nth', part.body)]);
48
+ continue;
49
+ }
50
+ if (part.name === 'internal:text') {
51
+ const {
52
+ exact,
53
+ text
54
+ } = detectExact(part.body);
55
+ tokens.push([factory.generateLocator(base, 'text', text, {
56
+ exact
57
+ })]);
58
+ continue;
59
+ }
60
+ if (part.name === 'internal:has-text') {
61
+ const {
62
+ exact,
63
+ text
64
+ } = detectExact(part.body);
65
+ // There is no locator equivalent for strict has-text, leave it as is.
66
+ if (!exact) {
67
+ tokens.push([factory.generateLocator(base, 'has-text', text, {
68
+ exact
69
+ })]);
70
+ continue;
71
+ }
72
+ }
73
+ if (part.name === 'internal:has-not-text') {
74
+ const {
75
+ exact,
76
+ text
77
+ } = detectExact(part.body);
78
+ // There is no locator equivalent for strict has-not-text, leave it as is.
79
+ if (!exact) {
80
+ tokens.push([factory.generateLocator(base, 'has-not-text', text, {
81
+ exact
82
+ })]);
83
+ continue;
84
+ }
85
+ }
86
+ if (part.name === 'internal:has') {
87
+ const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
88
+ tokens.push(inners.map(inner => factory.generateLocator(base, 'has', inner)));
89
+ continue;
90
+ }
91
+ if (part.name === 'internal:has-not') {
92
+ const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
93
+ tokens.push(inners.map(inner => factory.generateLocator(base, 'hasNot', inner)));
94
+ continue;
95
+ }
96
+ if (part.name === 'internal:and') {
97
+ const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
98
+ tokens.push(inners.map(inner => factory.generateLocator(base, 'and', inner)));
99
+ continue;
100
+ }
101
+ if (part.name === 'internal:or') {
102
+ const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
103
+ tokens.push(inners.map(inner => factory.generateLocator(base, 'or', inner)));
104
+ continue;
105
+ }
106
+ if (part.name === 'internal:chain') {
107
+ const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
108
+ tokens.push(inners.map(inner => factory.generateLocator(base, 'chain', inner)));
109
+ continue;
110
+ }
111
+ if (part.name === 'internal:label') {
112
+ const {
113
+ exact,
114
+ text
115
+ } = detectExact(part.body);
116
+ tokens.push([factory.generateLocator(base, 'label', text, {
117
+ exact
118
+ })]);
119
+ continue;
120
+ }
121
+ if (part.name === 'internal:role') {
122
+ const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
123
+ const options = {
124
+ attrs: []
125
+ };
126
+ for (const attr of attrSelector.attributes) {
127
+ if (attr.name === 'name') {
128
+ options.exact = attr.caseSensitive;
129
+ options.name = attr.value;
130
+ } else {
131
+ if (attr.name === 'level' && typeof attr.value === 'string') attr.value = +attr.value;
132
+ options.attrs.push({
133
+ name: attr.name === 'include-hidden' ? 'includeHidden' : attr.name,
134
+ value: attr.value
135
+ });
136
+ }
137
+ }
138
+ tokens.push([factory.generateLocator(base, 'role', attrSelector.name, options)]);
139
+ continue;
140
+ }
141
+ if (part.name === 'internal:testid') {
142
+ const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
143
+ const {
144
+ value
145
+ } = attrSelector.attributes[0];
146
+ tokens.push([factory.generateLocator(base, 'test-id', value)]);
147
+ continue;
148
+ }
149
+ if (part.name === 'internal:attr') {
150
+ const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
151
+ const {
152
+ name,
153
+ value,
154
+ caseSensitive
155
+ } = attrSelector.attributes[0];
156
+ const text = value;
157
+ const exact = !!caseSensitive;
158
+ if (name === 'placeholder') {
159
+ tokens.push([factory.generateLocator(base, 'placeholder', text, {
160
+ exact
161
+ })]);
162
+ continue;
163
+ }
164
+ if (name === 'alt') {
165
+ tokens.push([factory.generateLocator(base, 'alt', text, {
166
+ exact
167
+ })]);
168
+ continue;
169
+ }
170
+ if (name === 'title') {
171
+ tokens.push([factory.generateLocator(base, 'title', text, {
172
+ exact
173
+ })]);
174
+ continue;
175
+ }
176
+ }
177
+ if (part.name === 'internal:control' && part.body === 'enter-frame') {
178
+ tokens.push([factory.generateLocator(base, 'frame', '')]);
179
+ nextBase = 'frame-locator';
180
+ continue;
181
+ }
182
+ let locatorType = 'default';
183
+ const nextPart = parts[index + 1];
184
+ const selectorPart = (0, _selectorParser.stringifySelector)({
185
+ parts: [part]
186
+ });
187
+ const locatorPart = factory.generateLocator(base, locatorType, selectorPart);
188
+ if (locatorType === 'default' && nextPart && ['internal:has-text', 'internal:has-not-text'].includes(nextPart.name)) {
189
+ const {
190
+ exact,
191
+ text
192
+ } = detectExact(nextPart.body);
193
+ // There is no locator equivalent for strict has-text and has-not-text, leave it as is.
194
+ if (!exact) {
195
+ const nextLocatorPart = factory.generateLocator('locator', nextPart.name === 'internal:has-text' ? 'has-text' : 'has-not-text', text, {
196
+ exact
197
+ });
198
+ const options = {};
199
+ if (nextPart.name === 'internal:has-text') options.hasText = text;else options.hasNotText = text;
200
+ const combinedPart = factory.generateLocator(base, 'default', selectorPart, options);
201
+ // Two options:
202
+ // - locator('div').filter({ hasText: 'foo' })
203
+ // - locator('div', { hasText: 'foo' })
204
+ tokens.push([factory.chainLocators([locatorPart, nextLocatorPart]), combinedPart]);
205
+ index++;
206
+ continue;
207
+ }
208
+ }
209
+
210
+ // Selectors can be prefixed with engine name, e.g. xpath=//foo
211
+ let locatorPartWithEngine;
212
+ if (['xpath', 'css'].includes(part.name)) {
213
+ const selectorPart = (0, _selectorParser.stringifySelector)({
214
+ parts: [part]
215
+ }, /* forceEngineName */true);
216
+ locatorPartWithEngine = factory.generateLocator(base, locatorType, selectorPart);
217
+ }
218
+ tokens.push([locatorPart, locatorPartWithEngine].filter(Boolean));
219
+ }
220
+ return combineTokens(factory, tokens, maxOutputSize);
221
+ }
222
+ function combineTokens(factory, tokens, maxOutputSize) {
223
+ const currentTokens = tokens.map(() => '');
224
+ const result = [];
225
+ const visit = index => {
226
+ if (index === tokens.length) {
227
+ result.push(factory.chainLocators(currentTokens));
228
+ return currentTokens.length < maxOutputSize;
229
+ }
230
+ for (const taken of tokens[index]) {
231
+ currentTokens[index] = taken;
232
+ if (!visit(index + 1)) return false;
233
+ }
234
+ return true;
235
+ };
236
+ visit(0);
237
+ return result;
238
+ }
239
+ function detectExact(text) {
240
+ let exact = false;
241
+ const match = text.match(/^\/(.*)\/([igm]*)$/);
242
+ if (match) return {
243
+ text: new RegExp(match[1], match[2])
244
+ };
245
+ if (text.endsWith('"')) {
246
+ text = JSON.parse(text);
247
+ exact = true;
248
+ } else if (text.endsWith('"s')) {
249
+ text = JSON.parse(text.substring(0, text.length - 1));
250
+ exact = true;
251
+ } else if (text.endsWith('"i')) {
252
+ text = JSON.parse(text.substring(0, text.length - 1));
253
+ exact = false;
254
+ }
255
+ return {
256
+ exact,
257
+ text
258
+ };
259
+ }
260
+ class JavaScriptLocatorFactory {
261
+ constructor(preferredQuote) {
262
+ this.preferredQuote = preferredQuote;
263
+ }
264
+ generateLocator(base, kind, body, options = {}) {
265
+ switch (kind) {
266
+ case 'default':
267
+ if (options.hasText !== undefined) return `locator(${this.quote(body)}, { hasText: ${this.toHasText(options.hasText)} })`;
268
+ if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, { hasNotText: ${this.toHasText(options.hasNotText)} })`;
269
+ return `locator(${this.quote(body)})`;
270
+ case 'frame':
271
+ return `contentFrame()`;
272
+ case 'nth':
273
+ return `nth(${body})`;
274
+ case 'first':
275
+ return `first()`;
276
+ case 'last':
277
+ return `last()`;
278
+ case 'role':
279
+ const attrs = [];
280
+ if (isRegExp(options.name)) {
281
+ attrs.push(`name: ${this.regexToSourceString(options.name)}`);
282
+ } else if (typeof options.name === 'string') {
283
+ attrs.push(`name: ${this.quote(options.name)}`);
284
+ if (options.exact) attrs.push(`exact: true`);
285
+ }
286
+ for (const {
287
+ name,
288
+ value
289
+ } of options.attrs) attrs.push(`${name}: ${typeof value === 'string' ? this.quote(value) : value}`);
290
+ const attrString = attrs.length ? `, { ${attrs.join(', ')} }` : '';
291
+ return `getByRole(${this.quote(body)}${attrString})`;
292
+ case 'has-text':
293
+ return `filter({ hasText: ${this.toHasText(body)} })`;
294
+ case 'has-not-text':
295
+ return `filter({ hasNotText: ${this.toHasText(body)} })`;
296
+ case 'has':
297
+ return `filter({ has: ${body} })`;
298
+ case 'hasNot':
299
+ return `filter({ hasNot: ${body} })`;
300
+ case 'and':
301
+ return `and(${body})`;
302
+ case 'or':
303
+ return `or(${body})`;
304
+ case 'chain':
305
+ return `locator(${body})`;
306
+ case 'test-id':
307
+ return `getByTestId(${this.toTestIdValue(body)})`;
308
+ case 'text':
309
+ return this.toCallWithExact('getByText', body, !!options.exact);
310
+ case 'alt':
311
+ return this.toCallWithExact('getByAltText', body, !!options.exact);
312
+ case 'placeholder':
313
+ return this.toCallWithExact('getByPlaceholder', body, !!options.exact);
314
+ case 'label':
315
+ return this.toCallWithExact('getByLabel', body, !!options.exact);
316
+ case 'title':
317
+ return this.toCallWithExact('getByTitle', body, !!options.exact);
318
+ default:
319
+ throw new Error('Unknown selector kind ' + kind);
320
+ }
321
+ }
322
+ chainLocators(locators) {
323
+ return locators.join('.');
324
+ }
325
+ regexToSourceString(re) {
326
+ return (0, _stringUtils.normalizeEscapedRegexQuotes)(String(re));
327
+ }
328
+ toCallWithExact(method, body, exact) {
329
+ if (isRegExp(body)) return `${method}(${this.regexToSourceString(body)})`;
330
+ return exact ? `${method}(${this.quote(body)}, { exact: true })` : `${method}(${this.quote(body)})`;
331
+ }
332
+ toHasText(body) {
333
+ if (isRegExp(body)) return this.regexToSourceString(body);
334
+ return this.quote(body);
335
+ }
336
+ toTestIdValue(value) {
337
+ if (isRegExp(value)) return this.regexToSourceString(value);
338
+ return this.quote(value);
339
+ }
340
+ quote(text) {
341
+ var _this$preferredQuote;
342
+ return (0, _stringUtils.escapeWithQuotes)(text, (_this$preferredQuote = this.preferredQuote) !== null && _this$preferredQuote !== void 0 ? _this$preferredQuote : '\'');
343
+ }
344
+ }
345
+ exports.JavaScriptLocatorFactory = JavaScriptLocatorFactory;
346
+ class PythonLocatorFactory {
347
+ generateLocator(base, kind, body, options = {}) {
348
+ switch (kind) {
349
+ case 'default':
350
+ if (options.hasText !== undefined) return `locator(${this.quote(body)}, has_text=${this.toHasText(options.hasText)})`;
351
+ if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, has_not_text=${this.toHasText(options.hasNotText)})`;
352
+ return `locator(${this.quote(body)})`;
353
+ case 'frame':
354
+ return `content_frame`;
355
+ case 'nth':
356
+ return `nth(${body})`;
357
+ case 'first':
358
+ return `first`;
359
+ case 'last':
360
+ return `last`;
361
+ case 'role':
362
+ const attrs = [];
363
+ if (isRegExp(options.name)) {
364
+ attrs.push(`name=${this.regexToString(options.name)}`);
365
+ } else if (typeof options.name === 'string') {
366
+ attrs.push(`name=${this.quote(options.name)}`);
367
+ if (options.exact) attrs.push(`exact=True`);
368
+ }
369
+ for (const {
370
+ name,
371
+ value
372
+ } of options.attrs) {
373
+ let valueString = typeof value === 'string' ? this.quote(value) : value;
374
+ if (typeof value === 'boolean') valueString = value ? 'True' : 'False';
375
+ attrs.push(`${(0, _stringUtils.toSnakeCase)(name)}=${valueString}`);
376
+ }
377
+ const attrString = attrs.length ? `, ${attrs.join(', ')}` : '';
378
+ return `get_by_role(${this.quote(body)}${attrString})`;
379
+ case 'has-text':
380
+ return `filter(has_text=${this.toHasText(body)})`;
381
+ case 'has-not-text':
382
+ return `filter(has_not_text=${this.toHasText(body)})`;
383
+ case 'has':
384
+ return `filter(has=${body})`;
385
+ case 'hasNot':
386
+ return `filter(has_not=${body})`;
387
+ case 'and':
388
+ return `and_(${body})`;
389
+ case 'or':
390
+ return `or_(${body})`;
391
+ case 'chain':
392
+ return `locator(${body})`;
393
+ case 'test-id':
394
+ return `get_by_test_id(${this.toTestIdValue(body)})`;
395
+ case 'text':
396
+ return this.toCallWithExact('get_by_text', body, !!options.exact);
397
+ case 'alt':
398
+ return this.toCallWithExact('get_by_alt_text', body, !!options.exact);
399
+ case 'placeholder':
400
+ return this.toCallWithExact('get_by_placeholder', body, !!options.exact);
401
+ case 'label':
402
+ return this.toCallWithExact('get_by_label', body, !!options.exact);
403
+ case 'title':
404
+ return this.toCallWithExact('get_by_title', body, !!options.exact);
405
+ default:
406
+ throw new Error('Unknown selector kind ' + kind);
407
+ }
408
+ }
409
+ chainLocators(locators) {
410
+ return locators.join('.');
411
+ }
412
+ regexToString(body) {
413
+ const suffix = body.flags.includes('i') ? ', re.IGNORECASE' : '';
414
+ return `re.compile(r"${(0, _stringUtils.normalizeEscapedRegexQuotes)(body.source).replace(/\\\//, '/').replace(/"/g, '\\"')}"${suffix})`;
415
+ }
416
+ toCallWithExact(method, body, exact) {
417
+ if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
418
+ if (exact) return `${method}(${this.quote(body)}, exact=True)`;
419
+ return `${method}(${this.quote(body)})`;
420
+ }
421
+ toHasText(body) {
422
+ if (isRegExp(body)) return this.regexToString(body);
423
+ return `${this.quote(body)}`;
424
+ }
425
+ toTestIdValue(value) {
426
+ if (isRegExp(value)) return this.regexToString(value);
427
+ return this.quote(value);
428
+ }
429
+ quote(text) {
430
+ return (0, _stringUtils.escapeWithQuotes)(text, '\"');
431
+ }
432
+ }
433
+ exports.PythonLocatorFactory = PythonLocatorFactory;
434
+ class JavaLocatorFactory {
435
+ generateLocator(base, kind, body, options = {}) {
436
+ let clazz;
437
+ switch (base) {
438
+ case 'page':
439
+ clazz = 'Page';
440
+ break;
441
+ case 'frame-locator':
442
+ clazz = 'FrameLocator';
443
+ break;
444
+ case 'locator':
445
+ clazz = 'Locator';
446
+ break;
447
+ }
448
+ switch (kind) {
449
+ case 'default':
450
+ if (options.hasText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasText(${this.toHasText(options.hasText)}))`;
451
+ if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasNotText(${this.toHasText(options.hasNotText)}))`;
452
+ return `locator(${this.quote(body)})`;
453
+ case 'frame':
454
+ return `contentFrame()`;
455
+ case 'nth':
456
+ return `nth(${body})`;
457
+ case 'first':
458
+ return `first()`;
459
+ case 'last':
460
+ return `last()`;
461
+ case 'role':
462
+ const attrs = [];
463
+ if (isRegExp(options.name)) {
464
+ attrs.push(`.setName(${this.regexToString(options.name)})`);
465
+ } else if (typeof options.name === 'string') {
466
+ attrs.push(`.setName(${this.quote(options.name)})`);
467
+ if (options.exact) attrs.push(`.setExact(true)`);
468
+ }
469
+ for (const {
470
+ name,
471
+ value
472
+ } of options.attrs) attrs.push(`.set${(0, _stringUtils.toTitleCase)(name)}(${typeof value === 'string' ? this.quote(value) : value})`);
473
+ const attrString = attrs.length ? `, new ${clazz}.GetByRoleOptions()${attrs.join('')}` : '';
474
+ return `getByRole(AriaRole.${(0, _stringUtils.toSnakeCase)(body).toUpperCase()}${attrString})`;
475
+ case 'has-text':
476
+ return `filter(new ${clazz}.FilterOptions().setHasText(${this.toHasText(body)}))`;
477
+ case 'has-not-text':
478
+ return `filter(new ${clazz}.FilterOptions().setHasNotText(${this.toHasText(body)}))`;
479
+ case 'has':
480
+ return `filter(new ${clazz}.FilterOptions().setHas(${body}))`;
481
+ case 'hasNot':
482
+ return `filter(new ${clazz}.FilterOptions().setHasNot(${body}))`;
483
+ case 'and':
484
+ return `and(${body})`;
485
+ case 'or':
486
+ return `or(${body})`;
487
+ case 'chain':
488
+ return `locator(${body})`;
489
+ case 'test-id':
490
+ return `getByTestId(${this.toTestIdValue(body)})`;
491
+ case 'text':
492
+ return this.toCallWithExact(clazz, 'getByText', body, !!options.exact);
493
+ case 'alt':
494
+ return this.toCallWithExact(clazz, 'getByAltText', body, !!options.exact);
495
+ case 'placeholder':
496
+ return this.toCallWithExact(clazz, 'getByPlaceholder', body, !!options.exact);
497
+ case 'label':
498
+ return this.toCallWithExact(clazz, 'getByLabel', body, !!options.exact);
499
+ case 'title':
500
+ return this.toCallWithExact(clazz, 'getByTitle', body, !!options.exact);
501
+ default:
502
+ throw new Error('Unknown selector kind ' + kind);
503
+ }
504
+ }
505
+ chainLocators(locators) {
506
+ return locators.join('.');
507
+ }
508
+ regexToString(body) {
509
+ const suffix = body.flags.includes('i') ? ', Pattern.CASE_INSENSITIVE' : '';
510
+ return `Pattern.compile(${this.quote((0, _stringUtils.normalizeEscapedRegexQuotes)(body.source))}${suffix})`;
511
+ }
512
+ toCallWithExact(clazz, method, body, exact) {
513
+ if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
514
+ if (exact) return `${method}(${this.quote(body)}, new ${clazz}.${(0, _stringUtils.toTitleCase)(method)}Options().setExact(true))`;
515
+ return `${method}(${this.quote(body)})`;
516
+ }
517
+ toHasText(body) {
518
+ if (isRegExp(body)) return this.regexToString(body);
519
+ return this.quote(body);
520
+ }
521
+ toTestIdValue(value) {
522
+ if (isRegExp(value)) return this.regexToString(value);
523
+ return this.quote(value);
524
+ }
525
+ quote(text) {
526
+ return (0, _stringUtils.escapeWithQuotes)(text, '\"');
527
+ }
528
+ }
529
+ exports.JavaLocatorFactory = JavaLocatorFactory;
530
+ class CSharpLocatorFactory {
531
+ generateLocator(base, kind, body, options = {}) {
532
+ switch (kind) {
533
+ case 'default':
534
+ if (options.hasText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasText(options.hasText)} })`;
535
+ if (options.hasNotText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasNotText(options.hasNotText)} })`;
536
+ return `Locator(${this.quote(body)})`;
537
+ case 'frame':
538
+ return `ContentFrame`;
539
+ case 'nth':
540
+ return `Nth(${body})`;
541
+ case 'first':
542
+ return `First`;
543
+ case 'last':
544
+ return `Last`;
545
+ case 'role':
546
+ const attrs = [];
547
+ if (isRegExp(options.name)) {
548
+ attrs.push(`NameRegex = ${this.regexToString(options.name)}`);
549
+ } else if (typeof options.name === 'string') {
550
+ attrs.push(`Name = ${this.quote(options.name)}`);
551
+ if (options.exact) attrs.push(`Exact = true`);
552
+ }
553
+ for (const {
554
+ name,
555
+ value
556
+ } of options.attrs) attrs.push(`${(0, _stringUtils.toTitleCase)(name)} = ${typeof value === 'string' ? this.quote(value) : value}`);
557
+ const attrString = attrs.length ? `, new() { ${attrs.join(', ')} }` : '';
558
+ return `GetByRole(AriaRole.${(0, _stringUtils.toTitleCase)(body)}${attrString})`;
559
+ case 'has-text':
560
+ return `Filter(new() { ${this.toHasText(body)} })`;
561
+ case 'has-not-text':
562
+ return `Filter(new() { ${this.toHasNotText(body)} })`;
563
+ case 'has':
564
+ return `Filter(new() { Has = ${body} })`;
565
+ case 'hasNot':
566
+ return `Filter(new() { HasNot = ${body} })`;
567
+ case 'and':
568
+ return `And(${body})`;
569
+ case 'or':
570
+ return `Or(${body})`;
571
+ case 'chain':
572
+ return `Locator(${body})`;
573
+ case 'test-id':
574
+ return `GetByTestId(${this.toTestIdValue(body)})`;
575
+ case 'text':
576
+ return this.toCallWithExact('GetByText', body, !!options.exact);
577
+ case 'alt':
578
+ return this.toCallWithExact('GetByAltText', body, !!options.exact);
579
+ case 'placeholder':
580
+ return this.toCallWithExact('GetByPlaceholder', body, !!options.exact);
581
+ case 'label':
582
+ return this.toCallWithExact('GetByLabel', body, !!options.exact);
583
+ case 'title':
584
+ return this.toCallWithExact('GetByTitle', body, !!options.exact);
585
+ default:
586
+ throw new Error('Unknown selector kind ' + kind);
587
+ }
588
+ }
589
+ chainLocators(locators) {
590
+ return locators.join('.');
591
+ }
592
+ regexToString(body) {
593
+ const suffix = body.flags.includes('i') ? ', RegexOptions.IgnoreCase' : '';
594
+ return `new Regex(${this.quote((0, _stringUtils.normalizeEscapedRegexQuotes)(body.source))}${suffix})`;
595
+ }
596
+ toCallWithExact(method, body, exact) {
597
+ if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
598
+ if (exact) return `${method}(${this.quote(body)}, new() { Exact = true })`;
599
+ return `${method}(${this.quote(body)})`;
600
+ }
601
+ toHasText(body) {
602
+ if (isRegExp(body)) return `HasTextRegex = ${this.regexToString(body)}`;
603
+ return `HasText = ${this.quote(body)}`;
604
+ }
605
+ toTestIdValue(value) {
606
+ if (isRegExp(value)) return this.regexToString(value);
607
+ return this.quote(value);
608
+ }
609
+ toHasNotText(body) {
610
+ if (isRegExp(body)) return `HasNotTextRegex = ${this.regexToString(body)}`;
611
+ return `HasNotText = ${this.quote(body)}`;
612
+ }
613
+ quote(text) {
614
+ return (0, _stringUtils.escapeWithQuotes)(text, '\"');
615
+ }
616
+ }
617
+ exports.CSharpLocatorFactory = CSharpLocatorFactory;
618
+ class JsonlLocatorFactory {
619
+ generateLocator(base, kind, body, options = {}) {
620
+ return JSON.stringify({
621
+ kind,
622
+ body,
623
+ options
624
+ });
625
+ }
626
+ chainLocators(locators) {
627
+ const objects = locators.map(l => JSON.parse(l));
628
+ for (let i = 0; i < objects.length - 1; ++i) objects[i].next = objects[i + 1];
629
+ return JSON.stringify(objects[0]);
630
+ }
631
+ }
632
+ exports.JsonlLocatorFactory = JsonlLocatorFactory;
633
+ const generators = {
634
+ javascript: JavaScriptLocatorFactory,
635
+ python: PythonLocatorFactory,
636
+ java: JavaLocatorFactory,
637
+ csharp: CSharpLocatorFactory,
638
+ jsonl: JsonlLocatorFactory
639
+ };
640
+ function isRegExp(obj) {
641
+ return obj instanceof RegExp;
642
+ }