appium-geckodriver 2.2.1 → 2.2.3
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/CHANGELOG.md +12 -0
- package/build/lib/commands/find.d.ts +10 -0
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +10 -1
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/driver.d.ts +4 -4
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +13 -17
- package/build/lib/driver.js.map +1 -1
- package/build/lib/gecko.d.ts.map +1 -1
- package/build/lib/gecko.js +24 -18
- package/build/lib/gecko.js.map +1 -1
- package/build/lib/utils.d.ts +2 -2
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +8 -9
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/find.ts +10 -1
- package/lib/driver.ts +17 -17
- package/lib/gecko.ts +28 -21
- package/lib/utils.ts +8 -9
- package/npm-shrinkwrap.json +124 -93
- package/package.json +1 -3
- package/scripts/install-geckodriver.mjs +12 -12
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import * as semver from 'semver';
|
|
3
|
-
import _ from 'lodash';
|
|
4
3
|
import path from 'node:path';
|
|
5
4
|
import { tmpdir } from 'node:os';
|
|
6
5
|
import { log } from '../build/lib/logger.js';
|
|
@@ -21,7 +20,8 @@ const API_TIMEOUT_MS = 45 * 1000;
|
|
|
21
20
|
const STABLE_VERSION = 'stable';
|
|
22
21
|
const EXT_TAR_GZ = '.tar.gz';
|
|
23
22
|
const EXT_ZIP = '.zip';
|
|
24
|
-
const
|
|
23
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
24
|
+
const EXT_REGEXP = new RegExp(`(${escapeRegExp(EXT_TAR_GZ)}|${escapeRegExp(EXT_ZIP)})$`);
|
|
25
25
|
const ARCHIVE_NAME_PREFIX = 'geckodriver-v';
|
|
26
26
|
const ARCH_MAPPING = Object.freeze({
|
|
27
27
|
ia32: '32',
|
|
@@ -56,7 +56,7 @@ function parseNextPageUrl(headers) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
for (const part of headers.link.split(';')) {
|
|
59
|
-
const [rel, pageUrl] = part.split(',').map(
|
|
59
|
+
const [rel, pageUrl] = part.split(',').map((item) => item.trim());
|
|
60
60
|
if (rel === 'rel="next"' && pageUrl) {
|
|
61
61
|
return pageUrl.replace(/^<|>$/g, '');
|
|
62
62
|
}
|
|
@@ -123,8 +123,8 @@ async function listReleases() {
|
|
|
123
123
|
const assetName = asset?.name;
|
|
124
124
|
const downloadUrl = asset?.browser_download_url;
|
|
125
125
|
if (
|
|
126
|
-
!
|
|
127
|
-
|| !(
|
|
126
|
+
!assetName?.startsWith(ARCHIVE_NAME_PREFIX)
|
|
127
|
+
|| !(assetName?.endsWith(EXT_TAR_GZ) || assetName?.endsWith(EXT_ZIP))
|
|
128
128
|
|| !downloadUrl
|
|
129
129
|
) {
|
|
130
130
|
continue;
|
|
@@ -154,7 +154,7 @@ function selectRelease(releases, version) {
|
|
|
154
154
|
const stableReleasesAsc = releases
|
|
155
155
|
.filter(({isDraft, isPrerelease}) => !isDraft && !isPrerelease)
|
|
156
156
|
.toSorted((a, b) => a.version.compare(b.version));
|
|
157
|
-
const dstRelease =
|
|
157
|
+
const dstRelease = stableReleasesAsc.at(-1);
|
|
158
158
|
if (!dstRelease) {
|
|
159
159
|
throw new Error(`Cannot find any stable GeckoDriver release: ${JSON.stringify(releases)}`);
|
|
160
160
|
}
|
|
@@ -180,7 +180,7 @@ function selectRelease(releases, version) {
|
|
|
180
180
|
* @returns {ReleaseAsset}
|
|
181
181
|
*/
|
|
182
182
|
function selectAsset(release) {
|
|
183
|
-
if (
|
|
183
|
+
if (release.assets.length === 0) {
|
|
184
184
|
throw new Error(`GeckoDriver v${release.version} does not contain any matching releases`);
|
|
185
185
|
}
|
|
186
186
|
const dstPlatform = PLATFORM_MAPPING[process.platform];
|
|
@@ -189,7 +189,7 @@ function selectAsset(release) {
|
|
|
189
189
|
/** @type {(filterFunc: (string) => boolean) => null|ReleaseAsset} */
|
|
190
190
|
const findAssetMatch = (filterFunc) => {
|
|
191
191
|
for (const asset of release.assets) {
|
|
192
|
-
if (!dstPlatform || !
|
|
192
|
+
if (!dstPlatform || !asset.name.includes(`-${dstPlatform}`)) {
|
|
193
193
|
continue;
|
|
194
194
|
}
|
|
195
195
|
const nameWoExt = asset.name.replace(EXT_REGEXP, '');
|
|
@@ -203,8 +203,8 @@ function selectAsset(release) {
|
|
|
203
203
|
// Try to find an exact match
|
|
204
204
|
const exactMatch = findAssetMatch(
|
|
205
205
|
(nameWoExt) =>
|
|
206
|
-
(dstArch === 'aarch64' &&
|
|
207
|
-
|| (['64', '32'].includes(dstArch) &&
|
|
206
|
+
(dstArch === 'aarch64' && nameWoExt.endsWith(`-${dstArch}`))
|
|
207
|
+
|| (['64', '32'].includes(dstArch) && nameWoExt.endsWith(`-${dstPlatform}${dstArch}`))
|
|
208
208
|
);
|
|
209
209
|
if (exactMatch) {
|
|
210
210
|
return exactMatch;
|
|
@@ -212,8 +212,8 @@ function selectAsset(release) {
|
|
|
212
212
|
// If no exact match has been been found then try a loose one
|
|
213
213
|
const looseMatch = findAssetMatch(
|
|
214
214
|
(nameWoExt) =>
|
|
215
|
-
|
|
216
|
-
|| (dstArch === '64' &&
|
|
215
|
+
nameWoExt.endsWith(`-${dstPlatform}`)
|
|
216
|
+
|| (dstArch === '64' && nameWoExt.endsWith(`-${dstPlatform}32`))
|
|
217
217
|
);
|
|
218
218
|
if (looseMatch) {
|
|
219
219
|
return looseMatch;
|