ax-grep 0.0.0 → 0.1.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/README.md +154 -1
- package/dist/browser.d.ts +11 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-U3GDKPLQ.js +578 -0
- package/dist/chunk-U3GDKPLQ.js.map +1 -0
- package/dist/chunk-Z7V6PIPH.js +735 -0
- package/dist/chunk-Z7V6PIPH.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +402 -0
- package/dist/index.js.map +1 -0
- package/dist/static.d.ts +6 -0
- package/dist/static.js +8 -0
- package/dist/static.js.map +1 -0
- package/dist/types-dgf3brcf.d.ts +74 -0
- package/package.json +61 -5
- package/index.js +0 -1
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { a as SemanticTreeOptions, S as SemanticNode } from './types-dgf3brcf.js';
|
|
2
|
+
|
|
3
|
+
type StaticSemanticTreeOptions = Pick<SemanticTreeOptions, "excludeLikelyAds" | "excludeLikelyBoilerplate" | "includeAttributes" | "includeHidden" | "includeSelectOptions" | "includeTextNodes" | "maxChildrenPerNode" | "maxLinkFarmChildren" | "maxRepeatedSubtreeInstances" | "maxTextLength" | "mode" | "pruneCollapsedSubtrees" | "pruneLikelyClosedOverlays" | "summarizeLargeSubtrees" | "summarizeLikelyLinkFarms" | "summarizeRepeatedSubtrees">;
|
|
4
|
+
declare function extractStaticSemanticTree(html: string, options?: StaticSemanticTreeOptions): SemanticNode;
|
|
5
|
+
|
|
6
|
+
export { type StaticSemanticTreeOptions, extractStaticSemanticTree as extract, extractStaticSemanticTree };
|
package/dist/static.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
type OutputFormat = "json" | "text";
|
|
2
|
+
type ExtractMode = "full" | "compact" | "interactive";
|
|
3
|
+
type SemanticTreeOptions = {
|
|
4
|
+
mode?: ExtractMode;
|
|
5
|
+
includeBounds?: boolean;
|
|
6
|
+
includeAttributes?: boolean;
|
|
7
|
+
includeTextNodes?: boolean;
|
|
8
|
+
includeHidden?: boolean;
|
|
9
|
+
includeSelectOptions?: boolean;
|
|
10
|
+
excludeLikelyAds?: boolean;
|
|
11
|
+
excludeLikelyBoilerplate?: boolean;
|
|
12
|
+
pruneCustomElementWrappers?: boolean;
|
|
13
|
+
pruneCollapsedSubtrees?: boolean;
|
|
14
|
+
pruneLikelyClosedOverlays?: boolean;
|
|
15
|
+
summarizeLargeSubtrees?: boolean;
|
|
16
|
+
summarizeLikelyLinkFarms?: boolean;
|
|
17
|
+
summarizeRepeatedSubtrees?: boolean;
|
|
18
|
+
maxChildrenPerNode?: number;
|
|
19
|
+
maxLinkFarmChildren?: number;
|
|
20
|
+
maxRepeatedSubtreeInstances?: number;
|
|
21
|
+
maxTextLength?: number;
|
|
22
|
+
};
|
|
23
|
+
type SemanticTreeChange = {
|
|
24
|
+
tree: SemanticNode;
|
|
25
|
+
changedAt: number;
|
|
26
|
+
mutationCount: number;
|
|
27
|
+
};
|
|
28
|
+
type SemanticTreeObserverOptions = SemanticTreeOptions & {
|
|
29
|
+
debounceMs?: number;
|
|
30
|
+
};
|
|
31
|
+
type SemanticNodeState = {
|
|
32
|
+
hidden?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
checked?: boolean | "mixed";
|
|
35
|
+
selected?: boolean;
|
|
36
|
+
expanded?: boolean;
|
|
37
|
+
pressed?: boolean | "mixed";
|
|
38
|
+
focused?: boolean;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
invalid?: boolean | string;
|
|
41
|
+
readonly?: boolean;
|
|
42
|
+
};
|
|
43
|
+
type SemanticNodeBounds = {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
type SemanticNode = {
|
|
50
|
+
id: string;
|
|
51
|
+
tag: string;
|
|
52
|
+
role: string | null;
|
|
53
|
+
name: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
text?: string;
|
|
56
|
+
value?: string;
|
|
57
|
+
state?: SemanticNodeState;
|
|
58
|
+
interactive: boolean;
|
|
59
|
+
focusable: boolean;
|
|
60
|
+
selector?: string;
|
|
61
|
+
xpath?: string;
|
|
62
|
+
bounds?: SemanticNodeBounds;
|
|
63
|
+
attributes?: Record<string, string>;
|
|
64
|
+
children: SemanticNode[];
|
|
65
|
+
unavailableReason?: string;
|
|
66
|
+
};
|
|
67
|
+
type ExtractorScriptOptions = SemanticTreeOptions & {
|
|
68
|
+
format?: OutputFormat;
|
|
69
|
+
};
|
|
70
|
+
type ObserverScriptOptions = SemanticTreeObserverOptions & {
|
|
71
|
+
globalName?: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type { ExtractorScriptOptions as E, ObserverScriptOptions as O, SemanticNode as S, SemanticTreeOptions as a, ExtractMode as b, OutputFormat as c, SemanticNodeBounds as d, SemanticNodeState as e, SemanticTreeChange as f, SemanticTreeObserverOptions as g };
|
package/package.json
CHANGED
|
@@ -1,14 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ax-grep",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A browser-native semantic accessibility tree extractor that runs without DevTools or CDP.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"packageManager": "pnpm@10.33.4",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|
|
9
12
|
"url": "git+https://github.com/hmmhmmhm/ax-lite.git"
|
|
10
13
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./browser": {
|
|
20
|
+
"types": "./dist/browser.d.ts",
|
|
21
|
+
"import": "./dist/browser.js"
|
|
22
|
+
},
|
|
23
|
+
"./static": {
|
|
24
|
+
"types": "./dist/static.d.ts",
|
|
25
|
+
"import": "./dist/static.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup && tsc --noEmit",
|
|
33
|
+
"check": "tsc --noEmit",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"compare": "tsx scripts/compare.ts",
|
|
37
|
+
"compare:static": "tsx scripts/compare-static.ts",
|
|
38
|
+
"compare:tokens": "tsx scripts/compare-token-cost.ts",
|
|
39
|
+
"compare:sample": "tsx scripts/compare.ts https://example.com https://www.wikipedia.org https://developer.mozilla.org/en-US/docs/Web/Accessibility https://news.ycombinator.com https://github.com/features https://libraries.io/npm/typescript https://www.npmjs.com/package/typescript",
|
|
40
|
+
"compare:korea": "tsx scripts/compare.ts https://ko.wikipedia.org/wiki/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD https://www.hani.co.kr/ https://www.korea.kr/ https://www.yonhapnewstv.co.kr/",
|
|
41
|
+
"compare:static:korea-social": "tsx scripts/compare-static.ts --target-set korea-social",
|
|
42
|
+
"compare:tokens:korea-social": "tsx scripts/compare-token-cost.ts --target-set korea-social",
|
|
43
|
+
"compare:static:china-japan": "tsx scripts/compare-static.ts --target-set china-japan",
|
|
44
|
+
"compare:tokens:china-japan": "tsx scripts/compare-token-cost.ts --target-set china-japan",
|
|
45
|
+
"compare:static:diverse": "tsx scripts/compare-static.ts https://www.bbc.com/news https://www.npr.org/2025/03/11/nx-s1-5324543/ntsb-dca-mid-air-collision-american-black-hawk https://www.theguardian.com/international https://www.gov.uk/foreign-travel-advice https://www.nottinghamshire.gov.uk/global-content/how-to-create-accessible-content/how-to-make-web-pages-accessible/checklist-web-page https://books.toscrape.com/ https://old.reddit.com/r/programming/ https://www.reddit.com/r/programming/ https://x.com/NASA https://www.instagram.com/nasa/",
|
|
46
|
+
"compare:tokens:diverse": "tsx scripts/compare-token-cost.ts https://www.bbc.com/news https://www.npr.org/2025/03/11/nx-s1-5324543/ntsb-dca-mid-air-collision-american-black-hawk https://www.gov.uk/foreign-travel-advice https://books.toscrape.com/ https://old.reddit.com/r/programming/ https://x.com/NASA https://www.instagram.com/nasa/"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"accessibility",
|
|
50
|
+
"a11y",
|
|
51
|
+
"semantic-tree",
|
|
52
|
+
"webview",
|
|
53
|
+
"agent"
|
|
54
|
+
],
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "^25.0.0",
|
|
58
|
+
"agent-browser": "^0.27.0",
|
|
59
|
+
"puppeteer": "^24.31.0",
|
|
60
|
+
"tsup": "^8.5.1",
|
|
61
|
+
"tsx": "^4.21.0",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^4.1.0"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"domhandler": "^6.0.1",
|
|
67
|
+
"htmlparser2": "^12.0.0",
|
|
68
|
+
"js-tiktoken": "^1.0.21"
|
|
13
69
|
}
|
|
14
70
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|