Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions dist/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
function __accessProp(key) {
return this[key];
}
var __toESMCache_node;
var __toESMCache_esm;
var __toESM = (mod, isNodeMode, target) => {
var canCache = mod != null && typeof mod === "object";
if (canCache) {
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
var cached = cache.get(mod);
if (cached)
return cached;
}
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
get: __accessProp.bind(mod, key),
enumerable: true
});
if (canCache)
cache.set(mod, to);
return to;
};
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
set: __exportSetter.bind(all, name)
});
};
var __require = /* @__PURE__ */ createRequire(import.meta.url);
Expand Down Expand Up @@ -13615,7 +13633,7 @@ class JSONSchemaGenerator {
if (val === undefined) {
if (this.unrepresentable === "throw") {
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
} else {}
}
} else if (typeof val === "bigint") {
if (this.unrepresentable === "throw") {
throw new Error("BigInt literals cannot be represented in JSON Schema");
Expand Down Expand Up @@ -15332,8 +15350,26 @@ function walkAXTree(axNode, allNodes, byUid) {
const value = axNode.value?.value;
const backendNodeId = axNode.backendDOMNodeId ?? 0;
const ignored = axNode.ignored;
if (ignored && !name)
return null;
if (ignored && !name) {
const childIds2 = axNode.childIds ?? [];
const children2 = [];
for (const childId of childIds2) {
const childAx = allNodes[childId];
if (!childAx)
continue;
const childNode = walkAXTree(childAx, allNodes, byUid);
if (childNode)
children2.push(childNode);
}
if (children2.length === 0)
return null;
if (children2.length === 1)
return children2[0];
const uid2 = nextUid++;
const node2 = { uid: uid2, role: "generic", children: children2 };
byUid.set(uid2, node2);
return node2;
}
const uid = nextUid++;
const children = [];
const childIds = axNode.childIds ?? [];
Expand Down
17 changes: 16 additions & 1 deletion src/lib/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ function walkAXTree(
const backendNodeId = (axNode.backendDOMNodeId as number | undefined) ?? 0;
const ignored = axNode.ignored as boolean;

if (ignored && !name) return null;
if (ignored && !name) {
const childIds = (axNode.childIds as string[] | undefined) ?? [];
const children: SnapshotNode[] = [];
for (const childId of childIds) {
const childAx = allNodes[childId];
if (!childAx) continue;
const childNode = walkAXTree(childAx, allNodes, byUid);
if (childNode) children.push(childNode);
}
if (children.length === 0) return null;
if (children.length === 1) return children[0];
const uid = nextUid++;
const node: SnapshotNode = { uid, role: "generic", children };
byUid.set(uid, node);
return node;
}

const uid = nextUid++;
const children: SnapshotNode[] = [];
Expand Down