web-ext 10.1.0 → 10.2.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/lib/cmd/run.js CHANGED
@@ -2,7 +2,6 @@ import path from 'path';
2
2
  import fs from 'fs/promises';
3
3
  import nodeFs from 'fs';
4
4
  import defaultBuildExtension from './build.js';
5
- import { showDesktopNotification as defaultDesktopNotifications } from '../util/desktop-notifier.js';
6
5
  import * as defaultFirefoxApp from '../firefox/index.js';
7
6
  import { connectWithMaxRetries as defaultFirefoxClient } from '../firefox/remote.js';
8
7
  import { createLogger } from '../util/logger.js';
@@ -44,10 +43,10 @@ export default async function run({
44
43
  firefoxApkComponent,
45
44
  // Chromium CLI options.
46
45
  chromiumBinary,
46
+ chromiumPref = {},
47
47
  chromiumProfile
48
48
  }, {
49
49
  buildExtension = defaultBuildExtension,
50
- desktopNotifications = defaultDesktopNotifications,
51
50
  firefoxApp = defaultFirefoxApp,
52
51
  firefoxClient = defaultFirefoxClient,
53
52
  reloadStrategy = defaultReloadStrategy,
@@ -67,6 +66,10 @@ export default async function run({
67
66
  // Create an alias for --pref since it has been transformed into an
68
67
  // object containing one or more preferences.
69
68
  const customPrefs = pref;
69
+
70
+ // Create an alias for --chromium-pref since it has been transformed into an
71
+ // object containing one or more preferences.
72
+ const customChromiumPrefs = chromiumPref;
70
73
  const manifestData = await getValidatedManifest(sourceDir);
71
74
  const profileDir = firefoxProfile || chromiumProfile;
72
75
  if (profileCreateIfMissing) {
@@ -90,8 +93,7 @@ export default async function run({
90
93
  }],
91
94
  keepProfileChanges,
92
95
  startUrl,
93
- args,
94
- desktopNotifications
96
+ args
95
97
  };
96
98
  if (!target || target.length === 0 || target.includes('firefox-desktop')) {
97
99
  const firefoxDesktopRunnerParams = {
@@ -132,7 +134,6 @@ export default async function run({
132
134
  // Injected dependencies.
133
135
  firefoxApp,
134
136
  firefoxClient,
135
- desktopNotifications: defaultDesktopNotifications,
136
137
  buildSourceDir: (extensionSourceDir, tmpArtifactsDir) => {
137
138
  return buildExtension({
138
139
  sourceDir: extensionSourceDir,
@@ -158,6 +159,7 @@ export default async function run({
158
159
  ...commonRunnerParams,
159
160
  verbose,
160
161
  chromiumBinary,
162
+ customChromiumPrefs,
161
163
  chromiumProfile
162
164
  };
163
165
  const chromiumRunner = await createExtensionRunner({
@@ -167,7 +169,6 @@ export default async function run({
167
169
  runners.push(chromiumRunner);
168
170
  }
169
171
  const extensionRunner = new MultiExtensionRunner({
170
- desktopNotifications,
171
172
  runners
172
173
  });
173
174
  await extensionRunner.run();
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","names":["path","fs","nodeFs","defaultBuildExtension","showDesktopNotification","defaultDesktopNotifications","defaultFirefoxApp","connectWithMaxRetries","defaultFirefoxClient","createLogger","defaultGetValidatedManifest","UsageError","createExtensionRunner","defaultReloadStrategy","MultiExtensionRunner","DefaultMultiExtensionRunner","log","import","meta","url","run","artifactsDir","browserConsole","devtools","pref","firefox","firefoxProfile","profileCreateIfMissing","keepProfileChanges","ignoreFiles","noInput","noReload","preInstall","sourceDir","verbose","watchFile","watchIgnored","startUrl","target","args","adbBin","adbHost","adbPort","adbDevice","adbDiscoveryTimeout","adbRemoveOldArtifacts","firefoxApk","firefoxApkComponent","chromiumBinary","chromiumProfile","buildExtension","desktopNotifications","firefoxApp","firefoxClient","reloadStrategy","getValidatedManifest","resolve","info","Array","isArray","every","el","customPrefs","manifestData","profileDir","isDir","existsSync","mkdir","runners","commonRunnerParams","extensions","length","includes","firefoxDesktopRunnerParams","firefoxBinary","profilePath","firefoxDesktopRunner","params","push","firefoxAndroidRunnerParams","buildSourceDir","extensionSourceDir","tmpArtifactsDir","asNeeded","showReadyMessage","firefoxAndroidRunner","chromiumRunnerParams","chromiumRunner","extensionRunner"],"sources":["../../src/cmd/run.js"],"sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\nimport nodeFs from 'fs';\n\nimport defaultBuildExtension from './build.js';\nimport { showDesktopNotification as defaultDesktopNotifications } from '../util/desktop-notifier.js';\nimport * as defaultFirefoxApp from '../firefox/index.js';\nimport { connectWithMaxRetries as defaultFirefoxClient } from '../firefox/remote.js';\nimport { createLogger } from '../util/logger.js';\nimport defaultGetValidatedManifest from '../util/manifest.js';\nimport { UsageError } from '../errors.js';\nimport {\n createExtensionRunner,\n defaultReloadStrategy,\n MultiExtensionRunner as DefaultMultiExtensionRunner,\n} from '../extension-runners/index.js';\n\nconst log = createLogger(import.meta.url);\n\n// Run command types and implementation.\n\nexport default async function run(\n {\n artifactsDir,\n browserConsole = false,\n devtools = false,\n pref,\n firefox,\n firefoxProfile,\n profileCreateIfMissing,\n keepProfileChanges = false,\n ignoreFiles,\n noInput = false,\n noReload = false,\n preInstall = false,\n sourceDir,\n verbose = false,\n watchFile,\n watchIgnored,\n startUrl,\n target,\n args,\n // Android CLI options.\n adbBin,\n adbHost,\n adbPort,\n adbDevice,\n adbDiscoveryTimeout,\n adbRemoveOldArtifacts,\n firefoxApk,\n firefoxApkComponent,\n // Chromium CLI options.\n chromiumBinary,\n chromiumProfile,\n },\n {\n buildExtension = defaultBuildExtension,\n desktopNotifications = defaultDesktopNotifications,\n firefoxApp = defaultFirefoxApp,\n firefoxClient = defaultFirefoxClient,\n reloadStrategy = defaultReloadStrategy,\n MultiExtensionRunner = DefaultMultiExtensionRunner,\n getValidatedManifest = defaultGetValidatedManifest,\n } = {},\n) {\n sourceDir = path.resolve(sourceDir);\n log.info(`Running web extension from ${sourceDir}`);\n if (preInstall) {\n log.info(\n \"Disabled auto-reloading because it's not possible with \" +\n '--pre-install',\n );\n noReload = true;\n }\n\n if (\n watchFile != null &&\n (!Array.isArray(watchFile) ||\n !watchFile.every((el) => typeof el === 'string'))\n ) {\n throw new UsageError('Unexpected watchFile type');\n }\n\n // Create an alias for --pref since it has been transformed into an\n // object containing one or more preferences.\n const customPrefs = pref;\n const manifestData = await getValidatedManifest(sourceDir);\n\n const profileDir = firefoxProfile || chromiumProfile;\n\n if (profileCreateIfMissing) {\n if (!profileDir) {\n throw new UsageError(\n '--profile-create-if-missing requires ' +\n '--firefox-profile or --chromium-profile',\n );\n }\n const isDir = nodeFs.existsSync(profileDir);\n if (isDir) {\n log.info(`Profile directory ${profileDir} already exists`);\n } else {\n log.info(`Profile directory not found. Creating directory ${profileDir}`);\n await fs.mkdir(profileDir);\n }\n }\n\n const runners = [];\n\n const commonRunnerParams = {\n // Common options.\n extensions: [{ sourceDir, manifestData }],\n keepProfileChanges,\n startUrl,\n args,\n desktopNotifications,\n };\n\n if (!target || target.length === 0 || target.includes('firefox-desktop')) {\n const firefoxDesktopRunnerParams = {\n ...commonRunnerParams,\n\n // Firefox specific CLI options.\n firefoxBinary: firefox,\n profilePath: firefoxProfile,\n customPrefs,\n browserConsole,\n devtools,\n preInstall,\n\n // Firefox runner injected dependencies.\n firefoxApp,\n firefoxClient,\n };\n\n const firefoxDesktopRunner = await createExtensionRunner({\n target: 'firefox-desktop',\n params: firefoxDesktopRunnerParams,\n });\n runners.push(firefoxDesktopRunner);\n }\n\n if (target && target.includes('firefox-android')) {\n const firefoxAndroidRunnerParams = {\n ...commonRunnerParams,\n\n // Firefox specific CLI options.\n profilePath: firefoxProfile,\n customPrefs,\n browserConsole,\n preInstall,\n firefoxApk,\n firefoxApkComponent,\n adbDevice,\n adbHost,\n adbPort,\n adbBin,\n adbDiscoveryTimeout,\n adbRemoveOldArtifacts,\n\n // Injected dependencies.\n firefoxApp,\n firefoxClient,\n desktopNotifications: defaultDesktopNotifications,\n buildSourceDir: (extensionSourceDir, tmpArtifactsDir) => {\n return buildExtension(\n {\n sourceDir: extensionSourceDir,\n ignoreFiles,\n asNeeded: false,\n // Use a separate temporary directory for building the extension zip file\n // that we are going to upload on the android device.\n artifactsDir: tmpArtifactsDir,\n },\n {\n // Suppress the message usually logged by web-ext build.\n showReadyMessage: false,\n },\n );\n },\n };\n\n const firefoxAndroidRunner = await createExtensionRunner({\n target: 'firefox-android',\n params: firefoxAndroidRunnerParams,\n });\n runners.push(firefoxAndroidRunner);\n }\n\n if (target && target.includes('chromium')) {\n const chromiumRunnerParams = {\n ...commonRunnerParams,\n verbose,\n chromiumBinary,\n chromiumProfile,\n };\n\n const chromiumRunner = await createExtensionRunner({\n target: 'chromium',\n params: chromiumRunnerParams,\n });\n runners.push(chromiumRunner);\n }\n\n const extensionRunner = new MultiExtensionRunner({\n desktopNotifications,\n runners,\n });\n\n await extensionRunner.run();\n\n if (noReload) {\n log.info('Automatic extension reloading has been disabled');\n } else {\n log.info('The extension will reload if any source file changes');\n\n reloadStrategy({\n extensionRunner,\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n noInput,\n });\n }\n\n return extensionRunner;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,aAAa;AAC5B,OAAOC,MAAM,MAAM,IAAI;AAEvB,OAAOC,qBAAqB,MAAM,YAAY;AAC9C,SAASC,uBAAuB,IAAIC,2BAA2B,QAAQ,6BAA6B;AACpG,OAAO,KAAKC,iBAAiB,MAAM,qBAAqB;AACxD,SAASC,qBAAqB,IAAIC,oBAAoB,QAAQ,sBAAsB;AACpF,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAOC,2BAA2B,MAAM,qBAAqB;AAC7D,SAASC,UAAU,QAAQ,cAAc;AACzC,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,oBAAoB,IAAIC,2BAA2B,QAC9C,+BAA+B;AAEtC,MAAMC,GAAG,GAAGP,YAAY,CAACQ,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;;AAEzC;;AAEA,eAAe,eAAeC,GAAGA,CAC/B;EACEC,YAAY;EACZC,cAAc,GAAG,KAAK;EACtBC,QAAQ,GAAG,KAAK;EAChBC,IAAI;EACJC,OAAO;EACPC,cAAc;EACdC,sBAAsB;EACtBC,kBAAkB,GAAG,KAAK;EAC1BC,WAAW;EACXC,OAAO,GAAG,KAAK;EACfC,QAAQ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vD,SAAS;MACTE,SAAS;MACTC,YAAY;MACZf,YAAY;MACZQ,WAAW;MACXC;IACF,CAAC,CAAC;EACJ;EAEA,OAAO0D,eAAe;AACxB","ignoreList":[]}
1
+ {"version":3,"file":"run.js","names":["path","fs","nodeFs","defaultBuildExtension","defaultFirefoxApp","connectWithMaxRetries","defaultFirefoxClient","createLogger","defaultGetValidatedManifest","UsageError","createExtensionRunner","defaultReloadStrategy","MultiExtensionRunner","DefaultMultiExtensionRunner","log","import","meta","url","run","artifactsDir","browserConsole","devtools","pref","firefox","firefoxProfile","profileCreateIfMissing","keepProfileChanges","ignoreFiles","noInput","noReload","preInstall","sourceDir","verbose","watchFile","watchIgnored","startUrl","target","args","adbBin","adbHost","adbPort","adbDevice","adbDiscoveryTimeout","adbRemoveOldArtifacts","firefoxApk","firefoxApkComponent","chromiumBinary","chromiumPref","chromiumProfile","buildExtension","firefoxApp","firefoxClient","reloadStrategy","getValidatedManifest","resolve","info","Array","isArray","every","el","customPrefs","customChromiumPrefs","manifestData","profileDir","isDir","existsSync","mkdir","runners","commonRunnerParams","extensions","length","includes","firefoxDesktopRunnerParams","firefoxBinary","profilePath","firefoxDesktopRunner","params","push","firefoxAndroidRunnerParams","buildSourceDir","extensionSourceDir","tmpArtifactsDir","asNeeded","showReadyMessage","firefoxAndroidRunner","chromiumRunnerParams","chromiumRunner","extensionRunner"],"sources":["../../src/cmd/run.js"],"sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\nimport nodeFs from 'fs';\n\nimport defaultBuildExtension from './build.js';\nimport * as defaultFirefoxApp from '../firefox/index.js';\nimport { connectWithMaxRetries as defaultFirefoxClient } from '../firefox/remote.js';\nimport { createLogger } from '../util/logger.js';\nimport defaultGetValidatedManifest from '../util/manifest.js';\nimport { UsageError } from '../errors.js';\nimport {\n createExtensionRunner,\n defaultReloadStrategy,\n MultiExtensionRunner as DefaultMultiExtensionRunner,\n} from '../extension-runners/index.js';\n\nconst log = createLogger(import.meta.url);\n\n// Run command types and implementation.\n\nexport default async function run(\n {\n artifactsDir,\n browserConsole = false,\n devtools = false,\n pref,\n firefox,\n firefoxProfile,\n profileCreateIfMissing,\n keepProfileChanges = false,\n ignoreFiles,\n noInput = false,\n noReload = false,\n preInstall = false,\n sourceDir,\n verbose = false,\n watchFile,\n watchIgnored,\n startUrl,\n target,\n args,\n // Android CLI options.\n adbBin,\n adbHost,\n adbPort,\n adbDevice,\n adbDiscoveryTimeout,\n adbRemoveOldArtifacts,\n firefoxApk,\n firefoxApkComponent,\n // Chromium CLI options.\n chromiumBinary,\n chromiumPref = {},\n chromiumProfile,\n },\n {\n buildExtension = defaultBuildExtension,\n firefoxApp = defaultFirefoxApp,\n firefoxClient = defaultFirefoxClient,\n reloadStrategy = defaultReloadStrategy,\n MultiExtensionRunner = DefaultMultiExtensionRunner,\n getValidatedManifest = defaultGetValidatedManifest,\n } = {},\n) {\n sourceDir = path.resolve(sourceDir);\n log.info(`Running web extension from ${sourceDir}`);\n if (preInstall) {\n log.info(\n \"Disabled auto-reloading because it's not possible with \" +\n '--pre-install',\n );\n noReload = true;\n }\n\n if (\n watchFile != null &&\n (!Array.isArray(watchFile) ||\n !watchFile.every((el) => typeof el === 'string'))\n ) {\n throw new UsageError('Unexpected watchFile type');\n }\n\n // Create an alias for --pref since it has been transformed into an\n // object containing one or more preferences.\n const customPrefs = pref;\n\n // Create an alias for --chromium-pref since it has been transformed into an\n // object containing one or more preferences.\n const customChromiumPrefs = chromiumPref;\n\n const manifestData = await getValidatedManifest(sourceDir);\n\n const profileDir = firefoxProfile || chromiumProfile;\n\n if (profileCreateIfMissing) {\n if (!profileDir) {\n throw new UsageError(\n '--profile-create-if-missing requires ' +\n '--firefox-profile or --chromium-profile',\n );\n }\n const isDir = nodeFs.existsSync(profileDir);\n if (isDir) {\n log.info(`Profile directory ${profileDir} already exists`);\n } else {\n log.info(`Profile directory not found. Creating directory ${profileDir}`);\n await fs.mkdir(profileDir);\n }\n }\n\n const runners = [];\n\n const commonRunnerParams = {\n // Common options.\n extensions: [{ sourceDir, manifestData }],\n keepProfileChanges,\n startUrl,\n args,\n };\n\n if (!target || target.length === 0 || target.includes('firefox-desktop')) {\n const firefoxDesktopRunnerParams = {\n ...commonRunnerParams,\n\n // Firefox specific CLI options.\n firefoxBinary: firefox,\n profilePath: firefoxProfile,\n customPrefs,\n browserConsole,\n devtools,\n preInstall,\n\n // Firefox runner injected dependencies.\n firefoxApp,\n firefoxClient,\n };\n\n const firefoxDesktopRunner = await createExtensionRunner({\n target: 'firefox-desktop',\n params: firefoxDesktopRunnerParams,\n });\n runners.push(firefoxDesktopRunner);\n }\n\n if (target && target.includes('firefox-android')) {\n const firefoxAndroidRunnerParams = {\n ...commonRunnerParams,\n\n // Firefox specific CLI options.\n profilePath: firefoxProfile,\n customPrefs,\n browserConsole,\n preInstall,\n firefoxApk,\n firefoxApkComponent,\n adbDevice,\n adbHost,\n adbPort,\n adbBin,\n adbDiscoveryTimeout,\n adbRemoveOldArtifacts,\n\n // Injected dependencies.\n firefoxApp,\n firefoxClient,\n buildSourceDir: (extensionSourceDir, tmpArtifactsDir) => {\n return buildExtension(\n {\n sourceDir: extensionSourceDir,\n ignoreFiles,\n asNeeded: false,\n // Use a separate temporary directory for building the extension zip file\n // that we are going to upload on the android device.\n artifactsDir: tmpArtifactsDir,\n },\n {\n // Suppress the message usually logged by web-ext build.\n showReadyMessage: false,\n },\n );\n },\n };\n\n const firefoxAndroidRunner = await createExtensionRunner({\n target: 'firefox-android',\n params: firefoxAndroidRunnerParams,\n });\n runners.push(firefoxAndroidRunner);\n }\n\n if (target && target.includes('chromium')) {\n const chromiumRunnerParams = {\n ...commonRunnerParams,\n verbose,\n chromiumBinary,\n customChromiumPrefs,\n chromiumProfile,\n };\n\n const chromiumRunner = await createExtensionRunner({\n target: 'chromium',\n params: chromiumRunnerParams,\n });\n runners.push(chromiumRunner);\n }\n\n const extensionRunner = new MultiExtensionRunner({\n runners,\n });\n\n await extensionRunner.run();\n\n if (noReload) {\n log.info('Automatic extension reloading has been disabled');\n } else {\n log.info('The extension will reload if any source file changes');\n\n reloadStrategy({\n extensionRunner,\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n noInput,\n });\n }\n\n return extensionRunner;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,aAAa;AAC5B,OAAOC,MAAM,MAAM,IAAI;AAEvB,OAAOC,qBAAqB,MAAM,YAAY;AAC9C,OAAO,KAAKC,iBAAiB,MAAM,qBAAqB;AACxD,SAASC,qBAAqB,IAAIC,oBAAoB,QAAQ,sBAAsB;AACpF,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAOC,2BAA2B,MAAM,qBAAqB;AAC7D,SAASC,UAAU,QAAQ,cAAc;AACzC,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,oBAAoB,IAAIC,2BAA2B,QAC9C,+BAA+B;AAEtC,MAAMC,GAAG,GAAGP,YAAY,CAACQ,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;;AAEzC;;AAEA,eAAe,eAAeC,GAAGA,CAC/B;EACEC,YAAY;EACZC,cAAc,GAAG,KAAK;EACtBC,QAAQ,GAAG,KAAK;EAChBC,IAAI;EACJC,OAAO;EACPC,cAAc;EACdC,sBAAsB;EACtBC,kBAAkB,GAAG,KAAK;EAC1BC,WAAW;EACXC,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAG,KAAK;EAClBC,SAAS;EACTC,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,YAAY;EACZC,QAAQ;EACRC,MAAM;EACNC,IAAI;EACJ;EACAC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,qBAAqB;EACrBC,UAAU;EACVC,mBAAmB;EACnB;EACAC,cAAc;EACdC,YAAY,GAAG,CAAC,CAAC;EACjBC;AACF,CAAC,EACD;EACEC,cAAc,GA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Y,EAAE8D;QAChB,CAAC,EACD;UACE;UACAE,gBAAgB,EAAE;QACpB,CACF,CAAC;MACH;IACF,CAAC;IAED,MAAMC,oBAAoB,GAAG,MAAM1E,qBAAqB,CAAC;MACvD0B,MAAM,EAAE,iBAAiB;MACzBwC,MAAM,EAAEE;IACV,CAAC,CAAC;IACFX,OAAO,CAACU,IAAI,CAACO,oBAAoB,CAAC;EACpC;EAEA,IAAIhD,MAAM,IAAIA,MAAM,CAACmC,QAAQ,CAAC,UAAU,CAAC,EAAE;IACzC,MAAMc,oBAAoB,GAAG;MAC3B,GAAGjB,kBAAkB;MACrBpC,OAAO;MACPc,cAAc;MACde,mBAAmB;MACnBb;IACF,CAAC;IAED,MAAMsC,cAAc,GAAG,MAAM5E,qBAAqB,CAAC;MACjD0B,MAAM,EAAE,UAAU;MAClBwC,MAAM,EAAES;IACV,CAAC,CAAC;IACFlB,OAAO,CAACU,IAAI,CAACS,cAAc,CAAC;EAC9B;EAEA,MAAMC,eAAe,GAAG,IAAI3E,oBAAoB,CAAC;IAC/CuD;EACF,CAAC,CAAC;EAEF,MAAMoB,eAAe,CAACrE,GAAG,CAAC,CAAC;EAE3B,IAAIW,QAAQ,EAAE;IACZf,GAAG,CAACyC,IAAI,CAAC,iDAAiD,CAAC;EAC7D,CAAC,MAAM;IACLzC,GAAG,CAACyC,IAAI,CAAC,sDAAsD,CAAC;IAEhEH,cAAc,CAAC;MACbmC,eAAe;MACfxD,SAAS;MACTE,SAAS;MACTC,YAAY;MACZf,YAAY;MACZQ,WAAW;MACXC;IACF,CAAC,CAAC;EACJ;EAEA,OAAO2D,eAAe;AACxB","ignoreList":[]}
@@ -19,9 +19,13 @@ import { createLogger } from '../util/logger.js';
19
19
  import { TempDir } from '../util/temp-dir.js';
20
20
  import isDirectory from '../util/is-directory.js';
21
21
  import fileExists from '../util/file-exists.js';
22
+ import expandPrefs from '../util/expand-prefs.js';
22
23
  const log = createLogger(import.meta.url);
23
24
  const EXCLUDED_CHROME_FLAGS = ['--disable-extensions', '--mute-audio', '--disable-component-update'];
24
25
  export const DEFAULT_CHROME_FLAGS = ChromeLauncher.defaultFlags().filter(flag => !EXCLUDED_CHROME_FLAGS.includes(flag));
26
+ const DEFAULT_PREFS = {
27
+ 'extensions.ui.developer_mode': true
28
+ };
25
29
 
26
30
  // This is a client for the Chrome Devtools protocol. The methods and results
27
31
  // are documented at https://chromedevtools.github.io/devtools-protocol/tot/
@@ -314,7 +318,8 @@ export class ChromiumExtensionRunner {
314
318
  userDataDir,
315
319
  logLevel: this.params.verbose ? 'verbose' : 'silent',
316
320
  // Ignore default flags to keep the extension enabled.
317
- ignoreDefaultFlags: true
321
+ ignoreDefaultFlags: true,
322
+ prefs: this.getPrefs()
318
323
  });
319
324
  this.cdp = new ChromeDevtoolsProtocolClient(this.chromiumInstance);
320
325
  const initialChromiumInstance = this.chromiumInstance;
@@ -576,5 +581,16 @@ export class ChromiumExtensionRunner {
576
581
  }
577
582
  }
578
583
  }
584
+
585
+ /**
586
+ * Returns a deep preferences object based on a set of flat preferences, like
587
+ * "extensions.ui.developer_mode".
588
+ */
589
+ getPrefs() {
590
+ return expandPrefs({
591
+ ...DEFAULT_PREFS,
592
+ ...this.params.customChromiumPrefs
593
+ });
594
+ }
579
595
  }
580
596
  //# sourceMappingURL=chromium.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chromium.js","names":["fs","path","Launcher","ChromeLauncher","launch","defaultChromiumLaunch","createLogger","TempDir","isDirectory","fileExists","log","import","meta","url","EXCLUDED_CHROME_FLAGS","DEFAULT_CHROME_FLAGS","defaultFlags","filter","flag","includes","_receivedData","WeakMap","_isProcessingMessage","_lastId","_deferredResponses","_disconnected","_disconnectedPromise","_resolveDisconnectedPromise","_ChromeDevtoolsProtocolClient_brand","WeakSet","ChromeDevtoolsProtocolClient","constructor","chromiumInstance","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","Map","_defineProperty","process","env","TEST_LOG_VERBOSE_CDP","incoming","outgoing","remoteDebuggingPipes","_classPrivateFieldSet","Promise","resolve","closed","warn","_assertClassBrand","_finalizeDisconnect","call","on","data","_classPrivateFieldGet","_processNextMessage","error","outgoingPipe","waitUntilDisconnected","sendCommand","method","params","sessionId","undefined","_this$lastId","Error","message","id","rawMessage","JSON","stringify","stderr","write","reject","set","end","indexOf","slice","result","parse","deferredResponse","get","delete","err","e","values","clear","ChromiumExtensionRunner","cleanupCallbacks","chromiumLaunch","forceUseDeprecatedLoadExtension","exiting","_promiseSetupDone","Set","getName","run","setupInstance","isUserDataDir","dirPath","localStatePath","join","defaultPath","isProfileDir","securePreferencesPath","getProfilePaths","chromiumProfile","userDataDir","profileDirName","isProfileDirAndNotUserData","dir","base","extensions","map","sourceDir","chromiumBinary","debug","chromeFlags","push","args","some","test","keepProfileChanges","tmpDir","create","tmpDirPath","cp","recursive","startingUrl","startUrl","startingUrls","Array","isArray","shift","chromePath","logLevel","verbose","ignoreDefaultFlags","cdp","initialChromiumInstance","once","info","exit","cdpSupportsExtensionsLoadUnpacked","kill","reloadAllExtensions","runnerName","reloadAllExtensionsFallbackForChrome125andEarlier","stdout","Date","toTimeString","targetInfos","targets","type","t","startsWith","targetId","hasExistingTarget","length","newWindow","background","windowState","codeToEvaluateInChrome","developerPrivate","chrome","getExtensionsInfo","extensionIds","extension","location","reloadPromises","extensionId","reload","failQuietly","populateErrorForUnpacked","loadError","all","targetResult","flatten","i","_evalResult$result","evalResult","expression","awaitPromise","evalResultReturnValue","value","r","setTimeout","exceptionDetails","text","reloadExtensionBySourceDir","extensionSourceDir","registerCleanup","fn","add","catch"],"sources":["../../src/extension-runners/chromium.js"],"sourcesContent":["/**\n * This module provide an ExtensionRunner subclass that manage an extension executed\n * in a Chromium-based browser instance.\n */\n\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport {\n Launcher as ChromeLauncher,\n launch as defaultChromiumLaunch,\n} from 'chrome-launcher';\n\nimport { createLogger } from '../util/logger.js';\nimport { TempDir } from '../util/temp-dir.js';\nimport isDirectory from '../util/is-directory.js';\nimport fileExists from '../util/file-exists.js';\n\nconst log = createLogger(import.meta.url);\n\nconst EXCLUDED_CHROME_FLAGS = [\n '--disable-extensions',\n '--mute-audio',\n '--disable-component-update',\n];\n\nexport const DEFAULT_CHROME_FLAGS = ChromeLauncher.defaultFlags().filter(\n (flag) => !EXCLUDED_CHROME_FLAGS.includes(flag),\n);\n\n// This is a client for the Chrome Devtools protocol. The methods and results\n// are documented at https://chromedevtools.github.io/devtools-protocol/tot/\nclass ChromeDevtoolsProtocolClient {\n #receivedData = '';\n #isProcessingMessage = false;\n #lastId = 0;\n #deferredResponses = new Map();\n #disconnected = false;\n #disconnectedPromise;\n #resolveDisconnectedPromise;\n\n // Print all exchanged CDP messages to ease debugging.\n TEST_LOG_VERBOSE_CDP = process.env.TEST_LOG_VERBOSE_CDP;\n\n constructor(chromiumInstance) {\n // remoteDebuggingPipes is from chrome-launcher, see\n // https://github.com/GoogleChrome/chrome-launcher/pull/347\n const { incoming, outgoing } = chromiumInstance.remoteDebuggingPipes;\n this.#disconnectedPromise = new Promise((resolve) => {\n this.#resolveDisconnectedPromise = resolve;\n });\n if (incoming.closed) {\n // Strange. Did Chrome fail to start, or exit on startup?\n log.warn('CDP already disconnected at initialization');\n this.#finalizeDisconnect();\n return;\n }\n incoming.on('data', (data) => {\n this.#receivedData += data;\n this.#processNextMessage();\n });\n incoming.on('error', (error) => {\n log.error(error);\n this.#finalizeDisconnect();\n });\n incoming.on('close', () => this.#finalizeDisconnect());\n this.outgoingPipe = outgoing;\n }\n\n waitUntilDisconnected() {\n return this.#disconnectedPromise;\n }\n\n async sendCommand(method, params, sessionId = undefined) {\n if (this.#disconnected) {\n throw new Error(`CDP disconnected, cannot send: command ${method}`);\n }\n const message = {\n id: ++this.#lastId,\n method,\n params,\n sessionId,\n };\n const rawMessage = `${JSON.stringify(message)}\\x00`;\n if (this.TEST_LOG_VERBOSE_CDP) {\n process.stderr.write(`[CDP] [SEND] ${rawMessage}\\n`);\n }\n return new Promise((resolve, reject) => {\n // CDP will always send a response.\n this.#deferredResponses.set(message.id, { method, resolve, reject });\n this.outgoingPipe.write(rawMessage);\n });\n }\n\n #processNextMessage() {\n if (this.#isProcessingMessage) {\n return;\n }\n this.#isProcessingMessage = true;\n let end = this.#receivedData.indexOf('\\x00');\n while (end !== -1) {\n const rawMessage = this.#receivedData.slice(0, end);\n this.#receivedData = this.#receivedData.slice(end + 1); // +1 skips \\x00.\n try {\n if (this.TEST_LOG_VERBOSE_CDP) {\n process.stderr.write(`[CDP] [RECV] ${rawMessage}\\n`);\n }\n const { id, error, result } = JSON.parse(rawMessage);\n const deferredResponse = this.#deferredResponses.get(id);\n if (deferredResponse) {\n this.#deferredResponses.delete(id);\n if (error) {\n const err = new Error(error.message || 'Unexpected CDP response');\n deferredResponse.reject(err);\n } else {\n deferredResponse.resolve(result);\n }\n } else {\n // Dropping events and non-response messages since we don't need it.\n }\n } catch (e) {\n log.error(e);\n }\n end = this.#receivedData.indexOf('\\x00');\n }\n this.#isProcessingMessage = false;\n if (this.#disconnected) {\n for (const { method, reject } of this.#deferredResponses.values()) {\n reject(new Error(`CDP connection closed before response to ${method}`));\n }\n this.#deferredResponses.clear();\n this.#resolveDisconnectedPromise();\n }\n }\n\n #finalizeDisconnect() {\n if (!this.#disconnected) {\n this.#disconnected = true;\n this.#processNextMessage();\n }\n }\n}\n\n/**\n * Implements an IExtensionRunner which manages a Chromium instance.\n */\nexport class ChromiumExtensionRunner {\n cleanupCallbacks;\n params;\n chromiumInstance;\n chromiumLaunch;\n // --load-extension is deprecated, but only supported in Chrome 126+, see:\n // https://github.com/mozilla/web-ext/issues/3388#issuecomment-2906982117\n forceUseDeprecatedLoadExtension;\n exiting;\n _promiseSetupDone;\n\n constructor(params) {\n const { chromiumLaunch = defaultChromiumLaunch } = params;\n this.params = params;\n this.chromiumLaunch = chromiumLaunch;\n // We will try to use Extensions.loadUnpacked first (Chrome 126+), and if\n // that does not work fall back to --load-extension.\n this.forceUseDeprecatedLoadExtension = false;\n this.cleanupCallbacks = new Set();\n }\n\n // Method exported from the IExtensionRunner interface.\n\n /**\n * Returns the runner name.\n */\n getName() {\n return 'Chromium';\n }\n\n async run() {\n // Run should never be called more than once.\n this._promiseSetupDone = this.setupInstance();\n await this._promiseSetupDone;\n }\n\n static async isUserDataDir(dirPath) {\n const localStatePath = path.join(dirPath, 'Local State');\n const defaultPath = path.join(dirPath, 'Default');\n // Local State and Default are typical for the user-data-dir\n return (\n (await fileExists(localStatePath)) && (await isDirectory(defaultPath))\n );\n }\n\n static async isProfileDir(dirPath) {\n const securePreferencesPath = path.join(dirPath, 'Secure Preferences');\n //Secure Preferences is typical for a profile dir inside a user data dir\n return await fileExists(securePreferencesPath);\n }\n\n static async getProfilePaths(chromiumProfile) {\n if (!chromiumProfile) {\n return {\n userDataDir: null,\n profileDirName: null,\n };\n }\n\n const isProfileDirAndNotUserData =\n (await ChromiumExtensionRunner.isProfileDir(chromiumProfile)) &&\n !(await ChromiumExtensionRunner.isUserDataDir(chromiumProfile));\n\n if (isProfileDirAndNotUserData) {\n const { dir: userDataDir, base: profileDirName } =\n path.parse(chromiumProfile);\n return {\n userDataDir,\n profileDirName,\n };\n }\n\n return {\n userDataDir: chromiumProfile,\n profileDirName: null,\n };\n }\n\n /**\n * Setup the Chromium Profile and run a Chromium instance.\n */\n async setupInstance() {\n // NOTE: This function may be called twice, if the user is using an old\n // Chrome version (before Chrome 126), because then we have to add a\n // command-line flag (--load-extension) to load the extension. For details,\n // see:\n // https://github.com/mozilla/web-ext/issues/3388#issuecomment-2906982117\n\n // Start chrome pointing it to a given profile dir\n const extensions = this.params.extensions.map(({ sourceDir }) => sourceDir);\n\n const { chromiumBinary } = this.params;\n\n log.debug('Starting Chromium instance...');\n\n if (chromiumBinary) {\n log.debug(`(chromiumBinary: ${chromiumBinary})`);\n }\n\n const chromeFlags = [...DEFAULT_CHROME_FLAGS];\n chromeFlags.push('--remote-debugging-pipe');\n\n if (!this.forceUseDeprecatedLoadExtension) {\n chromeFlags.push('--enable-unsafe-extension-debugging');\n } else {\n chromeFlags.push(`--load-extension=${extensions.join(',')}`);\n }\n\n if (this.params.args) {\n chromeFlags.push(...this.params.args);\n }\n\n // `--remote-debugging-pipe` results in `navigator.webdriver == true` in\n // the launched Chromium instance (unless a Chromium session exists\n // already, in which case the existing session is used, which typically\n // has `navigator.webdriver == false`). This breaks websites with bot\n // detection features. The following flag prevents this.\n // Only pass this flag if `--enable-blink-features=AutomationControlled`\n // is not passed.\n if (\n !chromeFlags.some((flag) =>\n /^--enable-blink-features=(.*,)?AutomationControlled(,|$)/.test(flag),\n )\n ) {\n chromeFlags.push('--disable-blink-features=AutomationControlled');\n }\n\n // eslint-disable-next-line prefer-const\n let { userDataDir, profileDirName } =\n await ChromiumExtensionRunner.getProfilePaths(\n this.params.chromiumProfile,\n );\n\n if (userDataDir && this.params.keepProfileChanges) {\n if (\n profileDirName &&\n !(await ChromiumExtensionRunner.isUserDataDir(userDataDir))\n ) {\n throw new Error(\n 'The profile you provided is not in a ' +\n 'user-data-dir. The changes cannot be kept. Please either ' +\n 'remove --keep-profile-changes or use a profile in a ' +\n 'user-data-dir directory',\n );\n }\n } else if (!this.params.keepProfileChanges) {\n // the user provided an existing profile directory but doesn't want\n // the changes to be kept. we copy this directory to a temporary\n // user data dir.\n const tmpDir = new TempDir();\n await tmpDir.create();\n const tmpDirPath = tmpDir.path();\n\n if (userDataDir && profileDirName) {\n // copy profile dir to this temp user data dir.\n await fs.cp(\n path.join(userDataDir, profileDirName),\n path.join(tmpDirPath, profileDirName),\n { recursive: true },\n );\n } else if (userDataDir) {\n await fs.cp(userDataDir, tmpDirPath, { recursive: true });\n }\n userDataDir = tmpDirPath;\n }\n\n if (profileDirName) {\n chromeFlags.push(`--profile-directory=${profileDirName}`);\n }\n\n let startingUrl;\n if (this.params.startUrl) {\n const startingUrls = Array.isArray(this.params.startUrl)\n ? this.params.startUrl\n : [this.params.startUrl];\n startingUrl = startingUrls.shift();\n chromeFlags.push(...startingUrls);\n }\n\n this.chromiumInstance = await this.chromiumLaunch({\n chromePath: chromiumBinary,\n chromeFlags,\n startingUrl,\n userDataDir,\n logLevel: this.params.verbose ? 'verbose' : 'silent',\n // Ignore default flags to keep the extension enabled.\n ignoreDefaultFlags: true,\n });\n this.cdp = new ChromeDevtoolsProtocolClient(this.chromiumInstance);\n\n const initialChromiumInstance = this.chromiumInstance;\n this.chromiumInstance.process.once('close', () => {\n if (this.chromiumInstance !== initialChromiumInstance) {\n // This happens when we restart Chrome to fall back to --load-extension.\n return;\n }\n this.chromiumInstance = null;\n\n if (!this.exiting) {\n log.info('Exiting on Chromium instance disconnected.');\n this.exit();\n }\n });\n\n if (!this.forceUseDeprecatedLoadExtension) {\n // Assume that the required Extensions.loadUnpacked CDP method is\n // supported. If it is not, we will fall back to --load-extension.\n let cdpSupportsExtensionsLoadUnpacked = true;\n for (const sourceDir of extensions) {\n try {\n await this.cdp.sendCommand('Extensions.loadUnpacked', {\n path: sourceDir,\n });\n } catch (e) {\n // Chrome 125- will emit the following message:\n if (e.message === \"'Extensions.loadUnpacked' wasn't found\") {\n cdpSupportsExtensionsLoadUnpacked = false;\n break;\n }\n log.error(`Failed to load extension at ${sourceDir}: ${e.message}`);\n // We do not have to throw - the extension can work again when\n // auto-reload is used. But users may like a hard fail, and this is\n // consistent with the firefox runner.\n throw e;\n }\n }\n if (!cdpSupportsExtensionsLoadUnpacked) {\n // Retry once, now with --load-extension.\n log.warn('Cannot load extension via CDP, falling back to old method');\n this.forceUseDeprecatedLoadExtension = true;\n this.chromiumInstance = null;\n await initialChromiumInstance.kill();\n await this.cdp.waitUntilDisconnected();\n this.cdp = null;\n return this.setupInstance();\n }\n }\n }\n\n /**\n * Reloads all the extensions, collect any reload error and resolves to\n * an array composed by a single ExtensionRunnerReloadResult object.\n */\n async reloadAllExtensions() {\n const runnerName = this.getName();\n\n if (this.forceUseDeprecatedLoadExtension) {\n this.reloadAllExtensionsFallbackForChrome125andEarlier();\n } else {\n for (const { sourceDir } of this.params.extensions) {\n try {\n await this.cdp.sendCommand('Extensions.loadUnpacked', {\n path: sourceDir,\n });\n } catch (e) {\n log.error(`Failed to load extension at ${sourceDir}: ${e.message}`);\n }\n }\n }\n\n process.stdout.write(\n `\\rLast extension reload: ${new Date().toTimeString()}`,\n );\n log.debug('\\n');\n\n return [{ runnerName }];\n }\n\n async reloadAllExtensionsFallbackForChrome125andEarlier() {\n // Ideally, we'd like to use the \"Extensions.loadUnpacked\" CDP command to\n // reload an extension, but that is unsupported in Chrome 125 and earlier.\n //\n // As a fallback, connect to chrome://extensions/ and reload from there.\n // Since we are targeting old Chrome versions, we can safely use the\n // chrome.developerPrivate APIs, because these are never going to change\n // for the old browser versions. Do NOT use this for newer versions!\n //\n // Target.* CDP methods documented at: https://chromedevtools.github.io/devtools-protocol/tot/Target/\n // developerPrivate documented at:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl\n //\n // Specific revision that exposed developerPrivate to chrome://extensions/:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n // https://chromium.googlesource.com/chromium/src.git/+/69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n //\n // Specific revision that introduced developerPrivate.getExtensionsInfo:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n //\n // The above changes are from 2015; The --remote-debugging-pipe feature\n // that we rely on for CDP was added in 2018; this is the version of the\n // developerPrivate API at that time:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=c9ae59c8f37d487f1f01c222deb6b7d1f51c99c2\n\n // Find an existing chrome://extensions/ tab, if it exists.\n let { targetInfos: targets } = await this.cdp.sendCommand(\n 'Target.getTargets',\n { filter: [{ type: 'tab' }] },\n );\n targets = targets.filter((t) => t.url.startsWith('chrome://extensions/'));\n let targetId;\n const hasExistingTarget = targets.length > 0;\n if (hasExistingTarget) {\n targetId = targets[0].targetId;\n } else {\n const result = await this.cdp.sendCommand('Target.createTarget', {\n url: 'chrome://extensions/',\n newWindow: true,\n background: true,\n windowState: 'minimized',\n });\n targetId = result.targetId;\n }\n const codeToEvaluateInChrome = async () => {\n // This function is serialized and executed in Chrome. Designed for\n // compatibility with Chrome 69 - 125. Do not use JS syntax of functions\n // that are not supported in these versions!\n\n // eslint-disable-next-line no-undef\n const developerPrivate = chrome.developerPrivate;\n if (!developerPrivate || !developerPrivate.getExtensionsInfo) {\n // When chrome://extensions/ is still loading, its document URL may be\n // about:blank and the chrome.developerPrivate API is not exposed.\n return 'NOT_READY_PLEASE_RETRY';\n }\n const extensionIds = [];\n await new Promise((resolve) => {\n developerPrivate.getExtensionsInfo((extensions) => {\n for (const extension of extensions || []) {\n if (extension.location === 'UNPACKED') {\n // We only care about those loaded via --load-extension.\n extensionIds.push(extension.id);\n }\n }\n resolve();\n });\n });\n const reloadPromises = extensionIds.map((extensionId) => {\n return new Promise((resolve, reject) => {\n developerPrivate.reload(\n extensionId,\n // Suppress alert dialog when load fails.\n { failQuietly: true, populateErrorForUnpacked: true },\n (loadError) => {\n if (loadError) {\n reject(new Error(loadError.error));\n } else {\n resolve();\n }\n },\n );\n });\n });\n await Promise.all(reloadPromises);\n return reloadPromises.length;\n };\n try {\n const targetResult = await this.cdp.sendCommand('Target.attachToTarget', {\n targetId,\n flatten: true,\n });\n if (!targetResult.sessionId) {\n throw new Error('Unexpectedly, no sessionId from attachToTarget');\n }\n // In practice, we're going to run the logic only once. But if we are\n // unlucky, chrome://extensions is still loading, so we will then retry.\n for (let i = 0; i < 3; ++i) {\n const evalResult = await this.cdp.sendCommand(\n 'Runtime.evaluate',\n {\n expression: `(${codeToEvaluateInChrome})();`,\n awaitPromise: true,\n },\n targetResult.sessionId,\n );\n const evalResultReturnValue = evalResult.result?.value;\n if (evalResultReturnValue === 'NOT_READY_PLEASE_RETRY') {\n await new Promise((r) => setTimeout(r, 200 * i));\n continue;\n }\n if (evalResult.exceptionDetails) {\n log.error(`Failed to reload: ${evalResult.exceptionDetails.text}`);\n }\n if (evalResultReturnValue !== this.params.extensions.length) {\n log.warn(`Failed to reload extensions: ${evalResultReturnValue}`);\n }\n break;\n }\n } finally {\n if (!hasExistingTarget && targetId) {\n try {\n await this.cdp.sendCommand('Target.closeTarget', { targetId });\n } catch (e) {\n log.error(e);\n }\n }\n }\n }\n\n /**\n * Reloads a single extension, collect any reload error and resolves to\n * an array composed by a single ExtensionRunnerReloadResult object.\n */\n async reloadExtensionBySourceDir(\n extensionSourceDir, // eslint-disable-line no-unused-vars\n ) {\n // TODO(rpl): detect the extension ids assigned to the\n // target extensions and map it to the extensions source dir\n // (https://github.com/mozilla/web-ext/issues/1687).\n return this.reloadAllExtensions();\n }\n\n /**\n * Register a callback to be called when the runner has been exited\n * (e.g. the Chromium instance exits or the user has requested web-ext\n * to exit).\n */\n registerCleanup(fn) {\n this.cleanupCallbacks.add(fn);\n }\n\n /**\n * Exits the runner, by closing the managed Chromium instance.\n */\n async exit() {\n this.exiting = true;\n\n // Wait for the setup to complete if the extension runner is already\n // being started.\n if (this._promiseSetupDone) {\n // Ignore initialization errors if any.\n await this._promiseSetupDone.catch((err) => {\n log.debug(`ignored setup error on chromium runner shutdown: ${err}`);\n });\n }\n\n if (this.chromiumInstance) {\n await this.chromiumInstance.kill();\n this.chromiumInstance = null;\n }\n\n if (this.cdp) {\n await this.cdp.waitUntilDisconnected();\n this.cdp = null;\n }\n\n // Call all the registered cleanup callbacks.\n for (const fn of this.cleanupCallbacks) {\n try {\n fn();\n } catch (error) {\n log.error(error);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,aAAa;AAC5B,OAAOC,IAAI,MAAM,MAAM;AAEvB,SACEC,QAAQ,IAAIC,cAAc,EAC1BC,MAAM,IA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CAAClD,OAAO,GAAG,IAAI;;IAEnB;IACA;IACA,IAAI,IAAI,CAACC,iBAAiB,EAAE;MAC1B;MACA,MAAM,IAAI,CAACA,iBAAiB,CAACqG,KAAK,CAAE9G,GAAG,IAAK;QAC1CxE,GAAG,CAACwG,KAAK,CAAC,oDAAoDhC,GAAG,EAAE,CAAC;MACtE,CAAC,CAAC;IACJ;IAEA,IAAI,IAAI,CAAClD,gBAAgB,EAAE;MACzB,MAAM,IAAI,CAACA,gBAAgB,CAAC8G,IAAI,CAAC,CAAC;MAClC,IAAI,CAAC9G,gBAAgB,GAAG,IAAI;IAC9B;IAEA,IAAI,IAAI,CAACwG,GAAG,EAAE;MACZ,MAAM,IAAI,CAACA,GAAG,CAAC/E,qBAAqB,CAAC,CAAC;MACtC,IAAI,CAAC+E,GAAG,GAAG,IAAI;IACjB;;IAEA;IACA,KAAK,MAAMsD,EAAE,IAAI,IAAI,CAACvG,gBAAgB,EAAE;MACtC,IAAI;QACFuG,EAAE,CAAC,CAAC;MACN,CAAC,CAAC,OAAOvI,KAAK,EAAE;QACd7C,GAAG,CAAC6C,KAAK,CAACA,KAAK,CAAC;MAClB;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"chromium.js","names":["fs","path","Launcher","ChromeLauncher","launch","defaultChromiumLaunch","createLogger","TempDir","isDirectory","fileExists","expandPrefs","log","import","meta","url","EXCLUDED_CHROME_FLAGS","DEFAULT_CHROME_FLAGS","defaultFlags","filter","flag","includes","DEFAULT_PREFS","_receivedData","WeakMap","_isProcessingMessage","_lastId","_deferredResponses","_disconnected","_disconnectedPromise","_resolveDisconnectedPromise","_ChromeDevtoolsProtocolClient_brand","WeakSet","ChromeDevtoolsProtocolClient","constructor","chromiumInstance","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","Map","_defineProperty","process","env","TEST_LOG_VERBOSE_CDP","incoming","outgoing","remoteDebuggingPipes","_classPrivateFieldSet","Promise","resolve","closed","warn","_assertClassBrand","_finalizeDisconnect","call","on","data","_classPrivateFieldGet","_processNextMessage","error","outgoingPipe","waitUntilDisconnected","sendCommand","method","params","sessionId","undefined","_this$lastId","Error","message","id","rawMessage","JSON","stringify","stderr","write","reject","set","end","indexOf","slice","result","parse","deferredResponse","get","delete","err","e","values","clear","ChromiumExtensionRunner","cleanupCallbacks","chromiumLaunch","forceUseDeprecatedLoadExtension","exiting","_promiseSetupDone","Set","getName","run","setupInstance","isUserDataDir","dirPath","localStatePath","join","defaultPath","isProfileDir","securePreferencesPath","getProfilePaths","chromiumProfile","userDataDir","profileDirName","isProfileDirAndNotUserData","dir","base","extensions","map","sourceDir","chromiumBinary","debug","chromeFlags","push","args","some","test","keepProfileChanges","tmpDir","create","tmpDirPath","cp","recursive","startingUrl","startUrl","startingUrls","Array","isArray","shift","chromePath","logLevel","verbose","ignoreDefaultFlags","prefs","getPrefs","cdp","initialChromiumInstance","once","info","exit","cdpSupportsExtensionsLoadUnpacked","kill","reloadAllExtensions","runnerName","reloadAllExtensionsFallbackForChrome125andEarlier","stdout","Date","toTimeString","targetInfos","targets","type","t","startsWith","targetId","hasExistingTarget","length","newWindow","background","windowState","codeToEvaluateInChrome","developerPrivate","chrome","getExtensionsInfo","extensionIds","extension","location","reloadPromises","extensionId","reload","failQuietly","populateErrorForUnpacked","loadError","all","targetResult","flatten","i","_evalResult$result","evalResult","expression","awaitPromise","evalResultReturnValue","value","r","setTimeout","exceptionDetails","text","reloadExtensionBySourceDir","extensionSourceDir","registerCleanup","fn","add","catch","customChromiumPrefs"],"sources":["../../src/extension-runners/chromium.js"],"sourcesContent":["/**\n * This module provide an ExtensionRunner subclass that manage an extension executed\n * in a Chromium-based browser instance.\n */\n\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport {\n Launcher as ChromeLauncher,\n launch as defaultChromiumLaunch,\n} from 'chrome-launcher';\n\nimport { createLogger } from '../util/logger.js';\nimport { TempDir } from '../util/temp-dir.js';\nimport isDirectory from '../util/is-directory.js';\nimport fileExists from '../util/file-exists.js';\nimport expandPrefs from '../util/expand-prefs.js';\n\nconst log = createLogger(import.meta.url);\n\nconst EXCLUDED_CHROME_FLAGS = [\n '--disable-extensions',\n '--mute-audio',\n '--disable-component-update',\n];\n\nexport const DEFAULT_CHROME_FLAGS = ChromeLauncher.defaultFlags().filter(\n (flag) => !EXCLUDED_CHROME_FLAGS.includes(flag),\n);\n\nconst DEFAULT_PREFS = { 'extensions.ui.developer_mode': true };\n\n// This is a client for the Chrome Devtools protocol. The methods and results\n// are documented at https://chromedevtools.github.io/devtools-protocol/tot/\nclass ChromeDevtoolsProtocolClient {\n #receivedData = '';\n #isProcessingMessage = false;\n #lastId = 0;\n #deferredResponses = new Map();\n #disconnected = false;\n #disconnectedPromise;\n #resolveDisconnectedPromise;\n\n // Print all exchanged CDP messages to ease debugging.\n TEST_LOG_VERBOSE_CDP = process.env.TEST_LOG_VERBOSE_CDP;\n\n constructor(chromiumInstance) {\n // remoteDebuggingPipes is from chrome-launcher, see\n // https://github.com/GoogleChrome/chrome-launcher/pull/347\n const { incoming, outgoing } = chromiumInstance.remoteDebuggingPipes;\n this.#disconnectedPromise = new Promise((resolve) => {\n this.#resolveDisconnectedPromise = resolve;\n });\n if (incoming.closed) {\n // Strange. Did Chrome fail to start, or exit on startup?\n log.warn('CDP already disconnected at initialization');\n this.#finalizeDisconnect();\n return;\n }\n incoming.on('data', (data) => {\n this.#receivedData += data;\n this.#processNextMessage();\n });\n incoming.on('error', (error) => {\n log.error(error);\n this.#finalizeDisconnect();\n });\n incoming.on('close', () => this.#finalizeDisconnect());\n this.outgoingPipe = outgoing;\n }\n\n waitUntilDisconnected() {\n return this.#disconnectedPromise;\n }\n\n async sendCommand(method, params, sessionId = undefined) {\n if (this.#disconnected) {\n throw new Error(`CDP disconnected, cannot send: command ${method}`);\n }\n const message = {\n id: ++this.#lastId,\n method,\n params,\n sessionId,\n };\n const rawMessage = `${JSON.stringify(message)}\\x00`;\n if (this.TEST_LOG_VERBOSE_CDP) {\n process.stderr.write(`[CDP] [SEND] ${rawMessage}\\n`);\n }\n return new Promise((resolve, reject) => {\n // CDP will always send a response.\n this.#deferredResponses.set(message.id, { method, resolve, reject });\n this.outgoingPipe.write(rawMessage);\n });\n }\n\n #processNextMessage() {\n if (this.#isProcessingMessage) {\n return;\n }\n this.#isProcessingMessage = true;\n let end = this.#receivedData.indexOf('\\x00');\n while (end !== -1) {\n const rawMessage = this.#receivedData.slice(0, end);\n this.#receivedData = this.#receivedData.slice(end + 1); // +1 skips \\x00.\n try {\n if (this.TEST_LOG_VERBOSE_CDP) {\n process.stderr.write(`[CDP] [RECV] ${rawMessage}\\n`);\n }\n const { id, error, result } = JSON.parse(rawMessage);\n const deferredResponse = this.#deferredResponses.get(id);\n if (deferredResponse) {\n this.#deferredResponses.delete(id);\n if (error) {\n const err = new Error(error.message || 'Unexpected CDP response');\n deferredResponse.reject(err);\n } else {\n deferredResponse.resolve(result);\n }\n } else {\n // Dropping events and non-response messages since we don't need it.\n }\n } catch (e) {\n log.error(e);\n }\n end = this.#receivedData.indexOf('\\x00');\n }\n this.#isProcessingMessage = false;\n if (this.#disconnected) {\n for (const { method, reject } of this.#deferredResponses.values()) {\n reject(new Error(`CDP connection closed before response to ${method}`));\n }\n this.#deferredResponses.clear();\n this.#resolveDisconnectedPromise();\n }\n }\n\n #finalizeDisconnect() {\n if (!this.#disconnected) {\n this.#disconnected = true;\n this.#processNextMessage();\n }\n }\n}\n\n/**\n * Implements an IExtensionRunner which manages a Chromium instance.\n */\nexport class ChromiumExtensionRunner {\n cleanupCallbacks;\n params;\n chromiumInstance;\n chromiumLaunch;\n // --load-extension is deprecated, but only supported in Chrome 126+, see:\n // https://github.com/mozilla/web-ext/issues/3388#issuecomment-2906982117\n forceUseDeprecatedLoadExtension;\n exiting;\n _promiseSetupDone;\n\n constructor(params) {\n const { chromiumLaunch = defaultChromiumLaunch } = params;\n this.params = params;\n this.chromiumLaunch = chromiumLaunch;\n // We will try to use Extensions.loadUnpacked first (Chrome 126+), and if\n // that does not work fall back to --load-extension.\n this.forceUseDeprecatedLoadExtension = false;\n this.cleanupCallbacks = new Set();\n }\n\n // Method exported from the IExtensionRunner interface.\n\n /**\n * Returns the runner name.\n */\n getName() {\n return 'Chromium';\n }\n\n async run() {\n // Run should never be called more than once.\n this._promiseSetupDone = this.setupInstance();\n await this._promiseSetupDone;\n }\n\n static async isUserDataDir(dirPath) {\n const localStatePath = path.join(dirPath, 'Local State');\n const defaultPath = path.join(dirPath, 'Default');\n // Local State and Default are typical for the user-data-dir\n return (\n (await fileExists(localStatePath)) && (await isDirectory(defaultPath))\n );\n }\n\n static async isProfileDir(dirPath) {\n const securePreferencesPath = path.join(dirPath, 'Secure Preferences');\n //Secure Preferences is typical for a profile dir inside a user data dir\n return await fileExists(securePreferencesPath);\n }\n\n static async getProfilePaths(chromiumProfile) {\n if (!chromiumProfile) {\n return {\n userDataDir: null,\n profileDirName: null,\n };\n }\n\n const isProfileDirAndNotUserData =\n (await ChromiumExtensionRunner.isProfileDir(chromiumProfile)) &&\n !(await ChromiumExtensionRunner.isUserDataDir(chromiumProfile));\n\n if (isProfileDirAndNotUserData) {\n const { dir: userDataDir, base: profileDirName } =\n path.parse(chromiumProfile);\n return {\n userDataDir,\n profileDirName,\n };\n }\n\n return {\n userDataDir: chromiumProfile,\n profileDirName: null,\n };\n }\n\n /**\n * Setup the Chromium Profile and run a Chromium instance.\n */\n async setupInstance() {\n // NOTE: This function may be called twice, if the user is using an old\n // Chrome version (before Chrome 126), because then we have to add a\n // command-line flag (--load-extension) to load the extension. For details,\n // see:\n // https://github.com/mozilla/web-ext/issues/3388#issuecomment-2906982117\n\n // Start chrome pointing it to a given profile dir\n const extensions = this.params.extensions.map(({ sourceDir }) => sourceDir);\n\n const { chromiumBinary } = this.params;\n\n log.debug('Starting Chromium instance...');\n\n if (chromiumBinary) {\n log.debug(`(chromiumBinary: ${chromiumBinary})`);\n }\n\n const chromeFlags = [...DEFAULT_CHROME_FLAGS];\n chromeFlags.push('--remote-debugging-pipe');\n\n if (!this.forceUseDeprecatedLoadExtension) {\n chromeFlags.push('--enable-unsafe-extension-debugging');\n } else {\n chromeFlags.push(`--load-extension=${extensions.join(',')}`);\n }\n\n if (this.params.args) {\n chromeFlags.push(...this.params.args);\n }\n\n // `--remote-debugging-pipe` results in `navigator.webdriver == true` in\n // the launched Chromium instance (unless a Chromium session exists\n // already, in which case the existing session is used, which typically\n // has `navigator.webdriver == false`). This breaks websites with bot\n // detection features. The following flag prevents this.\n // Only pass this flag if `--enable-blink-features=AutomationControlled`\n // is not passed.\n if (\n !chromeFlags.some((flag) =>\n /^--enable-blink-features=(.*,)?AutomationControlled(,|$)/.test(flag),\n )\n ) {\n chromeFlags.push('--disable-blink-features=AutomationControlled');\n }\n\n // eslint-disable-next-line prefer-const\n let { userDataDir, profileDirName } =\n await ChromiumExtensionRunner.getProfilePaths(\n this.params.chromiumProfile,\n );\n\n if (userDataDir && this.params.keepProfileChanges) {\n if (\n profileDirName &&\n !(await ChromiumExtensionRunner.isUserDataDir(userDataDir))\n ) {\n throw new Error(\n 'The profile you provided is not in a ' +\n 'user-data-dir. The changes cannot be kept. Please either ' +\n 'remove --keep-profile-changes or use a profile in a ' +\n 'user-data-dir directory',\n );\n }\n } else if (!this.params.keepProfileChanges) {\n // the user provided an existing profile directory but doesn't want\n // the changes to be kept. we copy this directory to a temporary\n // user data dir.\n const tmpDir = new TempDir();\n await tmpDir.create();\n const tmpDirPath = tmpDir.path();\n\n if (userDataDir && profileDirName) {\n // copy profile dir to this temp user data dir.\n await fs.cp(\n path.join(userDataDir, profileDirName),\n path.join(tmpDirPath, profileDirName),\n { recursive: true },\n );\n } else if (userDataDir) {\n await fs.cp(userDataDir, tmpDirPath, { recursive: true });\n }\n userDataDir = tmpDirPath;\n }\n\n if (profileDirName) {\n chromeFlags.push(`--profile-directory=${profileDirName}`);\n }\n\n let startingUrl;\n if (this.params.startUrl) {\n const startingUrls = Array.isArray(this.params.startUrl)\n ? this.params.startUrl\n : [this.params.startUrl];\n startingUrl = startingUrls.shift();\n chromeFlags.push(...startingUrls);\n }\n\n this.chromiumInstance = await this.chromiumLaunch({\n chromePath: chromiumBinary,\n chromeFlags,\n startingUrl,\n userDataDir,\n logLevel: this.params.verbose ? 'verbose' : 'silent',\n // Ignore default flags to keep the extension enabled.\n ignoreDefaultFlags: true,\n prefs: this.getPrefs(),\n });\n this.cdp = new ChromeDevtoolsProtocolClient(this.chromiumInstance);\n\n const initialChromiumInstance = this.chromiumInstance;\n this.chromiumInstance.process.once('close', () => {\n if (this.chromiumInstance !== initialChromiumInstance) {\n // This happens when we restart Chrome to fall back to --load-extension.\n return;\n }\n this.chromiumInstance = null;\n\n if (!this.exiting) {\n log.info('Exiting on Chromium instance disconnected.');\n this.exit();\n }\n });\n\n if (!this.forceUseDeprecatedLoadExtension) {\n // Assume that the required Extensions.loadUnpacked CDP method is\n // supported. If it is not, we will fall back to --load-extension.\n let cdpSupportsExtensionsLoadUnpacked = true;\n for (const sourceDir of extensions) {\n try {\n await this.cdp.sendCommand('Extensions.loadUnpacked', {\n path: sourceDir,\n });\n } catch (e) {\n // Chrome 125- will emit the following message:\n if (e.message === \"'Extensions.loadUnpacked' wasn't found\") {\n cdpSupportsExtensionsLoadUnpacked = false;\n break;\n }\n log.error(`Failed to load extension at ${sourceDir}: ${e.message}`);\n // We do not have to throw - the extension can work again when\n // auto-reload is used. But users may like a hard fail, and this is\n // consistent with the firefox runner.\n throw e;\n }\n }\n if (!cdpSupportsExtensionsLoadUnpacked) {\n // Retry once, now with --load-extension.\n log.warn('Cannot load extension via CDP, falling back to old method');\n this.forceUseDeprecatedLoadExtension = true;\n this.chromiumInstance = null;\n await initialChromiumInstance.kill();\n await this.cdp.waitUntilDisconnected();\n this.cdp = null;\n return this.setupInstance();\n }\n }\n }\n\n /**\n * Reloads all the extensions, collect any reload error and resolves to\n * an array composed by a single ExtensionRunnerReloadResult object.\n */\n async reloadAllExtensions() {\n const runnerName = this.getName();\n\n if (this.forceUseDeprecatedLoadExtension) {\n this.reloadAllExtensionsFallbackForChrome125andEarlier();\n } else {\n for (const { sourceDir } of this.params.extensions) {\n try {\n await this.cdp.sendCommand('Extensions.loadUnpacked', {\n path: sourceDir,\n });\n } catch (e) {\n log.error(`Failed to load extension at ${sourceDir}: ${e.message}`);\n }\n }\n }\n\n process.stdout.write(\n `\\rLast extension reload: ${new Date().toTimeString()}`,\n );\n log.debug('\\n');\n\n return [{ runnerName }];\n }\n\n async reloadAllExtensionsFallbackForChrome125andEarlier() {\n // Ideally, we'd like to use the \"Extensions.loadUnpacked\" CDP command to\n // reload an extension, but that is unsupported in Chrome 125 and earlier.\n //\n // As a fallback, connect to chrome://extensions/ and reload from there.\n // Since we are targeting old Chrome versions, we can safely use the\n // chrome.developerPrivate APIs, because these are never going to change\n // for the old browser versions. Do NOT use this for newer versions!\n //\n // Target.* CDP methods documented at: https://chromedevtools.github.io/devtools-protocol/tot/Target/\n // developerPrivate documented at:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl\n //\n // Specific revision that exposed developerPrivate to chrome://extensions/:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n // https://chromium.googlesource.com/chromium/src.git/+/69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n //\n // Specific revision that introduced developerPrivate.getExtensionsInfo:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=69bf75316e7ae533c0a0dccc1a56ca019aa95a1e\n //\n // The above changes are from 2015; The --remote-debugging-pipe feature\n // that we rely on for CDP was added in 2018; this is the version of the\n // developerPrivate API at that time:\n // https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/extensions/api/developer_private.idl;drc=c9ae59c8f37d487f1f01c222deb6b7d1f51c99c2\n\n // Find an existing chrome://extensions/ tab, if it exists.\n let { targetInfos: targets } = await this.cdp.sendCommand(\n 'Target.getTargets',\n { filter: [{ type: 'tab' }] },\n );\n targets = targets.filter((t) => t.url.startsWith('chrome://extensions/'));\n let targetId;\n const hasExistingTarget = targets.length > 0;\n if (hasExistingTarget) {\n targetId = targets[0].targetId;\n } else {\n const result = await this.cdp.sendCommand('Target.createTarget', {\n url: 'chrome://extensions/',\n newWindow: true,\n background: true,\n windowState: 'minimized',\n });\n targetId = result.targetId;\n }\n const codeToEvaluateInChrome = async () => {\n // This function is serialized and executed in Chrome. Designed for\n // compatibility with Chrome 69 - 125. Do not use JS syntax of functions\n // that are not supported in these versions!\n\n // eslint-disable-next-line no-undef\n const developerPrivate = chrome.developerPrivate;\n if (!developerPrivate || !developerPrivate.getExtensionsInfo) {\n // When chrome://extensions/ is still loading, its document URL may be\n // about:blank and the chrome.developerPrivate API is not exposed.\n return 'NOT_READY_PLEASE_RETRY';\n }\n const extensionIds = [];\n await new Promise((resolve) => {\n developerPrivate.getExtensionsInfo((extensions) => {\n for (const extension of extensions || []) {\n if (extension.location === 'UNPACKED') {\n // We only care about those loaded via --load-extension.\n extensionIds.push(extension.id);\n }\n }\n resolve();\n });\n });\n const reloadPromises = extensionIds.map((extensionId) => {\n return new Promise((resolve, reject) => {\n developerPrivate.reload(\n extensionId,\n // Suppress alert dialog when load fails.\n { failQuietly: true, populateErrorForUnpacked: true },\n (loadError) => {\n if (loadError) {\n reject(new Error(loadError.error));\n } else {\n resolve();\n }\n },\n );\n });\n });\n await Promise.all(reloadPromises);\n return reloadPromises.length;\n };\n try {\n const targetResult = await this.cdp.sendCommand('Target.attachToTarget', {\n targetId,\n flatten: true,\n });\n if (!targetResult.sessionId) {\n throw new Error('Unexpectedly, no sessionId from attachToTarget');\n }\n // In practice, we're going to run the logic only once. But if we are\n // unlucky, chrome://extensions is still loading, so we will then retry.\n for (let i = 0; i < 3; ++i) {\n const evalResult = await this.cdp.sendCommand(\n 'Runtime.evaluate',\n {\n expression: `(${codeToEvaluateInChrome})();`,\n awaitPromise: true,\n },\n targetResult.sessionId,\n );\n const evalResultReturnValue = evalResult.result?.value;\n if (evalResultReturnValue === 'NOT_READY_PLEASE_RETRY') {\n await new Promise((r) => setTimeout(r, 200 * i));\n continue;\n }\n if (evalResult.exceptionDetails) {\n log.error(`Failed to reload: ${evalResult.exceptionDetails.text}`);\n }\n if (evalResultReturnValue !== this.params.extensions.length) {\n log.warn(`Failed to reload extensions: ${evalResultReturnValue}`);\n }\n break;\n }\n } finally {\n if (!hasExistingTarget && targetId) {\n try {\n await this.cdp.sendCommand('Target.closeTarget', { targetId });\n } catch (e) {\n log.error(e);\n }\n }\n }\n }\n\n /**\n * Reloads a single extension, collect any reload error and resolves to\n * an array composed by a single ExtensionRunnerReloadResult object.\n */\n async reloadExtensionBySourceDir(\n extensionSourceDir, // eslint-disable-line no-unused-vars\n ) {\n // TODO(rpl): detect the extension ids assigned to the\n // target extensions and map it to the extensions source dir\n // (https://github.com/mozilla/web-ext/issues/1687).\n return this.reloadAllExtensions();\n }\n\n /**\n * Register a callback to be called when the runner has been exited\n * (e.g. the Chromium instance exits or the user has requested web-ext\n * to exit).\n */\n registerCleanup(fn) {\n this.cleanupCallbacks.add(fn);\n }\n\n /**\n * Exits the runner, by closing the managed Chromium instance.\n */\n async exit() {\n this.exiting = true;\n\n // Wait for the setup to complete if the extension runner is already\n // being started.\n if (this._promiseSetupDone) {\n // Ignore initialization errors if any.\n await this._promiseSetupDone.catch((err) => {\n log.debug(`ignored setup error on chromium runner shutdown: ${err}`);\n });\n }\n\n if (this.chromiumInstance) {\n await this.chromiumInstance.kill();\n this.chromiumInstance = null;\n }\n\n if (this.cdp) {\n await this.cdp.waitUntilDisconnected();\n this.cdp = null;\n }\n\n // Call all the registered cleanup callbacks.\n for (const fn of this.cleanupCallbacks) {\n try {\n fn();\n } catch (error) {\n log.error(error);\n }\n }\n }\n\n /**\n * Returns a deep preferences object based on a set of flat preferences, like\n * \"extensions.ui.developer_mode\".\n */\n getPrefs() {\n return expandPrefs({\n ...DEFAULT_PREFS,\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+40,8 @@ export async function createExtensionRunner(config) {
40
40
  */
41
41
  export class MultiExtensionRunner {
42
42
  extensionRunners;
43
- desktopNotifications;
44
43
  constructor(params) {
45
44
  this.extensionRunners = params.runners;
46
- this.desktopNotifications = params.desktopNotifications;
47
45
  }
48
46
 
49
47
  // Method exported from the IExtensionRunner interface.
@@ -72,8 +70,7 @@ export class MultiExtensionRunner {
72
70
  * collect any reload error, and resolves to an array composed by
73
71
  * a ExtensionRunnerReloadResult object per managed runner.
74
72
  *
75
- * Any detected reload error is also logged on the terminal and shows as a
76
- * desktop notification.
73
+ * Any detected reload error is also logged on the terminal.
77
74
  */
78
75
  async reloadAllExtensions() {
79
76
  log.debug('Reloading all reloadable add-ons');
@@ -102,8 +99,7 @@ export class MultiExtensionRunner {
102
99
  * collect any reload error and resolves to an array composed by
103
100
  * a ExtensionRunnerReloadResult object per managed runner.
104
101
  *
105
- * Any detected reload error is also logged on the terminal and shows as a
106
- * desktop notification.
102
+ * Any detected reload error is also logged on the terminal.
107
103
  */
108
104
  async reloadExtensionBySourceDir(sourceDir) {
109
105
  log.debug(`Reloading add-on at ${sourceDir}`);
@@ -177,10 +173,6 @@ export class MultiExtensionRunner {
177
173
  message += `on "${runnerName}" - ${reloadError.message}`;
178
174
  log.error(`\n${message}`);
179
175
  log.debug(reloadError.stack);
180
- this.desktopNotifications({
181
- title: 'web-ext run: extension reload error',
182
- message
183
- });
184
176
  }
185
177
  }
186
178
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["readline","WebExtError","createLogger","createFileFilter","defaultFileFilterCreator","isTTY","setRawMode","defaultSourceWatcher","log","import","meta","url","createExtensionRunner","config","target","FirefoxDesktopExtensionRunner","params","FirefoxAndroidExtensionRunner","ChromiumExtensionRunner","MultiExtensionRunner","extensionRunners","desktopNotifications","constructor","runners","getName","run","promises","runner","push","Promise","all","reloadAllExtensions","debug","reloadPromise","then","runnerName","error","reloadError","results","handleReloadResults","reloadExtensionBySourceDir","sourceDir","registerCleanup","cleanupCallback","resolve","exit","Error","message","stack","title","defaultWatcherCreator","reloadExtension","watchFile","watchIgnored","artifactsDir","ignoreFiles","onSourceChange","fileFilter","onChange","shouldWatchFile","file","wantFile","defaultReloadStrategy","extensionRunner","noInput","createWatcher","stdin","process","kill","allowInput","watcher","watchedSourceDir","close","pause","emitKeypressEvents","keypressUsageInfo","info","userExit","keyPressed","once","str","key","ctrl","name","pid","catch","err","warn"],"sources":["../../src/extension-runners/index.js"],"sourcesContent":["import readline from 'readline';\n\nimport { WebExtError } from '../errors.js';\nimport { createLogger } from '../util/logger.js';\nimport { createFileFilter as defaultFileFilterCreator } from '../util/file-filter.js';\nimport { isTTY, setRawMode } from '../util/stdin.js';\nimport defaultSourceWatcher from '../watcher.js';\n\nconst log = createLogger(import.meta.url);\n\nexport async function createExtensionRunner(config) {\n switch (config.target) {\n case 'firefox-desktop': {\n const { FirefoxDesktopExtensionRunner } =\n await import('./firefox-desktop.js');\n return new FirefoxDesktopExtensionRunner(config.params);\n }\n case 'firefox-android': {\n const { FirefoxAndroidExtensionRunner } =\n await import('./firefox-android.js');\n return new FirefoxAndroidExtensionRunner(config.params);\n }\n case 'chromium': {\n const { ChromiumExtensionRunner } = await import('./chromium.js');\n return new ChromiumExtensionRunner(config.params);\n }\n default:\n throw new WebExtError(`Unknown target: \"${config.target}\"`);\n }\n}\n\n/**\n * Implements an IExtensionRunner which allow the caller to\n * manage multiple extension runners at the same time (e.g. by running\n * a Firefox Desktop instance alongside to a Firefox for Android instance).\n */\nexport class MultiExtensionRunner {\n extensionRunners;\n desktopNotifications;\n\n constructor(params) {\n this.extensionRunners = params.runners;\n this.desktopNotifications = params.desktopNotifications;\n }\n\n // Method exported from the IExtensionRunner interface.\n\n /**\n * Returns the runner name.\n */\n getName() {\n return 'Multi Extension Runner';\n }\n\n /**\n * Call the `run` method on all the managed extension runners,\n * and awaits that all the runners has been successfully started.\n */\n async run() {\n const promises = [];\n for (const runner of this.extensionRunners) {\n promises.push(runner.run());\n }\n\n await Promise.all(promises);\n }\n\n /**\n * Reloads all the extensions on all the managed extension runners,\n * collect any reload error, and resolves to an array composed by\n * a ExtensionRunnerReloadResult object per managed runner.\n *\n * Any detected reload error is also logged on the terminal and shows as a\n * desktop notification.\n */\n async reloadAllExtensions() {\n log.debug('Reloading all reloadable add-ons');\n\n const promises = [];\n for (const runner of this.extensionRunners) {\n const reloadPromise = runner.reloadAllExtensions().then(\n () => {\n return { runnerName: runner.getName() };\n },\n (error) => {\n return {\n runnerName: runner.getName(),\n reloadError: error,\n };\n },\n );\n\n promises.push(reloadPromise);\n }\n\n return await Promise.all(promises).then((results) => {\n this.handleReloadResults(results);\n return results;\n });\n }\n\n /**\n * Reloads a single extension on all the managed extension runners,\n * collect any reload error and resolves to an array composed by\n * a ExtensionRunnerReloadResult object per managed runner.\n *\n * Any detected reload error is also logged on the terminal and shows as a\n * desktop notification.\n */\n async reloadExtensionBySourceDir(sourceDir) {\n log.debug(`Reloading add-on at ${sourceDir}`);\n\n const promises = [];\n for (const runner of this.extensionRunners) {\n const reloadPromise = runner.reloadExtensionBySourceDir(sourceDir).then(\n () => {\n return { runnerName: runner.getName(), sourceDir };\n },\n (error) => {\n return {\n runnerName: runner.getName(),\n reloadError: error,\n sourceDir,\n };\n },\n );\n\n promises.push(reloadPromise);\n }\n\n return await Promise.all(promises).then((results) => {\n this.handleReloadResults(results);\n return results;\n });\n }\n\n /**\n * Register a callback to be called when all the managed runners has been exited.\n */\n registerCleanup(cleanupCallback) {\n const promises = [];\n\n // Create a promise for every extension runner managed by this instance,\n // the promise will be resolved when the particular runner calls its\n // registered cleanup callbacks.\n for (const runner of this.extensionRunners) {\n promises.push(\n new Promise((resolve) => {\n runner.registerCleanup(resolve);\n }),\n );\n }\n\n // Wait for all the created promises to be resolved or rejected\n // (once each one of the runners has cleaned up) and then call\n // the cleanup callback registered to this runner.\n Promise.all(promises).then(cleanupCallback, cleanupCallback);\n }\n\n /**\n * Exits all the managed runner has been exited.\n */\n async exit() {\n const promises = [];\n for (const runner of this.extensionRunners) {\n promises.push(runner.exit());\n }\n\n await Promise.all(promises);\n }\n\n // Private helper methods.\n\n handleReloadResults(results) {\n for (const { runnerName, reloadError, sourceDir } of results) {\n if (reloadError instanceof Error) {\n let message = 'Error occurred while reloading';\n if (sourceDir) {\n message += ` \"${sourceDir}\" `;\n }\n\n message += `on \"${runnerName}\" - ${reloadError.message}`;\n\n log.error(`\\n${message}`);\n log.debug(reloadError.stack);\n\n this.desktopNotifications({\n title: 'web-ext run: extension reload error',\n message,\n });\n }\n }\n }\n}\n\n// defaultWatcherCreator types and implementation.\n\nexport function defaultWatcherCreator({\n reloadExtension,\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n onSourceChange = defaultSourceWatcher,\n createFileFilter = defaultFileFilterCreator,\n}) {\n const fileFilter = createFileFilter({ sourceDir, artifactsDir, ignoreFiles });\n return onSourceChange({\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n onChange: () => reloadExtension(sourceDir),\n shouldWatchFile: (file) => fileFilter.wantFile(file),\n });\n}\n\n// defaultReloadStrategy types and implementation.\n\nexport function defaultReloadStrategy(\n {\n artifactsDir,\n extensionRunner,\n ignoreFiles,\n noInput = false,\n sourceDir,\n watchFile,\n watchIgnored,\n },\n {\n createWatcher = defaultWatcherCreator,\n stdin = process.stdin,\n kill = process.kill,\n } = {},\n) {\n const allowInput = !noInput;\n if (!allowInput) {\n log.debug('Input has been disabled because of noInput==true');\n }\n\n const watcher = createWatcher({\n reloadExtension: (watchedSourceDir) => {\n extensionRunner.reloadExtensionBySourceDir(watchedSourceDir);\n },\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n });\n\n extensionRunner.registerCleanup(() => {\n watcher.close();\n if (allowInput) {\n if (isTTY(stdin)) {\n setRawMode(stdin, false);\n }\n stdin.pause();\n }\n });\n\n if (allowInput && isTTY(stdin)) {\n readline.emitKeypressEvents(stdin);\n setRawMode(stdin, true);\n\n const keypressUsageInfo = 'Press R to reload (and Ctrl-C to quit)';\n\n // NOTE: this `Promise.resolve().then(...)` is basically used to spawn a \"co-routine\"\n // that is executed before the callback attached to the Promise returned by this function\n // (and it allows the `run` function to not be stuck in the while loop).\n Promise.resolve().then(async function () {\n log.info(keypressUsageInfo);\n\n let userExit = false;\n\n while (!userExit) {\n const keyPressed = await new Promise((resolve) => {\n stdin.once('keypress', (str, key) => resolve(key));\n });\n\n if (keyPressed.ctrl && keyPressed.name === 'c') {\n userExit = true;\n } else if (keyPressed.name === 'z') {\n // Prepare to suspend.\n\n // NOTE: Switch the raw mode off before suspending (needed to make the keypress event\n // to work correctly when the nodejs process is resumed).\n setRawMode(stdin, false);\n\n log.info('\\nweb-ext has been suspended on user request');\n kill(process.pid, 'SIGTSTP');\n\n // Prepare to resume.\n\n log.info(`\\nweb-ext has been resumed. ${keypressUsageInfo}`);\n\n // Switch the raw mode on on resume.\n setRawMode(stdin, true);\n } else if (keyPressed.name === 'r') {\n log.debug('Reloading installed extensions on user request');\n await extensionRunner.reloadAllExtensions().catch((err) => {\n log.warn(`\\nError reloading extension: ${err}`);\n log.debug(`Reloading extension error stack: ${err.stack}`);\n });\n }\n }\n\n log.info('\\nExiting web-ext on user request');\n extensionRunner.exit();\n });\n }\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,UAAU;AAE/B,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,gBAAgB,IAAIC,wBAAwB,QAAQ,wBAAwB;AACrF,SAASC,KAAK,EAAEC,UAAU,QAAQ,kBAAkB;AACpD,OAAOC,oBAAoB,MAAM,eAAe;AAEhD,MAAMC,GAAG,GAAGN,YAAY,CAACO,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAEzC,OAAO,eAAeC,qBAAqBA,CAACC,MAAM,EAAE;EAClD,QAAQA,MAAM,CAACC,MAAM;IACnB,KAAK,iBAAiB;MAAE;QAC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OAAO,CAACiB,GAAG,EAAE,SAAS,CAAC;;UAE5B;;UAEA5E,GAAG,CAACoE,IAAI,CAAC,+BAA+BD,iBAAiB,EAAE,CAAC;;UAE5D;UACArE,UAAU,CAAC4D,KAAK,EAAE,IAAI,CAAC;QACzB,CAAC,MAAM,IAAIY,UAAU,CAACK,IAAI,KAAK,GAAG,EAAE;UAClC3E,GAAG,CAACwB,KAAK,CAAC,gDAAgD,CAAC;UAC3D,MAAM+B,eAAe,CAAChC,mBAAmB,CAAC,CAAC,CAACsD,KAAK,CAAEC,GAAG,IAAK;YACzD9E,GAAG,CAAC+E,IAAI,CAAC,gCAAgCD,GAAG,EAAE,CAAC;YAC/C9E,GAAG,CAACwB,KAAK,CAAC,oCAAoCsD,GAAG,CAACtC,KAAK,EAAE,CAAC;UAC5D,CAAC,CAAC;QACJ;MACF;MAEAxC,GAAG,CAACoE,IAAI,CAAC,mCAAmC,CAAC;MAC7Cb,eAAe,CAAClB,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["readline","WebExtError","createLogger","createFileFilter","defaultFileFilterCreator","isTTY","setRawMode","defaultSourceWatcher","log","import","meta","url","createExtensionRunner","config","target","FirefoxDesktopExtensionRunner","params","FirefoxAndroidExtensionRunner","ChromiumExtensionRunner","MultiExtensionRunner","extensionRunners","constructor","runners","getName","run","promises","runner","push","Promise","all","reloadAllExtensions","debug","reloadPromise","then","runnerName","error","reloadError","results","handleReloadResults","reloadExtensionBySourceDir","sourceDir","registerCleanup","cleanupCallback","resolve","exit","Error","message","stack","defaultWatcherCreator","reloadExtension","watchFile","watchIgnored","artifactsDir","ignoreFiles","onSourceChange","fileFilter","onChange","shouldWatchFile","file","wantFile","defaultReloadStrategy","extensionRunner","noInput","createWatcher","stdin","process","kill","allowInput","watcher","watchedSourceDir","close","pause","emitKeypressEvents","keypressUsageInfo","info","userExit","keyPressed","once","str","key","ctrl","name","pid","catch","err","warn"],"sources":["../../src/extension-runners/index.js"],"sourcesContent":["import readline from 'readline';\n\nimport { WebExtError } from '../errors.js';\nimport { createLogger } from '../util/logger.js';\nimport { createFileFilter as defaultFileFilterCreator } from '../util/file-filter.js';\nimport { isTTY, setRawMode } from '../util/stdin.js';\nimport defaultSourceWatcher from '../watcher.js';\n\nconst log = createLogger(import.meta.url);\n\nexport async function createExtensionRunner(config) {\n switch (config.target) {\n case 'firefox-desktop': {\n const { FirefoxDesktopExtensionRunner } =\n await import('./firefox-desktop.js');\n return new FirefoxDesktopExtensionRunner(config.params);\n }\n case 'firefox-android': {\n const { FirefoxAndroidExtensionRunner } =\n await import('./firefox-android.js');\n return new FirefoxAndroidExtensionRunner(config.params);\n }\n case 'chromium': {\n const { ChromiumExtensionRunner } = await import('./chromium.js');\n return new ChromiumExtensionRunner(config.params);\n }\n default:\n throw new WebExtError(`Unknown target: \"${config.target}\"`);\n }\n}\n\n/**\n * Implements an IExtensionRunner which allow the caller to\n * manage multiple extension runners at the same time (e.g. by running\n * a Firefox Desktop instance alongside to a Firefox for Android instance).\n */\nexport class MultiExtensionRunner {\n extensionRunners;\n\n constructor(params) {\n this.extensionRunners = params.runners;\n }\n\n // Method exported from the IExtensionRunner interface.\n\n /**\n * Returns the runner name.\n */\n getName() {\n return 'Multi Extension Runner';\n }\n\n /**\n * Call the `run` method on all the managed extension runners,\n * and awaits that all the runners has been successfully started.\n */\n async run() {\n const promises = [];\n for (const runner of this.extensionRunners) {\n promises.push(runner.run());\n }\n\n await Promise.all(promises);\n }\n\n /**\n * Reloads all the extensions on all the managed extension runners,\n * collect any reload error, and resolves to an array composed by\n * a ExtensionRunnerReloadResult object per managed runner.\n *\n * Any detected reload error is also logged on the terminal.\n */\n async reloadAllExtensions() {\n log.debug('Reloading all reloadable add-ons');\n\n const promises = [];\n for (const runner of this.extensionRunners) {\n const reloadPromise = runner.reloadAllExtensions().then(\n () => {\n return { runnerName: runner.getName() };\n },\n (error) => {\n return {\n runnerName: runner.getName(),\n reloadError: error,\n };\n },\n );\n\n promises.push(reloadPromise);\n }\n\n return await Promise.all(promises).then((results) => {\n this.handleReloadResults(results);\n return results;\n });\n }\n\n /**\n * Reloads a single extension on all the managed extension runners,\n * collect any reload error and resolves to an array composed by\n * a ExtensionRunnerReloadResult object per managed runner.\n *\n * Any detected reload error is also logged on the terminal.\n */\n async reloadExtensionBySourceDir(sourceDir) {\n log.debug(`Reloading add-on at ${sourceDir}`);\n\n const promises = [];\n for (const runner of this.extensionRunners) {\n const reloadPromise = runner.reloadExtensionBySourceDir(sourceDir).then(\n () => {\n return { runnerName: runner.getName(), sourceDir };\n },\n (error) => {\n return {\n runnerName: runner.getName(),\n reloadError: error,\n sourceDir,\n };\n },\n );\n\n promises.push(reloadPromise);\n }\n\n return await Promise.all(promises).then((results) => {\n this.handleReloadResults(results);\n return results;\n });\n }\n\n /**\n * Register a callback to be called when all the managed runners has been exited.\n */\n registerCleanup(cleanupCallback) {\n const promises = [];\n\n // Create a promise for every extension runner managed by this instance,\n // the promise will be resolved when the particular runner calls its\n // registered cleanup callbacks.\n for (const runner of this.extensionRunners) {\n promises.push(\n new Promise((resolve) => {\n runner.registerCleanup(resolve);\n }),\n );\n }\n\n // Wait for all the created promises to be resolved or rejected\n // (once each one of the runners has cleaned up) and then call\n // the cleanup callback registered to this runner.\n Promise.all(promises).then(cleanupCallback, cleanupCallback);\n }\n\n /**\n * Exits all the managed runner has been exited.\n */\n async exit() {\n const promises = [];\n for (const runner of this.extensionRunners) {\n promises.push(runner.exit());\n }\n\n await Promise.all(promises);\n }\n\n // Private helper methods.\n\n handleReloadResults(results) {\n for (const { runnerName, reloadError, sourceDir } of results) {\n if (reloadError instanceof Error) {\n let message = 'Error occurred while reloading';\n if (sourceDir) {\n message += ` \"${sourceDir}\" `;\n }\n\n message += `on \"${runnerName}\" - ${reloadError.message}`;\n\n log.error(`\\n${message}`);\n log.debug(reloadError.stack);\n }\n }\n }\n}\n\n// defaultWatcherCreator types and implementation.\n\nexport function defaultWatcherCreator({\n reloadExtension,\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n onSourceChange = defaultSourceWatcher,\n createFileFilter = defaultFileFilterCreator,\n}) {\n const fileFilter = createFileFilter({ sourceDir, artifactsDir, ignoreFiles });\n return onSourceChange({\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n onChange: () => reloadExtension(sourceDir),\n shouldWatchFile: (file) => fileFilter.wantFile(file),\n });\n}\n\n// defaultReloadStrategy types and implementation.\n\nexport function defaultReloadStrategy(\n {\n artifactsDir,\n extensionRunner,\n ignoreFiles,\n noInput = false,\n sourceDir,\n watchFile,\n watchIgnored,\n },\n {\n createWatcher = defaultWatcherCreator,\n stdin = process.stdin,\n kill = process.kill,\n } = {},\n) {\n const allowInput = !noInput;\n if (!allowInput) {\n log.debug('Input has been disabled because of noInput==true');\n }\n\n const watcher = createWatcher({\n reloadExtension: (watchedSourceDir) => {\n extensionRunner.reloadExtensionBySourceDir(watchedSourceDir);\n },\n sourceDir,\n watchFile,\n watchIgnored,\n artifactsDir,\n ignoreFiles,\n });\n\n extensionRunner.registerCleanup(() => {\n watcher.close();\n if (allowInput) {\n if (isTTY(stdin)) {\n setRawMode(stdin, false);\n }\n stdin.pause();\n }\n });\n\n if (allowInput && isTTY(stdin)) {\n readline.emitKeypressEvents(stdin);\n setRawMode(stdin, true);\n\n const keypressUsageInfo = 'Press R to reload (and Ctrl-C to quit)';\n\n // NOTE: this `Promise.resolve().then(...)` is basically used to spawn a \"co-routine\"\n // that is executed before the callback attached to the Promise returned by this function\n // (and it allows the `run` function to not be stuck in the while loop).\n Promise.resolve().then(async function () {\n log.info(keypressUsageInfo);\n\n let userExit = false;\n\n while (!userExit) {\n const keyPressed = await new Promise((resolve) => {\n stdin.once('keypress', (str, key) => resolve(key));\n });\n\n if (keyPressed.ctrl && keyPressed.name === 'c') {\n userExit = true;\n } else if (keyPressed.name === 'z') {\n // Prepare to suspend.\n\n // NOTE: Switch the raw mode off before suspending (needed to make the keypress event\n // to work correctly when the nodejs process is resumed).\n setRawMode(stdin, false);\n\n log.info('\\nweb-ext has been suspended on user request');\n kill(process.pid, 'SIGTSTP');\n\n // Prepare to resume.\n\n log.info(`\\nweb-ext has been resumed. ${keypressUsageInfo}`);\n\n // Switch the raw mode on on resume.\n setRawMode(stdin, true);\n } else if (keyPressed.name === 'r') {\n log.debug('Reloading installed extensions on user request');\n await extensionRunner.reloadAllExtensions().catch((err) => {\n log.warn(`\\nError reloading extension: ${err}`);\n log.debug(`Reloading extension error stack: ${err.stack}`);\n });\n }\n }\n\n log.info('\\nExiting web-ext on user request');\n extensionRunner.exit();\n });\n }\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,UAAU;AAE/B,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,gBAAgB,IAAIC,wBAAwB,QAAQ,wBAAwB;AACrF,SAASC,KAAK,EAAEC,UAAU,QAAQ,kBAAkB;AACpD,OAAOC,oBAAoB,MAAM,eAAe;AAEhD,MAAMC,GAAG,GAAGN,YAAY,CAACO,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAEzC,OAAO,eAAeC,qBAAqBA,CAACC,MAAM,EAAE;EAClD,QAAQA,MAAM,CAACC,MAAM;IACnB,KAAK,iBAAiB;MAAE;QACtB,MAAM;UAAEC;QAA8B,CAAC,GACrC,MAAM,MAAM,CAAC,sBAAsB,CAAC;QACtC,OAAO,IAAIA,6BAA6B,CAACF,MAAM,CAACG,MAAM,CAAC;MACzD;IACA,KAAK,iBAAiB;MAAE;QACtB,MAAM;UAAEC;QAA8B,CAAC,GACrC,MAAM,MAAM,CAAC,sBAAsB,CAAC;QACtC,OAAO,IAAIA,6BAA6B,CAACJ,MAAM,CAACG,MAAM,CAAC;MACzD;IACA,KAAK,UAAU;MAAE;QACf,MAAM;UAAEE;QAAwB,CAAC,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;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CAAC,mCAAmC,CAAC;MAC7Cb,eAAe,CAACjB,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -59,6 +59,7 @@ const prefsFirefox = {
59
59
  'startup.homepage_welcome_url.additional': '',
60
60
  'devtools.errorconsole.enabled': true,
61
61
  'devtools.chrome.enabled': true,
62
+ 'devtools.debugger.show-content-scripts': true,
62
63
  // From:
63
64
  // http://hg.mozilla.org/mozilla-central/file/1dd81c324ac7/build/automation.py.in//l388
64
65
  // Make url-classifier updates so rare that they won't affect tests.
@@ -74,7 +75,9 @@ const prefsFirefox = {
74
75
  // Set the policy firstURL to an empty string to prevent
75
76
  // the privacy info page to be opened on every "web-ext run".
76
77
  // (See #1114 for rationale)
77
- 'datareporting.policy.firstRunURL': ''
78
+ 'datareporting.policy.firstRunURL': '',
79
+ // Prevent the terms-of-use modal from appearing on every "web-ext run". (See #3478)
80
+ 'termsofuse.bypassNotification': true
78
81
  };
79
82
  const prefs = {
80
83
  common: prefsCommon,
@@ -1 +1 @@
1
- {"version":3,"file":"preferences.js","names":["WebExtError","UsageError","createLogger","log","import","meta","url","nonOverridablePreferences","prefsCommon","prefsFennec","prefsFirefox","prefs","common","fennec","firefox","getPrefs","app","appPrefs","coerceCLICustomPreference","cliPrefs","customPrefs","pref","prefsAry","split","length","key","value","slice","join","test","parseInt","includes","warn"],"sources":["../../src/firefox/preferences.js"],"sourcesContent":["import { WebExtError, UsageError } from '../errors.js';\nimport { createLogger } from '../util/logger.js';\n\nconst log = createLogger(import.meta.url);\n\nexport const nonOverridablePreferences = [\n 'devtools.debugger.remote-enabled',\n 'devtools.debugger.prompt-connection',\n 'xpinstall.signatures.required',\n];\n\n// Preferences Maps\n\nconst prefsCommon = {\n // Allow debug output via dump to be printed to the system console\n 'browser.dom.window.dump.enabled': true,\n\n // From:\n // https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/internals/preferences.html#data-choices-notification\n // This is the data submission master kill switch. If disabled, no policy is shown or upload takes place, ever.\n 'datareporting.policy.dataSubmissionEnabled': false,\n\n // Allow remote connections to the debugger.\n 'devtools.debugger.remote-enabled': true,\n // Disable the prompt for allowing connections.\n 'devtools.debugger.prompt-connection': false,\n // Allow extensions to log messages on browser's console.\n 'devtools.browserconsole.contentMessages': true,\n\n // Turn off platform logging because it is a lot of info.\n 'extensions.logging.enabled': false,\n\n // Disable extension updates and notifications.\n 'extensions.checkCompatibility.nightly': false,\n 'extensions.update.enabled': false,\n 'extensions.update.notifyUser': false,\n\n // From:\n // http://hg.mozilla.org/mozilla-central/file/1dd81c324ac7/build/automation.py.in//l372\n // Only load extensions from the application and user profile.\n // AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION\n 'extensions.enabledScopes': 5,\n // Disable metadata caching for installed add-ons by default.\n 'extensions.getAddons.cache.enabled': false,\n // Disable installing any distribution add-ons.\n 'extensions.installDistroAddons': false,\n // Allow installing extensions dropped into the profile folder.\n 'extensions.autoDisableScopes': 10,\n\n // Disable app update.\n 'app.update.enabled': false,\n\n // Allow unsigned add-ons.\n 'xpinstall.signatures.required': false,\n\n // browser.link.open_newwindow is changed from 3 to 2 in:\n // https://github.com/saadtazi/firefox-profile-js/blob/cafc793d940a779d280103ae17d02a92de862efc/lib/firefox_profile.js#L32\n // Restore original value to avoid https://github.com/mozilla/web-ext/issues/1592\n 'browser.link.open_newwindow': 3,\n};\n\n// Prefs specific to Firefox for Android.\nconst prefsFennec = {\n 'browser.console.showInPanel': true,\n 'browser.firstrun.show.uidiscovery': false,\n 'devtools.remote.usb.enabled': true,\n};\n\n// Prefs specific to Firefox for desktop.\nconst prefsFirefox = {\n 'browser.startup.homepage': 'about:blank',\n 'startup.homepage_welcome_url': 'about:blank',\n 'startup.homepage_welcome_url.additional': '',\n 'devtools.errorconsole.enabled': true,\n 'devtools.chrome.enabled': true,\n\n // From:\n // http://hg.mozilla.org/mozilla-central/file/1dd81c324ac7/build/automation.py.in//l388\n // Make url-classifier updates so rare that they won't affect tests.\n 'urlclassifier.updateinterval': 172800,\n // Point the url-classifier to a nonexistent local URL for fast failures.\n 'browser.safebrowsing.provider.0.gethashURL':\n 'http://localhost/safebrowsing-dummy/gethash',\n 'browser.safebrowsing.provider.0.keyURL':\n 'http://localhost/safebrowsing-dummy/newkey',\n 'browser.safebrowsing.provider.0.updateURL':\n 'http://localhost/safebrowsing-dummy/update',\n\n // Disable self repair/SHIELD\n 'browser.selfsupport.url': 'https://localhost/selfrepair',\n // Disable Reader Mode UI tour\n 'browser.reader.detectedFirstArticle': true,\n\n // Set the policy firstURL to an empty string to prevent\n // the privacy info page to be opened on every \"web-ext run\".\n // (See #1114 for rationale)\n 'datareporting.policy.firstRunURL': '',\n};\n\nconst prefs = {\n common: prefsCommon,\n fennec: prefsFennec,\n firefox: prefsFirefox,\n};\n\n// Module exports\n\nexport function getPrefs(app = 'firefox') {\n const appPrefs = prefs[app];\n if (!appPrefs) {\n throw new WebExtError(`Unsupported application: ${app}`);\n }\n return {\n ...prefsCommon,\n ...appPrefs,\n };\n}\n\nexport function coerceCLICustomPreference(cliPrefs) {\n const customPrefs = {};\n\n for (const pref of cliPrefs) {\n const prefsAry = pref.split('=');\n\n if (prefsAry.length < 2) {\n throw new UsageError(\n `Incomplete custom preference: \"${pref}\". ` +\n 'Syntax expected: \"prefname=prefvalue\".',\n );\n }\n\n const key = prefsAry[0];\n let value = prefsAry.slice(1).join('=');\n\n if (/[^\\w{@}.-]/.test(key)) {\n throw new UsageError(`Invalid custom preference name: ${key}`);\n }\n\n if (value === `${parseInt(value)}`) {\n value = parseInt(value, 10);\n } else if (value === 'true' || value === 'false') {\n value = value === 'true';\n }\n\n if (nonOverridablePreferences.includes(key)) {\n log.warn(`'${key}' preference cannot be customized.`);\n continue;\n }\n customPrefs[`${key}`] = value;\n }\n\n return customPrefs;\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,MA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AAK,KAAK,MAAM;IAC1B;IAEA,IAAInB,yBAAyB,CAACwB,QAAQ,CAACN,GAAG,CAAC,EAAE;MAC3CtB,GAAG,CAAC6B,IAAI,CAAC,IAAIP,GAAG,oCAAoC,CAAC;MACrD;IACF;IACAL,WAAW,CAAC,GAAGK,GAAG,EAAE,CAAC,GAAGC,KAAK;EAC/B;EAEA,OAAON,WAAW;AACpB","ignoreList":[]}
1
+ {"version":3,"file":"preferences.js","names":["WebExtError","UsageError","createLogger","log","import","meta","url","nonOverridablePreferences","prefsCommon","prefsFennec","prefsFirefox","prefs","common","fennec","firefox","getPrefs","app","appPrefs","coerceCLICustomPreference","cliPrefs","customPrefs","pref","prefsAry","split","length","key","value","slice","join","test","parseInt","includes","warn"],"sources":["../../src/firefox/preferences.js"],"sourcesContent":["import { WebExtError, UsageError } from '../errors.js';\nimport { createLogger } from '../util/logger.js';\n\nconst log = createLogger(import.meta.url);\n\nexport const nonOverridablePreferences = [\n 'devtools.debugger.remote-enabled',\n 'devtools.debugger.prompt-connection',\n 'xpinstall.signatures.required',\n];\n\n// Preferences Maps\n\nconst prefsCommon = {\n // Allow debug output via dump to be printed to the system console\n 'browser.dom.window.dump.enabled': true,\n\n // From:\n // https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/internals/preferences.html#data-choices-notification\n // This is the data submission master kill switch. If disabled, no policy is shown or upload takes place, ever.\n 'datareporting.policy.dataSubmissionEnabled': false,\n\n // Allow remote connections to the debugger.\n 'devtools.debugger.remote-enabled': true,\n // Disable the prompt for allowing connections.\n 'devtools.debugger.prompt-connection': false,\n // Allow extensions to log messages on browser's console.\n 'devtools.browserconsole.contentMessages': true,\n\n // Turn off platform logging because it is a lot of info.\n 'extensions.logging.enabled': false,\n\n // Disable extension updates and notifications.\n 'extensions.checkCompatibility.nightly': false,\n 'extensions.update.enabled': false,\n 'extensions.update.notifyUser': false,\n\n // From:\n // http://hg.mozilla.org/mozilla-central/file/1dd81c324ac7/build/automation.py.in//l372\n // Only load extensions from the application and user profile.\n // AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION\n 'extensions.enabledScopes': 5,\n // Disable metadata caching for installed add-ons by default.\n 'extensions.getAddons.cache.enabled': false,\n // Disable installing any distribution add-ons.\n 'extensions.installDistroAddons': false,\n // Allow installing extensions dropped into the profile folder.\n 'extensions.autoDisableScopes': 10,\n\n // Disable app update.\n 'app.update.enabled': false,\n\n // Allow unsigned add-ons.\n 'xpinstall.signatures.required': false,\n\n // browser.link.open_newwindow is changed from 3 to 2 in:\n // https://github.com/saadtazi/firefox-profile-js/blob/cafc793d940a779d280103ae17d02a92de862efc/lib/firefox_profile.js#L32\n // Restore original value to avoid https://github.com/mozilla/web-ext/issues/1592\n 'browser.link.open_newwindow': 3,\n};\n\n// Prefs specific to Firefox for Android.\nconst prefsFennec = {\n 'browser.console.showInPanel': true,\n 'browser.firstrun.show.uidiscovery': false,\n 'devtools.remote.usb.enabled': true,\n};\n\n// Prefs specific to Firefox for desktop.\nconst prefsFirefox = {\n 'browser.startup.homepage': 'about:blank',\n 'startup.homepage_welcome_url': 'about:blank',\n 'startup.homepage_welcome_url.additional': '',\n 'devtools.errorconsole.enabled': true,\n 'devtools.chrome.enabled': true,\n 'devtools.debugger.show-content-scripts': true,\n\n // From:\n // http://hg.mozilla.org/mozilla-central/file/1dd81c324ac7/build/automation.py.in//l388\n // Make url-classifier updates so rare that they won't affect tests.\n 'urlclassifier.updateinterval': 172800,\n // Point the url-classifier to a nonexistent local URL for fast failures.\n 'browser.safebrowsing.provider.0.gethashURL':\n 'http://localhost/safebrowsing-dummy/gethash',\n 'browser.safebrowsing.provider.0.keyURL':\n 'http://localhost/safebrowsing-dummy/newkey',\n 'browser.safebrowsing.provider.0.updateURL':\n 'http://localhost/safebrowsing-dummy/update',\n\n // Disable self repair/SHIELD\n 'browser.selfsupport.url': 'https://localhost/selfrepair',\n // Disable Reader Mode UI tour\n 'browser.reader.detectedFirstArticle': true,\n\n // Set the policy firstURL to an empty string to prevent\n // the privacy info page to be opened on every \"web-ext run\".\n // (See #1114 for rationale)\n 'datareporting.policy.firstRunURL': '',\n\n // Prevent the terms-of-use modal from appearing on every \"web-ext run\". (See #3478)\n 'termsofuse.bypassNotification': true,\n};\n\nconst prefs = {\n common: prefsCommon,\n fennec: prefsFennec,\n firefox: prefsFirefox,\n};\n\n// Module exports\n\nexport function getPrefs(app = 'firefox') {\n const appPrefs = prefs[app];\n if (!appPrefs) {\n throw new WebExtError(`Unsupported application: ${app}`);\n }\n return {\n ...prefsCommon,\n ...appPrefs,\n };\n}\n\nexport function coerceCLICustomPreference(cliPrefs) {\n const customPrefs = {};\n\n for (const pref of cliPrefs) {\n const prefsAry = pref.split('=');\n\n if (prefsAry.length < 2) {\n throw new UsageError(\n `Incomplete custom preference: \"${pref}\". ` +\n 'Syntax expected: \"prefname=prefvalue\".',\n );\n }\n\n const key = prefsAry[0];\n let value = prefsAry.slice(1).join('=');\n\n if (/[^\\w{@}.-]/.test(key)) {\n throw new UsageError(`Invalid custom preference name: ${key}`);\n }\n\n if (value === `${parseInt(value)}`) {\n value = parseInt(value, 10);\n } else if (value === 'true' || value === 'false') {\n value = value === 'true';\n }\n\n if (nonOverridablePreferences.includes(key)) {\n log.warn(`'${key}' preference cannot be customized.`);\n continue;\n }\n customPrefs[`${key}`] = value;\n }\n\n return customPrefs;\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,MAAMC,GAAG,GAAGD,YAAY,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAEzC,OAAO,MAAMC,yBAAyB,GAAG,CACvC,kCAAkC,EAClC,qCAAqC,EACrC,+BAA+B,CAChC;;AAED;;AAEA,MAAMC,WAAW,GAAG;EAClB;EACA,iCAAiC,EAAE,IAAI;EAEvC;EACA;EACA;EACA,4CAA4C,EAAE,KAAK;EAEnD;EACA,kCAAkC,EAAE,IAAI;EACxC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,WAAW;AACpB","ignoreList":[]}
package/lib/program.js CHANGED
@@ -491,6 +491,13 @@ Example: $0 --help run.
491
491
  demandOption: false,
492
492
  type: 'string'
493
493
  },
494
+ 'chromium-pref': {
495
+ describe: 'Launch chromium with a custom preference ' + '(example: --chromium-pref=browser.theme.follows_system_colors=false). ' + 'You can repeat this option to set more than one ' + 'preference.',
496
+ demandOption: false,
497
+ requiresArg: true,
498
+ type: 'array',
499
+ coerce: arg => arg != null ? coerceCLICustomPreference(arg) : undefined
500
+ },
494
501
  'chromium-profile': {
495
502
  describe: 'Path to a custom Chromium profile',
496
503
  demandOption: false,
@@ -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","AMO_BASE_URL","Program","absolutePackageDir","commands","shouldExitProgram","verboseEnabled","options","programArgv","demandedOptions","constructor","argv","process","cwd","slice","yargsInstance","parserConfiguration","strict","wrap","terminalWidth","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","getDemandedOptions","args","err","message","startsWith","configDiscovery","noConfigDiscovery","reload","noReload","input","noInput","ignoreFiles","length","startUrl","checkRequiredArguments","adjustedArgv","cleanupProcessEnvConfigs","systemProcess","cmd","_","toOptionKey","k","replace","separator","filter","optKey","globalOpt","cmdOpt","debug","execute","getVersion","defaultVersionGetter","globalEnv","runCommand","verbose","webextVersion","configFiles","discoveredConfigs","push","config","resolve","niceFileList","map","f","homedir","join","configFileName","configObject","argvFromCLI","error","stack","String","code","cause","exit","packageData","JSON","parse","git","branch","long","throwUsageErrorIfArray","errorMessage","value","Array","isArray","main","runOptions","program","usage","help","alias","recommendCommands","describe","default","requiresArg","type","coerce","arg","normalize","hidden","build","filename","dumpConfig","sign","timeout","channel","run","target","choices","firefox","pref","devtools","lint","output","metadata","pretty","privileged","boring","docs"],"sources":["../src/program.js"],"sourcesContent":["import 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\nexport const AMO_BASE_URL = 'https://addons.mozilla.org/api/v5/';\n\n/*\n * The command line program.\n */\nexport class Program {\n absolutePackageDir;\n yargs;\n commands;\n shouldExitProgram;\n verboseEnabled;\n options;\n programArgv;\n demandedOptions;\n\n constructor(argv, { absolutePackageDir = process.cwd() } = {}) {\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(name, description, executor, commandOptions = {}) {\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) {\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, version) {\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() {\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 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) {\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) {\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 } = {}) {\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, webextVersion: version };\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.debug(\n 'Applying config file' +\n `${configFiles.length !== 1 ? 's' : ''}: ` +\n `${niceFileList}`,\n );\n }\n\n for (const configFileName of configFiles) {\n const configObject = await 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 if (error.cause && adjustedArgv.verbose) {\n log.error(`Error cause: ${error.cause.stack}\\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 definition of type of argument for defaultVersionGetter\n\nexport async function defaultVersionGetter(\n absolutePackageDir,\n { globalEnv = defaultGlobalEnv } = {},\n) {\n if (globalEnv === 'production') {\n log.debug('Getting the version from package.json');\n const packageData = 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\nexport function throwUsageErrorIfArray(errorMessage) {\n return (value) => {\n if (Array.isArray(value)) {\n throw new UsageError(errorMessage);\n }\n return value;\n };\n}\n\nexport async function main(\n absolutePackageDir,\n {\n getVersion = defaultVersionGetter,\n commands = defaultCommands,\n argv,\n runOptions = {},\n } = {},\n) {\n const program = new Program(argv, { absolutePackageDir });\n const version = await getVersion(absolutePackageDir);\n\n // yargs uses magic camel case expansion to expose options on the\n // final argv object. For example, the 'artifacts-dir' option is alternatively\n // available as argv.artifactsDir.\n program.yargs\n .usage(\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 ?? 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 'dump-config',\n 'Run config discovery and dump the resulting config data as JSON',\n commands.dumpConfig,\n {},\n )\n .command(\n 'sign',\n 'Submit the extension to Mozilla Add-ons (AMO) for signing so it can be installed in Firefox',\n commands.sign,\n {\n 'amo-base-url': {\n describe: 'Submission API URL prefix',\n default: AMO_BASE_URL,\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-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 timeout: {\n describe: 'Number of milliseconds to wait before giving up',\n type: 'number',\n },\n 'approval-timeout': {\n describe:\n 'Number of milliseconds to wait for approval before giving up. ' +\n 'Set to 0 to disable waiting for approval. Fallback to `timeout` if not set.',\n type: 'number',\n },\n channel: {\n describe:\n \"The channel for which to sign the addon. Either 'listed' or 'unlisted'.\",\n demandOption: true,\n type: 'string',\n },\n 'amo-metadata': {\n describe:\n 'Path to a JSON file containing an object with metadata to be passed to the API. ' +\n 'See https://addons-server.readthedocs.io/en/latest/topics/api/addons.html for details.',\n type: 'string',\n },\n 'upload-source-code': {\n describe:\n 'Path to an archive file containing human readable source code of this submission, ' +\n 'if the code in --source-dir has been processed to make it unreadable. ' +\n 'See https://extensionworkshop.com/documentation/publish/source-code-submission/ for ' +\n 'details.',\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 (or deved). ' +\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 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 })\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":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,YAAY,QAAQ,IAAI;AAEjC,OAAOC,SAAS,MAAM,WAAW;AACjC,OAAOC,UAAU,MAAM,YAAY;AAC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,EAAE,gCAAgC;MAC1CG,IAAI,EAAE,SAAS;MACfF,OAAO,EAAE;IACX;EACF,CAAC,CAAC,CACDrG,OAAO,CACN,MAAM,EACN,6CAA6C,EAC7ChB,QAAQ,CAAC8I,IAAI,EACb,CAAC,CACH,CAAC;EAEH,OAAO/B,OAAO,CAACvC,OAAO,CAAC;IAAEC,UAAU;IAAE,GAAGqC;EAAW,CAAC,CAAC;AACvD","ignoreList":[]}
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","AMO_BASE_URL","Program","absolutePackageDir","commands","shouldExitProgram","verboseEnabled","options","programArgv","demandedOptions","constructor","argv","process","cwd","slice","yargsInstance","parserConfiguration","strict","wrap","terminalWidth","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","getDemandedOptions","args","err","message","startsWith","configDiscovery","noConfigDiscovery","reload","noReload","input","noInput","ignoreFiles","length","startUrl","checkRequiredArguments","adjustedArgv","cleanupProcessEnvConfigs","systemProcess","cmd","_","toOptionKey","k","replace","separator","filter","optKey","globalOpt","cmdOpt","debug","execute","getVersion","defaultVersionGetter","globalEnv","runCommand","verbose","webextVersion","configFiles","discoveredConfigs","push","config","resolve","niceFileList","map","f","homedir","join","configFileName","configObject","argvFromCLI","error","stack","String","code","cause","exit","packageData","JSON","parse","git","branch","long","throwUsageErrorIfArray","errorMessage","value","Array","isArray","main","runOptions","program","usage","help","alias","recommendCommands","describe","default","requiresArg","type","coerce","arg","normalize","hidden","build","filename","dumpConfig","sign","timeout","channel","run","target","choices","firefox","pref","devtools","lint","output","metadata","pretty","privileged","boring","docs"],"sources":["../src/program.js"],"sourcesContent":["import 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\nexport const AMO_BASE_URL = 'https://addons.mozilla.org/api/v5/';\n\n/*\n * The command line program.\n */\nexport class Program {\n absolutePackageDir;\n yargs;\n commands;\n shouldExitProgram;\n verboseEnabled;\n options;\n programArgv;\n demandedOptions;\n\n constructor(argv, { absolutePackageDir = process.cwd() } = {}) {\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(name, description, executor, commandOptions = {}) {\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) {\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, version) {\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() {\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 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) {\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) {\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 } = {}) {\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, webextVersion: version };\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.debug(\n 'Applying config file' +\n `${configFiles.length !== 1 ? 's' : ''}: ` +\n `${niceFileList}`,\n );\n }\n\n for (const configFileName of configFiles) {\n const configObject = await 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 if (error.cause && adjustedArgv.verbose) {\n log.error(`Error cause: ${error.cause.stack}\\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 definition of type of argument for defaultVersionGetter\n\nexport async function defaultVersionGetter(\n absolutePackageDir,\n { globalEnv = defaultGlobalEnv } = {},\n) {\n if (globalEnv === 'production') {\n log.debug('Getting the version from package.json');\n const packageData = 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\nexport function throwUsageErrorIfArray(errorMessage) {\n return (value) => {\n if (Array.isArray(value)) {\n throw new UsageError(errorMessage);\n }\n return value;\n };\n}\n\nexport async function main(\n absolutePackageDir,\n {\n getVersion = defaultVersionGetter,\n commands = defaultCommands,\n argv,\n runOptions = {},\n } = {},\n) {\n const program = new Program(argv, { absolutePackageDir });\n const version = await getVersion(absolutePackageDir);\n\n // yargs uses magic camel case expansion to expose options on the\n // final argv object. For example, the 'artifacts-dir' option is alternatively\n // available as argv.artifactsDir.\n program.yargs\n .usage(\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 ?? 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 'dump-config',\n 'Run config discovery and dump the resulting config data as JSON',\n commands.dumpConfig,\n {},\n )\n .command(\n 'sign',\n 'Submit the extension to Mozilla Add-ons (AMO) for signing so it can be installed in Firefox',\n commands.sign,\n {\n 'amo-base-url': {\n describe: 'Submission API URL prefix',\n default: AMO_BASE_URL,\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-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 timeout: {\n describe: 'Number of milliseconds to wait before giving up',\n type: 'number',\n },\n 'approval-timeout': {\n describe:\n 'Number of milliseconds to wait for approval before giving up. ' +\n 'Set to 0 to disable waiting for approval. Fallback to `timeout` if not set.',\n type: 'number',\n },\n channel: {\n describe:\n \"The channel for which to sign the addon. Either 'listed' or 'unlisted'.\",\n demandOption: true,\n type: 'string',\n },\n 'amo-metadata': {\n describe:\n 'Path to a JSON file containing an object with metadata to be passed to the API. ' +\n 'See https://addons-server.readthedocs.io/en/latest/topics/api/addons.html for details.',\n type: 'string',\n },\n 'upload-source-code': {\n describe:\n 'Path to an archive file containing human readable source code of this submission, ' +\n 'if the code in --source-dir has been processed to make it unreadable. ' +\n 'See https://extensionworkshop.com/documentation/publish/source-code-submission/ for ' +\n 'details.',\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 (or deved). ' +\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-pref': {\n describe:\n 'Launch chromium with a custom preference ' +\n '(example: --chromium-pref=browser.theme.follows_system_colors=false). ' +\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 '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 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 })\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":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,YAAY,Q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sB,MAAM,EAAE;MACNvB,QAAQ,EAAE,sBAAsB;MAChCG,IAAI,EAAE,SAAS;MACfF,OAAO,EAAE;IACX,CAAC;IACDuB,UAAU,EAAE;MACVxB,QAAQ,EAAE,gDAAgD;MAC1DG,IAAI,EAAE,SAAS;MACfF,OAAO,EAAE;IACX,CAAC;IACD,aAAa,EAAE;MACbD,QAAQ,EACN,6DAA6D,GAC7D,2CAA2C;MAC7CG,IAAI,EAAE,SAAS;MACfF,OAAO,EAAE;IACX,CAAC;IACDwB,MAAM,EAAE;MACNzB,QAAQ,EAAE,gCAAgC;MAC1CG,IAAI,EAAE,SAAS;MACfF,OAAO,EAAE;IACX;EACF,CAAC,CAAC,CACDrG,OAAO,CACN,MAAM,EACN,6CAA6C,EAC7ChB,QAAQ,CAAC8I,IAAI,EACb,CAAC,CACH,CAAC;EAEH,OAAO/B,OAAO,CAACvC,OAAO,CAAC;IAAEC,UAAU;IAAE,GAAGqC;EAAW,CAAC,CAAC;AACvD","ignoreList":[]}
@@ -1,27 +1,2 @@
1
- import defaultNotifier from 'node-notifier';
2
- import { createLogger } from './logger.js';
3
- const defaultLog = createLogger(import.meta.url);
4
- export function showDesktopNotification({
5
- title,
6
- message,
7
- icon
8
- }, {
9
- notifier = defaultNotifier,
10
- log = defaultLog
11
- } = {}) {
12
- return new Promise((resolve, reject) => {
13
- notifier.notify({
14
- title,
15
- message,
16
- icon
17
- }, (err, res) => {
18
- if (err) {
19
- log.debug(`Desktop notifier error: ${err.message},` + ` response: ${res}`);
20
- reject(err);
21
- } else {
22
- resolve();
23
- }
24
- });
25
- });
26
- }
1
+
27
2
  //# sourceMappingURL=desktop-notifier.js.map
@@ -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":["import defaultNotifier from 'node-notifier';\n\nimport { createLogger } from './logger.js';\n\nconst defaultLog = createLogger(import.meta.url);\n\nexport function showDesktopNotification(\n { title, message, icon },\n { notifier = defaultNotifier, log = defaultLog } = {},\n) {\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":"AAAA,OAAOA,eAAe,MAAM,eAAe;AAE3C,SAASC,YAAY,QAAQ,aAAa;AAE1C,MAAMC,UAAU,GAAGD,YAAY,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAEhD,OAAO,SAASC,uBAAuBA,CACrC;EAAEC,KAAK;EAAEC,OAAO;EAAEC;AAAK,CAAC,EACxB;EAAEC,QAAQ,GAAGV,eAAe;EAAEW,GAAG,GAAGT;AAAW,CAAC,GAAG,CAAC,CAAC,EACrD;EACA,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,CACP,2BAA2BF,GAAG,CAACR,OAAO,GAAG,GAAG,cAAcS,GAAG,EAC/D,CAAC;QACDH,MAAM,CAACE,GAAG,CAAC;MACb,CAAC,MAAM;QACLH,OAAO,CAAC,CAAC;MACX;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"desktop-notifier.js","names":[],"sources":["../../src/util/desktop-notifier.js"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Given an object where the keys are the flattened path to a
3
+ * preference, and the value is the value to set at that path, return
4
+ * an object where the paths are fully expanded.
5
+ */
6
+ export default function expandPrefs(prefs) {
7
+ const prefsMap = new Map();
8
+ for (const [key, value] of Object.entries(prefs)) {
9
+ let submap = prefsMap;
10
+ const props = key.split('.');
11
+ const lastProp = props.pop();
12
+ for (const prop of props) {
13
+ if (!submap.has(prop)) {
14
+ submap.set(prop, new Map());
15
+ }
16
+ submap = submap.get(prop);
17
+ if (!(submap instanceof Map)) {
18
+ throw new Error(`Cannot set ${key} because a value already exists at ${prop}`);
19
+ }
20
+ }
21
+ submap.set(lastProp, value);
22
+ }
23
+ return mapToObject(prefsMap);
24
+ }
25
+ function mapToObject(map) {
26
+ return Object.fromEntries(Array.from(map, ([k, v]) => [k, v instanceof Map ? mapToObject(v) : v]));
27
+ }
28
+ //# sourceMappingURL=expand-prefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expand-prefs.js","names":["expandPrefs","prefs","prefsMap","Map","key","value","Object","entries","submap","props","split","lastProp","pop","prop","has","set","get","Error","mapToObject","map","fromEntries","Array","from","k","v"],"sources":["../../src/util/expand-prefs.js"],"sourcesContent":["/**\n * Given an object where the keys are the flattened path to a\n * preference, and the value is the value to set at that path, return\n * an object where the paths are fully expanded.\n */\nexport default function expandPrefs(prefs) {\n const prefsMap = new Map();\n\n for (const [key, value] of Object.entries(prefs)) {\n let submap = prefsMap;\n const props = key.split('.');\n const lastProp = props.pop();\n\n for (const prop of props) {\n if (!submap.has(prop)) {\n submap.set(prop, new Map());\n }\n\n submap = submap.get(prop);\n\n if (!(submap instanceof Map)) {\n throw new Error(\n `Cannot set ${key} because a value already exists at ${prop}`,\n );\n }\n }\n submap.set(lastProp, value);\n }\n return mapToObject(prefsMap);\n}\n\nfunction mapToObject(map) {\n return Object.fromEntries(\n Array.from(map, ([k, v]) => [k, v instanceof Map ? mapToObject(v) : v]),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,WAAWA,CAACC,KAAK,EAAE;EACzC,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC;EAE1B,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;IAChD,IAAIO,MAAM,GAAGN,QAAQ;IACrB,MAAMO,KAAK,GAAGL,GAAG,CAACM,KAAK,CAAC,GAAG,CAAC;IAC5B,MAAMC,QAAQ,GAAGF,KAAK,CAACG,GAAG,CAAC,CAAC;IAE5B,KAAK,MAAMC,IAAI,IAAIJ,KAAK,EAAE;MACxB,IAAI,CAACD,MAAM,CAACM,GAAG,CAACD,IAAI,CAAC,EAAE;QACrBL,MAAM,CAACO,GAAG,CAACF,IAAI,EAAE,IAAIV,GAAG,CAAC,CAAC,CAAC;MAC7B;MAEAK,MAAM,GAAGA,MAAM,CAACQ,GAAG,CAACH,IAAI,CAAC;MAEzB,IAAI,EAAEL,MAAM,YAAYL,GAAG,CAAC,EAAE;QAC5B,MAAM,IAAIc,KAAK,CACb,cAAcb,GAAG,sCAAsCS,IAAI,EAC7D,CAAC;MACH;IACF;IACAL,MAAM,CAACO,GAAG,CAACJ,QAAQ,EAAEN,KAAK,CAAC;EAC7B;EACA,OAAOa,WAAW,CAAChB,QAAQ,CAAC;AAC9B;AAEA,SAASgB,WAAWA,CAACC,GAAG,EAAE;EACxB,OAAOb,MAAM,CAACc,WAAW,CACvBC,KAAK,CAACC,IAAI,CAACH,GAAG,EAAE,CAAC,CAACI,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACD,CAAC,EAAEC,CAAC,YAAYrB,GAAG,GAAGe,WAAW,CAACM,CAAC,CAAC,GAAGA,CAAC,CAAC,CACxE,CAAC;AACH","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-ext",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "A command line tool to help build, run, and test web extensions",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "@babel/runtime": "7.29.2",
63
63
  "@devicefarmer/adbkit": "3.3.8",
64
- "addons-linter": "10.3.0",
64
+ "addons-linter": "10.5.0",
65
65
  "camelcase": "8.0.0",
66
66
  "chrome-launcher": "1.2.0",
67
67
  "debounce": "1.2.1",
@@ -73,7 +73,6 @@
73
73
  "jose": "5.9.6",
74
74
  "jszip": "3.10.1",
75
75
  "multimatch": "6.0.0",
76
- "node-notifier": "10.0.1",
77
76
  "open": "11.0.0",
78
77
  "parse-json": "8.3.0",
79
78
  "pino": "10.3.1",
@@ -91,34 +90,34 @@
91
90
  "@babel/cli": "7.28.6",
92
91
  "@babel/core": "7.29.0",
93
92
  "@babel/eslint-parser": "7.28.6",
94
- "@babel/preset-env": "7.29.2",
95
- "@babel/register": "7.28.6",
96
- "@commitlint/cli": "20.5.0",
97
- "@commitlint/config-conventional": "20.5.0",
98
- "@eslint/compat": "2.0.3",
93
+ "@babel/preset-env": "7.29.5",
94
+ "@babel/register": "7.29.3",
95
+ "@commitlint/cli": "21.0.1",
96
+ "@commitlint/config-conventional": "21.0.1",
97
+ "@eslint/compat": "2.1.0",
99
98
  "@eslint/eslintrc": "3.3.5",
100
99
  "@eslint/js": "9.39.2",
101
- "babel-plugin-istanbul": "7.0.1",
100
+ "babel-plugin-istanbul": "8.0.0",
102
101
  "babel-plugin-transform-inline-environment-variables": "0.4.4",
103
102
  "chai": "6.2.2",
104
103
  "chai-as-promised": "8.0.2",
105
104
  "copy-dir": "1.3.0",
106
105
  "crc-32": "1.2.2",
107
- "cross-env": "10.0.0",
106
+ "cross-env": "10.1.0",
108
107
  "deepcopy": "2.1.0",
109
108
  "eslint": "9.39.0",
110
109
  "eslint-plugin-import": "2.32.0",
111
- "fs-extra": "11.3.4",
110
+ "fs-extra": "11.3.5",
112
111
  "git-rev-sync": "3.0.2",
113
- "globals": "17.4.0",
112
+ "globals": "17.6.0",
114
113
  "html-entities": "2.6.0",
115
114
  "mocha": "11.7.5",
116
115
  "nyc": "18.0.0",
117
- "prettier": "3.8.1",
116
+ "prettier": "3.8.3",
118
117
  "pretty-quick": "4.2.2",
119
118
  "prettyjson": "1.2.5",
120
119
  "shelljs": "0.8.5",
121
- "sinon": "21.0.3",
120
+ "sinon": "22.0.0",
122
121
  "testdouble": "3.20.2",
123
122
  "yauzl": "2.10.0"
124
123
  },