@checkly/playwright-core 1.48.22 → 1.51.11-beta.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 (307) hide show
  1. package/ThirdPartyNotices.txt +60 -48
  2. package/bin/reinstall_chrome_beta_linux.sh +10 -8
  3. package/bin/reinstall_chrome_stable_linux.sh +10 -8
  4. package/bin/reinstall_msedge_beta_linux.sh +17 -9
  5. package/bin/reinstall_msedge_dev_linux.sh +17 -9
  6. package/bin/reinstall_msedge_stable_linux.sh +17 -9
  7. package/browsers.json +33 -12
  8. package/index.js +0 -1
  9. package/lib/androidServerImpl.js +5 -5
  10. package/lib/browserServerImpl.js +18 -9
  11. package/lib/checkly/secretsFilter.js +1 -1
  12. package/lib/cli/driver.js +6 -6
  13. package/lib/cli/program.js +38 -43
  14. package/lib/cli/programWithTestStub.js +2 -1
  15. package/lib/client/android.js +37 -58
  16. package/lib/client/artifact.js +4 -7
  17. package/lib/client/browser.js +10 -15
  18. package/lib/client/browserContext.js +69 -62
  19. package/lib/client/browserType.js +30 -64
  20. package/lib/client/channelOwner.js +53 -68
  21. package/lib/client/clientHelper.js +4 -6
  22. package/lib/client/clientInstrumentation.js +2 -0
  23. package/lib/client/clientStackTrace.js +65 -0
  24. package/lib/client/connection.js +48 -41
  25. package/lib/client/consoleMessage.js +4 -7
  26. package/lib/client/electron.js +10 -10
  27. package/lib/client/elementHandle.js +32 -33
  28. package/lib/client/errors.js +2 -2
  29. package/lib/client/eventEmitter.js +5 -8
  30. package/lib/client/fetch.js +61 -62
  31. package/lib/client/fileUtils.js +31 -0
  32. package/lib/client/frame.js +22 -23
  33. package/lib/client/harRouter.js +7 -9
  34. package/lib/client/jsHandle.js +3 -4
  35. package/lib/client/localUtils.js +24 -0
  36. package/lib/client/locator.js +27 -13
  37. package/lib/client/network.js +44 -37
  38. package/lib/client/page.js +50 -41
  39. package/lib/client/platform.js +71 -0
  40. package/lib/client/playwright.js +21 -1
  41. package/lib/client/selectors.js +8 -2
  42. package/lib/client/stream.js +2 -21
  43. package/lib/client/timeoutSettings.js +65 -0
  44. package/lib/client/tracing.js +29 -7
  45. package/lib/client/video.js +2 -2
  46. package/lib/client/waiter.js +19 -16
  47. package/lib/client/webSocket.js +106 -0
  48. package/lib/client/worker.js +4 -4
  49. package/lib/client/writableStream.js +2 -21
  50. package/lib/generated/consoleApiSource.js +1 -1
  51. package/lib/generated/injectedScriptSource.js +1 -1
  52. package/lib/generated/pollingRecorderSource.js +1 -1
  53. package/lib/generated/recorderSource.js +7 -0
  54. package/lib/generated/webSocketMockSource.js +1 -1
  55. package/lib/inProcessFactory.js +8 -3
  56. package/lib/outofprocess.js +12 -8
  57. package/lib/protocol/debug.js +1 -1
  58. package/lib/protocol/validator.js +77 -11
  59. package/lib/protocol/validatorPrimitives.js +1 -2
  60. package/lib/remote/playwrightConnection.js +21 -12
  61. package/lib/remote/playwrightServer.js +22 -8
  62. package/lib/server/android/android.js +17 -14
  63. package/lib/server/android/backendAdb.js +14 -14
  64. package/lib/server/artifact.js +3 -3
  65. package/lib/server/bidi/bidiBrowser.js +11 -8
  66. package/lib/server/bidi/bidiChromium.js +5 -4
  67. package/lib/server/bidi/bidiConnection.js +1 -3
  68. package/lib/server/bidi/bidiExecutionContext.js +71 -25
  69. package/lib/server/bidi/bidiFirefox.js +4 -3
  70. package/lib/server/bidi/bidiInput.js +11 -12
  71. package/lib/server/bidi/bidiNetworkManager.js +11 -12
  72. package/lib/server/bidi/bidiOverCdp.js +2 -2
  73. package/lib/server/bidi/bidiPage.js +39 -66
  74. package/lib/server/bidi/third_party/bidiKeyboard.js +9 -7
  75. package/lib/server/bidi/third_party/firefoxPrefs.js +19 -3
  76. package/lib/server/browser.js +2 -2
  77. package/lib/server/browserContext.js +60 -55
  78. package/lib/server/browserType.js +22 -18
  79. package/lib/server/callLog.js +79 -0
  80. package/lib/server/chromium/chromium.js +20 -16
  81. package/lib/server/chromium/chromiumSwitches.js +32 -9
  82. package/lib/server/chromium/crBrowser.js +25 -24
  83. package/lib/server/chromium/crConnection.js +2 -2
  84. package/lib/server/chromium/crCoverage.js +1 -1
  85. package/lib/server/chromium/crDevTools.js +1 -1
  86. package/lib/server/chromium/crDragDrop.js +1 -1
  87. package/lib/server/chromium/crExecutionContext.js +26 -35
  88. package/lib/server/chromium/crInput.js +17 -6
  89. package/lib/server/chromium/crNetworkManager.js +3 -3
  90. package/lib/server/chromium/crPage.js +43 -55
  91. package/lib/server/chromium/crPdf.js +1 -1
  92. package/lib/server/chromium/crProtocolHelper.js +3 -3
  93. package/lib/server/chromium/crServiceWorker.js +2 -2
  94. package/lib/server/chromium/videoRecorder.js +2 -2
  95. package/lib/server/clock.js +1 -1
  96. package/lib/server/codegen/csharp.js +21 -16
  97. package/lib/server/codegen/java.js +17 -9
  98. package/lib/server/codegen/javascript.js +37 -7
  99. package/lib/server/codegen/jsonl.js +1 -1
  100. package/lib/server/codegen/languages.js +2 -2
  101. package/lib/server/codegen/python.js +14 -17
  102. package/lib/server/debugController.js +23 -45
  103. package/lib/server/debugger.js +1 -1
  104. package/lib/server/deviceDescriptors.js +1 -1
  105. package/lib/server/deviceDescriptorsSource.json +131 -131
  106. package/lib/server/dispatchers/androidDispatcher.js +14 -3
  107. package/lib/server/dispatchers/artifactDispatcher.js +3 -3
  108. package/lib/server/dispatchers/browserContextDispatcher.js +21 -32
  109. package/lib/server/dispatchers/browserTypeDispatcher.js +1 -1
  110. package/lib/server/dispatchers/cdpSessionDispatcher.js +1 -1
  111. package/lib/server/dispatchers/debugControllerDispatcher.js +5 -3
  112. package/lib/server/dispatchers/dispatcher.js +27 -25
  113. package/lib/server/dispatchers/electronDispatcher.js +3 -3
  114. package/lib/server/dispatchers/elementHandlerDispatcher.js +7 -2
  115. package/lib/server/dispatchers/frameDispatcher.js +9 -3
  116. package/lib/server/dispatchers/jsonPipeDispatcher.js +2 -2
  117. package/lib/server/dispatchers/localUtilsDispatcher.js +25 -291
  118. package/lib/server/dispatchers/networkDispatchers.js +3 -3
  119. package/lib/server/dispatchers/pageDispatcher.js +10 -8
  120. package/lib/server/dispatchers/playwrightDispatcher.js +5 -5
  121. package/lib/server/dispatchers/streamDispatcher.js +4 -3
  122. package/lib/server/dispatchers/tracingDispatcher.js +10 -0
  123. package/lib/server/dispatchers/webSocketRouteDispatcher.js +18 -18
  124. package/lib/server/dispatchers/writableStreamDispatcher.js +5 -6
  125. package/lib/server/dom.js +102 -48
  126. package/lib/server/download.js +1 -1
  127. package/lib/server/electron/electron.js +17 -16
  128. package/lib/server/errors.js +1 -1
  129. package/lib/server/fetch.js +49 -33
  130. package/lib/server/fileUploadUtils.js +7 -4
  131. package/lib/server/firefox/ffBrowser.js +17 -9
  132. package/lib/server/firefox/ffConnection.js +1 -1
  133. package/lib/server/firefox/ffExecutionContext.js +25 -29
  134. package/lib/server/firefox/ffInput.js +15 -4
  135. package/lib/server/firefox/ffNetworkManager.js +3 -3
  136. package/lib/server/firefox/ffPage.js +29 -50
  137. package/lib/server/firefox/firefox.js +7 -9
  138. package/lib/server/frameSelectors.js +1 -1
  139. package/lib/server/frames.js +65 -55
  140. package/lib/server/har/harRecorder.js +4 -4
  141. package/lib/server/har/harTracer.js +8 -9
  142. package/lib/server/harBackend.js +157 -0
  143. package/lib/server/helper.js +2 -2
  144. package/lib/server/index.js +1 -14
  145. package/lib/server/input.js +3 -4
  146. package/lib/server/instrumentation.js +2 -2
  147. package/lib/server/isomorphic/utilityScriptSerializers.js +3 -0
  148. package/lib/server/javascript.js +26 -33
  149. package/lib/server/launchApp.js +7 -7
  150. package/lib/server/localUtils.js +203 -0
  151. package/lib/server/network.js +5 -5
  152. package/lib/server/page.js +76 -37
  153. package/lib/server/pipeTransport.js +1 -1
  154. package/lib/server/playwright.js +5 -5
  155. package/lib/server/progress.js +1 -4
  156. package/lib/server/protocolError.js +1 -1
  157. package/lib/server/recorder/chat.js +177 -0
  158. package/lib/server/recorder/codeGenerator.js +154 -0
  159. package/lib/server/recorder/contextRecorder.js +9 -18
  160. package/lib/server/recorder/csharp.js +311 -0
  161. package/lib/server/recorder/java.js +249 -0
  162. package/lib/server/recorder/javascript.js +230 -0
  163. package/lib/server/recorder/jsonl.js +48 -0
  164. package/lib/server/recorder/language.js +45 -0
  165. package/lib/server/recorder/python.js +276 -0
  166. package/lib/server/recorder/recorderActions.js +6 -0
  167. package/lib/server/recorder/recorderApp.js +25 -28
  168. package/lib/server/recorder/recorderCollection.js +9 -21
  169. package/lib/server/recorder/recorderInTraceViewer.js +1 -1
  170. package/lib/server/recorder/recorderRunner.js +7 -3
  171. package/lib/server/recorder/recorderUtils.js +5 -28
  172. package/lib/server/recorder/throttledFile.js +3 -4
  173. package/lib/server/recorder/utils.js +46 -0
  174. package/lib/server/recorder.js +83 -43
  175. package/lib/server/registry/browserFetcher.js +10 -8
  176. package/lib/server/registry/dependencies.js +20 -20
  177. package/lib/server/registry/index.js +215 -61
  178. package/lib/server/registry/nativeDeps.js +10 -4
  179. package/lib/server/registry/oopDownloadBrowserMain.js +3 -3
  180. package/lib/server/screenshotter.js +1 -1
  181. package/lib/server/selectors.js +3 -3
  182. package/lib/server/socksClientCertificatesInterceptor.js +8 -8
  183. package/lib/server/socksInterceptor.js +8 -5
  184. package/lib/server/storageScript.js +160 -0
  185. package/lib/server/timeoutSettings.js +74 -0
  186. package/lib/server/trace/recorder/snapshotter.js +10 -20
  187. package/lib/server/trace/recorder/snapshotterInjected.js +26 -1
  188. package/lib/server/trace/recorder/tracing.js +108 -45
  189. package/lib/server/trace/test/inMemorySnapshotter.js +6 -6
  190. package/lib/server/trace/viewer/traceViewer.js +21 -7
  191. package/lib/server/transport.js +3 -2
  192. package/lib/server/utils/ascii.js +31 -0
  193. package/lib/server/utils/comparators.js +159 -0
  194. package/lib/server/utils/crypto.js +171 -0
  195. package/lib/server/utils/debug.js +38 -0
  196. package/lib/server/utils/debugLogger.js +93 -0
  197. package/lib/server/utils/env.js +53 -0
  198. package/lib/server/utils/eventsHelper.js +38 -0
  199. package/lib/server/utils/expectUtils.js +33 -0
  200. package/lib/server/utils/fileUtils.js +204 -0
  201. package/lib/server/utils/happyEyeballs.js +207 -0
  202. package/lib/server/utils/hostPlatform.js +145 -0
  203. package/lib/server/utils/httpServer.js +233 -0
  204. package/lib/server/utils/image_tools/colorUtils.js +98 -0
  205. package/lib/server/utils/image_tools/compare.js +108 -0
  206. package/lib/server/utils/image_tools/imageChannel.js +70 -0
  207. package/lib/server/utils/image_tools/stats.js +102 -0
  208. package/lib/server/utils/linuxUtils.js +58 -0
  209. package/lib/server/utils/network.js +160 -0
  210. package/lib/server/utils/nodePlatform.js +140 -0
  211. package/lib/server/utils/pipeTransport.js +82 -0
  212. package/lib/server/utils/processLauncher.js +248 -0
  213. package/lib/server/utils/profiler.js +52 -0
  214. package/lib/server/utils/socksProxy.js +570 -0
  215. package/lib/server/utils/spawnAsync.js +45 -0
  216. package/lib/server/utils/task.js +58 -0
  217. package/lib/server/utils/userAgent.js +91 -0
  218. package/lib/server/utils/wsServer.js +128 -0
  219. package/lib/server/utils/zipFile.js +75 -0
  220. package/lib/server/utils/zones.js +54 -0
  221. package/lib/server/webkit/webkit.js +4 -4
  222. package/lib/server/webkit/wkBrowser.js +10 -10
  223. package/lib/server/webkit/wkConnection.js +1 -1
  224. package/lib/server/webkit/wkExecutionContext.js +26 -30
  225. package/lib/server/webkit/wkInput.js +17 -7
  226. package/lib/server/webkit/wkInterceptableRequest.js +2 -2
  227. package/lib/server/webkit/wkPage.js +80 -66
  228. package/lib/server/webkit/wkProvisionalPage.js +1 -1
  229. package/lib/server/webkit/wkWorkers.js +2 -2
  230. package/lib/utils/fileUtils.js +1 -1
  231. package/lib/utils/glob.js +84 -0
  232. package/lib/utils/isomorphic/ariaSnapshot.js +392 -0
  233. package/lib/utils/isomorphic/assert.js +25 -0
  234. package/lib/utils/isomorphic/colors.js +65 -0
  235. package/lib/utils/isomorphic/cssParser.js +5 -5
  236. package/lib/utils/isomorphic/headers.js +52 -0
  237. package/lib/utils/isomorphic/locatorGenerators.js +38 -8
  238. package/lib/utils/isomorphic/locatorParser.js +19 -13
  239. package/lib/utils/isomorphic/manualPromise.js +107 -0
  240. package/lib/utils/isomorphic/mimeType.js +11 -3
  241. package/lib/utils/isomorphic/multimap.js +73 -0
  242. package/lib/utils/isomorphic/rtti.js +41 -0
  243. package/lib/utils/isomorphic/semaphore.js +51 -0
  244. package/lib/utils/isomorphic/stackTrace.js +169 -0
  245. package/lib/utils/isomorphic/stringUtils.js +31 -1
  246. package/lib/utils/isomorphic/time.js +25 -0
  247. package/lib/utils/isomorphic/timeoutRunner.js +66 -0
  248. package/lib/utils/isomorphic/traceUtils.js +23 -0
  249. package/lib/utils/isomorphic/types.js +5 -0
  250. package/lib/utils/isomorphic/urlMatch.js +7 -5
  251. package/lib/utils/mimeType.js +30 -0
  252. package/lib/utils/stackTrace.js +1 -1
  253. package/lib/utils.js +447 -0
  254. package/lib/utilsBundle.js +4 -29
  255. package/lib/utilsBundleImpl/index.js +188 -33
  256. package/lib/vite/htmlReport/index.html +20 -17
  257. package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +24 -0
  258. package/lib/vite/recorder/assets/index-ELPgmkwA.js +184 -0
  259. package/lib/vite/recorder/assets/{index-BW-aOBcL.css → index-eHBmevrY.css} +1 -1
  260. package/lib/vite/recorder/index.html +2 -2
  261. package/lib/vite/traceViewer/assets/codeMirrorModule-gU1OOCQO.js +24 -0
  262. package/lib/vite/traceViewer/assets/defaultSettingsView-B5n_FjMx.js +1 -0
  263. package/lib/vite/traceViewer/assets/inspectorTab-6Tru8Mn_.js +235 -0
  264. package/lib/vite/traceViewer/assets/workbench-B_Nj4NA2.js +25 -0
  265. package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-BoAIEibi.js} +7 -7
  266. package/lib/vite/traceViewer/defaultSettingsView.CO3FR0CX.css +1 -0
  267. package/lib/vite/traceViewer/{embedded.BkvOrz5Z.js → embedded.DpNPH6mk.js} +2 -2
  268. package/lib/vite/traceViewer/embedded.html +6 -6
  269. package/lib/vite/traceViewer/index.CuE3SYGw.js +2 -0
  270. package/lib/vite/traceViewer/index.html +27 -9
  271. package/lib/vite/traceViewer/inspectorTab.CXDulcFG.css +1 -0
  272. package/lib/vite/traceViewer/{recorder.DNMfnSiu.js → recorder.BD-uZJs7.js} +2 -2
  273. package/lib/vite/traceViewer/recorder.html +4 -4
  274. package/lib/vite/traceViewer/sw.bundle.js +7888 -3
  275. package/lib/vite/traceViewer/{uiMode.CAYqod-m.css → uiMode.BatfzHMG.css} +1 -1
  276. package/lib/vite/traceViewer/uiMode.DHrNgddz.js +5 -0
  277. package/lib/vite/traceViewer/uiMode.html +8 -7
  278. package/lib/vite/traceViewer/workbench.B9vIAzH9.css +1 -0
  279. package/lib/zipBundleImpl.js +4 -4
  280. package/package.json +7 -7
  281. package/types/protocol.d.ts +820 -153
  282. package/types/types.d.ts +285 -82
  283. package/bin/PrintDeps.exe +0 -0
  284. package/bin/README.md +0 -2
  285. package/lib/vite/recorder/assets/codeMirrorModule-d0KhC1qL.js +0 -24
  286. package/lib/vite/recorder/assets/index-Bxxcmxlu.js +0 -42
  287. package/lib/vite/traceViewer/assets/codeMirrorModule-pBPtArIT.js +0 -24
  288. package/lib/vite/traceViewer/assets/codeMirrorModule-tzBrK1V4.js +0 -24
  289. package/lib/vite/traceViewer/assets/inspectorTab-BuJ3wAX_.js +0 -64
  290. package/lib/vite/traceViewer/assets/inspectorTab-Soeeuvzv.js +0 -64
  291. package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
  292. package/lib/vite/traceViewer/assets/workbench-DdmJ9AJV.js +0 -9
  293. package/lib/vite/traceViewer/assets/workbench-lypYlf00.js +0 -9
  294. package/lib/vite/traceViewer/embedded.DInvAijy.js +0 -2
  295. package/lib/vite/traceViewer/index.Dha3cgqs.js +0 -2
  296. package/lib/vite/traceViewer/index._Iolt-uE.js +0 -2
  297. package/lib/vite/traceViewer/inspectorTab.DLjBDrQR.css +0 -1
  298. package/lib/vite/traceViewer/recorder.DTSaNaly.js +0 -2
  299. package/lib/vite/traceViewer/uiMode.BM7yhjzl.js +0 -5
  300. package/lib/vite/traceViewer/uiMode.Cr1tvTWS.js +0 -5
  301. package/lib/vite/traceViewer/workbench.DlsCx8k5.css +0 -1
  302. /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
  303. /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
  304. /package/lib/vite/traceViewer/{embedded.w7WN2u1R.css → embedded.mLhjB5IF.css} +0 -0
  305. /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
  306. /package/lib/vite/traceViewer/{recorder.B_SY1GJM.css → recorder.tn0RQdqM.css} +0 -0
  307. /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.captureRawStack = captureRawStack;
7
+ exports.parseErrorStack = parseErrorStack;
8
+ exports.parseStackFrame = parseStackFrame;
9
+ exports.rewriteErrorMessage = rewriteErrorMessage;
10
+ exports.splitErrorMessage = splitErrorMessage;
11
+ exports.stringifyStackFrames = stringifyStackFrames;
12
+ /**
13
+ * The MIT License (MIT)
14
+ * Modifications copyright (c) Microsoft Corporation.
15
+ *
16
+ * Copyright (c) 2016-2023 Isaac Z. Schlueter i@izs.me, James Talmage james@talmage.io (github.com/jamestalmage), and
17
+ * Contributors
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
20
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
21
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
22
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
25
+ * Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
28
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
29
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
30
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
+ */
32
+
33
+ function captureRawStack() {
34
+ const stackTraceLimit = Error.stackTraceLimit;
35
+ Error.stackTraceLimit = 50;
36
+ const error = new Error();
37
+ const stack = error.stack || '';
38
+ Error.stackTraceLimit = stackTraceLimit;
39
+ return stack.split('\n');
40
+ }
41
+ function parseStackFrame(text, pathSeparator, showInternalStackFrames) {
42
+ const match = text && text.match(re);
43
+ if (!match) return null;
44
+ let fname = match[2];
45
+ let file = match[7];
46
+ if (!file) return null;
47
+ if (!showInternalStackFrames && (file.startsWith('internal') || file.startsWith('node:'))) return null;
48
+ const line = match[8];
49
+ const column = match[9];
50
+ const closeParen = match[11] === ')';
51
+ const frame = {
52
+ file: '',
53
+ line: 0,
54
+ column: 0
55
+ };
56
+ if (line) frame.line = Number(line);
57
+ if (column) frame.column = Number(column);
58
+ if (closeParen && file) {
59
+ // make sure parens are balanced
60
+ // if we have a file like "asdf) [as foo] (xyz.js", then odds are
61
+ // that the fname should be += " (asdf) [as foo]" and the file
62
+ // should be just "xyz.js"
63
+ // walk backwards from the end to find the last unbalanced (
64
+ let closes = 0;
65
+ for (let i = file.length - 1; i > 0; i--) {
66
+ if (file.charAt(i) === ')') {
67
+ closes++;
68
+ } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
69
+ closes--;
70
+ if (closes === -1 && file.charAt(i - 1) === ' ') {
71
+ const before = file.slice(0, i - 1);
72
+ const after = file.slice(i + 1);
73
+ file = after;
74
+ fname += ` (${before}`;
75
+ break;
76
+ }
77
+ }
78
+ }
79
+ }
80
+ if (fname) {
81
+ const methodMatch = fname.match(methodRe);
82
+ if (methodMatch) fname = methodMatch[1];
83
+ }
84
+ if (file) {
85
+ if (file.startsWith('file://')) file = fileURLToPath(file, pathSeparator);
86
+ frame.file = file;
87
+ }
88
+ if (fname) frame.function = fname;
89
+ return frame;
90
+ }
91
+ function rewriteErrorMessage(e, newMessage) {
92
+ var _e$stack;
93
+ const lines = (((_e$stack = e.stack) === null || _e$stack === void 0 ? void 0 : _e$stack.split('\n')) || []).filter(l => l.startsWith(' at '));
94
+ e.message = newMessage;
95
+ const errorTitle = `${e.name}: ${e.message}`;
96
+ if (lines.length) e.stack = `${errorTitle}\n${lines.join('\n')}`;
97
+ return e;
98
+ }
99
+ function stringifyStackFrames(frames) {
100
+ const stackLines = [];
101
+ for (const frame of frames) {
102
+ if (frame.function) stackLines.push(` at ${frame.function} (${frame.file}:${frame.line}:${frame.column})`);else stackLines.push(` at ${frame.file}:${frame.line}:${frame.column}`);
103
+ }
104
+ return stackLines;
105
+ }
106
+ function splitErrorMessage(message) {
107
+ const separationIdx = message.indexOf(':');
108
+ return {
109
+ name: separationIdx !== -1 ? message.slice(0, separationIdx) : '',
110
+ message: separationIdx !== -1 && separationIdx + 2 <= message.length ? message.substring(separationIdx + 2) : message
111
+ };
112
+ }
113
+ function parseErrorStack(stack, pathSeparator, showInternalStackFrames = false) {
114
+ const lines = stack.split('\n');
115
+ let firstStackLine = lines.findIndex(line => line.startsWith(' at '));
116
+ if (firstStackLine === -1) firstStackLine = lines.length;
117
+ const message = lines.slice(0, firstStackLine).join('\n');
118
+ const stackLines = lines.slice(firstStackLine);
119
+ let location;
120
+ for (const line of stackLines) {
121
+ const frame = parseStackFrame(line, pathSeparator, showInternalStackFrames);
122
+ if (!frame || !frame.file) continue;
123
+ if (belongsToNodeModules(frame.file, pathSeparator)) continue;
124
+ location = {
125
+ file: frame.file,
126
+ column: frame.column || 0,
127
+ line: frame.line || 0
128
+ };
129
+ break;
130
+ }
131
+ return {
132
+ message,
133
+ stackLines,
134
+ location
135
+ };
136
+ }
137
+ function belongsToNodeModules(file, pathSeparator) {
138
+ return file.includes(`${pathSeparator}node_modules${pathSeparator}`);
139
+ }
140
+ const re = new RegExp('^' +
141
+ // Sometimes we strip out the ' at' because it's noisy
142
+ '(?:\\s*at )?' +
143
+ // $1 = ctor if 'new'
144
+ '(?:(new) )?' +
145
+ // $2 = function name (can be literally anything)
146
+ // May contain method at the end as [as xyz]
147
+ '(?:(.*?) \\()?' +
148
+ // (eval at <anonymous> (file.js:1:1),
149
+ // $3 = eval origin
150
+ // $4:$5:$6 are eval file/line/col, but not normally reported
151
+ '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' +
152
+ // file:line:col
153
+ // $7:$8:$9
154
+ // $10 = 'native' if native
155
+ '(?:(.+?):(\\d+):(\\d+)|(native))' +
156
+ // maybe close the paren, then end
157
+ // if $11 is ), then we only allow balanced parens in the filename
158
+ // any imbalance is placed on the fname. This is a heuristic, and
159
+ // bound to be incorrect in some edge cases. The bet is that
160
+ // having weird characters in method names is more common than
161
+ // having weird characters in filenames, which seems reasonable.
162
+ '(\\)?)$');
163
+ const methodRe = /^(.*?) \[as (.*?)\]$/;
164
+ function fileURLToPath(fileUrl, pathSeparator) {
165
+ if (!fileUrl.startsWith('file://')) return fileUrl;
166
+ let path = decodeURIComponent(fileUrl.slice(7));
167
+ if (path.startsWith('/') && /^[a-zA-Z]:/.test(path.slice(1))) path = path.slice(1);
168
+ return path.replace(/\//g, pathSeparator);
169
+ }
@@ -10,8 +10,10 @@ exports.escapeForTextSelector = escapeForTextSelector;
10
10
  exports.escapeHTML = escapeHTML;
11
11
  exports.escapeHTMLAttribute = escapeHTMLAttribute;
12
12
  exports.escapeRegExp = escapeRegExp;
13
+ exports.escapeTemplateString = escapeTemplateString;
13
14
  exports.escapeWithQuotes = escapeWithQuotes;
14
15
  exports.isString = isString;
16
+ exports.longestCommonSubstring = longestCommonSubstring;
15
17
  exports.normalizeEscapedRegexQuotes = normalizeEscapedRegexQuotes;
16
18
  exports.normalizeWhiteSpace = normalizeWhiteSpace;
17
19
  exports.quoteCSSAttributeValue = quoteCSSAttributeValue;
@@ -44,6 +46,9 @@ function escapeWithQuotes(text, char = '\'') {
44
46
  if (char === '`') return char + escapedText.replace(/[`]/g, '`') + char;
45
47
  throw new Error('Invalid escape char');
46
48
  }
49
+ function escapeTemplateString(text) {
50
+ return text.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
51
+ }
47
52
  function isString(obj) {
48
53
  return typeof obj === 'string' || obj instanceof String;
49
54
  }
@@ -80,7 +85,7 @@ function normalizeWhiteSpace(text) {
80
85
  let result = (_normalizedWhitespace = normalizedWhitespaceCache) === null || _normalizedWhitespace === void 0 ? void 0 : _normalizedWhitespace.get(text);
81
86
  if (result === undefined) {
82
87
  var _normalizedWhitespace2;
83
- result = text.replace(/\u200b/g, '').trim().replace(/\s+/g, ' ');
88
+ result = text.replace(/[\u200b\u00ad]/g, '').trim().replace(/\s+/g, ' ');
84
89
  (_normalizedWhitespace2 = normalizedWhitespaceCache) === null || _normalizedWhitespace2 === void 0 || _normalizedWhitespace2.set(text, result);
85
90
  }
86
91
  return result;
@@ -136,4 +141,29 @@ function escapeHTMLAttribute(s) {
136
141
  }
137
142
  function escapeHTML(s) {
138
143
  return s.replace(/[&<]/ug, char => escaped[char]);
144
+ }
145
+ function longestCommonSubstring(s1, s2) {
146
+ const n = s1.length;
147
+ const m = s2.length;
148
+ let maxLen = 0;
149
+ let endingIndex = 0;
150
+
151
+ // Initialize a 2D array with zeros
152
+ const dp = Array(n + 1).fill(null).map(() => Array(m + 1).fill(0));
153
+
154
+ // Build the dp table
155
+ for (let i = 1; i <= n; i++) {
156
+ for (let j = 1; j <= m; j++) {
157
+ if (s1[i - 1] === s2[j - 1]) {
158
+ dp[i][j] = dp[i - 1][j - 1] + 1;
159
+ if (dp[i][j] > maxLen) {
160
+ maxLen = dp[i][j];
161
+ endingIndex = i;
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ // Extract the longest common substring
168
+ return s1.slice(endingIndex - maxLen, endingIndex);
139
169
  }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.monotonicTime = monotonicTime;
7
+ /**
8
+ * Copyright (c) Microsoft Corporation.
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+
23
+ function monotonicTime() {
24
+ return Math.floor(performance.now() * 1000) / 1000;
25
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pollAgainstDeadline = pollAgainstDeadline;
7
+ exports.raceAgainstDeadline = raceAgainstDeadline;
8
+ var _time = require("./time");
9
+ /**
10
+ * Copyright (c) Microsoft Corporation.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+
25
+ async function raceAgainstDeadline(cb, deadline) {
26
+ let timer;
27
+ return Promise.race([cb().then(result => {
28
+ return {
29
+ result,
30
+ timedOut: false
31
+ };
32
+ }), new Promise(resolve => {
33
+ const kMaxDeadline = 2147483647; // 2^31-1
34
+ const timeout = (deadline || kMaxDeadline) - (0, _time.monotonicTime)();
35
+ timer = setTimeout(() => resolve({
36
+ timedOut: true
37
+ }), timeout);
38
+ })]).finally(() => {
39
+ clearTimeout(timer);
40
+ });
41
+ }
42
+ async function pollAgainstDeadline(callback, deadline, pollIntervals = [100, 250, 500, 1000]) {
43
+ var _pollIntervals$pop;
44
+ const lastPollInterval = (_pollIntervals$pop = pollIntervals.pop()) !== null && _pollIntervals$pop !== void 0 ? _pollIntervals$pop : 1000;
45
+ let lastResult;
46
+ const wrappedCallback = () => Promise.resolve().then(callback);
47
+ while (true) {
48
+ var _shift;
49
+ const time = (0, _time.monotonicTime)();
50
+ if (deadline && time >= deadline) break;
51
+ const received = await raceAgainstDeadline(wrappedCallback, deadline);
52
+ if (received.timedOut) break;
53
+ lastResult = received.result.result;
54
+ if (!received.result.continuePolling) return {
55
+ result: lastResult,
56
+ timedOut: false
57
+ };
58
+ const interval = (_shift = pollIntervals.shift()) !== null && _shift !== void 0 ? _shift : lastPollInterval;
59
+ if (deadline && deadline <= (0, _time.monotonicTime)() + interval) break;
60
+ await new Promise(x => setTimeout(x, interval));
61
+ }
62
+ return {
63
+ timedOut: true,
64
+ result: lastResult
65
+ };
66
+ }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.parseClientSideCallMetadata = parseClientSideCallMetadata;
7
+ exports.serializeClientSideCallMetadata = serializeClientSideCallMetadata;
7
8
  /**
8
9
  * Copyright (c) Microsoft Corporation.
9
10
  *
@@ -36,4 +37,26 @@ function parseClientSideCallMetadata(data) {
36
37
  })));
37
38
  }
38
39
  return result;
40
+ }
41
+ function serializeClientSideCallMetadata(metadatas) {
42
+ const fileNames = new Map();
43
+ const stacks = [];
44
+ for (const m of metadatas) {
45
+ if (!m.stack || !m.stack.length) continue;
46
+ const stack = [];
47
+ for (const frame of m.stack) {
48
+ let ordinal = fileNames.get(frame.file);
49
+ if (typeof ordinal !== 'number') {
50
+ ordinal = fileNames.size;
51
+ fileNames.set(frame.file, ordinal);
52
+ }
53
+ const stackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ''];
54
+ stack.push(stackFrame);
55
+ }
56
+ stacks.push([m.id, stack]);
57
+ }
58
+ return {
59
+ files: [...fileNames.keys()],
60
+ stacks
61
+ };
39
62
  }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -94,17 +94,19 @@ function urlMatchesEqual(match1, match2) {
94
94
  }
95
95
  function urlMatches(baseURL, urlString, match) {
96
96
  if (match === undefined || match === '') return true;
97
- if ((0, _stringUtils.isString)(match) && !match.startsWith('*')) match = constructURLBasedOnBaseURL(baseURL, match);
97
+ if ((0, _stringUtils.isString)(match) && !match.startsWith('*')) {
98
+ // Allow http(s) baseURL to match ws(s) urls.
99
+ if (baseURL && /^https?:\/\//.test(baseURL) && /^wss?:\/\//.test(urlString)) baseURL = baseURL.replace(/^http/, 'ws');
100
+ match = constructURLBasedOnBaseURL(baseURL, match);
101
+ }
98
102
  if ((0, _stringUtils.isString)(match)) match = globToRegex(match);
99
103
  if (isRegExp(match)) return match.test(urlString);
100
- if (typeof match === 'string' && match === urlString) return true;
101
- const url = parsedURL(urlString);
104
+ const url = parseURL(urlString);
102
105
  if (!url) return false;
103
- if (typeof match === 'string') return url.pathname === match;
104
106
  if (typeof match !== 'function') throw new Error('url parameter should be string, RegExp or function');
105
107
  return match(url);
106
108
  }
107
- function parsedURL(url) {
109
+ function parseURL(url) {
108
110
  try {
109
111
  return new URL(url);
110
112
  } catch (e) {
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isJsonMimeType = isJsonMimeType;
7
+ exports.isTextualMimeType = isTextualMimeType;
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
+
24
+ function isJsonMimeType(mimeType) {
25
+ return !!mimeType.match(/^(application\/json|application\/.*?\+json|text\/(x-)?json)(;\s*charset=.*)?$/);
26
+ }
27
+ function isTextualMimeType(mimeType) {
28
+ return !!mimeType.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/);
29
+ }
30
+ //# sourceMappingURL=mimeType.js.map
@@ -14,7 +14,7 @@ exports.stringifyStackFrames = stringifyStackFrames;
14
14
  var _path = _interopRequireDefault(require("path"));
15
15
  var _utilsBundle = require("../utilsBundle");
16
16
  var _ = require("./");
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  /**
19
19
  * Copyright (c) Microsoft Corporation.
20
20
  *