extension 4.0.16 → 4.0.17

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/49.cjs CHANGED
@@ -187,6 +187,7 @@ exports.modules = {
187
187
  });
188
188
  var external_node_fs_ = __webpack_require__("node:fs");
189
189
  var external_node_path_ = __webpack_require__("node:path");
190
+ var messaging = __webpack_require__("./helpers/messaging.ts");
190
191
  var banner = __webpack_require__("./browsers/browsers-lib/banner.ts");
191
192
  var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
192
193
  var ready_stamp = __webpack_require__("./browsers/browsers-lib/ready-stamp.ts");
@@ -245,7 +246,7 @@ exports.modules = {
245
246
  ];
246
247
  class CDPClient {
247
248
  isDev() {
248
- return 'true' === process.env.EXTENSION_AUTHOR_MODE;
249
+ return (0, messaging._o)();
249
250
  }
250
251
  async connect() {
251
252
  try {
@@ -257,12 +258,7 @@ exports.modules = {
257
258
  this.pendingRequests.forEach(({ reject, timeout }, id)=>{
258
259
  try {
259
260
  reject(new Error(reason));
260
- } catch (error) {
261
- if (this.isDev()) {
262
- const err = error;
263
- console.warn(messages.r0(String(err.message || err)));
264
- }
265
- }
261
+ } catch {}
266
262
  if (timeout) clearTimeout(timeout);
267
263
  this.pendingRequests.delete(id);
268
264
  });
@@ -386,12 +382,7 @@ exports.modules = {
386
382
  if (this.isDev()) console.log(messages.p8(String(params.sessionId || ''), String(params.targetInfo?.type || '')));
387
383
  }
388
384
  for (const eventCallback of this.eventCallbacks)eventCallback(message);
389
- } catch (error) {
390
- if (this.isDev()) {
391
- const err = error;
392
- console.warn(messages.xx(String(err.message || err)));
393
- }
394
- }
385
+ } catch {}
395
386
  }
396
387
  async sendCommand(method, params = {}, sessionId, timeoutMs = constants.Ns) {
397
388
  return new Promise((resolve, reject)=>{
@@ -540,7 +531,7 @@ exports.modules = {
540
531
  cdp.disconnect();
541
532
  const retryable = isRecoverableBootstrapError(error);
542
533
  const hasMoreAttempts = attempt < maxBootstrapAttempts;
543
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
534
+ if ((0, messaging._o)()) {
544
535
  const base = String(error?.message || error);
545
536
  console.warn(`[CDP] bootstrap attempt ${attempt}/${maxBootstrapAttempts} failed: ${base}`);
546
537
  }
@@ -750,9 +741,7 @@ exports.modules = {
750
741
  });
751
742
  }
752
743
  }
753
- } catch (error) {
754
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(messages.KK(String(error?.message || error)));
755
- }
744
+ } catch {}
756
745
  });
757
746
  }
758
747
  var cdp_extension_controller_ownership = __webpack_require__("./browsers/run-chromium/cdp/cdp-extension-controller/ownership.ts");
@@ -908,7 +897,7 @@ exports.modules = {
908
897
  name = String(manifest?.name || '') || void 0;
909
898
  version = String(manifest?.version || '') || void 0;
910
899
  } catch (e2) {
911
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] Fallback manifest read failed:', String(e2?.message || e2));
900
+ if ((0, messaging._o)()) console.warn('[CDP] Fallback manifest read failed:', String(e2?.message || e2));
912
901
  }
913
902
  }
914
903
  return {
@@ -940,9 +929,7 @@ exports.modules = {
940
929
  flatten: true,
941
930
  filter: EXTENSION_AUTO_ATTACH_FILTER
942
931
  });
943
- } catch (error) {
944
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(messages.wX(String(error?.message || error)));
945
- }
932
+ } catch {}
946
933
  registerAutoEnableLogging(this.cdp, ()=>this.extensionId, this.logSink);
947
934
  }
948
935
  onProtocolEvent(cb) {
@@ -1000,7 +987,7 @@ exports.modules = {
1000
987
  } catch {}
1001
988
  });
1002
989
  } catch (e) {
1003
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] enableLogging failed:', String(e));
990
+ if ((0, messaging._o)()) console.warn('[CDP] enableLogging failed:', String(e));
1004
991
  }
1005
992
  }
1006
993
  async getInfoBestEffort() {
@@ -1079,7 +1066,7 @@ exports.modules = {
1079
1066
  const chromeRemoteDebugPort = remoteDebugPortFlag ? parseInt(remoteDebugPortFlag.split('=')[1], 10) : (0, shared_utils.jl)(plugin.port, plugin.instanceId);
1080
1067
  const userDataDirFlag = chromiumArgs.find((flag)=>flag.startsWith('--user-data-dir='));
1081
1068
  const userDataDir = userDataDirFlag ? userDataDirFlag.replace('--user-data-dir=', '').replace(/^"|"$/g, '') : '';
1082
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
1069
+ if ((0, messaging._o)()) {
1083
1070
  if (userDataDir) console.log(messages.aI(userDataDir));
1084
1071
  console.log(messages.CY(chromeRemoteDebugPort, chromeRemoteDebugPort));
1085
1072
  }
@@ -1094,7 +1081,7 @@ exports.modules = {
1094
1081
  logSink: plugin.logSink
1095
1082
  });
1096
1083
  await cdpExtensionController.connect();
1097
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages.M3('127.0.0.1', chromeRemoteDebugPort));
1084
+ if ((0, messaging._o)()) console.log(messages.M3('127.0.0.1', chromeRemoteDebugPort));
1098
1085
  try {
1099
1086
  if (extensionOutputPath && Number.isFinite(chromeRemoteDebugPort)) {
1100
1087
  const readyPath = external_node_path_.join(external_node_path_.dirname(extensionOutputPath), 'extension-js', external_node_path_.basename(extensionOutputPath), 'ready.json');
@@ -1171,7 +1158,7 @@ exports.modules = {
1171
1158
  })
1172
1159
  ]);
1173
1160
  } catch (error) {
1174
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(`[CDP] ensureLoaded failed: ${String(error?.message || error)}`);
1161
+ if ((0, messaging._o)()) console.warn(`[CDP] ensureLoaded failed: ${String(error?.message || error)}`);
1175
1162
  }
1176
1163
  try {
1177
1164
  if ('development' === mode) {
@@ -1211,7 +1198,7 @@ exports.modules = {
1211
1198
  });
1212
1199
  }
1213
1200
  } catch (bannerErr) {
1214
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(messages.$w(String(bannerErr)));
1201
+ if ((0, messaging._o)()) console.warn(messages.$w(String(bannerErr)));
1215
1202
  try {
1216
1203
  const mode = compilation?.options?.mode || 'development';
1217
1204
  if ('production' === mode) await (0, banner.MK)({