extension 3.18.2 → 3.18.3-canary.local-2fe00f589e

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/dist/browsers.cjs CHANGED
@@ -4130,6 +4130,8 @@ var __webpack_modules__ = {
4130
4130
  const client = new MessagingClient();
4131
4131
  await client.connect(port);
4132
4132
  this.client = client;
4133
+ this.invalidateConnectionScopedCaches();
4134
+ client.on('reconnected', ()=>this.invalidateConnectionScopedCaches());
4133
4135
  return client;
4134
4136
  } catch (error) {
4135
4137
  if (isErrorWithCode('ECONNREFUSED', error)) {
@@ -4144,6 +4146,10 @@ var __webpack_modules__ = {
4144
4146
  console.error(messages.MSw(this.options.browser));
4145
4147
  throw lastError;
4146
4148
  }
4149
+ invalidateConnectionScopedCaches() {
4150
+ this.cachedAddonsActor = void 0;
4151
+ this.cachedSupportsReload = null;
4152
+ }
4147
4153
  async installAddons(compilation) {
4148
4154
  const { devtools } = this.options;
4149
4155
  const rawExtensions = (0, runtime_options.fT)(this.options.extension);
package/dist/cli.cjs CHANGED
@@ -4203,6 +4203,8 @@ var __webpack_modules__ = {
4203
4203
  const client = new MessagingClient();
4204
4204
  await client.connect(port);
4205
4205
  this.client = client;
4206
+ this.invalidateConnectionScopedCaches();
4207
+ client.on('reconnected', ()=>this.invalidateConnectionScopedCaches());
4206
4208
  return client;
4207
4209
  } catch (error) {
4208
4210
  if (isErrorWithCode('ECONNREFUSED', error)) {
@@ -4217,6 +4219,10 @@ var __webpack_modules__ = {
4217
4219
  console.error(messages.MSw(this.options.browser));
4218
4220
  throw lastError;
4219
4221
  }
4222
+ invalidateConnectionScopedCaches() {
4223
+ this.cachedAddonsActor = void 0;
4224
+ this.cachedSupportsReload = null;
4225
+ }
4220
4226
  async installAddons(compilation) {
4221
4227
  const { devtools } = this.options;
4222
4228
  const rawExtensions = (0, runtime_options.fT)(this.options.extension);
@@ -5802,7 +5808,7 @@ var __webpack_modules__ = {
5802
5808
  eval: 'Evaluates an expression in a running extension context (requires --allow-eval)',
5803
5809
  storage: 'Reads or writes chrome.storage in a running extension (requires --allow-control)',
5804
5810
  reload: 'Reloads a running extension or tab (requires --allow-control)',
5805
- open: 'Opens an extension surface — popup, options, or sidebar (requires --allow-control)',
5811
+ open: 'Opens an extension surface — popup, options, sidebar, action, or command (requires --allow-control)',
5806
5812
  inspect: 'Inspects a page/content DOM via the agent bridge (CDP-free; requires --allow-control)',
5807
5813
  publish: 'Publishes to extension.dev and prints a shareable URL (requires EXTENSION_DEV_TOKEN)',
5808
5814
  install: 'Installs a managed browser binary into Extension.js cache',
@@ -6561,6 +6567,9 @@ Cross-Browser Compatibility
6561
6567
  else obj[key] = value;
6562
6568
  return obj;
6563
6569
  }
6570
+ function sanitizeTag(value) {
6571
+ return String(value).trim().replace(/[^a-zA-Z0-9._-]/g, '').slice(0, 64);
6572
+ }
6564
6573
  const DEFAULT_SAMPLE_RATE = Number(process.env.EXTENSION_TELEMETRY_SAMPLE_RATE || 0.2);
6565
6574
  const DEFAULT_MAX_EVENTS = Number(process.env.EXTENSION_TELEMETRY_MAX_EVENTS || 3);
6566
6575
  const DEFAULT_DEBOUNCE_MS = Number(process.env.EXTENSION_TELEMETRY_DEBOUNCE_MS || 60000);
@@ -6710,6 +6719,8 @@ Cross-Browser Compatibility
6710
6719
  success: Boolean(props.success),
6711
6720
  version: String(props.version ?? this.version).slice(0, 32)
6712
6721
  };
6722
+ if (props.template) enforcedProps.template = sanitizeTag(props.template);
6723
+ if (props.source) enforcedProps.source = sanitizeTag(props.source);
6713
6724
  const payload = {
6714
6725
  event,
6715
6726
  properties: {
@@ -6721,7 +6732,7 @@ Cross-Browser Compatibility
6721
6732
  distinct_id: this.anonId
6722
6733
  };
6723
6734
  this.writeAudit(payload);
6724
- if ('command_executed' === event && Math.random() > this.sampleRate) return;
6735
+ if ('command_executed' === event && 'create' !== props.command && Math.random() > this.sampleRate) return;
6725
6736
  if (!this.apiKey || !this.host) return;
6726
6737
  this.buffer.push(payload);
6727
6738
  this.sent += 1;
@@ -6826,6 +6837,30 @@ Cross-Browser Compatibility
6826
6837
  }
6827
6838
  return 'unknown';
6828
6839
  }
6840
+ function readArgValue(argv, names) {
6841
+ for(let i = 2; i < argv.length; i += 1){
6842
+ const arg = argv[i];
6843
+ if (arg) for (const name of names){
6844
+ if (arg === name) {
6845
+ const next = argv[i + 1];
6846
+ return next && !next.startsWith('-') ? next : void 0;
6847
+ }
6848
+ if (arg.startsWith(`${name}=`)) return arg.slice(name.length + 1);
6849
+ }
6850
+ }
6851
+ }
6852
+ function commandContext(command) {
6853
+ if ('create' !== command) return {};
6854
+ return {
6855
+ template: readArgValue(process.argv, [
6856
+ '--template',
6857
+ '-t'
6858
+ ]),
6859
+ source: readArgValue(process.argv, [
6860
+ '--source'
6861
+ ]) || 'cli'
6862
+ };
6863
+ }
6829
6864
  const consent = resolveTelemetryConsent(process.argv);
6830
6865
  const invoked = detectInvokedCommand(process.argv);
6831
6866
  const telemetry_cli_version = getCliPackageJson().version;
@@ -6856,7 +6891,8 @@ Cross-Browser Compatibility
6856
6891
  telemetry.track('command_executed', {
6857
6892
  command,
6858
6893
  success: true,
6859
- version: telemetry_cli_version
6894
+ version: telemetry_cli_version,
6895
+ ...commandContext(command)
6860
6896
  });
6861
6897
  }
6862
6898
  function markCommandFailure(command = invoked) {
@@ -6864,7 +6900,8 @@ Cross-Browser Compatibility
6864
6900
  telemetry.track('command_failed', {
6865
6901
  command,
6866
6902
  success: false,
6867
- version: telemetry_cli_version
6903
+ version: telemetry_cli_version,
6904
+ ...commandContext(command)
6868
6905
  });
6869
6906
  }
6870
6907
  function printOptOutNoticeIfFirstRun() {
@@ -6929,7 +6966,7 @@ Cross-Browser Compatibility
6929
6966
  }
6930
6967
  const create_require = (0, external_module_.createRequire)(__rslib_import_meta_url__);
6931
6968
  function registerCreateCommand(program) {
6932
- program.command('create').arguments('<project-name|project-path>').usage('create <project-name|project-path> [options]').description(commandDescriptions.create).option('-t, --template <template-name>', 'specify a template for the created project').option('--install [boolean]', 'whether or not to install the dependencies after creating the project (disabled by default — pass --install to opt in)', parseOptionalBoolean, false).action(async function(pathOrRemoteUrl, { template, install }) {
6969
+ program.command('create').arguments('<project-name|project-path>').usage('create <project-name|project-path> [options]').description(commandDescriptions.create).option('-t, --template <template-name>', 'specify a template for the created project').option('--install [boolean]', 'whether or not to install the dependencies after creating the project (disabled by default — pass --install to opt in)', parseOptionalBoolean, false).option('--source <source>', 'attribution tag for where this create was initiated (e.g. cli, templates); recorded in anonymous telemetry only').action(async function(pathOrRemoteUrl, { template, install }) {
6933
6970
  if (!process.env.EXTENSION_CREATE_DEVELOP_ROOT) try {
6934
6971
  process.env.EXTENSION_CREATE_DEVELOP_ROOT = resolveExtensionDevelopRoot();
6935
6972
  } catch {
@@ -7998,22 +8035,28 @@ Cross-Browser Compatibility
7998
8035
  } : void 0
7999
8036
  });
8000
8037
  });
8001
- commonOptions(program.command('open').arguments('<surface> [project-path]').description('Open an extension surface — popup, options, or sidebar (requires --allow-control)')).action(async function(surface, projectPathArg, opts) {
8038
+ commonOptions(program.command('open').arguments('<surface> [project-path]').description('Open an extension surface — popup, options, sidebar, action, or command (requires --allow-control)').option('--name <command>', 'with `open command`: the chrome.commands name to trigger')).action(async function(surface, projectPathArg, opts) {
8002
8039
  const allowed = [
8003
8040
  'popup',
8004
8041
  'options',
8005
- 'sidebar'
8042
+ 'sidebar',
8043
+ 'action',
8044
+ 'command'
8006
8045
  ];
8007
- if (!allowed.includes(surface)) fail(`unknown surface: ${surface} (use popup, options, or sidebar)`);
8046
+ if (!allowed.includes(surface)) fail(`unknown surface: ${surface} (use popup, options, sidebar, action, or command)`);
8047
+ const inBackground = 'action' === surface || 'command' === surface;
8048
+ const context = inBackground ? 'background' : surface;
8049
+ const args = {
8050
+ surface
8051
+ };
8052
+ if ('command' === surface && opts.name) args.name = opts.name;
8008
8053
  await runCommand({
8009
8054
  projectPathArg,
8010
8055
  op: 'open',
8011
8056
  target: {
8012
- context: surface
8013
- },
8014
- args: {
8015
- surface
8057
+ context
8016
8058
  },
8059
+ args,
8017
8060
  opts
8018
8061
  });
8019
8062
  });
@@ -29,6 +29,12 @@ export declare class RemoteFirefox {
29
29
  });
30
30
  private resolveRdpPort;
31
31
  private connectClient;
32
+ /**
33
+ * Drop caches that are only valid for the current RDP connection. Actor IDs
34
+ * (addonsActor and its probed capability) belong to a specific Firefox
35
+ * connection; once we reconnect they must be re-resolved via getRoot.
36
+ */
37
+ private invalidateConnectionScopedCaches;
32
38
  installAddons(compilation: CompilationLike): Promise<void>;
33
39
  markNeedsReinstall(): void;
34
40
  private ensureCapabilities;
@@ -17,7 +17,7 @@ export declare const commandDescriptions: {
17
17
  readonly eval: "Evaluates an expression in a running extension context (requires --allow-eval)";
18
18
  readonly storage: "Reads or writes chrome.storage in a running extension (requires --allow-control)";
19
19
  readonly reload: "Reloads a running extension or tab (requires --allow-control)";
20
- readonly open: "Opens an extension surface — popup, options, or sidebar (requires --allow-control)";
20
+ readonly open: "Opens an extension surface — popup, options, sidebar, action, or command (requires --allow-control)";
21
21
  readonly inspect: "Inspects a page/content DOM via the agent bridge (CDP-free; requires --allow-control)";
22
22
  readonly publish: "Publishes to extension.dev and prints a shareable URL (requires EXTENSION_DEV_TOKEN)";
23
23
  readonly install: "Installs a managed browser binary into Extension.js cache";
@@ -3,6 +3,8 @@ export type TelemetryProps = {
3
3
  command: string;
4
4
  success: boolean;
5
5
  version: string;
6
+ template?: string;
7
+ source?: string;
6
8
  };
7
9
  export type TelemetrySource = 'env' | 'flag' | 'config' | 'default';
8
10
  type TelemetryInit = {
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "extension": "./bin/extension.cjs"
39
39
  },
40
40
  "name": "extension",
41
- "version": "3.18.2",
41
+ "version": "3.18.3-canary.local-2fe00f589e",
42
42
  "description": "Create cross-browser extensions with no build configuration.",
43
43
  "homepage": "https://extension.js.org/",
44
44
  "bugs": {
@@ -100,9 +100,9 @@
100
100
  "cross-spawn": "^7.0.6",
101
101
  "edge-location": "2.2.0",
102
102
  "firefox-location2": "3.0.0",
103
- "extension-create": "3.18.2",
104
- "extension-develop": "3.18.2",
105
- "extension-install": "3.18.2",
103
+ "extension-create": "3.18.3-canary.local-2fe00f589e",
104
+ "extension-develop": "3.18.3-canary.local-2fe00f589e",
105
+ "extension-install": "3.18.3-canary.local-2fe00f589e",
106
106
  "commander": "^14.0.3",
107
107
  "pintor": "0.3.0",
108
108
  "semver": "^7.7.3",