@checkly/playwright-core 1.48.24-beta.0 → 1.48.24-beta.1

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 (61) hide show
  1. package/lib/vite/recorder/assets/{codeMirrorModule-xqJWdfrS.js → codeMirrorModule-d0KhC1qL.js} +11 -11
  2. package/lib/vite/recorder/assets/{index-DDT9w7gI.js → index-Bxxcmxlu.js} +2 -2
  3. package/lib/vite/recorder/index.html +1 -1
  4. package/lib/vite/traceViewer/embedded.html +3 -3
  5. package/lib/vite/traceViewer/index.html +3 -3
  6. package/lib/vite/traceViewer/recorder.html +2 -2
  7. package/lib/vite/traceViewer/uiMode.html +3 -3
  8. package/package.json +1 -1
  9. package/lib/client/clientStackTrace.js +0 -65
  10. package/lib/client/fileUtils.js +0 -31
  11. package/lib/client/platform.js +0 -71
  12. package/lib/client/timeoutSettings.js +0 -65
  13. package/lib/client/webSocket.js +0 -106
  14. package/lib/server/callLog.js +0 -79
  15. package/lib/server/harBackend.js +0 -157
  16. package/lib/server/localUtils.js +0 -203
  17. package/lib/server/recorder/chat.js +0 -177
  18. package/lib/server/storageScript.js +0 -160
  19. package/lib/server/timeoutSettings.js +0 -74
  20. package/lib/server/utils/ascii.js +0 -31
  21. package/lib/server/utils/comparators.js +0 -159
  22. package/lib/server/utils/crypto.js +0 -171
  23. package/lib/server/utils/debug.js +0 -38
  24. package/lib/server/utils/debugLogger.js +0 -93
  25. package/lib/server/utils/env.js +0 -53
  26. package/lib/server/utils/eventsHelper.js +0 -38
  27. package/lib/server/utils/expectUtils.js +0 -33
  28. package/lib/server/utils/fileUtils.js +0 -204
  29. package/lib/server/utils/happyEyeballs.js +0 -209
  30. package/lib/server/utils/hostPlatform.js +0 -145
  31. package/lib/server/utils/httpServer.js +0 -233
  32. package/lib/server/utils/image_tools/colorUtils.js +0 -98
  33. package/lib/server/utils/image_tools/compare.js +0 -108
  34. package/lib/server/utils/image_tools/imageChannel.js +0 -70
  35. package/lib/server/utils/image_tools/stats.js +0 -102
  36. package/lib/server/utils/linuxUtils.js +0 -58
  37. package/lib/server/utils/network.js +0 -160
  38. package/lib/server/utils/nodePlatform.js +0 -140
  39. package/lib/server/utils/pipeTransport.js +0 -82
  40. package/lib/server/utils/processLauncher.js +0 -248
  41. package/lib/server/utils/profiler.js +0 -52
  42. package/lib/server/utils/socksProxy.js +0 -570
  43. package/lib/server/utils/spawnAsync.js +0 -45
  44. package/lib/server/utils/task.js +0 -58
  45. package/lib/server/utils/userAgent.js +0 -91
  46. package/lib/server/utils/wsServer.js +0 -128
  47. package/lib/server/utils/zipFile.js +0 -75
  48. package/lib/server/utils/zones.js +0 -54
  49. package/lib/utils/isomorphic/ariaSnapshot.js +0 -392
  50. package/lib/utils/isomorphic/assert.js +0 -25
  51. package/lib/utils/isomorphic/colors.js +0 -65
  52. package/lib/utils/isomorphic/headers.js +0 -52
  53. package/lib/utils/isomorphic/manualPromise.js +0 -107
  54. package/lib/utils/isomorphic/multimap.js +0 -73
  55. package/lib/utils/isomorphic/rtti.js +0 -41
  56. package/lib/utils/isomorphic/semaphore.js +0 -51
  57. package/lib/utils/isomorphic/stackTrace.js +0 -169
  58. package/lib/utils/isomorphic/time.js +0 -25
  59. package/lib/utils/isomorphic/timeoutRunner.js +0 -66
  60. package/lib/utils/isomorphic/types.js +0 -5
  61. package/lib/utils.js +0 -447
@@ -1,204 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SerializedFS = void 0;
7
- exports.canAccessFile = canAccessFile;
8
- exports.copyFileAndMakeWritable = copyFileAndMakeWritable;
9
- exports.existsAsync = void 0;
10
- exports.mkdirIfNeeded = mkdirIfNeeded;
11
- exports.removeFolders = removeFolders;
12
- exports.sanitizeForFilePath = sanitizeForFilePath;
13
- exports.toPosixPath = toPosixPath;
14
- var _fs = _interopRequireDefault(require("fs"));
15
- var _path = _interopRequireDefault(require("path"));
16
- var _manualPromise = require("../../utils/isomorphic/manualPromise");
17
- var _zipBundle = require("../../zipBundle");
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
- /**
20
- * Copyright (c) Microsoft Corporation.
21
- *
22
- * Licensed under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License.
24
- * You may obtain a copy of the License at
25
- *
26
- * http://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software
29
- * distributed under the License is distributed on an "AS IS" BASIS,
30
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
- * See the License for the specific language governing permissions and
32
- * limitations under the License.
33
- */
34
-
35
- const existsAsync = path => new Promise(resolve => _fs.default.stat(path, err => resolve(!err)));
36
- exports.existsAsync = existsAsync;
37
- async function mkdirIfNeeded(filePath) {
38
- // This will harmlessly throw on windows if the dirname is the root directory.
39
- await _fs.default.promises.mkdir(_path.default.dirname(filePath), {
40
- recursive: true
41
- }).catch(() => {});
42
- }
43
- async function removeFolders(dirs) {
44
- return await Promise.all(dirs.map(dir => _fs.default.promises.rm(dir, {
45
- recursive: true,
46
- force: true,
47
- maxRetries: 10
48
- }).catch(e => e)));
49
- }
50
- function canAccessFile(file) {
51
- if (!file) return false;
52
- try {
53
- _fs.default.accessSync(file);
54
- return true;
55
- } catch (e) {
56
- return false;
57
- }
58
- }
59
- async function copyFileAndMakeWritable(from, to) {
60
- await _fs.default.promises.copyFile(from, to);
61
- await _fs.default.promises.chmod(to, 0o664);
62
- }
63
- function sanitizeForFilePath(s) {
64
- return s.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');
65
- }
66
- function toPosixPath(aPath) {
67
- return aPath.split(_path.default.sep).join(_path.default.posix.sep);
68
- }
69
- class SerializedFS {
70
- constructor() {
71
- this._buffers = new Map();
72
- // Should never be accessed from within appendOperation.
73
- this._error = void 0;
74
- this._operations = [];
75
- this._operationsDone = void 0;
76
- this._operationsDone = new _manualPromise.ManualPromise();
77
- this._operationsDone.resolve(); // No operations scheduled yet.
78
- }
79
- mkdir(dir) {
80
- this._appendOperation({
81
- op: 'mkdir',
82
- dir
83
- });
84
- }
85
- writeFile(file, content, skipIfExists) {
86
- this._buffers.delete(file); // No need to flush the buffer since we'll overwrite anyway.
87
- this._appendOperation({
88
- op: 'writeFile',
89
- file,
90
- content,
91
- skipIfExists
92
- });
93
- }
94
- appendFile(file, text, flush) {
95
- if (!this._buffers.has(file)) this._buffers.set(file, []);
96
- this._buffers.get(file).push(text);
97
- if (flush) this._flushFile(file);
98
- }
99
- _flushFile(file) {
100
- const buffer = this._buffers.get(file);
101
- if (buffer === undefined) return;
102
- const content = buffer.join('');
103
- this._buffers.delete(file);
104
- this._appendOperation({
105
- op: 'appendFile',
106
- file,
107
- content
108
- });
109
- }
110
- copyFile(from, to) {
111
- this._flushFile(from);
112
- this._buffers.delete(to); // No need to flush the buffer since we'll overwrite anyway.
113
- this._appendOperation({
114
- op: 'copyFile',
115
- from,
116
- to
117
- });
118
- }
119
- async syncAndGetError() {
120
- for (const file of this._buffers.keys()) this._flushFile(file);
121
- await this._operationsDone;
122
- return this._error;
123
- }
124
- zip(entries, zipFileName) {
125
- for (const file of this._buffers.keys()) this._flushFile(file);
126
-
127
- // Chain the export operation against write operations,
128
- // so that files do not change during the export.
129
- this._appendOperation({
130
- op: 'zip',
131
- entries,
132
- zipFileName
133
- });
134
- }
135
-
136
- // This method serializes all writes to the trace.
137
- _appendOperation(op) {
138
- const last = this._operations[this._operations.length - 1];
139
- if ((last === null || last === void 0 ? void 0 : last.op) === 'appendFile' && op.op === 'appendFile' && last.file === op.file) {
140
- // Merge pending appendFile operations for performance.
141
- last.content += op.content;
142
- return;
143
- }
144
- this._operations.push(op);
145
- if (this._operationsDone.isDone()) this._performOperations();
146
- }
147
- async _performOperations() {
148
- this._operationsDone = new _manualPromise.ManualPromise();
149
- while (this._operations.length) {
150
- const op = this._operations.shift();
151
- // Ignore all operations after the first error.
152
- if (this._error) continue;
153
- try {
154
- await this._performOperation(op);
155
- } catch (e) {
156
- this._error = e;
157
- }
158
- }
159
- this._operationsDone.resolve();
160
- }
161
- async _performOperation(op) {
162
- switch (op.op) {
163
- case 'mkdir':
164
- {
165
- await _fs.default.promises.mkdir(op.dir, {
166
- recursive: true
167
- });
168
- return;
169
- }
170
- case 'writeFile':
171
- {
172
- // Note: 'wx' flag only writes when the file does not exist.
173
- // See https://nodejs.org/api/fs.html#file-system-flags.
174
- // This way tracing never have to write the same resource twice.
175
- if (op.skipIfExists) await _fs.default.promises.writeFile(op.file, op.content, {
176
- flag: 'wx'
177
- }).catch(() => {});else await _fs.default.promises.writeFile(op.file, op.content);
178
- return;
179
- }
180
- case 'copyFile':
181
- {
182
- await _fs.default.promises.copyFile(op.from, op.to);
183
- return;
184
- }
185
- case 'appendFile':
186
- {
187
- await _fs.default.promises.appendFile(op.file, op.content);
188
- return;
189
- }
190
- case 'zip':
191
- {
192
- const zipFile = new _zipBundle.yazl.ZipFile();
193
- const result = new _manualPromise.ManualPromise();
194
- zipFile.on('error', error => result.reject(error));
195
- for (const entry of op.entries) zipFile.addFile(entry.value, entry.name);
196
- zipFile.end();
197
- zipFile.outputStream.pipe(_fs.default.createWriteStream(op.zipFileName)).on('close', () => result.resolve()).on('error', error => result.reject(error));
198
- await result;
199
- return;
200
- }
201
- }
202
- }
203
- }
204
- exports.SerializedFS = SerializedFS;
@@ -1,209 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createConnectionAsync = createConnectionAsync;
7
- exports.createSocket = createSocket;
8
- exports.createTLSSocket = createTLSSocket;
9
- exports.httpsHappyEyeballsAgent = exports.httpHappyEyeballsTimings = exports.httpHappyEyeballsAgent = void 0;
10
- exports.timingForSocket = timingForSocket;
11
- var _dns = _interopRequireDefault(require("dns"));
12
- var _http = _interopRequireDefault(require("http"));
13
- var _https = _interopRequireDefault(require("https"));
14
- var _net = _interopRequireDefault(require("net"));
15
- var _tls = _interopRequireDefault(require("tls"));
16
- var _assert = require("../../utils/isomorphic/assert");
17
- var _manualPromise = require("../../utils/isomorphic/manualPromise");
18
- var _time = require("../../utils/isomorphic/time");
19
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
- // Implementation(partial) of Happy Eyeballs 2 algorithm described in
37
- // https://www.rfc-editor.org/rfc/rfc8305
38
-
39
- // Same as in Chromium (https://source.chromium.org/chromium/chromium/src/+/5666ff4f5077a7e2f72902f3a95f5d553ea0d88d:net/socket/transport_connect_job.cc;l=102)
40
- const connectionAttemptDelayMs = 300;
41
- const checklyTimings = {
42
- values: {
43
- startTimeNow: 0,
44
- socket: 0,
45
- connect: 0,
46
- lookup: 0
47
- },
48
- agent: false
49
- };
50
- const kDNSLookupAt = Symbol('kDNSLookupAt');
51
- const kTCPConnectionAt = Symbol('kTCPConnectionAt');
52
- class HttpHappyEyeballsAgent extends _http.default.Agent {
53
- createConnection(options, oncreate) {
54
- // There is no ambiguity in case of IP address.
55
- if (_net.default.isIP(clientRequestArgsToHostName(options))) return _net.default.createConnection(options);
56
- createConnectionAsync(options, oncreate, /* useTLS */false).catch(err => oncreate === null || oncreate === void 0 ? void 0 : oncreate(err));
57
- }
58
- }
59
- class HttpsHappyEyeballsAgent extends _https.default.Agent {
60
- createConnection(options, oncreate) {
61
- checklyTimings.values.startTimeNow = performance.now();
62
- checklyTimings.agent = true;
63
- // There is no ambiguity in case of IP address.
64
- if (_net.default.isIP(clientRequestArgsToHostName(options))) return _tls.default.connect(options);
65
- createConnectionAsync(options, oncreate, /* useTLS */true).catch(err => oncreate === null || oncreate === void 0 ? void 0 : oncreate(err));
66
- }
67
- }
68
-
69
- // These options are aligned with the default Node.js globalAgent options.
70
- const httpsHappyEyeballsAgent = exports.httpsHappyEyeballsAgent = new HttpsHappyEyeballsAgent({
71
- keepAlive: true
72
- });
73
- const httpHappyEyeballsAgent = exports.httpHappyEyeballsAgent = new HttpHappyEyeballsAgent({
74
- keepAlive: true
75
- });
76
- const httpHappyEyeballsTimings = exports.httpHappyEyeballsTimings = checklyTimings;
77
- async function createSocket(host, port) {
78
- return new Promise((resolve, reject) => {
79
- if (_net.default.isIP(host)) {
80
- const socket = _net.default.createConnection({
81
- host,
82
- port
83
- });
84
- socket.on('connect', () => resolve(socket));
85
- socket.on('error', error => reject(error));
86
- } else {
87
- createConnectionAsync({
88
- host,
89
- port
90
- }, (err, socket) => {
91
- if (err) reject(err);
92
- if (socket) resolve(socket);
93
- }, /* useTLS */false).catch(err => reject(err));
94
- }
95
- });
96
- }
97
- async function createTLSSocket(options) {
98
- return new Promise((resolve, reject) => {
99
- (0, _assert.assert)(options.host, 'host is required');
100
- if (_net.default.isIP(options.host)) {
101
- const socket = _tls.default.connect(options);
102
- socket.on('secureConnect', () => resolve(socket));
103
- socket.on('error', error => reject(error));
104
- } else {
105
- createConnectionAsync(options, (err, socket) => {
106
- if (err) reject(err);
107
- if (socket) {
108
- socket.on('secureConnect', () => resolve(socket));
109
- socket.on('error', error => reject(error));
110
- }
111
- }, true).catch(err => reject(err));
112
- }
113
- });
114
- }
115
- async function createConnectionAsync(options, oncreate, useTLS) {
116
- const lookup = options.__testHookLookup || lookupAddresses;
117
- const hostname = clientRequestArgsToHostName(options);
118
- const addresses = await lookup(hostname);
119
- const dnsLookupAt = (0, _time.monotonicTime)();
120
- const sockets = new Set();
121
- let firstError;
122
- let errorCount = 0;
123
- const handleError = (socket, err) => {
124
- if (!sockets.delete(socket)) return;
125
- ++errorCount;
126
- firstError !== null && firstError !== void 0 ? firstError : firstError = err;
127
- if (errorCount === addresses.length) oncreate === null || oncreate === void 0 || oncreate(firstError);
128
- };
129
- const connected = new _manualPromise.ManualPromise();
130
- for (const {
131
- address
132
- } of addresses) {
133
- const socket = useTLS ? _tls.default.connect({
134
- ...options,
135
- port: options.port,
136
- host: address,
137
- servername: hostname
138
- }) : _net.default.createConnection({
139
- ...options,
140
- port: options.port,
141
- host: address
142
- });
143
-
144
- // Socket created
145
- checklyTimings.values.socket = performance.now() - checklyTimings.values.startTimeNow;
146
- socket[kDNSLookupAt] = dnsLookupAt;
147
-
148
- // Each socket may fire only one of 'connect', 'timeout' or 'error' events.
149
- // None of these events are fired after socket.destroy() is called.
150
- socket.on('connect', () => {
151
- socket[kTCPConnectionAt] = (0, _time.monotonicTime)();
152
- checklyTimings.values.connect = performance.now() - checklyTimings.values.startTimeNow;
153
- connected.resolve();
154
- oncreate === null || oncreate === void 0 || oncreate(null, socket);
155
- // TODO: Cache the result?
156
- // Close other outstanding sockets.
157
- sockets.delete(socket);
158
- for (const s of sockets) s.destroy();
159
- sockets.clear();
160
- });
161
- socket.on('timeout', () => {
162
- // Timeout is not an error, so we have to manually close the socket.
163
- socket.destroy();
164
- handleError(socket, new Error('Connection timeout'));
165
- });
166
- socket.on('error', e => handleError(socket, e));
167
- sockets.add(socket);
168
- await Promise.race([connected, new Promise(f => setTimeout(f, connectionAttemptDelayMs))]);
169
- if (connected.isDone()) break;
170
- }
171
- }
172
- async function lookupAddresses(hostname) {
173
- const addresses = await _dns.default.promises.lookup(hostname, {
174
- all: true,
175
- family: 0,
176
- verbatim: true
177
- });
178
- checklyTimings.values.lookup = performance.now() - checklyTimings.values.startTimeNow;
179
- let firstFamily = addresses.filter(({
180
- family
181
- }) => family === 6);
182
- let secondFamily = addresses.filter(({
183
- family
184
- }) => family === 4);
185
- // Make sure first address in the list is the same as in the original order.
186
- if (firstFamily.length && firstFamily[0] !== addresses[0]) {
187
- const tmp = firstFamily;
188
- firstFamily = secondFamily;
189
- secondFamily = tmp;
190
- }
191
- const result = [];
192
- // Alternate ipv6 and ipv4 addresses.
193
- for (let i = 0; i < Math.max(firstFamily.length, secondFamily.length); i++) {
194
- if (firstFamily[i]) result.push(firstFamily[i]);
195
- if (secondFamily[i]) result.push(secondFamily[i]);
196
- }
197
- return result;
198
- }
199
- function clientRequestArgsToHostName(options) {
200
- if (options.hostname) return options.hostname;
201
- if (options.host) return options.host;
202
- throw new Error('Either options.hostname or options.host must be provided');
203
- }
204
- function timingForSocket(socket) {
205
- return {
206
- dnsLookupAt: socket[kDNSLookupAt],
207
- tcpConnectionAt: socket[kTCPConnectionAt]
208
- };
209
- }
@@ -1,145 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isOfficiallySupportedPlatform = exports.hostPlatform = void 0;
7
- var _os = _interopRequireDefault(require("os"));
8
- var _linuxUtils = require("./linuxUtils");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- /**
11
- * Copyright (c) Microsoft Corporation.
12
- *
13
- * Licensed under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License.
15
- * You may obtain a copy of the License at
16
- *
17
- * http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS,
21
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- * See the License for the specific language governing permissions and
23
- * limitations under the License.
24
- */
25
-
26
- function calculatePlatform() {
27
- if (process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE) {
28
- return {
29
- hostPlatform: process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE,
30
- isOfficiallySupportedPlatform: false
31
- };
32
- }
33
- const platform = _os.default.platform();
34
- if (platform === 'darwin') {
35
- const ver = _os.default.release().split('.').map(a => parseInt(a, 10));
36
- let macVersion = '';
37
- if (ver[0] < 18) {
38
- // Everything before 10.14 is considered 10.13.
39
- macVersion = 'mac10.13';
40
- } else if (ver[0] === 18) {
41
- macVersion = 'mac10.14';
42
- } else if (ver[0] === 19) {
43
- macVersion = 'mac10.15';
44
- } else {
45
- // ver[0] >= 20
46
- const LAST_STABLE_MACOS_MAJOR_VERSION = 15;
47
- // Best-effort support for MacOS beta versions.
48
- macVersion = 'mac' + Math.min(ver[0] - 9, LAST_STABLE_MACOS_MAJOR_VERSION);
49
- // BigSur is the first version that might run on Apple Silicon.
50
- if (_os.default.cpus().some(cpu => cpu.model.includes('Apple'))) macVersion += '-arm64';
51
- }
52
- return {
53
- hostPlatform: macVersion,
54
- isOfficiallySupportedPlatform: true
55
- };
56
- }
57
- if (platform === 'linux') {
58
- if (!['x64', 'arm64'].includes(_os.default.arch())) return {
59
- hostPlatform: '<unknown>',
60
- isOfficiallySupportedPlatform: false
61
- };
62
- const archSuffix = '-' + _os.default.arch();
63
- const distroInfo = (0, _linuxUtils.getLinuxDistributionInfoSync)();
64
-
65
- // Pop!_OS is ubuntu-based and has the same versions.
66
- // KDE Neon is ubuntu-based and has the same versions.
67
- // TUXEDO OS is ubuntu-based and has the same versions.
68
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'ubuntu' || (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'pop' || (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'neon' || (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'tuxedo') {
69
- const isUbuntu = (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'ubuntu';
70
- const version = distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.version;
71
- const major = parseInt(distroInfo.version, 10);
72
- if (major < 20) return {
73
- hostPlatform: 'ubuntu18.04' + archSuffix,
74
- isOfficiallySupportedPlatform: false
75
- };
76
- if (major < 22) return {
77
- hostPlatform: 'ubuntu20.04' + archSuffix,
78
- isOfficiallySupportedPlatform: isUbuntu && version === '20.04'
79
- };
80
- if (major < 24) return {
81
- hostPlatform: 'ubuntu22.04' + archSuffix,
82
- isOfficiallySupportedPlatform: isUbuntu && version === '22.04'
83
- };
84
- if (major < 26) return {
85
- hostPlatform: 'ubuntu24.04' + archSuffix,
86
- isOfficiallySupportedPlatform: isUbuntu && version === '24.04'
87
- };
88
- return {
89
- hostPlatform: 'ubuntu' + distroInfo.version + archSuffix,
90
- isOfficiallySupportedPlatform: false
91
- };
92
- }
93
- // Linux Mint is ubuntu-based but does not have the same versions
94
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'linuxmint') {
95
- const mintMajor = parseInt(distroInfo.version, 10);
96
- if (mintMajor <= 20) return {
97
- hostPlatform: 'ubuntu20.04' + archSuffix,
98
- isOfficiallySupportedPlatform: false
99
- };
100
- if (mintMajor === 21) return {
101
- hostPlatform: 'ubuntu22.04' + archSuffix,
102
- isOfficiallySupportedPlatform: false
103
- };
104
- return {
105
- hostPlatform: 'ubuntu24.04' + archSuffix,
106
- isOfficiallySupportedPlatform: false
107
- };
108
- }
109
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'debian' || (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'raspbian') {
110
- const isOfficiallySupportedPlatform = (distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.id) === 'debian';
111
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.version) === '11') return {
112
- hostPlatform: 'debian11' + archSuffix,
113
- isOfficiallySupportedPlatform
114
- };
115
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.version) === '12') return {
116
- hostPlatform: 'debian12' + archSuffix,
117
- isOfficiallySupportedPlatform
118
- };
119
- // use most recent supported release for 'debian testing' and 'unstable'.
120
- // they never include a numeric version entry in /etc/os-release.
121
- if ((distroInfo === null || distroInfo === void 0 ? void 0 : distroInfo.version) === '') return {
122
- hostPlatform: 'debian12' + archSuffix,
123
- isOfficiallySupportedPlatform
124
- };
125
- }
126
- return {
127
- hostPlatform: 'ubuntu20.04' + archSuffix,
128
- isOfficiallySupportedPlatform: false
129
- };
130
- }
131
- if (platform === 'win32') return {
132
- hostPlatform: 'win64',
133
- isOfficiallySupportedPlatform: true
134
- };
135
- return {
136
- hostPlatform: '<unknown>',
137
- isOfficiallySupportedPlatform: false
138
- };
139
- }
140
- const {
141
- hostPlatform,
142
- isOfficiallySupportedPlatform
143
- } = calculatePlatform();
144
- exports.isOfficiallySupportedPlatform = isOfficiallySupportedPlatform;
145
- exports.hostPlatform = hostPlatform;