rebrowser-playwright-core 1.47.100 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +1 -1
  2. package/ThirdPartyNotices.txt +70 -384
  3. package/bin/reinstall_chrome_beta_linux.sh +10 -8
  4. package/bin/reinstall_chrome_stable_linux.sh +10 -8
  5. package/bin/reinstall_msedge_beta_linux.sh +11 -9
  6. package/bin/reinstall_msedge_dev_linux.sh +11 -9
  7. package/bin/reinstall_msedge_stable_linux.sh +11 -9
  8. package/browsers.json +24 -12
  9. package/lib/cli/program.js +49 -19
  10. package/lib/client/api.js +6 -0
  11. package/lib/client/browserContext.js +20 -2
  12. package/lib/client/channelOwner.js +6 -2
  13. package/lib/client/connection.js +3 -0
  14. package/lib/client/fetch.js +16 -21
  15. package/lib/client/jsHandle.js +0 -8
  16. package/lib/client/localUtils.js +1 -0
  17. package/lib/client/locator.js +7 -0
  18. package/lib/client/network.js +180 -17
  19. package/lib/client/page.js +25 -2
  20. package/lib/client/playwright.js +6 -3
  21. package/lib/client/tracing.js +29 -20
  22. package/lib/client/waiter.js +15 -11
  23. package/lib/generated/consoleApiSource.js +1 -1
  24. package/lib/generated/injectedScriptSource.js +1 -1
  25. package/lib/generated/pollingRecorderSource.js +7 -0
  26. package/lib/generated/webSocketMockSource.js +7 -0
  27. package/lib/protocol/validator.js +103 -17
  28. package/lib/server/ariaSnapshot.js +33 -0
  29. package/lib/server/bidi/bidiBrowser.js +23 -8
  30. package/lib/server/bidi/bidiChromium.js +124 -0
  31. package/lib/server/bidi/bidiConnection.js +1 -3
  32. package/lib/server/bidi/bidiExecutionContext.js +0 -6
  33. package/lib/server/bidi/bidiFirefox.js +15 -21
  34. package/lib/server/bidi/bidiInput.js +16 -32
  35. package/lib/server/bidi/bidiNetworkManager.js +39 -5
  36. package/lib/server/bidi/bidiOverCdp.js +103 -0
  37. package/lib/server/bidi/bidiPage.js +98 -25
  38. package/lib/server/bidi/bidiPdf.js +140 -0
  39. package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
  40. package/lib/server/browser.js +13 -2
  41. package/lib/server/browserContext.js +6 -23
  42. package/lib/server/browserType.js +43 -12
  43. package/lib/server/chromium/chromium.js +9 -17
  44. package/lib/server/chromium/chromiumSwitches.js +3 -1
  45. package/lib/server/chromium/crBrowser.js +4 -3
  46. package/lib/server/chromium/crConnection.js +153 -0
  47. package/lib/server/chromium/crExecutionContext.js +0 -20
  48. package/lib/server/chromium/crPage.js +13 -7
  49. package/lib/server/chromium/videoRecorder.js +1 -1
  50. package/lib/server/codegen/csharp.js +12 -17
  51. package/lib/server/codegen/java.js +5 -8
  52. package/lib/server/codegen/javascript.js +29 -7
  53. package/lib/server/codegen/language.js +14 -2
  54. package/lib/server/codegen/python.js +13 -17
  55. package/lib/server/cookieStore.js +73 -0
  56. package/lib/server/debugController.js +10 -7
  57. package/lib/server/deviceDescriptorsSource.json +127 -127
  58. package/lib/server/dialog.js +1 -0
  59. package/lib/server/dispatchers/androidDispatcher.js +13 -2
  60. package/lib/server/dispatchers/browserContextDispatcher.js +19 -2
  61. package/lib/server/dispatchers/debugControllerDispatcher.js +1 -1
  62. package/lib/server/dispatchers/dispatcher.js +1 -1
  63. package/lib/server/dispatchers/frameDispatcher.js +8 -1
  64. package/lib/server/dispatchers/jsHandleDispatcher.js +0 -5
  65. package/lib/server/dispatchers/pageDispatcher.js +9 -0
  66. package/lib/server/dispatchers/playwrightDispatcher.js +2 -1
  67. package/lib/server/dispatchers/tracingDispatcher.js +10 -0
  68. package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
  69. package/lib/server/dom.js +79 -36
  70. package/lib/server/download.js +9 -2
  71. package/lib/server/fetch.js +105 -96
  72. package/lib/server/firefox/ffBrowser.js +6 -4
  73. package/lib/server/firefox/ffExecutionContext.js +0 -15
  74. package/lib/server/firefox/ffNetworkManager.js +1 -1
  75. package/lib/server/firefox/ffPage.js +6 -3
  76. package/lib/server/firefox/firefox.js +2 -13
  77. package/lib/server/frameSelectors.js +1 -1
  78. package/lib/server/frames.js +68 -67
  79. package/lib/server/har/harTracer.js +11 -0
  80. package/lib/server/index.js +0 -6
  81. package/lib/server/input.js +0 -1
  82. package/lib/server/javascript.js +0 -13
  83. package/lib/server/page.js +53 -9
  84. package/lib/server/playwright.js +5 -2
  85. package/lib/server/progress.js +0 -3
  86. package/lib/server/recorder/contextRecorder.js +33 -50
  87. package/lib/server/recorder/recorderApp.js +22 -25
  88. package/lib/server/recorder/recorderCollection.js +68 -79
  89. package/lib/server/recorder/recorderInTraceViewer.js +144 -0
  90. package/lib/server/recorder/recorderRunner.js +75 -97
  91. package/lib/server/recorder/recorderUtils.js +48 -6
  92. package/lib/server/recorder.js +87 -47
  93. package/lib/server/registry/index.js +154 -26
  94. package/lib/server/registry/nativeDeps.js +6 -3
  95. package/lib/server/socksClientCertificatesInterceptor.js +15 -3
  96. package/lib/server/trace/recorder/snapshotter.js +2 -12
  97. package/lib/server/trace/recorder/snapshotterInjected.js +21 -3
  98. package/lib/server/trace/recorder/tracing.js +127 -17
  99. package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
  100. package/lib/server/trace/viewer/traceViewer.js +4 -6
  101. package/lib/server/webkit/webkit.js +1 -1
  102. package/lib/server/webkit/wkBrowser.js +8 -7
  103. package/lib/server/webkit/wkExecutionContext.js +0 -16
  104. package/lib/server/webkit/wkPage.js +11 -4
  105. package/lib/utils/comparators.js +12 -30
  106. package/lib/utils/crypto.js +1 -4
  107. package/lib/utils/happy-eyeballs.js +13 -0
  108. package/lib/utils/hostPlatform.js +8 -2
  109. package/lib/utils/httpServer.js +1 -0
  110. package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
  111. package/lib/utils/isomorphic/locatorGenerators.js +30 -21
  112. package/lib/utils/isomorphic/locatorParser.js +2 -2
  113. package/lib/utils/isomorphic/recorderUtils.js +227 -0
  114. package/lib/utils/isomorphic/stringUtils.js +30 -0
  115. package/lib/utils/isomorphic/urlMatch.js +5 -1
  116. package/lib/utils/network.js +1 -1
  117. package/lib/utils/sequence.js +64 -0
  118. package/lib/utils/stackTrace.js +16 -3
  119. package/lib/utils/zones.js +32 -23
  120. package/lib/utilsBundle.js +4 -5
  121. package/lib/utilsBundleImpl/index.js +190 -33
  122. package/lib/vite/htmlReport/index.html +19 -16
  123. package/lib/vite/recorder/assets/codeMirrorModule-AFvV6hAs.js +24 -0
  124. package/lib/vite/recorder/assets/index-_cTWgVuJ.js +184 -0
  125. package/lib/vite/recorder/assets/{index-B-MT5gKo.css → index-iA1aAGZg.css} +1 -1
  126. package/lib/vite/recorder/index.html +2 -2
  127. package/lib/vite/traceViewer/assets/codeMirrorModule-KatbITLF.js +24 -0
  128. package/lib/vite/traceViewer/assets/inspectorTab-DdpLd2bb.js +68 -0
  129. package/lib/vite/traceViewer/assets/workbench-CdYbzWFD.js +9 -0
  130. package/lib/vite/traceViewer/embedded.6m3UZh7r.js +2 -0
  131. package/lib/vite/traceViewer/embedded.html +5 -3
  132. package/lib/vite/traceViewer/index.WUV-8boJ.js +2 -0
  133. package/lib/vite/traceViewer/index.html +24 -5
  134. package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +1 -0
  135. package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
  136. package/lib/vite/traceViewer/recorder.OT2tVHgn.js +2 -0
  137. package/lib/vite/traceViewer/recorder.html +17 -0
  138. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  139. package/lib/vite/traceViewer/uiMode.BZBTyvGn.js +5 -0
  140. package/lib/vite/traceViewer/uiMode.html +6 -4
  141. package/lib/vite/traceViewer/{uiMode.D3cNFP6u.css → uiMode.voC1ZiOQ.css} +1 -1
  142. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
  143. package/package.json +1 -1
  144. package/types/protocol.d.ts +135 -16
  145. package/types/types.d.ts +2149 -965
  146. package/lib/generated/recorderSource.js +0 -7
  147. package/lib/third_party/diff_match_patch.js +0 -2222
  148. package/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +0 -24
  149. package/lib/vite/recorder/assets/index-DCpXOVIh.js +0 -47
  150. package/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +0 -24
  151. package/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +0 -72
  152. package/lib/vite/traceViewer/embedded.BkuvsLJp.js +0 -2
  153. package/lib/vite/traceViewer/index.C968kAiC.js +0 -2
  154. package/lib/vite/traceViewer/uiMode.BkFnr4V0.js +0 -10
  155. package/lib/vite/traceViewer/workbench.DjbIuxix.css +0 -1
  156. /package/lib/server/recorder/{recorderActions.js → recorderFrontend.js} +0 -0
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildFullSelector = buildFullSelector;
7
+ exports.toKeyboardModifiers = toKeyboardModifiers;
8
+ exports.traceParamsForAction = traceParamsForAction;
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
+ function buildFullSelector(framePath, selector) {
26
+ return [...framePath, selector].join(' >> internal:control=enter-frame >> ');
27
+ }
28
+ const kDefaultTimeout = 5_000;
29
+ function traceParamsForAction(actionInContext) {
30
+ const {
31
+ action
32
+ } = actionInContext;
33
+ switch (action.name) {
34
+ case 'navigate':
35
+ {
36
+ const params = {
37
+ url: action.url
38
+ };
39
+ return {
40
+ method: 'goto',
41
+ apiName: 'page.goto',
42
+ params
43
+ };
44
+ }
45
+ case 'openPage':
46
+ case 'closePage':
47
+ throw new Error('Not reached');
48
+ }
49
+ const selector = buildFullSelector(actionInContext.frame.framePath, action.selector);
50
+ switch (action.name) {
51
+ case 'click':
52
+ {
53
+ const params = {
54
+ selector,
55
+ strict: true,
56
+ modifiers: toKeyboardModifiers(action.modifiers),
57
+ button: action.button,
58
+ clickCount: action.clickCount,
59
+ position: action.position
60
+ };
61
+ return {
62
+ method: 'click',
63
+ apiName: 'locator.click',
64
+ params
65
+ };
66
+ }
67
+ case 'press':
68
+ {
69
+ const params = {
70
+ selector,
71
+ strict: true,
72
+ key: [...toKeyboardModifiers(action.modifiers), action.key].join('+')
73
+ };
74
+ return {
75
+ method: 'press',
76
+ apiName: 'locator.press',
77
+ params
78
+ };
79
+ }
80
+ case 'fill':
81
+ {
82
+ const params = {
83
+ selector,
84
+ strict: true,
85
+ value: action.text
86
+ };
87
+ return {
88
+ method: 'fill',
89
+ apiName: 'locator.fill',
90
+ params
91
+ };
92
+ }
93
+ case 'setInputFiles':
94
+ {
95
+ const params = {
96
+ selector,
97
+ strict: true,
98
+ localPaths: action.files
99
+ };
100
+ return {
101
+ method: 'setInputFiles',
102
+ apiName: 'locator.setInputFiles',
103
+ params
104
+ };
105
+ }
106
+ case 'check':
107
+ {
108
+ const params = {
109
+ selector,
110
+ strict: true
111
+ };
112
+ return {
113
+ method: 'check',
114
+ apiName: 'locator.check',
115
+ params
116
+ };
117
+ }
118
+ case 'uncheck':
119
+ {
120
+ const params = {
121
+ selector,
122
+ strict: true
123
+ };
124
+ return {
125
+ method: 'uncheck',
126
+ apiName: 'locator.uncheck',
127
+ params
128
+ };
129
+ }
130
+ case 'select':
131
+ {
132
+ const params = {
133
+ selector,
134
+ strict: true,
135
+ options: action.options.map(option => ({
136
+ value: option
137
+ }))
138
+ };
139
+ return {
140
+ method: 'selectOption',
141
+ apiName: 'locator.selectOption',
142
+ params
143
+ };
144
+ }
145
+ case 'assertChecked':
146
+ {
147
+ const params = {
148
+ selector: action.selector,
149
+ expression: 'to.be.checked',
150
+ isNot: !action.checked,
151
+ timeout: kDefaultTimeout
152
+ };
153
+ return {
154
+ method: 'expect',
155
+ apiName: 'expect.toBeChecked',
156
+ params
157
+ };
158
+ }
159
+ case 'assertText':
160
+ {
161
+ const params = {
162
+ selector,
163
+ expression: 'to.have.text',
164
+ expectedText: [],
165
+ isNot: false,
166
+ timeout: kDefaultTimeout
167
+ };
168
+ return {
169
+ method: 'expect',
170
+ apiName: 'expect.toContainText',
171
+ params
172
+ };
173
+ }
174
+ case 'assertValue':
175
+ {
176
+ const params = {
177
+ selector,
178
+ expression: 'to.have.value',
179
+ expectedValue: undefined,
180
+ isNot: false,
181
+ timeout: kDefaultTimeout
182
+ };
183
+ return {
184
+ method: 'expect',
185
+ apiName: 'expect.toHaveValue',
186
+ params
187
+ };
188
+ }
189
+ case 'assertVisible':
190
+ {
191
+ const params = {
192
+ selector,
193
+ expression: 'to.be.visible',
194
+ isNot: false,
195
+ timeout: kDefaultTimeout
196
+ };
197
+ return {
198
+ method: 'expect',
199
+ apiName: 'expect.toBeVisible',
200
+ params
201
+ };
202
+ }
203
+ case 'assertSnapshot':
204
+ {
205
+ const params = {
206
+ selector,
207
+ expression: 'to.match.snapshot',
208
+ expectedText: [],
209
+ isNot: false,
210
+ timeout: kDefaultTimeout
211
+ };
212
+ return {
213
+ method: 'expect',
214
+ apiName: 'expect.toMatchAriaSnapshot',
215
+ params
216
+ };
217
+ }
218
+ }
219
+ }
220
+ function toKeyboardModifiers(modifiers) {
221
+ const result = [];
222
+ if (modifiers & 1) result.push('Alt');
223
+ if (modifiers & 2) result.push('ControlOrMeta');
224
+ if (modifiers & 4) result.push('ControlOrMeta');
225
+ if (modifiers & 8) result.push('Shift');
226
+ return result;
227
+ }
@@ -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
  }
@@ -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
  }
@@ -94,7 +94,11 @@ 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
104
  if (typeof match === 'string' && match === urlString) return true;
@@ -47,7 +47,7 @@ function httpRequest(params, onResponse, onError) {
47
47
  const timeout = (_params$timeout = params.timeout) !== null && _params$timeout !== void 0 ? _params$timeout : NET_DEFAULT_TIMEOUT;
48
48
  const proxyURL = (0, _utilsBundle.getProxyForUrl)(params.url);
49
49
  if (proxyURL) {
50
- const parsedProxyURL = _url.default.parse(proxyURL);
50
+ const parsedProxyURL = new URL(proxyURL);
51
51
  if (params.url.startsWith('http:')) {
52
52
  options = {
53
53
  path: parsedUrl.href,
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findRepeatedSubsequences = findRepeatedSubsequences;
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 findRepeatedSubsequences(s) {
24
+ const n = s.length;
25
+ const result = [];
26
+ let i = 0;
27
+ const arraysEqual = (a1, a2) => {
28
+ if (a1.length !== a2.length) return false;
29
+ for (let j = 0; j < a1.length; j++) {
30
+ if (a1[j] !== a2[j]) return false;
31
+ }
32
+ return true;
33
+ };
34
+ while (i < n) {
35
+ let maxRepeatCount = 1;
36
+ let maxRepeatSubstr = [s[i]]; // Initialize with the element at index i
37
+ let maxRepeatLength = 1;
38
+
39
+ // Try substrings of length from 1 to the remaining length of the array
40
+ for (let p = 1; p <= n - i; p++) {
41
+ const substr = s.slice(i, i + p); // Extract substring as array
42
+ let k = 1;
43
+
44
+ // Count how many times the substring repeats consecutively
45
+ while (i + p * k <= n && arraysEqual(s.slice(i + p * (k - 1), i + p * k), substr)) k += 1;
46
+ k -= 1; // Adjust k since it increments one extra time in the loop
47
+
48
+ // Update the maximal repeating substring if necessary
49
+ if (k > 1 && k * p > maxRepeatCount * maxRepeatLength) {
50
+ maxRepeatCount = k;
51
+ maxRepeatSubstr = substr;
52
+ maxRepeatLength = p;
53
+ }
54
+ }
55
+
56
+ // Record the substring and its count
57
+ result.push({
58
+ sequence: maxRepeatSubstr,
59
+ count: maxRepeatCount
60
+ });
61
+ i += maxRepeatLength * maxRepeatCount; // Move index forward
62
+ }
63
+ return result;
64
+ }
@@ -7,13 +7,14 @@ exports.addInternalStackPrefix = void 0;
7
7
  exports.captureLibraryStackText = captureLibraryStackText;
8
8
  exports.captureLibraryStackTrace = captureLibraryStackTrace;
9
9
  exports.captureRawStack = captureRawStack;
10
+ exports.compressCallLog = compressCallLog;
10
11
  exports.formatCallLog = formatCallLog;
11
12
  exports.rewriteErrorMessage = rewriteErrorMessage;
12
13
  exports.splitErrorMessage = splitErrorMessage;
13
14
  exports.stringifyStackFrames = stringifyStackFrames;
14
15
  var _path = _interopRequireDefault(require("path"));
15
16
  var _utilsBundle = require("../utilsBundle");
16
- var _ = require("./");
17
+ var _sequence = require("./sequence");
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  /**
19
20
  * Copyright (c) Microsoft Corporation.
@@ -53,7 +54,6 @@ function captureRawStack() {
53
54
  }
54
55
  function captureLibraryStackTrace() {
55
56
  const stack = captureRawStack();
56
- const isTesting = (0, _.isUnderTest)();
57
57
  let parsedFrames = stack.map(line => {
58
58
  const frame = (0, _utilsBundle.parseStackTraceLine)(line);
59
59
  if (!frame || !frame.file) return null;
@@ -116,6 +116,19 @@ function formatCallLog(log) {
116
116
  if (!log || !log.some(l => !!l)) return '';
117
117
  return `
118
118
  Call log:
119
- ${_utilsBundle.colors.dim('- ' + (log || []).join('\n - '))}
119
+ ${_utilsBundle.colors.dim(log.join('\n'))}
120
120
  `;
121
+ }
122
+ function compressCallLog(log) {
123
+ const lines = [];
124
+ for (const block of (0, _sequence.findRepeatedSubsequences)(log)) {
125
+ for (let i = 0; i < block.sequence.length; i++) {
126
+ const line = block.sequence[i];
127
+ const leadingWhitespace = line.match(/^\s*/);
128
+ const whitespacePrefix = ' ' + (leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace[0]) || '';
129
+ const countPrefix = `${block.count} × `;
130
+ if (block.count > 1 && i === 0) lines.push(whitespacePrefix + countPrefix + line.trim());else if (block.count > 1) lines.push(whitespacePrefix + ' '.repeat(countPrefix.length - 2) + '- ' + line.trim());else lines.push(whitespacePrefix + '- ' + line.trim());
131
+ }
132
+ }
133
+ return lines;
121
134
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.zones = void 0;
6
+ exports.zones = exports.Zone = void 0;
7
7
  var _async_hooks = require("async_hooks");
8
8
  /**
9
9
  * Copyright (c) Microsoft Corporation.
@@ -26,37 +26,46 @@ class ZoneManager {
26
26
  this._asyncLocalStorage = new _async_hooks.AsyncLocalStorage();
27
27
  }
28
28
  run(type, data, func) {
29
- const previous = this._asyncLocalStorage.getStore();
30
- const zone = new Zone(previous, type, data);
29
+ const zone = Zone._createWithData(this._asyncLocalStorage, type, data);
31
30
  return this._asyncLocalStorage.run(zone, func);
32
31
  }
33
32
  zoneData(type) {
34
- for (let zone = this._asyncLocalStorage.getStore(); zone; zone = zone.previous) {
35
- if (zone.type === type) return zone.data;
36
- }
37
- return undefined;
33
+ const zone = this._asyncLocalStorage.getStore();
34
+ return zone === null || zone === void 0 ? void 0 : zone.get(type);
35
+ }
36
+ currentZone() {
37
+ var _this$_asyncLocalStor;
38
+ return (_this$_asyncLocalStor = this._asyncLocalStorage.getStore()) !== null && _this$_asyncLocalStor !== void 0 ? _this$_asyncLocalStor : Zone._createEmpty(this._asyncLocalStorage);
38
39
  }
39
40
  exitZones(func) {
40
41
  return this._asyncLocalStorage.run(undefined, func);
41
42
  }
42
- printZones() {
43
- const zones = [];
44
- for (let zone = this._asyncLocalStorage.getStore(); zone; zone = zone.previous) {
45
- let str = zone.type;
46
- if (zone.type === 'apiZone') str += `(${zone.data.apiName})`;
47
- zones.push(str);
48
- }
49
- console.log('zones: ', zones.join(' -> '));
50
- }
51
43
  }
52
44
  class Zone {
53
- constructor(previous, type, data) {
54
- this.type = void 0;
55
- this.data = void 0;
56
- this.previous = void 0;
57
- this.type = type;
58
- this.data = data;
59
- this.previous = previous;
45
+ static _createWithData(asyncLocalStorage, type, data) {
46
+ var _asyncLocalStorage$ge;
47
+ const store = new Map((_asyncLocalStorage$ge = asyncLocalStorage.getStore()) === null || _asyncLocalStorage$ge === void 0 ? void 0 : _asyncLocalStorage$ge._data);
48
+ store.set(type, data);
49
+ return new Zone(asyncLocalStorage, store);
50
+ }
51
+ static _createEmpty(asyncLocalStorage) {
52
+ return new Zone(asyncLocalStorage, new Map());
53
+ }
54
+ constructor(asyncLocalStorage, store) {
55
+ this._asyncLocalStorage = void 0;
56
+ this._data = void 0;
57
+ this._asyncLocalStorage = asyncLocalStorage;
58
+ this._data = store;
59
+ }
60
+ run(func) {
61
+ // Reset apiZone and expectZone, but restore stepZone.
62
+ const entries = [...this._data.entries()].filter(([type]) => type !== 'apiZone' && type !== 'expectZone');
63
+ const resetZone = new Zone(this._asyncLocalStorage, new Map(entries));
64
+ return this._asyncLocalStorage.run(resetZone, func);
65
+ }
66
+ get(type) {
67
+ return this._data.get(type);
60
68
  }
61
69
  }
70
+ exports.Zone = Zone;
62
71
  const zones = exports.zones = new ZoneManager();
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.minimatch = exports.mime = exports.lockfile = exports.jpegjs = exports.getProxyForUrl = exports.dotenv = exports.debug = exports.colors = exports.SocksProxyAgent = exports.PNG = exports.HttpsProxyAgent = void 0;
6
+ exports.minimatch = exports.mime = exports.lockfile = exports.jpegjs = exports.getProxyForUrl = exports.dotenv = exports.diff = exports.debug = exports.colors = exports.SocksProxyAgent = exports.PNG = exports.HttpsProxyAgent = void 0;
7
7
  exports.ms = ms;
8
8
  exports.open = void 0;
9
9
  exports.parseStackTraceLine = parseStackTraceLine;
10
- exports.wsServer = exports.wsSender = exports.wsReceiver = exports.ws = exports.progress = exports.program = void 0;
10
+ exports.yaml = exports.wsServer = exports.wsSender = exports.wsReceiver = exports.ws = exports.progress = exports.program = void 0;
11
11
  var _url = _interopRequireDefault(require("url"));
12
12
  var _path = _interopRequireDefault(require("path"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -29,6 +29,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
29
29
 
30
30
  const colors = exports.colors = require('./utilsBundleImpl').colors;
31
31
  const debug = exports.debug = require('./utilsBundleImpl').debug;
32
+ const diff = exports.diff = require('./utilsBundleImpl').diff;
32
33
  const dotenv = exports.dotenv = require('./utilsBundleImpl').dotenv;
33
34
  const getProxyForUrl = exports.getProxyForUrl = require('./utilsBundleImpl').getProxyForUrl;
34
35
  const HttpsProxyAgent = exports.HttpsProxyAgent = require('./utilsBundleImpl').HttpsProxyAgent;
@@ -41,6 +42,7 @@ const PNG = exports.PNG = require('./utilsBundleImpl').PNG;
41
42
  const program = exports.program = require('./utilsBundleImpl').program;
42
43
  const progress = exports.progress = require('./utilsBundleImpl').progress;
43
44
  const SocksProxyAgent = exports.SocksProxyAgent = require('./utilsBundleImpl').SocksProxyAgent;
45
+ const yaml = exports.yaml = require('./utilsBundleImpl').yaml;
44
46
  const ws = exports.ws = require('./utilsBundleImpl').ws;
45
47
  const wsServer = exports.wsServer = require('./utilsBundleImpl').wsServer;
46
48
  const wsReceiver = exports.wsReceiver = require('./utilsBundleImpl').wsReceiver;
@@ -49,11 +51,8 @@ const StackUtils = require('./utilsBundleImpl').StackUtils;
49
51
  const stackUtils = new StackUtils({
50
52
  internals: StackUtils.nodeInternals()
51
53
  });
52
- const nodeInternals = StackUtils.nodeInternals();
53
- const nodeMajorVersion = +process.versions.node.split('.')[0];
54
54
  function parseStackTraceLine(line) {
55
55
  var _frame$file, _frame$file2;
56
- if (!process.env.PWDEBUGIMPL && nodeMajorVersion < 16 && nodeInternals.some(internal => internal.test(line))) return null;
57
56
  const frame = stackUtils.parseLine(line);
58
57
  if (!frame) return null;
59
58
  if (!process.env.PWDEBUGIMPL && ((_frame$file = frame.file) !== null && _frame$file !== void 0 && _frame$file.startsWith('internal') || (_frame$file2 = frame.file) !== null && _frame$file2 !== void 0 && _frame$file2.startsWith('node:'))) return null;