@checkly/playwright-core 1.51.11-beta.1 → 1.51.11

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 (49) hide show
  1. package/package.json +1 -1
  2. package/lib/common/socksProxy.js +0 -569
  3. package/lib/common/timeoutSettings.js +0 -73
  4. package/lib/common/types.js +0 -5
  5. package/lib/generated/recorderSource.js +0 -7
  6. package/lib/image_tools/colorUtils.js +0 -98
  7. package/lib/image_tools/compare.js +0 -108
  8. package/lib/image_tools/imageChannel.js +0 -70
  9. package/lib/image_tools/stats.js +0 -102
  10. package/lib/protocol/transport.js +0 -82
  11. package/lib/server/recorder/codeGenerator.js +0 -154
  12. package/lib/server/recorder/csharp.js +0 -311
  13. package/lib/server/recorder/java.js +0 -249
  14. package/lib/server/recorder/javascript.js +0 -230
  15. package/lib/server/recorder/jsonl.js +0 -48
  16. package/lib/server/recorder/language.js +0 -45
  17. package/lib/server/recorder/python.js +0 -276
  18. package/lib/server/recorder/recorderActions.js +0 -6
  19. package/lib/server/recorder/utils.js +0 -46
  20. package/lib/third_party/diff_match_patch.js +0 -2222
  21. package/lib/utils/ascii.js +0 -31
  22. package/lib/utils/comparators.js +0 -171
  23. package/lib/utils/crypto.js +0 -174
  24. package/lib/utils/debug.js +0 -46
  25. package/lib/utils/debugLogger.js +0 -91
  26. package/lib/utils/env.js +0 -49
  27. package/lib/utils/eventsHelper.js +0 -38
  28. package/lib/utils/glob.js +0 -84
  29. package/lib/utils/happy-eyeballs.js +0 -210
  30. package/lib/utils/headers.js +0 -52
  31. package/lib/utils/hostPlatform.js +0 -133
  32. package/lib/utils/httpServer.js +0 -237
  33. package/lib/utils/linuxUtils.js +0 -78
  34. package/lib/utils/manualPromise.js +0 -109
  35. package/lib/utils/mimeType.js +0 -30
  36. package/lib/utils/multimap.js +0 -75
  37. package/lib/utils/network.js +0 -160
  38. package/lib/utils/processLauncher.js +0 -248
  39. package/lib/utils/profiler.js +0 -53
  40. package/lib/utils/rtti.js +0 -44
  41. package/lib/utils/semaphore.js +0 -51
  42. package/lib/utils/spawnAsync.js +0 -45
  43. package/lib/utils/task.js +0 -58
  44. package/lib/utils/time.js +0 -37
  45. package/lib/utils/traceUtils.js +0 -44
  46. package/lib/utils/userAgent.js +0 -105
  47. package/lib/utils/wsServer.js +0 -127
  48. package/lib/utils/zipFile.js +0 -75
  49. package/lib/vite/traceViewer/sw.bundle.js +0 -3
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getLinuxDistributionInfo = getLinuxDistributionInfo;
7
- exports.getLinuxDistributionInfoSync = getLinuxDistributionInfoSync;
8
- var _fs = _interopRequireDefault(require("fs"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /**
11
- * Copyright 2017 Google Inc. All rights reserved.
12
- * Modifications 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
- let didFailToReadOSRelease = false;
28
- let osRelease;
29
- async function getLinuxDistributionInfo() {
30
- if (process.platform !== 'linux') return undefined;
31
- if (!osRelease && !didFailToReadOSRelease) {
32
- try {
33
- var _fields$get, _fields$get2;
34
- // List of /etc/os-release values for different distributions could be
35
- // found here: https://gist.github.com/aslushnikov/8ceddb8288e4cf9db3039c02e0f4fb75
36
- const osReleaseText = await _fs.default.promises.readFile('/etc/os-release', 'utf8');
37
- const fields = parseOSReleaseText(osReleaseText);
38
- osRelease = {
39
- id: (_fields$get = fields.get('id')) !== null && _fields$get !== void 0 ? _fields$get : '',
40
- version: (_fields$get2 = fields.get('version_id')) !== null && _fields$get2 !== void 0 ? _fields$get2 : ''
41
- };
42
- } catch (e) {
43
- didFailToReadOSRelease = true;
44
- }
45
- }
46
- return osRelease;
47
- }
48
- function getLinuxDistributionInfoSync() {
49
- if (process.platform !== 'linux') return undefined;
50
- if (!osRelease && !didFailToReadOSRelease) {
51
- try {
52
- var _fields$get3, _fields$get4;
53
- // List of /etc/os-release values for different distributions could be
54
- // found here: https://gist.github.com/aslushnikov/8ceddb8288e4cf9db3039c02e0f4fb75
55
- const osReleaseText = _fs.default.readFileSync('/etc/os-release', 'utf8');
56
- const fields = parseOSReleaseText(osReleaseText);
57
- osRelease = {
58
- id: (_fields$get3 = fields.get('id')) !== null && _fields$get3 !== void 0 ? _fields$get3 : '',
59
- version: (_fields$get4 = fields.get('version_id')) !== null && _fields$get4 !== void 0 ? _fields$get4 : ''
60
- };
61
- } catch (e) {
62
- didFailToReadOSRelease = true;
63
- }
64
- }
65
- return osRelease;
66
- }
67
- function parseOSReleaseText(osReleaseText) {
68
- const fields = new Map();
69
- for (const line of osReleaseText.split('\n')) {
70
- const tokens = line.split('=');
71
- const name = tokens.shift();
72
- let value = tokens.join('=').trim();
73
- if (value.startsWith('"') && value.endsWith('"')) value = value.substring(1, value.length - 1);
74
- if (!name) continue;
75
- fields.set(name.toLowerCase(), value);
76
- }
77
- return fields;
78
- }
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ManualPromise = exports.LongStandingScope = void 0;
7
- var _stackTrace = require("./stackTrace");
8
- let _Symbol$species, _Symbol$toStringTag;
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
- _Symbol$species = Symbol.species;
25
- _Symbol$toStringTag = Symbol.toStringTag;
26
- class ManualPromise extends Promise {
27
- constructor() {
28
- let resolve;
29
- let reject;
30
- super((f, r) => {
31
- resolve = f;
32
- reject = r;
33
- });
34
- this._resolve = void 0;
35
- this._reject = void 0;
36
- this._isDone = void 0;
37
- this._isDone = false;
38
- this._resolve = resolve;
39
- this._reject = reject;
40
- }
41
- isDone() {
42
- return this._isDone;
43
- }
44
- resolve(t) {
45
- this._isDone = true;
46
- this._resolve(t);
47
- }
48
- reject(e) {
49
- this._isDone = true;
50
- this._reject(e);
51
- }
52
- static get [_Symbol$species]() {
53
- return Promise;
54
- }
55
- get [_Symbol$toStringTag]() {
56
- return 'ManualPromise';
57
- }
58
- }
59
- exports.ManualPromise = ManualPromise;
60
- class LongStandingScope {
61
- constructor() {
62
- this._terminateError = void 0;
63
- this._closeError = void 0;
64
- this._terminatePromises = new Map();
65
- this._isClosed = false;
66
- }
67
- reject(error) {
68
- this._isClosed = true;
69
- this._terminateError = error;
70
- for (const p of this._terminatePromises.keys()) p.resolve(error);
71
- }
72
- close(error) {
73
- this._isClosed = true;
74
- this._closeError = error;
75
- for (const [p, frames] of this._terminatePromises) p.resolve(cloneError(error, frames));
76
- }
77
- isClosed() {
78
- return this._isClosed;
79
- }
80
- static async raceMultiple(scopes, promise) {
81
- return Promise.race(scopes.map(s => s.race(promise)));
82
- }
83
- async race(promise) {
84
- return this._race(Array.isArray(promise) ? promise : [promise], false);
85
- }
86
- async safeRace(promise, defaultValue) {
87
- return this._race([promise], true, defaultValue);
88
- }
89
- async _race(promises, safe, defaultValue) {
90
- const terminatePromise = new ManualPromise();
91
- const frames = (0, _stackTrace.captureRawStack)();
92
- if (this._terminateError) terminatePromise.resolve(this._terminateError);
93
- if (this._closeError) terminatePromise.resolve(cloneError(this._closeError, frames));
94
- this._terminatePromises.set(terminatePromise, frames);
95
- try {
96
- return await Promise.race([terminatePromise.then(e => safe ? defaultValue : Promise.reject(e)), ...promises]);
97
- } finally {
98
- this._terminatePromises.delete(terminatePromise);
99
- }
100
- }
101
- }
102
- exports.LongStandingScope = LongStandingScope;
103
- function cloneError(error, frames) {
104
- const clone = new Error();
105
- clone.name = error.name;
106
- clone.message = error.message;
107
- clone.stack = [error.name + ':' + error.message, ...frames].join('\n');
108
- return clone;
109
- }
@@ -1,30 +0,0 @@
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
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MultiMap = void 0;
7
- let _Symbol$iterator;
8
- _Symbol$iterator = Symbol.iterator;
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
- class MultiMap {
26
- constructor() {
27
- this._map = void 0;
28
- this._map = new Map();
29
- }
30
- set(key, value) {
31
- let values = this._map.get(key);
32
- if (!values) {
33
- values = [];
34
- this._map.set(key, values);
35
- }
36
- values.push(value);
37
- }
38
- get(key) {
39
- return this._map.get(key) || [];
40
- }
41
- has(key) {
42
- return this._map.has(key);
43
- }
44
- delete(key, value) {
45
- const values = this._map.get(key);
46
- if (!values) return;
47
- if (values.includes(value)) this._map.set(key, values.filter(v => value !== v));
48
- }
49
- deleteAll(key) {
50
- this._map.delete(key);
51
- }
52
- hasValue(key, value) {
53
- const values = this._map.get(key);
54
- if (!values) return false;
55
- return values.includes(value);
56
- }
57
- get size() {
58
- return this._map.size;
59
- }
60
- [_Symbol$iterator]() {
61
- return this._map[Symbol.iterator]();
62
- }
63
- keys() {
64
- return this._map.keys();
65
- }
66
- values() {
67
- const result = [];
68
- for (const key of this.keys()) result.push(...this.get(key));
69
- return result;
70
- }
71
- clear() {
72
- this._map.clear();
73
- }
74
- }
75
- exports.MultiMap = MultiMap;
@@ -1,160 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NET_DEFAULT_TIMEOUT = void 0;
7
- exports.createHttp2Server = createHttp2Server;
8
- exports.createHttpServer = createHttpServer;
9
- exports.createHttpsServer = createHttpsServer;
10
- exports.fetchData = fetchData;
11
- exports.httpRequest = httpRequest;
12
- exports.isURLAvailable = isURLAvailable;
13
- var _http = _interopRequireDefault(require("http"));
14
- var _https = _interopRequireDefault(require("https"));
15
- var _http2 = _interopRequireDefault(require("http2"));
16
- var _utilsBundle = require("../utilsBundle");
17
- var _url = _interopRequireDefault(require("url"));
18
- var _happyEyeballs = require("./happy-eyeballs");
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
- /**
21
- * Copyright (c) Microsoft Corporation.
22
- *
23
- * Licensed under the Apache License, Version 2.0 (the "License");
24
- * you may not use this file except in compliance with the License.
25
- * You may obtain a copy of the License at
26
- *
27
- * http://www.apache.org/licenses/LICENSE-2.0
28
- *
29
- * Unless required by applicable law or agreed to in writing, software
30
- * distributed under the License is distributed on an "AS IS" BASIS,
31
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
- * See the License for the specific language governing permissions and
33
- * limitations under the License.
34
- */
35
-
36
- const NET_DEFAULT_TIMEOUT = exports.NET_DEFAULT_TIMEOUT = 30_000;
37
- function httpRequest(params, onResponse, onError) {
38
- var _params$timeout;
39
- const parsedUrl = _url.default.parse(params.url);
40
- let options = {
41
- ...parsedUrl,
42
- agent: parsedUrl.protocol === 'https:' ? _happyEyeballs.httpsHappyEyeballsAgent : _happyEyeballs.httpHappyEyeballsAgent,
43
- method: params.method || 'GET',
44
- headers: params.headers
45
- };
46
- if (params.rejectUnauthorized !== undefined) options.rejectUnauthorized = params.rejectUnauthorized;
47
- const timeout = (_params$timeout = params.timeout) !== null && _params$timeout !== void 0 ? _params$timeout : NET_DEFAULT_TIMEOUT;
48
- const proxyURL = (0, _utilsBundle.getProxyForUrl)(params.url);
49
- if (proxyURL) {
50
- const parsedProxyURL = _url.default.parse(proxyURL);
51
- if (params.url.startsWith('http:')) {
52
- options = {
53
- path: parsedUrl.href,
54
- host: parsedProxyURL.hostname,
55
- port: parsedProxyURL.port,
56
- headers: options.headers,
57
- method: options.method
58
- };
59
- } else {
60
- parsedProxyURL.secureProxy = parsedProxyURL.protocol === 'https:';
61
- options.agent = new _utilsBundle.HttpsProxyAgent(parsedProxyURL);
62
- options.rejectUnauthorized = false;
63
- }
64
- }
65
- const requestCallback = res => {
66
- const statusCode = res.statusCode || 0;
67
- if (statusCode >= 300 && statusCode < 400 && res.headers.location) httpRequest({
68
- ...params,
69
- url: new URL(res.headers.location, params.url).toString()
70
- }, onResponse, onError);else onResponse(res);
71
- };
72
- const request = options.protocol === 'https:' ? _https.default.request(options, requestCallback) : _http.default.request(options, requestCallback);
73
- request.on('error', onError);
74
- if (timeout !== undefined) {
75
- const rejectOnTimeout = () => {
76
- onError(new Error(`Request to ${params.url} timed out after ${timeout}ms`));
77
- request.abort();
78
- };
79
- if (timeout <= 0) {
80
- rejectOnTimeout();
81
- return;
82
- }
83
- request.setTimeout(timeout, rejectOnTimeout);
84
- }
85
- request.end(params.data);
86
- }
87
- function fetchData(params, onError) {
88
- return new Promise((resolve, reject) => {
89
- httpRequest(params, async response => {
90
- if (response.statusCode !== 200) {
91
- const error = onError ? await onError(params, response) : new Error(`fetch failed: server returned code ${response.statusCode}. URL: ${params.url}`);
92
- reject(error);
93
- return;
94
- }
95
- let body = '';
96
- response.on('data', chunk => body += chunk);
97
- response.on('error', error => reject(error));
98
- response.on('end', () => resolve(body));
99
- }, reject);
100
- });
101
- }
102
- function createHttpServer(...args) {
103
- const server = _http.default.createServer(...args);
104
- decorateServer(server);
105
- return server;
106
- }
107
- function createHttpsServer(...args) {
108
- const server = _https.default.createServer(...args);
109
- decorateServer(server);
110
- return server;
111
- }
112
- function createHttp2Server(...args) {
113
- const server = _http2.default.createSecureServer(...args);
114
- decorateServer(server);
115
- return server;
116
- }
117
- async function isURLAvailable(url, ignoreHTTPSErrors, onLog, onStdErr) {
118
- let statusCode = await httpStatusCode(url, ignoreHTTPSErrors, onLog, onStdErr);
119
- if (statusCode === 404 && url.pathname === '/') {
120
- const indexUrl = new URL(url);
121
- indexUrl.pathname = '/index.html';
122
- statusCode = await httpStatusCode(indexUrl, ignoreHTTPSErrors, onLog, onStdErr);
123
- }
124
- return statusCode >= 200 && statusCode < 404;
125
- }
126
- async function httpStatusCode(url, ignoreHTTPSErrors, onLog, onStdErr) {
127
- return new Promise(resolve => {
128
- onLog === null || onLog === void 0 || onLog(`HTTP GET: ${url}`);
129
- httpRequest({
130
- url: url.toString(),
131
- headers: {
132
- Accept: '*/*'
133
- },
134
- rejectUnauthorized: !ignoreHTTPSErrors
135
- }, res => {
136
- var _res$statusCode;
137
- res.resume();
138
- const statusCode = (_res$statusCode = res.statusCode) !== null && _res$statusCode !== void 0 ? _res$statusCode : 0;
139
- onLog === null || onLog === void 0 || onLog(`HTTP Status: ${statusCode}`);
140
- resolve(statusCode);
141
- }, error => {
142
- if (error.code === 'DEPTH_ZERO_SELF_SIGNED_CERT') onStdErr === null || onStdErr === void 0 || onStdErr(`[WebServer] Self-signed certificate detected. Try adding ignoreHTTPSErrors: true to config.webServer.`);
143
- onLog === null || onLog === void 0 || onLog(`Error while checking if ${url} is available: ${error.message}`);
144
- resolve(0);
145
- });
146
- });
147
- }
148
- function decorateServer(server) {
149
- const sockets = new Set();
150
- server.on('connection', socket => {
151
- sockets.add(socket);
152
- socket.once('close', () => sockets.delete(socket));
153
- });
154
- const close = server.close;
155
- server.close = callback => {
156
- for (const socket of sockets) socket.destroy();
157
- sockets.clear();
158
- return close.call(server, callback);
159
- };
160
- }