extension-develop 4.0.14-canary.1784584351.6a165dda → 4.0.14

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.
Files changed (50) hide show
  1. package/dist/0~rspack-config.mjs +9 -5
  2. package/dist/101.mjs +2 -2
  3. package/dist/494.mjs +1 -1
  4. package/dist/839.mjs +162 -54
  5. package/dist/dev-server/cleanup.d.ts +0 -8
  6. package/dist/dev-server/control-bridge/broker.d.ts +0 -63
  7. package/dist/dev-server/control-bridge/contracts.d.ts +0 -11
  8. package/dist/dev-server/control-bridge/producer-runtime.d.ts +2 -2
  9. package/dist/dev-server/control-bridge/session-token.d.ts +0 -13
  10. package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
  11. package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +4 -4
  12. package/dist/extension-js-devtools/chrome/pages/welcome.js +1 -1
  13. package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
  14. package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +4 -4
  15. package/dist/extension-js-devtools/chromium/pages/welcome.js +1 -1
  16. package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
  17. package/dist/extension-js-devtools/edge/pages/centralized-logger.js +4 -4
  18. package/dist/extension-js-devtools/edge/pages/welcome.js +1 -1
  19. package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
  20. package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +4 -4
  21. package/dist/extension-js-devtools/firefox/pages/welcome.js +1 -1
  22. package/dist/feature-scripts-classic-concat-loader.js +3 -1
  23. package/dist/feature-scripts-classic-concat-loader.mjs +3 -1
  24. package/dist/feature-scripts-content-script-wrapper.js +14 -2
  25. package/dist/feature-scripts-content-script-wrapper.mjs +14 -2
  26. package/dist/lib/build-summary.d.ts +1 -1
  27. package/dist/lib/package-manager.d.ts +0 -28
  28. package/dist/lib/parse-json-safe.d.ts +0 -11
  29. package/dist/lib/project-manifest.d.ts +0 -43
  30. package/dist/lib/session-paths.d.ts +0 -16
  31. package/dist/plugin-compilation/env.d.ts +0 -8
  32. package/dist/plugin-css/css-lib/inject-css-link.d.ts +0 -12
  33. package/dist/plugin-css/css-lib/resolve-css-asset.d.ts +0 -7
  34. package/dist/plugin-css/css-tools/less.d.ts +0 -5
  35. package/dist/plugin-css/css-tools/sass.d.ts +0 -6
  36. package/dist/plugin-css/index.d.ts +0 -13
  37. package/dist/plugin-reload/reload-dispatch.d.ts +0 -27
  38. package/dist/plugin-reload/reload-lib/scripts-replay-shim.d.ts +0 -18
  39. package/dist/plugin-reload/steps/inject-bridge-producer.d.ts +0 -10
  40. package/dist/plugin-reload/steps/inject-scripts-replay-shim.d.ts +0 -6
  41. package/dist/plugin-reload/steps/prune-stale-hot-updates.d.ts +0 -14
  42. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +0 -4
  43. package/dist/plugin-web-extension/feature-manifest/steps/patch-chromium-background.d.ts +0 -13
  44. package/dist/plugin-web-extension/feature-manifest/steps/patch-dev-content-script-manifest-paths.d.ts +0 -8
  45. package/dist/plugin-web-extension/feature-manifest/steps/patch-gecko-background.d.ts +0 -13
  46. package/dist/plugin-web-extension/feature-scripts/steps/keep-geturl-imports-native.d.ts +0 -8
  47. package/dist/plugin-web-extension/feature-scripts/steps/validate-content-script-syntax.d.ts +0 -14
  48. package/dist/plugin-web-extension/shared/classic-concat.d.ts +0 -16
  49. package/dist/types.d.ts +2 -3
  50. package/package.json +2 -2
@@ -675,7 +675,7 @@ class ZipPlugin {
675
675
  if (manifest.default_locale) {
676
676
  const localeRoot = this.zipData.zipSource ? packageJsonDir : outPath;
677
677
  const messagesPath = __rspack_external_node_path_c5b9b54f.join(localeRoot, '_locales', String(manifest.default_locale), 'messages.json');
678
- if (!__rspack_external_node_fs_5ea92f0c.existsSync(messagesPath)) stats?.compilation?.warnings?.push(new Error(`ZipPlugin: manifest.json declares default_locale "${String(manifest.default_locale)}" but ${messagesPath} does not exist. Stores reject packages without their default locale restore the _locales folder before shipping this zip.`));
678
+ if (!__rspack_external_node_fs_5ea92f0c.existsSync(messagesPath)) stats?.compilation?.warnings?.push(new Error(`ZipPlugin: manifest.json declares default_locale "${String(manifest.default_locale)}" but ${messagesPath} does not exist. Stores reject packages without their default locale: restore the _locales folder before shipping this zip.`));
679
679
  }
680
680
  const base = sanitize(resolveManifestName(manifest.name, manifest, [
681
681
  outPath,
@@ -4247,7 +4247,7 @@ function javaScriptError(errorSourcePath, missingFilePath, opts) {
4247
4247
  lines.push(`Missing script file in ${pintor.underline(errorSourcePath)}.`);
4248
4248
  lines.push(`Update your ${pintor.yellow("<script>")} src to point to a file that exists.`);
4249
4249
  if (opts?.publicRootHint) lines.push(`Paths starting with '/' are resolved from the extension output root (served from ${pintor.yellow('public/')}), not your source directory.`);
4250
- if (opts?.deadRefHint) lines.push(`The build ships an empty placeholder for this script, so the page loads and no 404 appears in DevTools likely dead code. Set ${pintor.yellow('EXTENSION_STRICT_REFS=true')} to make this a build error.`);
4250
+ if (opts?.deadRefHint) lines.push(`The build ships an empty placeholder for this script, so the page loads and no 404 appears in DevTools (likely dead code). Set ${pintor.yellow('EXTENSION_STRICT_REFS=true')} to make this a build error.`);
4251
4251
  lines.push('');
4252
4252
  lines.push(`${pintor.red('NOT FOUND')} ${pintor.underline(missingFilePath)}`);
4253
4253
  return lines.join('\n');
@@ -6388,7 +6388,7 @@ class ApplyDevDefaults {
6388
6388
  const uses = findInjectedOnlyPermissionUses(compilation, declared, injectedForEra);
6389
6389
  for (const [api, file] of uses){
6390
6390
  const WebpackErrorCtor = compiler.rspack?.WebpackError;
6391
- const text = `manifest.json does not declare the "${api}" permission, but ${__rspack_external_path.relative(__rspack_external_path.dirname(this.manifestPath), file)} uses chrome.${api}. It works in development only because the dev instrumentation injects "${api}" the production build will fail at runtime. Add "${api}" to permissions in manifest.json.`;
6391
+ const text = `manifest.json does not declare the "${api}" permission, but ${__rspack_external_path.relative(__rspack_external_path.dirname(this.manifestPath), file)} uses chrome.${api}. It works in development only because the dev instrumentation injects "${api}": the production build will fail at runtime. Add "${api}" to permissions in manifest.json.`;
6392
6392
  const warning = WebpackErrorCtor ? new WebpackErrorCtor(text) : new Error(text);
6393
6393
  warning.name = 'DevInjectedPermissionWarning';
6394
6394
  compilation.warnings.push(warning);
@@ -7608,8 +7608,12 @@ class AddContentScriptWrapper {
7608
7608
  }
7609
7609
  }
7610
7610
  const basic = [
7611
- 'var isBrowser = !!(() => { try { return globalThis.browser.runtime.getURL("/") } catch(e) {} })()',
7612
- 'var isChrome = !!(() => { try { return globalThis.chrome.runtime.getURL("/") } catch(e) {} })()'
7611
+ `var isBrowser = !!(() => { try { return globalThis.browser.runtime.getURL("/") } catch(e) {
7612
+ // Ignore
7613
+ } })()`,
7614
+ `var isChrome = !!(() => { try { return globalThis.chrome.runtime.getURL("/") } catch(e) {
7615
+ // Ignore
7616
+ } })()`
7613
7617
  ];
7614
7618
  const weakRuntimeCheck = [
7615
7619
  ...basic,
package/dist/101.mjs CHANGED
@@ -698,7 +698,7 @@ async function config_loader_isUsingExperimentalConfig(projectPath) {
698
698
  }
699
699
  return false;
700
700
  }
701
- var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.14-canary.1784584351.6a165dda","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.26","acorn":"^8.16.0","adm-zip":"^0.6.0","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.10","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
701
+ var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.14","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.26","acorn":"^8.16.0","adm-zip":"^0.6.0","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.10","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
702
702
  function asAbsolute(p) {
703
703
  return __rspack_external_node_path_c5b9b54f.isAbsolute(p) ? p : __rspack_external_node_path_c5b9b54f.resolve(p);
704
704
  }
@@ -1878,7 +1878,7 @@ function createPlaywrightMetadataWriter(options) {
1878
1878
  return null;
1879
1879
  }
1880
1880
  })();
1881
- if (foreignLiveDevSession) console.warn(`[extension] a live dev session (pid ${foreignLiveDevSession.pid}) owns ${readyPath}; this ${options.command} run will not rewrite the session's ready.json/events.ndjson. The output dir is shared, so the dev browser may pick up freshly ${options.command}-built files stop the dev session first for a clean ${options.command} receipt.`);
1881
+ if (foreignLiveDevSession) console.warn(`[extension] a live dev session (pid ${foreignLiveDevSession.pid}) owns ${readyPath}; this ${options.command} run will not rewrite the session's ready.json/events.ndjson. The output dir is shared, so the dev browser may pick up freshly ${options.command}-built files. Stop the dev session first for a clean ${options.command} receipt.`);
1882
1882
  const base = {
1883
1883
  schemaVersion: 2,
1884
1884
  command: options.command,
package/dist/494.mjs CHANGED
@@ -19,7 +19,7 @@ function legacyControlTokenPath(projectPath) {
19
19
  function sessionArtifactsRootDir(projectPath) {
20
20
  return __rspack_external_node_path_c5b9b54f.resolve(projectPath, 'dist', 'extension-js');
21
21
  }
22
- const SESSION_ARTIFACTS_IGNORE_CONTENT = "# Extension.js session state: managed browser profiles (cookies, history,\n# logins), session logs and machine contracts. Personal data lives here —\n# this directory must never be committed or shipped.\n*\n";
22
+ const SESSION_ARTIFACTS_IGNORE_CONTENT = "# Extension.js session state: managed browser profiles (cookies, history,\n# logins), session logs and machine contracts. Personal data lives here:\n# this directory must never be committed or shipped.\n*\n";
23
23
  function sessionArtifactsIgnoreFilePath(projectPath) {
24
24
  return __rspack_external_node_path_c5b9b54f.join(sessionArtifactsRootDir(projectPath), '.gitignore');
25
25
  }
package/dist/839.mjs CHANGED
@@ -888,12 +888,16 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
888
888
  var s = safeValue(value);
889
889
  var frame = {type: "result", cmdId: cmdId, ok: true, value: s.value};
890
890
  if (s.truncated) frame.truncated = true;
891
- try { socket && socket.send(JSON.stringify(frame)); } catch (e) {}
891
+ try { socket && socket.send(JSON.stringify(frame)); } catch (e) {
892
+ // Ignore
893
+ }
892
894
  }
893
895
 
894
896
  function replyErr(cmdId, name, message) {
895
897
  var frame = {type: "result", cmdId: cmdId, ok: false, error: {name: name, message: String(message), engine: engineName()}};
896
- try { socket && socket.send(JSON.stringify(frame)); } catch (e) {}
898
+ try { socket && socket.send(JSON.stringify(frame)); } catch (e) {
899
+ // Ignore
900
+ }
897
901
  }
898
902
 
899
903
  // Resolve a numeric tab id when the caller did not pass one: match
@@ -1085,7 +1089,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1085
1089
  if (op === "reload") {
1086
1090
  if (ctx === "background") {
1087
1091
  replyOk(cmdId, {reloading: true});
1088
- setTimeout(function () { try { chrome.runtime.reload(); } catch (e) {} }, 50);
1092
+ setTimeout(function () { try { chrome.runtime.reload(); } catch (e) {
1093
+ // Ignore
1094
+ } }, 50);
1089
1095
  } else if (target.tabId) {
1090
1096
  nsCall("tabs", "reload", [target.tabId], function (err) {
1091
1097
  if (err) replyErr(cmdId, "ReloadError", (err && err.message) || err);
@@ -1107,14 +1113,18 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1107
1113
  r.then(function (p) { cb(p || ""); }, function () { cb(""); });
1108
1114
  return;
1109
1115
  }
1110
- } catch (e) {}
1116
+ } catch (e) {
1117
+ // Ignore
1118
+ }
1111
1119
  try { chrome.action.getPopup({}, function (p) { cb(p || ""); }); }
1112
1120
  catch (e) { cb(""); }
1113
1121
  };
1114
1122
  var resolveActiveTab = function (a, cb) {
1115
1123
  if (a && typeof a.tabId === "number") {
1116
1124
  try { chrome.tabs.get(a.tabId, function (t) { cb(t || {id: a.tabId}); }); return; }
1117
- catch (e) {}
1125
+ catch (e) {
1126
+ // Ignore
1127
+ }
1118
1128
  }
1119
1129
  try { chrome.tabs.query({active: true, lastFocusedWindow: true}, function (tabs) { cb((tabs && tabs[0]) || undefined); }); }
1120
1130
  catch (e) { cb(undefined); }
@@ -1128,7 +1138,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1128
1138
  if (perms.indexOf("activeTab") !== -1) {
1129
1139
  return "replayed without a user gesture: activeTab is NOT granted, so APIs that depend on it (scripting on the active tab, captureVisibleTab) behave differently than a real click";
1130
1140
  }
1131
- } catch (e) {}
1141
+ } catch (e) {
1142
+ // Ignore
1143
+ }
1132
1144
  return null;
1133
1145
  };
1134
1146
  if (surface === "popup") {
@@ -1164,7 +1176,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1164
1176
  resolveActiveTab(args, function (tab) {
1165
1177
  var fired = 0;
1166
1178
  for (var i = 0; i < actionClickedListeners.length; i++) {
1167
- try { actionClickedListeners[i](tab); fired++; } catch (e) {}
1179
+ try { actionClickedListeners[i](tab); fired++; } catch (e) {
1180
+ // Ignore
1181
+ }
1168
1182
  }
1169
1183
  var reply = {triggered: "onClicked", listeners: fired, gesture: false};
1170
1184
  var warning = activeTabWarning();
@@ -1184,7 +1198,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1184
1198
  resolveActiveTab(args, function (tab) {
1185
1199
  var fired = 0;
1186
1200
  for (var i = 0; i < commandListeners.length; i++) {
1187
- try { commandListeners[i](commandName, tab); fired++; } catch (e) {}
1201
+ try { commandListeners[i](commandName, tab); fired++; } catch (e) {
1202
+ // Ignore
1203
+ }
1188
1204
  }
1189
1205
  replyOk(cmdId, {triggered: "command", command: commandName || null, listeners: fired, gesture: false});
1190
1206
  });
@@ -1270,7 +1286,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1270
1286
  }
1271
1287
  }
1272
1288
 
1273
- function noopLastError() { try { void g.chrome.runtime.lastError; } catch (e) {} }
1289
+ function noopLastError() { try { void g.chrome.runtime.lastError; } catch (e) {
1290
+ // Ignore
1291
+ } }
1274
1292
 
1275
1293
  // Only http(s)/file/ftp tabs can run a content script; skip chrome://, the
1276
1294
  // extension's own pages, about:blank, etc.
@@ -1294,7 +1312,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1294
1312
  try {
1295
1313
  chrome.tabs.query({url: matches}, function (tabs) {
1296
1314
  var err = null;
1297
- try { err = chrome.runtime.lastError; } catch (e) {}
1315
+ try { err = chrome.runtime.lastError; } catch (e) {
1316
+ // Ignore
1317
+ }
1298
1318
  if (err || !tabs) return;
1299
1319
  for (var i = 0; i < tabs.length; i++) {
1300
1320
  (function (tab) {
@@ -1302,7 +1322,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1302
1322
  if (excludedTabIds[tab.id]) return;
1303
1323
  var target = {tabId: tab.id, allFrames: allFrames};
1304
1324
  if (cssFiles.length && chrome.scripting.insertCSS) {
1305
- try { chrome.scripting.insertCSS({target: target, files: cssFiles}, noopLastError); } catch (e) {}
1325
+ try { chrome.scripting.insertCSS({target: target, files: cssFiles}, noopLastError); } catch (e) {
1326
+ // Ignore
1327
+ }
1306
1328
  }
1307
1329
  if (jsFiles.length && chrome.scripting.executeScript) {
1308
1330
  try {
@@ -1310,17 +1332,23 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1310
1332
  {target: target, files: jsFiles, world: world, injectImmediately: true},
1311
1333
  noopLastError
1312
1334
  );
1313
- } catch (e) {}
1335
+ } catch (e) {
1336
+ // Ignore
1337
+ }
1314
1338
  }
1315
1339
  })(tabs[i]);
1316
1340
  }
1317
1341
  });
1318
- } catch (e) {}
1342
+ } catch (e) {
1343
+ // Ignore
1344
+ }
1319
1345
  }
1320
1346
  if (Array.isArray(excludeMatches) && excludeMatches.length) {
1321
1347
  try {
1322
1348
  chrome.tabs.query({url: excludeMatches}, function (excludedTabs) {
1323
- try { void chrome.runtime.lastError; } catch (e) {}
1349
+ try { void chrome.runtime.lastError; } catch (e) {
1350
+ // Ignore
1351
+ }
1324
1352
  var excluded = {};
1325
1353
  if (excludedTabs) {
1326
1354
  for (var i = 0; i < excludedTabs.length; i++) {
@@ -1330,7 +1358,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1330
1358
  injectInto(excluded);
1331
1359
  });
1332
1360
  return;
1333
- } catch (e) {}
1361
+ } catch (e) {
1362
+ // Ignore
1363
+ }
1334
1364
  }
1335
1365
  injectInto({});
1336
1366
  }
@@ -1347,9 +1377,13 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1347
1377
  var entries = (manifest && manifest.content_scripts) || [];
1348
1378
  for (var i = 0; i < entries.length; i++) reinjectContentScriptEntry(entries[i]);
1349
1379
  reregisterForFutureNavigations(entries);
1350
- if (onDone) { try { onDone(); } catch (e) {} }
1380
+ if (onDone) { try { onDone(); } catch (e) {
1381
+ // Ignore
1382
+ } }
1351
1383
  })
1352
- .catch(function () {});
1384
+ .catch(function () {
1385
+ // Ignore
1386
+ });
1353
1387
  return true;
1354
1388
  } catch (e) { return false; }
1355
1389
  }
@@ -1397,7 +1431,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1397
1431
 
1398
1432
  try {
1399
1433
  chrome.scripting.getRegisteredContentScripts(function (existing) {
1400
- try { void chrome.runtime.lastError; } catch (e) {}
1434
+ try { void chrome.runtime.lastError; } catch (e) {
1435
+ // Ignore
1436
+ }
1401
1437
  var have = {};
1402
1438
  if (existing) for (var k = 0; k < existing.length; k++) have[existing[k].id] = true;
1403
1439
  var toRegister = [], toUpdate = [];
@@ -1405,13 +1441,19 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1405
1441
  (have[scripts[j].id] ? toUpdate : toRegister).push(scripts[j]);
1406
1442
  }
1407
1443
  if (toRegister.length) {
1408
- try { chrome.scripting.registerContentScripts(toRegister, noopLastError); } catch (e) {}
1444
+ try { chrome.scripting.registerContentScripts(toRegister, noopLastError); } catch (e) {
1445
+ // Ignore
1446
+ }
1409
1447
  }
1410
1448
  if (toUpdate.length) {
1411
- try { chrome.scripting.updateContentScripts(toUpdate, noopLastError); } catch (e) {}
1449
+ try { chrome.scripting.updateContentScripts(toUpdate, noopLastError); } catch (e) {
1450
+ // Ignore
1451
+ }
1412
1452
  }
1413
1453
  });
1414
- } catch (e) {}
1454
+ } catch (e) {
1455
+ // Ignore
1456
+ }
1415
1457
  }
1416
1458
 
1417
1459
  // Dev-loop reload without the CDP controller: content-scripts re-inject in
@@ -1427,10 +1469,14 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1427
1469
  if (chrome.storage && chrome.storage.local) {
1428
1470
  chrome.storage.local.set({__extjsDevPendingReinject: Date.now()}, noopLastError);
1429
1471
  }
1430
- } catch (e) {}
1472
+ } catch (e) {
1473
+ // Ignore
1474
+ }
1431
1475
  // Deferred so in-flight frames and the tab console announcement flush
1432
1476
  // before the SW dies; the devtools companion confirms completion.
1433
- try { setTimeout(function () { try { chrome.runtime.reload(); } catch (e) {} }, 150); } catch (e) {}
1477
+ try { setTimeout(function () { try { chrome.runtime.reload(); } catch (e) {
1478
+ // Ignore
1479
+ } }, 150); } catch (e) {}
1434
1480
  };
1435
1481
 
1436
1482
  if (type === "content-scripts" && chrome.scripting && chrome.tabs && chrome.tabs.query) {
@@ -1458,7 +1504,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1458
1504
  {type: "extjs-dev-reload-state", phase: phase, label: label || "", kind: kind || "", instanceId: INSTANCE_ID},
1459
1505
  function () { noopLastError(); }
1460
1506
  );
1461
- } catch (e) {}
1507
+ } catch (e) {
1508
+ // Ignore
1509
+ }
1462
1510
  }
1463
1511
 
1464
1512
  // console.log the reload line into every open injectable tab; the patched
@@ -1480,18 +1528,24 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1480
1528
  noopLastError
1481
1529
  );
1482
1530
  return;
1483
- } catch (e) {}
1531
+ } catch (e) {
1532
+ // Ignore
1533
+ }
1484
1534
  }
1485
1535
  // MV2 fallback (Firefox without the scripting API).
1486
1536
  if (chrome.tabs.executeScript) {
1487
1537
  try {
1488
1538
  chrome.tabs.executeScript(tab.id, {code: "console.log(" + JSON.stringify(text) + ");"}, noopLastError);
1489
- } catch (e) {}
1539
+ } catch (e) {
1540
+ // Ignore
1541
+ }
1490
1542
  }
1491
1543
  })(tabs[i]);
1492
1544
  }
1493
1545
  });
1494
- } catch (e) {}
1546
+ } catch (e) {
1547
+ // Ignore
1548
+ }
1495
1549
  }
1496
1550
 
1497
1551
  function handleDevReloadFrame(frame) {
@@ -1549,7 +1603,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1549
1603
 
1550
1604
  function send(frame) {
1551
1605
  if (open && socket) {
1552
- try { socket.send(JSON.stringify(frame)); return; } catch (e) {}
1606
+ try { socket.send(JSON.stringify(frame)); return; } catch (e) {
1607
+ // Ignore
1608
+ }
1553
1609
  }
1554
1610
  if (queue.length < MAX_QUEUE) queue.push(frame);
1555
1611
  }
@@ -1557,7 +1613,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1557
1613
  function schedule() {
1558
1614
  var delay = backoff;
1559
1615
  backoff = Math.min(backoff * 2, MAX_BACKOFF);
1560
- try { setTimeout(connect, delay); } catch (e) {}
1616
+ try { setTimeout(connect, delay); } catch (e) {
1617
+ // Ignore
1618
+ }
1561
1619
  }
1562
1620
 
1563
1621
  function connect() {
@@ -1572,7 +1630,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1572
1630
  backoff = 250;
1573
1631
  try {
1574
1632
  socket.send(JSON.stringify({type: "hello", v: 1, role: "producer", instanceId: INSTANCE_ID}));
1575
- } catch (e) {}
1633
+ } catch (e) {
1634
+ // Ignore
1635
+ }
1576
1636
  flush();
1577
1637
  };
1578
1638
  socket.onmessage = function (ev) {
@@ -1583,7 +1643,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1583
1643
  } else if (frame && frame.type === "reload") {
1584
1644
  // Dev-loop reload broadcast (see broker.broadcastReload).
1585
1645
  // Fire-and-forget: no result frame is expected.
1586
- try { handleDevReloadFrame(frame); } catch (e) {}
1646
+ try { handleDevReloadFrame(frame); } catch (e) {
1647
+ // Ignore
1648
+ }
1587
1649
  } else if (frame && frame.type === "ping") {
1588
1650
  // Server keepalive: merely RECEIVING this resets the MV3 SW's ~30s
1589
1651
  // idle timer (Chrome 116+), keeping it reachable. Nothing to do.
@@ -1595,7 +1657,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1595
1657
  schedule();
1596
1658
  };
1597
1659
  socket.onerror = function () {
1598
- try { socket && socket.close(); } catch (e) {}
1660
+ try { socket && socket.close(); } catch (e) {
1661
+ // Ignore
1662
+ }
1599
1663
  };
1600
1664
  }
1601
1665
 
@@ -1641,7 +1705,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1641
1705
  runId: INSTANCE_ID
1642
1706
  }
1643
1707
  });
1644
- } catch (e) {}
1708
+ } catch (e) {
1709
+ // Ignore
1710
+ }
1645
1711
  return orig.apply(consoleRef, arguments);
1646
1712
  };
1647
1713
  });
@@ -1666,7 +1732,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1666
1732
  runId: INSTANCE_ID
1667
1733
  }
1668
1734
  });
1669
- } catch (e) {}
1735
+ } catch (e) {
1736
+ // Ignore
1737
+ }
1670
1738
  }
1671
1739
  try {
1672
1740
  if (typeof g.addEventListener === "function") {
@@ -1681,7 +1749,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1681
1749
  shipUncaughtError("Unhandled promise rejection: " + message, reason && reason.stack, undefined);
1682
1750
  });
1683
1751
  }
1684
- } catch (e) {}
1752
+ } catch (e) {
1753
+ // Ignore
1754
+ }
1685
1755
 
1686
1756
  // Other contexts relay console logs to this SW over a NAMED runtime.Port:
1687
1757
  // they can't open the WS under page CSP, and sendMessage can echo-loop.
@@ -1702,7 +1772,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1702
1772
  runId: INSTANCE_ID
1703
1773
  }
1704
1774
  });
1705
- } catch (e) {}
1775
+ } catch (e) {
1776
+ // Ignore
1777
+ }
1706
1778
  }
1707
1779
  try {
1708
1780
  var rtPort = g.chrome;
@@ -1714,10 +1786,14 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1714
1786
  if (!msg || !msg.__extjsBridgeLog) return;
1715
1787
  shipRelayedLog(msg.__extjsBridgeLog, port.sender);
1716
1788
  });
1717
- } catch (e) {}
1789
+ } catch (e) {
1790
+ // Ignore
1791
+ }
1718
1792
  });
1719
1793
  }
1720
- } catch (e) {}
1794
+ } catch (e) {
1795
+ // Ignore
1796
+ }
1721
1797
  // Legacy sendMessage path: kept for any surface still relaying the old way
1722
1798
  // (harmless one-predicate listener; new relays never use it).
1723
1799
  try {
@@ -1728,7 +1804,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1728
1804
  shipRelayedLog(msg.__extjsBridgeLog, sender);
1729
1805
  });
1730
1806
  }
1731
- } catch (e) {}
1807
+ } catch (e) {
1808
+ // Ignore
1809
+ }
1732
1810
 
1733
1811
  // Chrome never injects manifest content scripts into already-open tabs, so
1734
1812
  // fire one reinject on onInstalled (which skips idle-stop SW wakes).
@@ -1738,12 +1816,18 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1738
1816
  rtBoot.runtime.onInstalled.addListener(function () {
1739
1817
  try {
1740
1818
  setTimeout(function () {
1741
- try { reinjectContentScripts(); } catch (e) {}
1819
+ try { reinjectContentScripts(); } catch (e) {
1820
+ // Ignore
1821
+ }
1742
1822
  }, 250);
1743
- } catch (e) {}
1823
+ } catch (e) {
1824
+ // Ignore
1825
+ }
1744
1826
  });
1745
1827
  }
1746
- } catch (e) {}
1828
+ } catch (e) {
1829
+ // Ignore
1830
+ }
1747
1831
 
1748
1832
  // runtime.reload() does NOT fire onInstalled (verified Chromium 146), so
1749
1833
  // consume the pre-reload storage flag here (fresh only) to heal open tabs.
@@ -1754,17 +1838,25 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
1754
1838
  noopLastError();
1755
1839
  var ts = res && res.__extjsDevPendingReinject;
1756
1840
  if (ts == null) return;
1757
- try { stBoot.storage.local.remove("__extjsDevPendingReinject", noopLastError); } catch (e) {}
1841
+ try { stBoot.storage.local.remove("__extjsDevPendingReinject", noopLastError); } catch (e) {
1842
+ // Ignore
1843
+ }
1758
1844
  if (typeof ts !== "number" || Date.now() - ts > 30000) return;
1759
1845
  setTimeout(function () {
1760
- try { reinjectContentScripts(); } catch (e) {}
1846
+ try { reinjectContentScripts(); } catch (e) {
1847
+ // Ignore
1848
+ }
1761
1849
  }, 250);
1762
1850
  });
1763
1851
  }
1764
- } catch (e) {}
1852
+ } catch (e) {
1853
+ // Ignore
1854
+ }
1765
1855
 
1766
1856
  connect();
1767
- } catch (e) {}
1857
+ } catch (e) {
1858
+ // Ignore
1859
+ }
1768
1860
  })();
1769
1861
  `;
1770
1862
  const BRIDGE_RELAY_SOURCE = `;(function () {
@@ -1806,7 +1898,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1806
1898
  try {
1807
1899
  logPort = chrome.runtime.connect({name: "__extjs-bridge-log__"});
1808
1900
  logPort.onDisconnect.addListener(function () {
1809
- try { void chrome.runtime.lastError; } catch (e) {}
1901
+ try { void chrome.runtime.lastError; } catch (e) {
1902
+ // Ignore
1903
+ }
1810
1904
  logPort = null;
1811
1905
  });
1812
1906
  } catch (e) { logPort = null; }
@@ -1823,7 +1917,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1823
1917
  } catch (e) {
1824
1918
  logPort = null;
1825
1919
  var p2 = getLogPort();
1826
- if (p2) { try { p2.postMessage({__extjsBridgeLog: payload}); } catch (e2) {} }
1920
+ if (p2) { try { p2.postMessage({__extjsBridgeLog: payload}); } catch (e2) {
1921
+ // Ignore
1922
+ } }
1827
1923
  }
1828
1924
  }
1829
1925
 
@@ -1856,7 +1952,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1856
1952
  }
1857
1953
  }
1858
1954
  postLog({level: level, context: CONTEXT, messageParts: sanitize([].slice.call(arguments)), url: here()});
1859
- } catch (e) {}
1955
+ } catch (e) {
1956
+ // Ignore
1957
+ }
1860
1958
  return orig.apply(consoleRef, arguments);
1861
1959
  };
1862
1960
  });
@@ -1867,7 +1965,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1867
1965
  if (errorSigSeenRecently(sig)) return;
1868
1966
  noteErrorSig(sig);
1869
1967
  postLog({level: "error", context: CONTEXT, messageParts: sanitize([String(message) + (stack ? "\\n" + stack : "")]), url: url || here()});
1870
- } catch (e) {}
1968
+ } catch (e) {
1969
+ // Ignore
1970
+ }
1871
1971
  }
1872
1972
  try {
1873
1973
  if (typeof g.addEventListener === "function") {
@@ -1882,7 +1982,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1882
1982
  shipUncaughtError("Unhandled promise rejection: " + message, reason && reason.stack, undefined);
1883
1983
  });
1884
1984
  }
1885
- } catch (e) {}
1985
+ } catch (e) {
1986
+ // Ignore
1987
+ }
1886
1988
 
1887
1989
  // The SW executor can't reach another extension page's DOM or eval there,
1888
1990
  // so THIS surface answers inspect/eval requests for its own context.
@@ -1906,7 +2008,9 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1906
2008
  return true; // responded
1907
2009
  });
1908
2010
  }
1909
- } catch (e) {}
2011
+ } catch (e) {
2012
+ // Ignore
2013
+ }
1910
2014
 
1911
2015
  try {
1912
2016
  if (chrome.runtime && chrome.runtime.onMessage) {
@@ -1949,8 +2053,12 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
1949
2053
  return true; // responded
1950
2054
  });
1951
2055
  }
1952
- } catch (e) {}
1953
- } catch (e) {}
2056
+ } catch (e) {
2057
+ // Ignore
2058
+ }
2059
+ } catch (e) {
2060
+ // Ignore
2061
+ }
1954
2062
  })();
1955
2063
  `;
1956
2064
  function buildBridgeRelaySource(opts) {
@@ -1,11 +1,3 @@
1
1
  import type { RspackDevServer } from '@rspack/dev-server';
2
2
  import type { PortManager } from './port-manager';
3
- /**
4
- * Creates cleanup handlers for process termination and uncaught errors.
5
- * Registers signal handlers for graceful shutdown.
6
- *
7
- * @param devServer - The RspackDevServer instance
8
- * @param portManager - The PortManager instance
9
- * @returns A cleanup function and a cancel function for auto-exit
10
- */
11
3
  export declare function setupCleanupHandlers(devServer: RspackDevServer, portManager: PortManager): () => void;