web-ext 7.3.1 → 7.4.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 +43 -37
- package/index.js +1 -1
- package/lib/cmd/build.js.map +1 -1
- package/lib/cmd/docs.js.map +1 -1
- package/lib/cmd/index.js.map +1 -1
- package/lib/cmd/lint.js +2 -2
- package/lib/cmd/lint.js.map +1 -1
- package/lib/cmd/run.js +1 -1
- package/lib/cmd/run.js.map +1 -1
- package/lib/cmd/sign.js.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/extension-runners/base.js.map +1 -1
- package/lib/extension-runners/chromium.js.map +1 -1
- package/lib/extension-runners/firefox-android.js.map +1 -1
- package/lib/extension-runners/firefox-desktop.js.map +1 -1
- package/lib/extension-runners/index.js.map +1 -1
- package/lib/firefox/index.js +6 -6
- package/lib/firefox/index.js.map +1 -1
- package/lib/firefox/preferences.js.map +1 -1
- package/lib/firefox/rdp-client.js.map +1 -1
- package/lib/firefox/remote.js.map +1 -1
- package/lib/main.js.map +1 -1
- package/lib/program.js +19 -19
- package/lib/program.js.map +1 -1
- package/lib/util/adb.js.map +1 -1
- package/lib/util/artifacts.js.map +1 -1
- package/lib/util/desktop-notifier.js.map +1 -1
- package/lib/util/file-exists.js.map +1 -1
- package/lib/util/file-filter.js.map +1 -1
- package/lib/util/is-directory.js.map +1 -1
- package/lib/util/logger.js.map +1 -1
- package/lib/util/manifest.js.map +1 -1
- package/lib/util/promisify.js.map +1 -1
- package/lib/util/stdin.js.map +1 -1
- package/lib/util/submit-addon.js.map +1 -1
- package/lib/util/temp-dir.js.map +1 -1
- package/lib/util/updates.js.map +1 -1
- package/lib/watcher.js.map +1 -1
- package/package.json +23 -18
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","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;AAErD,OAAOC,eAAe,MAAM,gBAAgB;AAC5C,SAAQC,UAAU,QAAO,aAAa;AACtC,SACEC,YAAY,EACZC,aAAa,IAAIC,gBAAgB,QAC5B,kBAAkB;AACzB,SAAQC,yBAAyB,QAAO,0BAA0B;AAClE,SAAQC,eAAe,IAAIC,oBAAoB,QAAO,mBAAmB;AACzE,SACEC,mBAAmB,IAAIC,sBAAsB,EAC7CC,gBAAgB,IAAIC,uBAAuB,EAC3CC,iBAAiB,IAAIC,wBAAwB,QACxC,aAAa;AAEpB,MAAMC,GAAG,GAAGZ,YAAY,CAACa,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AACzC,MAAMC,SAAS,GAAG,SAAS;AAC3B;AACA;AACA,MAAMC,gBAAgB,GAAG,gBAAgC,aAAa;AAwBtE;AACA;AACA;AACA,OAAO,MAAMC,OAAO,CAAC;EAUnBC,WAAW,CACTC,IAAoB,EACpB;IACEC,kBAAkB,GAAGC,OAAO,CAACC,GAAG;EAClB,CAAC,GAAG,CAAC,CAAC,EACtB;IACA;IACA;IACA;IACA;IACAH,IAAI,GAAGA,IAAI,IAAIE,OAAO,CAACF,IAAI,CAACI,KAAK,CAAC,CAAC,CAAC;IACpC,IAAI,CAACC,WAAW,GAAGL,IAAI;;IAEvB;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMM,aAAa,GAAG/B,KAAK,CAACyB,IAAI,EAAEC,kBAAkB,CAAC;IAErD,IAAI,CAAC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ACD,YAAY,EAAE;MACZN,QAAQ,EAAE,gDAAgD;MAC1DC,IAAI,EAAE,SAAS;MACfK,OAAO,EAAE;IACX,CAAC;IACD,aAAa,EAAE;MACbN,QAAQ,EACN,6DAA6D,GAC7D,2CAA2C;MAC7CC,IAAI,EAAE,SAAS;MACfK,OAAO,EAAE;IACX,CAAC;IACD,QAAQ,EAAE;MACRN,QAAQ,EAAE,gCAAgC;MAC1CC,IAAI,EAAE,SAAS;MACfK,OAAO,EAAE;IACX,CAAC;IACD,iBAAiB,EAAEP;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"}
|
|
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","filename","sign","id","timeout","channel","run","target","choices","firefox","pref","devtools","lint","output","metadata","pretty","privileged","boring","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\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 * 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 { absolutePackageDir = process.cwd() }: 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,\n description: string,\n 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 (\n 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(\n 0,\n 0,\n undefined,\n 'This command does not take any arguments'\n )\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 });\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(logStream: typeof defaultLogStream, version: string): 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 = this.yargs\n .getInternalMethods()\n .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 (\n err.name === 'YError' &&\n err.message.startsWith('Unknown argument: ')\n ) {\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 = this.yargs\n .getInternalMethods()\n .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) =>\n decamelize(camelCase(k.replace(envPrefix, '')), { separator: '-' });\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 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 = {}): 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. ' + 'Set --no-config-discovery to disable'\n );\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\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 } 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 );\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,\n commands = defaultCommands,\n 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:\n 'Turn on developer preview features in Firefox' + ' (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(\n `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 )\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:\n '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 ' + 'option defaults',\n default: undefined,\n demandOption: false,\n requiresArg: true,\n type: 'string',\n },\n 'config-discovery': {\n describe:\n '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 {\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) =>\n arg == null\n ? undefined\n : 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 )\n .command(\n 'sign',\n 'Sign the extension so it can be installed in Firefox',\n commands.sign,\n {\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: '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:\n 'The channel for which to sign the addon. Either ' +\n \"'listed' or 'unlisted'\",\n },\n 'amo-metadata': {\n describe:\n '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 )\n .command('run', 'Run the extension', commands.run, {\n target: {\n alias: 't',\n describe:\n '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:\n '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:\n '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:\n '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:\n '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:\n '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:\n '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:\n '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:\n '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:\n '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) =>\n arg != null ? 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:\n '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 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(\n 'docs',\n 'Open the web-ext documentation in a browser',\n commands.docs,\n {}\n );\n\n return program.execute({ getVersion, ...runOptions });\n}\n"],"mappings":";AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,YAAY,QAAQ,IAAI;AAEjC,OAAOC,SAAS,MAAM,WAAW;AACjC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,IAAIC,WAAW,QAAQ,eAAe;AAErD,OAAOC,eAAe,MAAM,gBAAgB;AAC5C,SAASC,UAAU,QAAQ,aAAa;AACxC,SACEC,YAAY,EACZC,aAAa,IAAIC,gBAAgB,QAC5B,kBAAkB;AACzB,SAASC,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,IAA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,CAAC;IAAEC,UAAU;IAAE,GAAGiC;EAAW,CAAC,CAAC;AACvD"}
|
package/lib/util/adb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adb.js","names":["ADBKit","isErrorWithCode","UsageError","WebExtError","createLogger","packageIdentifiers","defaultApkComponents","DEVICE_DIR_BASE","ARTIFACTS_DIR_PREFIX","defaultADB","default","log","import","meta","url","wrapADBCall","asyncFn","error","message","includes","ADBUtils","constructor","params","adb","adbBin","adbHost","adbPort","adbClient","createClient","bin","host","port","artifactsDirMap","Map","userAbortDiscovery","runShellCommand","deviceId","cmd","debug","JSON","stringify","getDevice","shell","then","util","readAll","res","toString","discoverDevices","devices","listDevices","map","dev","id","discoverInstalledFirefoxAPKs","firefoxApk","pmList","split","line","replace","trim","filter","browser","startsWith","getAndroidVersionNumber","androidVersion","androidVersionNumber","parseInt","isNaN","ensureRequiredAPKRuntimePermissions","apk","permissions","permissionsMap","perm","pmDumpLogs","amForceStopAPK","getOrCreateArtifactsDir","artifactsDir","get","Date","now","testDirOut","set","detectOrRemoveOldArtifacts","removeArtifactDirs","files","readdir","found","file","isDirectory","name","clearArtifactsDir","delete","pushFile","localPath","devicePath","push","transfer","Promise","resolve","on","startFirefoxAPK","apkComponent","deviceProfileDir","extras","key","value","component","startActivity","wait","action","setUserAbortDiscovery","discoverRDPUnixSocket","maxDiscoveryTime","retryInterval","rdpUnixSockets","discoveryStartedAt","msg","length","info","endsWith","setTimeout","pop","setupForward","remote","local","forward","listADBDevices","adbUtils","listADBFirefoxAPKs"],"sources":["../../src/util/adb.js"],"sourcesContent":["/* @flow */\nimport ADBKit from '@devicefarmer/adbkit';\n\nimport {\n isErrorWithCode,\n UsageError,\n WebExtError,\n} from '../errors.js';\nimport {createLogger} from '../util/logger.js';\nimport packageIdentifiers, {\n defaultApkComponents,\n} from '../firefox/package-identifiers.js';\n\nexport const DEVICE_DIR_BASE = '/data/local/tmp/';\nexport const ARTIFACTS_DIR_PREFIX = 'web-ext-artifacts-';\n\nconst defaultADB = ADBKit.default;\n\nconst log = createLogger(import.meta.url);\n\nexport type ADBUtilsParams = {|\n adb?: typeof defaultADB,\n // ADB configs.\n adbBin?: string,\n adbHost?: string,\n adbPort?: string,\n adbDevice?: string,\n|};\n\nexport type DiscoveryParams = {\n maxDiscoveryTime: number,\n retryInterval: number,\n};\n\n// Helper function used to raise an UsageError when the adb binary has not been found.\nasync function wrapADBCall(asyncFn: (...any) => Promise<any>): Promise<any> {\n try {\n return await asyncFn();\n } catch (error) {\n if (isErrorWithCode('ENOENT', error) &&\n error.message.includes('spawn adb')) {\n throw new UsageError(\n 'No adb executable has been found. ' +\n 'You can Use --adb-bin, --adb-host/--adb-port ' +\n 'to configure it manually if needed.');\n }\n\n throw error;\n }\n}\n\nexport default class ADBUtils {\n params: ADBUtilsParams;\n adb: typeof defaultADB;\n adbClient: any; // TODO: better flow typing here.\n\n // Map<deviceId -> artifactsDir>\n artifactsDirMap: Map<string, string>;\n // Toggled when the user wants to abort the RDP Unix Socket discovery loop\n // while it is still executing.\n userAbortDiscovery: boolean;\n\n constructor(params: ADBUtilsParams) {\n this.params = params;\n\n const {\n adb,\n adbBin,\n adbHost,\n adbPort,\n } = params;\n\n this.adb = adb || defaultADB;\n\n this.adbClient = this.adb.createClient({\n bin: adbBin,\n host: adbHost,\n port: adbPort,\n });\n\n this.artifactsDirMap = new Map();\n\n this.userAbortDiscovery = false;\n }\n\n runShellCommand(\n deviceId: string, cmd: string | Array<string>\n ): Promise<string> {\n const {adb, adbClient} = this;\n\n log.debug(`Run adb shell command on ${deviceId}: ${JSON.stringify(cmd)}`);\n\n return wrapADBCall(async () => {\n return await adbClient.getDevice(deviceId).shell(cmd).then(\n adb.util.readAll\n );\n }).then((res) => res.toString());\n }\n\n async discoverDevices(): Promise<Array<string>> {\n const {adbClient} = this;\n\n let devices = [];\n\n log.debug('Listing android devices');\n devices = await wrapADBCall(async () => adbClient.listDevices());\n\n return devices.map((dev) => dev.id);\n }\n\n async discoverInstalledFirefoxAPKs(\n deviceId: string,\n firefoxApk?: string\n ): Promise<Array<string>> {\n log.debug(`Listing installed Firefox APKs on ${deviceId}`);\n\n const pmList = await this.runShellCommand(deviceId, [\n 'pm', 'list', 'packages',\n ]);\n\n return pmList.split('\\n')\n .map((line) => line.replace('package:', '').trim())\n .filter((line) => {\n // Look for an exact match if firefoxApk is defined.\n if (firefoxApk) {\n return line === firefoxApk;\n }\n // Match any package name that starts with the package name of a Firefox for Android browser.\n for (const browser of packageIdentifiers) {\n if (line.startsWith(browser)) {\n return true;\n }\n }\n\n return false;\n });\n }\n\n async getAndroidVersionNumber(deviceId: string): Promise<number> {\n const androidVersion = (await this.runShellCommand(deviceId, [\n 'getprop', 'ro.build.version.sdk',\n ])).trim();\n\n const androidVersionNumber = parseInt(androidVersion);\n\n // No need to check the granted runtime permissions on Android versions < Lollypop.\n if (isNaN(androidVersionNumber)) {\n throw new WebExtError(\n 'Unable to discovery android version on ' +\n `${deviceId}: ${androidVersion}`\n );\n }\n\n return androidVersionNumber;\n }\n\n // Raise an UsageError when the given APK does not have the required runtime permissions.\n async ensureRequiredAPKRuntimePermissions(\n deviceId: string, apk: string, permissions: Array<string>\n ): Promise<void> {\n const permissionsMap = {};\n\n // Initialize every permission to false in the permissions map.\n for (const perm of permissions) {\n permissionsMap[perm] = false;\n }\n\n // Retrieve the permissions information for the given apk.\n const pmDumpLogs = (await this.runShellCommand(deviceId, [\n 'pm', 'dump', apk,\n ])).split('\\n');\n\n // Set to true the required permissions that have been granted.\n for (const line of pmDumpLogs) {\n for (const perm of permissions) {\n if (line.includes(`${perm}: granted=true`) ||\n line.includes(`${perm}, granted=true`)) {\n permissionsMap[perm] = true;\n }\n }\n }\n\n for (const perm of permissions) {\n if (!permissionsMap[perm]) {\n throw new UsageError(\n `Required ${perm} has not be granted for ${apk}. ` +\n 'Please grant them using the Android Settings ' +\n 'or using the following adb command:\\n' +\n `\\t adb shell pm grant ${apk} ${perm}\\n`\n );\n }\n }\n }\n\n async amForceStopAPK(deviceId: string, apk: string): Promise<void> {\n await this.runShellCommand(deviceId, [\n 'am', 'force-stop', apk,\n ]);\n }\n\n async getOrCreateArtifactsDir(deviceId: string): Promise<string> {\n let artifactsDir = this.artifactsDirMap.get(deviceId);\n\n if (artifactsDir) {\n return artifactsDir;\n }\n\n artifactsDir = `${DEVICE_DIR_BASE}${ARTIFACTS_DIR_PREFIX}${Date.now()}`;\n\n const testDirOut = (await this.runShellCommand(\n deviceId, `test -d ${artifactsDir} ; echo $?`\n )).trim();\n\n if (testDirOut !== '1') {\n throw new WebExtError(\n `Cannot create artifacts directory ${artifactsDir} ` +\n `because it exists on ${deviceId}.`\n );\n }\n\n await this.runShellCommand(deviceId, ['mkdir', '-p', artifactsDir]);\n\n this.artifactsDirMap.set(deviceId, artifactsDir);\n\n return artifactsDir;\n }\n\n async detectOrRemoveOldArtifacts(\n deviceId: string, removeArtifactDirs?: boolean = false\n ): Promise<boolean> {\n const {adbClient} = this;\n\n log.debug('Checking adb device for existing web-ext artifacts dirs');\n\n return wrapADBCall(async () => {\n const files = await adbClient.getDevice(deviceId).readdir(\n DEVICE_DIR_BASE\n );\n let found = false;\n\n for (const file of files) {\n if (!file.isDirectory() ||\n !file.name.startsWith(ARTIFACTS_DIR_PREFIX)) {\n continue;\n }\n\n // Return earlier if we only need to warn the user that some\n // existing artifacts dirs have been found on the adb device.\n if (!removeArtifactDirs) {\n return true;\n }\n\n found = true;\n\n const artifactsDir = `${DEVICE_DIR_BASE}${file.name}`;\n\n log.debug(\n `Removing artifacts directory ${artifactsDir} from device ${deviceId}`\n );\n\n await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);\n }\n\n return found;\n });\n }\n\n async clearArtifactsDir(deviceId: string): Promise<void> {\n const artifactsDir = this.artifactsDirMap.get(deviceId);\n\n if (!artifactsDir) {\n // nothing to do here.\n return;\n }\n\n this.artifactsDirMap.delete(deviceId);\n\n log.debug(\n `Removing ${artifactsDir} artifacts directory on ${deviceId} device`\n );\n\n await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);\n }\n\n async pushFile(\n deviceId: string, localPath: string, devicePath: string\n ): Promise<void> {\n const {adbClient} = this;\n\n log.debug(`Pushing ${localPath} to ${devicePath} on ${deviceId}`);\n\n await wrapADBCall(async () => {\n await adbClient.getDevice(deviceId).push(localPath, devicePath)\n .then(function(transfer) {\n return new Promise((resolve) => {\n transfer.on('end', resolve);\n });\n });\n });\n }\n\n async startFirefoxAPK(\n deviceId: string,\n apk: string,\n apkComponent: ?string,\n deviceProfileDir: string,\n ): Promise<void> {\n const {adbClient} = this;\n\n log.debug(\n `Starting ${apk} on ${deviceId}`\n );\n\n // Fenix does ignore the -profile parameter, on the contrary Fennec\n // would run using the given path as the profile to be used during\n // this execution.\n const extras = [{\n key: 'args',\n value: `-profile ${deviceProfileDir}`,\n }];\n\n if (!apkComponent) {\n apkComponent = '.App';\n if (defaultApkComponents[apk]) {\n apkComponent = defaultApkComponents[apk];\n }\n } else if (!apkComponent.includes('.')) {\n apkComponent = `.${apkComponent}`;\n }\n\n // if `apk` is a browser package or the `apk` has a\n // browser package prefix: prepend the package identifier\n // before `apkComponent`\n if (apkComponent.startsWith('.')) {\n for (const browser of packageIdentifiers) {\n if (apk === browser || apk.startsWith(`${browser}.`)) {\n apkComponent = browser + apkComponent;\n }\n }\n }\n\n // if `apkComponent` starts with a '.', then adb will expand\n // the following to: `${apk}/${apk}.${apkComponent}`\n const component = `${apk}/${apkComponent}`;\n\n await wrapADBCall(async () => {\n await adbClient.getDevice(deviceId).startActivity({\n wait: true,\n action: 'android.activity.MAIN',\n component,\n extras,\n });\n });\n }\n\n setUserAbortDiscovery(value: boolean) {\n this.userAbortDiscovery = value;\n }\n\n async discoverRDPUnixSocket(\n deviceId: string, apk: string,\n {maxDiscoveryTime, retryInterval}: DiscoveryParams = {}\n ): Promise<string> {\n let rdpUnixSockets = [];\n\n const discoveryStartedAt = Date.now();\n const msg = (\n `Waiting for ${apk} Remote Debugging Server...` +\n '\\nMake sure to enable \"Remote Debugging via USB\" ' +\n 'from Settings -> Developer Tools if it is not yet enabled.'\n );\n\n while (rdpUnixSockets.length === 0) {\n log.info(msg);\n if (this.userAbortDiscovery) {\n throw new UsageError(\n 'Exiting Firefox Remote Debugging socket discovery on user request'\n );\n }\n\n if (Date.now() - discoveryStartedAt > maxDiscoveryTime) {\n throw new WebExtError(\n 'Timeout while waiting for the Android Firefox Debugger Socket'\n );\n }\n\n rdpUnixSockets = (await this.runShellCommand(deviceId, [\n 'cat', '/proc/net/unix',\n ])).split('\\n').filter((line) => {\n // The RDP unix socket is expected to be a path in the form:\n // /data/data/org.mozilla.fennec_rpl/firefox-debugger-socket\n return line.trim().endsWith(`${apk}/firefox-debugger-socket`);\n });\n\n if (rdpUnixSockets.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, retryInterval));\n }\n }\n\n // Convert into an array of unix socket filenames.\n rdpUnixSockets = rdpUnixSockets.map((line) => {\n return line.trim().split(/\\s/).pop();\n });\n\n if (rdpUnixSockets.length > 1) {\n throw new WebExtError(\n 'Unexpected multiple RDP sockets: ' +\n `${JSON.stringify(rdpUnixSockets)}`\n );\n }\n\n return rdpUnixSockets[0];\n }\n\n async setupForward(deviceId: string, remote: string, local: string) {\n const {adbClient} = this;\n\n // TODO(rpl): we should use adb.listForwards and reuse the existing one if any (especially\n // because adbkit doesn't seem to support `adb forward --remote` yet).\n log.debug(`Configuring ADB forward for ${deviceId}: ${remote} -> ${local}`);\n\n await wrapADBCall(async () => {\n await adbClient.getDevice(deviceId).forward(local, remote);\n });\n }\n}\n\nexport async function listADBDevices(adbBin?: string): Promise<Array<string>> {\n const adbUtils = new ADBUtils({adbBin});\n return adbUtils.discoverDevices();\n}\n\nexport async function listADBFirefoxAPKs(\n deviceId: string,\n adbBin?: string\n): Promise<Array<string>> {\n const adbUtils = new ADBUtils({adbBin});\n return adbUtils.discoverInstalledFirefoxAPKs(deviceId);\n}\n"],"mappings":";AAC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,OAAO,eAAeG,cAAc,CAACvG,MAAe,EAA0B;EAC5E,MAAMwG,QAAQ,GAAG,IAAI5G,QAAQ,CAAC;IAACI;EAAM,CAAC,CAAC;EACvC,OAAOwG,QAAQ,CAAChF,eAAe,EAAE;AACnC;AAEA,OAAO,eAAeiF,kBAAkB,CACtC7F,QAAgB,EAChBZ,MAAe,EACS;EACxB,MAAMwG,QAAQ,GAAG,IAAI5G,QAAQ,CAAC;IAACI;EAAM,CAAC,CAAC;EACvC,OAAOwG,QAAQ,CAAC1E,4BAA4B,CAAClB,QAAQ,CAAC;AACxD"}
|
|
1
|
+
{"version":3,"file":"adb.js","names":["ADBKit","isErrorWithCode","UsageError","WebExtError","createLogger","packageIdentifiers","defaultApkComponents","DEVICE_DIR_BASE","ARTIFACTS_DIR_PREFIX","defaultADB","default","log","import","meta","url","wrapADBCall","asyncFn","error","message","includes","ADBUtils","constructor","params","adb","adbBin","adbHost","adbPort","adbClient","createClient","bin","host","port","artifactsDirMap","Map","userAbortDiscovery","runShellCommand","deviceId","cmd","debug","JSON","stringify","getDevice","shell","then","util","readAll","res","toString","discoverDevices","devices","listDevices","map","dev","id","discoverInstalledFirefoxAPKs","firefoxApk","pmList","split","line","replace","trim","filter","browser","startsWith","getAndroidVersionNumber","androidVersion","androidVersionNumber","parseInt","isNaN","ensureRequiredAPKRuntimePermissions","apk","permissions","permissionsMap","perm","pmDumpLogs","amForceStopAPK","getOrCreateArtifactsDir","artifactsDir","get","Date","now","testDirOut","set","detectOrRemoveOldArtifacts","removeArtifactDirs","files","readdir","found","file","isDirectory","name","clearArtifactsDir","delete","pushFile","localPath","devicePath","push","transfer","Promise","resolve","on","startFirefoxAPK","apkComponent","deviceProfileDir","extras","key","value","component","startActivity","wait","action","setUserAbortDiscovery","discoverRDPUnixSocket","maxDiscoveryTime","retryInterval","rdpUnixSockets","discoveryStartedAt","msg","length","info","endsWith","setTimeout","pop","setupForward","remote","local","forward","listADBDevices","adbUtils","listADBFirefoxAPKs"],"sources":["../../src/util/adb.js"],"sourcesContent":["/* @flow */\nimport ADBKit from '@devicefarmer/adbkit';\n\nimport { isErrorWithCode, UsageError, WebExtError } from '../errors.js';\nimport { createLogger } from '../util/logger.js';\nimport packageIdentifiers, {\n defaultApkComponents,\n} from '../firefox/package-identifiers.js';\n\nexport const DEVICE_DIR_BASE = '/data/local/tmp/';\nexport const ARTIFACTS_DIR_PREFIX = 'web-ext-artifacts-';\n\nconst defaultADB = ADBKit.default;\n\nconst log = createLogger(import.meta.url);\n\nexport type ADBUtilsParams = {|\n adb?: typeof defaultADB,\n // ADB configs.\n adbBin?: string,\n adbHost?: string,\n adbPort?: string,\n adbDevice?: string,\n|};\n\nexport type DiscoveryParams = {\n maxDiscoveryTime: number,\n retryInterval: number,\n};\n\n// Helper function used to raise an UsageError when the adb binary has not been found.\nasync function wrapADBCall(asyncFn: (...any) => Promise<any>): Promise<any> {\n try {\n return await asyncFn();\n } catch (error) {\n if (\n isErrorWithCode('ENOENT', error) &&\n error.message.includes('spawn adb')\n ) {\n throw new UsageError(\n 'No adb executable has been found. ' +\n 'You can Use --adb-bin, --adb-host/--adb-port ' +\n 'to configure it manually if needed.'\n );\n }\n\n throw error;\n }\n}\n\nexport default class ADBUtils {\n params: ADBUtilsParams;\n adb: typeof defaultADB;\n adbClient: any; // TODO: better flow typing here.\n\n // Map<deviceId -> artifactsDir>\n artifactsDirMap: Map<string, string>;\n // Toggled when the user wants to abort the RDP Unix Socket discovery loop\n // while it is still executing.\n userAbortDiscovery: boolean;\n\n constructor(params: ADBUtilsParams) {\n this.params = params;\n\n const { adb, adbBin, adbHost, adbPort } = params;\n\n this.adb = adb || defaultADB;\n\n this.adbClient = this.adb.createClient({\n bin: adbBin,\n host: adbHost,\n port: adbPort,\n });\n\n this.artifactsDirMap = new Map();\n\n this.userAbortDiscovery = false;\n }\n\n runShellCommand(\n deviceId: string,\n cmd: string | Array<string>\n ): Promise<string> {\n const { adb, adbClient } = this;\n\n log.debug(`Run adb shell command on ${deviceId}: ${JSON.stringify(cmd)}`);\n\n return wrapADBCall(async () => {\n return await adbClient\n .getDevice(deviceId)\n .shell(cmd)\n .then(adb.util.readAll);\n }).then((res) => res.toString());\n }\n\n async discoverDevices(): Promise<Array<string>> {\n const { adbClient } = this;\n\n let devices = [];\n\n log.debug('Listing android devices');\n devices = await wrapADBCall(async () => adbClient.listDevices());\n\n return devices.map((dev) => dev.id);\n }\n\n async discoverInstalledFirefoxAPKs(\n deviceId: string,\n firefoxApk?: string\n ): Promise<Array<string>> {\n log.debug(`Listing installed Firefox APKs on ${deviceId}`);\n\n const pmList = await this.runShellCommand(deviceId, [\n 'pm',\n 'list',\n 'packages',\n ]);\n\n return pmList\n .split('\\n')\n .map((line) => line.replace('package:', '').trim())\n .filter((line) => {\n // Look for an exact match if firefoxApk is defined.\n if (firefoxApk) {\n return line === firefoxApk;\n }\n // Match any package name that starts with the package name of a Firefox for Android browser.\n for (const browser of packageIdentifiers) {\n if (line.startsWith(browser)) {\n return true;\n }\n }\n\n return false;\n });\n }\n\n async getAndroidVersionNumber(deviceId: string): Promise<number> {\n const androidVersion = (\n await this.runShellCommand(deviceId, ['getprop', 'ro.build.version.sdk'])\n ).trim();\n\n const androidVersionNumber = parseInt(androidVersion);\n\n // No need to check the granted runtime permissions on Android versions < Lollypop.\n if (isNaN(androidVersionNumber)) {\n throw new WebExtError(\n 'Unable to discovery android version on ' +\n `${deviceId}: ${androidVersion}`\n );\n }\n\n return androidVersionNumber;\n }\n\n // Raise an UsageError when the given APK does not have the required runtime permissions.\n async ensureRequiredAPKRuntimePermissions(\n deviceId: string,\n apk: string,\n permissions: Array<string>\n ): Promise<void> {\n const permissionsMap = {};\n\n // Initialize every permission to false in the permissions map.\n for (const perm of permissions) {\n permissionsMap[perm] = false;\n }\n\n // Retrieve the permissions information for the given apk.\n const pmDumpLogs = (\n await this.runShellCommand(deviceId, ['pm', 'dump', apk])\n ).split('\\n');\n\n // Set to true the required permissions that have been granted.\n for (const line of pmDumpLogs) {\n for (const perm of permissions) {\n if (\n line.includes(`${perm}: granted=true`) ||\n line.includes(`${perm}, granted=true`)\n ) {\n permissionsMap[perm] = true;\n }\n }\n }\n\n for (const perm of permissions) {\n if (!permissionsMap[perm]) {\n throw new UsageError(\n `Required ${perm} has not be granted for ${apk}. ` +\n 'Please grant them using the Android Settings ' +\n 'or using the following adb command:\\n' +\n `\\t adb shell pm grant ${apk} ${perm}\\n`\n );\n }\n }\n }\n\n async amForceStopAPK(deviceId: string, apk: string): Promise<void> {\n await this.runShellCommand(deviceId, ['am', 'force-stop', apk]);\n }\n\n async getOrCreateArtifactsDir(deviceId: string): Promise<string> {\n let artifactsDir = this.artifactsDirMap.get(deviceId);\n\n if (artifactsDir) {\n return artifactsDir;\n }\n\n artifactsDir = `${DEVICE_DIR_BASE}${ARTIFACTS_DIR_PREFIX}${Date.now()}`;\n\n const testDirOut = (\n await this.runShellCommand(deviceId, `test -d ${artifactsDir} ; echo $?`)\n ).trim();\n\n if (testDirOut !== '1') {\n throw new WebExtError(\n `Cannot create artifacts directory ${artifactsDir} ` +\n `because it exists on ${deviceId}.`\n );\n }\n\n await this.runShellCommand(deviceId, ['mkdir', '-p', artifactsDir]);\n\n this.artifactsDirMap.set(deviceId, artifactsDir);\n\n return artifactsDir;\n }\n\n async detectOrRemoveOldArtifacts(\n deviceId: string,\n removeArtifactDirs?: boolean = false\n ): Promise<boolean> {\n const { adbClient } = this;\n\n log.debug('Checking adb device for existing web-ext artifacts dirs');\n\n return wrapADBCall(async () => {\n const files = await adbClient\n .getDevice(deviceId)\n .readdir(DEVICE_DIR_BASE);\n let found = false;\n\n for (const file of files) {\n if (\n !file.isDirectory() ||\n !file.name.startsWith(ARTIFACTS_DIR_PREFIX)\n ) {\n continue;\n }\n\n // Return earlier if we only need to warn the user that some\n // existing artifacts dirs have been found on the adb device.\n if (!removeArtifactDirs) {\n return true;\n }\n\n found = true;\n\n const artifactsDir = `${DEVICE_DIR_BASE}${file.name}`;\n\n log.debug(\n `Removing artifacts directory ${artifactsDir} from device ${deviceId}`\n );\n\n await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);\n }\n\n return found;\n });\n }\n\n async clearArtifactsDir(deviceId: string): Promise<void> {\n const artifactsDir = this.artifactsDirMap.get(deviceId);\n\n if (!artifactsDir) {\n // nothing to do here.\n return;\n }\n\n this.artifactsDirMap.delete(deviceId);\n\n log.debug(\n `Removing ${artifactsDir} artifacts directory on ${deviceId} device`\n );\n\n await this.runShellCommand(deviceId, ['rm', '-rf', artifactsDir]);\n }\n\n async pushFile(\n deviceId: string,\n localPath: string,\n devicePath: string\n ): Promise<void> {\n const { adbClient } = this;\n\n log.debug(`Pushing ${localPath} to ${devicePath} on ${deviceId}`);\n\n await wrapADBCall(async () => {\n await adbClient\n .getDevice(deviceId)\n .push(localPath, devicePath)\n .then(function (transfer) {\n return new Promise((resolve) => {\n transfer.on('end', resolve);\n });\n });\n });\n }\n\n async startFirefoxAPK(\n deviceId: string,\n apk: string,\n apkComponent: ?string,\n deviceProfileDir: string\n ): Promise<void> {\n const { adbClient } = this;\n\n log.debug(`Starting ${apk} on ${deviceId}`);\n\n // Fenix does ignore the -profile parameter, on the contrary Fennec\n // would run using the given path as the profile to be used during\n // this execution.\n const extras = [\n {\n key: 'args',\n value: `-profile ${deviceProfileDir}`,\n },\n ];\n\n if (!apkComponent) {\n apkComponent = '.App';\n if (defaultApkComponents[apk]) {\n apkComponent = defaultApkComponents[apk];\n }\n } else if (!apkComponent.includes('.')) {\n apkComponent = `.${apkComponent}`;\n }\n\n // if `apk` is a browser package or the `apk` has a\n // browser package prefix: prepend the package identifier\n // before `apkComponent`\n if (apkComponent.startsWith('.')) {\n for (const browser of packageIdentifiers) {\n if (apk === browser || apk.startsWith(`${browser}.`)) {\n apkComponent = browser + apkComponent;\n }\n }\n }\n\n // if `apkComponent` starts with a '.', then adb will expand\n // the following to: `${apk}/${apk}.${apkComponent}`\n const component = `${apk}/${apkComponent}`;\n\n await wrapADBCall(async () => {\n await adbClient.getDevice(deviceId).startActivity({\n wait: true,\n action: 'android.activity.MAIN',\n component,\n extras,\n });\n });\n }\n\n setUserAbortDiscovery(value: boolean) {\n this.userAbortDiscovery = value;\n }\n\n async discoverRDPUnixSocket(\n deviceId: string,\n apk: string,\n { maxDiscoveryTime, retryInterval }: DiscoveryParams = {}\n ): Promise<string> {\n let rdpUnixSockets = [];\n\n const discoveryStartedAt = Date.now();\n const msg =\n `Waiting for ${apk} Remote Debugging Server...` +\n '\\nMake sure to enable \"Remote Debugging via USB\" ' +\n 'from Settings -> Developer Tools if it is not yet enabled.';\n\n while (rdpUnixSockets.length === 0) {\n log.info(msg);\n if (this.userAbortDiscovery) {\n throw new UsageError(\n 'Exiting Firefox Remote Debugging socket discovery on user request'\n );\n }\n\n if (Date.now() - discoveryStartedAt > maxDiscoveryTime) {\n throw new WebExtError(\n 'Timeout while waiting for the Android Firefox Debugger Socket'\n );\n }\n\n rdpUnixSockets = (\n await this.runShellCommand(deviceId, ['cat', '/proc/net/unix'])\n )\n .split('\\n')\n .filter((line) => {\n // The RDP unix socket is expected to be a path in the form:\n // /data/data/org.mozilla.fennec_rpl/firefox-debugger-socket\n return line.trim().endsWith(`${apk}/firefox-debugger-socket`);\n });\n\n if (rdpUnixSockets.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, retryInterval));\n }\n }\n\n // Convert into an array of unix socket filenames.\n rdpUnixSockets = rdpUnixSockets.map((line) => {\n return line.trim().split(/\\s/).pop();\n });\n\n if (rdpUnixSockets.length > 1) {\n throw new WebExtError(\n 'Unexpected multiple RDP sockets: ' +\n `${JSON.stringify(rdpUnixSockets)}`\n );\n }\n\n return rdpUnixSockets[0];\n }\n\n async setupForward(deviceId: string, remote: string, local: string) {\n const { adbClient } = this;\n\n // TODO(rpl): we should use adb.listForwards and reuse the existing one if any (especially\n // because adbkit doesn't seem to support `adb forward --remote` yet).\n log.debug(`Configuring ADB forward for ${deviceId}: ${remote} -> ${local}`);\n\n await wrapADBCall(async () => {\n await adbClient.getDevice(deviceId).forward(local, remote);\n });\n }\n}\n\nexport async function listADBDevices(adbBin?: string): Promise<Array<string>> {\n const adbUtils = new ADBUtils({ adbBin });\n return adbUtils.discoverDevices();\n}\n\nexport async function listADBFirefoxAPKs(\n deviceId: string,\n adbBin?: string\n): Promise<Array<string>> {\n const adbUtils = new ADBUtils({ adbBin });\n return adbUtils.discoverInstalledFirefoxAPKs(deviceId);\n}\n"],"mappings":";AACA,OAAOA,MAAM,MAAM,sBAAsB;AAEzC,SAASC,eAAe,EAAEC,UAAU,EAAEC,WAAW,QAAQ,cAAc;AACvE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAOC,kBAAkB,IACvBC,oBAAoB,QACf,mCAAmC;AAE1C,OAAO,MAAMC,eAAe,GAAG,kBAAkB;AACjD,OAAO,MAAMC,oBAAoB,GAAG,oBAAoB;AAExD,MAAMC,UAAU,GAAGT,MAAM,CAACU,OAAO;AAEjC,MAAMC,GAAG,GAAGP,YAAY,CAACQ,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAgBzC;AACA,eAAeC,WAAW,CAACC,OAAiC,EAAgB;EAC1E,IAAI;IACF,OAAO,MAAMA,OAAO,EAAE;EACxB,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,IACEhB,eAAe,CAAC,QAAQ,EAAEgB,KAAK,CAAC,IAChCA,KAAK,CAACC,OAAO,CAACC,QAAQ,CAAC,WAAW,CAAC,EACnC;MACA,MAAM,IAAIjB,UAAU,CAClB,oCAAoC,GAClC,+CAA+C,GAC/C,qCAAqC,CACxC;IACH;IAEA,MAAMe,KAAK;EACb;AACF;AAEA,eAAe,MAAMG,QAAQ,CAAC;EAGZ;;EAEhB;;EAEA;EACA;;EAGAC,WAAW,CAACC,MAAsB,EAAE;IAClC,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAM;MAAEC,GAAG;MAAEC,MAAM;MAAEC,OAAO;MAAEC;IAAQ,CAAC,GAAGJ,MAAM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ElG;IAAU,CAAC,GAAG,IAAI;;IAE1B;IACA;IACAhB,GAAG,CAAC2B,KAAK,CAAE,+BAA8BF,QAAS,KAAIwF,MAAO,OAAMC,KAAM,EAAC,CAAC;IAE3E,MAAM9G,WAAW,CAAC,YAAY;MAC5B,MAAMY,SAAS,CAACc,SAAS,CAACL,QAAQ,CAAC,CAAC0F,OAAO,CAACD,KAAK,EAAED,MAAM,CAAC;IAC5D,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,eAAeG,cAAc,CAACvG,MAAe,EAA0B;EAC5E,MAAMwG,QAAQ,GAAG,IAAI5G,QAAQ,CAAC;IAAEI;EAAO,CAAC,CAAC;EACzC,OAAOwG,QAAQ,CAAChF,eAAe,EAAE;AACnC;AAEA,OAAO,eAAeiF,kBAAkB,CACtC7F,QAAgB,EAChBZ,MAAe,EACS;EACxB,MAAMwG,QAAQ,GAAG,IAAI5G,QAAQ,CAAC;IAAEI;EAAO,CAAC,CAAC;EACzC,OAAOwG,QAAQ,CAAC1E,4BAA4B,CAAClB,QAAQ,CAAC;AACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["fs","defaultAsyncMkdirp","UsageError","isErrorWithCode","createLogger","log","import","meta","url","defaultAsyncFsAccess","access","bind","prepareArtifactsDir","artifactsDir","asyncMkdirp","asyncFsAccess","stats","stat","isDirectory","W_OK","accessErr","error","debug","mkdirErr"],"sources":["../../src/util/artifacts.js"],"sourcesContent":["/* @flow */\nimport {fs} from 'mz';\nimport defaultAsyncMkdirp from 'mkdirp';\n\nimport {UsageError, isErrorWithCode} from '../errors.js';\nimport {createLogger} from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\nconst defaultAsyncFsAccess: typeof fs.access = fs.access.bind(fs);\n\ntype PrepareArtifactsDirOptions = {\n asyncMkdirp?: typeof defaultAsyncMkdirp,\n asyncFsAccess?: typeof defaultAsyncFsAccess,\n}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":["fs","defaultAsyncMkdirp","UsageError","isErrorWithCode","createLogger","log","import","meta","url","defaultAsyncFsAccess","access","bind","prepareArtifactsDir","artifactsDir","asyncMkdirp","asyncFsAccess","stats","stat","isDirectory","W_OK","accessErr","error","debug","mkdirErr"],"sources":["../../src/util/artifacts.js"],"sourcesContent":["/* @flow */\nimport { fs } from 'mz';\nimport defaultAsyncMkdirp from 'mkdirp';\n\nimport { UsageError, isErrorWithCode } from '../errors.js';\nimport { createLogger } from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\nconst defaultAsyncFsAccess: typeof fs.access = fs.access.bind(fs);\n\ntype PrepareArtifactsDirOptions = {\n asyncMkdirp?: typeof defaultAsyncMkdirp,\n asyncFsAccess?: typeof defaultAsyncFsAccess,\n};\n\nexport async function prepareArtifactsDir(\n artifactsDir: string,\n {\n asyncMkdirp = defaultAsyncMkdirp,\n asyncFsAccess = defaultAsyncFsAccess,\n }: PrepareArtifactsDirOptions = {}\n): Promise<string> {\n try {\n const stats = await fs.stat(artifactsDir);\n if (!stats.isDirectory()) {\n throw new UsageError(\n `--artifacts-dir=\"${artifactsDir}\" exists but it is not a directory.`\n );\n }\n // If the artifactsDir already exists, check that we have the write permissions on it.\n try {\n await asyncFsAccess(artifactsDir, fs.W_OK);\n } catch (accessErr) {\n if (isErrorWithCode('EACCES', accessErr)) {\n throw new UsageError(\n `--artifacts-dir=\"${artifactsDir}\" exists but the user lacks ` +\n 'permissions on it.'\n );\n } else {\n throw accessErr;\n }\n }\n } catch (error) {\n if (isErrorWithCode('EACCES', error)) {\n // Handle errors when the artifactsDir cannot be accessed.\n throw new UsageError(\n `Cannot access --artifacts-dir=\"${artifactsDir}\" because the user ` +\n `lacks permissions: ${error}`\n );\n } else if (isErrorWithCode('ENOENT', error)) {\n // Create the artifact dir if it doesn't exist yet.\n try {\n log.debug(`Creating artifacts directory: ${artifactsDir}`);\n await asyncMkdirp(artifactsDir);\n } catch (mkdirErr) {\n if (isErrorWithCode('EACCES', mkdirErr)) {\n // Handle errors when the artifactsDir cannot be created for lack of permissions.\n throw new UsageError(\n `Cannot create --artifacts-dir=\"${artifactsDir}\" because the ` +\n `user lacks permissions: ${mkdirErr}`\n );\n } else {\n throw mkdirErr;\n }\n }\n } else {\n throw error;\n }\n }\n\n return artifactsDir;\n}\n"],"mappings":";AACA,SAASA,EAAE,QAAQ,IAAI;AACvB,OAAOC,kBAAkB,MAAM,QAAQ;AAEvC,SAASC,UAAU,EAAEC,eAAe,QAAQ,cAAc;AAC1D,SAASC,YAAY,QAAQ,aAAa;AAE1C,MAAMC,GAAG,GAAGD,YAAY,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAEzC,MAAMC,oBAAsC,GAAGT,EAAE,CAACU,MAAM,CAACC,IAAI,CAACX,EAAE,CAAC;AAOjE,OAAO,eAAeY,mBAAmB,CACvCC,YAAoB,EACpB;EACEC,WAAW,GAAGb,kBAAkB;EAChCc,aAAa,GAAGN;AACU,CAAC,GAAG,CAAC,CAAC,EACjB;EACjB,IAAI;IACF,MAAMO,KAAK,GAAG,MAAMhB,EAAE,CAACiB,IAAI,CAACJ,YAAY,CAAC;IACzC,IAAI,CAACG,KAAK,CAACE,WAAW,EAAE,EAAE;MACxB,MAAM,IAAIhB,UAAU,CACjB,oBAAmBW,YAAa,qCAAoC,CACtE;IACH;IACA;IACA,IAAI;MACF,MAAME,aAAa,CAACF,YAAY,EAAEb,EAAE,CAACmB,IAAI,CAAC;IAC5C,CAAC,CAAC,OAAOC,SAAS,EAAE;MAClB,IAAIjB,eAAe,CAAC,QAAQ,EAAEiB,SAAS,CAAC,EAAE;QACxC,MAAM,IAAIlB,UAAU,CACjB,oBAAmBW,YAAa,8BAA6B,GAC5D,oBAAoB,CACvB;MACH,CAAC,MAAM;QACL,MAAMO,SAAS;MACjB;IACF;EACF,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,IAAIlB,eAAe,CAAC,QAAQ,EAAEkB,KAAK,CAAC,EAAE;MACpC;MACA,MAAM,IAAInB,UAAU,CACjB,kCAAiCW,YAAa,qBAAoB,GAChE,sBAAqBQ,KAAM,EAAC,CAChC;IACH,CAAC,MAAM,IAAIlB,eAAe,CAAC,QAAQ,EAAEkB,KAAK,CAAC,EAAE;MAC3C;MACA,IAAI;QACFhB,GAAG,CAACiB,KAAK,CAAE,iCAAgCT,YAAa,EAAC,CAAC;QAC1D,MAAMC,WAAW,CAACD,YAAY,CAAC;MACjC,CAAC,CAAC,OAAOU,QAAQ,EAAE;QACjB,IAAIpB,eAAe,CAAC,QAAQ,EAAEoB,QAAQ,CAAC,EAAE;UACvC;UACA,MAAM,IAAIrB,UAAU,CACjB,kCAAiCW,YAAa,gBAAe,GAC3D,2BAA0BU,QAAS,EAAC,CACxC;QACH,CAAC,MAAM;UACL,MAAMA,QAAQ;QAChB;MACF;IACF,CAAC,MAAM;MACL,MAAMF,KAAK;IACb;EACF;EAEA,OAAOR,YAAY;AACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desktop-notifier.js","names":["defaultNotifier","createLogger","defaultLog","import","meta","url","showDesktopNotification","title","message","icon","notifier","log","Promise","resolve","reject","notify","err","res","debug"],"sources":["../../src/util/desktop-notifier.js"],"sourcesContent":["/* @flow */\nimport defaultNotifier from 'node-notifier';\n\nimport {createLogger} from './logger.js';\nimport type {Logger} from './logger';\n\nconst defaultLog = createLogger(import.meta.url);\n\nexport type DesktopNotificationsParams = {|\n title: string,\n message: string,\n icon?: string,\n|};\n\nexport type DesktopNotificationsOptions = {\n notifier?: typeof defaultNotifier,\n log?: Logger,\n};\n\nexport function showDesktopNotification(\n {
|
|
1
|
+
{"version":3,"file":"desktop-notifier.js","names":["defaultNotifier","createLogger","defaultLog","import","meta","url","showDesktopNotification","title","message","icon","notifier","log","Promise","resolve","reject","notify","err","res","debug"],"sources":["../../src/util/desktop-notifier.js"],"sourcesContent":["/* @flow */\nimport defaultNotifier from 'node-notifier';\n\nimport { createLogger } from './logger.js';\nimport type { Logger } from './logger';\n\nconst defaultLog = createLogger(import.meta.url);\n\nexport type DesktopNotificationsParams = {|\n title: string,\n message: string,\n icon?: string,\n|};\n\nexport type DesktopNotificationsOptions = {\n notifier?: typeof defaultNotifier,\n log?: Logger,\n};\n\nexport function showDesktopNotification(\n { title, message, icon }: DesktopNotificationsParams,\n {\n notifier = defaultNotifier,\n log = defaultLog,\n }: DesktopNotificationsOptions = {}\n): Promise<void> {\n return new Promise((resolve, reject) => {\n notifier.notify({ title, message, icon }, (err, res) => {\n if (err) {\n log.debug(\n `Desktop notifier error: ${err.message},` + ` response: ${res}`\n );\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n"],"mappings":";AACA,OAAOA,eAAe,MAAM,eAAe;AAE3C,SAASC,YAAY,QAAQ,aAAa;AAG1C,MAAMC,UAAU,GAAGD,YAAY,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAahD,OAAO,SAASC,uBAAuB,CACrC;EAAEC,KAAK;EAAEC,OAAO;EAAEC;AAAiC,CAAC,EACpD;EACEC,QAAQ,GAAGV,eAAe;EAC1BW,GAAG,GAAGT;AACqB,CAAC,GAAG,CAAC,CAAC,EACpB;EACf,OAAO,IAAIU,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCJ,QAAQ,CAACK,MAAM,CAAC;MAAER,KAAK;MAAEC,OAAO;MAAEC;IAAK,CAAC,EAAE,CAACO,GAAG,EAAEC,GAAG,KAAK;MACtD,IAAID,GAAG,EAAE;QACPL,GAAG,CAACO,KAAK,CACN,2BAA0BF,GAAG,CAACR,OAAQ,GAAE,GAAI,cAAaS,GAAI,EAAC,CAChE;QACDH,MAAM,CAACE,GAAG,CAAC;MACb,CAAC,MAAM;QACLH,OAAO,EAAE;MACX;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-exists.js","names":["fs","isErrorWithCode","fileExists","path","fileIsReadable","f","access","constants","R_OK","stat","isFile","error"],"sources":["../../src/util/file-exists.js"],"sourcesContent":["/* @flow */\nimport {fs} from 'mz';\n\nimport {isErrorWithCode} from '../errors.js';\n\ntype FileExistsOptions = {\n fileIsReadable: (filePath: string) => Promise<boolean>,\n};\n\n/*\n * Resolves true if the path is a readable file.\n *\n * Usage:\n *\n * const exists = await fileExists(filePath);\n * if (exists) {\n * // ...\n * }\n *\n * */\nexport default async function fileExists(\n path: string,\n {\n fileIsReadable = (f) => fs.access(f, fs.constants.R_OK),\n }: FileExistsOptions = {}\n): Promise<boolean> {\n try {\n await fileIsReadable(path);\n const stat = await fs.stat(path);\n return stat.isFile();\n } catch (error) {\n if (isErrorWithCode(['EACCES', 'ENOENT'], error)) {\n return false;\n }\n throw error;\n }\n}\n"],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"file-exists.js","names":["fs","isErrorWithCode","fileExists","path","fileIsReadable","f","access","constants","R_OK","stat","isFile","error"],"sources":["../../src/util/file-exists.js"],"sourcesContent":["/* @flow */\nimport { fs } from 'mz';\n\nimport { isErrorWithCode } from '../errors.js';\n\ntype FileExistsOptions = {\n fileIsReadable: (filePath: string) => Promise<boolean>,\n};\n\n/*\n * Resolves true if the path is a readable file.\n *\n * Usage:\n *\n * const exists = await fileExists(filePath);\n * if (exists) {\n * // ...\n * }\n *\n * */\nexport default async function fileExists(\n path: string,\n {\n fileIsReadable = (f) => fs.access(f, fs.constants.R_OK),\n }: FileExistsOptions = {}\n): Promise<boolean> {\n try {\n await fileIsReadable(path);\n const stat = await fs.stat(path);\n return stat.isFile();\n } catch (error) {\n if (isErrorWithCode(['EACCES', 'ENOENT'], error)) {\n return false;\n }\n throw error;\n }\n}\n"],"mappings":";AACA,SAASA,EAAE,QAAQ,IAAI;AAEvB,SAASC,eAAe,QAAQ,cAAc;AAM9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAeC,UAAU,CACtCC,IAAY,EACZ;EACEC,cAAc,GAAIC,CAAC,IAAKL,EAAE,CAACM,MAAM,CAACD,CAAC,EAAEL,EAAE,CAACO,SAAS,CAACC,IAAI;AACrC,CAAC,GAAG,CAAC,CAAC,EACP;EAClB,IAAI;IACF,MAAMJ,cAAc,CAACD,IAAI,CAAC;IAC1B,MAAMM,IAAI,GAAG,MAAMT,EAAE,CAACS,IAAI,CAACN,IAAI,CAAC;IAChC,OAAOM,IAAI,CAACC,MAAM,EAAE;EACtB,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,IAAIV,eAAe,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAEU,KAAK,CAAC,EAAE;MAChD,OAAO,KAAK;IACd;IACA,MAAMA,KAAK;EACb;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-filter.js","names":["path","multimatch","createLogger","log","import","meta","url","isSubPath","src","target","relate","relative","startsWith","sep","FileFilter","constructor","baseIgnoredPatterns","ignoreFiles","sourceDir","artifactsDir","resolve","filesToIgnore","addToIgnoreList","debug","join","resolveWithSourceDir","file","resolvedPath","files","charAt","resolvedFile","substr","push","wantFile","filePath","matches","length","createFileFilter","params"],"sources":["../../src/util/file-filter.js"],"sourcesContent":["/* @flow */\nimport path from 'path';\n\nimport multimatch from 'multimatch';\n\nimport {createLogger} from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\n// check if target is a sub directory of src\nexport const isSubPath = (src: string, target: string): boolean => {\n const relate = path.relative(src, target);\n // same dir\n if (!relate) {\n return false;\n }\n if (relate === '..') {\n return false;\n }\n return !relate.startsWith(`..${path.sep}`);\n};\n\n// FileFilter types and implementation.\n\nexport type FileFilterOptions = {\n baseIgnoredPatterns?: Array<string>,\n ignoreFiles?: Array<string>,\n sourceDir: string,\n artifactsDir?: string,\n};\n\n/*\n * Allows or ignores files.\n */\nexport class FileFilter {\n filesToIgnore: Array<string>;\n sourceDir: string;\n\n constructor({\n baseIgnoredPatterns = [\n '**/*.xpi',\n '**/*.zip',\n '**/.*', // any hidden file and folder\n '**/.*/**/*', // and the content inside hidden folder\n '**/node_modules',\n '**/node_modules/**/*',\n ],\n ignoreFiles = [],\n sourceDir,\n artifactsDir,\n }: FileFilterOptions = {}) {\n sourceDir = path.resolve(sourceDir);\n\n this.filesToIgnore = [];\n this.sourceDir = sourceDir;\n\n this.addToIgnoreList(baseIgnoredPatterns);\n if (ignoreFiles) {\n this.addToIgnoreList(ignoreFiles);\n }\n if (artifactsDir && isSubPath(sourceDir, artifactsDir)) {\n artifactsDir = path.resolve(artifactsDir);\n log.debug(\n `Ignoring artifacts directory \"${artifactsDir}\" ` +\n
|
|
1
|
+
{"version":3,"file":"file-filter.js","names":["path","multimatch","createLogger","log","import","meta","url","isSubPath","src","target","relate","relative","startsWith","sep","FileFilter","constructor","baseIgnoredPatterns","ignoreFiles","sourceDir","artifactsDir","resolve","filesToIgnore","addToIgnoreList","debug","join","resolveWithSourceDir","file","resolvedPath","files","charAt","resolvedFile","substr","push","wantFile","filePath","matches","length","createFileFilter","params"],"sources":["../../src/util/file-filter.js"],"sourcesContent":["/* @flow */\nimport path from 'path';\n\nimport multimatch from 'multimatch';\n\nimport { createLogger } from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\n// check if target is a sub directory of src\nexport const isSubPath = (src: string, target: string): boolean => {\n const relate = path.relative(src, target);\n // same dir\n if (!relate) {\n return false;\n }\n if (relate === '..') {\n return false;\n }\n return !relate.startsWith(`..${path.sep}`);\n};\n\n// FileFilter types and implementation.\n\nexport type FileFilterOptions = {\n baseIgnoredPatterns?: Array<string>,\n ignoreFiles?: Array<string>,\n sourceDir: string,\n artifactsDir?: string,\n};\n\n/*\n * Allows or ignores files.\n */\nexport class FileFilter {\n filesToIgnore: Array<string>;\n sourceDir: string;\n\n constructor({\n baseIgnoredPatterns = [\n '**/*.xpi',\n '**/*.zip',\n '**/.*', // any hidden file and folder\n '**/.*/**/*', // and the content inside hidden folder\n '**/node_modules',\n '**/node_modules/**/*',\n ],\n ignoreFiles = [],\n sourceDir,\n artifactsDir,\n }: FileFilterOptions = {}) {\n sourceDir = path.resolve(sourceDir);\n\n this.filesToIgnore = [];\n this.sourceDir = sourceDir;\n\n this.addToIgnoreList(baseIgnoredPatterns);\n if (ignoreFiles) {\n this.addToIgnoreList(ignoreFiles);\n }\n if (artifactsDir && isSubPath(sourceDir, artifactsDir)) {\n artifactsDir = path.resolve(artifactsDir);\n log.debug(\n `Ignoring artifacts directory \"${artifactsDir}\" ` +\n 'and all its subdirectories'\n );\n this.addToIgnoreList([artifactsDir, path.join(artifactsDir, '**', '*')]);\n }\n }\n\n /**\n * Resolve relative path to absolute path with sourceDir.\n */\n resolveWithSourceDir(file: string): string {\n const resolvedPath = path.resolve(this.sourceDir, file);\n log.debug(\n `Resolved path ${file} with sourceDir ${this.sourceDir} ` +\n `to ${resolvedPath}`\n );\n return resolvedPath;\n }\n\n /**\n * Insert more files into filesToIgnore array.\n */\n addToIgnoreList(files: Array<string>) {\n for (const file of files) {\n if (file.charAt(0) === '!') {\n const resolvedFile = this.resolveWithSourceDir(file.substr(1));\n this.filesToIgnore.push(`!${resolvedFile}`);\n } else {\n this.filesToIgnore.push(this.resolveWithSourceDir(file));\n }\n }\n }\n\n /*\n * Returns true if the file is wanted.\n *\n * If filePath does not start with a slash, it will be treated as a path\n * relative to sourceDir when matching it against all configured\n * ignore-patterns.\n *\n * Example: this is called by zipdir as wantFile(filePath) for each\n * file in the folder that is being archived.\n */\n wantFile(filePath: string): boolean {\n const resolvedPath = this.resolveWithSourceDir(filePath);\n const matches = multimatch(resolvedPath, this.filesToIgnore);\n if (matches.length > 0) {\n log.debug(`FileFilter: ignoring file ${resolvedPath}`);\n return false;\n }\n return true;\n }\n}\n\n// a helper function to make mocking easier\n\nexport const createFileFilter = (params: FileFilterOptions): FileFilter =>\n new FileFilter(params);\n\nexport type FileFilterCreatorFn = typeof createFileFilter;\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,MAAM;AAEvB,OAAOC,UAAU,MAA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AAgB,GAAIC,MAAyB,IACxD,IAAIxB,UAAU,CAACwB,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-directory.js","names":["fs","onlyErrorsWithCode","isDirectory","path","stat","then","stats","catch"],"sources":["../../src/util/is-directory.js"],"sourcesContent":["/* @flow */\nimport {fs} from 'mz';\n\nimport {onlyErrorsWithCode} from '../errors.js';\n\n/*\n * Resolves true if the path is a readable directory.\n *\n * Usage:\n *\n * isDirectory('/some/path')\n * .then((dirExists) => {\n * // dirExists will be true or false.\n * });\n *\n * */\nexport default function isDirectory(path: string): Promise<boolean> {\n return fs.stat(path)\n .then((stats) => stats.isDirectory())\n .catch(onlyErrorsWithCode(['ENOENT', 'ENOTDIR'], () => {\n
|
|
1
|
+
{"version":3,"file":"is-directory.js","names":["fs","onlyErrorsWithCode","isDirectory","path","stat","then","stats","catch"],"sources":["../../src/util/is-directory.js"],"sourcesContent":["/* @flow */\nimport { fs } from 'mz';\n\nimport { onlyErrorsWithCode } from '../errors.js';\n\n/*\n * Resolves true if the path is a readable directory.\n *\n * Usage:\n *\n * isDirectory('/some/path')\n * .then((dirExists) => {\n * // dirExists will be true or false.\n * });\n *\n * */\nexport default function isDirectory(path: string): Promise<boolean> {\n return fs\n .stat(path)\n .then((stats) => stats.isDirectory())\n .catch(\n onlyErrorsWithCode(['ENOENT', 'ENOTDIR'], () => {\n return false;\n })\n );\n}\n"],"mappings":";AACA,SAASA,EAAE,QAAQ,IAAI;AAEvB,SAASC,kBAAkB,QAAQ,cAAc;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAW,CAACC,IAAY,EAAoB;EAClE,OAAOH,EAAE,CACNI,IAAI,CAACD,IAAI,CAAC,CACVE,IAAI,CAAEC,KAAK,IAAKA,KAAK,CAACJ,WAAW,EAAE,CAAC,CACpCK,KAAK,CACJN,kBAAkB,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM;IAC9C,OAAO,KAAK;EACd,CAAC,CAAC,CACH;AACL"}
|
package/lib/util/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["fileURLToPath","bunyan","nameFromLevel","createLogger","defaultLogCreator","ConsoleStream","constructor","verbose","isCapturing","capturedMessages","format","name","msg","level","prefix","makeVerbose","write","packet","localProcess","process","thisLevel","TRACE","INFO","push","stdout","startCapturing","stopCapturing","flushCapturedLogs","consoleStream","moduleURL","createBunyanLog","replace","streams","type","stream"],"sources":["../../src/util/logger.js"],"sourcesContent":["/* @flow */\nimport { fileURLToPath } from 'url';\n\nimport bunyan, {nameFromLevel
|
|
1
|
+
{"version":3,"file":"logger.js","names":["fileURLToPath","bunyan","nameFromLevel","createLogger","defaultLogCreator","ConsoleStream","constructor","verbose","isCapturing","capturedMessages","format","name","msg","level","prefix","makeVerbose","write","packet","localProcess","process","thisLevel","TRACE","INFO","push","stdout","startCapturing","stopCapturing","flushCapturedLogs","consoleStream","moduleURL","createBunyanLog","replace","streams","type","stream"],"sources":["../../src/util/logger.js"],"sourcesContent":["/* @flow */\nimport { fileURLToPath } from 'url';\n\nimport bunyan, {\n nameFromLevel,\n createLogger as defaultLogCreator,\n} from 'bunyan';\n\n// Bunyan-related Flow types\n\nexport type TRACE = 10;\nexport type DEBUG = 20;\nexport type INFO = 30;\nexport type WARN = 40;\nexport type ERROR = 50;\nexport type FATAL = 60;\n\nexport type BunyanLogLevel = TRACE | DEBUG | INFO | WARN | ERROR | FATAL;\n\nexport type BunyanLogEntry = {|\n name: string,\n msg: string,\n level: BunyanLogLevel,\n|};\n\nexport type Logger = {\n debug: (msg: string, ...args: any) => void,\n error: (msg: string, ...args: any) => void,\n info: (msg: string, ...args: any) => void,\n warn: (msg: string, ...args: any) => void,\n};\n\n// ConsoleStream types and implementation.\n\nexport type ConsoleStreamParams = {\n verbose?: boolean,\n};\n\nexport type ConsoleOptions = {\n localProcess?: typeof process,\n};\n\nexport class ConsoleStream {\n verbose: boolean;\n isCapturing: boolean;\n capturedMessages: Array<string>;\n\n constructor({ verbose = false }: ConsoleStreamParams = {}) {\n this.verbose = verbose;\n this.isCapturing = false;\n this.capturedMessages = [];\n }\n\n format({ name, msg, level }: BunyanLogEntry): string {\n const prefix = this.verbose ? `[${name}][${nameFromLevel[level]}] ` : '';\n return `${prefix}${msg}\\n`;\n }\n\n makeVerbose() {\n this.verbose = true;\n }\n\n write(\n packet: BunyanLogEntry,\n { localProcess = process }: ConsoleOptions = {}\n ): void {\n const thisLevel: BunyanLogLevel = this.verbose ? bunyan.TRACE : bunyan.INFO;\n if (packet.level >= thisLevel) {\n const msg = this.format(packet);\n if (this.isCapturing) {\n this.capturedMessages.push(msg);\n } else {\n localProcess.stdout.write(msg);\n }\n }\n }\n\n startCapturing() {\n this.isCapturing = true;\n }\n\n stopCapturing() {\n this.isCapturing = false;\n this.capturedMessages = [];\n }\n\n flushCapturedLogs({ localProcess = process }: ConsoleOptions = {}) {\n for (const msg of this.capturedMessages) {\n localProcess.stdout.write(msg);\n }\n this.capturedMessages = [];\n }\n}\n\nexport const consoleStream: ConsoleStream = new ConsoleStream();\n\n// createLogger types and implementation.\n\nexport type BunyanStreamConfig = {\n type: string,\n stream: ConsoleStream,\n};\n\nexport type CreateBunyanLogParams = {\n name: string,\n level: BunyanLogLevel,\n streams: Array<BunyanStreamConfig>,\n};\n\nexport type CreateBunyanLogFn = (params: CreateBunyanLogParams) => Logger;\n\nexport type CreateLoggerOptions = {\n createBunyanLog: CreateBunyanLogFn,\n};\n\nexport function createLogger(\n moduleURL?: string,\n { createBunyanLog = defaultLogCreator }: CreateLoggerOptions = {}\n): Logger {\n return createBunyanLog({\n // Strip the leading src/ from file names (which is in all file names) to\n // make the name less redundant.\n name: moduleURL\n ? fileURLToPath(moduleURL).replace(/^src\\//, '')\n : 'unknown-module',\n // Capture all log levels and let the stream filter them.\n level: bunyan.TRACE,\n streams: [\n {\n type: 'raw',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AkB,aAAa,GAAG;IACd,IAAI,CAAClB,WAAW,GAAG,KAAK;IACxB,IAAI,CAACC,gBAAgB,GAAG,EAAE;EAC5B;EAEAkB,iBAAiB,CAAC;IAAET,YAAY,GAAGC;EAAwB,CAAC,GAAG,CAAC,CAAC,EAAE;IACjE,KAAK,MAAMP,GAAG,IAAI,IAAI,CAACH,gBAAgB,EAAE;MACvCS,YAAY,CAACM,MAAM,CAACR,KAAK,CAACJ,GAAG,CAAC;IAChC;IACA,IAAI,CAACH,gBAAgB,GAAG,EAAE;EAC5B;AACF;AAEA,OAAO,MAAMmB,aAA4B,GAAG,IAAIvB,aAAa,EAAE;;AAE/D;;AAmBA,OAAO,SAASF,YAAY,CAC1B0B,SAAkB,EAClB;EAAEC,eAAe,GAAG1B;AAAuC,CAAC,GAAG,CAAC,CAAC,EACzD;EACR,OAAO0B,eAAe,CAAC;IACrB;IACA;IACAnB,IAAI,EAAEkB,SAAS,GACX7B,aAAa,CAAC6B,SAAS,CAAC,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,GAC9C,gBAAgB;IACpB;IACAlB,KAAK,EAAEZ,MAAM,CAACoB,KAAK;IACnBW,OAAO,EAAE,CACP;MACEC,IAAI,EAAE,KAAK;MACXC,MAAM,EAAEN;IACV,CAAC;EAEL,CAAC,CAAC;AACJ"}
|
package/lib/util/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","names":["path","fs","parseJSON","stripBom","stripJsonComments","InvalidManifest","createLogger","log","import","meta","url","getValidatedManifest","sourceDir","manifestFile","join","debug","manifestContents","readFile","encoding","error","manifestData","errors","name","push","version","applications","gecko","length","getManifestId","manifestApps","browser_specific_settings","apps","id","undefined"],"sources":["../../src/util/manifest.js"],"sourcesContent":["/* @flow */\nimport path from 'path';\n\nimport {fs} from 'mz';\nimport parseJSON from 'parse-json';\nimport stripBom from 'strip-bom';\nimport stripJsonComments from 'strip-json-comments';\n\nimport {InvalidManifest} from '../errors.js';\nimport {createLogger} from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\n
|
|
1
|
+
{"version":3,"file":"manifest.js","names":["path","fs","parseJSON","stripBom","stripJsonComments","InvalidManifest","createLogger","log","import","meta","url","getValidatedManifest","sourceDir","manifestFile","join","debug","manifestContents","readFile","encoding","error","manifestData","errors","name","push","version","applications","gecko","length","getManifestId","manifestApps","browser_specific_settings","apps","id","undefined"],"sources":["../../src/util/manifest.js"],"sourcesContent":["/* @flow */\nimport path from 'path';\n\nimport { fs } from 'mz';\nimport parseJSON from 'parse-json';\nimport stripBom from 'strip-bom';\nimport stripJsonComments from 'strip-json-comments';\n\nimport { InvalidManifest } from '../errors.js';\nimport { createLogger } from './logger.js';\n\nconst log = createLogger(import.meta.url);\n\n// getValidatedManifest helper types and implementation\n\nexport type ExtensionManifestApplications = {|\n gecko?: {|\n id?: string,\n strict_min_version?: string,\n strict_max_version?: string,\n update_url?: string,\n |},\n|};\n\nexport type ExtensionManifest = {|\n name: string,\n version: string,\n default_locale?: string,\n applications?: ExtensionManifestApplications,\n browser_specific_settings?: ExtensionManifestApplications,\n permissions?: Array<string>,\n|};\n\nexport default async function getValidatedManifest(\n sourceDir: string\n): Promise<ExtensionManifest> {\n const manifestFile = path.join(sourceDir, 'manifest.json');\n log.debug(`Validating manifest at ${manifestFile}`);\n\n let manifestContents;\n\n try {\n manifestContents = await fs.readFile(manifestFile, { encoding: 'utf-8' });\n } catch (error) {\n throw new InvalidManifest(\n `Could not read manifest.json file at ${manifestFile}: ${error}`\n );\n }\n\n manifestContents = stripBom(manifestContents);\n\n let manifestData;\n\n try {\n manifestData = parseJSON(stripJsonComments(manifestContents));\n } catch (error) {\n throw new InvalidManifest(\n `Error parsing manifest.json file at ${manifestFile}: ${error}`\n );\n }\n\n const errors = [];\n // This is just some basic validation of what web-ext needs, not\n // what Firefox will need to run the extension.\n // TODO: integrate with the addons-linter for actual validation.\n if (!manifestData.name) {\n errors.push('missing \"name\" property');\n }\n if (!manifestData.version) {\n errors.push('missing \"version\" property');\n }\n\n if (manifestData.applications && !manifestData.applications.gecko) {\n // Since the applications property only applies to gecko, make\n // sure 'gecko' exists when 'applications' is defined. This should\n // make introspection of gecko properties easier.\n errors.push('missing \"applications.gecko\" property');\n }\n\n if (errors.length) {\n throw new InvalidManifest(\n `Manifest at ${manifestFile} is invalid: ${errors.join('; ')}`\n );\n }\n\n return manifestData;\n}\n\nexport function getManifestId(manifestData: ExtensionManifest): string | void {\n const manifestApps = [\n manifestData.browser_specific_settings,\n manifestData.applications,\n ];\n for (const apps of manifestApps) {\n // If both bss and applicants contains a defined gecko property,\n // we prefer bss even if the id property isn't available.\n // This match what Firefox does in this particular scenario, see\n // https://searchfox.org/mozilla-central/rev/828f2319c0195d7f561ed35533aef6fe183e68e3/toolkit/mozapps/extensions/internal/XPIInstall.jsm#470-474,488\n if (apps?.gecko) {\n return apps.gecko.id;\n }\n }\n\n return undefined;\n}\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,MAAM;AAEvB,SAASC,EAAE,QAAQ,IAAI;AACvB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,iBAAiB,MAAM,qBAAqB;AAEnD,SAASC,eAAe,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,aAAa;AAE1C,MAAMC,GAAG,GAAGD,YAAY,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;;AAEzC;;AAoBA,eAAe,eAAeC,oBAAoB,CAChDC,SAAiB,EACW;EAC5B,MAAMC,YAAY,GAAGb,IAAI,CAACc,IAAI,CAACF,SAAS,EAAE,eAAe,CAAC;EAC1DL,GAAG,CAACQ,KAAK,CAAE,0BAAyBF,YAAa,EAAC,CAAC;EAEnD,IAAIG,gBAAgB;EAEpB,IAAI;IACFA,gBAAgB,GAAG,MAAMf,EAAE,CAACgB,QAAQ,CAACJ,YAAY,EAAE;MAAEK,QAAQ,EAAE;IAAQ,CA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ACM,EAAE;IACtB;EACF;EAEA,OAAOC,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify.js","names":["promisify","promisifyCustom","custom","multiArgsPromisedFn","fn","callerArgs","Promise","resolve","reject","err","rest"],"sources":["../../src/util/promisify.js"],"sourcesContent":["/* @flow */\n\nimport {promisify} from 'util';\n\n// promisify.custom is missing from the node types know to flow,\n// and it triggers flow-check errors if used directly.\n// By using the value exported here, flow-check passes successfully\n// using a single FLOW_IGNORE suppress comment.\n\n// $FlowIgnore: promisify.custom is missing in flow type signatures.\nexport const promisifyCustom = promisify.custom;\n\n/*\n * A small promisify helper to make it easier to customize a\n * function promisified (using the 'util' module available in\n * nodejs >= 8) to resolve to an array of results:\n *\n * import {promisify} from 'util';\n * import {multiArgsPromisedFn} from '../util/promisify';\n *\n * aCallbackBasedFn[promisify.custom] = multiArgsPromisedFn(tmp.dir);\n * ...\n */\nexport function multiArgsPromisedFn(fn: Function): Function {\n return (...callerArgs: Array<any>): Promise<any> => {\n return new Promise((resolve, reject) => {\n fn(...callerArgs, (err, ...rest) => {\n if (err) {\n reject(err);\n } else {\n resolve(rest);\n }\n });\n });\n };\n}\n"],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"promisify.js","names":["promisify","promisifyCustom","custom","multiArgsPromisedFn","fn","callerArgs","Promise","resolve","reject","err","rest"],"sources":["../../src/util/promisify.js"],"sourcesContent":["/* @flow */\n\nimport { promisify } from 'util';\n\n// promisify.custom is missing from the node types know to flow,\n// and it triggers flow-check errors if used directly.\n// By using the value exported here, flow-check passes successfully\n// using a single FLOW_IGNORE suppress comment.\n\n// $FlowIgnore: promisify.custom is missing in flow type signatures.\nexport const promisifyCustom = promisify.custom;\n\n/*\n * A small promisify helper to make it easier to customize a\n * function promisified (using the 'util' module available in\n * nodejs >= 8) to resolve to an array of results:\n *\n * import {promisify} from 'util';\n * import {multiArgsPromisedFn} from '../util/promisify';\n *\n * aCallbackBasedFn[promisify.custom] = multiArgsPromisedFn(tmp.dir);\n * ...\n */\nexport function multiArgsPromisedFn(fn: Function): Function {\n return (...callerArgs: Array<any>): Promise<any> => {\n return new Promise((resolve, reject) => {\n fn(...callerArgs, (err, ...rest) => {\n if (err) {\n reject(err);\n } else {\n resolve(rest);\n }\n });\n });\n };\n}\n"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,MAAM;;AAEhC;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMC,eAAe,GAAGD,SAAS,CAACE,MAAM;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmB,CAACC,EAAY,EAAY;EAC1D,OAAO,CAAC,GAAGC,UAAsB,KAAmB;IAClD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtCJ,EAAE,CAAC,GAAGC,UAAU,EAAE,CAACI,GAAG,EAAE,GAAGC,IAAI,KAAK;QAClC,IAAID,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;QACb,CAAC,MAAM;UACLF,OAAO,CAACG,IAAI,CAAC;QACf;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC;AACH"}
|
package/lib/util/stdin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdin.js","names":["isTTY","stream","setRawMode","rawMode"],"sources":["../../src/util/stdin.js"],"sourcesContent":["/* @flow */\n\nimport type {Readable} from 'stream';\n\nexport function isTTY(stream: Readable): boolean {\n // $FlowFixMe: flow complains that stream may not provide isTTY as a property.\n return stream.isTTY;\n}\n\nexport function setRawMode(stream: Readable, rawMode: boolean) {\n // $FlowFixMe: flow complains that stdin may not provide setRawMode.\n stream.setRawMode(rawMode);\n}\n"],"mappings":";;AAIA,OAAO,SAASA,KAAK,CAACC,MAAgB,EAAW;EAC/C;EACA,OAAOA,MAAM,CAACD,KAAK;AACrB;AAEA,OAAO,SAASE,UAAU,CAACD,MAAgB,EAAEE,OAAgB,EAAE;EAC7D;EACAF,MAAM,CAACC,UAAU,CAACC,OAAO,CAAC;AAC5B"}
|
|
1
|
+
{"version":3,"file":"stdin.js","names":["isTTY","stream","setRawMode","rawMode"],"sources":["../../src/util/stdin.js"],"sourcesContent":["/* @flow */\n\nimport type { Readable } from 'stream';\n\nexport function isTTY(stream: Readable): boolean {\n // $FlowFixMe: flow complains that stream may not provide isTTY as a property.\n return stream.isTTY;\n}\n\nexport function setRawMode(stream: Readable, rawMode: boolean) {\n // $FlowFixMe: flow complains that stdin may not provide setRawMode.\n stream.setRawMode(rawMode);\n}\n"],"mappings":";;AAIA,OAAO,SAASA,KAAK,CAACC,MAAgB,EAAW;EAC/C;EACA,OAAOA,MAAM,CAACD,KAAK;AACrB;AAEA,OAAO,SAASE,UAAU,CAACD,MAAgB,EAAEE,OAAgB,EAAE;EAC7D;EACAF,MAAM,CAACC,UAAU,CAACC,OAAO,CAAC;AAC5B"}
|