@se-studio/site-check 0.0.0-next16-20260822103555
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 +948 -0
- package/README.md +220 -0
- package/check-no-context-workarounds.mjs +235 -0
- package/develop-sites-timing.mjs +609 -0
- package/dist/check-pages-exist.d.ts +19 -0
- package/dist/check-pages-exist.d.ts.map +1 -0
- package/dist/check-pages-exist.js +25 -0
- package/dist/check-pages-exist.js.map +1 -0
- package/dist/check-rewrites.d.ts +21 -0
- package/dist/check-rewrites.d.ts.map +1 -0
- package/dist/check-rewrites.js +69 -0
- package/dist/check-rewrites.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +231 -0
- package/dist/cli.js.map +1 -0
- package/dist/cms-integrity/article-link-integrity.d.ts +4 -0
- package/dist/cms-integrity/article-link-integrity.d.ts.map +1 -0
- package/dist/cms-integrity/article-link-integrity.js +8 -0
- package/dist/cms-integrity/article-link-integrity.js.map +1 -0
- package/dist/cms-integrity/evaluate-article-link-integrity.d.ts +11 -0
- package/dist/cms-integrity/evaluate-article-link-integrity.d.ts.map +1 -0
- package/dist/cms-integrity/evaluate-article-link-integrity.js +49 -0
- package/dist/cms-integrity/evaluate-article-link-integrity.js.map +1 -0
- package/dist/cms-integrity/fetch-article-links.d.ts +8 -0
- package/dist/cms-integrity/fetch-article-links.d.ts.map +1 -0
- package/dist/cms-integrity/fetch-article-links.js +27 -0
- package/dist/cms-integrity/fetch-article-links.js.map +1 -0
- package/dist/cms-integrity/index.d.ts +7 -0
- package/dist/cms-integrity/index.d.ts.map +1 -0
- package/dist/cms-integrity/index.js +6 -0
- package/dist/cms-integrity/index.js.map +1 -0
- package/dist/cms-integrity/report.d.ts +4 -0
- package/dist/cms-integrity/report.d.ts.map +1 -0
- package/dist/cms-integrity/report.js +42 -0
- package/dist/cms-integrity/report.js.map +1 -0
- package/dist/cms-integrity/routing-config.d.ts +3 -0
- package/dist/cms-integrity/routing-config.d.ts.map +1 -0
- package/dist/cms-integrity/routing-config.js +5 -0
- package/dist/cms-integrity/routing-config.js.map +1 -0
- package/dist/cms-integrity/types.d.ts +32 -0
- package/dist/cms-integrity/types.d.ts.map +1 -0
- package/dist/cms-integrity/types.js +2 -0
- package/dist/cms-integrity/types.js.map +1 -0
- package/dist/collect-markdown-urls.d.ts +29 -0
- package/dist/collect-markdown-urls.d.ts.map +1 -0
- package/dist/collect-markdown-urls.js +144 -0
- package/dist/collect-markdown-urls.js.map +1 -0
- package/dist/discovery/endpoints.d.ts +4 -0
- package/dist/discovery/endpoints.d.ts.map +1 -0
- package/dist/discovery/endpoints.js +34 -0
- package/dist/discovery/endpoints.js.map +1 -0
- package/dist/discovery/index.d.ts +6 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +5 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/resolve-config.d.ts +5 -0
- package/dist/discovery/resolve-config.d.ts.map +1 -0
- package/dist/discovery/resolve-config.js +21 -0
- package/dist/discovery/resolve-config.js.map +1 -0
- package/dist/discovery/types.d.ts +60 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +2 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/validate-content.d.ts +30 -0
- package/dist/discovery/validate-content.d.ts.map +1 -0
- package/dist/discovery/validate-content.js +244 -0
- package/dist/discovery/validate-content.js.map +1 -0
- package/dist/discovery/validate-endpoints.d.ts +4 -0
- package/dist/discovery/validate-endpoints.d.ts.map +1 -0
- package/dist/discovery/validate-endpoints.js +143 -0
- package/dist/discovery/validate-endpoints.js.map +1 -0
- package/dist/download.d.ts +19 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +48 -0
- package/dist/download.js.map +1 -0
- package/dist/fetch-options.d.ts +19 -0
- package/dist/fetch-options.d.ts.map +1 -0
- package/dist/fetch-options.js +48 -0
- package/dist/fetch-options.js.map +1 -0
- package/dist/production-audit/index.d.ts +96 -0
- package/dist/production-audit/index.d.ts.map +1 -0
- package/dist/production-audit/index.js +855 -0
- package/dist/production-audit/index.js.map +1 -0
- package/dist/screaming-frog/audit.d.ts +9 -0
- package/dist/screaming-frog/audit.d.ts.map +1 -0
- package/dist/screaming-frog/audit.js +254 -0
- package/dist/screaming-frog/audit.js.map +1 -0
- package/dist/screaming-frog/compare-report.d.ts +22 -0
- package/dist/screaming-frog/compare-report.d.ts.map +1 -0
- package/dist/screaming-frog/compare-report.js +142 -0
- package/dist/screaming-frog/compare-report.js.map +1 -0
- package/dist/screaming-frog/compare.d.ts +5 -0
- package/dist/screaming-frog/compare.d.ts.map +1 -0
- package/dist/screaming-frog/compare.js +42 -0
- package/dist/screaming-frog/compare.js.map +1 -0
- package/dist/screaming-frog/crawl-state.d.ts +19 -0
- package/dist/screaming-frog/crawl-state.d.ts.map +1 -0
- package/dist/screaming-frog/crawl-state.js +30 -0
- package/dist/screaming-frog/crawl-state.js.map +1 -0
- package/dist/screaming-frog/crawl.d.ts +12 -0
- package/dist/screaming-frog/crawl.d.ts.map +1 -0
- package/dist/screaming-frog/crawl.js +93 -0
- package/dist/screaming-frog/crawl.js.map +1 -0
- package/dist/screaming-frog/csv.d.ts +6 -0
- package/dist/screaming-frog/csv.d.ts.map +1 -0
- package/dist/screaming-frog/csv.js +71 -0
- package/dist/screaming-frog/csv.js.map +1 -0
- package/dist/screaming-frog/env.d.ts +4 -0
- package/dist/screaming-frog/env.d.ts.map +1 -0
- package/dist/screaming-frog/env.js +53 -0
- package/dist/screaming-frog/env.js.map +1 -0
- package/dist/screaming-frog/index.d.ts +15 -0
- package/dist/screaming-frog/index.d.ts.map +1 -0
- package/dist/screaming-frog/index.js +15 -0
- package/dist/screaming-frog/index.js.map +1 -0
- package/dist/screaming-frog/list-crawls.d.ts +22 -0
- package/dist/screaming-frog/list-crawls.d.ts.map +1 -0
- package/dist/screaming-frog/list-crawls.js +107 -0
- package/dist/screaming-frog/list-crawls.js.map +1 -0
- package/dist/screaming-frog/load-config.d.ts +9 -0
- package/dist/screaming-frog/load-config.d.ts.map +1 -0
- package/dist/screaming-frog/load-config.js +86 -0
- package/dist/screaming-frog/load-config.js.map +1 -0
- package/dist/screaming-frog/load-profile.d.ts +9 -0
- package/dist/screaming-frog/load-profile.d.ts.map +1 -0
- package/dist/screaming-frog/load-profile.js +32 -0
- package/dist/screaming-frog/load-profile.js.map +1 -0
- package/dist/screaming-frog/paths.d.ts +5 -0
- package/dist/screaming-frog/paths.d.ts.map +1 -0
- package/dist/screaming-frog/paths.js +34 -0
- package/dist/screaming-frog/paths.js.map +1 -0
- package/dist/screaming-frog/rules.d.ts +14 -0
- package/dist/screaming-frog/rules.d.ts.map +1 -0
- package/dist/screaming-frog/rules.js +211 -0
- package/dist/screaming-frog/rules.js.map +1 -0
- package/dist/screaming-frog/sf-runner.d.ts +12 -0
- package/dist/screaming-frog/sf-runner.d.ts.map +1 -0
- package/dist/screaming-frog/sf-runner.js +37 -0
- package/dist/screaming-frog/sf-runner.js.map +1 -0
- package/dist/screaming-frog/types.d.ts +136 -0
- package/dist/screaming-frog/types.d.ts.map +1 -0
- package/dist/screaming-frog/types.js +2 -0
- package/dist/screaming-frog/types.js.map +1 -0
- package/dist/screaming-frog-cli.d.ts +4 -0
- package/dist/screaming-frog-cli.d.ts.map +1 -0
- package/dist/screaming-frog-cli.js +326 -0
- package/dist/screaming-frog-cli.js.map +1 -0
- package/dist/smoke-test/analytics-context-bundle.d.ts +30 -0
- package/dist/smoke-test/analytics-context-bundle.d.ts.map +1 -0
- package/dist/smoke-test/analytics-context-bundle.js +148 -0
- package/dist/smoke-test/analytics-context-bundle.js.map +1 -0
- package/dist/smoke-test/build-route-policy.d.ts +39 -0
- package/dist/smoke-test/build-route-policy.d.ts.map +1 -0
- package/dist/smoke-test/build-route-policy.js +121 -0
- package/dist/smoke-test/build-route-policy.js.map +1 -0
- package/dist/smoke-test/cache-log-audit.d.ts +22 -0
- package/dist/smoke-test/cache-log-audit.d.ts.map +1 -0
- package/dist/smoke-test/cache-log-audit.js +85 -0
- package/dist/smoke-test/cache-log-audit.js.map +1 -0
- package/dist/smoke-test/config.d.ts +7 -0
- package/dist/smoke-test/config.d.ts.map +1 -0
- package/dist/smoke-test/config.js +61 -0
- package/dist/smoke-test/config.js.map +1 -0
- package/dist/smoke-test/index.d.ts +15 -0
- package/dist/smoke-test/index.d.ts.map +1 -0
- package/dist/smoke-test/index.js +9 -0
- package/dist/smoke-test/index.js.map +1 -0
- package/dist/smoke-test/runner.d.ts +9 -0
- package/dist/smoke-test/runner.d.ts.map +1 -0
- package/dist/smoke-test/runner.js +340 -0
- package/dist/smoke-test/runner.js.map +1 -0
- package/dist/smoke-test/static.d.ts +23 -0
- package/dist/smoke-test/static.d.ts.map +1 -0
- package/dist/smoke-test/static.js +126 -0
- package/dist/smoke-test/static.js.map +1 -0
- package/dist/smoke-test/types.d.ts +89 -0
- package/dist/smoke-test/types.d.ts.map +1 -0
- package/dist/smoke-test/types.js +2 -0
- package/dist/smoke-test/types.js.map +1 -0
- package/dist/validate.d.ts +48 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +140 -0
- package/dist/validate.js.map +1 -0
- package/dist/vercel-env.d.ts +13 -0
- package/dist/vercel-env.d.ts.map +1 -0
- package/dist/vercel-env.js +93 -0
- package/dist/vercel-env.js.map +1 -0
- package/docs/llms.md +137 -0
- package/fixtures/revalidation/entry-publish.json +10 -0
- package/markdown-accuracy-audit.mjs +432 -0
- package/package.json +102 -0
- package/revalidation-matrix-test.mjs +467 -0
- package/smoke-test-deploy-check.mjs +70 -0
- package/smoke-test-live.mjs +63 -0
- package/smoke-test-one.mjs +442 -0
- package/templates/biome-ssg-guardrails.override.json +27 -0
- package/templates/route-build-policy.example.json +18 -0
- package/validate-build-routes.mjs +74 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cross-site develop vs production cache/timing probe for all client marketing sites.
|
|
5
|
+
*
|
|
6
|
+
* Reads smoke.cases.json from each site repo, then runs N sequential passes over every
|
|
7
|
+
* path (default 5). Each request is one-at-a-time — no concurrent fetches.
|
|
8
|
+
*
|
|
9
|
+
* Usage (from repo root or packages/site-check):
|
|
10
|
+
* node packages/site-check/develop-sites-timing.mjs
|
|
11
|
+
* develop-sites-timing --site pointme --passes 3 --output ./timing.json
|
|
12
|
+
*
|
|
13
|
+
* Options:
|
|
14
|
+
* --site <key> Run one site (se2026, om1, brightline, brightlifekids, pedestal, headwater, pointme)
|
|
15
|
+
* --passes <n> Number of full passes (default 5)
|
|
16
|
+
* --output <path> JSON output path (default: develop-sites-timing.json in cwd)
|
|
17
|
+
* --delay-ms <n> Pause between requests in ms (default 0)
|
|
18
|
+
* --develop-only Skip production probes
|
|
19
|
+
* --production-only Skip develop probes (no bypass token required)
|
|
20
|
+
*
|
|
21
|
+
* Env:
|
|
22
|
+
* SE_SOURCE_ROOT Client repo root (default: ~/source)
|
|
23
|
+
*
|
|
24
|
+
* Develop URLs use VERCEL_PROTECTION_BYPASS_TOKEN from each site's .env.local.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { spawnSync } from 'node:child_process';
|
|
28
|
+
import fs from 'node:fs';
|
|
29
|
+
import { homedir } from 'node:os';
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
import { fileURLToPath } from 'node:url';
|
|
32
|
+
|
|
33
|
+
const BYPASS_ENV_KEYS = [
|
|
34
|
+
'VERCEL_PROTECTION_BYPASS_TOKEN',
|
|
35
|
+
'VERCEL_AUTOMATION_BYPASS_SECRET',
|
|
36
|
+
'VERCEL_BYPASS_TOKEN',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const DEFAULT_PASSES = 5;
|
|
40
|
+
const CURL_MAX_TIME_SECONDS = 45;
|
|
41
|
+
|
|
42
|
+
/** @type {readonly SiteDefinition[]} */
|
|
43
|
+
export const SITE_DEFINITIONS = [
|
|
44
|
+
{
|
|
45
|
+
key: 'se2026',
|
|
46
|
+
label: 'SE Studio',
|
|
47
|
+
develop: 'https://se-website-2026-git-develop-se-studio.vercel.app',
|
|
48
|
+
production: 'https://www.se.studio',
|
|
49
|
+
repoDir: 'se/se-website-2026',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'om1',
|
|
53
|
+
label: 'OM1',
|
|
54
|
+
develop: 'https://om1-website-git-develop-se-studio.vercel.app',
|
|
55
|
+
production: 'https://www.om1.com',
|
|
56
|
+
repoDir: 'customers/om1/om1-website',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: 'brightline',
|
|
60
|
+
label: 'Brightline',
|
|
61
|
+
develop: 'https://hellobrightline-com-git-develop-brightline.vercel.app',
|
|
62
|
+
production: 'https://www.brightline.com',
|
|
63
|
+
repoDir: 'customers/brightline/brightline-sites/apps/brightline-website',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: 'brightlifekids',
|
|
67
|
+
label: 'Brightlife Kids',
|
|
68
|
+
develop: 'https://brightlife-kids-website-git-develop-brightline.vercel.app',
|
|
69
|
+
production: 'https://www.brightlife.kids',
|
|
70
|
+
repoDir: 'customers/brightline/brightline-sites/apps/brightlife-kids-website',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: 'pedestal',
|
|
74
|
+
label: 'Pedestal',
|
|
75
|
+
develop: 'https://pedestal-health-git-develop-se-studio.vercel.app',
|
|
76
|
+
production: 'https://www.pedestalhealth.com',
|
|
77
|
+
repoDir: 'customers/pedestal/pedestal-sites/apps/pedestal-website',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'headwater',
|
|
81
|
+
label: 'Headwater',
|
|
82
|
+
develop: 'https://headwater-website-git-develop-se-studio.vercel.app',
|
|
83
|
+
production: 'https://www.headwaterscience.com',
|
|
84
|
+
repoDir: 'customers/pedestal/pedestal-sites/apps/headwater-website',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'pointme',
|
|
88
|
+
label: 'PointMe',
|
|
89
|
+
develop: 'https://develop-marketing-site.vercel.app',
|
|
90
|
+
production: 'https://www.point.me',
|
|
91
|
+
repoDir: 'customers/pointme/develop-marketing-site',
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @typedef {object} SiteDefinition
|
|
97
|
+
* @property {string} key
|
|
98
|
+
* @property {string} label
|
|
99
|
+
* @property {string} develop
|
|
100
|
+
* @property {string} production
|
|
101
|
+
* @property {string} repoDir — relative to SE_SOURCE_ROOT
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {object} ProbeResult
|
|
106
|
+
* @property {string} status
|
|
107
|
+
* @property {number | null} ttfb
|
|
108
|
+
* @property {number} size
|
|
109
|
+
* @property {string} vercel_cache
|
|
110
|
+
* @property {string} prerender
|
|
111
|
+
* @property {string} stale
|
|
112
|
+
* @property {string} age
|
|
113
|
+
* @property {string} pattern
|
|
114
|
+
* @property {string} cache_control
|
|
115
|
+
* @property {string} [error]
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {object} CliOptions
|
|
120
|
+
* @property {string | undefined} siteKey
|
|
121
|
+
* @property {number} passes
|
|
122
|
+
* @property {string} outputPath
|
|
123
|
+
* @property {number} delayMs
|
|
124
|
+
* @property {boolean} developOnly
|
|
125
|
+
* @property {boolean} productionOnly
|
|
126
|
+
* @property {string} sourceRoot
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
export function expandHome(filePath) {
|
|
130
|
+
return filePath.startsWith('~/') ? path.join(homedir(), filePath.slice(2)) : filePath;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function parseEnvFile(filePath) {
|
|
134
|
+
/** @type {Record<string, string>} */
|
|
135
|
+
const env = {};
|
|
136
|
+
if (!fs.existsSync(filePath)) {
|
|
137
|
+
return env;
|
|
138
|
+
}
|
|
139
|
+
for (const line of fs.readFileSync(filePath, 'utf8').split('\n')) {
|
|
140
|
+
const trimmed = line.trim();
|
|
141
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
142
|
+
const eq = trimmed.indexOf('=');
|
|
143
|
+
if (eq === -1) continue;
|
|
144
|
+
const key = trimmed.slice(0, eq).trim();
|
|
145
|
+
let value = trimmed.slice(eq + 1).trim();
|
|
146
|
+
if (
|
|
147
|
+
(value.startsWith('"') && value.endsWith('"')) ||
|
|
148
|
+
(value.startsWith("'") && value.endsWith("'"))
|
|
149
|
+
) {
|
|
150
|
+
value = value.slice(1, -1);
|
|
151
|
+
}
|
|
152
|
+
env[key] = value;
|
|
153
|
+
}
|
|
154
|
+
return env;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function resolveProtectionBypass(env) {
|
|
158
|
+
for (const key of BYPASS_ENV_KEYS) {
|
|
159
|
+
const value = (env[key] ?? '').trim();
|
|
160
|
+
if (value) return value;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function parseHeaders(raw) {
|
|
166
|
+
/** @type {Record<string, string>} */
|
|
167
|
+
const out = { status: '' };
|
|
168
|
+
for (const line of raw.split('\n')) {
|
|
169
|
+
if (line.toUpperCase().startsWith('HTTP/')) {
|
|
170
|
+
const parts = line.split(/\s+/);
|
|
171
|
+
out.status = parts[1] ?? '';
|
|
172
|
+
} else if (line.includes(':')) {
|
|
173
|
+
const colon = line.indexOf(':');
|
|
174
|
+
const key = line.slice(0, colon).trim().toLowerCase();
|
|
175
|
+
const value = line.slice(colon + 1).trim();
|
|
176
|
+
out[key] = value;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function classifyCachePattern(cacheControl) {
|
|
183
|
+
const cc = cacheControl.toLowerCase();
|
|
184
|
+
if (cc.includes('no-store') || cc.includes('private, no-cache')) {
|
|
185
|
+
return 'dynamic';
|
|
186
|
+
}
|
|
187
|
+
if (cc.includes('s-maxage') || cc.includes('stale-while-revalidate')) {
|
|
188
|
+
return 'isr';
|
|
189
|
+
}
|
|
190
|
+
return 'other';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function buildProbeFromCurl(headersRaw, metricsRaw) {
|
|
194
|
+
const metrics = metricsRaw.trim().split('|');
|
|
195
|
+
if (metrics.length < 3) {
|
|
196
|
+
return {
|
|
197
|
+
status: 'ERR',
|
|
198
|
+
ttfb: null,
|
|
199
|
+
size: 0,
|
|
200
|
+
vercel_cache: '-',
|
|
201
|
+
prerender: '-',
|
|
202
|
+
stale: '-',
|
|
203
|
+
age: '0',
|
|
204
|
+
pattern: 'other',
|
|
205
|
+
cache_control: '',
|
|
206
|
+
error: metricsRaw.slice(0, 200) || 'invalid curl metrics',
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const [ttfbRaw, statusCode, sizeRaw] = metrics;
|
|
211
|
+
const headers = parseHeaders(headersRaw);
|
|
212
|
+
const cacheControl = headers['cache-control'] ?? '';
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
status: headers.status || statusCode,
|
|
216
|
+
ttfb: Number.parseFloat(ttfbRaw),
|
|
217
|
+
size: Number.parseInt(sizeRaw, 10) || 0,
|
|
218
|
+
vercel_cache: headers['x-vercel-cache'] ?? '-',
|
|
219
|
+
prerender: headers['x-nextjs-prerender'] ?? '-',
|
|
220
|
+
stale: headers['x-nextjs-stale-time'] ?? '-',
|
|
221
|
+
age: headers.age ?? '0',
|
|
222
|
+
pattern: classifyCachePattern(cacheControl),
|
|
223
|
+
cache_control: cacheControl.slice(0, 80),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @param {string} url
|
|
229
|
+
* @param {string | undefined} bypass
|
|
230
|
+
* @param {(args: string[]) => { status: number | null; stdout: string; stderr: string }} [runCurl]
|
|
231
|
+
* @returns {ProbeResult}
|
|
232
|
+
*/
|
|
233
|
+
export function probeUrl(url, bypass, runCurl = defaultRunCurl) {
|
|
234
|
+
const args = [
|
|
235
|
+
'-sI',
|
|
236
|
+
'-w',
|
|
237
|
+
'\n__METRICS__%{time_starttransfer}|%{http_code}|%{size_download}',
|
|
238
|
+
'--max-time',
|
|
239
|
+
String(CURL_MAX_TIME_SECONDS),
|
|
240
|
+
];
|
|
241
|
+
if (bypass) {
|
|
242
|
+
args.push('-H', `x-vercel-protection-bypass: ${bypass}`);
|
|
243
|
+
}
|
|
244
|
+
args.push(url);
|
|
245
|
+
|
|
246
|
+
const result = runCurl(args);
|
|
247
|
+
const combined = `${result.stdout}${result.stderr}`;
|
|
248
|
+
if (result.status !== 0) {
|
|
249
|
+
return {
|
|
250
|
+
status: 'ERR',
|
|
251
|
+
ttfb: null,
|
|
252
|
+
size: 0,
|
|
253
|
+
vercel_cache: '-',
|
|
254
|
+
prerender: '-',
|
|
255
|
+
stale: '-',
|
|
256
|
+
age: '0',
|
|
257
|
+
pattern: 'other',
|
|
258
|
+
cache_control: '',
|
|
259
|
+
error: combined.slice(0, 300),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const marker = '__METRICS__';
|
|
264
|
+
const markerIndex = combined.lastIndexOf(marker);
|
|
265
|
+
if (markerIndex === -1) {
|
|
266
|
+
return {
|
|
267
|
+
status: 'ERR',
|
|
268
|
+
ttfb: null,
|
|
269
|
+
size: 0,
|
|
270
|
+
vercel_cache: '-',
|
|
271
|
+
prerender: '-',
|
|
272
|
+
stale: '-',
|
|
273
|
+
age: '0',
|
|
274
|
+
pattern: 'other',
|
|
275
|
+
cache_control: '',
|
|
276
|
+
error: combined.slice(0, 300) || 'missing curl metrics',
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const headersRaw = combined.slice(0, markerIndex);
|
|
281
|
+
const metricsRaw = combined.slice(markerIndex + marker.length);
|
|
282
|
+
return buildProbeFromCurl(headersRaw, metricsRaw);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function defaultRunCurl(args) {
|
|
286
|
+
const result = spawnSync('curl', args, { encoding: 'utf8' });
|
|
287
|
+
return {
|
|
288
|
+
status: result.status,
|
|
289
|
+
stdout: result.stdout ?? '',
|
|
290
|
+
stderr: result.stderr ?? '',
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function joinBaseUrl(baseUrl, routePath) {
|
|
295
|
+
const normalizedBase = baseUrl.replace(/\/$/, '');
|
|
296
|
+
const normalizedPath = routePath.startsWith('/') ? routePath : `/${routePath}`;
|
|
297
|
+
return `${normalizedBase}${normalizedPath}`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function loadSmokeCases(smokePath) {
|
|
301
|
+
const raw = JSON.parse(fs.readFileSync(smokePath, 'utf8'));
|
|
302
|
+
return raw.cases
|
|
303
|
+
.filter((entry) => entry.expectHtmlStatus !== 404)
|
|
304
|
+
.map((entry) => ({
|
|
305
|
+
category: entry.category ?? 'unknown',
|
|
306
|
+
label: entry.label ?? entry.path,
|
|
307
|
+
path: entry.path,
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export function resolveSites(options) {
|
|
312
|
+
const sourceRoot = expandHome(options.sourceRoot);
|
|
313
|
+
let sites = SITE_DEFINITIONS;
|
|
314
|
+
|
|
315
|
+
if (options.siteKey) {
|
|
316
|
+
sites = sites.filter((site) => site.key === options.siteKey);
|
|
317
|
+
if (sites.length === 0) {
|
|
318
|
+
throw new Error(
|
|
319
|
+
`Unknown site key "${options.siteKey}". Valid keys: ${SITE_DEFINITIONS.map((s) => s.key).join(', ')}`,
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return sites.map((site) => {
|
|
325
|
+
const repoPath = path.join(sourceRoot, site.repoDir);
|
|
326
|
+
const smokePath = path.join(repoPath, 'smoke.cases.json');
|
|
327
|
+
if (!fs.existsSync(smokePath)) {
|
|
328
|
+
throw new Error(`Missing smoke.cases.json for ${site.label}: ${smokePath}`);
|
|
329
|
+
}
|
|
330
|
+
const envLocal = parseEnvFile(path.join(repoPath, '.env.local'));
|
|
331
|
+
const bypass = resolveProtectionBypass(envLocal);
|
|
332
|
+
return {
|
|
333
|
+
...site,
|
|
334
|
+
repoPath,
|
|
335
|
+
smokePath,
|
|
336
|
+
bypass,
|
|
337
|
+
cases: loadSmokeCases(smokePath),
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function sleep(ms) {
|
|
343
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @param {ProbeResult[]} passes
|
|
348
|
+
*/
|
|
349
|
+
export function summarizePasses(passes) {
|
|
350
|
+
const valid = passes.filter((p) => p.ttfb !== null && !Number.isNaN(p.ttfb));
|
|
351
|
+
const ttfbs = valid.map((p) => p.ttfb);
|
|
352
|
+
const hitCount = passes.filter((p) => p.vercel_cache === 'HIT').length;
|
|
353
|
+
const staleCount = passes.filter((p) => p.vercel_cache === 'STALE').length;
|
|
354
|
+
const missCount = passes.filter((p) => p.vercel_cache === 'MISS').length;
|
|
355
|
+
const prerenderCount = passes.filter((p) => p.prerender === '1').length;
|
|
356
|
+
|
|
357
|
+
const avgTtfb =
|
|
358
|
+
ttfbs.length > 0 ? ttfbs.reduce((sum, value) => sum + value, 0) / ttfbs.length : null;
|
|
359
|
+
const minTtfb = ttfbs.length > 0 ? Math.min(...ttfbs) : null;
|
|
360
|
+
const maxTtfb = ttfbs.length > 0 ? Math.max(...ttfbs) : null;
|
|
361
|
+
const firstTtfb = passes[0]?.ttfb ?? null;
|
|
362
|
+
const lastTtfb = passes.at(-1)?.ttfb ?? null;
|
|
363
|
+
|
|
364
|
+
return {
|
|
365
|
+
count: passes.length,
|
|
366
|
+
avgTtfb,
|
|
367
|
+
minTtfb,
|
|
368
|
+
maxTtfb,
|
|
369
|
+
firstTtfb,
|
|
370
|
+
lastTtfb,
|
|
371
|
+
hitCount,
|
|
372
|
+
staleCount,
|
|
373
|
+
missCount,
|
|
374
|
+
prerenderCount,
|
|
375
|
+
lastVercelCache: passes.at(-1)?.vercel_cache ?? '-',
|
|
376
|
+
lastPrerender: passes.at(-1)?.prerender ?? '-',
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export function parseCliArgs(argv) {
|
|
381
|
+
/** @type {CliOptions} */
|
|
382
|
+
const options = {
|
|
383
|
+
siteKey: undefined,
|
|
384
|
+
passes: DEFAULT_PASSES,
|
|
385
|
+
outputPath: path.join(process.cwd(), 'develop-sites-timing.json'),
|
|
386
|
+
delayMs: 0,
|
|
387
|
+
developOnly: false,
|
|
388
|
+
productionOnly: false,
|
|
389
|
+
sourceRoot: process.env.SE_SOURCE_ROOT ?? path.join(homedir(), 'source'),
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const args = argv.slice(2).filter((arg) => arg !== '--');
|
|
393
|
+
for (let i = 0; i < args.length; i++) {
|
|
394
|
+
const arg = args[i];
|
|
395
|
+
if (arg === '--site') {
|
|
396
|
+
options.siteKey = args[++i];
|
|
397
|
+
} else if (arg === '--passes') {
|
|
398
|
+
options.passes = Number.parseInt(args[++i] ?? '', 10);
|
|
399
|
+
} else if (arg === '--output') {
|
|
400
|
+
options.outputPath = args[++i] ?? options.outputPath;
|
|
401
|
+
} else if (arg === '--delay-ms') {
|
|
402
|
+
options.delayMs = Number.parseInt(args[++i] ?? '', 10);
|
|
403
|
+
} else if (arg === '--develop-only') {
|
|
404
|
+
options.developOnly = true;
|
|
405
|
+
} else if (arg === '--production-only') {
|
|
406
|
+
options.productionOnly = true;
|
|
407
|
+
} else if (arg === '--source-root') {
|
|
408
|
+
options.sourceRoot = args[++i] ?? options.sourceRoot;
|
|
409
|
+
} else if (arg === '--help' || arg === '-h') {
|
|
410
|
+
printHelp();
|
|
411
|
+
process.exit(0);
|
|
412
|
+
} else {
|
|
413
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (options.developOnly && options.productionOnly) {
|
|
418
|
+
throw new Error('Use only one of --develop-only or --production-only');
|
|
419
|
+
}
|
|
420
|
+
if (!Number.isFinite(options.passes) || options.passes < 1) {
|
|
421
|
+
throw new Error('--passes must be a positive integer');
|
|
422
|
+
}
|
|
423
|
+
if (!Number.isFinite(options.delayMs) || options.delayMs < 0) {
|
|
424
|
+
throw new Error('--delay-ms must be a non-negative integer');
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return options;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function printHelp() {
|
|
431
|
+
console.log(`Usage: develop-sites-timing [options]
|
|
432
|
+
|
|
433
|
+
Options:
|
|
434
|
+
--site <key> se2026 | om1 | brightline | brightlifekids | pedestal | headwater | pointme
|
|
435
|
+
--passes <n> Full passes over all paths (default ${DEFAULT_PASSES})
|
|
436
|
+
--output <path> JSON report path (default: ./develop-sites-timing.json)
|
|
437
|
+
--delay-ms <n> Pause between requests (default 0)
|
|
438
|
+
--develop-only Probe develop deployments only
|
|
439
|
+
--production-only Probe production only
|
|
440
|
+
--source-root <path> Client repos root (default: ~/source or SE_SOURCE_ROOT)
|
|
441
|
+
-h, --help Show this help
|
|
442
|
+
`);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @param {CliOptions} options
|
|
447
|
+
*/
|
|
448
|
+
export async function runDevelopSitesTiming(options) {
|
|
449
|
+
const sites = resolveSites(options);
|
|
450
|
+
const startedAt = new Date().toISOString();
|
|
451
|
+
|
|
452
|
+
for (const site of sites) {
|
|
453
|
+
if (!options.productionOnly && !site.bypass) {
|
|
454
|
+
throw new Error(
|
|
455
|
+
`${site.label}: set VERCEL_PROTECTION_BYPASS_TOKEN in ${path.join(site.repoPath, '.env.local')}`,
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** @type {Map<string, Record<string, unknown>>} */
|
|
461
|
+
const resultByKey = new Map();
|
|
462
|
+
|
|
463
|
+
for (const site of sites) {
|
|
464
|
+
for (const testCase of site.cases) {
|
|
465
|
+
const resultKey = `${site.key}::${testCase.path}`;
|
|
466
|
+
resultByKey.set(resultKey, {
|
|
467
|
+
site: site.label,
|
|
468
|
+
key: site.key,
|
|
469
|
+
category: testCase.category,
|
|
470
|
+
label: testCase.label,
|
|
471
|
+
path: testCase.path,
|
|
472
|
+
develop: options.productionOnly
|
|
473
|
+
? undefined
|
|
474
|
+
: {
|
|
475
|
+
url: joinBaseUrl(site.develop, testCase.path),
|
|
476
|
+
passes: [],
|
|
477
|
+
},
|
|
478
|
+
production: options.developOnly
|
|
479
|
+
? undefined
|
|
480
|
+
: {
|
|
481
|
+
url: joinBaseUrl(site.production, testCase.path),
|
|
482
|
+
passes: [],
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
for (let pass = 1; pass <= options.passes; pass++) {
|
|
489
|
+
console.log(`Pass ${pass}/${options.passes}...`);
|
|
490
|
+
for (const site of sites) {
|
|
491
|
+
for (const testCase of site.cases) {
|
|
492
|
+
const resultKey = `${site.key}::${testCase.path}`;
|
|
493
|
+
const row = resultByKey.get(resultKey);
|
|
494
|
+
const developUrl = joinBaseUrl(site.develop, testCase.path);
|
|
495
|
+
const productionUrl = joinBaseUrl(site.production, testCase.path);
|
|
496
|
+
|
|
497
|
+
if (!options.productionOnly) {
|
|
498
|
+
row.develop.passes.push({
|
|
499
|
+
pass,
|
|
500
|
+
...probeUrl(developUrl, site.bypass),
|
|
501
|
+
});
|
|
502
|
+
if (options.delayMs > 0) await sleep(options.delayMs);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (!options.developOnly) {
|
|
506
|
+
row.production.passes.push({
|
|
507
|
+
pass,
|
|
508
|
+
...probeUrl(productionUrl, undefined),
|
|
509
|
+
});
|
|
510
|
+
if (options.delayMs > 0) await sleep(options.delayMs);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** @type {Array<Record<string, unknown>>} */
|
|
517
|
+
const results = [...resultByKey.values()].map((row) => {
|
|
518
|
+
if (row.develop) {
|
|
519
|
+
row.develop.summary = summarizePasses(row.develop.passes);
|
|
520
|
+
}
|
|
521
|
+
if (row.production) {
|
|
522
|
+
row.production.summary = summarizePasses(row.production.passes);
|
|
523
|
+
}
|
|
524
|
+
return row;
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
const report = {
|
|
528
|
+
meta: {
|
|
529
|
+
generatedAt: startedAt,
|
|
530
|
+
passes: options.passes,
|
|
531
|
+
delayMs: options.delayMs,
|
|
532
|
+
developOnly: options.developOnly,
|
|
533
|
+
productionOnly: options.productionOnly,
|
|
534
|
+
sites: sites.map((site) => ({
|
|
535
|
+
key: site.key,
|
|
536
|
+
label: site.label,
|
|
537
|
+
develop: site.develop,
|
|
538
|
+
production: site.production,
|
|
539
|
+
caseCount: site.cases.length,
|
|
540
|
+
})),
|
|
541
|
+
},
|
|
542
|
+
results,
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
fs.writeFileSync(options.outputPath, `${JSON.stringify(report, null, 2)}\n`);
|
|
546
|
+
printSummary(report, options);
|
|
547
|
+
return report;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function printSummary(report, options) {
|
|
551
|
+
console.log('DEVELOP SITES TIMING — smoke paths');
|
|
552
|
+
console.log('='.repeat(120));
|
|
553
|
+
console.log(`Passes: ${options.passes} | Output: ${options.outputPath}`);
|
|
554
|
+
console.log('');
|
|
555
|
+
|
|
556
|
+
for (const site of report.meta.sites) {
|
|
557
|
+
const rows = report.results.filter((row) => row.key === site.key);
|
|
558
|
+
console.log(`## ${site.label}`);
|
|
559
|
+
console.log(`Develop: ${site.develop}`);
|
|
560
|
+
console.log(`Prod: ${site.production}`);
|
|
561
|
+
console.log(
|
|
562
|
+
`${'Category'.padEnd(22)} ${'Path'.padEnd(42)} ${'D_avg'.padStart(7)} ${'D_last'.padStart(7)} ${'D_VC'.padStart(6)} ${'P_avg'.padStart(7)} ${'P_last'.padStart(7)} ${'P_VC'.padStart(6)}`,
|
|
563
|
+
);
|
|
564
|
+
console.log('-'.repeat(110));
|
|
565
|
+
|
|
566
|
+
for (const row of rows) {
|
|
567
|
+
const d = row.develop?.summary;
|
|
568
|
+
const p = row.production?.summary;
|
|
569
|
+
const dAvg = d?.avgTtfb != null ? `${d.avgTtfb.toFixed(2)}s` : ' n/a';
|
|
570
|
+
const dLast = d?.lastTtfb != null ? `${d.lastTtfb.toFixed(2)}s` : ' n/a';
|
|
571
|
+
const pAvg = p?.avgTtfb != null ? `${p.avgTtfb.toFixed(2)}s` : ' n/a';
|
|
572
|
+
const pLast = p?.lastTtfb != null ? `${p.lastTtfb.toFixed(2)}s` : ' n/a';
|
|
573
|
+
console.log(
|
|
574
|
+
`${row.category.padEnd(22)} ${row.path.padEnd(42)} ${dAvg.padStart(7)} ${dLast.padStart(7)} ${(d?.lastVercelCache ?? '-').padStart(6)} ${pAvg.padStart(7)} ${pLast.padStart(7)} ${(p?.lastVercelCache ?? '-').padStart(6)}`,
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
console.log('');
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (options.passes > 1) {
|
|
581
|
+
console.log('## Pass warmup (develop: first → last TTFB)');
|
|
582
|
+
for (const row of report.results) {
|
|
583
|
+
const d = row.develop?.summary;
|
|
584
|
+
if (!d || d.firstTtfb == null || d.lastTtfb == null) continue;
|
|
585
|
+
const delta = d.lastTtfb - d.firstTtfb;
|
|
586
|
+
if (Math.abs(delta) < 0.05) continue;
|
|
587
|
+
const sign = delta < 0 ? '' : '+';
|
|
588
|
+
console.log(
|
|
589
|
+
` ${row.site} ${row.path}: ${d.firstTtfb.toFixed(2)}s → ${d.lastTtfb.toFixed(2)}s (${sign}${delta.toFixed(2)}s)`,
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
console.log('');
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
async function main() {
|
|
597
|
+
try {
|
|
598
|
+
const options = parseCliArgs(process.argv);
|
|
599
|
+
await runDevelopSitesTiming(options);
|
|
600
|
+
} catch (error) {
|
|
601
|
+
console.error(error instanceof Error ? error.message : error);
|
|
602
|
+
process.exit(1);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
607
|
+
if (isMain) {
|
|
608
|
+
main();
|
|
609
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check that each page URL returns 2xx (e.g. HEAD). Used in compare mode to verify
|
|
3
|
+
* development has the same pages as production sitemap.
|
|
4
|
+
*/
|
|
5
|
+
interface PageExistError {
|
|
6
|
+
url: string;
|
|
7
|
+
status: number;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
interface CheckPagesExistResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
errors: PageExistError[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* For each page URL, send HEAD request. Require 2xx. Return errors for non-2xx.
|
|
16
|
+
*/
|
|
17
|
+
export declare function checkPagesExist(pageUrls: string[], fetchInit: RequestInit): Promise<CheckPagesExistResult>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=check-pages-exist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-pages-exist.d.ts","sourceRoot":"","sources":["../src/check-pages-exist.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,qBAAqB;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,qBAAqB,CAAC,CAiBhC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check that each page URL returns 2xx (e.g. HEAD). Used in compare mode to verify
|
|
3
|
+
* development has the same pages as production sitemap.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* For each page URL, send HEAD request. Require 2xx. Return errors for non-2xx.
|
|
7
|
+
*/
|
|
8
|
+
export async function checkPagesExist(pageUrls, fetchInit) {
|
|
9
|
+
const errors = [];
|
|
10
|
+
for (const url of pageUrls) {
|
|
11
|
+
const res = await fetch(url, { ...fetchInit, method: 'HEAD' });
|
|
12
|
+
if (res.ok)
|
|
13
|
+
continue;
|
|
14
|
+
errors.push({
|
|
15
|
+
url,
|
|
16
|
+
status: res.status,
|
|
17
|
+
message: `HTTP ${res.status}`,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
ok: errors.length === 0,
|
|
22
|
+
errors,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=check-pages-exist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-pages-exist.js","sourceRoot":"","sources":["../src/check-pages-exist.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAkB,EAClB,SAAsB;IAEtB,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/D,IAAI,GAAG,CAAC,EAAE;YAAE,SAAS;QACrB,MAAM,CAAC,IAAI,CAAC;YACV,GAAG;YACH,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,OAAO,EAAE,QAAQ,GAAG,CAAC,MAAM,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QACvB,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verify that sitemap page URLs do not rewrite to different paths (except localisation).
|
|
3
|
+
* Fetches each page URL and checks the x-nextjs-rewritten-path response header.
|
|
4
|
+
*/
|
|
5
|
+
interface RewriteCheckError {
|
|
6
|
+
url: string;
|
|
7
|
+
requestedPath: string;
|
|
8
|
+
rewrittenPath: string;
|
|
9
|
+
}
|
|
10
|
+
interface RewriteCheckResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
errors: RewriteCheckError[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* For each page URL, fetch with HEAD and check x-nextjs-rewritten-path.
|
|
16
|
+
* If the header is present and the rewritten path is not equivalent to the requested path
|
|
17
|
+
* (after normalisation and optional locale stripping), record an error.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkRewrites(pageUrls: string[], fetchInit: RequestInit): Promise<RewriteCheckResult>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=check-rewrites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-rewrites.d.ts","sourceRoot":"","sources":["../src/check-rewrites.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuCH,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
|