@pi-oxide/extension-js 0.10.3 → 0.11.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/index.js CHANGED
@@ -201,14 +201,14 @@ function ve(e) {
201
201
  const r = new Error(e.message);
202
202
  throw r.code = e.code, e.category && (r.category = e.category), e.hint && (r.hint = e.hint), e.recovery && (r.recovery = e.recovery), e.details && (r.details = e.details), r;
203
203
  }
204
- function sr(e, r) {
205
- let n = `Element not found by label "${e}"`;
206
- if (r != null && r.length) {
207
- const a = r.map((o) => o.name || o.refId).filter(Boolean).slice(0, 5);
208
- n += a.length > 0 ? `. Candidates: ${a.join(", ")}` : ". Candidates: none";
204
+ function sr(e, r, n) {
205
+ let a = `Element not found by label "${e}"`;
206
+ if (r !== void 0) {
207
+ const i = r.map((s) => s.name || s.refId).filter(Boolean).slice(0, 5);
208
+ a += i.length > 0 ? `. Candidates: ${i.join(", ")}` : ". Candidates: none";
209
209
  }
210
210
  return {
211
- message: n,
211
+ message: a,
212
212
  code: "E_NOT_FOUND",
213
213
  category: "resource",
214
214
  hint: "No element matched this label. Check candidates or snapshot for visible controls.",
@@ -216,7 +216,10 @@ function sr(e, r) {
216
216
  "const d = await page.snapshot_data(); find the target in d.nodes",
217
217
  "Try a more specific label or use refId from snapshot"
218
218
  ],
219
- details: r != null && r.length ? { label: e, candidates: r } : { label: e }
219
+ details: {
220
+ label: e,
221
+ ...r != null && r.length ? { candidates: r } : {}
222
+ }
220
223
  };
221
224
  }
222
225
  function cr(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-oxide/extension-js",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",