appium-chromedriver 8.4.21 → 9.0.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 (60) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/lib/chromedriver.d.ts +4 -4
  3. package/build/lib/chromedriver.d.ts.map +1 -1
  4. package/build/lib/chromedriver.js +42 -49
  5. package/build/lib/chromedriver.js.map +1 -1
  6. package/build/lib/commands/binary.d.ts +2 -2
  7. package/build/lib/commands/binary.d.ts.map +1 -1
  8. package/build/lib/commands/binary.js +29 -72
  9. package/build/lib/commands/binary.js.map +1 -1
  10. package/build/lib/commands/process.d.ts +1 -1
  11. package/build/lib/commands/process.d.ts.map +1 -1
  12. package/build/lib/commands/process.js +14 -20
  13. package/build/lib/commands/process.js.map +1 -1
  14. package/build/lib/commands/session.d.ts +1 -1
  15. package/build/lib/commands/session.d.ts.map +1 -1
  16. package/build/lib/commands/session.js +25 -66
  17. package/build/lib/commands/session.js.map +1 -1
  18. package/build/lib/commands/types.d.ts +2 -2
  19. package/build/lib/commands/types.d.ts.map +1 -1
  20. package/build/lib/commands/types.js +1 -2
  21. package/build/lib/commands/version.d.ts +1 -1
  22. package/build/lib/commands/version.d.ts.map +1 -1
  23. package/build/lib/commands/version.js +6 -42
  24. package/build/lib/commands/version.js.map +1 -1
  25. package/build/lib/constants.js +10 -13
  26. package/build/lib/constants.js.map +1 -1
  27. package/build/lib/index.d.ts +3 -3
  28. package/build/lib/index.d.ts.map +1 -1
  29. package/build/lib/index.js +4 -8
  30. package/build/lib/index.js.map +1 -1
  31. package/build/lib/storage-client/chromelabs.d.ts +1 -1
  32. package/build/lib/storage-client/chromelabs.d.ts.map +1 -1
  33. package/build/lib/storage-client/chromelabs.js +11 -51
  34. package/build/lib/storage-client/chromelabs.js.map +1 -1
  35. package/build/lib/storage-client/googleapis.d.ts +1 -1
  36. package/build/lib/storage-client/googleapis.d.ts.map +1 -1
  37. package/build/lib/storage-client/googleapis.js +22 -30
  38. package/build/lib/storage-client/googleapis.js.map +1 -1
  39. package/build/lib/storage-client/storage-client.d.ts +1 -1
  40. package/build/lib/storage-client/storage-client.d.ts.map +1 -1
  41. package/build/lib/storage-client/storage-client.js +65 -105
  42. package/build/lib/storage-client/storage-client.js.map +1 -1
  43. package/build/lib/types.js +1 -2
  44. package/build/lib/utils.d.ts +2 -2
  45. package/build/lib/utils.d.ts.map +1 -1
  46. package/build/lib/utils.js +41 -52
  47. package/build/lib/utils.js.map +1 -1
  48. package/config/mapping.json +1 -0
  49. package/lib/chromedriver.ts +8 -8
  50. package/lib/commands/binary.ts +3 -3
  51. package/lib/commands/process.ts +2 -2
  52. package/lib/commands/session.ts +3 -3
  53. package/lib/commands/types.ts +2 -2
  54. package/lib/commands/version.ts +2 -2
  55. package/lib/index.ts +3 -3
  56. package/lib/storage-client/chromelabs.ts +2 -2
  57. package/lib/storage-client/googleapis.ts +9 -3
  58. package/lib/storage-client/storage-client.ts +5 -5
  59. package/lib/utils.ts +7 -5
  60. package/package.json +12 -3
@@ -1,23 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getOsInfo = exports.getCpuType = exports.getOsName = exports.CD_VER = exports.CD_BASE_DIR = exports.CHROMEDRIVER_CHROME_MAPPING = void 0;
7
- exports.getMostRecentChromedriver = getMostRecentChromedriver;
8
- exports.getChromeVersion = getChromeVersion;
9
- exports.getChromedriverDir = getChromedriverDir;
10
- exports.getChromedriverBinaryPath = getChromedriverBinaryPath;
11
- exports.retrieveData = retrieveData;
12
- exports.generateLogPrefix = generateLogPrefix;
13
- exports.convertToInt = convertToInt;
14
- const support_1 = require("@appium/support");
15
- const base_driver_1 = require("@appium/base-driver");
16
- const node_path_1 = __importDefault(require("node:path"));
17
- const compare_versions_1 = require("compare-versions");
18
- const axios_1 = __importDefault(require("axios"));
19
- const node_os_1 = __importDefault(require("node:os"));
20
- const constants_1 = require("./constants");
1
+ import { system, fs, node, util } from '@appium/support';
2
+ import { BaseDriver } from '@appium/base-driver';
3
+ import path from 'node:path';
4
+ import { readFileSync } from 'node:fs';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { compareVersions } from 'compare-versions';
7
+ import axios from 'axios';
8
+ import os from 'node:os';
9
+ import { OS, CPU } from './constants.js';
21
10
  const CD_EXECUTABLE_PREFIX = 'chromedriver';
22
11
  const MODULE_NAME = 'appium-chromedriver';
23
12
  /**
@@ -25,30 +14,30 @@ const MODULE_NAME = 'appium-chromedriver';
25
14
  * @returns The full path to module root
26
15
  * @throws {Error} If the current module root folder cannot be determined
27
16
  */
28
- const getModuleRoot = support_1.util.memoize(function getModuleRoot() {
29
- const root = support_1.node.getModuleRootSync(MODULE_NAME, __filename);
17
+ const getModuleRoot = util.memoize(function getModuleRoot() {
18
+ const root = node.getModuleRootSync(MODULE_NAME, fileURLToPath(import.meta.url));
30
19
  if (!root) {
31
20
  throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
32
21
  }
33
22
  return root;
34
23
  });
35
24
  // Chromedriver version: minimum Chrome version
36
- exports.CHROMEDRIVER_CHROME_MAPPING = require(node_path_1.default.join(getModuleRoot(), 'config', 'mapping.json'));
37
- exports.CD_BASE_DIR = node_path_1.default.join(getModuleRoot(), 'chromedriver');
25
+ export const CHROMEDRIVER_CHROME_MAPPING = JSON.parse(readFileSync(path.join(getModuleRoot(), 'config', 'mapping.json'), 'utf8'));
26
+ export const CD_BASE_DIR = path.join(getModuleRoot(), 'chromedriver');
38
27
  /**
39
28
  * Gets the most recent Chromedriver version from the mapping.
40
29
  * @param mapping - The Chromedriver version mapping (defaults to the static mapping).
41
30
  * @returns The most recent version string.
42
31
  * @throws {Error} If the mapping is empty.
43
32
  */
44
- function getMostRecentChromedriver(mapping = exports.CHROMEDRIVER_CHROME_MAPPING) {
45
- if (support_1.util.isEmpty(mapping)) {
33
+ export function getMostRecentChromedriver(mapping = CHROMEDRIVER_CHROME_MAPPING) {
34
+ if (util.isEmpty(mapping)) {
46
35
  throw new Error('Unable to get most recent Chromedriver version from empty mapping');
47
36
  }
48
- const sorted = Object.keys(mapping).sort(compare_versions_1.compareVersions);
37
+ const sorted = Object.keys(mapping).sort(compareVersions);
49
38
  return sorted.at(-1);
50
39
  }
51
- exports.CD_VER = process.env.npm_config_chromedriver_version ||
40
+ export const CD_VER = process.env.npm_config_chromedriver_version ||
52
41
  process.env.CHROMEDRIVER_VERSION ||
53
42
  getMostRecentChromedriver();
54
43
  /**
@@ -57,7 +46,7 @@ exports.CD_VER = process.env.npm_config_chromedriver_version ||
57
46
  * @param bundleId - The bundle ID of the Chrome/WebView app.
58
47
  * @returns The version name string, or undefined if not found.
59
48
  */
60
- async function getChromeVersion(adb, bundleId) {
49
+ export async function getChromeVersion(adb, bundleId) {
61
50
  const { versionName } = await adb.getPackageInfo(bundleId);
62
51
  return versionName;
63
52
  }
@@ -66,24 +55,24 @@ async function getChromeVersion(adb, bundleId) {
66
55
  * @param osName - The OS name (defaults to the current OS).
67
56
  * @returns The full path to the Chromedriver directory.
68
57
  */
69
- function getChromedriverDir(osName = (0, exports.getOsName)()) {
70
- return node_path_1.default.resolve(exports.CD_BASE_DIR, osName);
58
+ export function getChromedriverDir(osName = getOsName()) {
59
+ return path.resolve(CD_BASE_DIR, osName);
71
60
  }
72
61
  /**
73
62
  * Gets the path to the Chromedriver binary for a given OS.
74
63
  * @param osName - The OS name (defaults to the current OS).
75
64
  * @returns The full path to the Chromedriver binary.
76
65
  */
77
- async function getChromedriverBinaryPath(osName = (0, exports.getOsName)()) {
66
+ export async function getChromedriverBinaryPath(osName = getOsName()) {
78
67
  const rootDir = getChromedriverDir(osName);
79
- const pathSuffix = osName === constants_1.OS.WINDOWS ? '.exe' : '';
80
- const paths = await support_1.fs.glob(`${CD_EXECUTABLE_PREFIX}*${pathSuffix}`, {
68
+ const pathSuffix = osName === OS.WINDOWS ? '.exe' : '';
69
+ const paths = await fs.glob(`${CD_EXECUTABLE_PREFIX}*${pathSuffix}`, {
81
70
  cwd: rootDir,
82
71
  absolute: true,
83
72
  nocase: true,
84
73
  nodir: true,
85
74
  });
86
- return paths[0] ?? node_path_1.default.resolve(rootDir, `${CD_EXECUTABLE_PREFIX}${pathSuffix}`);
75
+ return paths[0] ?? path.resolve(rootDir, `${CD_EXECUTABLE_PREFIX}${pathSuffix}`);
87
76
  }
88
77
  /**
89
78
  * Retrieves data from a URL using axios.
@@ -92,9 +81,9 @@ async function getChromedriverBinaryPath(osName = (0, exports.getOsName)()) {
92
81
  * @param opts - Optional configuration (timeout, responseType).
93
82
  * @returns The response data.
94
83
  */
95
- async function retrieveData(url, headers, opts = {}) {
84
+ export async function retrieveData(url, headers, opts = {}) {
96
85
  const { timeout = 5000, responseType = 'text' } = opts;
97
- return (await (0, axios_1.default)({
86
+ return (await axios({
98
87
  url,
99
88
  headers,
100
89
  timeout,
@@ -105,44 +94,44 @@ async function retrieveData(url, headers, opts = {}) {
105
94
  * Gets the OS name for the current system.
106
95
  * @returns The OS name ('win', 'mac', or 'linux').
107
96
  */
108
- exports.getOsName = support_1.util.memoize(function getOsName() {
109
- if (support_1.system.isWindows()) {
110
- return constants_1.OS.WINDOWS;
97
+ export const getOsName = util.memoize(function getOsName() {
98
+ if (system.isWindows()) {
99
+ return OS.WINDOWS;
111
100
  }
112
- if (support_1.system.isMac()) {
113
- return constants_1.OS.MAC;
101
+ if (system.isMac()) {
102
+ return OS.MAC;
114
103
  }
115
- return constants_1.OS.LINUX;
104
+ return OS.LINUX;
116
105
  });
117
106
  /**
118
107
  * Gets the CPU type for the current system.
119
108
  * @returns The CPU type ('intel' or 'arm').
120
109
  */
121
- exports.getCpuType = support_1.util.memoize(function getCpuType() {
122
- return node_os_1.default.cpus()[0]?.model.toLowerCase().includes('apple') ? constants_1.CPU.ARM : constants_1.CPU.INTEL;
110
+ export const getCpuType = util.memoize(function getCpuType() {
111
+ return os.cpus()[0]?.model.toLowerCase().includes('apple') ? CPU.ARM : CPU.INTEL;
123
112
  });
124
113
  /**
125
114
  * Gets OS information including name, architecture, and CPU type.
126
115
  * @returns A promise that resolves to OS information.
127
116
  */
128
- exports.getOsInfo = support_1.util.memoize(async function getOsInfo() {
117
+ export const getOsInfo = util.memoize(async function getOsInfo() {
129
118
  return {
130
- name: (0, exports.getOsName)(),
131
- arch: String(await support_1.system.arch()),
132
- cpu: (0, exports.getCpuType)(),
119
+ name: getOsName(),
120
+ arch: String(await system.arch()),
121
+ cpu: getCpuType(),
133
122
  };
134
123
  });
135
124
  // @ts-expect-error to avoid error
136
125
  // TS2345: Argument of type '{}' is not assignable to parameter of type 'DriverOpts<Readonly<Record<string, Constraint>>>'
137
126
  // Type '{}' is missing the following properties from type 'ServerArgs': address, allowCors, allowInsecure, basePath, and 26 more.
138
- const getBaseDriverInstance = support_1.util.memoize(() => new base_driver_1.BaseDriver({}, false));
127
+ const getBaseDriverInstance = util.memoize(() => new BaseDriver({}, false));
139
128
  /**
140
129
  * Generates log prefix string.
141
130
  * @param obj - Log owner instance.
142
131
  * @param sessionId - Optional session identifier.
143
132
  * @returns The generated log prefix string.
144
133
  */
145
- function generateLogPrefix(obj, sessionId = null) {
134
+ export function generateLogPrefix(obj, sessionId = null) {
146
135
  return getBaseDriverInstance().helpers.generateDriverLogPrefix(obj, sessionId ? sessionId : undefined);
147
136
  }
148
137
  /**
@@ -150,7 +139,7 @@ function generateLogPrefix(obj, sessionId = null) {
150
139
  * @param value - The value to be converted.
151
140
  * @returns The integer value or null if conversion is not possible.
152
141
  */
153
- function convertToInt(value) {
142
+ export function convertToInt(value) {
154
143
  switch (typeof value) {
155
144
  case 'number':
156
145
  return Number.isNaN(value) ? null : value;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;;;;AAuCA,8DAQC;AAaD,4CAGC;AAOD,gDAEC;AAOD,8D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C,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5C,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACxC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;QACxD,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  {
2
+ "151.0.7922.47": "151.0.7922.47",
2
3
  "151.0.7922.34": "151.0.7922.34",
3
4
  "150.0.7871.124": "150.0.7871.124",
4
5
  "150.0.7871.115": "150.0.7871.115",
@@ -2,29 +2,29 @@ import events from 'node:events';
2
2
  import {JWProxy, PROTOCOLS} from '@appium/base-driver';
3
3
  import {logger, util} from '@appium/support';
4
4
  import {SubProcess, exec} from 'teen_process';
5
- import {getChromedriverDir, generateLogPrefix} from './utils';
6
- import {ChromedriverStorageClient} from './storage-client/storage-client';
7
- import {CHROMEDRIVER_EVENTS, CHROMEDRIVER_STATES} from './constants';
5
+ import {getChromedriverDir, generateLogPrefix} from './utils.js';
6
+ import {ChromedriverStorageClient} from './storage-client/storage-client.js';
7
+ import {CHROMEDRIVER_EVENTS, CHROMEDRIVER_STATES} from './constants.js';
8
8
  import {
9
9
  getDriversMapping,
10
10
  getChromedrivers,
11
11
  updateDriversMapping,
12
12
  getCompatibleChromedriver,
13
13
  initChromedriverPath,
14
- } from './commands/binary';
15
- import {getChromeVersionForAutodetection} from './commands/version';
16
- import {buildChromedriverArgs, waitForOnline, getStatus, killAll} from './commands/process';
14
+ } from './commands/binary.js';
15
+ import {getChromeVersionForAutodetection} from './commands/version.js';
16
+ import {buildChromedriverArgs, waitForOnline, getStatus, killAll} from './commands/process.js';
17
17
  import {
18
18
  syncProtocol,
19
19
  startSession,
20
20
  changeState,
21
21
  getCapValue,
22
22
  type SessionCapabilities,
23
- } from './commands/session';
23
+ } from './commands/session.js';
24
24
  import type {ADB} from 'appium-adb';
25
25
  import type {ProxyOptions, HTTPMethod, HTTPBody} from '@appium/types';
26
26
  import type {Request, Response} from 'express';
27
- import type {ChromedriverOpts} from './types';
27
+ import type {ChromedriverOpts} from './types.js';
28
28
 
29
29
  // Keep this import marked as used at runtime when it is otherwise only referenced in type positions.
30
30
  void PROTOCOLS;
@@ -4,9 +4,9 @@ import {compareVersions} from 'compare-versions';
4
4
  import {type ExecError} from 'teen_process';
5
5
  import path from 'node:path';
6
6
  import * as semver from 'semver';
7
- import {CHROMEDRIVER_CHROME_MAPPING, getChromedriverBinaryPath} from '../utils';
8
- import type {ChromedriverVersionMapping} from '../types';
9
- import type {ChromedriverCommandContext} from './types';
7
+ import {CHROMEDRIVER_CHROME_MAPPING, getChromedriverBinaryPath} from '../utils.js';
8
+ import type {ChromedriverVersionMapping} from '../types.js';
9
+ import type {ChromedriverCommandContext} from './types.js';
10
10
 
11
11
  const NEW_CD_VERSION_FORMAT_MAJOR_VERSION = 73;
12
12
  const CD_VERSION_TIMEOUT = 5000;
@@ -1,8 +1,8 @@
1
1
  import {system, util} from '@appium/support';
2
2
  import {retryInterval} from 'asyncbox';
3
3
  import {exec} from 'teen_process';
4
- import {CHROMEDRIVER_STATES} from '../constants';
5
- import type {ChromedriverCommandContext} from './types';
4
+ import {CHROMEDRIVER_STATES} from '../constants.js';
5
+ import type {ChromedriverCommandContext} from './types.js';
6
6
 
7
7
  const VERSION_PATTERN = /([\d.]+)/;
8
8
 
@@ -1,9 +1,9 @@
1
1
  import {PROTOCOLS, isStandardCap} from '@appium/base-driver';
2
2
  import {util} from '@appium/support';
3
- import {generateLogPrefix} from '../utils';
4
- import {CHROMEDRIVER_EVENTS, CHROMEDRIVER_STATES} from '../constants';
3
+ import {generateLogPrefix} from '../utils.js';
4
+ import {CHROMEDRIVER_EVENTS, CHROMEDRIVER_STATES} from '../constants.js';
5
5
  import * as semver from 'semver';
6
- import type {ChromedriverCommandContext} from './types';
6
+ import type {ChromedriverCommandContext} from './types.js';
7
7
 
8
8
  const MIN_CD_VERSION_WITH_W3C_SUPPORT = 75;
9
9
  const W3C_PREFIX = 'goog:';
@@ -4,8 +4,8 @@ import {PROTOCOLS, type JWProxy} from '@appium/base-driver';
4
4
  import type * as TeenProcess from 'teen_process';
5
5
  import type {ADB} from 'appium-adb';
6
6
  import type {AppiumLogger} from '@appium/types';
7
- import type {ChromedriverOpts} from '../types';
8
- import type {ChromedriverStorageClient} from '../storage-client/storage-client';
7
+ import type {ChromedriverOpts} from '../types.js';
8
+ import type {ChromedriverStorageClient} from '../storage-client/storage-client.js';
9
9
  import type {EventEmitter} from 'node:events';
10
10
 
11
11
  export interface ChromedriverCommandContext extends EventEmitter {
@@ -1,6 +1,6 @@
1
1
  import * as semver from 'semver';
2
- import {getChromeVersion} from '../utils';
3
- import type {ChromedriverCommandContext} from './types';
2
+ import {getChromeVersion} from '../utils.js';
3
+ import type {ChromedriverCommandContext} from './types.js';
4
4
 
5
5
  const CHROME_BUNDLE_ID = 'com.android.chrome';
6
6
  const WEBVIEW_SHELL_BUNDLE_ID = 'org.chromium.webview_shell';
package/lib/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {Chromedriver} from './chromedriver';
2
- export {ChromedriverStorageClient} from './storage-client/storage-client';
1
+ import {Chromedriver} from './chromedriver.js';
2
+ export {ChromedriverStorageClient} from './storage-client/storage-client.js';
3
3
  export default Chromedriver;
4
4
  export {Chromedriver};
5
- export type * from './types';
5
+ export type * from './types.js';
@@ -1,8 +1,8 @@
1
1
  import path from 'node:path';
2
2
  import {logger} from '@appium/support';
3
3
  import * as semver from 'semver';
4
- import {ARCH, CPU} from '../constants';
5
- import type {ChromedriverDetailsMapping} from '../types';
4
+ import {ARCH, CPU} from '../constants.js';
5
+ import type {ChromedriverDetailsMapping} from '../types.js';
6
6
 
7
7
  interface VersionEntry {
8
8
  version: string;
@@ -1,15 +1,21 @@
1
1
  import {select as xpathSelect} from 'xpath';
2
2
  import {util, logger} from '@appium/support';
3
- import {retrieveData} from '../utils';
3
+ import {retrieveData} from '../utils.js';
4
4
  import {asyncmap} from 'asyncbox';
5
- import {STORAGE_REQ_TIMEOUT_MS, GOOGLEAPIS_CDN, ARCH, CPU, APPLE_ARM_SUFFIXES} from '../constants';
5
+ import {
6
+ STORAGE_REQ_TIMEOUT_MS,
7
+ GOOGLEAPIS_CDN,
8
+ ARCH,
9
+ CPU,
10
+ APPLE_ARM_SUFFIXES,
11
+ } from '../constants.js';
6
12
  import {DOMParser} from '@xmldom/xmldom';
7
13
  import path from 'node:path';
8
14
  import type {
9
15
  AdditionalDriverDetails,
10
16
  ChromedriverDetails,
11
17
  ChromedriverDetailsMapping,
12
- } from '../types';
18
+ } from '../types.js';
13
19
 
14
20
  const log = logger.getLogger('ChromedriverGoogleapisStorageClient');
15
21
  const MAX_PARALLEL_DOWNLOADS = 5;
@@ -1,4 +1,4 @@
1
- import {getChromedriverDir, retrieveData, getOsInfo, convertToInt, getCpuType} from '../utils';
1
+ import {getChromedriverDir, retrieveData, getOsInfo, convertToInt, getCpuType} from '../utils.js';
2
2
  import path from 'node:path';
3
3
  import {asyncmap} from 'asyncbox';
4
4
  import {system, fs, logger, tempDir, zip, util, net} from '@appium/support';
@@ -10,12 +10,12 @@ import {
10
10
  ARCH,
11
11
  OS,
12
12
  CPU,
13
- } from '../constants';
14
- import {parseGoogleapiStorageXml} from './googleapis';
13
+ } from '../constants.js';
14
+ import {parseGoogleapiStorageXml} from './googleapis.js';
15
15
  import {
16
16
  parseKnownGoodVersionsWithDownloadsJson,
17
17
  parseLatestKnownGoodVersionsJson,
18
- } from './chromelabs';
18
+ } from './chromelabs.js';
19
19
  import {compareVersions} from 'compare-versions';
20
20
  import * as semver from 'semver';
21
21
  import type {
@@ -23,7 +23,7 @@ import type {
23
23
  SyncOptions,
24
24
  OSInfo,
25
25
  ChromedriverDetailsMapping,
26
- } from '../types';
26
+ } from '../types.js';
27
27
 
28
28
  const MAX_PARALLEL_DOWNLOADS = 5;
29
29
 
package/lib/utils.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  import {system, fs, node, util} from '@appium/support';
2
2
  import {BaseDriver} from '@appium/base-driver';
3
3
  import path from 'node:path';
4
+ import {readFileSync} from 'node:fs';
5
+ import {fileURLToPath} from 'node:url';
4
6
  import {compareVersions} from 'compare-versions';
5
7
  import axios from 'axios';
6
8
  import type {AxiosRequestConfig} from 'axios';
7
9
  import os from 'node:os';
8
- import {OS, CPU} from './constants';
10
+ import {OS, CPU} from './constants.js';
9
11
  import type {ADB} from 'appium-adb';
10
- import type {ChromedriverVersionMapping, OSInfo} from './types';
12
+ import type {ChromedriverVersionMapping, OSInfo} from './types.js';
11
13
 
12
14
  const CD_EXECUTABLE_PREFIX = 'chromedriver';
13
15
  const MODULE_NAME = 'appium-chromedriver';
@@ -18,7 +20,7 @@ const MODULE_NAME = 'appium-chromedriver';
18
20
  * @throws {Error} If the current module root folder cannot be determined
19
21
  */
20
22
  const getModuleRoot = util.memoize(function getModuleRoot(): string {
21
- const root = node.getModuleRootSync(MODULE_NAME, __filename);
23
+ const root = node.getModuleRootSync(MODULE_NAME, fileURLToPath(import.meta.url));
22
24
  if (!root) {
23
25
  throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
24
26
  }
@@ -26,8 +28,8 @@ const getModuleRoot = util.memoize(function getModuleRoot(): string {
26
28
  });
27
29
 
28
30
  // Chromedriver version: minimum Chrome version
29
- export const CHROMEDRIVER_CHROME_MAPPING: ChromedriverVersionMapping = require(
30
- path.join(getModuleRoot(), 'config', 'mapping.json'),
31
+ export const CHROMEDRIVER_CHROME_MAPPING: ChromedriverVersionMapping = JSON.parse(
32
+ readFileSync(path.join(getModuleRoot(), 'config', 'mapping.json'), 'utf8'),
31
33
  );
32
34
  export const CD_BASE_DIR = path.join(getModuleRoot(), 'chromedriver');
33
35
 
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "chrome",
7
7
  "android"
8
8
  ],
9
- "version": "8.4.21",
9
+ "version": "9.0.0",
10
10
  "author": "Appium Contributors",
11
11
  "license": "Apache-2.0",
12
12
  "repository": {
@@ -26,6 +26,7 @@
26
26
  "singleQuote": true
27
27
  },
28
28
  "main": "./build/lib/index.js",
29
+ "type": "module",
29
30
  "directories": {
30
31
  "lib": "lib"
31
32
  },
@@ -36,6 +37,13 @@
36
37
  "CHANGELOG.md"
37
38
  ],
38
39
  "types": "./build/lib/index.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./build/lib/index.d.ts",
43
+ "import": "./build/lib/index.js"
44
+ },
45
+ "./package.json": "./package.json"
46
+ },
39
47
  "dependencies": {
40
48
  "@appium/base-driver": "^10.0.0-rc.2",
41
49
  "@appium/support": "^7.2.2",
@@ -57,8 +65,8 @@
57
65
  "prepare": "npm run build",
58
66
  "format": "prettier -w ./lib ./test",
59
67
  "format:check": "prettier --check ./lib ./test",
60
- "test": "node --test --test-force-exit --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
61
- "e2e-test": "node --test --test-force-exit --test-concurrency=1 --test-timeout=600000 \"./build/test/functional/**/*.spec.js\""
68
+ "test": "node --enable-source-maps --test --test-force-exit --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
69
+ "e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=600000 \"./build/test/functional/**/*.spec.js\""
62
70
  },
63
71
  "devDependencies": {
64
72
  "@appium/eslint-config-appium-ts": "^3.0.0",
@@ -74,6 +82,7 @@
74
82
  "chai": "^6.0.0",
75
83
  "chai-as-promised": "^8.0.0",
76
84
  "conventional-changelog-conventionalcommits": "^9.3.1",
85
+ "esmock": "^2.7.6",
77
86
  "prettier": "^3.0.0",
78
87
  "semantic-release": "^25.0.2",
79
88
  "sinon": "^22.0.0",