@checkly/playwright-core 1.48.22 → 1.48.23
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.
- package/lib/checkly/secretsFilter.js +29 -6
- package/lib/client/clientStackTrace.js +65 -0
- package/lib/client/fileUtils.js +31 -0
- package/lib/client/platform.js +71 -0
- package/lib/client/timeoutSettings.js +65 -0
- package/lib/client/webSocket.js +106 -0
- package/lib/generated/clockSource.js +2 -1
- package/lib/generated/consoleApiSource.js +2 -1
- package/lib/generated/injectedScriptSource.js +2 -1
- package/lib/generated/pollingRecorderSource.js +2 -1
- package/lib/generated/utilityScriptSource.js +2 -1
- package/lib/generated/webSocketMockSource.js +2 -1
- package/lib/server/callLog.js +79 -0
- package/lib/server/harBackend.js +157 -0
- package/lib/server/localUtils.js +203 -0
- package/lib/server/recorder/chat.js +177 -0
- package/lib/server/storageScript.js +160 -0
- package/lib/server/timeoutSettings.js +74 -0
- package/lib/server/utils/ascii.js +31 -0
- package/lib/server/utils/comparators.js +159 -0
- package/lib/server/utils/crypto.js +171 -0
- package/lib/server/utils/debug.js +38 -0
- package/lib/server/utils/debugLogger.js +93 -0
- package/lib/server/utils/env.js +53 -0
- package/lib/server/utils/eventsHelper.js +38 -0
- package/lib/server/utils/expectUtils.js +33 -0
- package/lib/server/utils/fileUtils.js +204 -0
- package/lib/server/utils/happyEyeballs.js +209 -0
- package/lib/server/utils/hostPlatform.js +145 -0
- package/lib/server/utils/httpServer.js +233 -0
- package/lib/server/utils/image_tools/colorUtils.js +98 -0
- package/lib/server/utils/image_tools/compare.js +108 -0
- package/lib/server/utils/image_tools/imageChannel.js +70 -0
- package/lib/server/utils/image_tools/stats.js +102 -0
- package/lib/server/utils/linuxUtils.js +58 -0
- package/lib/server/utils/network.js +160 -0
- package/lib/server/utils/nodePlatform.js +140 -0
- package/lib/server/utils/pipeTransport.js +82 -0
- package/lib/server/utils/processLauncher.js +248 -0
- package/lib/server/utils/profiler.js +52 -0
- package/lib/server/utils/socksProxy.js +570 -0
- package/lib/server/utils/spawnAsync.js +45 -0
- package/lib/server/utils/task.js +58 -0
- package/lib/server/utils/userAgent.js +91 -0
- package/lib/server/utils/wsServer.js +128 -0
- package/lib/server/utils/zipFile.js +75 -0
- package/lib/server/utils/zones.js +54 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +392 -0
- package/lib/utils/isomorphic/assert.js +25 -0
- package/lib/utils/isomorphic/colors.js +65 -0
- package/lib/utils/isomorphic/headers.js +52 -0
- package/lib/utils/isomorphic/manualPromise.js +107 -0
- package/lib/utils/isomorphic/multimap.js +73 -0
- package/lib/utils/isomorphic/rtti.js +41 -0
- package/lib/utils/isomorphic/semaphore.js +51 -0
- package/lib/utils/isomorphic/stackTrace.js +169 -0
- package/lib/utils/isomorphic/time.js +25 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/types.js +5 -0
- package/lib/utils.js +447 -0
- package/lib/vite/traceViewer/assets/{codeMirrorModule-pBPtArIT.js → codeMirrorModule-Bh1rfd2w.js} +14 -14
- package/lib/vite/traceViewer/assets/codeMirrorModule-DZoSgqUd.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-xvopPhZ4.js +24 -0
- package/lib/vite/traceViewer/assets/{inspectorTab-BuJ3wAX_.js → inspectorTab-7GHnKvSD.js} +2 -2
- package/lib/vite/traceViewer/assets/{inspectorTab-Soeeuvzv.js → inspectorTab-BHcfR9dD.js} +3 -3
- package/lib/vite/traceViewer/assets/inspectorTab-wfvwpMHs.js +64 -0
- package/lib/vite/traceViewer/assets/{workbench-DdmJ9AJV.js → workbench-C6nMfKVy.js} +1 -1
- package/lib/vite/traceViewer/assets/{workbench-lypYlf00.js → workbench-DZqNXdoV.js} +1 -1
- package/lib/vite/traceViewer/assets/workbench-LKskf2Iy.js +9 -0
- package/lib/vite/traceViewer/{embedded.BkvOrz5Z.js → embedded.BXYl5zRv.js} +1 -1
- package/lib/vite/traceViewer/{embedded.DInvAijy.js → embedded.CShPz96b.js} +1 -1
- package/lib/vite/traceViewer/embedded.Dxe2heQk.js +2 -0
- package/lib/vite/traceViewer/embedded.html +3 -3
- package/lib/vite/traceViewer/{index.Dha3cgqs.js → index.BZ9CE8t3.js} +1 -1
- package/lib/vite/traceViewer/{index._Iolt-uE.js → index.CB297BuW.js} +1 -1
- package/lib/vite/traceViewer/index.DZkJsFod.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/{recorder.DNMfnSiu.js → recorder.BVExlUUk.js} +1 -1
- package/lib/vite/traceViewer/{recorder.DTSaNaly.js → recorder.C4zxcvd2.js} +1 -1
- package/lib/vite/traceViewer/recorder.C88JDknq.js +2 -0
- package/lib/vite/traceViewer/recorder.html +2 -2
- package/lib/vite/traceViewer/{uiMode.BM7yhjzl.js → uiMode.2tr9k625.js} +1 -1
- package/lib/vite/traceViewer/{uiMode.Cr1tvTWS.js → uiMode.DXa41vt9.js} +1 -1
- package/lib/vite/traceViewer/uiMode.DjTS7tqC.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-tzBrK1V4.js +0 -24
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiMap = void 0;
|
|
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
|
+
class MultiMap {
|
|
24
|
+
constructor() {
|
|
25
|
+
this._map = void 0;
|
|
26
|
+
this._map = new Map();
|
|
27
|
+
}
|
|
28
|
+
set(key, value) {
|
|
29
|
+
let values = this._map.get(key);
|
|
30
|
+
if (!values) {
|
|
31
|
+
values = [];
|
|
32
|
+
this._map.set(key, values);
|
|
33
|
+
}
|
|
34
|
+
values.push(value);
|
|
35
|
+
}
|
|
36
|
+
get(key) {
|
|
37
|
+
return this._map.get(key) || [];
|
|
38
|
+
}
|
|
39
|
+
has(key) {
|
|
40
|
+
return this._map.has(key);
|
|
41
|
+
}
|
|
42
|
+
delete(key, value) {
|
|
43
|
+
const values = this._map.get(key);
|
|
44
|
+
if (!values) return;
|
|
45
|
+
if (values.includes(value)) this._map.set(key, values.filter(v => value !== v));
|
|
46
|
+
}
|
|
47
|
+
deleteAll(key) {
|
|
48
|
+
this._map.delete(key);
|
|
49
|
+
}
|
|
50
|
+
hasValue(key, value) {
|
|
51
|
+
const values = this._map.get(key);
|
|
52
|
+
if (!values) return false;
|
|
53
|
+
return values.includes(value);
|
|
54
|
+
}
|
|
55
|
+
get size() {
|
|
56
|
+
return this._map.size;
|
|
57
|
+
}
|
|
58
|
+
[Symbol.iterator]() {
|
|
59
|
+
return this._map[Symbol.iterator]();
|
|
60
|
+
}
|
|
61
|
+
keys() {
|
|
62
|
+
return this._map.keys();
|
|
63
|
+
}
|
|
64
|
+
values() {
|
|
65
|
+
const result = [];
|
|
66
|
+
for (const key of this.keys()) result.push(...this.get(key));
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
clear() {
|
|
70
|
+
this._map.clear();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.MultiMap = MultiMap;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isError = isError;
|
|
7
|
+
exports.isObject = isObject;
|
|
8
|
+
exports.isRegExp = isRegExp;
|
|
9
|
+
Object.defineProperty(exports, "isString", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _stringUtils.isString;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _stringUtils = require("./stringUtils");
|
|
16
|
+
/**
|
|
17
|
+
* Copyright (c) Microsoft Corporation.
|
|
18
|
+
*
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function isRegExp(obj) {
|
|
33
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
34
|
+
}
|
|
35
|
+
function isObject(obj) {
|
|
36
|
+
return typeof obj === 'object' && obj !== null;
|
|
37
|
+
}
|
|
38
|
+
function isError(obj) {
|
|
39
|
+
var _Object$getPrototypeO;
|
|
40
|
+
return obj instanceof Error || obj && ((_Object$getPrototypeO = Object.getPrototypeOf(obj)) === null || _Object$getPrototypeO === void 0 ? void 0 : _Object$getPrototypeO.name) === 'Error';
|
|
41
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Semaphore = void 0;
|
|
7
|
+
var _manualPromise = require("./manualPromise");
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) Microsoft Corporation.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
class Semaphore {
|
|
25
|
+
constructor(max) {
|
|
26
|
+
this._max = void 0;
|
|
27
|
+
this._acquired = 0;
|
|
28
|
+
this._queue = [];
|
|
29
|
+
this._max = max;
|
|
30
|
+
}
|
|
31
|
+
setMax(max) {
|
|
32
|
+
this._max = max;
|
|
33
|
+
}
|
|
34
|
+
acquire() {
|
|
35
|
+
const lock = new _manualPromise.ManualPromise();
|
|
36
|
+
this._queue.push(lock);
|
|
37
|
+
this._flush();
|
|
38
|
+
return lock;
|
|
39
|
+
}
|
|
40
|
+
release() {
|
|
41
|
+
--this._acquired;
|
|
42
|
+
this._flush();
|
|
43
|
+
}
|
|
44
|
+
_flush() {
|
|
45
|
+
while (this._acquired < this._max && this._queue.length) {
|
|
46
|
+
++this._acquired;
|
|
47
|
+
this._queue.shift().resolve();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Semaphore = Semaphore;
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|