@tanqory/theme-conformance 0.1.0-alpha.15 → 0.1.0-alpha.17

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.
Files changed (140) hide show
  1. package/README.md +27 -2
  2. package/dist/browser/harness.d.ts +8 -1
  3. package/dist/browser/harness.js +8 -2
  4. package/dist/browser/harness.js.map +1 -1
  5. package/dist/browser/page-run.d.ts +29 -1
  6. package/dist/browser/page-run.js +54 -6
  7. package/dist/browser/page-run.js.map +1 -1
  8. package/dist/browser/rules.d.ts +70 -0
  9. package/dist/browser/rules.js +119 -6
  10. package/dist/browser/rules.js.map +1 -1
  11. package/dist/build-info.json +1 -1
  12. package/dist/cli.js +52 -1
  13. package/dist/cli.js.map +1 -1
  14. package/dist/client-chunks.d.ts +185 -0
  15. package/dist/client-chunks.js +378 -0
  16. package/dist/client-chunks.js.map +1 -0
  17. package/dist/field-types.js +6 -5
  18. package/dist/field-types.js.map +1 -1
  19. package/dist/fixtures/store-fixture.d.ts +5 -0
  20. package/dist/fixtures/store-fixture.js.map +1 -1
  21. package/dist/fixtures/stores/alpha.json +38 -0
  22. package/dist/fixtures/stores/beta.json +3 -0
  23. package/dist/html-checks.d.ts +3 -0
  24. package/dist/html-checks.js +15 -0
  25. package/dist/html-checks.js.map +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +1 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/jobs.d.ts +67 -1
  30. package/dist/jobs.js +155 -6
  31. package/dist/jobs.js.map +1 -1
  32. package/dist/review/config.d.ts +36 -0
  33. package/dist/review/config.js +70 -0
  34. package/dist/review/config.js.map +1 -0
  35. package/dist/review/index.d.ts +85 -0
  36. package/dist/review/index.js +308 -0
  37. package/dist/review/index.js.map +1 -0
  38. package/dist/review/lighthouse.d.ts +27 -0
  39. package/dist/review/lighthouse.js +94 -0
  40. package/dist/review/lighthouse.js.map +1 -0
  41. package/dist/review/stores.d.ts +42 -0
  42. package/dist/review/stores.js +109 -0
  43. package/dist/review/stores.js.map +1 -0
  44. package/dist/runner-identity.d.ts +1 -1
  45. package/dist/runner-identity.js +6 -5
  46. package/dist/runner-identity.js.map +1 -1
  47. package/dist/storefront/budgets.js +26 -4
  48. package/dist/storefront/budgets.js.map +1 -1
  49. package/dist/storefront/checks/i18n.js +39 -0
  50. package/dist/storefront/checks/i18n.js.map +1 -1
  51. package/dist/storefront/fixture.d.ts +4 -3
  52. package/dist/storefront/fixture.js +12 -7
  53. package/dist/storefront/fixture.js.map +1 -1
  54. package/dist/storefront/gateway.d.ts +18 -2
  55. package/dist/storefront/gateway.js +47 -13
  56. package/dist/storefront/gateway.js.map +1 -1
  57. package/dist/storefront/locale-names.d.ts +39 -0
  58. package/dist/storefront/locale-names.js +63 -0
  59. package/dist/storefront/locale-names.js.map +1 -0
  60. package/dist/suites/app-blocks.d.ts +13 -0
  61. package/dist/suites/app-blocks.js +172 -0
  62. package/dist/suites/app-blocks.js.map +1 -0
  63. package/dist/suites/s1-static.js +4 -2
  64. package/dist/suites/s1-static.js.map +1 -1
  65. package/dist/suites/s2-render.js +20 -2
  66. package/dist/suites/s2-render.js.map +1 -1
  67. package/dist/suites/s4-limits.js +44 -1
  68. package/dist/suites/s4-limits.js.map +1 -1
  69. package/dist/suites/s5-hydration.d.ts +2 -0
  70. package/dist/suites/s5-hydration.js +89 -12
  71. package/dist/suites/s5-hydration.js.map +1 -1
  72. package/dist/workerd/config.js +3 -0
  73. package/dist/workerd/config.js.map +1 -1
  74. package/dist/workerd/elapsed.d.ts +19 -0
  75. package/dist/workerd/elapsed.js +25 -0
  76. package/dist/workerd/elapsed.js.map +1 -0
  77. package/dist/workerd/host.js +11 -4
  78. package/dist/workerd/host.js.map +1 -1
  79. package/dist/workerd/shim.mjs +40 -3
  80. package/dist/workerd/storefront-data.mjs +25 -11
  81. package/dist/workerd/tanqory-money.generated.mjs +551 -0
  82. package/docs/storefront-tier.md +1 -0
  83. package/fixtures/chunks-pass/client/assets/boot-d9c77977.js +13 -0
  84. package/fixtures/chunks-pass/client/assets/core-9e704970.js +21 -0
  85. package/fixtures/chunks-pass/client/assets/hero-f2dd1270.js +3 -0
  86. package/fixtures/chunks-pass/client/assets/main-28182e68.css +1 -0
  87. package/fixtures/chunks-pass/client/assets/main-3401d1c6.js +22 -0
  88. package/fixtures/chunks-pass/client/assets/probe-bad-de7c494b.js +1 -0
  89. package/fixtures/chunks-pass/client/assets/probe-ok-e658f0b4.js +1 -0
  90. package/fixtures/chunks-pass/client/assets/shared-53e84b49.js +2 -0
  91. package/fixtures/chunks-pass/client/client-manifest.json +87 -0
  92. package/fixtures/chunks-pass/defaults/regions/header.json +1 -0
  93. package/fixtures/chunks-pass/defaults/settings.json +1 -0
  94. package/fixtures/chunks-pass/defaults/templates/index.json +1 -0
  95. package/fixtures/chunks-pass/defaults/templates/product.json +1 -0
  96. package/fixtures/chunks-pass/locales/en.json +1 -0
  97. package/fixtures/chunks-pass/manifest.json +1 -0
  98. package/fixtures/chunks-pass/server/entry.mjs +171 -0
  99. package/fixtures/hydration-pass/defaults/templates/product.json +1 -0
  100. package/fixtures/hydration-pass/manifest.json +1 -1
  101. package/fixtures/hydration-pass/server/entry.mjs +7 -1
  102. package/fixtures/hydration-violations/slot-server-children/server/entry.mjs +7 -1
  103. package/fixtures/invalid-url-setting/defaults/templates/product.json +1 -0
  104. package/fixtures/invalid-url-setting/manifest.json +1 -1
  105. package/fixtures/invalid-url-setting/server/entry.mjs +7 -1
  106. package/fixtures/minimal-pass/defaults/templates/product.json +1 -0
  107. package/fixtures/minimal-pass/manifest.json +1 -1
  108. package/fixtures/minimal-pass/server/entry.mjs +7 -1
  109. package/fixtures/violations/defaults/templates/product.json +1 -0
  110. package/fixtures/violations/entries/async-iterable-body.mjs +7 -1
  111. package/fixtures/violations/entries/browser-only-capability.mjs +7 -1
  112. package/fixtures/violations/entries/deferred-ambient-access.mjs +7 -1
  113. package/fixtures/violations/entries/depends-on-harness-scope.mjs +7 -1
  114. package/fixtures/violations/entries/fetch-without-network.mjs +7 -1
  115. package/fixtures/violations/entries/forges-array-push.mjs +7 -1
  116. package/fixtures/violations/entries/forges-json-stringify.mjs +7 -1
  117. package/fixtures/violations/entries/forges-object-then.mjs +7 -1
  118. package/fixtures/violations/entries/forges-to-json.mjs +7 -1
  119. package/fixtures/violations/entries/grants-own-capability.mjs +7 -1
  120. package/fixtures/violations/entries/lowercase-tenant-leak.mjs +7 -1
  121. package/fixtures/violations/entries/nondeterministic-output.mjs +7 -1
  122. package/fixtures/violations/entries/reads-date-now.mjs +7 -1
  123. package/fixtures/violations/entries/reads-new-date.mjs +7 -1
  124. package/fixtures/violations/entries/redefines-prototype-method.mjs +7 -1
  125. package/fixtures/violations/entries/renders-tq-csrf-field.mjs +7 -1
  126. package/fixtures/violations/entries/renders-tq-form-field.mjs +7 -1
  127. package/fixtures/violations/entries/response-too-large.mjs +7 -1
  128. package/fixtures/violations/entries/retains-tenant-state.mjs +7 -1
  129. package/fixtures/violations/entries/signed-in-actions-customer.mjs +7 -1
  130. package/fixtures/violations/entries/signed-in-harness-scope.mjs +7 -1
  131. package/fixtures/violations/entries/slow-cold-render.mjs +7 -1
  132. package/fixtures/violations/entries/slow-signed-in-render.mjs +7 -1
  133. package/fixtures/violations/entries/slow-store-b-render.mjs +7 -1
  134. package/fixtures/violations/entries/stashes-on-date-prototype.mjs +7 -1
  135. package/fixtures/violations/entries/stashes-on-json.mjs +7 -1
  136. package/fixtures/violations/entries/stashes-on-prototype.mjs +7 -1
  137. package/fixtures/violations/entries/swallows-data-limit.mjs +7 -1
  138. package/fixtures/violations/manifest.json +1 -1
  139. package/package.json +7 -14
  140. package/review-config.json +37 -0
@@ -0,0 +1,308 @@
1
+ /**
2
+ * `theme-conformance review <artifact-dir> --out-dir <dir>`: the extended checks a partner theme version passes before
3
+ * Tanqory's human review (tanqory-platform docs/online-store/PARTNER_THEMES.md §5.2), on the BUILT artifact:
4
+ *
5
+ * performance Lighthouse performance, averaged over the configured pages (default: home, product, collection of
6
+ * the large sample store), at least `performance.minAverage`
7
+ * accessibility axe-core with the configured WCAG tags: no violation of the configured impacts on those pages at
8
+ * each configured viewport; and the Lighthouse accessibility average at least
9
+ * `accessibility.lighthouseMinAverage`
10
+ * previews every declared route kind and every section's presets[0] (the editor's section preview) rendered in
11
+ * preview mode on each sample store (src/review/stores.ts) with no render error; screenshots of the
12
+ * configured pages at each viewport, saved for the partner and the reviewers
13
+ *
14
+ * Every threshold is review-config.json's (src/review/config.ts). The theme runs under workerd with the conformance
15
+ * harness shim behind the storefront tier's gateway (src/storefront/gateway.ts), and one headless Chromium with the
16
+ * egress lockdown; nothing leaves the machine. Writes `<out-dir>/review-report.json` (`tq-review-report/1`) and
17
+ * `<out-dir>/screenshots/<store>-<page>-<viewport>.jpg`.
18
+ */
19
+ import { createHash } from 'node:crypto';
20
+ import { createServer } from 'node:net';
21
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
22
+ import { createRequire } from 'node:module';
23
+ import { join } from 'node:path';
24
+ import { loadArtifact } from '../artifact.js';
25
+ import { BrowserHarness, playwrightVersion } from '../browser/harness.js';
26
+ import { WorkerdHost, workerdVersion } from '../workerd/host.js';
27
+ import { runnerIdentity } from '../suites/s8-negative.js';
28
+ import { Gateway, newSession, SECTION_PREVIEW_PARAM } from '../storefront/gateway.js';
29
+ import { SF_ORIGIN } from '../storefront/fixture.js';
30
+ import { VIEWPORTS } from '../storefront/browser.js';
31
+ import { axeSource } from '../storefront/checks/a11y.js';
32
+ import { loadReviewConfig } from './config.js';
33
+ import { pagePath, reviewStore, routePaths } from './stores.js';
34
+ import { loadLighthouse } from './lighthouse.js';
35
+ export { loadReviewConfig, parseReviewConfig, DEFAULT_REVIEW_CONFIG_PATH } from './config.js';
36
+ export const REVIEW_REPORT_FORMAT = 'tq-review-report/1';
37
+ const require = createRequire(import.meta.url);
38
+ const pkg = require('../../package.json');
39
+ const sha256 = (b) => createHash('sha256').update(b).digest('hex');
40
+ const avg = (xs) => (xs.length && xs.every((x) => typeof x === 'number') ? Math.round((xs.reduce((a, b) => a + b, 0) / xs.length) * 10) / 10 : null);
41
+ async function freePort() {
42
+ return new Promise((resolve, reject) => {
43
+ const s = createServer();
44
+ s.unref();
45
+ s.on('error', reject);
46
+ s.listen(0, '127.0.0.1', () => {
47
+ const a = s.address();
48
+ const port = typeof a === 'object' && a ? a.port : 0;
49
+ s.close(() => resolve(port));
50
+ });
51
+ });
52
+ }
53
+ /** A browser tab whose every request the store's gateway answers (a shopper who answered the consent banner). */
54
+ async function tab(harness, gw, viewport, dpr) {
55
+ const v = VIEWPORTS[viewport];
56
+ const context = await harness.browser.newContext({ ...v, ...(dpr !== undefined ? { deviceScaleFactor: dpr } : {}), serviceWorkers: 'block', acceptDownloads: false });
57
+ context.setDefaultTimeout(5000);
58
+ context.setDefaultNavigationTimeout(30_000);
59
+ await gw.attach(context, newSession({ consentKnown: true }));
60
+ const page = await context.newPage();
61
+ const errors = [];
62
+ page.on('pageerror', (e) => errors.push(`${e.name}: ${e.message}`.slice(0, 300)));
63
+ return { context, page, errors };
64
+ }
65
+ async function load(page, path) {
66
+ const res = await page.goto(`${SF_ORIGIN}${path}`, { waitUntil: 'load', timeout: 30_000 });
67
+ await page.waitForLoadState('networkidle', { timeout: 5000 }).catch(() => { });
68
+ return res?.status() ?? null;
69
+ }
70
+ async function axe(page, tags) {
71
+ await page.evaluate(axeSource());
72
+ return page.evaluate(async (t) => {
73
+ const a = globalThis.axe;
74
+ const r = await a.run(globalThis.document, { runOnly: { type: 'tag', values: t }, resultTypes: ['violations'] });
75
+ return r.violations.map((v) => ({ id: v.id, impact: v.impact, help: v.help, targets: v.nodes.slice(0, 5).flatMap((n) => n.target).map(String) }));
76
+ }, tags);
77
+ }
78
+ class IsolateDied extends Error {
79
+ }
80
+ /** A page this much wider than its window is still taken as fitting (sub-pixel rounding, a scrollbar's gutter). */
81
+ export const SIDEWAYS_TOLERANCE_PX = 1;
82
+ /** One preview-mode render; a render error is the theme's (meta.error), an exception the gateway's. */
83
+ async function renderOne(gw, url) {
84
+ try {
85
+ const out = await gw.renderDocument(newSession({ preview: true, consentKnown: true }), url);
86
+ return { status: out.status, error: out.meta?.error ? `${out.meta.error.name}: ${out.meta.error.message}`.slice(0, 240) : null };
87
+ }
88
+ catch (e) {
89
+ return { status: 500, error: errorText(e).slice(0, 240) };
90
+ }
91
+ }
92
+ function errorText(e) {
93
+ return (e instanceof Error ? e.message : String(e)).split('\n')[0].slice(0, 300);
94
+ }
95
+ export async function runReview(dir, opts) {
96
+ const startedAt = new Date().toISOString();
97
+ const log = opts.log ?? (() => { });
98
+ const config = opts.config ?? loadReviewConfig();
99
+ const artifact = loadArtifact(dir);
100
+ const manifest = artifact.manifestJson;
101
+ const identity = runnerIdentity(pkg.name, pkg.version);
102
+ mkdirSync(join(opts.outDir, 'screenshots'), { recursive: true });
103
+ const renderFindings = [];
104
+ const previewNotes = [];
105
+ const axeFindings = [];
106
+ const lhRuns = [];
107
+ const screenshots = [];
108
+ const browserErrors = [];
109
+ let renders = 0;
110
+ let sectionsRendered = 0;
111
+ let chromium = null;
112
+ let lighthouse = null;
113
+ let lighthouseProblem = null;
114
+ let browserProblem = null;
115
+ let runnerProblem = null;
116
+ let host = null;
117
+ let harness = null;
118
+ const stores = new Map();
119
+ try {
120
+ if (!manifest || typeof manifest !== 'object' || !manifest.routes || !manifest.components || !manifest.capabilities)
121
+ throw new Error('manifest.json is missing or is not an ABI v2 manifest');
122
+ host = await WorkerdHost.start({ entryBytes: artifact.entry.bytes, ...(artifact.previewEntry ? { previewBytes: artifact.previewEntry.bytes } : {}) });
123
+ const init = await host.init();
124
+ if (!init.ok)
125
+ throw new Error(`the theme module did not evaluate: ${init.error?.name}: ${init.error?.message}`);
126
+ const wanted = new Set([...config.previews.stores, config.performance.store, config.accessibility.store]);
127
+ for (const id of wanted) {
128
+ const store = reviewStore(id);
129
+ stores.set(id, { store, gw: new Gateway(host, artifact, store.fixture, store.languages) });
130
+ }
131
+ // 1. preview renders: every declared route kind and every section's presets[0], on every sample store
132
+ const sections = Object.entries(manifest.components).filter(([, d]) => d.role !== 'block' && (d.presets?.length ?? 0) > 0).map(([t]) => t).sort();
133
+ for (const id of config.previews.stores) {
134
+ const { store, gw } = stores.get(id);
135
+ for (const r of routePaths(store, manifest.routes, manifest.customRoutes)) {
136
+ const out = await renderOne(gw, `${SF_ORIGIN}${r.path}`);
137
+ renders++;
138
+ const ok = !out.error && (r.status === 404 ? out.status === 404 : out.status >= 200 && out.status < 400);
139
+ if (!ok)
140
+ renderFindings.push({ where: `${id} ${r.kind} ${r.path}`, code: out.error ? 'render_error' : 'render_status', message: out.error ? `The ${r.kind} page threw ${out.error}` : `The ${r.kind} page answered ${out.status}, not ${r.status === 404 ? '404' : '2xx'}` });
141
+ if (!host.alive)
142
+ throw new IsolateDied(`${id} ${r.kind} ${r.path}`);
143
+ }
144
+ if (manifest.routes['home']) {
145
+ for (const type of sections) {
146
+ const out = await renderOne(gw, `${SF_ORIGIN}/?${SECTION_PREVIEW_PARAM}=${encodeURIComponent(type)}`);
147
+ sectionsRendered++;
148
+ if (out.error || out.status >= 400)
149
+ renderFindings.push({ where: `${id} section ${type}`, code: out.error ? 'render_error' : 'render_status', message: out.error ? `Section ${type} (presets[0]) threw ${out.error}` : `Section ${type} (presets[0]) answered ${out.status}` });
150
+ if (!host.alive)
151
+ throw new IsolateDied(`${id} section ${type}`);
152
+ }
153
+ }
154
+ else {
155
+ previewNotes.push({ where: id, code: 'no_home_template', message: 'The theme declares no home route, so section previews were not rendered.' });
156
+ }
157
+ }
158
+ // 2. the browser: screenshots, axe, Lighthouse
159
+ try {
160
+ lighthouse = await loadLighthouse(opts.modulesDir ?? null);
161
+ }
162
+ catch (e) {
163
+ lighthouseProblem = errorText(e);
164
+ }
165
+ const cdpPort = lighthouse ? await freePort() : undefined;
166
+ try {
167
+ harness = await BrowserHarness.launch(cdpPort !== undefined ? { cdpPort } : {});
168
+ }
169
+ catch (e) {
170
+ browserProblem = `headless Chromium could not be launched: ${errorText(e)}`;
171
+ }
172
+ if (harness) {
173
+ chromium = harness.chromiumVersion;
174
+ for (const id of config.previews.stores) {
175
+ const { store, gw } = stores.get(id);
176
+ for (const viewport of config.previews.viewports) {
177
+ for (const page of config.previews.screenshotPages) {
178
+ // screenshots at device pixel ratio 1: what a reviewer reads, at a quarter of the bytes
179
+ const t = await tab(harness, gw, viewport, 1);
180
+ try {
181
+ await load(t.page, pagePath(store, page));
182
+ // a page wider than its window scrolls sideways: a shopper can scroll into blank space, and the picture
183
+ // may show only that space (a right-to-left page with a large negative left offset, lane TS 2026-11-20)
184
+ const over = await t.page.evaluate(() => {
185
+ const root = globalThis.document.documentElement;
186
+ return { scroll: root.scrollWidth, client: root.clientWidth, dir: root.dir || 'ltr' };
187
+ });
188
+ if (over.scroll > over.client + SIDEWAYS_TOLERANCE_PX)
189
+ renderFindings.push({ where: `${id} ${page} ${viewport}`, code: 'horizontal_overflow', message: `The page scrolls sideways: it is ${over.scroll} px wide in a ${over.client} px window (${over.dir}). An element sits outside the page, often one hidden with a large negative left or right; hide it with inset-inline-start and a transform, or a clip-based visually hidden class.` });
190
+ const bytes = await t.page.screenshot({ type: 'jpeg', quality: config.previews.jpegQuality, fullPage: false, timeout: 15_000 });
191
+ const file = `${id}-${page}-${viewport}.jpg`;
192
+ writeFileSync(join(opts.outDir, 'screenshots', file), bytes);
193
+ const size = VIEWPORTS[viewport].viewport;
194
+ screenshots.push({ file, store: id, storeTitle: store.title, page, viewport, width: size.width, height: size.height, bytes: bytes.length, sha256: sha256(bytes) });
195
+ }
196
+ catch (e) {
197
+ previewNotes.push({ where: `${id} ${page} ${viewport}`, code: 'screenshot_failed', message: `No screenshot: ${errorText(e)}` });
198
+ }
199
+ finally {
200
+ for (const m of t.errors)
201
+ browserErrors.push({ where: `${id} ${page} ${viewport}`, message: m });
202
+ await t.context.close().catch(() => { });
203
+ }
204
+ }
205
+ }
206
+ }
207
+ const a = config.accessibility;
208
+ const { store: aStore, gw: aGw } = stores.get(a.store);
209
+ for (const viewport of a.viewports) {
210
+ for (const page of a.pages) {
211
+ const t = await tab(harness, aGw, viewport);
212
+ try {
213
+ await load(t.page, pagePath(aStore, page));
214
+ for (const v of await axe(t.page, a.axeTags)) {
215
+ if (v.impact && a.axeFailImpacts.includes(v.impact))
216
+ axeFindings.push({ where: `${a.store} ${page} ${viewport}`, code: v.id, message: `${v.help} (${v.impact}; ${v.targets.slice(0, 3).join(', ') || 'page'})`.slice(0, 400) });
217
+ }
218
+ }
219
+ catch (e) {
220
+ axeFindings.push({ where: `${a.store} ${page} ${viewport}`, code: 'axe_incomplete', message: `axe-core could not run: ${errorText(e)}` });
221
+ }
222
+ finally {
223
+ await t.context.close().catch(() => { });
224
+ }
225
+ }
226
+ }
227
+ if (lighthouse && cdpPort !== undefined) {
228
+ const runs = new Map();
229
+ for (const page of config.performance.pages)
230
+ runs.set(`${config.performance.store}/${page}`, { store: config.performance.store, page });
231
+ for (const page of a.pages)
232
+ runs.set(`${a.store}/${page}`, { store: a.store, page });
233
+ for (const { store: sid, page } of runs.values()) {
234
+ const { store, gw } = stores.get(sid);
235
+ const t = await tab(harness, gw, 'mobile');
236
+ try {
237
+ lhRuns.push({ store: sid, page, ...(await lighthouse.run(t.page, `${SF_ORIGIN}${pagePath(store, page)}`, cdpPort)) });
238
+ }
239
+ catch (e) {
240
+ lhRuns.push({ store: sid, page, url: `${SF_ORIGIN}${pagePath(store, page)}`, performance: null, accessibility: null, failedAccessibilityAudits: [], metrics: {}, runtimeError: errorText(e), warnings: [] });
241
+ }
242
+ finally {
243
+ await t.context.close().catch(() => { });
244
+ }
245
+ log(`lighthouse ${sid} ${page}: performance ${lhRuns.at(-1).performance ?? 'n/a'}, accessibility ${lhRuns.at(-1).accessibility ?? 'n/a'}`);
246
+ }
247
+ }
248
+ }
249
+ }
250
+ catch (e) {
251
+ // a theme that kills its own isolate fails the previews; anything else is the runner's problem
252
+ if (e instanceof IsolateDied)
253
+ renderFindings.push({ where: e.message, code: 'isolate_died', message: `The theme's isolate died rendering ${e.message}; nothing after it was rendered.` });
254
+ else
255
+ runnerProblem = errorText(e);
256
+ }
257
+ finally {
258
+ await lighthouse?.close();
259
+ await harness?.close();
260
+ host?.stop();
261
+ }
262
+ // ── verdicts ──
263
+ const runsFor = (sid, pages) => pages.map((p) => lhRuns.find((r) => r.store === sid && r.page === p));
264
+ const perfRuns = runsFor(config.performance.store, config.performance.pages);
265
+ const perfAvg = avg(perfRuns.map((r) => r?.performance ?? null));
266
+ const perfMissing = runnerProblem ?? browserProblem ?? lighthouseProblem ?? (perfAvg === null ? `Lighthouse gave no performance score for ${perfRuns.filter((r) => !r || r.performance === null).length} page(s): ${perfRuns.map((r) => r?.runtimeError).filter(Boolean).join('; ') || 'no result'}` : null);
267
+ const performance = perfMissing
268
+ ? { status: 'incomplete', average: null, message: `The performance check could not run: ${perfMissing}`, findings: [] }
269
+ : perfAvg >= config.performance.minAverage
270
+ ? { status: 'pass', average: perfAvg, message: `Lighthouse performance averages ${perfAvg} over ${config.performance.pages.join(', ')} (at least ${config.performance.minAverage}).`, findings: [] }
271
+ : { status: 'fail', average: perfAvg, message: `Lighthouse performance averages ${perfAvg} over ${config.performance.pages.join(', ')}; it must be at least ${config.performance.minAverage}. Reduce render-blocking scripts and main-thread work.`, findings: perfRuns.map((r, i) => ({ where: `${config.performance.store} ${config.performance.pages[i]} mobile`, code: 'lighthouse_performance', message: `Performance ${r?.performance ?? 'n/a'} (LCP ${r?.metrics['largest-contentful-paint'] ?? 'n/a'} ms, TBT ${r?.metrics['total-blocking-time'] ?? 'n/a'} ms, CLS ${r?.metrics['cumulative-layout-shift'] ?? 'n/a'})` })) };
272
+ const a = config.accessibility;
273
+ const a11yRuns = runsFor(a.store, a.pages);
274
+ const a11yAvg = avg(a11yRuns.map((r) => r?.accessibility ?? null));
275
+ const a11yMissing = runnerProblem ?? browserProblem ?? lighthouseProblem ?? (a11yAvg === null ? 'Lighthouse gave no accessibility score for every page' : null);
276
+ const axeIncomplete = axeFindings.filter((f) => f.code === 'axe_incomplete');
277
+ const axeBad = axeFindings.filter((f) => f.code !== 'axe_incomplete');
278
+ const lhA11yFindings = a11yRuns.flatMap((r, i) => (r && r.accessibility !== null && r.accessibility < a.lighthouseMinAverage ? [{ where: `${a.store} ${a.pages[i]} mobile`, code: 'lighthouse_accessibility', message: `Lighthouse accessibility ${r.accessibility}; failed audits: ${r.failedAccessibilityAudits.join(', ') || 'none named'}` }] : []));
279
+ const accessibility = a11yMissing || axeIncomplete.length
280
+ ? { status: 'incomplete', lighthouseAverage: a11yAvg, axeViolations: axeBad.length, message: `The accessibility check could not run: ${a11yMissing ?? axeIncomplete[0].message}`, findings: [...axeBad, ...axeIncomplete].slice(0, 50) }
281
+ : axeBad.length || a11yAvg < a.lighthouseMinAverage
282
+ ? { status: 'fail', lighthouseAverage: a11yAvg, axeViolations: axeBad.length, message: axeBad.length ? `${axeBad.length} ${a.axeFailImpacts.join(' or ')} axe-core violation(s) (WCAG 2.2 AA), first: ${axeBad[0].code} on ${axeBad[0].where}; Lighthouse accessibility averages ${a11yAvg} (at least ${a.lighthouseMinAverage}).` : `Lighthouse accessibility averages ${a11yAvg} over ${a.pages.join(', ')}; it must be at least ${a.lighthouseMinAverage}.`, findings: [...axeBad, ...lhA11yFindings].slice(0, 50) }
283
+ : { status: 'pass', lighthouseAverage: a11yAvg, axeViolations: 0, message: `No ${a.axeFailImpacts.join(' or ')} axe-core violation (WCAG 2.2 AA) on ${a.pages.join(', ')} at ${a.viewports.join(' and ')}; Lighthouse accessibility averages ${a11yAvg} (at least ${a.lighthouseMinAverage}).`, findings: [] };
284
+ const expectedShots = config.previews.stores.length * config.previews.viewports.length * config.previews.screenshotPages.length;
285
+ const previewProblem = runnerProblem ?? browserProblem ?? (screenshots.length < expectedShots ? `${expectedShots - screenshots.length} of ${expectedShots} screenshots could not be taken` : null);
286
+ const previews = renderFindings.length
287
+ ? { status: 'fail', renders, sections: sectionsRendered, message: `${renderFindings.length} preview render(s) failed, first: ${renderFindings[0].message} (${renderFindings[0].where}).`, findings: [...renderFindings, ...previewNotes].slice(0, 50) }
288
+ : previewProblem
289
+ ? { status: 'incomplete', renders, sections: sectionsRendered, message: `The preview renders could not finish: ${previewProblem}`, findings: previewNotes.slice(0, 50) }
290
+ : { status: 'pass', renders, sections: sectionsRendered, message: `${renders} route renders and ${sectionsRendered} section previews on ${config.previews.stores.length} sample stores, no render error; ${screenshots.length} screenshots saved.`, findings: previewNotes.slice(0, 50) };
291
+ const axeVersion = JSON.parse(readFileSync(require.resolve('axe-core/package.json'), 'utf8')).version;
292
+ const report = {
293
+ format: REVIEW_REPORT_FORMAT,
294
+ passed: performance.status === 'pass' && accessibility.status === 'pass' && previews.status === 'pass',
295
+ runner: { name: pkg.name, version: pkg.version, gitHead: identity.gitHead ?? null, workerd: workerdVersion(), playwright: playwrightVersion(), chromium, lighthouse: lighthouse?.version ?? null, axe: axeVersion },
296
+ artifact: { manifestDigest: artifact.manifestDigest, artifactDigest: artifact.artifactDigestComputed, ...(typeof manifest?.name === 'string' ? { name: manifest.name } : {}), ...(typeof manifest?.version === 'string' ? { version: manifest.version } : {}) },
297
+ config,
298
+ checks: { performance, accessibility, previews },
299
+ lighthouse: lhRuns,
300
+ screenshots,
301
+ browserErrors: browserErrors.slice(0, 50),
302
+ startedAt,
303
+ finishedAt: new Date().toISOString(),
304
+ };
305
+ writeFileSync(join(opts.outDir, 'review-report.json'), `${JSON.stringify(report, null, 2)}\n`);
306
+ return report;
307
+ }
308
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/review/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa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,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAC/P,MAAM;QACN,MAAM,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE;QAChD,UAAU,EAAE,MAAM;QAClB,WAAW;QACX,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QACzC,SAAS;QACT,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACrC,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;IAC9F,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Page } from 'playwright';
2
+ export interface LighthouseRun {
3
+ url: string;
4
+ performance: number | null;
5
+ accessibility: number | null;
6
+ /** Failed accessibility audits (score 0), by id. */
7
+ failedAccessibilityAudits: string[];
8
+ metrics: Record<string, number | null>;
9
+ runtimeError: string | null;
10
+ warnings: string[];
11
+ }
12
+ export interface LighthouseModules {
13
+ version: string;
14
+ run(page: Page, url: string, cdpPort: number): Promise<LighthouseRun>;
15
+ close(): Promise<void>;
16
+ }
17
+ /**
18
+ * The directory of package `name` as Node finds it from `fromDir` (each ancestor's node_modules), followed through
19
+ * symlinks (pnpm's layout), and its ESM entry: `exports["."]` (`import`, then `default`), else `module`, else `main`.
20
+ */
21
+ export declare function packageEntry(name: string, fromDir: string): {
22
+ dir: string;
23
+ version: string;
24
+ entry: string;
25
+ } | null;
26
+ /** Loads Lighthouse and puppeteer-core; throws `Error('lighthouse is not installed …')` when either is missing. */
27
+ export declare function loadLighthouse(modulesDir: string | null): Promise<LighthouseModules>;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Lighthouse (the npm package, default configuration: mobile form factor, simulated throttling) on a page the review
3
+ * gateway answers. Lighthouse drives the tab through the Chrome DevTools Protocol (puppeteer-core, Lighthouse's own
4
+ * dependency, connected to the harness browser's `--remote-debugging-port`). The tab belongs to a Playwright context
5
+ * whose route handler is the gateway, so Lighthouse's navigation is answered by the gateway like every other request
6
+ * and nothing leaves the machine.
7
+ *
8
+ * Lighthouse is not a dependency of this package (it is large and only the review command needs it): it is loaded
9
+ * from `modulesDir` (the theme-checker image's /opt/review/node_modules) or, without one, from this package's own
10
+ * resolution (its devDependency, for the tests).
11
+ */
12
+ import { existsSync, readFileSync, realpathSync } from 'node:fs';
13
+ import { basename, dirname, join } from 'node:path';
14
+ import { fileURLToPath, pathToFileURL } from 'node:url';
15
+ const METRICS = ['first-contentful-paint', 'largest-contentful-paint', 'total-blocking-time', 'cumulative-layout-shift', 'speed-index'];
16
+ const pct = (s) => (typeof s === 'number' ? Math.round(s * 100) : null);
17
+ /**
18
+ * The directory of package `name` as Node finds it from `fromDir` (each ancestor's node_modules), followed through
19
+ * symlinks (pnpm's layout), and its ESM entry: `exports["."]` (`import`, then `default`), else `module`, else `main`.
20
+ */
21
+ export function packageEntry(name, fromDir) {
22
+ for (let d = fromDir;; d = dirname(d)) {
23
+ const candidate = basename(d) === 'node_modules' ? join(d, name) : join(d, 'node_modules', name);
24
+ if (existsSync(join(candidate, 'package.json'))) {
25
+ const dir = realpathSync(candidate);
26
+ const pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
27
+ const pick = (e) => {
28
+ if (typeof e === 'string')
29
+ return e;
30
+ if (!e || typeof e !== 'object' || Array.isArray(e))
31
+ return undefined;
32
+ const o = e;
33
+ if ('.' in o)
34
+ return pick(o['.']);
35
+ return pick(o['import']) ?? pick(o['node']) ?? pick(o['default']);
36
+ };
37
+ const rel = pick(pkg.exports) ?? pkg.module ?? pkg.main ?? 'index.js';
38
+ return { dir, version: String(pkg.version ?? ''), entry: join(dir, rel) };
39
+ }
40
+ if (dirname(d) === d)
41
+ return null;
42
+ }
43
+ }
44
+ /** Loads Lighthouse and puppeteer-core; throws `Error('lighthouse is not installed …')` when either is missing. */
45
+ export async function loadLighthouse(modulesDir) {
46
+ const lh = packageEntry('lighthouse', modulesDir ?? dirname(fileURLToPath(import.meta.url)));
47
+ if (!lh)
48
+ throw new Error(`lighthouse is not installed${modulesDir ? ` under ${modulesDir}` : ''}`);
49
+ const lhEntry = lh.entry;
50
+ const lhVersion = lh.version;
51
+ const pp = packageEntry('puppeteer-core', lh.dir);
52
+ if (!pp)
53
+ throw new Error('puppeteer-core (a lighthouse dependency) is not installed');
54
+ const ppEntry = pp.entry;
55
+ const lighthouse = (await import(pathToFileURL(lhEntry).href)).default;
56
+ const puppeteer = (await import(pathToFileURL(ppEntry).href)).default;
57
+ let browser = null;
58
+ let marker = 0;
59
+ return {
60
+ version: lhVersion,
61
+ async run(page, url, cdpPort) {
62
+ if (!browser)
63
+ browser = await puppeteer.connect({ browserURL: `http://127.0.0.1:${cdpPort}`, defaultViewport: null });
64
+ // the Playwright tab, found by a marker URL only this run uses
65
+ const tag = `tq-review-lh-${process.pid}-${++marker}`;
66
+ await page.goto(`about:blank#${tag}`);
67
+ const target = await browser.waitForTarget((t) => t.url().endsWith(`#${tag}`), { timeout: 10_000 });
68
+ const ppage = await target.page();
69
+ const flags = { output: 'json', logLevel: 'error', onlyCategories: ['performance', 'accessibility'], formFactor: 'mobile', throttlingMethod: 'simulate', maxWaitForLoad: 30_000 };
70
+ const r = await lighthouse(url, flags, undefined, ppage);
71
+ if (!r)
72
+ return { url, performance: null, accessibility: null, failedAccessibilityAudits: [], metrics: {}, runtimeError: 'lighthouse returned no result', warnings: [] };
73
+ const lhr = r.lhr;
74
+ const a11y = lhr.categories['accessibility'];
75
+ return {
76
+ url,
77
+ performance: pct(lhr.categories['performance']?.score),
78
+ accessibility: pct(a11y?.score),
79
+ failedAccessibilityAudits: (a11y?.auditRefs ?? []).filter((x) => x.weight > 0 && lhr.audits[x.id]?.score === 0).map((x) => x.id).sort(),
80
+ metrics: Object.fromEntries(METRICS.map((m) => [m, typeof lhr.audits[m]?.numericValue === 'number' ? Math.round(lhr.audits[m].numericValue * 1000) / 1000 : null])),
81
+ runtimeError: lhr.runtimeError ? `${lhr.runtimeError.code ?? 'error'}: ${lhr.runtimeError.message ?? ''}`.slice(0, 300) : null,
82
+ warnings: (lhr.runWarnings ?? []).map((w) => String(w).slice(0, 300)).slice(0, 10),
83
+ };
84
+ },
85
+ async close() {
86
+ try {
87
+ await browser?.disconnect();
88
+ }
89
+ catch { /* the browser closes anyway */ }
90
+ browser = null;
91
+ },
92
+ };
93
+ }
94
+ //# sourceMappingURL=lighthouse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lighthouse.js","sourceRoot":"","sources":["../../src/review/lighthouse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA0BvD,MAAM,OAAO,GAAG,CAAC,wBAAwB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,aAAa,CAAU,CAAA;AAChJ,MAAM,GAAG,GAAG,CAAC,CAA4B,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAElG;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,OAAe;IACxD,KAAK,IAAI,CAAC,GAAG,OAAO,GAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CA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EAAE,CAAA;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,+BAA+B,CAAC,CAAC;YAC7E,OAAO,GAAG,IAAI,CAAA;QAChB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The review command's three sample stores (PARTNER_THEMES.md §5.2 "Preview renders on sample stores", Tanqory choice):
3
+ *
4
+ * small a small catalogue: three products, one collection besides `all`
5
+ * large the storefront tier's 60-product catalogue (src/storefront/fixture.ts) plus a product with a 120-character
6
+ * title and twelve variants, whose page is the product page reviewed
7
+ * rtl the same catalogue in a second language and a right-to-left locale: Arabic (`ar`, default, direction
8
+ * `rtl`) and English
9
+ *
10
+ * Derived from the storefront fixture, so every route the gateway resolves has data in every store. Deterministic.
11
+ */
12
+ import type { StoreFixture } from '../fixtures/store-fixture.js';
13
+ import type { GatewayLanguages } from '../storefront/gateway.js';
14
+ import type { ReviewPage, ReviewStoreId } from './config.js';
15
+ export interface ReviewStore {
16
+ id: ReviewStoreId;
17
+ /** What the screenshots are labelled with. */
18
+ title: string;
19
+ fixture: StoreFixture;
20
+ languages: GatewayLanguages;
21
+ /** The handle of the product page reviewed in this store. */
22
+ productHandle: string;
23
+ }
24
+ export declare const LONG_PRODUCT: {
25
+ readonly handle: "long-title-linen-overshirt";
26
+ readonly title: "Washed Linen Overshirt with Horn Buttons, Two Chest Pockets and a Relaxed Fit, Cut and Sewn in Small Batches by Hand";
27
+ readonly sizes: readonly ["XXS", "XS", "S", "M", "L", "XL", "XXL", "3XL", "4XL", "5XL", "6XL", "7XL"];
28
+ };
29
+ export declare function reviewStore(id: ReviewStoreId): ReviewStore;
30
+ /** The path of a reviewed page in a store. */
31
+ export declare function pagePath(store: ReviewStore, page: ReviewPage): string;
32
+ /**
33
+ * One sample URL per route kind (theme-abi §2.1 built-in routes); custom routes get `sample` for each parameter.
34
+ * not_found is rendered at a path no route claims and must answer 404.
35
+ */
36
+ export declare function routePaths(store: ReviewStore, routes: Record<string, string>, customRoutes: Record<string, {
37
+ path: string;
38
+ }> | undefined): {
39
+ kind: string;
40
+ path: string;
41
+ status: number;
42
+ }[];