@ankhorage/rules-design 0.6.0 → 0.8.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/CHANGELOG.md +12 -0
- package/README.md +2 -1
- package/dist/features/recognition/createWebsiteAssetIndex.d.ts +3 -0
- package/dist/features/recognition/createWebsiteAssetIndex.js +13 -0
- package/dist/features/recognition/qualifyWebsiteRecognitionProps.d.ts +3 -0
- package/dist/features/recognition/qualifyWebsiteRecognitionProps.js +28 -0
- package/dist/features/recognition/recognizeWebsiteDocument.d.ts +3 -0
- package/dist/features/recognition/recognizeWebsiteDocument.js +203 -0
- package/dist/features/recognition/validateWebsiteObservationDocument.d.ts +3 -0
- package/dist/features/recognition/validateWebsiteObservationDocument.js +29 -0
- package/dist/features/website-recognition/recognizeWebsiteStructure.d.ts +9 -0
- package/dist/features/website-recognition/recognizeWebsiteStructure.js +209 -0
- package/dist/features/website-recognition/recognizeWebsiteStructureProps.d.ts +3 -0
- package/dist/features/website-recognition/recognizeWebsiteStructureProps.js +36 -0
- package/dist/features/website-recognition/websiteStructureSemantics.d.ts +2 -0
- package/dist/features/website-recognition/websiteStructureSemantics.js +27 -0
- package/dist/features/website-recognition/websiteStructureTreeNodes.d.ts +4 -0
- package/dist/features/website-recognition/websiteStructureTreeNodes.js +39 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cd12383: Add the deterministic `recognizeWebsiteDocument` public recognition assembly API.
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- e6da8f0: Add a pure website structure recognizer that maps observed pages to source-linked canonical UI trees.
|
|
14
|
+
|
|
3
15
|
## 0.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/rules-design
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Declarative catalog for reusable design rules.
|
|
9
9
|
|
|
@@ -38,4 +38,5 @@ import { createRuleRegistry, evaluateRules } from '@ankhorage/rules';
|
|
|
38
38
|
- [Module relationships](././paradox/diagrams/module-relationships.mmd)
|
|
39
39
|
- [Export graph](././paradox/diagrams/export-graph.mmd)
|
|
40
40
|
- [recognizeWebsiteDesignProperties sequence](././paradox/diagrams/sequences/recognize-website-design-properties.mmd)
|
|
41
|
+
- [recognizeWebsiteDocument sequence](././paradox/diagrams/sequences/recognize-website-document.mmd)
|
|
41
42
|
- [selectDesignRuleProfile sequence](././paradox/diagrams/sequences/select-design-rule-profile.mmd)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WebsiteAsset, WebsiteObservationDocument } from '@ankhorage/contracts/website';
|
|
2
|
+
/*** Indexes globally named assets only after rejecting incompatible duplicate identities. */
|
|
3
|
+
export declare function createWebsiteAssetIndex(document: WebsiteObservationDocument): ReadonlyMap<string, WebsiteAsset>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*** Indexes globally named assets only after rejecting incompatible duplicate identities. */
|
|
2
|
+
export function createWebsiteAssetIndex(document) {
|
|
3
|
+
return new Map([
|
|
4
|
+
...Map.groupBy(document.pages.flatMap((page) => page.assets), (asset) => asset.id),
|
|
5
|
+
].map(([id, assets]) => {
|
|
6
|
+
const [asset] = assets;
|
|
7
|
+
if (assets.some((candidate) => candidate.url !== asset.url ||
|
|
8
|
+
candidate.kind !== asset.kind ||
|
|
9
|
+
candidate.contentType !== asset.contentType))
|
|
10
|
+
throw new TypeError(`Conflicting asset identity ${id}.`);
|
|
11
|
+
return [id, asset];
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WebsiteRecognizedProp } from '@ankhorage/contracts/website';
|
|
2
|
+
/*** Qualifies nested structural source evidence so equal DOM paths remain page-unique. */
|
|
3
|
+
export declare function qualifyWebsiteRecognitionProps(property: WebsiteRecognizedProp, pageId: string): WebsiteRecognizedProp;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*** Qualifies nested structural source evidence so equal DOM paths remain page-unique. */
|
|
2
|
+
export function qualifyWebsiteRecognitionProps(property, pageId) {
|
|
3
|
+
return {
|
|
4
|
+
...property,
|
|
5
|
+
originalValues: property.originalValues.map((value) => qualifySourceReferences(value, pageId)),
|
|
6
|
+
value: qualifySourceReferences(property.value, pageId),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/*** Qualifies the source references in a structural property list without altering observed literals. */
|
|
10
|
+
function qualifySourceReferences(value, pageId) {
|
|
11
|
+
if (!isSerializableArray(value))
|
|
12
|
+
return value;
|
|
13
|
+
return value.map((item) => isSourceReference(item)
|
|
14
|
+
? { ...item, sourceRef: JSON.stringify([pageId, item.sourceRef]) }
|
|
15
|
+
: item);
|
|
16
|
+
}
|
|
17
|
+
/*** Narrows a serializable value to its immutable list representation. */
|
|
18
|
+
function isSerializableArray(value) {
|
|
19
|
+
return Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
/*** Narrows the portable source-linked records used by structural text, link, and media props. */
|
|
22
|
+
function isSourceReference(value) {
|
|
23
|
+
return (value !== null &&
|
|
24
|
+
typeof value === 'object' &&
|
|
25
|
+
!Array.isArray(value) &&
|
|
26
|
+
'sourceRef' in value &&
|
|
27
|
+
typeof value.sourceRef === 'string');
|
|
28
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WebsiteObservationDocument, WebsiteRecognitionDocument } from '@ankhorage/contracts/website';
|
|
2
|
+
/*** Assembles the public website recognition contract from structural and factual design recognition. */
|
|
3
|
+
export declare function recognizeWebsiteDocument(document: WebsiteObservationDocument): WebsiteRecognitionDocument;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { recognizeWebsiteStructure } from '../website-recognition/recognizeWebsiteStructure';
|
|
2
|
+
import { createWebsiteAssetIndex } from './createWebsiteAssetIndex';
|
|
3
|
+
import { qualifyWebsiteRecognitionProps } from './qualifyWebsiteRecognitionProps';
|
|
4
|
+
import { recognizeWebsiteDesignProperties } from './recognizeWebsiteDesignProperties';
|
|
5
|
+
import { validateWebsiteObservationDocument } from './validateWebsiteObservationDocument';
|
|
6
|
+
/*** Assembles the public website recognition contract from structural and factual design recognition. */
|
|
7
|
+
export function recognizeWebsiteDocument(document) {
|
|
8
|
+
validateWebsiteObservationDocument(document);
|
|
9
|
+
const design = recognizeWebsiteDesignProperties(document);
|
|
10
|
+
const pages = recognizeWebsiteStructure(document).map((page) => assemblePage(page, observedPageFor(document, page.id), design.nodes));
|
|
11
|
+
return {
|
|
12
|
+
designTokens: design.tokenCandidates.map(assembleDesignToken),
|
|
13
|
+
documentId: `recognition:${document.documentId}`,
|
|
14
|
+
media: assembleMedia(document),
|
|
15
|
+
navigation: document.pages.flatMap((page) => page.navigation.map((item) => ({
|
|
16
|
+
...item,
|
|
17
|
+
sourceRef: sourceIdentity(page.id, item.sourceRef),
|
|
18
|
+
}))),
|
|
19
|
+
observedDocumentId: document.documentId,
|
|
20
|
+
pages,
|
|
21
|
+
recognizedAt: document.collectedAt,
|
|
22
|
+
schemaVersion: 1,
|
|
23
|
+
site: document.site,
|
|
24
|
+
source: document.source,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/*** Finds the validated observed page required to join a structural recognition. */
|
|
28
|
+
function observedPageFor(document, pageId) {
|
|
29
|
+
const page = document.pages.find((candidate) => candidate.id === pageId);
|
|
30
|
+
if (page === undefined)
|
|
31
|
+
throw new TypeError(`Missing observed page ${pageId}.`);
|
|
32
|
+
return page;
|
|
33
|
+
}
|
|
34
|
+
/*** Joins factual design observations with the structural page tree by page-local source identity. */
|
|
35
|
+
function assemblePage(page, observedPage, designNodes) {
|
|
36
|
+
const designBySourceRef = new Map(designNodes
|
|
37
|
+
.filter((node) => node.pageId === page.id)
|
|
38
|
+
.map((node) => [node.sourceRef, node]));
|
|
39
|
+
const nodes = page.nodes.map((node) => assembleNode(node, observedPage, designBySourceRef));
|
|
40
|
+
const nodesById = new Map(nodes.map((node) => [node.id, node]));
|
|
41
|
+
return {
|
|
42
|
+
...page,
|
|
43
|
+
nodes,
|
|
44
|
+
root: assembleUiNode(page.root, page.id, nodesById),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/*** Adds exact base, responsive, and unresolved design evidence to one structural recognition. */
|
|
48
|
+
function assembleNode(node, page, designBySourceRef) {
|
|
49
|
+
const design = node.sourceRefs.flatMap((sourceRef) => {
|
|
50
|
+
const candidate = designBySourceRef.get(sourceRef);
|
|
51
|
+
return candidate === undefined ? [] : [candidate];
|
|
52
|
+
});
|
|
53
|
+
const ownerDesign = design.filter((candidate) => candidate.sourceRef === node.id);
|
|
54
|
+
const inheritedDesign = design.filter((candidate) => candidate.sourceRef !== node.id);
|
|
55
|
+
const baseViewportId = page.viewports[0]?.id;
|
|
56
|
+
const baseStateId = page.states[0]?.id;
|
|
57
|
+
const designProperties = [...ownerDesign, ...inheritedDesign].flatMap((candidate) => [
|
|
58
|
+
...candidate.colors,
|
|
59
|
+
...candidate.typography,
|
|
60
|
+
...candidate.layout,
|
|
61
|
+
...candidate.responsive,
|
|
62
|
+
]);
|
|
63
|
+
return {
|
|
64
|
+
...node,
|
|
65
|
+
id: sourceIdentity(page.id, node.id),
|
|
66
|
+
props: mergeProperties([
|
|
67
|
+
...node.props.map((property) => qualifyWebsiteRecognitionProps(property, page.id)),
|
|
68
|
+
...baseProperties(designProperties, baseViewportId, baseStateId),
|
|
69
|
+
...unresolvedProperties(design),
|
|
70
|
+
]),
|
|
71
|
+
responsive: responsiveVariants(designProperties, baseViewportId, baseStateId),
|
|
72
|
+
sourceRefs: node.sourceRefs.map((sourceRef) => sourceIdentity(page.id, sourceRef)),
|
|
73
|
+
unresolved: node.unresolved === null
|
|
74
|
+
? null
|
|
75
|
+
: {
|
|
76
|
+
...node.unresolved,
|
|
77
|
+
sourceRefs: node.unresolved.sourceRefs.map((sourceRef) => sourceIdentity(page.id, sourceRef)),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/*** Selects the first declared viewport and state as the stable non-responsive property baseline. */
|
|
82
|
+
function baseProperties(observations, viewportId, stateId) {
|
|
83
|
+
return observations
|
|
84
|
+
.filter((observation) => observation.viewportId === viewportId && observation.stateId === stateId)
|
|
85
|
+
.map((observation) => propertyFromObservation(observation, stateId));
|
|
86
|
+
}
|
|
87
|
+
/*** Groups every non-baseline measured property by viewport without fabricating breakpoints. */
|
|
88
|
+
function responsiveVariants(observations, baseViewportId, baseStateId) {
|
|
89
|
+
return [
|
|
90
|
+
...Map.groupBy(observations.filter((observation) => observation.viewportId !== baseViewportId || observation.stateId !== baseStateId), (observation) => observation.viewportId),
|
|
91
|
+
]
|
|
92
|
+
.map(([viewportId, properties]) => ({
|
|
93
|
+
props: mergeProperties(properties.map((observation) => propertyFromObservation(observation, baseStateId))),
|
|
94
|
+
viewportId,
|
|
95
|
+
}))
|
|
96
|
+
.toSorted((left, right) => left.viewportId.localeCompare(right.viewportId));
|
|
97
|
+
}
|
|
98
|
+
/*** Represents unavailable source evidence explicitly inside the DTO's extensible property channel. */
|
|
99
|
+
function unresolvedProperties(design) {
|
|
100
|
+
return design.flatMap((node) => node.unresolved.map((unresolved) => ({
|
|
101
|
+
name: `unresolved:${unresolved.stateId}:${unresolved.viewportId}:${unresolved.kind}`,
|
|
102
|
+
originalValues: [unresolvedValue(unresolved.missing)],
|
|
103
|
+
value: unresolvedValue(unresolved.missing),
|
|
104
|
+
})));
|
|
105
|
+
}
|
|
106
|
+
/*** Converts the portable missing-value DTO to the serializable map shape required by property values. */
|
|
107
|
+
function unresolvedValue(missing) {
|
|
108
|
+
return { code: missing.code, message: missing.message };
|
|
109
|
+
}
|
|
110
|
+
/*** Converts factual style samples to property names that retain state identity when it is not baseline. */
|
|
111
|
+
function propertyFromObservation(observation, baselineStateId) {
|
|
112
|
+
return {
|
|
113
|
+
name: observation.stateId === baselineStateId
|
|
114
|
+
? observation.name
|
|
115
|
+
: `state:${observation.stateId}:${observation.name}`,
|
|
116
|
+
originalValues: [observation.value],
|
|
117
|
+
value: observation.value,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/*** Merges duplicate property samples while retaining every original value in stable JSON order. */
|
|
121
|
+
function mergeProperties(properties) {
|
|
122
|
+
return [...Map.groupBy(properties, (property) => property.name)]
|
|
123
|
+
.map(([name, values]) => ({
|
|
124
|
+
name,
|
|
125
|
+
originalValues: uniqueSerializableValues(values.flatMap((value) => value.originalValues)),
|
|
126
|
+
value: first(values).value,
|
|
127
|
+
}))
|
|
128
|
+
.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
129
|
+
}
|
|
130
|
+
/*** Reads a non-empty collected group after the grouping operation that created it. */
|
|
131
|
+
function first(values) {
|
|
132
|
+
const [value] = values;
|
|
133
|
+
if (value === undefined)
|
|
134
|
+
throw new TypeError('Expected a non-empty collection.');
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
/*** Deduplicates serializable literals by their exact JSON representation without coercion. */
|
|
138
|
+
function uniqueSerializableValues(values) {
|
|
139
|
+
return [...new Map(values.map((value) => [JSON.stringify(value), value])).values()];
|
|
140
|
+
}
|
|
141
|
+
/*** Rebuilds the canonical tree so node IDs and props agree with the assembled node mapping. */
|
|
142
|
+
function assembleUiNode(node, pageId, nodesById) {
|
|
143
|
+
const recognized = nodesById.get(sourceIdentity(pageId, node.id));
|
|
144
|
+
return {
|
|
145
|
+
...(node.children === undefined
|
|
146
|
+
? {}
|
|
147
|
+
: { children: node.children.map((child) => assembleUiNode(child, pageId, nodesById)) }),
|
|
148
|
+
id: sourceIdentity(pageId, node.id),
|
|
149
|
+
...(recognized === undefined || recognized.props.length === 0
|
|
150
|
+
? {}
|
|
151
|
+
: {
|
|
152
|
+
props: Object.fromEntries(recognized.props.map((property) => [property.name, property.value])),
|
|
153
|
+
}),
|
|
154
|
+
type: node.type,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/*** Converts role-free factual token candidates to the published, source-qualified token contract. */
|
|
158
|
+
function assembleDesignToken(candidate) {
|
|
159
|
+
return {
|
|
160
|
+
id: JSON.stringify([candidate.kind, candidate.property, candidate.value]),
|
|
161
|
+
kind: candidate.kind,
|
|
162
|
+
originalValues: candidate.originalValues,
|
|
163
|
+
sourceRefs: candidate.sourceRefs.map((reference) => sourceIdentity(reference.pageId, reference.sourceRef)),
|
|
164
|
+
value: candidate.value,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/*** Deduplicates media by known asset identity or exact anonymous media identity while retaining sources. */
|
|
168
|
+
function assembleMedia(document) {
|
|
169
|
+
const assetIndex = createWebsiteAssetIndex(document);
|
|
170
|
+
const references = [
|
|
171
|
+
...document.pages.flatMap((page) => page.nodes.flatMap((node) => node.media.map((media) => ({ media, pageId: page.id })))),
|
|
172
|
+
...document.pages.flatMap((page) => page.assets.flatMap((asset) => (asset.sourceRefs.length === 0 ? [undefined] : asset.sourceRefs).map((sourceRef) => ({
|
|
173
|
+
media: { assetId: asset.id, kind: asset.kind, sourceRef, url: asset.url },
|
|
174
|
+
pageId: page.id,
|
|
175
|
+
})))),
|
|
176
|
+
];
|
|
177
|
+
return [
|
|
178
|
+
...Map.groupBy(references, ({ media }) => media.assetId === null ? `${media.kind}\u0000${media.url}` : `asset\u0000${media.assetId}`),
|
|
179
|
+
]
|
|
180
|
+
.map(([identity, entries]) => assembleMediaGroup(identity, entries, assetIndex))
|
|
181
|
+
.toSorted((left, right) => left.id.localeCompare(right.id));
|
|
182
|
+
}
|
|
183
|
+
/*** Assembles one deduplicated media record and rejects incompatible observations sharing an asset ID. */
|
|
184
|
+
function assembleMediaGroup(identity, entries, assetsById) {
|
|
185
|
+
const firstEntry = first(entries);
|
|
186
|
+
if (entries.some((entry) => entry.media.url !== firstEntry.media.url))
|
|
187
|
+
throw new TypeError(`Conflicting URLs for media ${identity}.`);
|
|
188
|
+
const asset = firstEntry.media.assetId === null ? undefined : assetsById.get(firstEntry.media.assetId);
|
|
189
|
+
return {
|
|
190
|
+
asset: asset === undefined ? null : { mediaId: asset.id },
|
|
191
|
+
id: identity,
|
|
192
|
+
originalUrl: firstEntry.media.url,
|
|
193
|
+
sourceRefs: [
|
|
194
|
+
...new Set(entries.flatMap((entry) => entry.media.sourceRef === undefined
|
|
195
|
+
? []
|
|
196
|
+
: [sourceIdentity(entry.pageId, entry.media.sourceRef)])),
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/*** Serializes a two-part source identity without delimiters that could collide with source content. */
|
|
201
|
+
function sourceIdentity(pageId, sourceRef) {
|
|
202
|
+
return JSON.stringify([pageId, sourceRef]);
|
|
203
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WebsiteObservationDocument } from '@ankhorage/contracts/website';
|
|
2
|
+
/*** Validates the identity and reference invariants required for deterministic recognition assembly. */
|
|
3
|
+
export declare function validateWebsiteObservationDocument(document: WebsiteObservationDocument): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*** Validates the identity and reference invariants required for deterministic recognition assembly. */
|
|
2
|
+
export function validateWebsiteObservationDocument(document) {
|
|
3
|
+
const schemaVersion = document.schemaVersion;
|
|
4
|
+
if (schemaVersion !== 1)
|
|
5
|
+
throw new TypeError('Unsupported website observation schema.');
|
|
6
|
+
if (document.documentId.length === 0)
|
|
7
|
+
throw new TypeError('Website observation documentId is required.');
|
|
8
|
+
unique(document.pages.map((page) => page.id), 'page id');
|
|
9
|
+
document.pages.forEach(validatePage);
|
|
10
|
+
}
|
|
11
|
+
/*** Validates page-local references without rejecting malformed hierarchy evidence that recognition must retain. */
|
|
12
|
+
function validatePage(page) {
|
|
13
|
+
unique(page.nodes.map((node) => node.sourceRef), `source reference on page ${page.id}`);
|
|
14
|
+
unique(page.viewports.map((viewport) => viewport.id), `viewport id on page ${page.id}`);
|
|
15
|
+
unique(page.states.map((state) => state.id), `state id on page ${page.id}`);
|
|
16
|
+
const viewportIds = new Set(page.viewports.map((viewport) => viewport.id));
|
|
17
|
+
const stateIds = new Set(page.states.map((state) => state.id));
|
|
18
|
+
page.nodes.forEach((node) => node.observations.forEach((observation) => {
|
|
19
|
+
if (!viewportIds.has(observation.viewportId))
|
|
20
|
+
throw new TypeError(`Unknown viewport ${observation.viewportId} on page ${page.id}.`);
|
|
21
|
+
if (!stateIds.has(observation.stateId))
|
|
22
|
+
throw new TypeError(`Unknown state ${observation.stateId} on page ${page.id}.`);
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
/*** Rejects ambiguous identities before a Map could silently overwrite an observation. */
|
|
26
|
+
function unique(values, label) {
|
|
27
|
+
if (new Set(values).size !== values.length)
|
|
28
|
+
throw new TypeError(`Duplicate ${label}.`);
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UiNode } from '@ankhorage/contracts';
|
|
2
|
+
import type { WebsiteObservationDocument, WebsitePageRecognition, WebsiteRecognizedNode } from '@ankhorage/contracts/website';
|
|
3
|
+
/*** Recognizes source-linked canonical component trees from validated website observations. */
|
|
4
|
+
export declare function recognizeWebsiteStructure(document: WebsiteObservationDocument): readonly WebsitePageRecognition[];
|
|
5
|
+
export interface RecognizedTreeNode {
|
|
6
|
+
readonly node: WebsiteRecognizedNode;
|
|
7
|
+
readonly nodes: readonly WebsiteRecognizedNode[];
|
|
8
|
+
readonly uiNode: UiNode;
|
|
9
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { recognizeWebsiteStructureProps } from './recognizeWebsiteStructureProps';
|
|
2
|
+
import { recognizeWebsiteStructureSemanticComponentType } from './websiteStructureSemantics';
|
|
3
|
+
import { createWebsiteStructureTreeNode } from './websiteStructureTreeNodes';
|
|
4
|
+
/*** Recognizes source-linked canonical component trees from validated website observations. */
|
|
5
|
+
export function recognizeWebsiteStructure(document) {
|
|
6
|
+
return document.pages.map(recognizePage);
|
|
7
|
+
}
|
|
8
|
+
/*** Recognizes one page while retaining every source node in the canonical tree or node mapping. */
|
|
9
|
+
function recognizePage(page) {
|
|
10
|
+
const nodesBySourceRef = new Map(page.nodes.map((node) => [node.sourceRef, node]));
|
|
11
|
+
const childNodesByParent = createChildNodesByParent(page.nodes);
|
|
12
|
+
const rootNodes = page.nodes.filter((node) => node.parentSourceRef === null || !nodesBySourceRef.has(node.parentSourceRef));
|
|
13
|
+
const recognizedNodes = rootNodes.flatMap((node) => recognizeTreeNode(node, nodesBySourceRef, childNodesByParent, node.parentSourceRef, [], []));
|
|
14
|
+
const allRecognitions = page.nodes.reduce((recognitions, node) => containsSourceRef(recognitions, node.sourceRef)
|
|
15
|
+
? recognitions
|
|
16
|
+
: [
|
|
17
|
+
...recognitions,
|
|
18
|
+
...recognizeTreeNode(node, nodesBySourceRef, childNodesByParent, null, [], []),
|
|
19
|
+
], recognizedNodes);
|
|
20
|
+
return {
|
|
21
|
+
id: page.id,
|
|
22
|
+
nodes: allRecognitions.flatMap((recognition) => recognition.nodes),
|
|
23
|
+
path: page.path,
|
|
24
|
+
root: {
|
|
25
|
+
children: allRecognitions.map((recognition) => recognition.uiNode),
|
|
26
|
+
id: `${page.id}:root`,
|
|
27
|
+
type: 'Container',
|
|
28
|
+
},
|
|
29
|
+
url: page.url,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/*** Indexes observed children in DOM order for deterministic parent traversal. */
|
|
33
|
+
function createChildNodesByParent(nodes) {
|
|
34
|
+
const entries = nodes.reduce((childrenByParent, node) => {
|
|
35
|
+
if (node.parentSourceRef === null)
|
|
36
|
+
return childrenByParent;
|
|
37
|
+
const siblings = childrenByParent.get(node.parentSourceRef) ?? [];
|
|
38
|
+
return new Map(childrenByParent).set(node.parentSourceRef, [...siblings, node]);
|
|
39
|
+
}, new Map());
|
|
40
|
+
return new Map([...entries].map(([parentSourceRef, children]) => [
|
|
41
|
+
parentSourceRef,
|
|
42
|
+
[...children].sort(compareDomOrder),
|
|
43
|
+
]));
|
|
44
|
+
}
|
|
45
|
+
/*** Orders source nodes by their observed sibling position and stable source reference. */
|
|
46
|
+
function compareDomOrder(left, right) {
|
|
47
|
+
return (left.dom.childIndex - right.dom.childIndex || left.sourceRef.localeCompare(right.sourceRef));
|
|
48
|
+
}
|
|
49
|
+
/*** Recognizes one node and folds transparent wrappers into their meaningful descendants. */
|
|
50
|
+
function recognizeTreeNode(node, nodesBySourceRef, childNodesByParent, effectiveParentSourceRef, inheritedSourceRefs, ancestorSourceRefs) {
|
|
51
|
+
if (ancestorSourceRefs.includes(node.sourceRef)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const children = childNodesByParent.get(node.sourceRef) ?? [];
|
|
55
|
+
if (!isCyclicSourceRef(node, nodesBySourceRef) && isTransparentWrapper(node, children)) {
|
|
56
|
+
return children.flatMap((child) => recognizeTreeNode(child, nodesBySourceRef, childNodesByParent, effectiveParentSourceRef, [...inheritedSourceRefs, node.sourceRef], [...ancestorSourceRefs, node.sourceRef]));
|
|
57
|
+
}
|
|
58
|
+
const childRecognitions = children.flatMap((child) => recognizeTreeNode(child, nodesBySourceRef, childNodesByParent, node.sourceRef, [], [...ancestorSourceRefs, node.sourceRef]));
|
|
59
|
+
return [
|
|
60
|
+
createRecognizedTreeNode(node, nodesBySourceRef.get(effectiveParentSourceRef ?? '') ?? null, childNodesByParent, nodesBySourceRef, inheritedSourceRefs, childRecognitions),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
/*** Combines component classification, source lineage, and child mappings into one canonical node. */
|
|
64
|
+
function createRecognizedTreeNode(node, parent, childNodesByParent, nodesBySourceRef, inheritedSourceRefs, children) {
|
|
65
|
+
const cyclic = isCyclicSourceRef(node, nodesBySourceRef);
|
|
66
|
+
const componentType = cyclic
|
|
67
|
+
? 'Unknown'
|
|
68
|
+
: recognizeComponentType(node, parent, childNodesByParent);
|
|
69
|
+
const props = recognizeWebsiteStructureProps(node);
|
|
70
|
+
return createWebsiteStructureTreeNode(node, componentType, [...inheritedSourceRefs, node.sourceRef], props, children, cyclic
|
|
71
|
+
? 'Source hierarchy contains a cycle.'
|
|
72
|
+
: availableObservation(node) === null
|
|
73
|
+
? 'No available rendered observation exists for this source node.'
|
|
74
|
+
: 'Visible source node has no canonical component mapping.');
|
|
75
|
+
}
|
|
76
|
+
/*** Tests whether a source reference participates in a parent-reference cycle. */
|
|
77
|
+
function isCyclicSourceRef(node, nodesBySourceRef) {
|
|
78
|
+
const visitedSourceRefs = new Set();
|
|
79
|
+
let currentSourceRef = node.sourceRef;
|
|
80
|
+
while (currentSourceRef !== null) {
|
|
81
|
+
if (visitedSourceRefs.has(currentSourceRef))
|
|
82
|
+
return currentSourceRef === node.sourceRef;
|
|
83
|
+
visitedSourceRefs.add(currentSourceRef);
|
|
84
|
+
currentSourceRef = nodesBySourceRef.get(currentSourceRef)?.parentSourceRef ?? null;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
/*** Tests whether already emitted recognitions retain a source reference. */
|
|
89
|
+
function containsSourceRef(recognitions, sourceRef) {
|
|
90
|
+
return recognitions.some((recognition) => recognition.nodes.some((node) => node.sourceRefs.includes(sourceRef)));
|
|
91
|
+
}
|
|
92
|
+
/*** Identifies wrappers with no independently meaningful semantic, textual, media, or visual role. */
|
|
93
|
+
function isTransparentWrapper(node, children) {
|
|
94
|
+
const observation = availableObservation(node);
|
|
95
|
+
const tagName = node.dom.tagName.toLowerCase();
|
|
96
|
+
return (children.length > 0 &&
|
|
97
|
+
node.links.length === 0 &&
|
|
98
|
+
node.media.length === 0 &&
|
|
99
|
+
node.textRuns.length === 0 &&
|
|
100
|
+
(tagName === 'div' || tagName === 'span') &&
|
|
101
|
+
observation !== null &&
|
|
102
|
+
!hasLayoutRole(observation) &&
|
|
103
|
+
!hasSurfaceRole(observation));
|
|
104
|
+
}
|
|
105
|
+
/*** Maps observed DOM semantics and measured layout traits to already representable UI components. */
|
|
106
|
+
function recognizeComponentType(node, parent, childNodesByParent) {
|
|
107
|
+
const observation = availableObservation(node);
|
|
108
|
+
if (observation === null)
|
|
109
|
+
return 'Unknown';
|
|
110
|
+
const tagName = node.dom.tagName.toLowerCase();
|
|
111
|
+
const semanticType = recognizeWebsiteStructureSemanticComponentType(tagName);
|
|
112
|
+
if (semanticType !== null)
|
|
113
|
+
return semanticType;
|
|
114
|
+
if (node.media.length > 0)
|
|
115
|
+
return node.media.every((media) => media.kind === 'image') ? 'Image' : 'Media';
|
|
116
|
+
if (node.links.length > 0)
|
|
117
|
+
return 'Link';
|
|
118
|
+
if (node.textRuns.length > 0)
|
|
119
|
+
return 'RichText';
|
|
120
|
+
if (isGroupedCard(node, parent, childNodesByParent))
|
|
121
|
+
return 'Card';
|
|
122
|
+
const { css } = observation;
|
|
123
|
+
if (css === null)
|
|
124
|
+
return 'Unknown';
|
|
125
|
+
if (css.display.includes('grid'))
|
|
126
|
+
return 'Grid';
|
|
127
|
+
if (css.display.includes('flex'))
|
|
128
|
+
return 'Flex';
|
|
129
|
+
return hasLayoutRole(observation) || hasSurfaceRole(observation) ? 'Container' : 'Unknown';
|
|
130
|
+
}
|
|
131
|
+
/*** Recognizes a card only when a measured sibling group shares explicit surface traits. */
|
|
132
|
+
function isGroupedCard(node, parent, childNodesByParent) {
|
|
133
|
+
if (parent === null || !isLayoutGroup(parent))
|
|
134
|
+
return false;
|
|
135
|
+
const siblings = meaningfulChildren(parent.sourceRef, childNodesByParent);
|
|
136
|
+
return siblings.length >= 2 && siblings.every(isCardSurface) && isCardSurface(node);
|
|
137
|
+
}
|
|
138
|
+
/*** Flattens transparent DOM wrappers before measuring the source siblings in a layout group. */
|
|
139
|
+
function meaningfulChildren(parentSourceRef, childNodesByParent) {
|
|
140
|
+
const children = childNodesByParent.get(parentSourceRef) ?? [];
|
|
141
|
+
return children.flatMap((child) => {
|
|
142
|
+
const nestedChildren = childNodesByParent.get(child.sourceRef) ?? [];
|
|
143
|
+
return isTransparentWrapper(child, nestedChildren)
|
|
144
|
+
? meaningfulChildren(child.sourceRef, childNodesByParent)
|
|
145
|
+
: [child];
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/*** Tests whether a parent has measured Grid or Flex grouping semantics. */
|
|
149
|
+
function isLayoutGroup(node) {
|
|
150
|
+
const css = availableObservation(node)?.css;
|
|
151
|
+
return css === null || css === undefined ? false : /grid|flex/.test(css.display);
|
|
152
|
+
}
|
|
153
|
+
/*** Requires padding plus radius, border, or shadow so colored columns are not invented as cards. */
|
|
154
|
+
function isCardSurface(node) {
|
|
155
|
+
const observation = availableObservation(node);
|
|
156
|
+
const css = observation?.css;
|
|
157
|
+
return (css !== null &&
|
|
158
|
+
css !== undefined &&
|
|
159
|
+
hasNonZeroEdge(css.padding) &&
|
|
160
|
+
(hasNonZeroCssValue(css.borderRadius) ||
|
|
161
|
+
hasNonZeroCssValue(css.borderWidth) ||
|
|
162
|
+
css.boxShadow !== 'none'));
|
|
163
|
+
}
|
|
164
|
+
/*** Selects a visible available observation deterministically without inventing a missing style. */
|
|
165
|
+
function availableObservation(node) {
|
|
166
|
+
return ([...node.observations]
|
|
167
|
+
.sort((left, right) => left.viewportId.localeCompare(right.viewportId) ||
|
|
168
|
+
left.stateId.localeCompare(right.stateId))
|
|
169
|
+
.find((observation) => observation.availability.status === 'available' &&
|
|
170
|
+
observation.css !== null &&
|
|
171
|
+
observation.rect !== null &&
|
|
172
|
+
observation.rect.width > 0 &&
|
|
173
|
+
observation.rect.height > 0 &&
|
|
174
|
+
observation.css.display !== 'none' &&
|
|
175
|
+
observation.css.visibility !== 'hidden' &&
|
|
176
|
+
observation.css.visibility !== 'collapse' &&
|
|
177
|
+
observation.css.opacity !== '0') ?? null);
|
|
178
|
+
}
|
|
179
|
+
/*** Identifies layout evidence that gives an otherwise generic container a real component role. */
|
|
180
|
+
function hasLayoutRole(observation) {
|
|
181
|
+
const { css } = observation;
|
|
182
|
+
return (css !== null &&
|
|
183
|
+
(css.display.includes('grid') ||
|
|
184
|
+
css.display.includes('flex') ||
|
|
185
|
+
hasNonZeroEdge(css.padding) ||
|
|
186
|
+
hasNonZeroEdge(css.margin) ||
|
|
187
|
+
hasNonZeroCssValue(css.gap)));
|
|
188
|
+
}
|
|
189
|
+
/*** Identifies measured border, radius, background, or shadow evidence for a visual container. */
|
|
190
|
+
function hasSurfaceRole(observation) {
|
|
191
|
+
const { css } = observation;
|
|
192
|
+
return (css !== null &&
|
|
193
|
+
(hasNonZeroCssValue(css.borderRadius) ||
|
|
194
|
+
hasNonZeroCssValue(css.borderWidth) ||
|
|
195
|
+
css.boxShadow !== 'none' ||
|
|
196
|
+
!isTransparentColor(css.backgroundColor)));
|
|
197
|
+
}
|
|
198
|
+
/*** Tests CSS box edges without parsing or normalizing their original literals. */
|
|
199
|
+
function hasNonZeroEdge(edges) {
|
|
200
|
+
return [edges.top, edges.right, edges.bottom, edges.left].some(hasNonZeroCssValue);
|
|
201
|
+
}
|
|
202
|
+
/*** Detects non-zero CSS literals while preserving their exact source value elsewhere. */
|
|
203
|
+
function hasNonZeroCssValue(value) {
|
|
204
|
+
return value !== '0' && value !== '0px' && value !== 'normal' && value !== 'auto';
|
|
205
|
+
}
|
|
206
|
+
/*** Recognizes the transparent computed color forms without assigning a color token. */
|
|
207
|
+
function isTransparentColor(value) {
|
|
208
|
+
return value === 'transparent' || value === 'rgba(0, 0, 0, 0)';
|
|
209
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WebsiteObservedNode, WebsiteRecognizedProp } from '@ankhorage/contracts/website';
|
|
2
|
+
/*** Retains text runs, links, media references, and heading level as source-linked structural props. */
|
|
3
|
+
export declare function recognizeWebsiteStructureProps(node: WebsiteObservedNode): readonly WebsiteRecognizedProp[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*** Retains text runs, links, media references, and heading level as source-linked structural props. */
|
|
2
|
+
export function recognizeWebsiteStructureProps(node) {
|
|
3
|
+
const textRuns = node.textRuns.map((textRun) => ({
|
|
4
|
+
end: textRun.end,
|
|
5
|
+
sourceRef: textRun.sourceRef,
|
|
6
|
+
start: textRun.start,
|
|
7
|
+
text: textRun.text,
|
|
8
|
+
}));
|
|
9
|
+
const links = node.links.map((link) => ({
|
|
10
|
+
label: link.label,
|
|
11
|
+
sourceRef: link.sourceRef,
|
|
12
|
+
url: link.url,
|
|
13
|
+
}));
|
|
14
|
+
const media = node.media.map((item) => ({
|
|
15
|
+
alt: item.alt,
|
|
16
|
+
assetId: item.assetId,
|
|
17
|
+
kind: item.kind,
|
|
18
|
+
sourceRef: item.sourceRef,
|
|
19
|
+
url: item.url,
|
|
20
|
+
}));
|
|
21
|
+
const headingLevel = headingLevelFor(node.dom.tagName);
|
|
22
|
+
return [
|
|
23
|
+
...(textRuns.length === 0 ? [] : [recognizedProp('textRuns', textRuns)]),
|
|
24
|
+
...(links.length === 0 ? [] : [recognizedProp('links', links)]),
|
|
25
|
+
...(media.length === 0 ? [] : [recognizedProp('media', media)]),
|
|
26
|
+
...(headingLevel === null ? [] : [recognizedProp('level', headingLevel)]),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
/*** Creates one serializable recognition prop while retaining the exact source value. */
|
|
30
|
+
function recognizedProp(name, value) {
|
|
31
|
+
return { name, originalValues: [value], value };
|
|
32
|
+
}
|
|
33
|
+
/*** Extracts an explicit heading level only from an observed heading tag. */
|
|
34
|
+
function headingLevelFor(tagName) {
|
|
35
|
+
return /^h[1-6]$/i.test(tagName) ? Number(tagName[1]) : null;
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*** Maps explicit HTML semantics without relying on framework or page-builder selectors. */
|
|
2
|
+
export function recognizeWebsiteStructureSemanticComponentType(tagName) {
|
|
3
|
+
if (/^h[1-6]$/.test(tagName))
|
|
4
|
+
return 'Heading';
|
|
5
|
+
return semanticComponentTypes.find(([name]) => name === tagName)?.[1] ?? null;
|
|
6
|
+
}
|
|
7
|
+
const semanticComponentTypes = [
|
|
8
|
+
['a', 'Link'],
|
|
9
|
+
['article', 'Container'],
|
|
10
|
+
['audio', 'Media'],
|
|
11
|
+
['body', 'Container'],
|
|
12
|
+
['blockquote', 'RichText'],
|
|
13
|
+
['button', 'Button'],
|
|
14
|
+
['footer', 'Footer'],
|
|
15
|
+
['form', 'Form'],
|
|
16
|
+
['header', 'Header'],
|
|
17
|
+
['iframe', 'Media'],
|
|
18
|
+
['img', 'Image'],
|
|
19
|
+
['label', 'RichText'],
|
|
20
|
+
['li', 'ListItem'],
|
|
21
|
+
['main', 'Container'],
|
|
22
|
+
['ol', 'List'],
|
|
23
|
+
['p', 'RichText'],
|
|
24
|
+
['section', 'Section'],
|
|
25
|
+
['ul', 'List'],
|
|
26
|
+
['video', 'Media'],
|
|
27
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WebsiteObservedNode, WebsiteRecognizedProp } from '@ankhorage/contracts/website';
|
|
2
|
+
import type { RecognizedTreeNode } from './recognizeWebsiteStructure';
|
|
3
|
+
/*** Creates a recognized tree node and retains all descendant source mappings. */
|
|
4
|
+
export declare function createWebsiteStructureTreeNode(node: WebsiteObservedNode, componentType: string, sourceRefs: readonly string[], props: readonly WebsiteRecognizedProp[], children: readonly RecognizedTreeNode[], unresolvedReason: string): RecognizedTreeNode;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*** Creates a recognized tree node and retains all descendant source mappings. */
|
|
2
|
+
export function createWebsiteStructureTreeNode(node, componentType, sourceRefs, props, children, unresolvedReason) {
|
|
3
|
+
const unresolved = componentType === 'Unknown';
|
|
4
|
+
const recognizedNode = {
|
|
5
|
+
componentType,
|
|
6
|
+
confidence: unresolved ? 0 : confidenceFor(componentType),
|
|
7
|
+
id: node.sourceRef,
|
|
8
|
+
props,
|
|
9
|
+
responsive: [],
|
|
10
|
+
sourceRefs,
|
|
11
|
+
status: unresolved ? 'unresolved' : 'recognized',
|
|
12
|
+
unresolved: unresolved ? { reason: unresolvedReason, sourceRefs } : null,
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
node: recognizedNode,
|
|
16
|
+
nodes: [recognizedNode, ...children.flatMap((child) => child.nodes)],
|
|
17
|
+
uiNode: createWebsiteStructureUiNode(node.sourceRef, componentType, props, children),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/*** Creates a stable source-derived UI node with ordered recognized children. */
|
|
21
|
+
function createWebsiteStructureUiNode(id, componentType, props, children) {
|
|
22
|
+
const uiProps = Object.fromEntries(props.map((prop) => [prop.name, prop.value]));
|
|
23
|
+
return {
|
|
24
|
+
...(children.length === 0 ? {} : { children: children.map((child) => child.uiNode) }),
|
|
25
|
+
id,
|
|
26
|
+
...(props.length === 0 ? {} : { props: uiProps }),
|
|
27
|
+
type: componentType,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/*** Assigns bounded confidence from the evidence class rather than an aesthetic assessment. */
|
|
31
|
+
function confidenceFor(componentType) {
|
|
32
|
+
if (componentType === 'Grid' || componentType === 'Flex')
|
|
33
|
+
return 0.98;
|
|
34
|
+
if (componentType === 'Card')
|
|
35
|
+
return 0.9;
|
|
36
|
+
if (componentType === 'Container')
|
|
37
|
+
return 0.8;
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export { filterDesignRuleCatalog } from './features/catalog/filterDesignRuleCata
|
|
|
5
5
|
export { createDesignRuleProvider } from './features/provider/designRuleProvider';
|
|
6
6
|
export { selectDesignRuleProfile } from './features/provider/selectDesignRuleProfile';
|
|
7
7
|
export { recognizeWebsiteDesignProperties } from './features/recognition/recognizeWebsiteDesignProperties';
|
|
8
|
+
export { recognizeWebsiteDocument } from './features/recognition/recognizeWebsiteDocument';
|
|
8
9
|
export { createWebsiteAssessmentRuleSet } from './features/website-assessment/createWebsiteAssessmentRuleSet';
|
|
10
|
+
export { recognizeWebsiteStructure } from './features/website-recognition/recognizeWebsiteStructure';
|
|
9
11
|
export type { DesignAssessmentKind, DesignRuleCatalogEntry, DesignRuleCatalogFilter, DesignRuleEvidence, DesignRulePlanningManifest, DesignRuleProfile, DesignRuleProviderManifest, DesignRuleScope, DesignRuleStatus, } from './types/designRuleCatalog';
|
|
10
12
|
export type { DesignContext, DesignRuleProfileSelection, DesignRuleProvider, DesignRuleProviderOptions, } from './types/designRuleProvider';
|
|
11
13
|
export type { WebsiteAssessmentRuleOptions } from './types/websiteAssessment';
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,6 @@ export { filterDesignRuleCatalog } from './features/catalog/filterDesignRuleCata
|
|
|
5
5
|
export { createDesignRuleProvider } from './features/provider/designRuleProvider';
|
|
6
6
|
export { selectDesignRuleProfile } from './features/provider/selectDesignRuleProfile';
|
|
7
7
|
export { recognizeWebsiteDesignProperties } from './features/recognition/recognizeWebsiteDesignProperties';
|
|
8
|
+
export { recognizeWebsiteDocument } from './features/recognition/recognizeWebsiteDocument';
|
|
8
9
|
export { createWebsiteAssessmentRuleSet } from './features/website-assessment/createWebsiteAssessmentRuleSet';
|
|
10
|
+
export { recognizeWebsiteStructure } from './features/website-recognition/recognizeWebsiteStructure';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/rules-design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Declarative catalog for reusable design rules.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/rules-design#readme",
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"test": "bun test",
|
|
43
43
|
"lint": "ankhorage-eslint . --max-warnings=0",
|
|
44
44
|
"knip:check": "ankhorage-knip",
|
|
45
|
+
"test:packed-consumer": "bun test/packed-consumer.ts",
|
|
46
|
+
"test:php-consumer": "bun test/php-consumer.ts",
|
|
45
47
|
"format": "ankhorage-prettier --write .",
|
|
46
48
|
"format:check": "ankhorage-prettier --check .",
|
|
47
49
|
"lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
|