@zigrivers/surface-adapter-agnostic 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/LICENSE +22 -0
- package/README.md +15 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +146 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ken Allred
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Surface Agnostic Adapter
|
|
2
|
+
|
|
3
|
+
Framework-agnostic HTML adapter for Surface audits.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @zigrivers/surface-adapter-agnostic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the repository README for usage and release guidance: https://github.com/zigrivers/surface#readme
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
MIT.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FrameworkAdapter, SourceFileRef, ComponentMap } from '@zigrivers/surface-core/interfaces';
|
|
2
|
+
import { Result, SurfaceError } from '@zigrivers/surface-core';
|
|
3
|
+
|
|
4
|
+
declare const AGNOSTIC_ADAPTER_ID = "agnostic";
|
|
5
|
+
interface AgnosticFrameworkAdapter extends FrameworkAdapter {
|
|
6
|
+
readonly id: typeof AGNOSTIC_ADAPTER_ID;
|
|
7
|
+
introspect(source: SourceFileRef): Promise<Result<ComponentMap, SurfaceError>>;
|
|
8
|
+
}
|
|
9
|
+
declare function createAgnosticAdapter(): AgnosticFrameworkAdapter;
|
|
10
|
+
|
|
11
|
+
export { AGNOSTIC_ADAPTER_ID, type AgnosticFrameworkAdapter, createAgnosticAdapter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createSurfaceError } from "@zigrivers/surface-core";
|
|
3
|
+
import { parse } from "parse5";
|
|
4
|
+
var AGNOSTIC_ADAPTER_ID = "agnostic";
|
|
5
|
+
var NULL_REPLACEMENT_CHARACTER = "\uFFFD";
|
|
6
|
+
var SUPPORTED_EXTENSIONS = [".html", ".htm", ".xhtml"];
|
|
7
|
+
var COMPONENT_ATTRIBUTES = ["data-component", "data-surface-component"];
|
|
8
|
+
var FALLBACK_SELECTORS = ["html", "body", "main"];
|
|
9
|
+
function createAgnosticAdapter() {
|
|
10
|
+
return {
|
|
11
|
+
id: AGNOSTIC_ADAPTER_ID,
|
|
12
|
+
supports: (file) => SUPPORTED_EXTENSIONS.some((extension) => file.toLowerCase().endsWith(extension)),
|
|
13
|
+
introspect(source) {
|
|
14
|
+
if (!isSourceFileRef(source)) {
|
|
15
|
+
return Promise.resolve(
|
|
16
|
+
err(
|
|
17
|
+
createSurfaceError("step_failed", "SourceFileRef requires string path and contents.")
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
return Promise.resolve(ok({ entries: introspectHtml(source) }));
|
|
23
|
+
} catch (cause) {
|
|
24
|
+
return Promise.resolve(
|
|
25
|
+
err(
|
|
26
|
+
createSurfaceError("step_failed", "Failed to introspect agnostic HTML source.", {
|
|
27
|
+
cause
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function ok(value) {
|
|
36
|
+
return { ok: true, value };
|
|
37
|
+
}
|
|
38
|
+
function err(error) {
|
|
39
|
+
return { ok: false, error };
|
|
40
|
+
}
|
|
41
|
+
function isSourceFileRef(source) {
|
|
42
|
+
if (typeof source !== "object" || source === null) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const candidate = source;
|
|
46
|
+
return typeof candidate.path === "string" && typeof candidate.contents === "string";
|
|
47
|
+
}
|
|
48
|
+
function introspectHtml(source) {
|
|
49
|
+
const document = parse(source.contents);
|
|
50
|
+
const entries = /* @__PURE__ */ new Map();
|
|
51
|
+
const fallbackSelectors = /* @__PURE__ */ new Set();
|
|
52
|
+
visitElements(document, (element) => {
|
|
53
|
+
if (isFallbackSelector(element.tagName)) {
|
|
54
|
+
fallbackSelectors.add(element.tagName);
|
|
55
|
+
}
|
|
56
|
+
for (const reference of componentReferencesFor(element)) {
|
|
57
|
+
const key = `${source.path}\0${reference.component}`;
|
|
58
|
+
const existing = entries.get(key);
|
|
59
|
+
entries.set(
|
|
60
|
+
key,
|
|
61
|
+
existing === void 0 ? { component: reference.component, file: source.path, selectors: [reference.selector] } : { ...existing, selectors: [.../* @__PURE__ */ new Set([...existing.selectors, reference.selector])] }
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (entries.size > 0) {
|
|
66
|
+
return [...entries.values()];
|
|
67
|
+
}
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
component: "Document",
|
|
71
|
+
file: source.path,
|
|
72
|
+
selectors: FALLBACK_SELECTORS.filter((selector) => fallbackSelectors.has(selector))
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
function visitElements(node, visit) {
|
|
77
|
+
const pending = [node];
|
|
78
|
+
while (pending.length > 0) {
|
|
79
|
+
const current = pending.pop();
|
|
80
|
+
if (current === void 0) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (isElement(current)) {
|
|
84
|
+
visit(current);
|
|
85
|
+
}
|
|
86
|
+
const next = [];
|
|
87
|
+
if (isTemplateElement(current)) {
|
|
88
|
+
next.push(current.content);
|
|
89
|
+
}
|
|
90
|
+
if ("childNodes" in current) {
|
|
91
|
+
next.push(...current.childNodes);
|
|
92
|
+
}
|
|
93
|
+
for (let index = next.length - 1; index >= 0; index -= 1) {
|
|
94
|
+
const child = next[index];
|
|
95
|
+
if (child !== void 0) {
|
|
96
|
+
pending.push(child);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function isElement(node) {
|
|
102
|
+
return "tagName" in node && "attrs" in node;
|
|
103
|
+
}
|
|
104
|
+
function isTemplateElement(node) {
|
|
105
|
+
return isElement(node) && "content" in node;
|
|
106
|
+
}
|
|
107
|
+
function componentReferencesFor(element) {
|
|
108
|
+
return COMPONENT_ATTRIBUTES.flatMap((attribute) => {
|
|
109
|
+
const rawValue = getAttribute(element, attribute);
|
|
110
|
+
const component = sanitizeComponentName(rawValue);
|
|
111
|
+
if (component !== void 0) {
|
|
112
|
+
return [{ component, selector: `[${attribute}="${escapeCssString(rawValue ?? "")}"]` }];
|
|
113
|
+
}
|
|
114
|
+
return [];
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function getAttribute(element, name) {
|
|
118
|
+
return element.attrs.find((attribute) => attribute.name === name)?.value;
|
|
119
|
+
}
|
|
120
|
+
function isFallbackSelector(tagName) {
|
|
121
|
+
return FALLBACK_SELECTORS.includes(tagName);
|
|
122
|
+
}
|
|
123
|
+
function sanitizeComponentName(value) {
|
|
124
|
+
const component = value === void 0 ? void 0 : normalizeNullCharacters(value).trim();
|
|
125
|
+
return component === void 0 || component.length === 0 ? void 0 : component;
|
|
126
|
+
}
|
|
127
|
+
function normalizeNullCharacters(value) {
|
|
128
|
+
return value.replaceAll("\0", NULL_REPLACEMENT_CHARACTER);
|
|
129
|
+
}
|
|
130
|
+
function escapeCssString(value) {
|
|
131
|
+
return Array.from(normalizeNullCharacters(value), (character) => {
|
|
132
|
+
const codePoint = character.codePointAt(0);
|
|
133
|
+
if (codePoint >= 1 && codePoint <= 31 || codePoint === 127) {
|
|
134
|
+
return `\\${codePoint.toString(16)} `;
|
|
135
|
+
}
|
|
136
|
+
if (character === '"' || character === "\\") {
|
|
137
|
+
return `\\${character}`;
|
|
138
|
+
}
|
|
139
|
+
return character;
|
|
140
|
+
}).join("");
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
AGNOSTIC_ADAPTER_ID,
|
|
144
|
+
createAgnosticAdapter
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n ComponentMap,\n ComponentMapEntry,\n FrameworkAdapter,\n SourceFileRef,\n} from \"@zigrivers/surface-core/interfaces\";\nimport { createSurfaceError, type Result, type SurfaceError } from \"@zigrivers/surface-core\";\nimport { parse, type DefaultTreeAdapterMap } from \"parse5\";\n\nexport const AGNOSTIC_ADAPTER_ID = \"agnostic\";\n\nconst NULL_REPLACEMENT_CHARACTER = \"\\uFFFD\";\nconst SUPPORTED_EXTENSIONS = [\".html\", \".htm\", \".xhtml\"] as const;\nconst COMPONENT_ATTRIBUTES = [\"data-component\", \"data-surface-component\"] as const;\nconst FALLBACK_SELECTORS = [\"html\", \"body\", \"main\"] as const;\n\ntype ParseNode = DefaultTreeAdapterMap[\"node\"];\ntype ParseElement = DefaultTreeAdapterMap[\"element\"];\ntype ParseTemplate = DefaultTreeAdapterMap[\"template\"];\n\nexport interface AgnosticFrameworkAdapter extends FrameworkAdapter {\n readonly id: typeof AGNOSTIC_ADAPTER_ID;\n introspect(source: SourceFileRef): Promise<Result<ComponentMap, SurfaceError>>;\n}\n\nexport function createAgnosticAdapter(): AgnosticFrameworkAdapter {\n return {\n id: AGNOSTIC_ADAPTER_ID,\n supports: (file: string) =>\n SUPPORTED_EXTENSIONS.some((extension) => file.toLowerCase().endsWith(extension)),\n introspect(source: SourceFileRef) {\n if (!isSourceFileRef(source)) {\n return Promise.resolve(\n err(\n createSurfaceError(\"step_failed\", \"SourceFileRef requires string path and contents.\"),\n ),\n );\n }\n\n try {\n return Promise.resolve(ok({ entries: introspectHtml(source) }));\n } catch (cause) {\n return Promise.resolve(\n err(\n createSurfaceError(\"step_failed\", \"Failed to introspect agnostic HTML source.\", {\n cause,\n }),\n ),\n );\n }\n },\n };\n}\n\nfunction ok<T>(value: T): Result<T, SurfaceError> {\n return { ok: true, value };\n}\n\nfunction err(error: SurfaceError): Result<never, SurfaceError> {\n return { ok: false, error };\n}\n\nfunction isSourceFileRef(source: unknown): source is SourceFileRef {\n if (typeof source !== \"object\" || source === null) {\n return false;\n }\n\n const candidate = source as { readonly path?: unknown; readonly contents?: unknown };\n\n return typeof candidate.path === \"string\" && typeof candidate.contents === \"string\";\n}\n\nfunction introspectHtml(source: SourceFileRef): ComponentMapEntry[] {\n const document = parse(source.contents);\n const entries = new Map<string, ComponentMapEntry>();\n const fallbackSelectors = new Set<string>();\n\n visitElements(document, (element) => {\n if (isFallbackSelector(element.tagName)) {\n fallbackSelectors.add(element.tagName);\n }\n\n for (const reference of componentReferencesFor(element)) {\n const key = `${source.path}\\0${reference.component}`;\n const existing = entries.get(key);\n\n entries.set(\n key,\n existing === undefined\n ? { component: reference.component, file: source.path, selectors: [reference.selector] }\n : { ...existing, selectors: [...new Set([...existing.selectors, reference.selector])] },\n );\n }\n });\n\n if (entries.size > 0) {\n return [...entries.values()];\n }\n\n return [\n {\n component: \"Document\",\n file: source.path,\n selectors: FALLBACK_SELECTORS.filter((selector) => fallbackSelectors.has(selector)),\n },\n ];\n}\n\nfunction visitElements(node: ParseNode, visit: (element: ParseElement) => void): void {\n const pending: ParseNode[] = [node];\n\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current === undefined) {\n continue;\n }\n\n if (isElement(current)) {\n visit(current);\n }\n\n const next: ParseNode[] = [];\n\n if (isTemplateElement(current)) {\n next.push(current.content);\n }\n\n if (\"childNodes\" in current) {\n next.push(...current.childNodes);\n }\n\n for (let index = next.length - 1; index >= 0; index -= 1) {\n const child = next[index];\n\n if (child !== undefined) {\n pending.push(child);\n }\n }\n }\n}\n\nfunction isElement(node: ParseNode): node is ParseElement {\n return \"tagName\" in node && \"attrs\" in node;\n}\n\nfunction isTemplateElement(node: ParseNode): node is ParseTemplate {\n return isElement(node) && \"content\" in node;\n}\n\nfunction componentReferencesFor(\n element: ParseElement,\n): Array<{ readonly component: string; readonly selector: string }> {\n return COMPONENT_ATTRIBUTES.flatMap((attribute) => {\n const rawValue = getAttribute(element, attribute);\n const component = sanitizeComponentName(rawValue);\n\n if (component !== undefined) {\n return [{ component, selector: `[${attribute}=\"${escapeCssString(rawValue ?? \"\")}\"]` }];\n }\n\n return [];\n });\n}\n\nfunction getAttribute(element: ParseElement, name: string): string | undefined {\n return element.attrs.find((attribute) => attribute.name === name)?.value;\n}\n\nfunction isFallbackSelector(tagName: string): tagName is (typeof FALLBACK_SELECTORS)[number] {\n return FALLBACK_SELECTORS.includes(tagName as (typeof FALLBACK_SELECTORS)[number]);\n}\n\nfunction sanitizeComponentName(value: string | undefined): string | undefined {\n const component = value === undefined ? undefined : normalizeNullCharacters(value).trim();\n\n return component === undefined || component.length === 0 ? undefined : component;\n}\n\nfunction normalizeNullCharacters(value: string): string {\n return value.replaceAll(\"\\0\", NULL_REPLACEMENT_CHARACTER);\n}\n\nfunction escapeCssString(value: string): string {\n return Array.from(normalizeNullCharacters(value), (character) => {\n const codePoint = character.codePointAt(0)!;\n\n if ((codePoint >= 1 && codePoint <= 0x1f) || codePoint === 0x7f) {\n return `\\\\${codePoint.toString(16)} `;\n }\n\n if (character === '\"' || character === \"\\\\\") {\n return `\\\\${character}`;\n }\n\n return character;\n }).join(\"\");\n}\n"],"mappings":";AAMA,SAAS,0BAA0D;AACnE,SAAS,aAAyC;AAE3C,IAAM,sBAAsB;AAEnC,IAAM,6BAA6B;AACnC,IAAM,uBAAuB,CAAC,SAAS,QAAQ,QAAQ;AACvD,IAAM,uBAAuB,CAAC,kBAAkB,wBAAwB;AACxE,IAAM,qBAAqB,CAAC,QAAQ,QAAQ,MAAM;AAW3C,SAAS,wBAAkD;AAChE,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,UAAU,CAAC,SACT,qBAAqB,KAAK,CAAC,cAAc,KAAK,YAAY,EAAE,SAAS,SAAS,CAAC;AAAA,IACjF,WAAW,QAAuB;AAChC,UAAI,CAAC,gBAAgB,MAAM,GAAG;AAC5B,eAAO,QAAQ;AAAA,UACb;AAAA,YACE,mBAAmB,eAAe,kDAAkD;AAAA,UACtF;AAAA,QACF;AAAA,MACF;AAEA,UAAI;AACF,eAAO,QAAQ,QAAQ,GAAG,EAAE,SAAS,eAAe,MAAM,EAAE,CAAC,CAAC;AAAA,MAChE,SAAS,OAAO;AACd,eAAO,QAAQ;AAAA,UACb;AAAA,YACE,mBAAmB,eAAe,8CAA8C;AAAA,cAC9E;AAAA,YACF,CAAC;AAAA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AAEA,SAAS,sBAAsB,OAA+C;AAC5E,QAAM,YAAY,UAAU,SAAY,SAAY,wBAAwB,KAAK,EAAE,KAAK;AAExF,SAAO,cAAc,UAAa,UAAU,WAAW,IAAI,SAAY;AACzE;AAEA,SAAS,wBAAwB,OAAuB;AACtD,SAAO,MAAM,WAAW,MAAM,0BAA0B;AAC1D;AAEA,SAAS,gBAAgB,OAAuB;AAC9C,SAAO,MAAM,KAAK,wBAAwB,KAAK,GAAG,CAAC,cAAc;AAC/D,UAAM,YAAY,UAAU,YAAY,CAAC;AAEzC,QAAK,aAAa,KAAK,aAAa,MAAS,cAAc,KAAM;AAC/D,aAAO,KAAK,UAAU,SAAS,EAAE,CAAC;AAAA,IACpC;AAEA,QAAI,cAAc,OAAO,cAAc,MAAM;AAC3C,aAAO,KAAK,SAAS;AAAA,IACvB;AAEA,WAAO;AAAA,EACT,CAAC,EAAE,KAAK,EAAE;AACZ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zigrivers/surface-adapter-agnostic",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"parse5": "^8.0.0",
|
|
20
|
+
"@zigrivers/surface-core": "0.1.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.13.0",
|
|
24
|
+
"eslint": "^9.39.4",
|
|
25
|
+
"tsup": "^8.5.1",
|
|
26
|
+
"typescript": "^5.9.3",
|
|
27
|
+
"vitest": "^4.0.14"
|
|
28
|
+
},
|
|
29
|
+
"description": "Framework-agnostic HTML adapter for Surface audits",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"homepage": "https://github.com/zigrivers/surface#readme",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/zigrivers/surface.git",
|
|
35
|
+
"directory": "packages/adapters/agnostic"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/zigrivers/surface/issues"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"surface",
|
|
42
|
+
"adapter",
|
|
43
|
+
"html"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"provenance": true
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"build:smoke": "node scripts/build-smoke.mjs",
|
|
52
|
+
"clean": "node scripts/clean.mjs",
|
|
53
|
+
"lint": "eslint src",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest",
|
|
56
|
+
"typecheck": "tsc --noEmit"
|
|
57
|
+
}
|
|
58
|
+
}
|