extension 3.18.4 → 3.18.5-canary.local-34c11c8f

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 (26) hide show
  1. package/dist/{322.cjs → 204.cjs} +62 -42
  2. package/dist/browsers.cjs +539 -439
  3. package/dist/cli.cjs +634 -430
  4. package/dist/extension/browsers/browsers-lib/instance-registry.d.ts +38 -0
  5. package/dist/extension/browsers/browsers-lib/messages.d.ts +11 -0
  6. package/dist/extension/browsers/browsers-lib/output-binaries-resolver.d.ts +1 -1
  7. package/dist/extension/browsers/browsers-lib/process-teardown.d.ts +6 -0
  8. package/dist/extension/browsers/browsers-lib/resolve-profile.d.ts +62 -0
  9. package/dist/extension/browsers/browsers-lib/runtime-options.d.ts +3 -3
  10. package/dist/extension/browsers/browsers-lib/wsl-support.d.ts +1 -3
  11. package/dist/extension/browsers/browsers-types.d.ts +1 -1
  12. package/dist/extension/browsers/index.d.ts +2 -0
  13. package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-client.d.ts +3 -2
  14. package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-extension-controller/index.d.ts +3 -6
  15. package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-extension-controller/ownership.d.ts +2 -0
  16. package/dist/extension/browsers/run-chromium/chromium-types.d.ts +136 -1
  17. package/dist/extension/browsers/run-firefox/firefox-launch/index.d.ts +1 -2
  18. package/dist/extension/browsers/run-firefox/firefox-launch/process-handlers.d.ts +1 -2
  19. package/dist/extension/browsers/run-firefox/firefox-source-inspection/index.d.ts +4 -0
  20. package/dist/extension/browsers/run-firefox/firefox-source-inspection/remote-firefox/messaging-client.d.ts +9 -15
  21. package/dist/extension/browsers/run-firefox/firefox-source-inspection/remote-firefox/rdp-api.d.ts +2 -6
  22. package/dist/extension/browsers/run-firefox/firefox-source-inspection/remote-firefox/rdp-types.d.ts +99 -0
  23. package/dist/extension/browsers/run-firefox/firefox-source-inspection/remote-firefox/source-inspect.d.ts +6 -6
  24. package/dist/extension/browsers/run-firefox/firefox-types.d.ts +1 -1
  25. package/dist/extension/browsers/run-safari/safari-launch/safari-config.d.ts +10 -0
  26. package/package.json +19 -13
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.ids = [
3
- 322
3
+ 204
4
4
  ];
5
5
  exports.modules = {
6
6
  "./browsers/run-chromium/chromium-launch/setup-cdp-after-launch.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
@@ -1073,6 +1073,37 @@ exports.modules = {
1073
1073
  }
1074
1074
  return deriveFromProfile() || deferredFirstEvalId || deferredUrlDerivedId;
1075
1075
  }
1076
+ function ownership_normalizePath(input) {
1077
+ try {
1078
+ return external_fs_.realpathSync(external_path_.resolve(input));
1079
+ } catch {
1080
+ return external_path_.resolve(input);
1081
+ }
1082
+ }
1083
+ function classifyExtensionOwnership(profilePath, outPath, extensionId) {
1084
+ if (!profilePath || !extensionId) return 'unknown';
1085
+ const prefCandidates = [];
1086
+ const addPrefCandidate = (dir)=>{
1087
+ const prefPath = external_path_.join(dir, 'Preferences');
1088
+ if (external_fs_.existsSync(prefPath)) prefCandidates.push(prefPath);
1089
+ };
1090
+ try {
1091
+ addPrefCandidate(profilePath);
1092
+ addPrefCandidate(external_path_.join(profilePath, 'Default'));
1093
+ for (const entry of external_fs_.readdirSync(profilePath))if (/^Profile\s+\d+$/i.test(entry)) addPrefCandidate(external_path_.join(profilePath, entry));
1094
+ } catch {}
1095
+ if (0 === prefCandidates.length) return 'unknown';
1096
+ const normalizedOutPath = ownership_normalizePath(outPath);
1097
+ for (const prefPath of prefCandidates)try {
1098
+ const prefs = JSON.parse(external_fs_.readFileSync(prefPath, 'utf-8'));
1099
+ const settings = prefs?.extensions?.settings;
1100
+ const info = settings?.[extensionId];
1101
+ const storedPath = String(info?.path || '');
1102
+ if (!storedPath) continue;
1103
+ return ownership_normalizePath(storedPath) === normalizedOutPath ? 'mine' : 'not_mine';
1104
+ } catch {}
1105
+ return 'unknown';
1106
+ }
1076
1107
  function isRecoverableBootstrapError(error) {
1077
1108
  const msg = String(error?.message || error || '').toLowerCase();
1078
1109
  return msg.includes('econnreset') || msg.includes('websocket is not open') || msg.includes('cdp transport is not open') || msg.includes('cdp connection closed') || msg.includes('cdp pipe closed') || msg.includes('socket hang up') || msg.includes('timed out') || msg.includes('no cdp websocket url');
@@ -1212,8 +1243,22 @@ exports.modules = {
1212
1243
  if (id) this.extensionId = id;
1213
1244
  }
1214
1245
  if (this.extensionId) {
1215
- const belongsToOutPath = this.extensionIdBelongsToOutPath(this.extensionId);
1216
- if (false === belongsToOutPath) this.extensionId = null;
1246
+ const ownership = this.classifyOwnership(this.extensionId);
1247
+ if ('not_mine' === ownership) this.extensionId = null;
1248
+ else if ('unknown' === ownership && this.profilePath) for(let attempt = 0; attempt < 5; attempt++){
1249
+ await new Promise((r)=>setTimeout(r, 200));
1250
+ const candidate = this.extensionId || await this.deriveExtensionIdFromTargets(4, 150);
1251
+ if (!candidate) continue;
1252
+ const verdict = this.classifyOwnership(candidate);
1253
+ if ('mine' === verdict) {
1254
+ this.extensionId = candidate;
1255
+ break;
1256
+ }
1257
+ if ('not_mine' === verdict) {
1258
+ this.extensionId = null;
1259
+ break;
1260
+ }
1261
+ }
1217
1262
  }
1218
1263
  if (this.extensionId) try {
1219
1264
  let info = null;
@@ -1266,36 +1311,8 @@ exports.modules = {
1266
1311
  if (!this.cdp) return null;
1267
1312
  return await deriveExtensionIdFromTargetsHelper(this.cdp, this.outPath, maxRetries, backoffMs, this.profilePath, this.extensionPaths);
1268
1313
  }
1269
- normalizePath(input) {
1270
- try {
1271
- return external_fs_.realpathSync(external_path_.resolve(input));
1272
- } catch {
1273
- return external_path_.resolve(input);
1274
- }
1275
- }
1276
- extensionIdBelongsToOutPath(extensionId) {
1277
- if (!this.profilePath || !extensionId) return null;
1278
- const prefCandidates = [];
1279
- const addPrefCandidate = (dir)=>{
1280
- const prefPath = external_path_.join(dir, 'Preferences');
1281
- if (external_fs_.existsSync(prefPath)) prefCandidates.push(prefPath);
1282
- };
1283
- try {
1284
- addPrefCandidate(this.profilePath);
1285
- addPrefCandidate(external_path_.join(this.profilePath, 'Default'));
1286
- for (const entry of external_fs_.readdirSync(this.profilePath))if (/^Profile\s+\d+$/i.test(entry)) addPrefCandidate(external_path_.join(this.profilePath, entry));
1287
- } catch {}
1288
- if (0 === prefCandidates.length) return null;
1289
- const normalizedOutPath = this.normalizePath(this.outPath);
1290
- for (const prefPath of prefCandidates)try {
1291
- const prefs = JSON.parse(external_fs_.readFileSync(prefPath, 'utf-8'));
1292
- const settings = prefs?.extensions?.settings;
1293
- const info = settings?.[extensionId];
1294
- const storedPath = String(info?.path || '');
1295
- if (!storedPath) continue;
1296
- return this.normalizePath(storedPath) === normalizedOutPath;
1297
- } catch {}
1298
- return null;
1314
+ classifyOwnership(extensionId) {
1315
+ return classifyExtensionOwnership(this.profilePath, this.outPath, extensionId);
1299
1316
  }
1300
1317
  getDeveloperModeStatus() {
1301
1318
  if (!this.profilePath) return 'unknown';
@@ -1379,10 +1396,10 @@ exports.modules = {
1379
1396
  }
1380
1397
  installContentScriptTargetListener() {
1381
1398
  if (!this.cdp) return;
1382
- this.cdp.onProtocolEvent((raw)=>{
1383
- const method = String(raw.method || '');
1384
- const params = raw.params;
1385
- const sessionId = String(raw.sessionId || '');
1399
+ this.cdp.onProtocolEvent((message)=>{
1400
+ const method = String(message.method || '');
1401
+ const params = message.params;
1402
+ const sessionId = String(message.sessionId || '');
1386
1403
  if ('Target.targetCreated' === method || 'Target.targetInfoChanged' === method) {
1387
1404
  const targetInfo = params?.targetInfo;
1388
1405
  if (!targetInfo || 'page' !== targetInfo.type) return;
@@ -1761,9 +1778,8 @@ exports.modules = {
1761
1778
  }
1762
1779
  onProtocolEvent(cb) {
1763
1780
  if (!this.cdp) throw new Error('CDP not connected');
1764
- this.cdp.onProtocolEvent((raw)=>{
1765
- const evt = raw;
1766
- cb(evt);
1781
+ this.cdp.onProtocolEvent((message)=>{
1782
+ cb(message);
1767
1783
  });
1768
1784
  }
1769
1785
  clearProtocolEventHandler() {
@@ -1832,8 +1848,12 @@ exports.modules = {
1832
1848
  if (!this.cdp) return null;
1833
1849
  if (!this.extensionId) this.extensionId = await this.deriveExtensionIdFromTargets(6, 150);
1834
1850
  if (this.extensionId) {
1835
- const belongsToOutPath = this.extensionIdBelongsToOutPath(this.extensionId);
1836
- if (false === belongsToOutPath) this.extensionId = await this.deriveExtensionIdFromTargets(10, 150);
1851
+ const ownership = this.classifyOwnership(this.extensionId);
1852
+ if ('not_mine' === ownership) this.extensionId = await this.deriveExtensionIdFromTargets(10, 150);
1853
+ else if ('unknown' === ownership && this.profilePath) {
1854
+ const rederived = await this.deriveExtensionIdFromTargets(6, 150);
1855
+ if (rederived && 'not_mine' !== this.classifyOwnership(rederived)) this.extensionId = rederived;
1856
+ }
1837
1857
  }
1838
1858
  if (!this.extensionId) return null;
1839
1859
  let name;