appium 3.5.2 → 3.6.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.
- package/build/lib/appium.d.ts +3 -4
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +10 -19
- package/build/lib/appium.js.map +1 -1
- package/build/lib/bidi-commands.d.ts +2 -2
- package/build/lib/bidi-commands.d.ts.map +1 -1
- package/build/lib/bidi-commands.js +4 -4
- package/build/lib/bidi-commands.js.map +1 -1
- package/build/lib/bootstrap/appium-initializer.d.ts.map +1 -1
- package/build/lib/bootstrap/appium-initializer.js +12 -16
- package/build/lib/bootstrap/appium-initializer.js.map +1 -1
- package/build/lib/bootstrap/appium-main-runner.d.ts +1 -1
- package/build/lib/bootstrap/appium-main-runner.d.ts.map +1 -1
- package/build/lib/bootstrap/appium-main-runner.js +2 -2
- package/build/lib/bootstrap/appium-main-runner.js.map +1 -1
- package/build/lib/bootstrap/config-file.d.ts +1 -1
- package/build/lib/bootstrap/config-file.d.ts.map +1 -1
- package/build/lib/bootstrap/config-file.js +13 -15
- package/build/lib/bootstrap/config-file.js.map +1 -1
- package/build/lib/bootstrap/grid-v3-register.d.ts.map +1 -1
- package/build/lib/bootstrap/grid-v3-register.js +7 -14
- package/build/lib/bootstrap/grid-v3-register.js.map +1 -1
- package/build/lib/bootstrap/init-types.d.ts +1 -1
- package/build/lib/bootstrap/init-types.d.ts.map +1 -1
- package/build/lib/bootstrap/main-helpers.d.ts +1 -1
- package/build/lib/bootstrap/main-helpers.d.ts.map +1 -1
- package/build/lib/bootstrap/main-helpers.js +5 -6
- package/build/lib/bootstrap/main-helpers.js.map +1 -1
- package/build/lib/bootstrap/node-helpers.d.ts +1 -1
- package/build/lib/bootstrap/node-helpers.d.ts.map +1 -1
- package/build/lib/bootstrap/node-helpers.js +6 -8
- package/build/lib/bootstrap/node-helpers.js.map +1 -1
- package/build/lib/bootstrap/startup-config.d.ts.map +1 -1
- package/build/lib/bootstrap/startup-config.js.map +1 -1
- package/build/lib/cli/args.d.ts +2 -4
- package/build/lib/cli/args.d.ts.map +1 -1
- package/build/lib/cli/args.js +3 -6
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +2 -2
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +4 -7
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +3 -20
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +32 -56
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +10 -15
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/plugin-command.d.ts +2 -2
- package/build/lib/cli/plugin-command.d.ts.map +1 -1
- package/build/lib/cli/plugin-command.js +4 -7
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/cli/setup-command.d.ts.map +1 -1
- package/build/lib/cli/setup-command.js +2 -2
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/doctor/doctor.js +1 -4
- package/build/lib/doctor/doctor.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +1 -1
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +2 -4
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +1 -1
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +10 -10
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +3 -5
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
- package/build/lib/extension/manifest-migrations.js.map +1 -1
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +2 -2
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +1 -2
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/helpers/build.d.ts.map +1 -1
- package/build/lib/helpers/build.js +1 -1
- package/build/lib/helpers/build.js.map +1 -1
- package/build/lib/helpers/capability.d.ts.map +1 -1
- package/build/lib/helpers/capability.js +2 -4
- package/build/lib/helpers/capability.js.map +1 -1
- package/build/lib/helpers/network.d.ts.map +1 -1
- package/build/lib/helpers/network.js +1 -3
- package/build/lib/helpers/network.js.map +1 -1
- package/build/lib/insecure-features.d.ts +1 -1
- package/build/lib/insecure-features.d.ts.map +1 -1
- package/build/lib/insecure-features.js +2 -6
- package/build/lib/insecure-features.js.map +1 -1
- package/build/lib/inspector-commands.d.ts.map +1 -1
- package/build/lib/inspector-commands.js +6 -16
- package/build/lib/inspector-commands.js.map +1 -1
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +5 -9
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.d.ts.map +1 -1
- package/build/lib/schema/arg-spec.js.map +1 -1
- package/build/lib/schema/cli-args-guards.d.ts +1 -1
- package/build/lib/schema/cli-args-guards.d.ts.map +1 -1
- package/build/lib/schema/cli-args-guards.js.map +1 -1
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +2 -2
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/cli-transformers.d.ts.map +1 -1
- package/build/lib/schema/cli-transformers.js +2 -4
- package/build/lib/schema/cli-transformers.js.map +1 -1
- package/build/lib/schema/format-errors.d.ts +1 -1
- package/build/lib/schema/format-errors.d.ts.map +1 -1
- package/build/lib/schema/format-errors.js.map +1 -1
- package/build/lib/schema/index.d.ts +2 -2
- package/build/lib/schema/index.d.ts.map +1 -1
- package/build/lib/schema/index.js +2 -2
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/keywords.d.ts.map +1 -1
- package/build/lib/schema/keywords.js.map +1 -1
- package/build/lib/schema/schema.d.ts +1 -1
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +5 -7
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils/index.d.ts +2 -2
- package/build/lib/utils/index.d.ts.map +1 -1
- package/build/lib/utils/index.js +8 -8
- package/build/lib/utils/index.js.map +1 -1
- package/build/lib/utils/is-package-changed.d.ts.map +1 -1
- package/build/lib/utils/is-package-changed.js +2 -4
- package/build/lib/utils/is-package-changed.js.map +1 -1
- package/build/lib/utils/object.d.ts.map +1 -1
- package/build/lib/utils/object.js +1 -3
- package/build/lib/utils/object.js.map +1 -1
- package/build/lib/utils/package-changed.d.ts +0 -1
- package/build/lib/utils/package-changed.d.ts.map +1 -1
- package/build/lib/utils/package-changed.js +4 -3
- package/build/lib/utils/package-changed.js.map +1 -1
- package/build/lib/utils/package-json.d.ts.map +1 -1
- package/build/lib/utils/package-json.js.map +1 -1
- package/build/lib/utils/resolve-from.d.ts.map +1 -1
- package/build/lib/utils/resolve-from.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +1 -1
- package/build/types/index.js.map +1 -1
- package/build/types/manifest/base.d.ts.map +1 -1
- package/build/types/manifest/v3.d.ts.map +1 -1
- package/build/types/manifest/v4.d.ts.map +1 -1
- package/lib/appium.ts +46 -94
- package/lib/bidi-commands.ts +28 -63
- package/lib/bootstrap/appium-initializer.ts +26 -38
- package/lib/bootstrap/appium-main-runner.ts +14 -32
- package/lib/bootstrap/config-file.ts +19 -37
- package/lib/bootstrap/grid-v3-register.ts +12 -38
- package/lib/bootstrap/init-types.ts +3 -5
- package/lib/bootstrap/main-helpers.ts +15 -25
- package/lib/bootstrap/node-helpers.ts +11 -22
- package/lib/bootstrap/startup-config.ts +13 -18
- package/lib/cli/args.ts +9 -18
- package/lib/cli/driver-command.ts +6 -13
- package/lib/cli/extension-command.ts +55 -156
- package/lib/cli/extension.ts +6 -5
- package/lib/cli/parser.ts +23 -29
- package/lib/cli/plugin-command.ts +7 -17
- package/lib/cli/setup-command.ts +10 -28
- package/lib/cli/utils.ts +1 -5
- package/lib/doctor/doctor.ts +1 -4
- package/lib/extension/driver-config.ts +5 -15
- package/lib/extension/extension-config.ts +36 -80
- package/lib/extension/index.ts +16 -31
- package/lib/extension/manifest-migrations.ts +1 -0
- package/lib/extension/manifest.ts +9 -19
- package/lib/extension/plugin-config.ts +5 -12
- package/lib/helpers/build.ts +4 -6
- package/lib/helpers/capability.ts +6 -17
- package/lib/helpers/network.ts +2 -6
- package/lib/insecure-features.ts +7 -22
- package/lib/inspector-commands.ts +28 -68
- package/lib/logsink.ts +11 -25
- package/lib/main.ts +2 -7
- package/lib/schema/arg-spec.ts +1 -0
- package/lib/schema/cli-args-guards.ts +7 -14
- package/lib/schema/cli-args.ts +10 -17
- package/lib/schema/cli-transformers.ts +5 -10
- package/lib/schema/format-errors.ts +2 -1
- package/lib/schema/index.ts +2 -2
- package/lib/schema/keywords.ts +2 -2
- package/lib/schema/schema.ts +14 -33
- package/lib/utils/index.ts +3 -3
- package/lib/utils/is-package-changed.ts +4 -7
- package/lib/utils/object.ts +4 -13
- package/lib/utils/package-changed.ts +7 -9
- package/lib/utils/package-json.ts +2 -3
- package/lib/utils/resolve-from.ts +1 -4
- package/package.json +32 -31
- package/scripts/autoinstall-extensions.js +1 -4
- package/tsconfig.json +7 -11
- package/types/cli.ts +2 -3
- package/types/index.ts +2 -2
- package/types/manifest/base.ts +3 -10
- package/types/manifest/v3.ts +3 -10
- package/types/manifest/v4.ts +3 -10
- package/LICENSE +0 -201
package/lib/schema/schema.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import Ajv, {type ErrorObject, type SchemaObject, type ValidateFunction} from 'ajv';
|
|
2
|
-
import addFormats from 'ajv-formats';
|
|
3
|
-
import {util} from '@appium/support';
|
|
4
1
|
import path from 'node:path';
|
|
5
|
-
|
|
2
|
+
|
|
6
3
|
import {AppiumConfigJsonSchema} from '@appium/schema';
|
|
4
|
+
import {util} from '@appium/support';
|
|
7
5
|
import type {ExtensionType} from '@appium/types';
|
|
6
|
+
import Ajv, {type ErrorObject, type SchemaObject, type ValidateFunction} from 'ajv';
|
|
7
|
+
import addFormats from 'ajv-formats';
|
|
8
|
+
|
|
8
9
|
import {DRIVER_TYPE, PLUGIN_TYPE} from '../constants';
|
|
10
|
+
import {bindAll, kebabCase, omitKeys, setPath} from '../utils';
|
|
9
11
|
import {APPIUM_CONFIG_SCHEMA_ID, ArgSpec, SERVER_PROP_NAME} from './arg-spec';
|
|
10
12
|
import {keywords} from './keywords';
|
|
11
13
|
|
|
@@ -40,9 +42,7 @@ export class RoachHotelMap<K, V> extends Map<K, V> {
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
export const ALLOWED_SCHEMA_EXTENSIONS = Object.freeze(
|
|
44
|
-
new Set<AllowedSchemaExtension>(['.json', '.js', '.cjs']),
|
|
45
|
-
);
|
|
45
|
+
export const ALLOWED_SCHEMA_EXTENSIONS = Object.freeze(new Set<AllowedSchemaExtension>(['.json', '.js', '.cjs']));
|
|
46
46
|
|
|
47
47
|
const SCHEMA_KEY = '$schema';
|
|
48
48
|
|
|
@@ -148,11 +148,7 @@ class AppiumSchema {
|
|
|
148
148
|
const ajv = this.#ajv;
|
|
149
149
|
const baseSchema = structuredClone(AppiumConfigJsonSchema) as any;
|
|
150
150
|
|
|
151
|
-
const addArgSpecs = (
|
|
152
|
-
schema: Record<string, any>,
|
|
153
|
-
extType?: ExtensionType,
|
|
154
|
-
extName?: string,
|
|
155
|
-
): void => {
|
|
151
|
+
const addArgSpecs = (schema: Record<string, any>, extType?: ExtensionType, extName?: string): void => {
|
|
156
152
|
for (const [propName, propSchema] of Object.entries(schema)) {
|
|
157
153
|
const argSpec = ArgSpec.create(propName, {
|
|
158
154
|
dest: (propSchema as any).appiumCliDest,
|
|
@@ -211,11 +207,7 @@ class AppiumSchema {
|
|
|
211
207
|
/**
|
|
212
208
|
* Registers an extension schema.
|
|
213
209
|
*/
|
|
214
|
-
async registerSchema(
|
|
215
|
-
extType: ExtensionType,
|
|
216
|
-
extName: string,
|
|
217
|
-
schema: SchemaObject,
|
|
218
|
-
): Promise<void> {
|
|
210
|
+
async registerSchema(extType: ExtensionType, extName: string, schema: SchemaObject): Promise<void> {
|
|
219
211
|
if (!(extType && extName) || schema === undefined) {
|
|
220
212
|
throw new TypeError('Expected extension type, extension name, and a defined schema');
|
|
221
213
|
}
|
|
@@ -250,9 +242,7 @@ class AppiumSchema {
|
|
|
250
242
|
/**
|
|
251
243
|
* Returns default values for all args, flattened or nested.
|
|
252
244
|
*/
|
|
253
|
-
getDefaults<Flattened extends boolean | undefined = true>(
|
|
254
|
-
flatten = true as Flattened,
|
|
255
|
-
): DefaultValues<Flattened> {
|
|
245
|
+
getDefaults<Flattened extends boolean | undefined = true>(flatten = true as Flattened): DefaultValues<Flattened> {
|
|
256
246
|
if (!this.isFinalized()) {
|
|
257
247
|
throw new SchemaFinalizationError();
|
|
258
248
|
}
|
|
@@ -278,16 +268,11 @@ class AppiumSchema {
|
|
|
278
268
|
/**
|
|
279
269
|
* Returns flattened defaults for a specific extension.
|
|
280
270
|
*/
|
|
281
|
-
getDefaultsForExtension(
|
|
282
|
-
extType: ExtensionType,
|
|
283
|
-
extName: string,
|
|
284
|
-
): Record<string, ArgSpecDefaultValue> {
|
|
271
|
+
getDefaultsForExtension(extType: ExtensionType, extName: string): Record<string, ArgSpecDefaultValue> {
|
|
285
272
|
if (!this.isFinalized()) {
|
|
286
273
|
throw new SchemaFinalizationError();
|
|
287
274
|
}
|
|
288
|
-
const specs = [...this.#argSpecs.values()].filter(
|
|
289
|
-
(spec) => spec.extType === extType && spec.extName === extName,
|
|
290
|
-
);
|
|
275
|
+
const specs = [...this.#argSpecs.values()].filter((spec) => spec.extType === extType && spec.extName === extName);
|
|
291
276
|
return specs.reduce(
|
|
292
277
|
(defaults, {defaultValue, rawDest}) => {
|
|
293
278
|
if (defaultValue !== undefined) {
|
|
@@ -304,9 +289,7 @@ class AppiumSchema {
|
|
|
304
289
|
*/
|
|
305
290
|
flatten(): FlattenedSchema {
|
|
306
291
|
const schema = this.getSchema() as any;
|
|
307
|
-
const stack: {properties: Record<string, any>; prefix: string[]}[] = [
|
|
308
|
-
{properties: schema.properties, prefix: []},
|
|
309
|
-
];
|
|
292
|
+
const stack: {properties: Record<string, any>; prefix: string[]}[] = [{properties: schema.properties, prefix: []}];
|
|
310
293
|
const flattened: FlattenedSchema = [];
|
|
311
294
|
|
|
312
295
|
for (const {properties, prefix} of stack) {
|
|
@@ -327,9 +310,7 @@ class AppiumSchema {
|
|
|
327
310
|
}
|
|
328
311
|
const {normalizedExtName} = ArgSpec.extensionInfoFromRootSchemaId($ref);
|
|
329
312
|
if (!normalizedExtName) {
|
|
330
|
-
throw new ReferenceError(
|
|
331
|
-
`Could not determine extension name from schema ID ${$ref}. This is a bug.`,
|
|
332
|
-
);
|
|
313
|
+
throw new ReferenceError(`Could not determine extension name from schema ID ${$ref}. This is a bug.`);
|
|
333
314
|
}
|
|
334
315
|
stack.push({
|
|
335
316
|
properties: refSchema.properties,
|
package/lib/utils/index.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export {adler32} from './hash';
|
|
2
2
|
export {isPackageChanged} from './is-package-changed';
|
|
3
3
|
export type {IsPackageChangedOptions, IsPackageChangedResult} from './is-package-changed';
|
|
4
|
-
export {appiumPackageRoot, npmPackage} from './package-json';
|
|
5
|
-
export {packageDidChange} from './package-changed';
|
|
6
|
-
export {resolveFrom} from './resolve-from';
|
|
7
4
|
export {
|
|
8
5
|
bindAll,
|
|
9
6
|
camelCase,
|
|
@@ -21,3 +18,6 @@ export {
|
|
|
21
18
|
setPath,
|
|
22
19
|
zip,
|
|
23
20
|
} from './object';
|
|
21
|
+
export {packageDidChange} from './package-changed';
|
|
22
|
+
export {appiumPackageRoot, npmPackage} from './package-json';
|
|
23
|
+
export {resolveFrom} from './resolve-from';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {fs} from '@appium/support';
|
|
2
1
|
import crypto from 'node:crypto';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
|
|
4
|
+
import {fs} from '@appium/support';
|
|
5
|
+
|
|
5
6
|
export interface IsPackageChangedOptions {
|
|
6
7
|
cwd?: string;
|
|
7
8
|
hashFilename?: string;
|
|
@@ -18,9 +19,7 @@ export interface IsPackageChangedResult {
|
|
|
18
19
|
* Detects whether `package.json` dependencies changed since the last hash write.
|
|
19
20
|
* Inlined from the `package-changed` package (lockfile support omitted; unused by Appium).
|
|
20
21
|
*/
|
|
21
|
-
export async function isPackageChanged(
|
|
22
|
-
options: IsPackageChangedOptions = {},
|
|
23
|
-
): Promise<IsPackageChangedResult> {
|
|
22
|
+
export async function isPackageChanged(options: IsPackageChangedOptions = {}): Promise<IsPackageChangedResult> {
|
|
24
23
|
const {hashFilename = '.packagehash', cwd = process.cwd()} = options;
|
|
25
24
|
const packagePath = await findPackageJson(cwd);
|
|
26
25
|
if (!packagePath) {
|
|
@@ -30,9 +29,7 @@ export async function isPackageChanged(
|
|
|
30
29
|
const packageHashPath = path.join(cwd, hashFilename);
|
|
31
30
|
const packageHashPathExists = await fs.exists(packageHashPath);
|
|
32
31
|
const recentDigest = await getPackageHash(packagePath);
|
|
33
|
-
const previousDigest = packageHashPathExists
|
|
34
|
-
? await fs.readFile(packageHashPath, 'utf-8')
|
|
35
|
-
: undefined;
|
|
32
|
+
const previousDigest = packageHashPathExists ? await fs.readFile(packageHashPath, 'utf-8') : undefined;
|
|
36
33
|
const isChanged = !packageHashPathExists || previousDigest !== recentDigest;
|
|
37
34
|
|
|
38
35
|
const writeHash = async () => {
|
package/lib/utils/object.ts
CHANGED
|
@@ -84,9 +84,7 @@ export function mapValues<T extends Record<string, unknown>, R>(
|
|
|
84
84
|
obj: T,
|
|
85
85
|
fn: (value: T[keyof T], key: keyof T) => R,
|
|
86
86
|
): Record<string, R> {
|
|
87
|
-
return Object.fromEntries(
|
|
88
|
-
Object.entries(obj).map(([key, value]) => [key, fn(value as T[keyof T], key as keyof T)]),
|
|
89
|
-
);
|
|
87
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value as T[keyof T], key as keyof T)]));
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
/**
|
|
@@ -225,9 +223,7 @@ export function difference<T>(a: readonly T[], b: readonly T[]): T[] {
|
|
|
225
223
|
* @param sources - Objects merged in order; null/undefined sources are skipped
|
|
226
224
|
* @returns Merged object
|
|
227
225
|
*/
|
|
228
|
-
export function defaultsDeep<T extends Record<string, unknown>>(
|
|
229
|
-
...sources: Array<Partial<T> | undefined>
|
|
230
|
-
): T {
|
|
226
|
+
export function defaultsDeep<T extends Record<string, unknown>>(...sources: Array<Partial<T> | undefined>): T {
|
|
231
227
|
let result: Record<string, unknown> = {};
|
|
232
228
|
for (const source of sources) {
|
|
233
229
|
if (source == null) {
|
|
@@ -283,14 +279,9 @@ function copyForDefaultsDeep(value: unknown): unknown {
|
|
|
283
279
|
* @param source - Default values
|
|
284
280
|
* @returns Merged clone
|
|
285
281
|
*/
|
|
286
|
-
function fillUndefinedDeep(
|
|
287
|
-
target: Record<string, unknown>,
|
|
288
|
-
source: Record<string, unknown>,
|
|
289
|
-
): Record<string, unknown> {
|
|
282
|
+
function fillUndefinedDeep(target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown> {
|
|
290
283
|
const out = copyForDefaultsDeep(target) as Record<string, unknown>;
|
|
291
|
-
const stack: Array<{dest: Record<string, unknown>; src: Record<string, unknown>}> = [
|
|
292
|
-
{dest: out, src: source},
|
|
293
|
-
];
|
|
284
|
+
const stack: Array<{dest: Record<string, unknown>; src: Record<string, unknown>}> = [{dest: out, src: source}];
|
|
294
285
|
while (stack.length) {
|
|
295
286
|
const next = stack.pop();
|
|
296
287
|
if (!next) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {fs} from '@appium/support';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs} from '@appium/support';
|
|
4
|
+
|
|
3
5
|
import {PKG_HASHFILE_RELATIVE_PATH} from '../constants';
|
|
4
6
|
import {log} from '../logger';
|
|
5
7
|
import {isPackageChanged} from './is-package-changed';
|
|
@@ -8,7 +10,6 @@ import {isPackageChanged} from './is-package-changed';
|
|
|
8
10
|
* Determines if extensions have changed, and updates a hash the `package.json` in `appiumHome` if so.
|
|
9
11
|
*
|
|
10
12
|
* If they have, we need to sync them with the `extensions.yaml` manifest.
|
|
11
|
-
*
|
|
12
13
|
*/
|
|
13
14
|
export async function packageDidChange(appiumHome: string): Promise<boolean> {
|
|
14
15
|
const hashFilename = path.join(appiumHome, PKG_HASHFILE_RELATIVE_PATH);
|
|
@@ -41,14 +42,11 @@ export async function packageDidChange(appiumHome: string): Promise<boolean> {
|
|
|
41
42
|
if (isChanged) {
|
|
42
43
|
try {
|
|
43
44
|
await writeHash();
|
|
44
|
-
log.debug(
|
|
45
|
-
`Updated hash of ${appiumHome}/package.json from: ${oldHash ?? '(none)'} to: ${hash}`,
|
|
46
|
-
);
|
|
45
|
+
log.debug(`Updated hash of ${appiumHome}/package.json from: ${oldHash ?? '(none)'} to: ${hash}`);
|
|
47
46
|
} catch (err: any) {
|
|
48
|
-
throw new Error(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
47
|
+
throw new Error(`Appium could not write hash file: ${hashFilenameDir}. Original error: ${err.message}`, {
|
|
48
|
+
cause: err,
|
|
49
|
+
});
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import nodeFs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
|
|
3
4
|
import type {PackageJson} from 'type-fest';
|
|
4
5
|
|
|
5
6
|
type AppiumPackageJson = PackageJson & {
|
|
@@ -21,9 +22,7 @@ function readPackageJsonSync(): {pkgRoot: string; pkg: AppiumPackageJson} {
|
|
|
21
22
|
}
|
|
22
23
|
current = path.dirname(current);
|
|
23
24
|
}
|
|
24
|
-
const pkg = JSON.parse(
|
|
25
|
-
nodeFs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'),
|
|
26
|
-
) as PackageJson;
|
|
25
|
+
const pkg = JSON.parse(nodeFs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')) as PackageJson;
|
|
27
26
|
if (typeof pkg.name !== 'string' || typeof pkg.version !== 'string') {
|
|
28
27
|
throw new Error(`Invalid \`package.json\` near ${__dirname}`);
|
|
29
28
|
}
|
|
@@ -26,10 +26,7 @@ export async function resolveFrom(fromDirectory: string, moduleId: string): Prom
|
|
|
26
26
|
|
|
27
27
|
const fromFile = path.join(resolvedFromDirectory, 'noop.js');
|
|
28
28
|
const nodeModule = Module as typeof Module & {
|
|
29
|
-
_resolveFilename: (
|
|
30
|
-
id: string,
|
|
31
|
-
parent: {id: string; filename: string; paths: string[]},
|
|
32
|
-
) => string;
|
|
29
|
+
_resolveFilename: (id: string, parent: {id: string; filename: string; paths: string[]}) => string;
|
|
33
30
|
_nodeModulePaths: (from: string) => string[];
|
|
34
31
|
};
|
|
35
32
|
return nodeModule._resolveFilename(moduleId, {
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
|
+
"gitHead": "f7b20335eab4022e5cbbb627ec86866a994444f8",
|
|
4
5
|
"description": "Automation for Apps.",
|
|
5
6
|
"keywords": [
|
|
7
|
+
"android",
|
|
6
8
|
"automation",
|
|
9
|
+
"firefoxos",
|
|
10
|
+
"ios",
|
|
7
11
|
"javascript",
|
|
8
12
|
"selenium",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"android",
|
|
12
|
-
"firefoxos",
|
|
13
|
-
"testing"
|
|
13
|
+
"testing",
|
|
14
|
+
"webdriver"
|
|
14
15
|
],
|
|
15
16
|
"homepage": "https://appium.io",
|
|
16
17
|
"bugs": {
|
|
17
18
|
"url": "https://github.com/appium/appium/issues"
|
|
18
19
|
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"author": "https://github.com/appium",
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
21
24
|
"url": "https://github.com/appium/appium.git",
|
|
22
25
|
"directory": "packages/appium"
|
|
23
26
|
},
|
|
24
|
-
"license": "Apache-2.0",
|
|
25
|
-
"author": "https://github.com/appium",
|
|
26
|
-
"types": "./build/lib/main.d.ts",
|
|
27
27
|
"bin": {
|
|
28
28
|
"appium": "index.js"
|
|
29
29
|
},
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"types",
|
|
43
43
|
"tsconfig.json"
|
|
44
44
|
],
|
|
45
|
+
"main": "./build/lib/main.js",
|
|
46
|
+
"types": "./build/lib/main.d.ts",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
45
50
|
"scripts": {
|
|
46
51
|
"build:docs": "node docs/scripts/build-docs.js",
|
|
47
52
|
"build:docs:preview": "cross-env APPIUM_DOCS_PREVIEW=1 npm run build:docs",
|
|
@@ -55,40 +60,36 @@
|
|
|
55
60
|
"postinstall": "node ./scripts/autoinstall-extensions.js",
|
|
56
61
|
"publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
57
62
|
"test": "npm run test:unit",
|
|
58
|
-
"test:e2e": "
|
|
63
|
+
"test:e2e": "node --test --enable-source-maps --test-force-exit --test-concurrency=1 --test-timeout=200000 \"./build/test/e2e/**/*.spec.js\"",
|
|
59
64
|
"test:smoke": "cross-env APPIUM_HOME=./local_appium_home node ./index.js driver install uiautomator2 && cross-env APPIUM_HOME=./local_appium_home node ./index.js driver list",
|
|
60
|
-
"test:unit": "
|
|
65
|
+
"test:unit": "node --test --enable-source-maps --test-timeout=5000 \"./build/test/unit/**/*.spec.js\""
|
|
61
66
|
},
|
|
62
67
|
"dependencies": {
|
|
63
|
-
"@appium/base-driver": "10.7.
|
|
64
|
-
"@appium/base-plugin": "3.3.
|
|
65
|
-
"@appium/docutils": "2.5.
|
|
66
|
-
"@appium/logger": "2.0.
|
|
67
|
-
"@appium/schema": "1.
|
|
68
|
-
"@appium/support": "7.2.
|
|
69
|
-
"@appium/types": "1.
|
|
68
|
+
"@appium/base-driver": "10.7.2",
|
|
69
|
+
"@appium/base-plugin": "3.3.3",
|
|
70
|
+
"@appium/docutils": "2.5.2",
|
|
71
|
+
"@appium/logger": "2.0.10",
|
|
72
|
+
"@appium/schema": "1.3.0",
|
|
73
|
+
"@appium/support": "7.2.6",
|
|
74
|
+
"@appium/types": "1.6.0",
|
|
70
75
|
"@sidvind/better-ajv-errors": "5.0.0",
|
|
71
76
|
"ajv": "8.20.0",
|
|
72
77
|
"ajv-formats": "3.0.1",
|
|
73
|
-
"argparse": "
|
|
74
|
-
"asyncbox": "6.3.
|
|
75
|
-
"axios": "1.18.
|
|
78
|
+
"argparse": "3.0.0",
|
|
79
|
+
"asyncbox": "6.3.5",
|
|
80
|
+
"axios": "1.18.1",
|
|
76
81
|
"lilconfig": "3.1.3",
|
|
77
|
-
"lru-cache": "11.5.
|
|
82
|
+
"lru-cache": "11.5.2",
|
|
78
83
|
"ora": "5.4.1",
|
|
79
|
-
"semver": "7.8.
|
|
80
|
-
"teen_process": "4.1.
|
|
81
|
-
"type-fest": "5.
|
|
84
|
+
"semver": "7.8.5",
|
|
85
|
+
"teen_process": "4.1.9",
|
|
86
|
+
"type-fest": "5.8.0",
|
|
82
87
|
"winston": "3.19.0",
|
|
83
|
-
"ws": "8.21.
|
|
88
|
+
"ws": "8.21.1",
|
|
84
89
|
"yaml": "2.9.0"
|
|
85
90
|
},
|
|
86
91
|
"engines": {
|
|
87
92
|
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
88
93
|
"npm": ">=10"
|
|
89
|
-
}
|
|
90
|
-
"publishConfig": {
|
|
91
|
-
"access": "public"
|
|
92
|
-
},
|
|
93
|
-
"gitHead": "e6b583a2094f7919ef27b0dc28ebf42b3184852b"
|
|
94
|
+
}
|
|
94
95
|
}
|
|
@@ -166,10 +166,7 @@ async function main() {
|
|
|
166
166
|
`Done. ${installedStats[DRIVER_TYPE]} ${util.pluralize(
|
|
167
167
|
'driver',
|
|
168
168
|
installedStats[DRIVER_TYPE],
|
|
169
|
-
)} and ${installedStats[PLUGIN_TYPE]} ${util.pluralize(
|
|
170
|
-
'plugin',
|
|
171
|
-
installedStats[PLUGIN_TYPE],
|
|
172
|
-
)} are installed.`,
|
|
169
|
+
)} and ${installedStats[PLUGIN_TYPE]} ${util.pluralize('plugin', installedStats[PLUGIN_TYPE])} are installed.`,
|
|
173
170
|
);
|
|
174
171
|
}
|
|
175
172
|
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@appium/tsconfig/tsconfig.json",
|
|
3
|
-
"ts-node": {
|
|
4
|
-
"transpileOnly": true,
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"rootDir": "."
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
3
|
"compilerOptions": {
|
|
10
4
|
"rootDir": ".",
|
|
11
5
|
"outDir": "build",
|
|
@@ -15,20 +9,22 @@
|
|
|
15
9
|
"@appium/base-driver": ["../base-driver"],
|
|
16
10
|
"@appium/base-plugin": ["../base-plugin"],
|
|
17
11
|
"@appium/fake-driver": ["../fake-driver"],
|
|
12
|
+
"@appium/logger": ["../logger"],
|
|
18
13
|
"@appium/types": ["../types"],
|
|
19
14
|
"@appium/schema": ["../schema"],
|
|
20
15
|
"appium": ["."]
|
|
21
16
|
},
|
|
22
17
|
"checkJs": true,
|
|
23
|
-
"types": ["
|
|
18
|
+
"types": ["node"]
|
|
24
19
|
},
|
|
25
20
|
"include": ["lib", "types", "test"],
|
|
26
21
|
"references": [
|
|
27
|
-
{"path": "../schema"},
|
|
28
|
-
{"path": "../types"},
|
|
29
|
-
{"path": "../support"},
|
|
30
22
|
{"path": "../base-driver"},
|
|
31
23
|
{"path": "../base-plugin"},
|
|
32
|
-
{"path": "../fake-driver"}
|
|
24
|
+
{"path": "../fake-driver"},
|
|
25
|
+
{"path": "../logger"},
|
|
26
|
+
{"path": "../types"},
|
|
27
|
+
{"path": "../schema"},
|
|
28
|
+
{"path": "../support"}
|
|
33
29
|
]
|
|
34
30
|
}
|
package/types/cli.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {DriverType, PluginType, ServerArgs} from '@appium/types';
|
|
2
2
|
import type {SetOptional} from 'type-fest';
|
|
3
|
+
|
|
3
4
|
import type {InstallType} from './manifest';
|
|
4
5
|
export type CliCommandServer = 'server';
|
|
5
6
|
export type CliCommandSetup = 'setup';
|
|
@@ -204,9 +205,7 @@ export type ParsedArgs<
|
|
|
204
205
|
export type Args<
|
|
205
206
|
Cmd extends CliCommand = CliCommandServer,
|
|
206
207
|
SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void,
|
|
207
|
-
> = Cmd extends CliCommandServer
|
|
208
|
-
? SetOptional<CommonArgs<Cmd>, keyof ServerArgs>
|
|
209
|
-
: ParsedArgs<Cmd, SubCmd>;
|
|
208
|
+
> = Cmd extends CliCommandServer ? SetOptional<CommonArgs<Cmd>, keyof ServerArgs> : ParsedArgs<Cmd, SubCmd>;
|
|
210
209
|
|
|
211
210
|
/**
|
|
212
211
|
* Shown by `appium --build-info`
|
package/types/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {DriverClass, DriverType, ExtensionType, PluginClass, PluginType} from '@appium/types';
|
|
2
2
|
|
|
3
|
-
export * from './manifest';
|
|
4
3
|
export * from './cli';
|
|
4
|
+
export * from './manifest';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Known environment variables concerning Appium
|
package/types/manifest/base.ts
CHANGED
|
@@ -108,10 +108,7 @@ export type ExtMetadata<ExtType extends ExtensionType> = (ExtType extends Driver
|
|
|
108
108
|
* Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
|
|
109
109
|
* Part of `extensions.yaml`.
|
|
110
110
|
*/
|
|
111
|
-
export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
112
|
-
ExtMetadata<ExtType>,
|
|
113
|
-
'driverName' | 'pluginName'
|
|
114
|
-
> &
|
|
111
|
+
export type ExtManifest<ExtType extends ExtensionType> = Omit<ExtMetadata<ExtType>, 'driverName' | 'pluginName'> &
|
|
115
112
|
InternalMetadata;
|
|
116
113
|
|
|
117
114
|
/**
|
|
@@ -143,10 +140,7 @@ export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
|
|
|
143
140
|
* - `appium`: the metadata for the extension
|
|
144
141
|
* - `peerDependencies.appium`: the maximum compatible version of Appium
|
|
145
142
|
*/
|
|
146
|
-
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
147
|
-
PackageJson,
|
|
148
|
-
'name' | 'version'
|
|
149
|
-
> & {
|
|
143
|
+
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<PackageJson, 'name' | 'version'> & {
|
|
150
144
|
appium: ExtMetadata<ExtType>;
|
|
151
145
|
peerDependencies: {appium: string; [key: string]: string};
|
|
152
146
|
};
|
|
@@ -154,5 +148,4 @@ export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
|
154
148
|
/**
|
|
155
149
|
* A transient format between installation and insertion of extension metadata into the manifest.
|
|
156
150
|
*/
|
|
157
|
-
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> &
|
|
158
|
-
InternalMetadata;
|
|
151
|
+
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> & InternalMetadata;
|
package/types/manifest/v3.ts
CHANGED
|
@@ -111,10 +111,7 @@ export type ExtMetadata<ExtType extends ExtensionType> = (ExtType extends Driver
|
|
|
111
111
|
* Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
|
|
112
112
|
* Part of `extensions.yaml`.
|
|
113
113
|
*/
|
|
114
|
-
export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
115
|
-
ExtMetadata<ExtType>,
|
|
116
|
-
'driverName' | 'pluginName'
|
|
117
|
-
> &
|
|
114
|
+
export type ExtManifest<ExtType extends ExtensionType> = Omit<ExtMetadata<ExtType>, 'driverName' | 'pluginName'> &
|
|
118
115
|
InternalMetadata;
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -146,10 +143,7 @@ export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
|
|
|
146
143
|
* - `appium`: the metadata for the extension
|
|
147
144
|
* - `peerDependencies.appium`: the maximum compatible version of Appium
|
|
148
145
|
*/
|
|
149
|
-
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
150
|
-
PackageJson,
|
|
151
|
-
'name' | 'version'
|
|
152
|
-
> & {
|
|
146
|
+
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<PackageJson, 'name' | 'version'> & {
|
|
153
147
|
appium: ExtMetadata<ExtType>;
|
|
154
148
|
peerDependencies: {appium: string; [key: string]: string};
|
|
155
149
|
};
|
|
@@ -157,5 +151,4 @@ export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
|
157
151
|
/**
|
|
158
152
|
* A transient format between installation and insertion of extension metadata into the manifest.
|
|
159
153
|
*/
|
|
160
|
-
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> &
|
|
161
|
-
InternalMetadata;
|
|
154
|
+
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> & InternalMetadata;
|
package/types/manifest/v4.ts
CHANGED
|
@@ -111,10 +111,7 @@ export type ExtMetadata<ExtType extends ExtensionType> = (ExtType extends Driver
|
|
|
111
111
|
* Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
|
|
112
112
|
* Part of `extensions.yaml`.
|
|
113
113
|
*/
|
|
114
|
-
export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
115
|
-
ExtMetadata<ExtType>,
|
|
116
|
-
'driverName' | 'pluginName'
|
|
117
|
-
> &
|
|
114
|
+
export type ExtManifest<ExtType extends ExtensionType> = Omit<ExtMetadata<ExtType>, 'driverName' | 'pluginName'> &
|
|
118
115
|
InternalMetadata;
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -146,10 +143,7 @@ export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
|
|
|
146
143
|
* - `appium`: the metadata for the extension
|
|
147
144
|
* - `peerDependencies.appium`: the maximum compatible version of Appium
|
|
148
145
|
*/
|
|
149
|
-
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
150
|
-
PackageJson,
|
|
151
|
-
'name' | 'version'
|
|
152
|
-
> & {
|
|
146
|
+
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<PackageJson, 'name' | 'version'> & {
|
|
153
147
|
appium: ExtMetadata<ExtType>;
|
|
154
148
|
peerDependencies: {appium: string; [key: string]: string};
|
|
155
149
|
};
|
|
@@ -157,5 +151,4 @@ export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
|
157
151
|
/**
|
|
158
152
|
* A transient format between installation and insertion of extension metadata into the manifest.
|
|
159
153
|
*/
|
|
160
|
-
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> &
|
|
161
|
-
InternalMetadata;
|
|
154
|
+
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> & InternalMetadata;
|