web-ext 7.2.0 → 7.3.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/README.md +2 -2
- package/lib/cmd/build.js +18 -36
- package/lib/cmd/build.js.map +1 -1
- package/lib/cmd/docs.js +1 -0
- package/lib/cmd/docs.js.map +1 -1
- package/lib/cmd/index.js +3 -5
- package/lib/cmd/index.js.map +1 -1
- package/lib/cmd/lint.js +28 -17
- package/lib/cmd/lint.js.map +1 -1
- package/lib/cmd/run.js +19 -23
- package/lib/cmd/run.js.map +1 -1
- package/lib/cmd/sign.js +80 -47
- package/lib/cmd/sign.js.map +1 -1
- package/lib/config.js +18 -29
- package/lib/config.js.map +1 -1
- package/lib/errors.js +8 -18
- package/lib/errors.js.map +1 -1
- package/lib/extension-runners/base.js +2 -0
- package/lib/extension-runners/base.js.map +1 -1
- package/lib/extension-runners/chromium.js +36 -62
- package/lib/extension-runners/chromium.js.map +1 -1
- package/lib/extension-runners/firefox-android.js +65 -102
- package/lib/extension-runners/firefox-android.js.map +1 -1
- package/lib/extension-runners/firefox-desktop.js +29 -42
- package/lib/extension-runners/firefox-desktop.js.map +1 -1
- package/lib/extension-runners/index.js +33 -46
- package/lib/extension-runners/index.js.map +1 -1
- package/lib/firefox/index.js +59 -52
- package/lib/firefox/index.js.map +1 -1
- package/lib/firefox/package-identifiers.js +2 -0
- package/lib/firefox/package-identifiers.js.map +1 -1
- package/lib/firefox/preferences.js +14 -15
- package/lib/firefox/preferences.js.map +1 -1
- package/lib/firefox/rdp-client.js +16 -64
- package/lib/firefox/rdp-client.js.map +1 -1
- package/lib/firefox/remote.js +15 -30
- package/lib/firefox/remote.js.map +1 -1
- package/lib/main.js +4 -2
- package/lib/main.js.map +1 -1
- package/lib/program.js +74 -76
- package/lib/program.js.map +1 -1
- package/lib/util/adb.js +33 -63
- package/lib/util/adb.js.map +1 -1
- package/lib/util/artifacts.js +3 -5
- package/lib/util/artifacts.js.map +1 -1
- package/lib/util/desktop-notifier.js +1 -0
- package/lib/util/desktop-notifier.js.map +1 -1
- package/lib/util/file-exists.js +1 -2
- package/lib/util/file-exists.js.map +1 -1
- package/lib/util/file-filter.js +17 -19
- package/lib/util/file-filter.js.map +1 -1
- package/lib/util/is-directory.js +2 -1
- package/lib/util/is-directory.js.map +1 -1
- package/lib/util/logger.js +7 -12
- package/lib/util/logger.js.map +1 -1
- package/lib/util/manifest.js +6 -13
- package/lib/util/manifest.js.map +1 -1
- package/lib/util/promisify.js +7 -3
- package/lib/util/promisify.js.map +1 -1
- package/lib/util/stdin.js +2 -0
- package/lib/util/stdin.js.map +1 -1
- package/lib/util/submit-addon.js +288 -0
- package/lib/util/submit-addon.js.map +1 -0
- package/lib/util/temp-dir.js +8 -18
- package/lib/util/temp-dir.js.map +1 -1
- package/lib/util/updates.js +1 -1
- package/lib/util/updates.js.map +1 -1
- package/lib/watcher.js +14 -9
- package/lib/watcher.js.map +1 -1
- package/package.json +16 -14
package/lib/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","names":["os","path","readFileSync","camelCase","decamelize","yargs","Parser","yargsParser","defaultCommands","UsageError","createLogger","consoleStream","defaultLogStream","coerceCLICustomPreference","checkForUpdates","defaultUpdateChecker","discoverConfigFiles","defaultConfigDiscovery","loadJSConfigFile","defaultLoadJSConfigFile","applyConfigToArgv","defaultApplyConfigToArgv","log","import","meta","url","envPrefix","defaultGlobalEnv","Program","constructor","argv","absolutePackageDir","process","cwd","slice","programArgv","yargsInstance","verboseEnabled","shouldExitProgram","parserConfiguration","strict","wrap","terminalWidth","commands","options","command","name","description","executor","commandOptions","yargsForCmd","demandCommand","undefined","exitProcess","env","setGlobalOptions","Object","keys","forEach","key","global","demandOption","enableVerboseMode","logStream","version","makeVerbose","info","getArguments","validationInstance","getInternalMethods","getValidationInstance","requiredArguments","demandedOptions","getDemandedOptions","args","err","message","startsWith","configDiscovery","noConfigDiscovery","reload","noReload","input","noInput","ignoreFiles","length","startUrl","Array","isArray","firefoxPreview","checkRequiredArguments","adjustedArgv","cleanupProcessEnvConfigs","systemProcess","cmd","_","toOptionKey","k","replace","separator","filter","optKey","globalOpt","cmdOpt","debug","execute","getVersion","defaultVersionGetter","globalEnv","runCommand","verbose","configFiles","discoveredConfigs","push","config","resolve","niceFileList","map","f","homedir","join","configFileName","configObject","argvFromCLI","error","stack","String","code","exit","packageData","JSON","parse","git","branch","long","throwUsageErrorIfArray","errorMessage","value","main","runOptions","program","usage","help","alias","recommendCommands","describe","default","requiresArg","type","coerce","arg","normalize","hidden","build","sign","run","choices","lint","docs"],"sources":["../src/program.js"],"sourcesContent":["/* @flow */\nimport os from 'os';\nimport path from 'path';\nimport {readFileSync} from 'fs';\n\nimport camelCase from 'camelcase';\nimport decamelize from 'decamelize';\nimport yargs from 'yargs';\nimport { Parser as yargsParser } from 'yargs/helpers';\n\nimport defaultCommands from './cmd/index.js';\nimport {UsageError} from './errors.js';\nimport {\n createLogger,\n consoleStream as defaultLogStream,\n} from './util/logger.js';\nimport {coerceCLICustomPreference} from './firefox/preferences.js';\nimport {checkForUpdates as defaultUpdateChecker} from './util/updates.js';\nimport {\n discoverConfigFiles as defaultConfigDiscovery,\n loadJSConfigFile as defaultLoadJSConfigFile,\n applyConfigToArgv as defaultApplyConfigToArgv,\n} from './config.js';\n\nconst log = createLogger(import.meta.url);\nconst envPrefix = 'WEB_EXT';\n// Default to \"development\" (the value actually assigned will be interpolated\n// by babel-plugin-transform-inline-environment-variables).\nconst defaultGlobalEnv = process.env.WEBEXT_BUILD_ENV || 'development';\n\n\ntype ProgramOptions = {\n absolutePackageDir?: string,\n}\n\nexport type VersionGetterFn = (absolutePackageDir: string) => Promise<string>;\n\n// TODO: add pipes to Flow type after https://github.com/facebook/flow/issues/2405 is fixed\n\ntype ExecuteOptions = {\n checkForUpdates?: Function,\n systemProcess?: typeof process,\n logStream?: typeof defaultLogStream,\n getVersion?: VersionGetterFn,\n applyConfigToArgv?: typeof defaultApplyConfigToArgv,\n discoverConfigFiles?: typeof defaultConfigDiscovery,\n loadJSConfigFile?: typeof defaultLoadJSConfigFile,\n shouldExitProgram?: boolean,\n globalEnv?: string | void,\n}\n\n\n/*\n * The command line program.\n */\nexport class Program {\n absolutePackageDir: string;\n yargs: any;\n commands: { [key: string]: Function };\n shouldExitProgram: boolean;\n verboseEnabled: boolean;\n options: Object;\n programArgv: Array<string>;\n demandedOptions: Object;\n\n constructor(\n argv: ?Array<string>,\n {\n absolutePackageDir = process.cwd(),\n }: ProgramOptions = {}\n ) {\n // This allows us to override the process argv which is useful for\n // testing.\n // NOTE: process.argv.slice(2) removes the path to node and web-ext\n // executables from the process.argv array.\n argv = argv || process.argv.slice(2);\n this.programArgv = argv;\n\n // NOTE: always initialize yargs explicitly with the package dir\n // to avoid side-effects due to yargs looking for its configuration\n // section from a package.json file stored in an arbitrary directory\n // (e.g. in tests yargs would end up loading yargs config from the\n // mocha package.json). web-ext package.json doesn't contain any yargs\n // section as it is deprecated and we configure yargs using\n // yargs.parserConfiguration. See web-ext#469 for rationale.\n const yargsInstance = yargs(argv, absolutePackageDir);\n\n this.absolutePackageDir = absolutePackageDir;\n this.verboseEnabled = false;\n this.shouldExitProgram = true;\n\n this.yargs = yargsInstance;\n this.yargs.parserConfiguration({\n 'boolean-negation': true,\n });\n this.yargs.strict();\n this.yargs.wrap(this.yargs.terminalWidth());\n\n this.commands = {};\n this.options = {};\n }\n\n command(\n name: string, description: string, executor: Function,\n commandOptions: Object = {}\n ): Program {\n this.options[camelCase(name)] = commandOptions;\n\n this.yargs.command(name, description, (yargsForCmd) => {\n if (!commandOptions) {\n return;\n }\n return yargsForCmd\n // Make sure the user does not add any extra commands. For example,\n // this would be a mistake because lint does not accept arguments:\n // web-ext lint ./src/path/to/file.js\n .demandCommand(0, 0, undefined,\n 'This command does not take any arguments')\n .strict()\n .exitProcess(this.shouldExitProgram)\n // Calling env() will be unnecessary after\n // https://github.com/yargs/yargs/issues/486 is fixed\n .env(envPrefix)\n .options(commandOptions);\n });\n this.commands[name] = executor;\n return this;\n }\n\n setGlobalOptions(options: Object): Program {\n // This is a convenience for setting global options.\n // An option is only global (i.e. available to all sub commands)\n // with the `global` flag so this makes sure every option has it.\n this.options = {...this.options, ...options};\n Object.keys(options).forEach((key) => {\n options[key].global = true;\n if (options[key].demandOption === undefined) {\n // By default, all options should be \"demanded\" otherwise\n // yargs.strict() will think they are missing when declared.\n options[key].demandOption = true;\n }\n });\n this.yargs.options(options);\n return this;\n }\n\n enableVerboseMode(\n logStream: typeof defaultLogStream,\n version: string\n ): void {\n if (this.verboseEnabled) {\n return;\n }\n\n logStream.makeVerbose();\n log.info('Version:', version);\n this.verboseEnabled = true;\n }\n\n // Retrieve the yargs argv object and apply any further fix needed\n // on the output of the yargs options parsing.\n getArguments(): Object {\n // To support looking up required parameters via config files, we need to\n // temporarily disable the requiredArguments validation. Otherwise yargs\n // would exit early. Validation is enforced by the checkRequiredArguments()\n // method, after reading configuration files.\n //\n // This is an undocumented internal API of yargs! Unit tests to avoid\n // regressions are located at: tests/functional/test.cli.sign.js\n //\n // Replace hack if possible: https://github.com/mozilla/web-ext/issues/1930\n const validationInstance =\n this.yargs.getInternalMethods().getValidationInstance();\n const { requiredArguments } = validationInstance;\n // Initialize demandedOptions (which is going to be set to an object with one\n // property for each mandatory global options, then the arrow function below\n // will receive as its demandedOptions parameter a new one that also includes\n // all mandatory options for the sub command selected).\n this.demandedOptions = this.yargs.getDemandedOptions();\n validationInstance.requiredArguments = (args, demandedOptions) => {\n this.demandedOptions = demandedOptions;\n };\n let argv;\n try {\n argv = this.yargs.argv;\n } catch (err) {\n if (err.name === 'YError' &&\n err.message.startsWith('Unknown argument: ')) {\n throw new UsageError(err.message);\n }\n throw err;\n }\n validationInstance.requiredArguments = requiredArguments;\n\n // Yargs boolean options doesn't define the no* counterpart\n // with negate-boolean on Yargs 15. Define as expected by the\n // web-ext execute method.\n if (argv.configDiscovery != null) {\n argv.noConfigDiscovery = !argv.configDiscovery;\n }\n if (argv.reload != null) {\n argv.noReload = !argv.reload;\n }\n\n // Yargs doesn't accept --no-input as a valid option if there isn't a\n // --input option defined to be negated, to fix that the --input is\n // defined and hidden from the yargs help output and we define here\n // the negated argument name that we expect to be set in the parsed\n // arguments (and fix https://github.com/mozilla/web-ext/issues/1860).\n if (argv.input != null) {\n argv.noInput = !argv.input;\n }\n\n // Replacement for the \"requiresArg: true\" parameter until the following bug\n // is fixed: https://github.com/yargs/yargs/issues/1098\n if (argv.ignoreFiles && !argv.ignoreFiles.length) {\n throw new UsageError('Not enough arguments following: ignore-files');\n }\n\n if (argv.startUrl && !argv.startUrl.length) {\n throw new UsageError('Not enough arguments following: start-url');\n }\n\n if (Array.isArray(argv.firefoxPreview) && !argv.firefoxPreview.length) {\n argv.firefoxPreview = ['mv3'];\n }\n\n return argv;\n }\n\n // getArguments() disables validation of required parameters, to allow us to\n // read parameters from config files first. Before the program continues, it\n // must call checkRequiredArguments() to ensure that required parameters are\n // defined (in the CLI or in a config file).\n checkRequiredArguments(adjustedArgv: Object): void {\n const validationInstance =\n this.yargs.getInternalMethods().getValidationInstance();\n validationInstance.requiredArguments(adjustedArgv, this.demandedOptions);\n }\n\n // Remove WEB_EXT_* environment vars that are not a global cli options\n // or an option supported by the current command (See #793).\n cleanupProcessEnvConfigs(systemProcess: typeof process) {\n const cmd = yargsParser(this.programArgv)._[0];\n const env = systemProcess.env || {};\n const toOptionKey = (k) => decamelize(\n camelCase(k.replace(envPrefix, '')), {separator: '-'}\n );\n\n if (cmd) {\n Object.keys(env)\n .filter((k) => k.startsWith(envPrefix))\n .forEach((k) => {\n const optKey = toOptionKey(k);\n const globalOpt = this.options[optKey];\n const cmdOpt = this.options[cmd] && this.options[cmd][optKey];\n\n if (!globalOpt && !cmdOpt) {\n log.debug(`Environment ${k} not supported by web-ext ${cmd}`);\n delete env[k];\n }\n });\n }\n }\n\n async execute(\n {\n checkForUpdates = defaultUpdateChecker,\n systemProcess = process,\n logStream = defaultLogStream,\n getVersion = defaultVersionGetter,\n applyConfigToArgv = defaultApplyConfigToArgv,\n discoverConfigFiles = defaultConfigDiscovery,\n loadJSConfigFile = defaultLoadJSConfigFile,\n shouldExitProgram = true,\n globalEnv = defaultGlobalEnv,\n }: ExecuteOptions = {}\n ): Promise<void> {\n this.shouldExitProgram = shouldExitProgram;\n this.yargs.exitProcess(this.shouldExitProgram);\n\n this.cleanupProcessEnvConfigs(systemProcess);\n const argv = this.getArguments();\n\n const cmd = argv._[0];\n\n const version = await getVersion(this.absolutePackageDir);\n const runCommand = this.commands[cmd];\n\n if (argv.verbose) {\n this.enableVerboseMode(logStream, version);\n }\n\n let adjustedArgv = {...argv};\n\n try {\n if (cmd === undefined) {\n throw new UsageError('No sub-command was specified in the args');\n }\n if (!runCommand) {\n throw new UsageError(`Unknown command: ${cmd}`);\n }\n if (globalEnv === 'production') {\n checkForUpdates({version});\n }\n\n const configFiles = [];\n\n if (argv.configDiscovery) {\n log.debug(\n 'Discovering config files. ' +\n 'Set --no-config-discovery to disable');\n const discoveredConfigs = await discoverConfigFiles();\n configFiles.push(...discoveredConfigs);\n } else {\n log.debug('Not discovering config files');\n }\n\n if (argv.config) {\n configFiles.push(path.resolve(argv.config));\n }\n\n if (configFiles.length) {\n const niceFileList = configFiles\n .map((f) => f.replace(process.cwd(), '.'))\n .map((f) => f.replace(os.homedir(), '~'))\n .join(', ');\n log.info(\n 'Applying config file' +\n `${configFiles.length !== 1 ? 's' : ''}: ` +\n `${niceFileList}`);\n }\n\n configFiles.forEach((configFileName) => {\n const configObject = loadJSConfigFile(configFileName);\n adjustedArgv = applyConfigToArgv({\n argv: adjustedArgv,\n argvFromCLI: argv,\n configFileName,\n configObject,\n options: this.options,\n });\n });\n\n if (adjustedArgv.verbose) {\n // Ensure that the verbose is enabled when specified in a config file.\n this.enableVerboseMode(logStream, version);\n }\n\n this.checkRequiredArguments(adjustedArgv);\n\n await runCommand(adjustedArgv, {shouldExitProgram});\n\n } catch (error) {\n if (!(error instanceof UsageError) || adjustedArgv.verbose) {\n log.error(`\\n${error.stack}\\n`);\n } else {\n log.error(`\\n${String(error)}\\n`);\n }\n if (error.code) {\n log.error(`Error code: ${error.code}\\n`);\n }\n\n log.debug(`Command executed: ${cmd}`);\n\n if (this.shouldExitProgram) {\n systemProcess.exit(1);\n } else {\n throw error;\n }\n }\n }\n}\n\n//A defintion of type of argument for defaultVersionGetter\ntype VersionGetterOptions = {\n globalEnv?: string,\n};\n\nexport async function defaultVersionGetter(\n absolutePackageDir: string,\n {globalEnv = defaultGlobalEnv}: VersionGetterOptions = {}\n): Promise<string> {\n if (globalEnv === 'production') {\n log.debug('Getting the version from package.json');\n const packageData: any = readFileSync(\n path.join(absolutePackageDir, 'package.json'));\n return JSON.parse(packageData).version;\n } else {\n log.debug('Getting version from the git revision');\n // This branch is only reached during development.\n // git-rev-sync is in devDependencies, and lazily imported using require.\n // This also avoids logspam from https://github.com/mozilla/web-ext/issues/1916\n // eslint-disable-next-line import/no-extraneous-dependencies\n const git = await import('git-rev-sync');\n return `${git.branch(absolutePackageDir)}-${git.long(absolutePackageDir)}`;\n }\n}\n\n// TODO: add pipes to Flow type after https://github.com/facebook/flow/issues/2405 is fixed\n\ntype MainParams = {\n getVersion?: VersionGetterFn,\n commands?: Object,\n argv: Array<any>,\n runOptions?: Object,\n}\n\nexport function throwUsageErrorIfArray(errorMessage: string): any {\n return (value: any): any => {\n if (Array.isArray(value)) {\n throw new UsageError(errorMessage);\n }\n return value;\n };\n}\n\nexport async function main(\n absolutePackageDir: string,\n {\n getVersion = defaultVersionGetter, commands = defaultCommands, argv,\n runOptions = {},\n }: MainParams = {}\n): Promise<any> {\n const program = new Program(argv, {absolutePackageDir});\n const version = await getVersion(absolutePackageDir);\n\n // yargs uses magic camel case expansion to expose options on the\n // final argv object. For example, the 'artifacts-dir' option is alternatively\n // available as argv.artifactsDir.\n program.yargs\n .usage(`Usage: $0 [options] command\n\nOption values can also be set by declaring an environment variable prefixed\nwith $${envPrefix}_. For example: $${envPrefix}_SOURCE_DIR=/path is the same as\n--source-dir=/path.\n\nTo view specific help for any given command, add the command name.\nExample: $0 --help run.\n`)\n .help('help')\n .alias('h', 'help')\n .env(envPrefix)\n .version(version)\n .demandCommand(1, 'You must specify a command')\n .strict()\n .recommendCommands();\n\n program.setGlobalOptions({\n 'source-dir': {\n alias: 's',\n describe: 'Web extension source directory.',\n default: process.cwd(),\n requiresArg: true,\n type: 'string',\n coerce: (arg) => arg != null ? path.resolve(arg) : undefined,\n },\n 'artifacts-dir': {\n alias: 'a',\n describe: 'Directory where artifacts will be saved.',\n default: path.join(process.cwd(), 'web-ext-artifacts'),\n normalize: true,\n requiresArg: true,\n type: 'string',\n },\n 'verbose': {\n alias: 'v',\n describe: 'Show verbose output',\n type: 'boolean',\n demandOption: false,\n },\n 'ignore-files': {\n alias: 'i',\n describe: 'A list of glob patterns to define which files should be ' +\n 'ignored. (Example: --ignore-files=path/to/first.js ' +\n 'path/to/second.js \"**/*.log\")',\n demandOption: false,\n // The following option prevents yargs>=11 from parsing multiple values,\n // so the minimum value requirement is enforced in execute instead.\n // Upstream bug: https://github.com/yargs/yargs/issues/1098\n // requiresArg: true,\n type: 'array',\n },\n 'no-input': {\n describe: 'Disable all features that require standard input',\n type: 'boolean',\n demandOption: false,\n },\n 'input': {\n // This option is defined to make yargs to accept the --no-input\n // defined above, but we hide it from the yargs help output.\n hidden: true,\n type: 'boolean',\n demandOption: false,\n },\n 'config': {\n alias: 'c',\n describe: 'Path to a CommonJS config file to set ' +\n 'option defaults',\n default: undefined,\n demandOption: false,\n requiresArg: true,\n type: 'string',\n },\n 'config-discovery': {\n describe: 'Discover config files in home directory and ' +\n 'working directory. Disable with --no-config-discovery.',\n demandOption: false,\n default: true,\n type: 'boolean',\n },\n });\n\n program\n .command(\n 'build',\n 'Create an extension package from source',\n commands.build, {\n 'as-needed': {\n describe: 'Watch for file changes and re-build as needed',\n type: 'boolean',\n },\n 'filename': {\n alias: 'n',\n describe: 'Name of the created extension package file.',\n default: undefined,\n normalize: false,\n demandOption: false,\n requiresArg: true,\n type: 'string',\n coerce: (arg) => arg == null ?\n undefined : throwUsageErrorIfArray(\n 'Multiple --filename/-n option are not allowed'\n )(arg),\n },\n 'overwrite-dest': {\n alias: 'o',\n describe: 'Overwrite destination package if it exists.',\n type: 'boolean',\n },\n })\n .command(\n 'sign',\n 'Sign the extension so it can be installed in Firefox',\n commands.sign, {\n 'api-key': {\n describe: 'API key (JWT issuer) from addons.mozilla.org',\n demandOption: true,\n type: 'string',\n },\n 'api-secret': {\n describe: 'API secret (JWT secret) from addons.mozilla.org',\n demandOption: true,\n type: 'string',\n },\n 'api-url-prefix': {\n describe: 'Signing API URL prefix',\n default: 'https://addons.mozilla.org/api/v4',\n demandOption: true,\n type: 'string',\n },\n 'api-proxy': {\n describe:\n 'Use a proxy to access the signing API. ' +\n 'Example: https://yourproxy:6000 ',\n demandOption: false,\n type: 'string',\n },\n 'id': {\n describe:\n 'A custom ID for the extension. This has no effect if the ' +\n 'extension already declares an explicit ID in its manifest.',\n demandOption: false,\n type: 'string',\n },\n 'timeout': {\n describe: 'Number of milliseconds to wait before giving up',\n type: 'number',\n },\n 'channel': {\n describe: 'The channel for which to sign the addon. Either ' +\n '\\'listed\\' or \\'unlisted\\'',\n type: 'string',\n },\n })\n .command('run', 'Run the extension', commands.run, {\n 'target': {\n alias: 't',\n describe: 'The extensions runners to enable. Specify this option ' +\n 'multiple times to run against multiple targets.',\n default: 'firefox-desktop',\n demandOption: false,\n type: 'array',\n choices: ['firefox-desktop', 'firefox-android', 'chromium'],\n },\n 'firefox': {\n alias: ['f', 'firefox-binary'],\n describe: 'Path or alias to a Firefox executable such as firefox-bin ' +\n 'or firefox.exe. ' +\n 'If not specified, the default Firefox will be used. ' +\n 'You can specify the following aliases in lieu of a path: ' +\n 'firefox, beta, nightly, firefoxdeveloperedition. ' +\n 'For Flatpak, use `flatpak:org.mozilla.firefox` where ' +\n '`org.mozilla.firefox` is the application ID.',\n demandOption: false,\n type: 'string',\n },\n 'firefox-profile': {\n alias: 'p',\n describe: 'Run Firefox using a copy of this profile. The profile ' +\n 'can be specified as a directory or a name, such as one ' +\n 'you would see in the Profile Manager. If not specified, ' +\n 'a new temporary profile will be created.',\n demandOption: false,\n type: 'string',\n },\n 'chromium-binary': {\n describe: 'Path or alias to a Chromium executable such as ' +\n 'google-chrome, google-chrome.exe or opera.exe etc. ' +\n 'If not specified, the default Google Chrome will be used.',\n demandOption: false,\n type: 'string',\n },\n 'chromium-profile': {\n describe: 'Path to a custom Chromium profile',\n demandOption: false,\n type: 'string',\n },\n 'profile-create-if-missing': {\n describe: 'Create the profile directory if it does not already exist',\n demandOption: false,\n type: 'boolean',\n },\n 'keep-profile-changes': {\n describe: 'Run Firefox directly in custom profile. Any changes to ' +\n 'the profile will be saved.',\n demandOption: false,\n type: 'boolean',\n },\n 'reload': {\n describe: 'Reload the extension when source files change.' +\n 'Disable with --no-reload.',\n demandOption: false,\n default: true,\n type: 'boolean',\n },\n 'watch-file': {\n alias: ['watch-files'],\n describe: 'Reload the extension only when the contents of this' +\n ' file changes. This is useful if you use a custom' +\n ' build process for your extension',\n demandOption: false,\n type: 'array',\n },\n 'watch-ignored': {\n describe: 'Paths and globs patterns that should not be ' +\n 'watched for changes. This is useful if you want ' +\n 'to explicitly prevent web-ext from watching part ' +\n 'of the extension directory tree, ' +\n 'e.g. the node_modules folder.',\n demandOption: false,\n type: 'array',\n },\n 'pre-install': {\n describe: 'Pre-install the extension into the profile before ' +\n 'startup. This is only needed to support older versions ' +\n 'of Firefox.',\n demandOption: false,\n type: 'boolean',\n },\n 'pref': {\n describe: 'Launch firefox with a custom preference ' +\n '(example: --pref=general.useragent.locale=fr-FR). ' +\n 'You can repeat this option to set more than one ' +\n 'preference.',\n demandOption: false,\n requiresArg: true,\n type: 'array',\n coerce: (arg) => arg != null ?\n coerceCLICustomPreference(arg) : undefined,\n },\n 'start-url': {\n alias: ['u', 'url'],\n describe: 'Launch firefox at specified page',\n demandOption: false,\n type: 'array',\n },\n 'browser-console': {\n alias: ['bc'],\n describe: 'Open the DevTools Browser Console.',\n demandOption: false,\n type: 'boolean',\n },\n 'args': {\n alias: ['arg'],\n describe: 'Additional CLI options passed to the Browser binary',\n demandOption: false,\n type: 'array',\n },\n 'firefox-preview': {\n describe: 'Turn on developer preview features in Firefox' +\n ' (defaults to \"mv3\")',\n demandOption: false,\n type: 'array',\n },\n // Firefox for Android CLI options.\n 'adb-bin': {\n describe: 'Specify a custom path to the adb binary',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-host': {\n describe: 'Connect to adb on the specified host',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-port': {\n describe: 'Connect to adb on the specified port',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-device': {\n alias: ['android-device'],\n describe: 'Connect to the specified adb device name',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-discovery-timeout': {\n describe: 'Number of milliseconds to wait before giving up',\n demandOption: false,\n type: 'number',\n requiresArg: true,\n },\n 'adb-remove-old-artifacts': {\n describe: 'Remove old artifacts directories from the adb device',\n demandOption: false,\n type: 'boolean',\n },\n 'firefox-apk': {\n describe: (\n 'Run a specific Firefox for Android APK. ' +\n 'Example: org.mozilla.fennec_aurora'\n ),\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'firefox-apk-component': {\n describe:\n 'Run a specific Android Component (defaults to <firefox-apk>/.App)',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n })\n .command('lint', 'Validate the extension source', commands.lint, {\n 'output': {\n alias: 'o',\n describe: 'The type of output to generate',\n type: 'string',\n default: 'text',\n choices: ['json', 'text'],\n },\n 'metadata': {\n describe: 'Output only metadata as JSON',\n type: 'boolean',\n default: false,\n },\n 'warnings-as-errors': {\n describe: 'Treat warnings as errors by exiting non-zero for warnings',\n alias: 'w',\n type: 'boolean',\n default: false,\n },\n 'pretty': {\n describe: 'Prettify JSON output',\n type: 'boolean',\n default: false,\n },\n 'privileged': {\n describe: 'Treat your extension as a privileged extension',\n type: 'boolean',\n default: false,\n },\n 'self-hosted': {\n describe:\n 'Your extension will be self-hosted. This disables messages ' +\n 'related to hosting on addons.mozilla.org.',\n type: 'boolean',\n default: false,\n },\n 'boring': {\n describe: 'Disables colorful shell output',\n type: 'boolean',\n default: false,\n },\n })\n .command('docs', 'Open the web-ext documentation in a browser',\n commands.docs, {});\n\n return program.execute({getVersion, ...runOptions});\n}\n"],"mappings":"AACA,OAAOA,EAAP,MAAe,IAAf;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAAQC,YAAR,QAA2B,IAA3B;AAEA,OAAOC,SAAP,MAAsB,WAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAM,IAAIC,WAAnB,QAAsC,eAAtC;AAEA,OAAOC,eAAP,MAA4B,gBAA5B;AACA,SAAQC,UAAR,QAAyB,aAAzB;AACA,SACEC,YADF,EAEEC,aAAa,IAAIC,gBAFnB,QAGO,kBAHP;AAIA,SAAQC,yBAAR,QAAwC,0BAAxC;AACA,SAAQC,eAAe,IAAIC,oBAA3B,QAAsD,mBAAtD;AACA,SACEC,mBAAmB,IAAIC,sBADzB,EAEEC,gBAAgB,IAAIC,uBAFtB,EAGEC,iBAAiB,IAAIC,wBAHvB,QAIO,aAJP;AAMA,MAAMC,GAAG,GAAGZ,YAAY,CAACa,MAAM,CAACC,IAAP,CAAYC,GAAb,CAAxB;AACA,MAAMC,SAAS,GAAG,SAAlB,C,CACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,gBAAgC,aAAzD;;AAwBA;AACA;AACA;AACA,OAAO,MAAMC,OAAN,CAAc;EAUnBC,WAAW,CACTC,IADS,EAET;IACEC,kBAAkB,GAAGC,OAAO,CAACC,GAAR;EADvB,IAEoB,EAJX,EAKT;IACA;IACA;IACA;IACA;IACAH,IAAI,GA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;MACVX,QAAQ,EAAE,8BADA;MAEVG,IAAI,EAAE,SAFI;MAGVF,OAAO,EAAE;IAHC,CARmD;IAa/D,sBAAsB;MACpBD,QAAQ,EAAE,2DADU;MAEpBF,KAAK,EAAE,GAFa;MAGpBK,IAAI,EAAE,SAHc;MAIpBF,OAAO,EAAE;IAJW,CAbyC;IAmB/D,UAAU;MACRD,QAAQ,EAAE,sBADF;MAERG,IAAI,EAAE,SAFE;MAGRF,OAAO,EAAE;IAHD,CAnBqD;IAwB/D,cAAc;MACZD,QAAQ,EAAE,gDADE;MAEZG,IAAI,EAAE,SAFM;MAGZF,OAAO,EAAE;IAHG,CAxBiD;IA6B/D,eAAe;MACbD,QAAQ,EACN,gEACA,2CAHW;MAIbG,IAAI,EAAE,SAJO;MAKbF,OAAO,EAAE;IALI,CA7BgD;IAoC/D,UAAU;MACRD,QAAQ,EAAE,gCADF;MAERG,IAAI,EAAE,SAFE;MAGRF,OAAO,EAAE;IAHD;EApCqD,CAtPnE,EAgSGrG,OAhSH,CAgSW,MAhSX,EAgSmB,6CAhSnB,EAiSWF,QAAQ,CAACmH,IAjSpB,EAiS0B,EAjS1B;EAmSA,OAAOlB,OAAO,CAACnC,OAAR,CAAgB;IAACC,UAAD;IAAa,GAAGiC;EAAhB,CAAhB,CAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"program.js","names":["os","path","readFileSync","camelCase","decamelize","yargs","Parser","yargsParser","defaultCommands","UsageError","createLogger","consoleStream","defaultLogStream","coerceCLICustomPreference","checkForUpdates","defaultUpdateChecker","discoverConfigFiles","defaultConfigDiscovery","loadJSConfigFile","defaultLoadJSConfigFile","applyConfigToArgv","defaultApplyConfigToArgv","log","import","meta","url","envPrefix","defaultGlobalEnv","Program","constructor","argv","absolutePackageDir","process","cwd","slice","programArgv","yargsInstance","verboseEnabled","shouldExitProgram","parserConfiguration","strict","wrap","terminalWidth","commands","options","command","name","description","executor","commandOptions","yargsForCmd","demandCommand","undefined","exitProcess","env","setGlobalOptions","Object","keys","forEach","key","global","demandOption","enableVerboseMode","logStream","version","makeVerbose","info","getArguments","validationInstance","getInternalMethods","getValidationInstance","requiredArguments","demandedOptions","getDemandedOptions","args","err","message","startsWith","configDiscovery","noConfigDiscovery","reload","noReload","input","noInput","ignoreFiles","length","startUrl","Array","isArray","firefoxPreview","checkRequiredArguments","adjustedArgv","cleanupProcessEnvConfigs","systemProcess","cmd","_","toOptionKey","k","replace","separator","filter","optKey","globalOpt","cmdOpt","debug","execute","getVersion","defaultVersionGetter","globalEnv","runCommand","verbose","configFiles","discoveredConfigs","push","config","resolve","niceFileList","map","f","homedir","join","configFileName","configObject","argvFromCLI","error","stack","String","code","exit","packageData","JSON","parse","git","branch","long","throwUsageErrorIfArray","errorMessage","value","main","runOptions","program","firefoxPreviewOption","describe","type","usage","help","alias","recommendCommands","default","requiresArg","coerce","arg","normalize","hidden","build","sign","run","choices","lint","docs"],"sources":["../src/program.js"],"sourcesContent":["/* @flow */\nimport os from 'os';\nimport path from 'path';\nimport {readFileSync} from 'fs';\n\nimport camelCase from 'camelcase';\nimport decamelize from 'decamelize';\nimport yargs from 'yargs';\nimport { Parser as yargsParser } from 'yargs/helpers';\n\nimport defaultCommands from './cmd/index.js';\nimport {UsageError} from './errors.js';\nimport {\n createLogger,\n consoleStream as defaultLogStream,\n} from './util/logger.js';\nimport {coerceCLICustomPreference} from './firefox/preferences.js';\nimport {checkForUpdates as defaultUpdateChecker} from './util/updates.js';\nimport {\n discoverConfigFiles as defaultConfigDiscovery,\n loadJSConfigFile as defaultLoadJSConfigFile,\n applyConfigToArgv as defaultApplyConfigToArgv,\n} from './config.js';\n\nconst log = createLogger(import.meta.url);\nconst envPrefix = 'WEB_EXT';\n// Default to \"development\" (the value actually assigned will be interpolated\n// by babel-plugin-transform-inline-environment-variables).\nconst defaultGlobalEnv = process.env.WEBEXT_BUILD_ENV || 'development';\n\n\ntype ProgramOptions = {\n absolutePackageDir?: string,\n}\n\nexport type VersionGetterFn = (absolutePackageDir: string) => Promise<string>;\n\n// TODO: add pipes to Flow type after https://github.com/facebook/flow/issues/2405 is fixed\n\ntype ExecuteOptions = {\n checkForUpdates?: Function,\n systemProcess?: typeof process,\n logStream?: typeof defaultLogStream,\n getVersion?: VersionGetterFn,\n applyConfigToArgv?: typeof defaultApplyConfigToArgv,\n discoverConfigFiles?: typeof defaultConfigDiscovery,\n loadJSConfigFile?: typeof defaultLoadJSConfigFile,\n shouldExitProgram?: boolean,\n globalEnv?: string | void,\n}\n\n\n/*\n * The command line program.\n */\nexport class Program {\n absolutePackageDir: string;\n yargs: any;\n commands: { [key: string]: Function };\n shouldExitProgram: boolean;\n verboseEnabled: boolean;\n options: Object;\n programArgv: Array<string>;\n demandedOptions: Object;\n\n constructor(\n argv: ?Array<string>,\n {\n absolutePackageDir = process.cwd(),\n }: ProgramOptions = {}\n ) {\n // This allows us to override the process argv which is useful for\n // testing.\n // NOTE: process.argv.slice(2) removes the path to node and web-ext\n // executables from the process.argv array.\n argv = argv || process.argv.slice(2);\n this.programArgv = argv;\n\n // NOTE: always initialize yargs explicitly with the package dir\n // to avoid side-effects due to yargs looking for its configuration\n // section from a package.json file stored in an arbitrary directory\n // (e.g. in tests yargs would end up loading yargs config from the\n // mocha package.json). web-ext package.json doesn't contain any yargs\n // section as it is deprecated and we configure yargs using\n // yargs.parserConfiguration. See web-ext#469 for rationale.\n const yargsInstance = yargs(argv, absolutePackageDir);\n\n this.absolutePackageDir = absolutePackageDir;\n this.verboseEnabled = false;\n this.shouldExitProgram = true;\n\n this.yargs = yargsInstance;\n this.yargs.parserConfiguration({\n 'boolean-negation': true,\n });\n this.yargs.strict();\n this.yargs.wrap(this.yargs.terminalWidth());\n\n this.commands = {};\n this.options = {};\n }\n\n command(\n name: string, description: string, executor: Function,\n commandOptions: Object = {}\n ): Program {\n this.options[camelCase(name)] = commandOptions;\n\n this.yargs.command(name, description, (yargsForCmd) => {\n if (!commandOptions) {\n return;\n }\n return yargsForCmd\n // Make sure the user does not add any extra commands. For example,\n // this would be a mistake because lint does not accept arguments:\n // web-ext lint ./src/path/to/file.js\n .demandCommand(0, 0, undefined,\n 'This command does not take any arguments')\n .strict()\n .exitProcess(this.shouldExitProgram)\n // Calling env() will be unnecessary after\n // https://github.com/yargs/yargs/issues/486 is fixed\n .env(envPrefix)\n .options(commandOptions);\n });\n this.commands[name] = executor;\n return this;\n }\n\n setGlobalOptions(options: Object): Program {\n // This is a convenience for setting global options.\n // An option is only global (i.e. available to all sub commands)\n // with the `global` flag so this makes sure every option has it.\n this.options = {...this.options, ...options};\n Object.keys(options).forEach((key) => {\n options[key].global = true;\n if (options[key].demandOption === undefined) {\n // By default, all options should be \"demanded\" otherwise\n // yargs.strict() will think they are missing when declared.\n options[key].demandOption = true;\n }\n });\n this.yargs.options(options);\n return this;\n }\n\n enableVerboseMode(\n logStream: typeof defaultLogStream,\n version: string\n ): void {\n if (this.verboseEnabled) {\n return;\n }\n\n logStream.makeVerbose();\n log.info('Version:', version);\n this.verboseEnabled = true;\n }\n\n // Retrieve the yargs argv object and apply any further fix needed\n // on the output of the yargs options parsing.\n getArguments(): Object {\n // To support looking up required parameters via config files, we need to\n // temporarily disable the requiredArguments validation. Otherwise yargs\n // would exit early. Validation is enforced by the checkRequiredArguments()\n // method, after reading configuration files.\n //\n // This is an undocumented internal API of yargs! Unit tests to avoid\n // regressions are located at: tests/functional/test.cli.sign.js\n //\n // Replace hack if possible: https://github.com/mozilla/web-ext/issues/1930\n const validationInstance =\n this.yargs.getInternalMethods().getValidationInstance();\n const { requiredArguments } = validationInstance;\n // Initialize demandedOptions (which is going to be set to an object with one\n // property for each mandatory global options, then the arrow function below\n // will receive as its demandedOptions parameter a new one that also includes\n // all mandatory options for the sub command selected).\n this.demandedOptions = this.yargs.getDemandedOptions();\n validationInstance.requiredArguments = (args, demandedOptions) => {\n this.demandedOptions = demandedOptions;\n };\n let argv;\n try {\n argv = this.yargs.argv;\n } catch (err) {\n if (err.name === 'YError' &&\n err.message.startsWith('Unknown argument: ')) {\n throw new UsageError(err.message);\n }\n throw err;\n }\n validationInstance.requiredArguments = requiredArguments;\n\n // Yargs boolean options doesn't define the no* counterpart\n // with negate-boolean on Yargs 15. Define as expected by the\n // web-ext execute method.\n if (argv.configDiscovery != null) {\n argv.noConfigDiscovery = !argv.configDiscovery;\n }\n if (argv.reload != null) {\n argv.noReload = !argv.reload;\n }\n\n // Yargs doesn't accept --no-input as a valid option if there isn't a\n // --input option defined to be negated, to fix that the --input is\n // defined and hidden from the yargs help output and we define here\n // the negated argument name that we expect to be set in the parsed\n // arguments (and fix https://github.com/mozilla/web-ext/issues/1860).\n if (argv.input != null) {\n argv.noInput = !argv.input;\n }\n\n // Replacement for the \"requiresArg: true\" parameter until the following bug\n // is fixed: https://github.com/yargs/yargs/issues/1098\n if (argv.ignoreFiles && !argv.ignoreFiles.length) {\n throw new UsageError('Not enough arguments following: ignore-files');\n }\n\n if (argv.startUrl && !argv.startUrl.length) {\n throw new UsageError('Not enough arguments following: start-url');\n }\n\n if (Array.isArray(argv.firefoxPreview) && !argv.firefoxPreview.length) {\n argv.firefoxPreview = ['mv3'];\n }\n\n return argv;\n }\n\n // getArguments() disables validation of required parameters, to allow us to\n // read parameters from config files first. Before the program continues, it\n // must call checkRequiredArguments() to ensure that required parameters are\n // defined (in the CLI or in a config file).\n checkRequiredArguments(adjustedArgv: Object): void {\n const validationInstance =\n this.yargs.getInternalMethods().getValidationInstance();\n validationInstance.requiredArguments(adjustedArgv, this.demandedOptions);\n }\n\n // Remove WEB_EXT_* environment vars that are not a global cli options\n // or an option supported by the current command (See #793).\n cleanupProcessEnvConfigs(systemProcess: typeof process) {\n const cmd = yargsParser(this.programArgv)._[0];\n const env = systemProcess.env || {};\n const toOptionKey = (k) => decamelize(\n camelCase(k.replace(envPrefix, '')), {separator: '-'}\n );\n\n if (cmd) {\n Object.keys(env)\n .filter((k) => k.startsWith(envPrefix))\n .forEach((k) => {\n const optKey = toOptionKey(k);\n const globalOpt = this.options[optKey];\n const cmdOpt = this.options[cmd] && this.options[cmd][optKey];\n\n if (!globalOpt && !cmdOpt) {\n log.debug(`Environment ${k} not supported by web-ext ${cmd}`);\n delete env[k];\n }\n });\n }\n }\n\n async execute(\n {\n checkForUpdates = defaultUpdateChecker,\n systemProcess = process,\n logStream = defaultLogStream,\n getVersion = defaultVersionGetter,\n applyConfigToArgv = defaultApplyConfigToArgv,\n discoverConfigFiles = defaultConfigDiscovery,\n loadJSConfigFile = defaultLoadJSConfigFile,\n shouldExitProgram = true,\n globalEnv = defaultGlobalEnv,\n }: ExecuteOptions = {}\n ): Promise<void> {\n this.shouldExitProgram = shouldExitProgram;\n this.yargs.exitProcess(this.shouldExitProgram);\n\n this.cleanupProcessEnvConfigs(systemProcess);\n const argv = this.getArguments();\n\n const cmd = argv._[0];\n\n const version = await getVersion(this.absolutePackageDir);\n const runCommand = this.commands[cmd];\n\n if (argv.verbose) {\n this.enableVerboseMode(logStream, version);\n }\n\n let adjustedArgv = {...argv};\n\n try {\n if (cmd === undefined) {\n throw new UsageError('No sub-command was specified in the args');\n }\n if (!runCommand) {\n throw new UsageError(`Unknown command: ${cmd}`);\n }\n if (globalEnv === 'production') {\n checkForUpdates({version});\n }\n\n const configFiles = [];\n\n if (argv.configDiscovery) {\n log.debug(\n 'Discovering config files. ' +\n 'Set --no-config-discovery to disable');\n const discoveredConfigs = await discoverConfigFiles();\n configFiles.push(...discoveredConfigs);\n } else {\n log.debug('Not discovering config files');\n }\n\n if (argv.config) {\n configFiles.push(path.resolve(argv.config));\n }\n\n if (configFiles.length) {\n const niceFileList = configFiles\n .map((f) => f.replace(process.cwd(), '.'))\n .map((f) => f.replace(os.homedir(), '~'))\n .join(', ');\n log.info(\n 'Applying config file' +\n `${configFiles.length !== 1 ? 's' : ''}: ` +\n `${niceFileList}`);\n }\n\n configFiles.forEach((configFileName) => {\n const configObject = loadJSConfigFile(configFileName);\n adjustedArgv = applyConfigToArgv({\n argv: adjustedArgv,\n argvFromCLI: argv,\n configFileName,\n configObject,\n options: this.options,\n });\n });\n\n if (adjustedArgv.verbose) {\n // Ensure that the verbose is enabled when specified in a config file.\n this.enableVerboseMode(logStream, version);\n }\n\n this.checkRequiredArguments(adjustedArgv);\n\n await runCommand(adjustedArgv, {shouldExitProgram});\n\n } catch (error) {\n if (!(error instanceof UsageError) || adjustedArgv.verbose) {\n log.error(`\\n${error.stack}\\n`);\n } else {\n log.error(`\\n${String(error)}\\n`);\n }\n if (error.code) {\n log.error(`Error code: ${error.code}\\n`);\n }\n\n log.debug(`Command executed: ${cmd}`);\n\n if (this.shouldExitProgram) {\n systemProcess.exit(1);\n } else {\n throw error;\n }\n }\n }\n}\n\n//A defintion of type of argument for defaultVersionGetter\ntype VersionGetterOptions = {\n globalEnv?: string,\n};\n\nexport async function defaultVersionGetter(\n absolutePackageDir: string,\n {globalEnv = defaultGlobalEnv}: VersionGetterOptions = {}\n): Promise<string> {\n if (globalEnv === 'production') {\n log.debug('Getting the version from package.json');\n const packageData: any = readFileSync(\n path.join(absolutePackageDir, 'package.json'));\n return JSON.parse(packageData).version;\n } else {\n log.debug('Getting version from the git revision');\n // This branch is only reached during development.\n // git-rev-sync is in devDependencies, and lazily imported using require.\n // This also avoids logspam from https://github.com/mozilla/web-ext/issues/1916\n // eslint-disable-next-line import/no-extraneous-dependencies\n const git = await import('git-rev-sync');\n return `${git.branch(absolutePackageDir)}-${git.long(absolutePackageDir)}`;\n }\n}\n\n// TODO: add pipes to Flow type after https://github.com/facebook/flow/issues/2405 is fixed\n\ntype MainParams = {\n getVersion?: VersionGetterFn,\n commands?: Object,\n argv: Array<any>,\n runOptions?: Object,\n}\n\nexport function throwUsageErrorIfArray(errorMessage: string): any {\n return (value: any): any => {\n if (Array.isArray(value)) {\n throw new UsageError(errorMessage);\n }\n return value;\n };\n}\n\nexport async function main(\n absolutePackageDir: string,\n {\n getVersion = defaultVersionGetter, commands = defaultCommands, argv,\n runOptions = {},\n }: MainParams = {}\n): Promise<any> {\n const program = new Program(argv, {absolutePackageDir});\n const version = await getVersion(absolutePackageDir);\n\n // This is an option shared by some commands but not all of them, hence why\n // it isn't a global option.\n const firefoxPreviewOption = {\n describe: 'Turn on developer preview features in Firefox' +\n ' (defaults to \"mv3\")',\n demandOption: false,\n type: 'array',\n };\n\n // yargs uses magic camel case expansion to expose options on the\n // final argv object. For example, the 'artifacts-dir' option is alternatively\n // available as argv.artifactsDir.\n program.yargs\n .usage(`Usage: $0 [options] command\n\nOption values can also be set by declaring an environment variable prefixed\nwith $${envPrefix}_. For example: $${envPrefix}_SOURCE_DIR=/path is the same as\n--source-dir=/path.\n\nTo view specific help for any given command, add the command name.\nExample: $0 --help run.\n`)\n .help('help')\n .alias('h', 'help')\n .env(envPrefix)\n .version(version)\n .demandCommand(1, 'You must specify a command')\n .strict()\n .recommendCommands();\n\n program.setGlobalOptions({\n 'source-dir': {\n alias: 's',\n describe: 'Web extension source directory.',\n default: process.cwd(),\n requiresArg: true,\n type: 'string',\n coerce: (arg) => arg != null ? path.resolve(arg) : undefined,\n },\n 'artifacts-dir': {\n alias: 'a',\n describe: 'Directory where artifacts will be saved.',\n default: path.join(process.cwd(), 'web-ext-artifacts'),\n normalize: true,\n requiresArg: true,\n type: 'string',\n },\n 'verbose': {\n alias: 'v',\n describe: 'Show verbose output',\n type: 'boolean',\n demandOption: false,\n },\n 'ignore-files': {\n alias: 'i',\n describe: 'A list of glob patterns to define which files should be ' +\n 'ignored. (Example: --ignore-files=path/to/first.js ' +\n 'path/to/second.js \"**/*.log\")',\n demandOption: false,\n // The following option prevents yargs>=11 from parsing multiple values,\n // so the minimum value requirement is enforced in execute instead.\n // Upstream bug: https://github.com/yargs/yargs/issues/1098\n // requiresArg: true,\n type: 'array',\n },\n 'no-input': {\n describe: 'Disable all features that require standard input',\n type: 'boolean',\n demandOption: false,\n },\n 'input': {\n // This option is defined to make yargs to accept the --no-input\n // defined above, but we hide it from the yargs help output.\n hidden: true,\n type: 'boolean',\n demandOption: false,\n },\n 'config': {\n alias: 'c',\n describe: 'Path to a CommonJS config file to set ' +\n 'option defaults',\n default: undefined,\n demandOption: false,\n requiresArg: true,\n type: 'string',\n },\n 'config-discovery': {\n describe: 'Discover config files in home directory and ' +\n 'working directory. Disable with --no-config-discovery.',\n demandOption: false,\n default: true,\n type: 'boolean',\n },\n });\n\n program\n .command(\n 'build',\n 'Create an extension package from source',\n commands.build, {\n 'as-needed': {\n describe: 'Watch for file changes and re-build as needed',\n type: 'boolean',\n },\n 'filename': {\n alias: 'n',\n describe: 'Name of the created extension package file.',\n default: undefined,\n normalize: false,\n demandOption: false,\n requiresArg: true,\n type: 'string',\n coerce: (arg) => arg == null ?\n undefined : throwUsageErrorIfArray(\n 'Multiple --filename/-n option are not allowed'\n )(arg),\n },\n 'overwrite-dest': {\n alias: 'o',\n describe: 'Overwrite destination package if it exists.',\n type: 'boolean',\n },\n })\n .command(\n 'sign',\n 'Sign the extension so it can be installed in Firefox',\n commands.sign, {\n 'amo-base-url': {\n describe:\n 'Signing API URL prefix - only used with `use-submission-api`',\n default: 'https://addons.mozilla.org/api/v5',\n demandOption: true,\n type: 'string',\n },\n 'api-key': {\n describe: 'API key (JWT issuer) from addons.mozilla.org',\n demandOption: true,\n type: 'string',\n },\n 'api-secret': {\n describe: 'API secret (JWT secret) from addons.mozilla.org',\n demandOption: true,\n type: 'string',\n },\n 'api-url-prefix': {\n describe: 'Signing API URL prefix',\n default: 'https://addons.mozilla.org/api/v4',\n demandOption: true,\n type: 'string',\n },\n 'api-proxy': {\n describe:\n 'Use a proxy to access the signing API. ' +\n 'Example: https://yourproxy:6000 ',\n demandOption: false,\n type: 'string',\n },\n 'use-submission-api': {\n describe:\n 'Sign using the addon submission API',\n demandOption: false,\n type: 'boolean',\n },\n 'id': {\n describe:\n 'A custom ID for the extension. This has no effect if the ' +\n 'extension already declares an explicit ID in its manifest.',\n demandOption: false,\n type: 'string',\n },\n 'timeout': {\n describe: 'Number of milliseconds to wait before giving up',\n type: 'number',\n },\n 'channel': {\n describe: 'The channel for which to sign the addon. Either ' +\n '\\'listed\\' or \\'unlisted\\'',\n },\n 'amo-metadata': {\n describe: 'Path to a JSON file containing an object with metadata ' +\n 'to be passed to the API. ' +\n 'See https://addons-server.readthedocs.io' +\n '/en/latest/topics/api/addons.html for details. ' +\n 'Only used with `use-submission-api`',\n type: 'string',\n },\n })\n .command('run', 'Run the extension', commands.run, {\n 'target': {\n alias: 't',\n describe: 'The extensions runners to enable. Specify this option ' +\n 'multiple times to run against multiple targets.',\n default: 'firefox-desktop',\n demandOption: false,\n type: 'array',\n choices: ['firefox-desktop', 'firefox-android', 'chromium'],\n },\n 'firefox': {\n alias: ['f', 'firefox-binary'],\n describe: 'Path or alias to a Firefox executable such as firefox-bin ' +\n 'or firefox.exe. ' +\n 'If not specified, the default Firefox will be used. ' +\n 'You can specify the following aliases in lieu of a path: ' +\n 'firefox, beta, nightly, firefoxdeveloperedition. ' +\n 'For Flatpak, use `flatpak:org.mozilla.firefox` where ' +\n '`org.mozilla.firefox` is the application ID.',\n demandOption: false,\n type: 'string',\n },\n 'firefox-profile': {\n alias: 'p',\n describe: 'Run Firefox using a copy of this profile. The profile ' +\n 'can be specified as a directory or a name, such as one ' +\n 'you would see in the Profile Manager. If not specified, ' +\n 'a new temporary profile will be created.',\n demandOption: false,\n type: 'string',\n },\n 'chromium-binary': {\n describe: 'Path or alias to a Chromium executable such as ' +\n 'google-chrome, google-chrome.exe or opera.exe etc. ' +\n 'If not specified, the default Google Chrome will be used.',\n demandOption: false,\n type: 'string',\n },\n 'chromium-profile': {\n describe: 'Path to a custom Chromium profile',\n demandOption: false,\n type: 'string',\n },\n 'profile-create-if-missing': {\n describe: 'Create the profile directory if it does not already exist',\n demandOption: false,\n type: 'boolean',\n },\n 'keep-profile-changes': {\n describe: 'Run Firefox directly in custom profile. Any changes to ' +\n 'the profile will be saved.',\n demandOption: false,\n type: 'boolean',\n },\n 'reload': {\n describe: 'Reload the extension when source files change.' +\n 'Disable with --no-reload.',\n demandOption: false,\n default: true,\n type: 'boolean',\n },\n 'watch-file': {\n alias: ['watch-files'],\n describe: 'Reload the extension only when the contents of this' +\n ' file changes. This is useful if you use a custom' +\n ' build process for your extension',\n demandOption: false,\n type: 'array',\n },\n 'watch-ignored': {\n describe: 'Paths and globs patterns that should not be ' +\n 'watched for changes. This is useful if you want ' +\n 'to explicitly prevent web-ext from watching part ' +\n 'of the extension directory tree, ' +\n 'e.g. the node_modules folder.',\n demandOption: false,\n type: 'array',\n },\n 'pre-install': {\n describe: 'Pre-install the extension into the profile before ' +\n 'startup. This is only needed to support older versions ' +\n 'of Firefox.',\n demandOption: false,\n type: 'boolean',\n },\n 'pref': {\n describe: 'Launch firefox with a custom preference ' +\n '(example: --pref=general.useragent.locale=fr-FR). ' +\n 'You can repeat this option to set more than one ' +\n 'preference.',\n demandOption: false,\n requiresArg: true,\n type: 'array',\n coerce: (arg) => arg != null ?\n coerceCLICustomPreference(arg) : undefined,\n },\n 'start-url': {\n alias: ['u', 'url'],\n describe: 'Launch firefox at specified page',\n demandOption: false,\n type: 'array',\n },\n 'devtools': {\n describe: 'Open the DevTools for the installed add-on ' +\n '(Firefox 106 and later)',\n demandOption: false,\n type: 'boolean',\n },\n 'browser-console': {\n alias: ['bc'],\n describe: 'Open the DevTools Browser Console.',\n demandOption: false,\n type: 'boolean',\n },\n 'args': {\n alias: ['arg'],\n describe: 'Additional CLI options passed to the Browser binary',\n demandOption: false,\n type: 'array',\n },\n 'firefox-preview': firefoxPreviewOption,\n // Firefox for Android CLI options.\n 'adb-bin': {\n describe: 'Specify a custom path to the adb binary',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-host': {\n describe: 'Connect to adb on the specified host',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-port': {\n describe: 'Connect to adb on the specified port',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-device': {\n alias: ['android-device'],\n describe: 'Connect to the specified adb device name',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'adb-discovery-timeout': {\n describe: 'Number of milliseconds to wait before giving up',\n demandOption: false,\n type: 'number',\n requiresArg: true,\n },\n 'adb-remove-old-artifacts': {\n describe: 'Remove old artifacts directories from the adb device',\n demandOption: false,\n type: 'boolean',\n },\n 'firefox-apk': {\n describe: (\n 'Run a specific Firefox for Android APK. ' +\n 'Example: org.mozilla.fennec_aurora'\n ),\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n 'firefox-apk-component': {\n describe:\n 'Run a specific Android Component (defaults to <firefox-apk>/.App)',\n demandOption: false,\n type: 'string',\n requiresArg: true,\n },\n })\n .command('lint', 'Validate the extension source', commands.lint, {\n 'output': {\n alias: 'o',\n describe: 'The type of output to generate',\n type: 'string',\n default: 'text',\n choices: ['json', 'text'],\n },\n 'metadata': {\n describe: 'Output only metadata as JSON',\n type: 'boolean',\n default: false,\n },\n 'warnings-as-errors': {\n describe: 'Treat warnings as errors by exiting non-zero for warnings',\n alias: 'w',\n type: 'boolean',\n default: false,\n },\n 'pretty': {\n describe: 'Prettify JSON output',\n type: 'boolean',\n default: false,\n },\n 'privileged': {\n describe: 'Treat your extension as a privileged extension',\n type: 'boolean',\n default: false,\n },\n 'self-hosted': {\n describe:\n 'Your extension will be self-hosted. This disables messages ' +\n 'related to hosting on addons.mozilla.org.',\n type: 'boolean',\n default: false,\n },\n 'boring': {\n describe: 'Disables colorful shell output',\n type: 'boolean',\n default: false,\n },\n 'firefox-preview': firefoxPreviewOption,\n })\n .command('docs', 'Open the web-ext documentation in a browser',\n commands.docs, {});\n\n return program.execute({getVersion, ...runOptions});\n}\n"],"mappings":";AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAAQC,YAAY,QAAO,IAAI;AAE/B,OAAOC,SAAS,MAAM,WAAW;AACjC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,IAAIC,WAAW,QAAQ,eAAe;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AEP;EACrB,CAAC,CAAC,CACDhG,OAAO,CAAC,MAAM,EAAE,6CAA6C,EACrDF,QAAQ,CAACoH,IAAI,EAAE,CAAC,CAAC,CAAC;EAE7B,OAAOnB,OAAO,CAACnC,OAAO,CAAC;IAACC,UAAU;IAAE,GAAGiC;EAAU,CAAC,CAAC;AACrD"}
|
package/lib/util/adb.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import ADBKit from '@devicefarmer/adbkit';
|
|
2
3
|
import { isErrorWithCode, UsageError, WebExtError } from '../errors.js';
|
|
3
4
|
import { createLogger } from '../util/logger.js';
|
|
@@ -6,7 +7,6 @@ export const DEVICE_DIR_BASE = '/data/local/tmp/';
|
|
|
6
7
|
export const ARTIFACTS_DIR_PREFIX = 'web-ext-artifacts-';
|
|
7
8
|
const defaultADB = ADBKit.default;
|
|
8
9
|
const log = createLogger(import.meta.url);
|
|
9
|
-
|
|
10
10
|
// Helper function used to raise an UsageError when the adb binary has not been found.
|
|
11
11
|
async function wrapADBCall(asyncFn) {
|
|
12
12
|
try {
|
|
@@ -15,16 +15,17 @@ async function wrapADBCall(asyncFn) {
|
|
|
15
15
|
if (isErrorWithCode('ENOENT', error) && error.message.includes('spawn adb')) {
|
|
16
16
|
throw new UsageError('No adb executable has been found. ' + 'You can Use --adb-bin, --adb-host/--adb-port ' + 'to configure it manually if needed.');
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
throw error;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
export default class ADBUtils {
|
|
24
22
|
// TODO: better flow typing here.
|
|
23
|
+
|
|
25
24
|
// Map<deviceId -> artifactsDir>
|
|
25
|
+
|
|
26
26
|
// Toggled when the user wants to abort the RDP Unix Socket discovery loop
|
|
27
27
|
// while it is still executing.
|
|
28
|
+
|
|
28
29
|
constructor(params) {
|
|
29
30
|
this.params = params;
|
|
30
31
|
const {
|
|
@@ -42,7 +43,6 @@ export default class ADBUtils {
|
|
|
42
43
|
this.artifactsDirMap = new Map();
|
|
43
44
|
this.userAbortDiscovery = false;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
46
|
runShellCommand(deviceId, cmd) {
|
|
47
47
|
const {
|
|
48
48
|
adb,
|
|
@@ -53,7 +53,6 @@ export default class ADBUtils {
|
|
|
53
53
|
return await adbClient.getDevice(deviceId).shell(cmd).then(adb.util.readAll);
|
|
54
54
|
}).then(res => res.toString());
|
|
55
55
|
}
|
|
56
|
-
|
|
57
56
|
async discoverDevices() {
|
|
58
57
|
const {
|
|
59
58
|
adbClient
|
|
@@ -63,7 +62,6 @@ export default class ADBUtils {
|
|
|
63
62
|
devices = await wrapADBCall(async () => adbClient.listDevices());
|
|
64
63
|
return devices.map(dev => dev.id);
|
|
65
64
|
}
|
|
66
|
-
|
|
67
65
|
async discoverInstalledFirefoxAPKs(deviceId, firefoxApk) {
|
|
68
66
|
log.debug(`Listing installed Firefox APKs on ${deviceId}`);
|
|
69
67
|
const pmList = await this.runShellCommand(deviceId, ['pm', 'list', 'packages']);
|
|
@@ -71,41 +69,40 @@ export default class ADBUtils {
|
|
|
71
69
|
// Look for an exact match if firefoxApk is defined.
|
|
72
70
|
if (firefoxApk) {
|
|
73
71
|
return line === firefoxApk;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
}
|
|
73
|
+
// Match any package name that starts with the package name of a Firefox for Android browser.
|
|
77
74
|
for (const browser of packageIdentifiers) {
|
|
78
75
|
if (line.startsWith(browser)) {
|
|
79
76
|
return true;
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
|
|
83
79
|
return false;
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
|
-
|
|
87
82
|
async getAndroidVersionNumber(deviceId) {
|
|
88
83
|
const androidVersion = (await this.runShellCommand(deviceId, ['getprop', 'ro.build.version.sdk'])).trim();
|
|
89
|
-
const androidVersionNumber = parseInt(androidVersion);
|
|
84
|
+
const androidVersionNumber = parseInt(androidVersion);
|
|
90
85
|
|
|
86
|
+
// No need to check the granted runtime permissions on Android versions < Lollypop.
|
|
91
87
|
if (isNaN(androidVersionNumber)) {
|
|
92
88
|
throw new WebExtError('Unable to discovery android version on ' + `${deviceId}: ${androidVersion}`);
|
|
93
89
|
}
|
|
94
|
-
|
|
95
90
|
return androidVersionNumber;
|
|
96
|
-
}
|
|
97
|
-
|
|
91
|
+
}
|
|
98
92
|
|
|
93
|
+
// Raise an UsageError when the given APK does not have the required runtime permissions.
|
|
99
94
|
async ensureRequiredAPKRuntimePermissions(deviceId, apk, permissions) {
|
|
100
|
-
const permissionsMap = {};
|
|
95
|
+
const permissionsMap = {};
|
|
101
96
|
|
|
97
|
+
// Initialize every permission to false in the permissions map.
|
|
102
98
|
for (const perm of permissions) {
|
|
103
99
|
permissionsMap[perm] = false;
|
|
104
|
-
}
|
|
105
|
-
|
|
100
|
+
}
|
|
106
101
|
|
|
107
|
-
|
|
102
|
+
// Retrieve the permissions information for the given apk.
|
|
103
|
+
const pmDumpLogs = (await this.runShellCommand(deviceId, ['pm', 'dump', apk])).split('\n');
|
|
108
104
|
|
|
105
|
+
// Set to true the required permissions that have been granted.
|
|
109
106
|
for (const line of pmDumpLogs) {
|
|
110
107
|
for (const perm of permissions) {
|
|
111
108
|
if (line.includes(`${perm}: granted=true`) || line.includes(`${perm}, granted=true`)) {
|
|
@@ -113,37 +110,29 @@ export default class ADBUtils {
|
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
|
-
|
|
117
113
|
for (const perm of permissions) {
|
|
118
114
|
if (!permissionsMap[perm]) {
|
|
119
115
|
throw new UsageError(`Required ${perm} has not be granted for ${apk}. ` + 'Please grant them using the Android Settings ' + 'or using the following adb command:\n' + `\t adb shell pm grant ${apk} ${perm}\n`);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
}
|
|
123
|
-
|
|
124
119
|
async amForceStopAPK(deviceId, apk) {
|
|
125
120
|
await this.runShellCommand(deviceId, ['am', 'force-stop', apk]);
|
|
126
121
|
}
|
|
127
|
-
|
|
128
122
|
async getOrCreateArtifactsDir(deviceId) {
|
|
129
123
|
let artifactsDir = this.artifactsDirMap.get(deviceId);
|
|
130
|
-
|
|
131
124
|
if (artifactsDir) {
|
|
132
125
|
return artifactsDir;
|
|
133
126
|
}
|
|
134
|
-
|
|
135
127
|
artifactsDir = `${DEVICE_DIR_BASE}${ARTIFACTS_DIR_PREFIX}${Date.now()}`;
|
|
136
128
|
const testDirOut = (await this.runShellCommand(deviceId, `test -d ${artifactsDir} ; echo $?`)).trim();
|
|
137
|
-
|
|
138
129
|
if (testDirOut !== '1') {
|
|
139
130
|
throw new WebExtError(`Cannot create artifacts directory ${artifactsDir} ` + `because it exists on ${deviceId}.`);
|
|
140
131
|
}
|
|
141
|
-
|
|
142
132
|
await this.runShellCommand(deviceId, ['mkdir', '-p', artifactsDir]);
|
|
143
133
|
this.artifactsDirMap.set(deviceId, artifactsDir);
|
|
144
134
|
return artifactsDir;
|
|
145
135
|
}
|
|
146
|
-
|
|
147
136
|
async detectOrRemoveOldArtifacts(deviceId, removeArtifactDirs = false) {
|
|
148
137
|
const {
|
|
149
138
|
adbClient
|
|
@@ -152,41 +141,34 @@ export default class ADBUtils {
|
|
|
152
141
|
return wrapADBCall(async () => {
|
|
153
142
|
const files = await adbClient.getDevice(deviceId).readdir(DEVICE_DIR_BASE);
|
|
154
143
|
let found = false;
|
|
155
|
-
|
|
156
144
|
for (const file of files) {
|
|
157
145
|
if (!file.isDirectory() || !file.name.startsWith(ARTIFACTS_DIR_PREFIX)) {
|
|
158
146
|
continue;
|
|
159
|
-
}
|
|
160
|
-
// existing artifacts dirs have been found on the adb device.
|
|
161
|
-
|
|
147
|
+
}
|
|
162
148
|
|
|
149
|
+
// Return earlier if we only need to warn the user that some
|
|
150
|
+
// existing artifacts dirs have been found on the adb device.
|
|
163
151
|
if (!removeArtifactDirs) {
|
|
164
152
|
return true;
|
|
165
153
|
}
|
|
166
|
-
|
|
167
154
|
found = true;
|
|
168
155
|
const artifactsDir = `${DEVICE_DIR_BASE}${file.name}`;
|
|
169
156
|
log.debug(`Removing artifacts directory ${artifactsDir} from device ${deviceId}`);
|
|
170
157
|
await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);
|
|
171
158
|
}
|
|
172
|
-
|
|
173
159
|
return found;
|
|
174
160
|
});
|
|
175
161
|
}
|
|
176
|
-
|
|
177
162
|
async clearArtifactsDir(deviceId) {
|
|
178
163
|
const artifactsDir = this.artifactsDirMap.get(deviceId);
|
|
179
|
-
|
|
180
164
|
if (!artifactsDir) {
|
|
181
165
|
// nothing to do here.
|
|
182
166
|
return;
|
|
183
167
|
}
|
|
184
|
-
|
|
185
168
|
this.artifactsDirMap.delete(deviceId);
|
|
186
169
|
log.debug(`Removing ${artifactsDir} artifacts directory on ${deviceId} device`);
|
|
187
170
|
await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);
|
|
188
171
|
}
|
|
189
|
-
|
|
190
172
|
async pushFile(deviceId, localPath, devicePath) {
|
|
191
173
|
const {
|
|
192
174
|
adbClient
|
|
@@ -200,43 +182,41 @@ export default class ADBUtils {
|
|
|
200
182
|
});
|
|
201
183
|
});
|
|
202
184
|
}
|
|
203
|
-
|
|
204
185
|
async startFirefoxAPK(deviceId, apk, apkComponent, deviceProfileDir) {
|
|
205
186
|
const {
|
|
206
187
|
adbClient
|
|
207
188
|
} = this;
|
|
208
|
-
log.debug(`Starting ${apk} on ${deviceId}`);
|
|
189
|
+
log.debug(`Starting ${apk} on ${deviceId}`);
|
|
190
|
+
|
|
191
|
+
// Fenix does ignore the -profile parameter, on the contrary Fennec
|
|
209
192
|
// would run using the given path as the profile to be used during
|
|
210
193
|
// this execution.
|
|
211
|
-
|
|
212
194
|
const extras = [{
|
|
213
195
|
key: 'args',
|
|
214
196
|
value: `-profile ${deviceProfileDir}`
|
|
215
197
|
}];
|
|
216
|
-
|
|
217
198
|
if (!apkComponent) {
|
|
218
199
|
apkComponent = '.App';
|
|
219
|
-
|
|
220
200
|
if (defaultApkComponents[apk]) {
|
|
221
201
|
apkComponent = defaultApkComponents[apk];
|
|
222
202
|
}
|
|
223
203
|
} else if (!apkComponent.includes('.')) {
|
|
224
204
|
apkComponent = `.${apkComponent}`;
|
|
225
|
-
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// if `apk` is a browser package or the `apk` has a
|
|
226
208
|
// browser package prefix: prepend the package identifier
|
|
227
209
|
// before `apkComponent`
|
|
228
|
-
|
|
229
|
-
|
|
230
210
|
if (apkComponent.startsWith('.')) {
|
|
231
211
|
for (const browser of packageIdentifiers) {
|
|
232
212
|
if (apk === browser || apk.startsWith(`${browser}.`)) {
|
|
233
213
|
apkComponent = browser + apkComponent;
|
|
234
214
|
}
|
|
235
215
|
}
|
|
236
|
-
}
|
|
237
|
-
// the following to: `${apk}/${apk}.${apkComponent}`
|
|
238
|
-
|
|
216
|
+
}
|
|
239
217
|
|
|
218
|
+
// if `apkComponent` starts with a '.', then adb will expand
|
|
219
|
+
// the following to: `${apk}/${apk}.${apkComponent}`
|
|
240
220
|
const component = `${apk}/${apkComponent}`;
|
|
241
221
|
await wrapADBCall(async () => {
|
|
242
222
|
await adbClient.getDevice(deviceId).startActivity({
|
|
@@ -247,11 +227,9 @@ export default class ADBUtils {
|
|
|
247
227
|
});
|
|
248
228
|
});
|
|
249
229
|
}
|
|
250
|
-
|
|
251
230
|
setUserAbortDiscovery(value) {
|
|
252
231
|
this.userAbortDiscovery = value;
|
|
253
232
|
}
|
|
254
|
-
|
|
255
233
|
async discoverRDPUnixSocket(deviceId, apk, {
|
|
256
234
|
maxDiscoveryTime,
|
|
257
235
|
retryInterval
|
|
@@ -259,53 +237,45 @@ export default class ADBUtils {
|
|
|
259
237
|
let rdpUnixSockets = [];
|
|
260
238
|
const discoveryStartedAt = Date.now();
|
|
261
239
|
const msg = `Waiting for ${apk} Remote Debugging Server...` + '\nMake sure to enable "Remote Debugging via USB" ' + 'from Settings -> Developer Tools if it is not yet enabled.';
|
|
262
|
-
|
|
263
240
|
while (rdpUnixSockets.length === 0) {
|
|
264
241
|
log.info(msg);
|
|
265
|
-
|
|
266
242
|
if (this.userAbortDiscovery) {
|
|
267
243
|
throw new UsageError('Exiting Firefox Remote Debugging socket discovery on user request');
|
|
268
244
|
}
|
|
269
|
-
|
|
270
245
|
if (Date.now() - discoveryStartedAt > maxDiscoveryTime) {
|
|
271
246
|
throw new WebExtError('Timeout while waiting for the Android Firefox Debugger Socket');
|
|
272
247
|
}
|
|
273
|
-
|
|
274
248
|
rdpUnixSockets = (await this.runShellCommand(deviceId, ['cat', '/proc/net/unix'])).split('\n').filter(line => {
|
|
275
249
|
// The RDP unix socket is expected to be a path in the form:
|
|
276
250
|
// /data/data/org.mozilla.fennec_rpl/firefox-debugger-socket
|
|
277
251
|
return line.trim().endsWith(`${apk}/firefox-debugger-socket`);
|
|
278
252
|
});
|
|
279
|
-
|
|
280
253
|
if (rdpUnixSockets.length === 0) {
|
|
281
254
|
await new Promise(resolve => setTimeout(resolve, retryInterval));
|
|
282
255
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
256
|
+
}
|
|
285
257
|
|
|
258
|
+
// Convert into an array of unix socket filenames.
|
|
286
259
|
rdpUnixSockets = rdpUnixSockets.map(line => {
|
|
287
260
|
return line.trim().split(/\s/).pop();
|
|
288
261
|
});
|
|
289
|
-
|
|
290
262
|
if (rdpUnixSockets.length > 1) {
|
|
291
263
|
throw new WebExtError('Unexpected multiple RDP sockets: ' + `${JSON.stringify(rdpUnixSockets)}`);
|
|
292
264
|
}
|
|
293
|
-
|
|
294
265
|
return rdpUnixSockets[0];
|
|
295
266
|
}
|
|
296
|
-
|
|
297
267
|
async setupForward(deviceId, remote, local) {
|
|
298
268
|
const {
|
|
299
269
|
adbClient
|
|
300
|
-
} = this;
|
|
301
|
-
// because adbkit doesn't seem to support `adb forward --remote` yet).
|
|
270
|
+
} = this;
|
|
302
271
|
|
|
272
|
+
// TODO(rpl): we should use adb.listForwards and reuse the existing one if any (especially
|
|
273
|
+
// because adbkit doesn't seem to support `adb forward --remote` yet).
|
|
303
274
|
log.debug(`Configuring ADB forward for ${deviceId}: ${remote} -> ${local}`);
|
|
304
275
|
await wrapADBCall(async () => {
|
|
305
276
|
await adbClient.getDevice(deviceId).forward(local, remote);
|
|
306
277
|
});
|
|
307
278
|
}
|
|
308
|
-
|
|
309
279
|
}
|
|
310
280
|
export async function listADBDevices(adbBin) {
|
|
311
281
|
const adbUtils = new ADBUtils({
|