@domandigital/craft 0.12.0 → 0.13.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 +20 -0
- package/CHARACTER.md +92 -1
- package/dist/{audit-5QWFLZ6L.js → audit-5TYDYRXV.js} +6 -3
- package/dist/audit.cjs +613 -88
- package/dist/audit.d.cts +81 -1
- package/dist/audit.d.ts +81 -1
- package/dist/audit.js +611 -88
- package/dist/{chunk-J3QUROJ5.js → chunk-3VTPI7BU.js} +9 -8
- package/dist/{chunk-ZKVJ7K6X.js → chunk-CZDOMIVS.js} +1 -1
- package/dist/chunk-ESCVTKPN.js +217 -0
- package/dist/{chunk-AL6MRG6V.js → chunk-GMVXADJ6.js} +2912 -2102
- package/dist/{chunk-PU5G5DUC.js → chunk-IMB4V34S.js} +26 -13
- package/dist/{chunk-CDAJUS5U.js → chunk-K2BZN4GA.js} +49 -14
- package/dist/{chunk-ULPI335S.js → chunk-ZLDA2SYB.js} +168 -8
- package/dist/{chunk-S3NZAVU6.js → chunk-ZZ5CKOJP.js} +1 -1
- package/dist/cli-BKJMLD3H.js +18 -0
- package/dist/{cli-ZPJIWVEP.js → cli-DRKAMFAH.js} +5 -7
- package/dist/{cli-C3JLFXMG.js → cli-ILH7OO5G.js} +4 -5
- package/dist/{cli-ZB2VJ7CY.js → cli-J5ECRCD4.js} +13 -15
- package/dist/cli-N2IDXH7W.js +20 -0
- package/dist/cli.js +2 -2
- package/dist/index.cjs +929 -401
- package/dist/index.d.cts +408 -196
- package/dist/index.d.ts +408 -196
- package/dist/index.js +911 -401
- package/package.json +1 -1
- package/word-lists.json +1 -1
- package/dist/chunk-LHGY43LL.js +0 -462
- package/dist/chunk-PZ4MF2VV.js +0 -117
- package/dist/cli-2DY3V3SF.js +0 -17
- package/dist/cli-QM2AQQMF.js +0 -19
package/dist/audit.d.cts
CHANGED
|
@@ -93,6 +93,50 @@ interface SnapshotSection {
|
|
|
93
93
|
role?: SectionRole;
|
|
94
94
|
/** Version 2. */
|
|
95
95
|
geometry?: SectionGeometry;
|
|
96
|
+
/** Version 2: short pill or label texts in the section ("Most popular", "New"), at most 5. */
|
|
97
|
+
badges?: string[];
|
|
98
|
+
/** Version 2: small round portraits (at most 96px, roughly square, radius 40% or more). */
|
|
99
|
+
avatars?: number;
|
|
100
|
+
/** Version 2: a horizontal scroller, snap track or prev/next control holds the content. */
|
|
101
|
+
carousel?: boolean;
|
|
102
|
+
/** Version 2: large standalone figures ("500+", "98%", "4.9/5") at 24px or more. */
|
|
103
|
+
figures?: number;
|
|
104
|
+
}
|
|
105
|
+
type ImageRole = "photo" | "illustration" | "icon" | "avatar" | "logo";
|
|
106
|
+
/**
|
|
107
|
+
* What the image's own bytes say about where it came from. Only a positive
|
|
108
|
+
* is evidence: most images carry no metadata at all, and a re-encode strips
|
|
109
|
+
* it, so no marker proves nothing.
|
|
110
|
+
*/
|
|
111
|
+
interface ImageProvenance {
|
|
112
|
+
/** The IPTC digital source type found, if any: "trainedAlgorithmicMedia" or "compositeWithTrainedAlgorithmicMedia". */
|
|
113
|
+
digitalSourceType: string | null;
|
|
114
|
+
/** Where the marker sat: an XMP packet, a C2PA manifest, or somewhere else in the file. */
|
|
115
|
+
source: "xmp" | "c2pa" | "other" | null;
|
|
116
|
+
/** The file carries a C2PA manifest (Content Credentials), whatever it says. */
|
|
117
|
+
c2pa: boolean;
|
|
118
|
+
/** Bytes read, from the start of the file. */
|
|
119
|
+
bytes: number;
|
|
120
|
+
}
|
|
121
|
+
/** One image as the visitor sees it: an `img`, or a CSS background large enough to be a picture. */
|
|
122
|
+
interface SnapshotImage {
|
|
123
|
+
/** The URL the browser loaded, unwrapped from an image optimiser (`/_next/image?url=`), or a `data:` URI cut to 64 characters. */
|
|
124
|
+
src: string;
|
|
125
|
+
/** Host of `src`, or null for a `data:` URI. */
|
|
126
|
+
host: string | null;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
top: number;
|
|
130
|
+
role: ImageRole;
|
|
131
|
+
alt: string | null;
|
|
132
|
+
/** Empty alt, `aria-hidden` or `role="presentation"`. */
|
|
133
|
+
decorative: boolean;
|
|
134
|
+
/** Index into `sections`, or null when the image sits outside them. */
|
|
135
|
+
section: number | null;
|
|
136
|
+
/** A CSS `background-image`, not an `img`. */
|
|
137
|
+
background: boolean;
|
|
138
|
+
/** Present when the bytes were read. */
|
|
139
|
+
provenance?: ImageProvenance;
|
|
96
140
|
}
|
|
97
141
|
/**
|
|
98
142
|
* Measures of the rendered pixels, from a full-page screenshot (capped at
|
|
@@ -167,6 +211,11 @@ interface Snapshot {
|
|
|
167
211
|
rhythmVariance?: number | null;
|
|
168
212
|
/** Version 2: absent when the page could not be screenshotted. */
|
|
169
213
|
visual?: SnapshotVisual;
|
|
214
|
+
/**
|
|
215
|
+
* Version 2, craft 0.14 and later: every image on the page, largest first, at
|
|
216
|
+
* most 60. Absent in older snapshots, which the imagery tells never judge.
|
|
217
|
+
*/
|
|
218
|
+
images?: SnapshotImage[];
|
|
170
219
|
/** Set when a version 1 snapshot was read and upgraded in memory. */
|
|
171
220
|
migratedFrom?: 1;
|
|
172
221
|
/** The design-system measures trawl has collected since v7, kept so it can switch to this. */
|
|
@@ -326,6 +375,21 @@ interface FingerprintSection {
|
|
|
326
375
|
centred: number;
|
|
327
376
|
/** Content width over viewport width, 0 to 1. */
|
|
328
377
|
width: number;
|
|
378
|
+
/** Left-right balance of the content, 0 to 1. Component comparison only. */
|
|
379
|
+
symmetry?: number;
|
|
380
|
+
/** Buttons in the section. */
|
|
381
|
+
controls?: number;
|
|
382
|
+
/** Cards side by side. */
|
|
383
|
+
cards?: number;
|
|
384
|
+
/** The section's own background, or null when it is the page ground. */
|
|
385
|
+
background?: Oklch | null;
|
|
386
|
+
/** Badge texts ("Most popular"), lower-cased. */
|
|
387
|
+
badges?: string[];
|
|
388
|
+
/** Small round portraits. */
|
|
389
|
+
avatars?: number;
|
|
390
|
+
carousel?: boolean;
|
|
391
|
+
/** Large standalone figures. */
|
|
392
|
+
figures?: number;
|
|
329
393
|
}
|
|
330
394
|
interface Fingerprint {
|
|
331
395
|
version: 1 | 2;
|
|
@@ -393,6 +457,8 @@ interface SnapshotOptions {
|
|
|
393
457
|
timeoutMs?: number;
|
|
394
458
|
/** Take a screenshot and measure its pixels (`visual`). Default true. */
|
|
395
459
|
visual?: boolean;
|
|
460
|
+
/** Read the first bytes of the page's larger images for AI provenance markers. Default true. */
|
|
461
|
+
provenance?: boolean;
|
|
396
462
|
}
|
|
397
463
|
interface MinimalPage {
|
|
398
464
|
close?(): Promise<void>;
|
|
@@ -413,7 +479,21 @@ interface MinimalPage {
|
|
|
413
479
|
height: number;
|
|
414
480
|
};
|
|
415
481
|
}): Promise<Uint8Array>;
|
|
482
|
+
/** Optional: Playwright's request context, which fetches outside the page's CORS rules. Without it, no image gets `provenance`. */
|
|
483
|
+
request?: {
|
|
484
|
+
get(url: string, options?: {
|
|
485
|
+
headers?: Record<string, string>;
|
|
486
|
+
timeout?: number;
|
|
487
|
+
}): Promise<{
|
|
488
|
+
ok(): boolean;
|
|
489
|
+
body(): Promise<Uint8Array>;
|
|
490
|
+
}>;
|
|
491
|
+
};
|
|
416
492
|
}
|
|
493
|
+
/** At most this many images are read for provenance, largest first. */
|
|
494
|
+
declare const PROVENANCE_MAX_IMAGES = 24;
|
|
495
|
+
/** The most time the reads may take for one page, in ms, so a machine offline waits seconds, not minutes. */
|
|
496
|
+
declare const PROVENANCE_BUDGET_MS = 20000;
|
|
417
497
|
/** The most of a page the screenshot measures read, in CSS px. A long page is judged on its opening. */
|
|
418
498
|
declare const VISUAL_MAX_HEIGHT = 6000;
|
|
419
499
|
interface MinimalBrowser {
|
|
@@ -465,4 +545,4 @@ interface AuditResult {
|
|
|
465
545
|
/** Snapshot a URL, judge it against the rendered tells, and fingerprint it. */
|
|
466
546
|
declare function audit(url: string, options?: SnapshotOptions & CheckOptions): Promise<AuditResult>;
|
|
467
547
|
|
|
468
|
-
export { type AuditResult, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
|
548
|
+
export { type AuditResult, PROVENANCE_BUDGET_MS, PROVENANCE_MAX_IMAGES, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
package/dist/audit.d.ts
CHANGED
|
@@ -93,6 +93,50 @@ interface SnapshotSection {
|
|
|
93
93
|
role?: SectionRole;
|
|
94
94
|
/** Version 2. */
|
|
95
95
|
geometry?: SectionGeometry;
|
|
96
|
+
/** Version 2: short pill or label texts in the section ("Most popular", "New"), at most 5. */
|
|
97
|
+
badges?: string[];
|
|
98
|
+
/** Version 2: small round portraits (at most 96px, roughly square, radius 40% or more). */
|
|
99
|
+
avatars?: number;
|
|
100
|
+
/** Version 2: a horizontal scroller, snap track or prev/next control holds the content. */
|
|
101
|
+
carousel?: boolean;
|
|
102
|
+
/** Version 2: large standalone figures ("500+", "98%", "4.9/5") at 24px or more. */
|
|
103
|
+
figures?: number;
|
|
104
|
+
}
|
|
105
|
+
type ImageRole = "photo" | "illustration" | "icon" | "avatar" | "logo";
|
|
106
|
+
/**
|
|
107
|
+
* What the image's own bytes say about where it came from. Only a positive
|
|
108
|
+
* is evidence: most images carry no metadata at all, and a re-encode strips
|
|
109
|
+
* it, so no marker proves nothing.
|
|
110
|
+
*/
|
|
111
|
+
interface ImageProvenance {
|
|
112
|
+
/** The IPTC digital source type found, if any: "trainedAlgorithmicMedia" or "compositeWithTrainedAlgorithmicMedia". */
|
|
113
|
+
digitalSourceType: string | null;
|
|
114
|
+
/** Where the marker sat: an XMP packet, a C2PA manifest, or somewhere else in the file. */
|
|
115
|
+
source: "xmp" | "c2pa" | "other" | null;
|
|
116
|
+
/** The file carries a C2PA manifest (Content Credentials), whatever it says. */
|
|
117
|
+
c2pa: boolean;
|
|
118
|
+
/** Bytes read, from the start of the file. */
|
|
119
|
+
bytes: number;
|
|
120
|
+
}
|
|
121
|
+
/** One image as the visitor sees it: an `img`, or a CSS background large enough to be a picture. */
|
|
122
|
+
interface SnapshotImage {
|
|
123
|
+
/** The URL the browser loaded, unwrapped from an image optimiser (`/_next/image?url=`), or a `data:` URI cut to 64 characters. */
|
|
124
|
+
src: string;
|
|
125
|
+
/** Host of `src`, or null for a `data:` URI. */
|
|
126
|
+
host: string | null;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
top: number;
|
|
130
|
+
role: ImageRole;
|
|
131
|
+
alt: string | null;
|
|
132
|
+
/** Empty alt, `aria-hidden` or `role="presentation"`. */
|
|
133
|
+
decorative: boolean;
|
|
134
|
+
/** Index into `sections`, or null when the image sits outside them. */
|
|
135
|
+
section: number | null;
|
|
136
|
+
/** A CSS `background-image`, not an `img`. */
|
|
137
|
+
background: boolean;
|
|
138
|
+
/** Present when the bytes were read. */
|
|
139
|
+
provenance?: ImageProvenance;
|
|
96
140
|
}
|
|
97
141
|
/**
|
|
98
142
|
* Measures of the rendered pixels, from a full-page screenshot (capped at
|
|
@@ -167,6 +211,11 @@ interface Snapshot {
|
|
|
167
211
|
rhythmVariance?: number | null;
|
|
168
212
|
/** Version 2: absent when the page could not be screenshotted. */
|
|
169
213
|
visual?: SnapshotVisual;
|
|
214
|
+
/**
|
|
215
|
+
* Version 2, craft 0.14 and later: every image on the page, largest first, at
|
|
216
|
+
* most 60. Absent in older snapshots, which the imagery tells never judge.
|
|
217
|
+
*/
|
|
218
|
+
images?: SnapshotImage[];
|
|
170
219
|
/** Set when a version 1 snapshot was read and upgraded in memory. */
|
|
171
220
|
migratedFrom?: 1;
|
|
172
221
|
/** The design-system measures trawl has collected since v7, kept so it can switch to this. */
|
|
@@ -326,6 +375,21 @@ interface FingerprintSection {
|
|
|
326
375
|
centred: number;
|
|
327
376
|
/** Content width over viewport width, 0 to 1. */
|
|
328
377
|
width: number;
|
|
378
|
+
/** Left-right balance of the content, 0 to 1. Component comparison only. */
|
|
379
|
+
symmetry?: number;
|
|
380
|
+
/** Buttons in the section. */
|
|
381
|
+
controls?: number;
|
|
382
|
+
/** Cards side by side. */
|
|
383
|
+
cards?: number;
|
|
384
|
+
/** The section's own background, or null when it is the page ground. */
|
|
385
|
+
background?: Oklch | null;
|
|
386
|
+
/** Badge texts ("Most popular"), lower-cased. */
|
|
387
|
+
badges?: string[];
|
|
388
|
+
/** Small round portraits. */
|
|
389
|
+
avatars?: number;
|
|
390
|
+
carousel?: boolean;
|
|
391
|
+
/** Large standalone figures. */
|
|
392
|
+
figures?: number;
|
|
329
393
|
}
|
|
330
394
|
interface Fingerprint {
|
|
331
395
|
version: 1 | 2;
|
|
@@ -393,6 +457,8 @@ interface SnapshotOptions {
|
|
|
393
457
|
timeoutMs?: number;
|
|
394
458
|
/** Take a screenshot and measure its pixels (`visual`). Default true. */
|
|
395
459
|
visual?: boolean;
|
|
460
|
+
/** Read the first bytes of the page's larger images for AI provenance markers. Default true. */
|
|
461
|
+
provenance?: boolean;
|
|
396
462
|
}
|
|
397
463
|
interface MinimalPage {
|
|
398
464
|
close?(): Promise<void>;
|
|
@@ -413,7 +479,21 @@ interface MinimalPage {
|
|
|
413
479
|
height: number;
|
|
414
480
|
};
|
|
415
481
|
}): Promise<Uint8Array>;
|
|
482
|
+
/** Optional: Playwright's request context, which fetches outside the page's CORS rules. Without it, no image gets `provenance`. */
|
|
483
|
+
request?: {
|
|
484
|
+
get(url: string, options?: {
|
|
485
|
+
headers?: Record<string, string>;
|
|
486
|
+
timeout?: number;
|
|
487
|
+
}): Promise<{
|
|
488
|
+
ok(): boolean;
|
|
489
|
+
body(): Promise<Uint8Array>;
|
|
490
|
+
}>;
|
|
491
|
+
};
|
|
416
492
|
}
|
|
493
|
+
/** At most this many images are read for provenance, largest first. */
|
|
494
|
+
declare const PROVENANCE_MAX_IMAGES = 24;
|
|
495
|
+
/** The most time the reads may take for one page, in ms, so a machine offline waits seconds, not minutes. */
|
|
496
|
+
declare const PROVENANCE_BUDGET_MS = 20000;
|
|
417
497
|
/** The most of a page the screenshot measures read, in CSS px. A long page is judged on its opening. */
|
|
418
498
|
declare const VISUAL_MAX_HEIGHT = 6000;
|
|
419
499
|
interface MinimalBrowser {
|
|
@@ -465,4 +545,4 @@ interface AuditResult {
|
|
|
465
545
|
/** Snapshot a URL, judge it against the rendered tells, and fingerprint it. */
|
|
466
546
|
declare function audit(url: string, options?: SnapshotOptions & CheckOptions): Promise<AuditResult>;
|
|
467
547
|
|
|
468
|
-
export { type AuditResult, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
|
548
|
+
export { type AuditResult, PROVENANCE_BUDGET_MS, PROVENANCE_MAX_IMAGES, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|