saturndocs 0.2.0 → 0.3.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.
Files changed (63) hide show
  1. package/dist/auth-OIEL34E4.js +16 -0
  2. package/dist/{chunk-GGGL4O7Z.js → chunk-32ATWMIS.js} +3 -3
  3. package/dist/{chunk-QF2ADHQZ.js → chunk-3EW6ZPL6.js} +5 -5
  4. package/dist/{chunk-ADZOBRZE.js → chunk-3KCCCMQY.js} +325 -35
  5. package/dist/{chunk-2RZEC3VH.js → chunk-3X2NBWZN.js} +123 -35
  6. package/dist/{chunk-EB7RWFQA.js → chunk-5ZYUBLEH.js} +1463 -130
  7. package/dist/{chunk-WBI4EI3D.js → chunk-6EKGBIUR.js} +2 -2
  8. package/dist/{chunk-W3GKH5DY.js → chunk-BOWRQKXR.js} +12 -6
  9. package/dist/{chunk-FGKHDJOC.js → chunk-E3G56DR2.js} +287 -35
  10. package/dist/chunk-FUZE54DG.js +905 -0
  11. package/dist/chunk-HBSJ4Z4S.js +53 -0
  12. package/dist/{chunk-DBMFJXKP.js → chunk-IJOYWJVM.js} +5 -5
  13. package/dist/chunk-IWIVHHZI.js +426 -0
  14. package/dist/{chunk-Z5CBPJ2L.js → chunk-PU37LVIF.js} +3 -3
  15. package/dist/{chunk-4ORVQCHY.js → chunk-RKM7YWPD.js} +25 -6
  16. package/dist/{chunk-2YTD2XNI.js → chunk-T3MCJYSF.js} +1 -1
  17. package/dist/{chunk-YSFP37B7.js → chunk-TEYHAN2L.js} +20 -6
  18. package/dist/{chunk-WUPP3THV.js → chunk-VDGVERLX.js} +5 -5
  19. package/dist/{chunk-SVDVBZPA.js → chunk-W3FZTCKV.js} +6 -4
  20. package/dist/chunk-WMS6FUKK.js +414 -0
  21. package/dist/chunk-WXLJZ7RD.js +115 -0
  22. package/dist/{chunk-56U46JVN.js → chunk-YGVC4N4V.js} +2 -1
  23. package/dist/{chunk-6JGAA5TF.js → chunk-YPWPLIEZ.js} +4 -4
  24. package/dist/cli.js +6 -6
  25. package/dist/{coverage-EBWULNQQ.js → coverage-SRIA65FT.js} +5 -5
  26. package/dist/{dist-XISZDQTR.js → dist-LJSALT4X.js} +33 -3
  27. package/dist/index.d.ts +69 -37
  28. package/dist/index.js +112 -47
  29. package/dist/{init-PI4VTG7V.js → init-Y3GDNDWW.js} +5 -3
  30. package/dist/{lint-SXBP37G3.js → lint-XM26WIGE.js} +3 -3
  31. package/dist/login-HIXLPRUI.js +22 -0
  32. package/dist/{manage-OB6DQK3Q.js → manage-3HEBB3EQ.js} +6 -2
  33. package/dist/{nav-R4OORY2G.js → nav-K43WZJ4J.js} +4 -4
  34. package/dist/openapiCheck-CL2AH3YC.js +105 -0
  35. package/dist/pages-4VWB7Z4S.js +16 -0
  36. package/dist/{read-VECMKHBW.js → read-DYGYUOFK.js} +5 -4
  37. package/dist/{read-WWOMA67R.js → read-RKT6HUZ7.js} +41 -7
  38. package/dist/requests-CZYE6GI3.js +13 -0
  39. package/dist/{schema-NKOXZHQH.js → schema-QMJMGD5P.js} +3 -3
  40. package/dist/{sites-XMMGWPY2.js → sites-JKS25SEM.js} +5 -4
  41. package/dist/{status-SYIUUSSU.js → status-FM2ALQUJ.js} +4 -4
  42. package/dist/{suggestions-GX5CQK26.js → suggestions-Z6XIHMFN.js} +13 -7
  43. package/dist/unavailable-DVPNUO3J.js +40 -0
  44. package/dist/validate-X42T4TJ6.js +12 -0
  45. package/package.json +15 -9
  46. package/dist/auth-DUYYFNEZ.js +0 -14
  47. package/dist/brokenLinks-E364XYH3.js +0 -48
  48. package/dist/build-F5PWGP57.js +0 -39
  49. package/dist/chunk-4J33CCAC.js +0 -49
  50. package/dist/chunk-D3CLXV7D.js +0 -131
  51. package/dist/chunk-GLI3OUYL.js +0 -637
  52. package/dist/chunk-K5YY6NSF.js +0 -71
  53. package/dist/chunk-KOJJUISB.js +0 -39
  54. package/dist/chunk-O72DR5FK.js +0 -152
  55. package/dist/chunk-VNYDYHXM.js +0 -22
  56. package/dist/chunk-VXEUNRVA.js +0 -26
  57. package/dist/chunk-WHNL6UYJ.js +0 -57
  58. package/dist/deploy-QUVLOGII.js +0 -13
  59. package/dist/dev-VDSDCBO2.js +0 -43
  60. package/dist/openapiCheck-X2QQGETY.js +0 -66
  61. package/dist/pages-MKFZAVGI.js +0 -15
  62. package/dist/requests-A7WC3B4M.js +0 -13
  63. package/dist/validate-D4I3DY2W.js +0 -32
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  parseOpenApi
3
- } from "./chunk-SVDVBZPA.js";
3
+ } from "./chunk-W3FZTCKV.js";
4
4
  import {
5
5
  BuildRuleError,
6
6
  assertGroupCapacity,
7
7
  knownGroups,
8
8
  navigationGroups,
9
+ navigationIconRefs,
10
+ navigationOpenApiSpecGroups,
9
11
  normalizedRedirectPath,
10
12
  openApiPublicationCollision,
11
13
  parseDocsConfig,
@@ -14,7 +16,7 @@ import {
14
16
  resolveRootRedirectDestination,
15
17
  themeCssProblems,
16
18
  ungatedOpenApiSpecPaths
17
- } from "./chunk-FGKHDJOC.js";
19
+ } from "./chunk-E3G56DR2.js";
18
20
 
19
21
  // ../ui-tokens/dist/index.js
20
22
  import {
@@ -1103,11 +1105,854 @@ function nearestAccessible(fg, bg, ratio) {
1103
1105
  }
1104
1106
 
1105
1107
  // ../source-abi/dist/index.js
1106
- import { parse as parse2, parseDocument } from "yaml";
1108
+ import { isMap, isScalar, LineCounter, parse as parse2, parseDocument, YAMLParseError } from "yaml";
1109
+
1110
+ // ../mdx-preprocess/dist/index.js
1111
+ import { unified as unified2 } from "unified";
1112
+ import remarkParse2 from "remark-parse";
1113
+ import remarkMdx2 from "remark-mdx";
1114
+ import remarkFrontmatter from "remark-frontmatter";
1115
+ import remarkGfm2 from "remark-gfm";
1116
+ import GithubSlugger from "github-slugger";
1117
+ import { parse as parseYaml } from "yaml";
1107
1118
  import { unified } from "unified";
1108
- import remarkGfm from "remark-gfm";
1109
- import remarkMdx from "remark-mdx";
1110
1119
  import remarkParse from "remark-parse";
1120
+ import remarkMdx from "remark-mdx";
1121
+ import remarkGfm from "remark-gfm";
1122
+ var COMPONENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9]{0,63}$/;
1123
+ var COMPONENT_PROPS_MAX_BYTES = 524288;
1124
+ var COMPONENT_PROPS_MAX_DEPTH = 32;
1125
+ var PAGE_FRONTMATTER_MAX_BYTES = 65536;
1126
+ var COMPONENT_CALLS_MAX_PER_PAGE = 1e3;
1127
+ var COMPONENT_PROPS_MAX_BYTES_PER_PAGE = 8388608;
1128
+ var PROP_NAME_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1129
+ var RESERVED_PROP_NAMES = /* @__PURE__ */ new Set([
1130
+ "key",
1131
+ "ref",
1132
+ "children",
1133
+ "dangerouslySetInnerHTML",
1134
+ "suppressHydrationWarning",
1135
+ "suppressContentEditableWarning",
1136
+ "__proto__",
1137
+ "__self",
1138
+ "__source"
1139
+ ]);
1140
+ var bodyParser = unified().use(remarkParse).use(remarkMdx).use(remarkGfm);
1141
+ var encoder = new TextEncoder();
1142
+ var ComponentCallError = class extends Error {
1143
+ line;
1144
+ column;
1145
+ constructor(message, line, column) {
1146
+ super(message);
1147
+ this.name = "ComponentCallError";
1148
+ this.line = line;
1149
+ this.column = column;
1150
+ }
1151
+ };
1152
+ function componentNameFromPath(path) {
1153
+ const match = /^components\/([^/]+)\.(?:jsx|tsx)$/.exec(path);
1154
+ const name = match?.[1];
1155
+ return name !== void 0 && COMPONENT_NAME_PATTERN.test(name) ? name : null;
1156
+ }
1157
+ function isComponentElement(node, registry) {
1158
+ return (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && typeof node.name === "string" && registry.has(node.name);
1159
+ }
1160
+ function decodeComponentProps(node) {
1161
+ const props = {};
1162
+ for (const raw of node.attributes ?? []) {
1163
+ const attribute = raw;
1164
+ if (attribute.type !== "mdxJsxAttribute" || attribute.name === void 0) {
1165
+ return { ok: false, reason: "spread attributes are not admissible on customer components", fix: "write each prop by name" };
1166
+ }
1167
+ const name = attribute.name;
1168
+ if (!PROP_NAME_PATTERN.test(name) || /^on/i.test(name) || RESERVED_PROP_NAMES.has(name)) {
1169
+ return { ok: false, reason: `prop ${name} is not admissible on customer components`, fix: "use a JavaScript identifier that is not an event handler or a React reserved name" };
1170
+ }
1171
+ if (Object.prototype.hasOwnProperty.call(props, name)) {
1172
+ return { ok: false, reason: `duplicate prop ${name}`, fix: `keep one ${name} prop` };
1173
+ }
1174
+ const value = attribute.value;
1175
+ if (value === null || value === void 0) {
1176
+ props[name] = true;
1177
+ } else if (typeof value === "string") {
1178
+ props[name] = value;
1179
+ } else {
1180
+ const program = value.data?.estree;
1181
+ const expression = program?.body?.length === 1 ? program.body[0]?.expression : void 0;
1182
+ if (expression === void 0) {
1183
+ return { ok: false, reason: `prop ${name} must be a string or a JSON value`, fix: `write ${name}="text" or ${name}={[...]}` };
1184
+ }
1185
+ const decoded = jsonLiteral(expression, 0);
1186
+ if (!decoded.ok) {
1187
+ return { ok: false, reason: `prop ${name} is not a JSON value: ${decoded.reason}`, fix: "use only objects, arrays, strings, numbers, true, false and null; move data that needs code into a JSON file the component imports" };
1188
+ }
1189
+ props[name] = decoded.value;
1190
+ }
1191
+ }
1192
+ const children = node.children ?? [];
1193
+ if (children.length > 0) {
1194
+ const block = node.type === "mdxJsxFlowElement";
1195
+ const first = children[0];
1196
+ const paragraph = block && children.length === 1 && first.type === "paragraph";
1197
+ const content = paragraph ? first.children ?? [] : children;
1198
+ if (!content.every((child) => child.type === "text" && typeof child.value === "string")) {
1199
+ return { ok: false, reason: "customer component children must be plain text for now", fix: "use a single paragraph of plain text" };
1200
+ }
1201
+ const text = content.map((child) => child.value).join("");
1202
+ props.children = block && !paragraph ? text.replace(/^[ \t\r\n]+|[ \t\r\n]+$/g, "") : text;
1203
+ }
1204
+ if (encoder.encode(canonicalJson(props)).byteLength > COMPONENT_PROPS_MAX_BYTES) {
1205
+ return { ok: false, reason: `props are larger than ${COMPONENT_PROPS_MAX_BYTES} bytes`, fix: "move large data into a JSON file the component imports" };
1206
+ }
1207
+ return { ok: true, props };
1208
+ }
1209
+ function jsonLiteral(node, depth) {
1210
+ if (depth > COMPONENT_PROPS_MAX_DEPTH) return { ok: false, reason: `nesting is deeper than ${COMPONENT_PROPS_MAX_DEPTH}` };
1211
+ switch (node.type) {
1212
+ case "Literal": {
1213
+ if (node.regex !== void 0 || node.bigint !== void 0) return { ok: false, reason: "regular expressions and BigInt are not JSON" };
1214
+ const value = node.value;
1215
+ if (value === null || typeof value === "string" || typeof value === "boolean") return { ok: true, value };
1216
+ if (typeof value === "number" && Number.isFinite(value)) {
1217
+ if (Number.isInteger(value) && !Number.isSafeInteger(value)) return { ok: false, reason: "integers beyond 2^53 lose precision; quote them as strings" };
1218
+ return { ok: true, value: Object.is(value, -0) ? 0 : value };
1219
+ }
1220
+ return { ok: false, reason: "unsupported literal" };
1221
+ }
1222
+ case "TemplateLiteral": {
1223
+ if ((node.expressions?.length ?? 0) > 0 || node.quasis?.length !== 1) return { ok: false, reason: "template literals cannot contain ${} expressions" };
1224
+ const cooked = node.quasis[0]?.value.cooked;
1225
+ return typeof cooked === "string" ? { ok: true, value: cooked } : { ok: false, reason: "invalid template literal" };
1226
+ }
1227
+ case "UnaryExpression": {
1228
+ if (node.operator === "-" && node.argument?.type === "Literal" && typeof node.argument.value === "number" && Number.isFinite(node.argument.value)) {
1229
+ if (Number.isInteger(node.argument.value) && !Number.isSafeInteger(node.argument.value)) return { ok: false, reason: "integers beyond 2^53 lose precision; quote them as strings" };
1230
+ const negated = -node.argument.value;
1231
+ return { ok: true, value: Object.is(negated, -0) ? 0 : negated };
1232
+ }
1233
+ return { ok: false, reason: `operator ${node.operator ?? "?"} is not allowed` };
1234
+ }
1235
+ case "ArrayExpression": {
1236
+ const values = [];
1237
+ for (const element of node.elements ?? []) {
1238
+ if (element === null) return { ok: false, reason: "arrays cannot have holes" };
1239
+ if (element.type === "SpreadElement") return { ok: false, reason: "spread is not allowed" };
1240
+ const decoded = jsonLiteral(element, depth + 1);
1241
+ if (!decoded.ok) return decoded;
1242
+ values.push(decoded.value);
1243
+ }
1244
+ return { ok: true, value: values };
1245
+ }
1246
+ case "ObjectExpression": {
1247
+ const value = {};
1248
+ for (const property of node.properties ?? []) {
1249
+ if (property.type !== "Property" || property.kind !== "init" || property.computed || property.method || property.shorthand) {
1250
+ return { ok: false, reason: "objects allow only plain key: value properties" };
1251
+ }
1252
+ const key = property.key?.type === "Identifier" ? property.key.name : property.key?.type === "Literal" && typeof property.key.value === "string" ? property.key.value : void 0;
1253
+ if (key === void 0) return { ok: false, reason: "object keys must be names or strings" };
1254
+ if (Object.prototype.hasOwnProperty.call(value, key)) return { ok: false, reason: `duplicate key ${key}` };
1255
+ if (key === "__proto__") return { ok: false, reason: "the key __proto__ is not allowed" };
1256
+ const decoded = jsonLiteral(property.value, depth + 1);
1257
+ if (!decoded.ok) return decoded;
1258
+ value[key] = decoded.value;
1259
+ }
1260
+ return { ok: true, value };
1261
+ }
1262
+ default:
1263
+ return { ok: false, reason: `${node.type} is not a JSON value` };
1264
+ }
1265
+ }
1266
+ function canonicalJson(value) {
1267
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
1268
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
1269
+ const keys = Object.keys(value).sort();
1270
+ return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
1271
+ }
1272
+ var PAGE_SOURCE_KEY = /^pages\/(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*[A-Za-z0-9][A-Za-z0-9._-]*\.mdx$/;
1273
+ var MARKDOWN_PAGE_KEY = /\.md$/i;
1274
+ var boundedDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
1275
+ function splitPageFrontmatter(bytes, maxBytes = PAGE_FRONTMATTER_MAX_BYTES) {
1276
+ let openingLength = 0;
1277
+ if (bytes[0] === 45 && bytes[1] === 45 && bytes[2] === 45) {
1278
+ let index = 3;
1279
+ while (bytes[index] === 32 || bytes[index] === 9) index += 1;
1280
+ if (bytes[index] === 10) openingLength = index + 1;
1281
+ else if (bytes[index] === 13 && bytes[index + 1] === 10) openingLength = index + 2;
1282
+ else if (index < bytes.byteLength) throw new Error("frontmatter opening marker is malformed");
1283
+ }
1284
+ if (openingLength === 0) return null;
1285
+ const searchEnd = Math.min(bytes.byteLength, openingLength + maxBytes);
1286
+ const windowIsWholeFile = searchEnd === bytes.byteLength;
1287
+ const bounded = boundedDecoder.decode(bytes.subarray(openingLength, searchEnd));
1288
+ const pattern = /(?:^|\r?\n)---[\t ]*(?:\r?\n|$)/g;
1289
+ let closing = null;
1290
+ for (let match = pattern.exec(bounded); match !== null; match = pattern.exec(bounded)) {
1291
+ if (match[0].endsWith("\n") || windowIsWholeFile) {
1292
+ closing = match;
1293
+ break;
1294
+ }
1295
+ if (match[0].length === 0) pattern.lastIndex += 1;
1296
+ }
1297
+ if (closing === null) throw new Error(`frontmatter closing marker was not found within ${maxBytes} bytes`);
1298
+ const block = bounded.slice(0, closing.index);
1299
+ if (encoder.encode(block).byteLength > maxBytes) throw new Error(`frontmatter exceeds ${maxBytes} bytes`);
1300
+ return { block, bodyOffset: openingLength + encoder.encode(bounded.slice(0, closing.index + closing[0].length)).byteLength };
1301
+ }
1302
+ function pageBodyStart(fileText) {
1303
+ const bytes = encoder.encode(fileText);
1304
+ const split = splitPageFrontmatter(bytes);
1305
+ const start = split === null ? 0 : boundedDecoder.decode(bytes.subarray(0, split.bodyOffset)).length;
1306
+ if (fileText.charCodeAt(start) === 65279) throw new Error("remove the byte order mark at the start of the page body");
1307
+ return start;
1308
+ }
1309
+ function linesBefore(text, index) {
1310
+ let count = 0;
1311
+ for (let position = text.indexOf("\n"); position !== -1 && position < index; position = text.indexOf("\n", position + 1)) count += 1;
1312
+ return count;
1313
+ }
1314
+ function normalizeComponentMarkdown(markdown) {
1315
+ const lines = markdown.replace(/\r\n?/g, "\n").split("\n");
1316
+ let fence = null;
1317
+ const out = lines.map((line) => {
1318
+ const opener = /^\s{0,3}(`{3,}|~{3,})/.exec(line);
1319
+ if (opener !== null) {
1320
+ const marker = opener[1];
1321
+ if (fence === null) fence = marker[0].repeat(marker.length);
1322
+ else if (marker[0] === fence[0] && marker.length >= fence.length) fence = null;
1323
+ return line;
1324
+ }
1325
+ if (fence !== null) return line;
1326
+ const heading = /^\s{0,3}#{1,6}(?:\s+(.*?))?\s*#*\s*$/.exec(line);
1327
+ if (heading !== null) return heading[1] ? `**${heading[1]}**` : "";
1328
+ if (/^\s{0,3}(?:=+|-{2,})\s*$/.test(line)) return "";
1329
+ return line;
1330
+ });
1331
+ return out.join("\n").replace(/^\n+/, "").replace(/\s+$/, "");
1332
+ }
1333
+ function collectComponentCalls(pagePath, fileText, registry) {
1334
+ if (registry.size === 0) return [];
1335
+ if (!PAGE_SOURCE_KEY.test(pagePath)) {
1336
+ if (/^pages\//.test(pagePath) && MARKDOWN_PAGE_KEY.test(pagePath) && !pagePath.includes("..")) return [];
1337
+ throw new ComponentCallError(`component calls need a canonical docs-root source key such as pages/guide.mdx, not ${pagePath}`, null, null);
1338
+ }
1339
+ let bodyStart;
1340
+ try {
1341
+ bodyStart = pageBodyStart(fileText);
1342
+ } catch (error) {
1343
+ throw new ComponentCallError(`${pagePath}: ${error instanceof Error ? error.message : String(error)}`, null, null);
1344
+ }
1345
+ let propsBytes = 0;
1346
+ const lineOffset = linesBefore(fileText, bodyStart);
1347
+ const tree = bodyParser.parse(fileText.slice(bodyStart));
1348
+ const calls = [];
1349
+ const visit = (node) => {
1350
+ if (isComponentElement(node, registry)) {
1351
+ const position = node.position;
1352
+ const start = position?.start.offset;
1353
+ const end = position?.end.offset;
1354
+ const line = position === void 0 ? null : position.start.line + lineOffset;
1355
+ const column = position === void 0 ? null : position.start.column;
1356
+ const where = `${pagePath}:${line ?? "?"}:${column ?? "?"}`;
1357
+ if (start === void 0 || end === void 0 || line === null || column === null) {
1358
+ throw new ComponentCallError(`${where}: component ${node.name} has no source position`, line, column);
1359
+ }
1360
+ const decoded = decodeComponentProps(node);
1361
+ if (!decoded.ok) throw new ComponentCallError(`${where}: ${decoded.reason}`, line, column);
1362
+ if (calls.length >= COMPONENT_CALLS_MAX_PER_PAGE) throw new ComponentCallError(`${where}: a page can hold at most ${COMPONENT_CALLS_MAX_PER_PAGE} component calls`, line, column);
1363
+ propsBytes += encoder.encode(canonicalJson(decoded.props)).byteLength;
1364
+ if (propsBytes > COMPONENT_PROPS_MAX_BYTES_PER_PAGE) throw new ComponentCallError(`${where}: component props on this page total more than ${COMPONENT_PROPS_MAX_BYTES_PER_PAGE} bytes`, line, column);
1365
+ calls.push({
1366
+ id: `${pagePath}#${calls.length}`,
1367
+ component: node.name,
1368
+ props: decoded.props,
1369
+ inline: node.type === "mdxJsxTextElement",
1370
+ start: bodyStart + start,
1371
+ end: bodyStart + end,
1372
+ line,
1373
+ column
1374
+ });
1375
+ return;
1376
+ }
1377
+ for (const child of node.children ?? []) visit(child);
1378
+ };
1379
+ visit(tree);
1380
+ return calls;
1381
+ }
1382
+ var PROSE_ATTRIBUTES = /* @__PURE__ */ new Set([
1383
+ "title",
1384
+ "caption",
1385
+ "description",
1386
+ "summary",
1387
+ "transcript"
1388
+ ]);
1389
+ var RESOURCE_DESCRIPTION_ATTRIBUTES = /* @__PURE__ */ new Set([
1390
+ "description",
1391
+ "summary",
1392
+ "transcript"
1393
+ ]);
1394
+ function pageParser(format) {
1395
+ const parser = unified2().use(remarkParse2);
1396
+ if (format === "mdx") parser.use(remarkMdx2);
1397
+ return parser.use(remarkFrontmatter, ["yaml"]).use(remarkGfm2);
1398
+ }
1399
+ var markdownParser = pageParser("md");
1400
+ var mdxParser = pageParser("mdx");
1401
+ function stripPage(source, path, options = {}) {
1402
+ const parser = path?.toLowerCase().endsWith(".md") ? markdownParser : mdxParser;
1403
+ const tree = parser.parse(source);
1404
+ if (options.components !== void 0 && path === void 0) {
1405
+ throw new Error("stripPage needs the page source key to place customer component Markdown");
1406
+ }
1407
+ const componentCalls = /* @__PURE__ */ new Map();
1408
+ const matchedCalls = /* @__PURE__ */ new Set();
1409
+ if (options.components !== void 0 && parser === mdxParser) {
1410
+ for (const call of collectComponentCalls(path, source, options.components.registry)) componentCalls.set(call.start, call);
1411
+ }
1412
+ const componentMarkdown = (node) => {
1413
+ if (componentCalls.size === 0) return void 0;
1414
+ const position = node.position;
1415
+ const start = position?.start?.offset;
1416
+ const call = start === void 0 ? void 0 : componentCalls.get(start);
1417
+ if (call === void 0) return void 0;
1418
+ if (call.component !== node.name || call.end !== position?.end?.offset || call.inline !== (node.type === "mdxJsxTextElement") || matchedCalls.has(call.id)) {
1419
+ throw new Error(`${call.id}: the component call does not match the page structure`);
1420
+ }
1421
+ const markdown = options.components?.markdown.get(call.id);
1422
+ if (markdown === void 0) throw new Error(`${call.id}: no agent Markdown for this component call`);
1423
+ matchedCalls.add(call.id);
1424
+ return normalizeComponentMarkdown(markdown);
1425
+ };
1426
+ const slugger = new GithubSlugger();
1427
+ const headings = [];
1428
+ let title;
1429
+ let description;
1430
+ let frontmatter = {};
1431
+ for (const node of tree.children ?? []) {
1432
+ if (node.type === "yaml" && typeof node.value === "string") {
1433
+ const parsed = parseFrontmatter(node.value);
1434
+ frontmatter = parsed.frontmatter;
1435
+ if (parsed.title !== void 0) title = parsed.title;
1436
+ if (parsed.description !== void 0) description = parsed.description;
1437
+ break;
1438
+ }
1439
+ }
1440
+ const renderPhrasing = (nodes) => {
1441
+ if (!nodes) return "";
1442
+ let out = "";
1443
+ for (const node of nodes) {
1444
+ out += phrasing(node);
1445
+ }
1446
+ return out;
1447
+ };
1448
+ function phrasing(node) {
1449
+ switch (node.type) {
1450
+ case "text":
1451
+ return escapeMarkdownText(node.value ?? "");
1452
+ case "inlineCode":
1453
+ return inlineCodeSpan(node.value ?? "");
1454
+ case "strong":
1455
+ return "**" + renderPhrasing(node.children) + "**";
1456
+ case "emphasis":
1457
+ return "*" + renderPhrasing(node.children) + "*";
1458
+ case "delete":
1459
+ return renderPhrasing(node.children);
1460
+ case "link":
1461
+ return renderMarkdownLink(
1462
+ renderPhrasing(node.children),
1463
+ node.url ?? "",
1464
+ true
1465
+ );
1466
+ case "image": {
1467
+ const label = node.alt?.trim() || "Image";
1468
+ return renderMarkdownResource("Image", label, node.url ?? "");
1469
+ }
1470
+ case "break":
1471
+ return "\n";
1472
+ case "mdxTextExpression": {
1473
+ const literal = stringLiteralValue(node.value ?? "");
1474
+ return literal === void 0 ? "" : escapeMarkdownText(literal);
1475
+ }
1476
+ case "mdxJsxTextElement": {
1477
+ const customer = componentMarkdown(node);
1478
+ if (customer !== void 0) return customer.replace(/\n+/g, " ");
1479
+ const inner = renderPhrasing(node.children);
1480
+ const componentText = componentMarkdownForNode(node);
1481
+ if (componentText) return inner ? `${componentText} ${inner}` : componentText;
1482
+ const resource = resourceMarkdownForNode(node, inner);
1483
+ if (resource) return resource;
1484
+ const attrText = proseAttributeValues(node.attributes).join(" ");
1485
+ return attrText ? inner ? attrText + " " + inner : attrText : inner;
1486
+ }
1487
+ case "html":
1488
+ return renderHtmlResource(node.value ?? "");
1489
+ default:
1490
+ return node.children ? renderPhrasing(node.children) : "";
1491
+ }
1492
+ }
1493
+ const renderFlow = (nodes) => {
1494
+ if (!nodes) return [];
1495
+ const blocks = [];
1496
+ for (const node of nodes) {
1497
+ pushFlow(node, blocks);
1498
+ }
1499
+ return blocks;
1500
+ };
1501
+ function pushFlow(node, blocks) {
1502
+ switch (node.type) {
1503
+ case "yaml":
1504
+ case "toml":
1505
+ case "mdxjsEsm":
1506
+ case "definition":
1507
+ case "footnoteDefinition":
1508
+ case "html": {
1509
+ const resource = renderHtmlResource(node.value ?? "");
1510
+ if (resource) blocks.push(resource);
1511
+ return;
1512
+ }
1513
+ case "thematicBreak":
1514
+ blocks.push("* * *");
1515
+ return;
1516
+ case "heading": {
1517
+ const depth = node.depth ?? 1;
1518
+ const text2 = renderPhrasing(node.children).trim();
1519
+ const slug = slugger.slug(text2);
1520
+ headings.push({ depth, text: text2, slug });
1521
+ blocks.push("#".repeat(depth) + " " + text2);
1522
+ return;
1523
+ }
1524
+ case "paragraph": {
1525
+ const text2 = renderPhrasing(node.children).trim();
1526
+ if (text2) blocks.push(text2);
1527
+ return;
1528
+ }
1529
+ case "blockquote": {
1530
+ const inner = renderFlow(node.children).join("\n\n");
1531
+ if (inner) {
1532
+ blocks.push(
1533
+ inner.split("\n").map((line) => line ? "> " + line : ">").join("\n")
1534
+ );
1535
+ }
1536
+ return;
1537
+ }
1538
+ case "list":
1539
+ blocks.push(renderList(node));
1540
+ return;
1541
+ case "code":
1542
+ blocks.push(renderCode(node));
1543
+ return;
1544
+ case "table":
1545
+ blocks.push(renderTable(node));
1546
+ return;
1547
+ case "mdxFlowExpression": {
1548
+ const literal = stringLiteralValue(node.value ?? "");
1549
+ if (literal) blocks.push(escapeMarkdownText(literal));
1550
+ return;
1551
+ }
1552
+ case "mdxJsxFlowElement": {
1553
+ const customer = componentMarkdown(node);
1554
+ if (customer !== void 0) {
1555
+ if (customer.trim()) blocks.push(customer);
1556
+ return;
1557
+ }
1558
+ const componentText = componentMarkdownForNode(node);
1559
+ if (componentText) blocks.push(componentText);
1560
+ const resource = resourceMarkdownForNode(node);
1561
+ if (resource) {
1562
+ blocks.push(resource);
1563
+ for (const value of namedAttributeValues(
1564
+ node.attributes,
1565
+ RESOURCE_DESCRIPTION_ATTRIBUTES
1566
+ )) {
1567
+ blocks.push(value);
1568
+ }
1569
+ } else if (!componentText) {
1570
+ for (const value of proseAttributeValues(node.attributes)) {
1571
+ blocks.push(value);
1572
+ }
1573
+ }
1574
+ for (const block of renderFlow(node.children)) {
1575
+ blocks.push(block);
1576
+ }
1577
+ return;
1578
+ }
1579
+ default: {
1580
+ if (node.children) {
1581
+ for (const block of renderFlow(node.children)) blocks.push(block);
1582
+ }
1583
+ return;
1584
+ }
1585
+ }
1586
+ }
1587
+ function renderList(node) {
1588
+ const ordered = node.ordered === true;
1589
+ let index = typeof node.start === "number" ? node.start : 1;
1590
+ const items = [];
1591
+ for (const item of node.children ?? []) {
1592
+ const marker = ordered ? `${index++}. ` : "- ";
1593
+ const pad = " ".repeat(marker.length);
1594
+ const body = renderFlow(item.children).join("\n\n");
1595
+ const lines = body.split("\n");
1596
+ const rendered = lines.map((line, i) => i === 0 ? marker + line : pad + line).join("\n");
1597
+ items.push(rendered);
1598
+ }
1599
+ return items.join("\n");
1600
+ }
1601
+ function renderCode(node) {
1602
+ const lang = typeof node.lang === "string" ? node.lang : "";
1603
+ const value = node.value ?? "";
1604
+ const fence = "`".repeat(Math.max(3, longestBacktickRun(value) + 1));
1605
+ const meta = typeof node["meta"] === "string" ? node["meta"] : "";
1606
+ const title2 = /(?:^|\s)title=("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/.exec(meta)?.[1];
1607
+ const caption = title2 ? stringLiteralValue(title2) : void 0;
1608
+ const code = fence + lang + "\n" + value + "\n" + fence;
1609
+ return caption ? `${caption}
1610
+
1611
+ ${code}` : code;
1612
+ }
1613
+ function renderTable(node) {
1614
+ const rows = node.children ?? [];
1615
+ if (rows.length === 0) return "";
1616
+ const rendered = rows.map(
1617
+ (row) => "| " + (row.children ?? []).map((cell) => escapeTablePipes(renderPhrasing(cell.children).trim())).join(" | ") + " |"
1618
+ );
1619
+ const columnCount = (rows[0]?.children ?? []).length;
1620
+ const separator = "| " + Array(columnCount).fill("---").join(" | ") + " |";
1621
+ rendered.splice(1, 0, separator);
1622
+ return rendered.join("\n");
1623
+ }
1624
+ const flow = renderFlow(tree.children);
1625
+ for (const call of componentCalls.values()) {
1626
+ if (!matchedCalls.has(call.id)) throw new Error(`${call.id}: the component call was not found while building agent text`);
1627
+ }
1628
+ const text = flow.filter((block) => block.trim() !== "").join("\n\n").trim();
1629
+ const result = { text, frontmatter, headings };
1630
+ if (title !== void 0) result.title = title;
1631
+ if (description !== void 0) result.description = description;
1632
+ return result;
1633
+ }
1634
+ function safeResourceUrl(raw) {
1635
+ const value = decodeHtmlAttribute(raw).trim();
1636
+ if (value === "" || /[\u0000-\u001f\u007f]/.test(value) || /\s/.test(value) || value.includes("\\")) {
1637
+ return void 0;
1638
+ }
1639
+ if (value.startsWith("//")) return void 0;
1640
+ if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("#") || value.startsWith("?")) {
1641
+ return value;
1642
+ }
1643
+ const scheme = /^([A-Za-z][A-Za-z0-9+.-]*):/.exec(value)?.[1]?.toLowerCase();
1644
+ if (scheme !== void 0) {
1645
+ return scheme === "https" || scheme === "http" || scheme === "mailto" ? value : void 0;
1646
+ }
1647
+ return value.includes(":") ? void 0 : value;
1648
+ }
1649
+ function renderMarkdownLink(label, rawUrl, serializedLabel = false) {
1650
+ const url = safeResourceUrl(rawUrl);
1651
+ const text = label.trim();
1652
+ if (!url || text === "") return text;
1653
+ return `[${escapeMarkdownLabel(text, serializedLabel)}](${escapeMarkdownUrl(url)})`;
1654
+ }
1655
+ function renderMarkdownResource(type, label, rawUrl) {
1656
+ const link = renderMarkdownLink(label, rawUrl);
1657
+ if (link === "" || link === label.trim()) return label.trim();
1658
+ return `${type}: ${link}`;
1659
+ }
1660
+ function resourceMarkdownForNode(node, childLabel = "") {
1661
+ const href = stringAttribute(node.attributes, "href");
1662
+ const src = stringAttribute(node.attributes, "src");
1663
+ const rawUrl = href ?? src;
1664
+ if (!rawUrl) return "";
1665
+ const name = (node.name ?? "").toLowerCase();
1666
+ const label = childLabel.trim() || stringAttribute(node.attributes, "title") || stringAttribute(node.attributes, "caption") || stringAttribute(node.attributes, "alt") || (name === "video" || name === "iframe" ? "Video" : "Resource");
1667
+ if (href) return renderMarkdownLink(label, href);
1668
+ const type = name === "video" || name === "iframe" || name === "source" ? "Video" : name === "img" ? "Image" : "Media";
1669
+ return renderMarkdownResource(type, label, src ?? "");
1670
+ }
1671
+ function componentMarkdownForNode(node) {
1672
+ if (node.name === "ParamField" || node.name === "ResponseField") {
1673
+ const names = node.name === "ParamField" ? ["path", "query", "header", "cookie", "body", "name"] : ["name"];
1674
+ const location2 = names.find((name) => stringAttribute(node.attributes, name) !== void 0);
1675
+ const field = location2 === void 0 ? void 0 : stringAttribute(node.attributes, location2);
1676
+ const type = stringAttribute(node.attributes, "type");
1677
+ const required = primitiveAttribute(node.attributes, "required") === "true";
1678
+ const defaultValue = primitiveAttribute(node.attributes, "default");
1679
+ const metadata = [location2 !== void 0 && location2 !== "name" ? location2 : void 0, type ? inlineCode(type) : void 0, required ? "required" : void 0, defaultValue !== void 0 ? `default: ${inlineCode(defaultValue)}` : void 0].filter(Boolean);
1680
+ return [field !== void 0 ? inlineCode(field) : void 0, metadata.length ? `(${metadata.join("; ")})` : void 0].filter(Boolean).join(" ");
1681
+ }
1682
+ if (node.name === "LandingHero" || node.name === "LandingCta") {
1683
+ const eyebrow = stringAttribute(node.attributes, "eyebrow");
1684
+ const title = stringAttribute(node.attributes, "title");
1685
+ const description = stringAttribute(node.attributes, "description");
1686
+ const primaryLabel = stringAttribute(node.attributes, "primaryLabel");
1687
+ const primaryHref = stringAttribute(node.attributes, "primaryHref");
1688
+ const secondaryLabel = stringAttribute(node.attributes, "secondaryLabel");
1689
+ const secondaryHref = stringAttribute(node.attributes, "secondaryHref");
1690
+ const terminalLabel = stringAttribute(node.attributes, "terminalLabel");
1691
+ const previewLabel = stringAttribute(node.attributes, "previewLabel");
1692
+ return [
1693
+ eyebrow,
1694
+ title,
1695
+ description,
1696
+ primaryLabel && primaryHref ? renderMarkdownLink(primaryLabel, primaryHref) : void 0,
1697
+ secondaryLabel && secondaryHref ? renderMarkdownLink(secondaryLabel, secondaryHref) : void 0,
1698
+ terminalLabel,
1699
+ previewLabel
1700
+ ].filter(Boolean).join("\n\n");
1701
+ }
1702
+ if (node.name === "TerminalWindow") {
1703
+ return [
1704
+ stringAttribute(node.attributes, "title"),
1705
+ stringAttribute(node.attributes, "command")
1706
+ ].filter(Boolean).join("\n\n");
1707
+ }
1708
+ if (node.name === "AppPreview") {
1709
+ return [
1710
+ stringAttribute(node.attributes, "url"),
1711
+ stringAttribute(node.attributes, "query"),
1712
+ stringAttribute(node.attributes, "tool"),
1713
+ stringAttribute(node.attributes, "response"),
1714
+ stringAttribute(node.attributes, "entities"),
1715
+ stringAttribute(node.attributes, "relationships")
1716
+ ].filter(Boolean).join("\n\n");
1717
+ }
1718
+ if (node.name === "MemoryStage") {
1719
+ return [
1720
+ stringAttribute(node.attributes, "badge"),
1721
+ stringAttribute(node.attributes, "title"),
1722
+ stringAttribute(node.attributes, "description")
1723
+ ].filter(Boolean).join("\n\n");
1724
+ }
1725
+ if (node.name === "DomainCard") {
1726
+ const name = stringAttribute(node.attributes, "name");
1727
+ const emoji = stringAttribute(node.attributes, "emoji");
1728
+ const domain = stringAttribute(node.attributes, "domain");
1729
+ const entities = stringAttribute(node.attributes, "entities")?.split("|").map((value) => value.trim()).filter(Boolean) ?? [];
1730
+ if (!name || !domain) return "";
1731
+ return [
1732
+ `### ${emoji ? `${emoji} ` : ""}${name}`,
1733
+ entities.join(" \xB7 "),
1734
+ `\`--domain ${domain}\``,
1735
+ entities.map((entity) => `\`:${entity}\``).join(" ") + " `+ base POLE+O types`",
1736
+ `\`uvx create-context-graph --domain ${domain}\``
1737
+ ].filter(Boolean).join("\n\n");
1738
+ }
1739
+ if (node.name === "FrameworkCard") {
1740
+ return [
1741
+ stringAttribute(node.attributes, "title"),
1742
+ stringAttribute(node.attributes, "support")
1743
+ ].filter(Boolean).join("\n\n");
1744
+ }
1745
+ if (node.name === "CommandStep") {
1746
+ const title = stringAttribute(node.attributes, "title");
1747
+ const command = stringAttribute(node.attributes, "command");
1748
+ return [title, command ? `\`$ ${command}\`` : void 0].filter(Boolean).join("\n\n");
1749
+ }
1750
+ if (node.name === "LandingFooter") {
1751
+ return [
1752
+ stringAttribute(node.attributes, "name"),
1753
+ stringAttribute(node.attributes, "description")
1754
+ ].filter(Boolean).join("\n\n");
1755
+ }
1756
+ if (node.name === "Stat") {
1757
+ const value = stringOrNumberAttribute(node.attributes, "value");
1758
+ const label = stringAttribute(node.attributes, "label");
1759
+ const caption = stringAttribute(node.attributes, "caption");
1760
+ return [value, label, caption].filter(Boolean).join("\n\n");
1761
+ }
1762
+ if (node.name === "ColorSwatch") {
1763
+ const name = stringAttribute(node.attributes, "name");
1764
+ const value = stringAttribute(node.attributes, "value");
1765
+ const usage = stringAttribute(node.attributes, "usage");
1766
+ if (!name || !value) return "";
1767
+ return `${name}: ${value}${usage ? `. ${usage}` : ""}`;
1768
+ }
1769
+ if (node.name === "TypeSpecimen") {
1770
+ const family = stringAttribute(node.attributes, "family");
1771
+ const role = stringAttribute(node.attributes, "role");
1772
+ const weights = stringAttribute(node.attributes, "weights");
1773
+ const sample = stringAttribute(node.attributes, "sample");
1774
+ if (!family || !role || !weights || !sample) return "";
1775
+ return `${family}: ${role}. Weights: ${weights}. Sample: ${sample}`;
1776
+ }
1777
+ if (node.name === "UsageExample") {
1778
+ const verdict = stringAttribute(node.attributes, "verdict");
1779
+ const title = stringAttribute(node.attributes, "title");
1780
+ if (!verdict || !title) return "";
1781
+ return `${verdict === "dont" ? "Do not" : "Do"}: ${title}`;
1782
+ }
1783
+ return "";
1784
+ }
1785
+ function inlineCode(value) {
1786
+ const fence = "`".repeat(Math.max(1, longestBacktickRun(value) + 1));
1787
+ return `${fence} ${value} ${fence}`;
1788
+ }
1789
+ function inlineCodeSpan(value) {
1790
+ const fence = "`".repeat(Math.max(1, longestBacktickRun(value) + 1));
1791
+ const padded = /[^ ]/.test(value) && (/^`|`$/.test(value) || /^ /.test(value) && / $/.test(value));
1792
+ return `${fence}${padded ? " " : ""}${value}${padded ? " " : ""}${fence}`;
1793
+ }
1794
+ function escapeTablePipes(value) {
1795
+ return value.replace(/\\*\|/g, (match) => match.length % 2 === 1 ? `\\${match}` : match);
1796
+ }
1797
+ function primitiveAttribute(attributes, name) {
1798
+ const attribute = attributes?.find((candidate) => candidate.type === "mdxJsxAttribute" && candidate.name === name);
1799
+ if (!attribute) return void 0;
1800
+ if (attribute.value === null) return "true";
1801
+ if (typeof attribute.value === "string") return attribute.value;
1802
+ const expression = attribute.value?.value?.trim() ?? "";
1803
+ return stringLiteralValue(expression) ?? (/^(?:true|false|-?(?:\d+\.?\d*|\.\d+))$/.test(expression) ? expression : void 0);
1804
+ }
1805
+ function renderHtmlResource(value) {
1806
+ const tag = /<(iframe|video|audio|source|img|a)\b([^>]*)>/i.exec(value);
1807
+ if (!tag) return "";
1808
+ const name = tag[1]?.toLowerCase() ?? "";
1809
+ const attributes = tag[2] ?? "";
1810
+ const href = htmlAttribute(attributes, "href");
1811
+ const src = htmlAttribute(attributes, "src");
1812
+ const rawUrl = href ?? src;
1813
+ if (!rawUrl) return "";
1814
+ const label = htmlAttribute(attributes, "title") || htmlAttribute(attributes, "aria-label") || htmlAttribute(attributes, "alt") || (name === "video" || name === "iframe" ? "Video" : "Resource");
1815
+ if (href) return renderMarkdownLink(label, href);
1816
+ const type = name === "video" || name === "iframe" || name === "source" ? "Video" : name === "img" ? "Image" : "Media";
1817
+ return renderMarkdownResource(type, label, src ?? "");
1818
+ }
1819
+ function stringAttribute(attributes, name) {
1820
+ const attr = attributes?.find(
1821
+ (candidate) => candidate.type === "mdxJsxAttribute" && candidate.name === name
1822
+ );
1823
+ if (!attr) return void 0;
1824
+ if (typeof attr.value === "string") return attr.value;
1825
+ if (attr.value && typeof attr.value === "object") {
1826
+ return stringLiteralValue(attr.value.value ?? "");
1827
+ }
1828
+ return void 0;
1829
+ }
1830
+ function stringOrNumberAttribute(attributes, name) {
1831
+ const attr = attributes?.find(
1832
+ (candidate) => candidate.type === "mdxJsxAttribute" && candidate.name === name
1833
+ );
1834
+ if (!attr) return void 0;
1835
+ if (typeof attr.value === "string") return attr.value;
1836
+ if (!attr.value || typeof attr.value !== "object") return void 0;
1837
+ const source = attr.value.value?.trim() ?? "";
1838
+ return stringLiteralValue(source) ?? (/^-?(?:\d+\.?\d*|\.\d+)$/.test(source) ? source : void 0);
1839
+ }
1840
+ function htmlAttribute(attributes, name) {
1841
+ const match = new RegExp(
1842
+ `(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,
1843
+ "i"
1844
+ ).exec(attributes);
1845
+ return decodeHtmlAttribute(match?.[1] ?? match?.[2] ?? "") || void 0;
1846
+ }
1847
+ function decodeHtmlAttribute(value) {
1848
+ return value.replace(/&amp;/gi, "&").replace(/&quot;/gi, '"').replace(/&#39;|&apos;/gi, "'").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">");
1849
+ }
1850
+ function escapeMarkdownText(value) {
1851
+ return value.replace(/[\\`*_[\]]/g, "\\$&").replace(/<(?=[A-Za-z/!?])/g, "\\<");
1852
+ }
1853
+ function escapeMarkdownLabel(value, preserveCode = false) {
1854
+ if (!preserveCode) return value.replace(/\\(?!<)|[[\]]/g, "\\$&");
1855
+ let output = "";
1856
+ let offset = 0;
1857
+ for (const match of value.matchAll(/`+/g)) {
1858
+ const start = match.index;
1859
+ if (start < offset) continue;
1860
+ let before = start;
1861
+ while (before > 0 && value[before - 1] === "\\") before -= 1;
1862
+ if ((start - before) % 2 === 1) continue;
1863
+ const end = new RegExp("(?<!`)" + match[0] + "(?!`)", "g");
1864
+ end.lastIndex = start + match[0].length;
1865
+ const close = end.exec(value);
1866
+ if (close === null || close.index === start + match[0].length) continue;
1867
+ output += escapeSerializedLabelText(value.slice(offset, start));
1868
+ offset = close.index + close[0].length;
1869
+ output += value.slice(start, offset);
1870
+ }
1871
+ return output + escapeSerializedLabelText(value.slice(offset));
1872
+ }
1873
+ function escapeSerializedLabelText(value) {
1874
+ return value.replace(/\\*[[\]]/g, (match) => match.length % 2 === 1 ? `\\${match}` : match);
1875
+ }
1876
+ function escapeMarkdownUrl(value) {
1877
+ return value.replace(/\\/g, "%5C").replace(/\(/g, "%28").replace(/\)/g, "%29");
1878
+ }
1879
+ function proseAttributeValues(attributes) {
1880
+ return namedAttributeValues(attributes, PROSE_ATTRIBUTES);
1881
+ }
1882
+ function namedAttributeValues(attributes, names) {
1883
+ if (!attributes) return [];
1884
+ const values = [];
1885
+ for (const attr of attributes) {
1886
+ if (attr.type !== "mdxJsxAttribute") continue;
1887
+ if (!attr.name || !names.has(attr.name)) continue;
1888
+ const value = attr.value;
1889
+ if (typeof value === "string") {
1890
+ if (value.trim()) values.push(value.trim());
1891
+ } else if (value && typeof value === "object") {
1892
+ const literal = stringLiteralValue(value.value ?? "");
1893
+ if (literal && literal.trim()) values.push(literal.trim());
1894
+ }
1895
+ }
1896
+ return values;
1897
+ }
1898
+ function stringLiteralValue(code) {
1899
+ const trimmed = code.trim();
1900
+ if (trimmed === "") return void 0;
1901
+ if (trimmed.startsWith('"')) {
1902
+ try {
1903
+ const parsed = JSON.parse(trimmed);
1904
+ return typeof parsed === "string" ? parsed : void 0;
1905
+ } catch {
1906
+ return void 0;
1907
+ }
1908
+ }
1909
+ if (trimmed.startsWith("'")) {
1910
+ const match = /^'((?:[^'\\]|\\.)*)'$/.exec(trimmed);
1911
+ if (match && match[1] !== void 0) return match[1].replace(/\\(.)/g, "$1");
1912
+ return void 0;
1913
+ }
1914
+ if (trimmed.startsWith("`")) {
1915
+ const match = /^`([^`]*)`$/.exec(trimmed);
1916
+ if (match && match[1] !== void 0 && !match[1].includes("${"))
1917
+ return match[1];
1918
+ return void 0;
1919
+ }
1920
+ return void 0;
1921
+ }
1922
+ function longestBacktickRun(value) {
1923
+ let longest = 0;
1924
+ let current = 0;
1925
+ for (const char of value) {
1926
+ if (char === "`") {
1927
+ current += 1;
1928
+ if (current > longest) longest = current;
1929
+ } else {
1930
+ current = 0;
1931
+ }
1932
+ }
1933
+ return longest;
1934
+ }
1935
+ function parseFrontmatter(raw) {
1936
+ try {
1937
+ const data = parseYaml(raw);
1938
+ if (data && typeof data === "object" && !Array.isArray(data)) {
1939
+ const record = data;
1940
+ const out = { frontmatter: record };
1941
+ if (typeof record.title === "string") out.title = record.title;
1942
+ if (typeof record.description === "string")
1943
+ out.description = record.description;
1944
+ return out;
1945
+ }
1946
+ } catch {
1947
+ }
1948
+ return { frontmatter: {} };
1949
+ }
1950
+
1951
+ // ../source-abi/dist/index.js
1952
+ import { unified as unified3 } from "unified";
1953
+ import remarkGfm3 from "remark-gfm";
1954
+ import remarkMdx3 from "remark-mdx";
1955
+ import remarkParse3 from "remark-parse";
1111
1956
  import { z } from "zod";
1112
1957
  var SOURCE_ABI_VERSION = 3;
1113
1958
  var SOURCE_LIMITS = Object.freeze({
@@ -1122,19 +1967,25 @@ var SOURCE_LIMITS = Object.freeze({
1122
1967
  maxModelsTomlBytes: 65536,
1123
1968
  maxOpenApiBytes: 4194304,
1124
1969
  maxFrontmatterBytes: 65536,
1125
- maxThemeCssBytes: 262144
1970
+ maxThemeCssBytes: 262144,
1971
+ maxComponentFileCount: 50,
1972
+ maxComponentFileBytes: 262144,
1973
+ maxComponentTotalBytes: 2097152
1126
1974
  });
1127
1975
  var SOURCE_ALLOWED_ROOTS = Object.freeze([
1128
1976
  "docs.json",
1129
1977
  "models.toml",
1130
1978
  "pages/**",
1131
1979
  "public/**",
1132
- "openapi/**"
1980
+ "openapi/**",
1981
+ "components/*"
1133
1982
  ]);
1983
+ var SOURCE_IGNORED_FILES = Object.freeze(["AGENTS.md", "CLAUDE.md"]);
1134
1984
  var SOURCE_ALLOWED_EXTENSIONS = Object.freeze({
1135
1985
  root: Object.freeze([".json", ".toml"]),
1136
1986
  pages: Object.freeze([".md", ".mdx"]),
1137
1987
  openapi: Object.freeze([".json", ".yaml", ".yml"]),
1988
+ components: Object.freeze([".jsx", ".tsx", ".js", ".ts", ".json"]),
1138
1989
  public: Object.freeze([
1139
1990
  ".css",
1140
1991
  ".png",
@@ -1196,7 +2047,9 @@ var SOURCE_MEDIA_TYPES = Object.freeze({
1196
2047
  ".ico": "image/x-icon",
1197
2048
  ".jpeg": "image/jpeg",
1198
2049
  ".jpg": "image/jpeg",
2050
+ ".js": "text/javascript",
1199
2051
  ".json": "application/json",
2052
+ ".jsx": "text/javascript",
1200
2053
  ".md": "text/markdown",
1201
2054
  ".mdx": "text/mdx",
1202
2055
  ".mp3": "audio/mpeg",
@@ -1209,6 +2062,8 @@ var SOURCE_MEDIA_TYPES = Object.freeze({
1209
2062
  ".png": "image/png",
1210
2063
  ".svg": "image/svg+xml",
1211
2064
  ".toml": "application/toml",
2065
+ ".ts": "text/typescript",
2066
+ ".tsx": "text/typescript",
1212
2067
  ".ttf": "font/ttf",
1213
2068
  ".txt": "text/plain",
1214
2069
  ".wav": "audio/wav",
@@ -1219,6 +2074,7 @@ var SOURCE_MEDIA_TYPES = Object.freeze({
1219
2074
  ".yaml": "application/yaml",
1220
2075
  ".yml": "application/yaml"
1221
2076
  });
2077
+ var PAGE_ISSUE_LIMIT = 50;
1222
2078
  var textEncoder = new TextEncoder();
1223
2079
  var WINDOWS_DEVICE_NAME = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
1224
2080
  var ASCII_SOURCE_PATH = /^[A-Za-z0-9._/-]+$/;
@@ -1250,14 +2106,20 @@ function inspectSourcePath(raw) {
1250
2106
  }
1251
2107
  return { normalized, segments, syntaxValid, tooDeep, tooLong, segmentTooLong };
1252
2108
  }
2109
+ function isIgnoredSourceFile(path) {
2110
+ return SOURCE_IGNORED_FILES.includes(path);
2111
+ }
1253
2112
  function isKnownSourceRoot(path) {
1254
2113
  if (path === "docs.json" || path === "models.toml") return true;
1255
- return path.startsWith("pages/") || path.startsWith("public/") || path.startsWith("openapi/");
2114
+ return path.startsWith("components/") || path.startsWith("pages/") || path.startsWith("public/") || path.startsWith("openapi/");
1256
2115
  }
1257
2116
  function isAllowedSourceLocation(path) {
1258
2117
  const extension = sourceExtension(path);
1259
2118
  if (path === "docs.json") return extension === ".json";
1260
2119
  if (path === "models.toml") return extension === ".toml";
2120
+ if (path.startsWith("components/")) {
2121
+ return /^components\/(?:[A-Z][A-Za-z0-9]{0,63}\.(?:jsx|tsx)|[a-z][A-Za-z0-9-]{0,63}\.(?:js|jsx|ts|tsx|json))$/.test(path);
2122
+ }
1261
2123
  if (path.startsWith("pages/")) {
1262
2124
  return extension !== null && PAGE_EXTENSIONS.has(extension);
1263
2125
  }
@@ -1271,6 +2133,7 @@ function isAllowedSourceLocation(path) {
1271
2133
  return false;
1272
2134
  }
1273
2135
  function isStaticallyGeneratedArtifact(path) {
2136
+ if (path.startsWith("components/")) return false;
1274
2137
  const lower = path.toLowerCase();
1275
2138
  const filename = lower.slice(lower.lastIndexOf("/") + 1);
1276
2139
  if (lower === "dist" || lower.startsWith("dist/") || lower === "pagefind" || lower.startsWith("pagefind/") || lower === "_astro" || lower.startsWith("_astro/") || lower === "node_modules" || lower.startsWith("node_modules/") || lower === ".git" || lower.startsWith(".git/") || lower === "worker/generated" || lower.startsWith("worker/generated/")) {
@@ -1285,14 +2148,64 @@ function canonicalizeSourcePath(raw) {
1285
2148
  }
1286
2149
  return inspected.normalized;
1287
2150
  }
2151
+ var SCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".ts", ".tsx"]);
1288
2152
  function detectSourceMediaType(path) {
1289
2153
  const extension = sourceExtension(path);
1290
2154
  if (extension === null) return null;
2155
+ if (SCRIPT_EXTENSIONS.has(extension) && !path.startsWith("components/")) return null;
1291
2156
  return SOURCE_MEDIA_TYPES[extension] ?? null;
1292
2157
  }
1293
2158
  function unicodeCaseFold(value) {
1294
2159
  return value.toLowerCase();
1295
2160
  }
2161
+ var R2_CONCURRENCY = 6;
2162
+ var R2_BYTE_BUDGET = 48 * 1024 * 1024;
2163
+ async function mapBounded(items, limit, worker) {
2164
+ const results = new Array(items.length);
2165
+ if (items.length === 0) return results;
2166
+ const bound = Math.max(1, Math.min(Math.floor(limit), items.length));
2167
+ let next = 0;
2168
+ const runner = async () => {
2169
+ for (; ; ) {
2170
+ const index = next;
2171
+ next += 1;
2172
+ if (index >= items.length) return;
2173
+ results[index] = await worker(items[index], index);
2174
+ }
2175
+ };
2176
+ await Promise.all(Array.from({ length: bound }, () => runner()));
2177
+ return results;
2178
+ }
2179
+ var BoundedPool = class {
2180
+ #limit;
2181
+ #byteBudget;
2182
+ #inFlight = /* @__PURE__ */ new Set();
2183
+ #inFlightBytes = 0;
2184
+ #error = void 0;
2185
+ constructor(limit, byteBudget = 0) {
2186
+ this.#limit = Math.max(1, Math.floor(limit));
2187
+ this.#byteBudget = Math.max(0, Math.floor(byteBudget));
2188
+ }
2189
+ get error() {
2190
+ return this.#error;
2191
+ }
2192
+ async add(task, bytes = 0) {
2193
+ while (this.#inFlight.size > 0 && (this.#inFlight.size >= this.#limit || this.#byteBudget > 0 && this.#inFlightBytes + bytes > this.#byteBudget)) {
2194
+ await Promise.race(this.#inFlight);
2195
+ }
2196
+ this.#inFlightBytes += bytes;
2197
+ const promise = task().catch((error) => {
2198
+ if (this.#error === void 0) this.#error = error;
2199
+ }).finally(() => {
2200
+ this.#inFlight.delete(promise);
2201
+ this.#inFlightBytes -= bytes;
2202
+ });
2203
+ this.#inFlight.add(promise);
2204
+ }
2205
+ async drain() {
2206
+ await Promise.allSettled(this.#inFlight);
2207
+ }
2208
+ };
1296
2209
  var textEncoder2 = new TextEncoder();
1297
2210
  var BLOB_PATTERN = /^sha256\/[0-9a-f]{64}$/;
1298
2211
  var GIT_COMMIT_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
@@ -1339,7 +2252,7 @@ function canonicalJsonString(value) {
1339
2252
  }
1340
2253
  return `${result}"`;
1341
2254
  }
1342
- function canonicalJson(value) {
2255
+ function canonicalJson2(value) {
1343
2256
  if (value === null || typeof value === "boolean" || typeof value === "string") {
1344
2257
  return typeof value === "string" ? canonicalJsonString(value) : JSON.stringify(value);
1345
2258
  }
@@ -1350,12 +2263,12 @@ function canonicalJson(value) {
1350
2263
  return String(value);
1351
2264
  }
1352
2265
  if (Array.isArray(value)) {
1353
- return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
2266
+ return `[${value.map((item) => canonicalJson2(item)).join(",")}]`;
1354
2267
  }
1355
2268
  if (typeof value === "object") {
1356
2269
  const record = value;
1357
2270
  const keys = Object.keys(record).filter((key) => record[key] !== void 0).sort(compareCodePoints);
1358
- return `{${keys.map((key) => `${canonicalJsonString(key)}:${canonicalJson(record[key])}`).join(",")}}`;
2271
+ return `{${keys.map((key) => `${canonicalJsonString(key)}:${canonicalJson2(record[key])}`).join(",")}}`;
1359
2272
  }
1360
2273
  throw new TypeError("canonical revision JSON contains an unsupported value");
1361
2274
  }
@@ -1396,7 +2309,7 @@ function validatedManifestValue(manifest) {
1396
2309
  return value;
1397
2310
  }
1398
2311
  function canonicalizeRevisionManifest(manifest) {
1399
- return canonicalJson(validatedManifestValue(manifest));
2312
+ return canonicalJson2(validatedManifestValue(manifest));
1400
2313
  }
1401
2314
  async function revisionId(manifest) {
1402
2315
  const canonical = canonicalizeRevisionManifest(manifest);
@@ -1474,7 +2387,7 @@ function sortViolations(violations) {
1474
2387
  });
1475
2388
  }
1476
2389
  function isRootSpecificTypeInvalid(path) {
1477
- return (path.startsWith("pages/") || path.startsWith("public/") || path.startsWith("openapi/") || path === "docs.json" || path === "models.toml") && !isAllowedSourceLocation(path);
2390
+ return isKnownSourceRoot(path) && !isAllowedSourceLocation(path);
1478
2391
  }
1479
2392
  function isReservedRoute(path) {
1480
2393
  return RESERVED_URL_PREFIXES.some((pattern) => {
@@ -1525,6 +2438,8 @@ function validateBundleStructure(files) {
1525
2438
  message: `bundle has ${files.length} files; maximum is ${SOURCE_LIMITS.maxFileCount}`
1526
2439
  });
1527
2440
  }
2441
+ let componentCount = 0;
2442
+ let componentBytes = 0;
1528
2443
  let totalSize = 0;
1529
2444
  let pageCount = 0;
1530
2445
  let hasDocsJson = false;
@@ -1574,9 +2489,17 @@ function validateBundleStructure(files) {
1574
2489
  }
1575
2490
  if (!path.syntaxValid) continue;
1576
2491
  const normalized = path.normalized;
2492
+ if (isIgnoredSourceFile(normalized)) continue;
1577
2493
  if (normalized === "docs.json" && !path.tooLong && !path.segmentTooLong && isAllowedSourceLocation(normalized) && !isStaticallyGeneratedArtifact(normalized)) {
1578
2494
  hasDocsJson = true;
1579
2495
  }
2496
+ if (normalized.startsWith("components/")) {
2497
+ componentCount += 1;
2498
+ componentBytes += sizeValid ? file.size : 0;
2499
+ if (file.size > SOURCE_LIMITS.maxComponentFileBytes) {
2500
+ violations.push({ path: normalized, code: "component_file_too_large", severity: "error", message: "Component file exceeds 256 KiB" });
2501
+ }
2502
+ }
1580
2503
  const mediaType = detectSourceMediaType(normalized);
1581
2504
  if (mediaType === null || isRootSpecificTypeInvalid(normalized)) {
1582
2505
  violations.push({
@@ -1624,6 +2547,12 @@ function validateBundleStructure(files) {
1624
2547
  pageCount += 1;
1625
2548
  }
1626
2549
  }
2550
+ if (componentCount > SOURCE_LIMITS.maxComponentFileCount) {
2551
+ violations.push({ path: "components/", code: "too_many_component_files", severity: "error", message: "Component directory exceeds 50 files" });
2552
+ }
2553
+ if (componentBytes > SOURCE_LIMITS.maxComponentTotalBytes) {
2554
+ violations.push({ path: "components/", code: "component_files_too_large", severity: "error", message: "Component directory exceeds 2 MiB" });
2555
+ }
1627
2556
  if (!hasDocsJson) {
1628
2557
  violations.push({
1629
2558
  path: null,
@@ -1733,11 +2662,8 @@ function validateRedirects(input, violations) {
1733
2662
  function validateOpenApiNames(input, violations) {
1734
2663
  if (input.config.agents?.openapi === false) return;
1735
2664
  const groupsByDocId = new Map(input.pages.map((page) => [page.docId, page.groups]));
1736
- const specGroups = navigationGroups(input.config).flatMap(
1737
- (group) => group.openapi ? [{ openapi: group.openapi, pages: group.pages }] : []
1738
- );
1739
2665
  const collision = openApiPublicationCollision(
1740
- ungatedOpenApiSpecPaths(specGroups, (docId) => groupsByDocId.get(docId) ?? [])
2666
+ ungatedOpenApiSpecPaths(navigationOpenApiSpecGroups(input.config), (docId) => groupsByDocId.get(docId) ?? [])
1741
2667
  );
1742
2668
  if (collision) {
1743
2669
  addViolation(
@@ -1935,6 +2861,8 @@ var COMPONENTS = {
1935
2861
  path: STRING,
1936
2862
  name: STRING,
1937
2863
  query: STRING,
2864
+ header: STRING,
2865
+ cookie: STRING,
1938
2866
  body: STRING,
1939
2867
  type: STRING,
1940
2868
  required: BOOLEAN,
@@ -2026,11 +2954,60 @@ var STANDARD_NODES = /* @__PURE__ */ new Set([
2026
2954
  "text",
2027
2955
  "thematicBreak"
2028
2956
  ]);
2029
- var markdownParser = unified().use(remarkParse).use(remarkGfm);
2030
- var mdxParser = unified().use(remarkParse).use(remarkMdx).use(remarkGfm);
2957
+ var markdownParser2 = unified3().use(remarkParse3).use(remarkGfm3);
2958
+ var mdxParser2 = unified3().use(remarkParse3).use(remarkMdx3).use(remarkGfm3);
2031
2959
  function issue(message) {
2032
2960
  return { code: "inadmissible_page_content", message };
2033
2961
  }
2962
+ var SNIPPET_LENGTH = 40;
2963
+ function snippet(value) {
2964
+ const characters = [...value.replace(/\s*\n\s*/g, " ").trim()];
2965
+ return characters.length > SNIPPET_LENGTH ? `${characters.slice(0, SNIPPET_LENGTH).join("")}\u2026` : characters.join("");
2966
+ }
2967
+ function location(line, column, lineOffset) {
2968
+ return `line ${line + lineOffset}, column ${column}`;
2969
+ }
2970
+ function nodeLocation(node, lineOffset) {
2971
+ const start = node.position?.start;
2972
+ return start === void 0 ? "an unknown line" : location(start.line, start.column, lineOffset);
2973
+ }
2974
+ function replacementFor(tag) {
2975
+ const lower = tag.toLowerCase();
2976
+ const component = Object.keys(COMPONENTS).find((name) => name.toLowerCase() === lower);
2977
+ if (component !== void 0) return `use the <${component}> component`;
2978
+ const native = NATIVE_ELEMENTS[lower];
2979
+ if (native !== void 0) {
2980
+ return `write it as ${native.empty ? `<${lower} ... />` : `<${lower}>...</${lower}>`}`;
2981
+ }
2982
+ return null;
2983
+ }
2984
+ function rawHtmlIssue(node, at) {
2985
+ const value = node.value ?? "";
2986
+ const tag = /^<\/?\s*([A-Za-z][\w-]*)/.exec(value)?.[1];
2987
+ if (tag === void 0) {
2988
+ const fix2 = "use Markdown or a supported component";
2989
+ return { issue: issue(`raw HTML ${snippet(value)} at ${at} is not admissible in page source; ${fix2}`), fix: fix2 };
2990
+ }
2991
+ const replacement = replacementFor(tag);
2992
+ const fix = replacement === null ? "use Markdown or a supported component" : `${replacement} in an .mdx page`;
2993
+ return { issue: issue(`raw HTML <${snippet(tag)}> at ${at} is not admissible in page source; ${fix}`), fix };
2994
+ }
2995
+ var RANGE_SUFFIX = /\((\d+):(\d+)-(\d+):(\d+)\)$/;
2996
+ function syntaxStart(error) {
2997
+ const raw = error instanceof Error ? error.message : String(error);
2998
+ const range = RANGE_SUFFIX.exec(raw);
2999
+ const place = error;
3000
+ return typeof place.line === "number" && typeof place.column === "number" ? { line: place.line, column: place.column } : range === null ? null : { line: Number(range[1]), column: Number(range[2]) };
3001
+ }
3002
+ function syntaxIssue(error, lineOffset) {
3003
+ const raw = error instanceof Error ? error.message : String(error);
3004
+ const range = RANGE_SUFFIX.exec(raw);
3005
+ const reason = range === null ? raw : `${raw.slice(0, range.index)}(${Number(range[1]) + lineOffset}:${range[2]}-${Number(range[3]) + lineOffset}:${range[4]})`;
3006
+ const start = syntaxStart(error);
3007
+ const prefix = start === null ? "" : `${location(start.line, start.column, lineOffset)}: `;
3008
+ const hint = /closing brace/.test(reason) ? "; write \\{ for a literal brace" : "";
3009
+ return { code: "invalid_page_syntax", message: `${prefix}${reason}${hint}` };
3010
+ }
2034
3011
  function expressionValue(attribute) {
2035
3012
  return attribute.value && typeof attribute.value === "object" ? attribute.value.value : null;
2036
3013
  }
@@ -2093,38 +3070,129 @@ function validAttribute(attribute, kind) {
2093
3070
  if (kind === "string") return typeof attribute.value === "string";
2094
3071
  return typeof attribute.value === "string" && kind.includes(attribute.value);
2095
3072
  }
2096
- function validateElement(node) {
2097
- if (node.name === null || node.name === void 0) return issue("MDX fragments are not admissible");
3073
+ function editDistance(left, right) {
3074
+ const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
3075
+ for (let row = 1; row <= left.length; row += 1) {
3076
+ let diagonal = previous[0];
3077
+ previous[0] = row;
3078
+ for (let column = 1; column <= right.length; column += 1) {
3079
+ const above = previous[column];
3080
+ previous[column] = Math.min(
3081
+ above + 1,
3082
+ previous[column - 1] + 1,
3083
+ diagonal + (left[row - 1] === right[column - 1] ? 0 : 1)
3084
+ );
3085
+ diagonal = above;
3086
+ }
3087
+ }
3088
+ return previous[right.length];
3089
+ }
3090
+ function closestName(name, candidates) {
3091
+ const lower = name.toLowerCase();
3092
+ const exactCase = candidates.find((candidate) => candidate.toLowerCase() === lower);
3093
+ if (exactCase !== void 0) return exactCase;
3094
+ let best = null;
3095
+ let bestDistance = Math.min(2, Math.floor(name.length / 2));
3096
+ for (const candidate of candidates) {
3097
+ const distance = editDistance(lower, candidate.toLowerCase());
3098
+ if (distance <= bestDistance) {
3099
+ best = candidate;
3100
+ bestDistance = distance - 1;
3101
+ }
3102
+ }
3103
+ return best;
3104
+ }
3105
+ function attributeFix(name, element, policy) {
3106
+ const names = Object.keys(policy.attributes);
3107
+ if (names.length === 0) return `remove ${name}; ${element} takes no attributes`;
3108
+ const closest = closestName(name, names);
3109
+ const accepted = `${element} accepts ${names.join(", ")}`;
3110
+ return closest === null ? `remove ${name}; ${accepted}` : `use ${closest}; ${accepted}`;
3111
+ }
3112
+ function valueFix(kind) {
3113
+ if (typeof kind !== "string") return `use one of ${kind.join(", ")}`;
3114
+ switch (kind) {
3115
+ case "boolean":
3116
+ return "write the attribute alone for true, or as {true} or {false}";
3117
+ case "color":
3118
+ return "use a six-digit hex color such as #4F46E5";
3119
+ case "cols":
3120
+ return "use a whole number from 1 to 6, such as {2}";
3121
+ case "dimension":
3122
+ return "use a whole number of pixels, such as 300 or {300}";
3123
+ case "iconSize":
3124
+ return "use a size up to 512, such as 24, 1.5rem, or 2em";
3125
+ case "href":
3126
+ case "src":
3127
+ return "use a site path such as /guides/setup or an https URL, with no spaces";
3128
+ case "string":
3129
+ return "use a quoted string";
3130
+ case "numberOrString":
3131
+ return "use a quoted string or a number such as {3}";
3132
+ case "default":
3133
+ return "use a quoted string, a number such as {3}, or {true} or {false}";
3134
+ }
3135
+ }
3136
+ function elementFindings(node, at) {
3137
+ if (node.name === null || node.name === void 0) {
3138
+ return [{ issue: issue("MDX fragments are not admissible"), fix: "remove the <> and </> wrapper" }];
3139
+ }
2098
3140
  const policy = COMPONENTS[node.name] ?? NATIVE_ELEMENTS[node.name];
2099
- if (policy === void 0) return issue(`element ${node.name} is not admissible`);
3141
+ if (policy === void 0) {
3142
+ const fix = replacementFor(node.name) ?? "use Markdown or a supported component";
3143
+ return [{ issue: issue(`element ${snippet(node.name)} at ${at} is not admissible; ${fix}`), fix }];
3144
+ }
3145
+ const findings = [];
2100
3146
  const seen = /* @__PURE__ */ new Set();
2101
3147
  for (const attribute of node.attributes ?? []) {
2102
3148
  if (attribute.type !== "mdxJsxAttribute" || attribute.name === void 0) {
2103
- return issue(`spread attributes are not admissible on ${node.name}`);
3149
+ findings.push({ issue: issue(`spread attributes are not admissible on ${node.name}`), fix: "write each attribute by name" });
3150
+ continue;
3151
+ }
3152
+ if (seen.has(attribute.name)) {
3153
+ findings.push({ issue: issue(`duplicate attribute ${attribute.name} on ${node.name}`), fix: `keep one ${attribute.name} attribute` });
3154
+ continue;
2104
3155
  }
2105
- if (seen.has(attribute.name)) return issue(`duplicate attribute ${attribute.name} on ${node.name}`);
2106
3156
  seen.add(attribute.name);
2107
3157
  const kind = policy.attributes[attribute.name];
2108
- if (kind === void 0) return issue(`attribute ${attribute.name} is not admissible on ${node.name}`);
3158
+ if (kind === void 0) {
3159
+ findings.push({
3160
+ issue: issue(`attribute ${attribute.name} is not admissible on ${node.name}`),
3161
+ fix: attributeFix(attribute.name, node.name, policy)
3162
+ });
3163
+ continue;
3164
+ }
2109
3165
  if (!validAttribute(attribute, kind)) {
2110
- return issue(`attribute ${attribute.name} has an inadmissible value on ${node.name}`);
3166
+ findings.push({ issue: issue(`attribute ${attribute.name} has an inadmissible value on ${node.name}`), fix: valueFix(kind) });
2111
3167
  }
2112
3168
  }
2113
3169
  for (const required of policy.required ?? []) {
2114
- if (!seen.has(required)) return issue(`attribute ${required} is required on ${node.name}`);
3170
+ if (!seen.has(required)) {
3171
+ findings.push({ issue: issue(`attribute ${required} is required on ${node.name}`), fix: `add ${required} to ${node.name}` });
3172
+ }
2115
3173
  }
2116
- if (policy.empty && (node.children?.length ?? 0) > 0) return issue(`${node.name} must not have children`);
2117
- return null;
3174
+ if (policy.empty && (node.children?.length ?? 0) > 0) {
3175
+ findings.push({ issue: issue(`${node.name} must not have children`), fix: `write <${node.name} /> with no content` });
3176
+ }
3177
+ return findings;
2118
3178
  }
2119
- function validatePageSource(path, source, policy = {}) {
3179
+ var HEADING_CONFLICT = {
3180
+ code: "page_heading_conflict",
3181
+ message: "standard documentation pages receive their level-one heading from frontmatter title; remove the authored level-one heading or set pageHeader: false when the page owns its title"
3182
+ };
3183
+ function collectPageSourceIssues(path, source, policy, limit) {
3184
+ const lineOffset = policy.lineOffset ?? 0;
2120
3185
  let tree;
2121
3186
  try {
2122
- tree = (path.toLowerCase().endsWith(".mdx") ? mdxParser : markdownParser).parse(source);
3187
+ tree = (path.toLowerCase().endsWith(".mdx") ? mdxParser2 : markdownParser2).parse(source);
2123
3188
  } catch (error) {
2124
- return {
2125
- code: "invalid_page_syntax",
2126
- message: error instanceof Error ? error.message : String(error)
2127
- };
3189
+ const start = syntaxStart(error);
3190
+ return [{
3191
+ ...syntaxIssue(error, lineOffset),
3192
+ line: start === null ? null : start.line + lineOffset,
3193
+ column: start === null ? null : start.column,
3194
+ fix: null
3195
+ }];
2128
3196
  }
2129
3197
  const definitions = /* @__PURE__ */ new Map();
2130
3198
  const collectDefinitions = (node) => {
@@ -2134,46 +3202,138 @@ function validatePageSource(path, source, policy = {}) {
2134
3202
  for (const child of node.children ?? []) collectDefinitions(child);
2135
3203
  };
2136
3204
  collectDefinitions(tree);
2137
- const visit = (node) => {
3205
+ const issues = [];
3206
+ const report = (found, node, fix = null) => {
3207
+ const start = node.position?.start;
3208
+ issues.push({
3209
+ ...found,
3210
+ line: start === void 0 ? null : start.line + lineOffset,
3211
+ column: start === void 0 ? null : start.column,
3212
+ fix
3213
+ });
3214
+ return issues.length >= limit;
3215
+ };
3216
+ const visit = (node, inHeading = false) => {
2138
3217
  if (node.type === "heading" && node.depth === 1 && policy.allowLevelOneHeading === false) {
2139
- return {
2140
- code: "page_heading_conflict",
2141
- message: "standard documentation pages receive their level-one heading from frontmatter title; remove the authored level-one heading or set pageHeader: false when the page owns its title"
2142
- };
2143
- }
2144
- if (node.type === "mdxjsEsm") return issue("ESM is not admissible in page source");
2145
- if (node.type === "mdxFlowExpression" || node.type === "mdxTextExpression") {
2146
- return issue("MDX expressions are not admissible in page content");
2147
- }
2148
- if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") {
2149
- const elementIssue = validateElement(node);
2150
- if (elementIssue !== null) return elementIssue;
3218
+ if (report(HEADING_CONFLICT, node)) return true;
3219
+ } else if (node.type === "mdxjsEsm") {
3220
+ return report(
3221
+ issue(
3222
+ `import/export at ${nodeLocation(node, lineOffset)} is not admissible in page source: ${snippet(node.value ?? "")}; remove it, components need no import`
3223
+ ),
3224
+ node,
3225
+ "remove the import or export line"
3226
+ );
3227
+ } else if (node.type === "mdxFlowExpression" || node.type === "mdxTextExpression") {
3228
+ return report(
3229
+ issue(
3230
+ `MDX expression {${snippet(node.value ?? "")}} at ${nodeLocation(node, lineOffset)} is not admissible in page content; write \\{ for a literal brace, put the text in backticks, or rename the file to .md if it uses no components`
3231
+ ),
3232
+ node,
3233
+ "write \\{ for a literal brace, or put the text in backticks"
3234
+ );
3235
+ } else if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && typeof node.name === "string" && policy.components?.has(node.name) === true) {
3236
+ const at = nodeLocation(node, lineOffset);
3237
+ if (inHeading) {
3238
+ return report(
3239
+ issue(`customer component ${node.name} at ${at} cannot be used in a heading`),
3240
+ node,
3241
+ `move <${node.name} /> out of the heading`
3242
+ );
3243
+ }
3244
+ const decoded = decodeComponentProps(node);
3245
+ if (!decoded.ok) return report(issue(`${decoded.reason} on ${node.name} at ${at}`), node, decoded.fix);
3246
+ return false;
3247
+ } else if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") {
3248
+ for (const finding of elementFindings(node, nodeLocation(node, lineOffset))) {
3249
+ if (report(finding.issue, node, finding.fix)) return true;
3250
+ }
2151
3251
  } else if (node.type === "html") {
2152
- return issue("raw HTML is not admissible in page source");
3252
+ const found = rawHtmlIssue(node, nodeLocation(node, lineOffset));
3253
+ return report(found.issue, node, found.fix);
2153
3254
  } else if (!STANDARD_NODES.has(node.type)) {
2154
- return issue(`syntax node ${node.type} is not admissible`);
2155
- }
2156
- if ((node.type === "link" || node.type === "definition") && node.url !== void 0) {
2157
- if (!safeUrl(node.url, "href")) return issue(`URL scheme is not admissible: ${node.url}`);
2158
- }
2159
- if (node.type === "image" && node.url !== void 0 && !safeUrl(node.url, "src")) {
2160
- return issue(`image URL scheme is not admissible: ${node.url}`);
2161
- }
2162
- if (node.type === "linkReference" && node.identifier !== void 0) {
2163
- const url = definitions.get(node.identifier);
2164
- if (url !== void 0 && !safeUrl(url, "href")) return issue(`URL scheme is not admissible: ${url}`);
2165
- }
2166
- if (node.type === "imageReference" && node.identifier !== void 0) {
2167
- const url = definitions.get(node.identifier);
2168
- if (url !== void 0 && !safeUrl(url, "src")) return issue(`image URL scheme is not admissible: ${url}`);
3255
+ if (report(issue(`syntax node ${node.type} is not admissible`), node)) return true;
3256
+ } else {
3257
+ const urlIssue = urlIssueOf(node, definitions);
3258
+ if (urlIssue !== null && report(urlIssue, node, "use a site path or an https URL")) return true;
2169
3259
  }
2170
3260
  for (const child of node.children ?? []) {
2171
- const childIssue = visit(child);
2172
- if (childIssue !== null) return childIssue;
3261
+ if (visit(child, inHeading || node.type === "heading")) return true;
2173
3262
  }
2174
- return null;
3263
+ return false;
3264
+ };
3265
+ visit(tree);
3266
+ return issues;
3267
+ }
3268
+ function urlIssueOf(node, definitions) {
3269
+ if ((node.type === "link" || node.type === "definition") && node.url !== void 0) {
3270
+ if (!safeUrl(node.url, "href")) return issue(`URL scheme is not admissible: ${node.url}`);
3271
+ }
3272
+ if (node.type === "image" && node.url !== void 0 && !safeUrl(node.url, "src")) {
3273
+ return issue(`image URL scheme is not admissible: ${node.url}`);
3274
+ }
3275
+ if (node.type === "linkReference" && node.identifier !== void 0) {
3276
+ const url = definitions.get(node.identifier);
3277
+ if (url !== void 0 && !safeUrl(url, "href")) return issue(`URL scheme is not admissible: ${url}`);
3278
+ }
3279
+ if (node.type === "imageReference" && node.identifier !== void 0) {
3280
+ const url = definitions.get(node.identifier);
3281
+ if (url !== void 0 && !safeUrl(url, "src")) return issue(`image URL scheme is not admissible: ${url}`);
3282
+ }
3283
+ return null;
3284
+ }
3285
+ var markdownStructureParser = unified3().use(remarkParse3);
3286
+ var mdxStructureParser = unified3().use(remarkParse3).use(remarkMdx3);
3287
+ function parsePageBody(path, body, options = {}) {
3288
+ const mdx = path.toLowerCase().endsWith(".mdx");
3289
+ if (options.gfm === false) return (mdx ? mdxStructureParser : markdownStructureParser).parse(body);
3290
+ return (mdx ? mdxParser2 : markdownParser2).parse(body);
3291
+ }
3292
+ function pageAssetReferences(path, bytes) {
3293
+ let tree;
3294
+ let lineOffset;
3295
+ try {
3296
+ const offset = splitPageFrontmatter(bytes)?.bodyOffset ?? 0;
3297
+ lineOffset = bytes.subarray(0, offset).reduce((lines, byte) => lines + Number(byte === 10), 0);
3298
+ tree = parsePageBody(path, new TextDecoder().decode(bytes.subarray(offset)));
3299
+ } catch {
3300
+ return [];
3301
+ }
3302
+ const refs = [];
3303
+ const definitions = /* @__PURE__ */ new Map();
3304
+ const used = /* @__PURE__ */ new Set();
3305
+ const add = (kind, value, position) => {
3306
+ if (position) refs.push({ kind, value, line: position.start.line + lineOffset, column: position.start.column });
2175
3307
  };
2176
- return visit(tree);
3308
+ const visit = (node) => {
3309
+ if (node.type === "image" && node.url !== void 0) add("markdown-image", node.url, node.position);
3310
+ if (node.type === "imageReference" && node.identifier) used.add(node.identifier);
3311
+ if (node.type === "definition" && node.identifier && !definitions.has(node.identifier)) definitions.set(node.identifier, node);
3312
+ if (node.name && (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement")) {
3313
+ const policy = COMPONENTS[node.name] ?? NATIVE_ELEMENTS[node.name];
3314
+ for (const attr of node.attributes ?? []) {
3315
+ if (!attr.name || typeof attr.value !== "string" || !policy?.attributes?.[attr.name]) continue;
3316
+ if (attr.name === "icon") add("icon", attr.value, attr.position);
3317
+ if (policy.attributes[attr.name] === SRC && !(node.name === "Video" && attr.name === "src")) {
3318
+ add("image", attr.value, attr.position);
3319
+ }
3320
+ }
3321
+ }
3322
+ for (const child of node.children ?? []) visit(child);
3323
+ };
3324
+ visit(tree);
3325
+ for (const id of used) {
3326
+ const def = definitions.get(id);
3327
+ if (def?.url !== void 0) add("markdown-image", def.url, def.position);
3328
+ }
3329
+ return refs;
3330
+ }
3331
+ function validatePageSource(path, source, policy = {}) {
3332
+ const [first] = collectPageSourceIssues(path, source, policy, 1);
3333
+ return first === void 0 ? null : { code: first.code, message: first.message };
3334
+ }
3335
+ function validatePageSourceAll(path, source, policy = {}, limit = PAGE_ISSUE_LIMIT) {
3336
+ return collectPageSourceIssues(path, source, policy, Math.max(1, limit));
2177
3337
  }
2178
3338
  function pageSourceComponents() {
2179
3339
  return Object.entries(COMPONENTS).map(([name, policy]) => ({
@@ -2278,9 +3438,20 @@ function runbookProblems(value) {
2278
3438
  }
2279
3439
  return problems;
2280
3440
  }
3441
+ var ADMISSIBLE_FRONTMATTER_KEYS = [
3442
+ "title",
3443
+ "description",
3444
+ "lastUpdated",
3445
+ "pageLayout",
3446
+ "toc",
3447
+ "groups",
3448
+ "pagefind",
3449
+ "noindex",
3450
+ "public",
3451
+ "pageHeader",
3452
+ "runbook"
3453
+ ];
2281
3454
  var fatalUtf8Decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
2282
- var boundedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
2283
- var textEncoder3 = new TextEncoder();
2284
3455
  function errorMessage2(error) {
2285
3456
  return error instanceof Error ? error.message : String(error);
2286
3457
  }
@@ -2371,42 +3542,54 @@ function parseDocsJson(bytes, violations) {
2371
3542
  }
2372
3543
  return config;
2373
3544
  }
2374
- var ADMISSIBLE_FRONTMATTER_KEYS = ["title", "description", "pageLayout", "groups", "pagefind", "noindex", "public", "pageHeader", "runbook"];
2375
- function frontmatterPolicy(bytes) {
2376
- let openingLength = 0;
2377
- if (bytes[0] === 45 && bytes[1] === 45 && bytes[2] === 45) {
2378
- let index = 3;
2379
- while (bytes[index] === 32 || bytes[index] === 9) index += 1;
2380
- if (bytes[index] === 10) openingLength = index + 1;
2381
- else if (bytes[index] === 13 && bytes[index + 1] === 10) openingLength = index + 2;
2382
- else if (index < bytes.byteLength) throw new Error("frontmatter opening marker is malformed");
3545
+ var ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:[Zz]|[+-]\d{2}:?\d{2})?)?$/;
3546
+ function isIsoDate(value) {
3547
+ const match = ISO_DATE.exec(value);
3548
+ if (match === null || Number.isNaN(Date.parse(value))) return false;
3549
+ const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
3550
+ const date = new Date(Date.UTC(year, month - 1, day));
3551
+ return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
3552
+ }
3553
+ var FrontmatterFieldError = class extends Error {
3554
+ constructor(field, message) {
3555
+ super(message);
3556
+ this.field = field;
2383
3557
  }
2384
- if (openingLength === 0) {
3558
+ field;
3559
+ };
3560
+ function frontmatterLocation(bytes, error) {
3561
+ if (error instanceof YAMLParseError && error.linePos?.[0]) {
3562
+ const { line, col } = error.linePos[0];
3563
+ return { line: line + 1, column: col };
3564
+ }
3565
+ if (error instanceof FrontmatterFieldError) {
3566
+ const lines = new LineCounter();
3567
+ const block = splitPageFrontmatter(bytes)?.block ?? "";
3568
+ const { contents } = parseDocument(block, { lineCounter: lines });
3569
+ if (isMap(contents)) {
3570
+ for (const { key } of contents.items) {
3571
+ if (!isScalar(key) || key.value !== error.field || !key.range) continue;
3572
+ const { line, col } = lines.linePos(key.range[0]);
3573
+ return { line: line + 1, column: col };
3574
+ }
3575
+ }
3576
+ }
3577
+ return { line: 1, column: 1 };
3578
+ }
3579
+ function frontmatterPolicy(bytes) {
3580
+ const split = splitPageFrontmatter(bytes, SOURCE_LIMITS.maxFrontmatterBytes);
3581
+ if (split === null) {
2385
3582
  return {
2386
3583
  grouped: false,
2387
3584
  groups: [],
2388
3585
  pagefindFalse: false,
2389
3586
  pageLayout: "docs",
2390
3587
  pageHeader: true,
3588
+ hasTitle: false,
2391
3589
  bodyOffset: 0
2392
3590
  };
2393
3591
  }
2394
- const searchEnd = Math.min(
2395
- bytes.byteLength,
2396
- openingLength + SOURCE_LIMITS.maxFrontmatterBytes
2397
- );
2398
- const bounded = boundedUtf8Decoder.decode(bytes.subarray(openingLength, searchEnd));
2399
- const closing = /(?:^|\r?\n)---[\t ]*(?:\r?\n|$)/.exec(bounded);
2400
- if (!closing) {
2401
- throw new Error(
2402
- `frontmatter closing marker was not found within ${SOURCE_LIMITS.maxFrontmatterBytes} bytes`
2403
- );
2404
- }
2405
- const block = bounded.slice(0, closing.index);
2406
- if (textEncoder3.encode(block).byteLength > SOURCE_LIMITS.maxFrontmatterBytes) {
2407
- throw new Error(`frontmatter exceeds ${SOURCE_LIMITS.maxFrontmatterBytes} bytes`);
2408
- }
2409
- const bodyOffset = openingLength + textEncoder3.encode(bounded.slice(0, closing.index + closing[0].length)).byteLength;
3592
+ const { block, bodyOffset } = split;
2410
3593
  const parsed = parse2(block, {
2411
3594
  maxAliasCount: 0,
2412
3595
  schema: "core",
@@ -2419,6 +3602,7 @@ function frontmatterPolicy(bytes) {
2419
3602
  pagefindFalse: false,
2420
3603
  pageLayout: "docs",
2421
3604
  pageHeader: true,
3605
+ hasTitle: false,
2422
3606
  bodyOffset
2423
3607
  };
2424
3608
  }
@@ -2428,28 +3612,31 @@ function frontmatterPolicy(bytes) {
2428
3612
  const record = parsed;
2429
3613
  const allowed = new Set(ADMISSIBLE_FRONTMATTER_KEYS);
2430
3614
  for (const key of Object.keys(record)) {
2431
- if (!allowed.has(key)) throw new Error(`frontmatter key is not admissible: ${key}`);
3615
+ if (!allowed.has(key)) throw new FrontmatterFieldError(key, `frontmatter key is not admissible: ${key}`);
2432
3616
  }
2433
3617
  for (const key of ["title", "description"]) {
2434
3618
  if (record[key] !== void 0 && typeof record[key] !== "string") {
2435
- throw new Error(`frontmatter ${key} must be a string`);
3619
+ throw new FrontmatterFieldError(key, `frontmatter ${key} must be a string`);
2436
3620
  }
2437
3621
  }
2438
3622
  if (record["pageLayout"] !== void 0 && !["docs", "landing"].includes(String(record["pageLayout"]))) {
2439
- throw new Error("frontmatter pageLayout must be docs or landing");
3623
+ throw new FrontmatterFieldError("pageLayout", "frontmatter pageLayout must be docs or landing");
2440
3624
  }
2441
3625
  if (record["groups"] !== void 0 && (!Array.isArray(record["groups"]) || record["groups"].some((group) => typeof group !== "string"))) {
2442
- throw new Error("frontmatter groups must be an array of strings");
3626
+ throw new FrontmatterFieldError("groups", "frontmatter groups must be an array of strings");
2443
3627
  }
2444
- for (const key of ["pagefind", "noindex", "public", "pageHeader"]) {
3628
+ if (record["lastUpdated"] !== void 0 && (typeof record["lastUpdated"] !== "string" || !isIsoDate(record["lastUpdated"]))) {
3629
+ throw new FrontmatterFieldError("lastUpdated", "frontmatter lastUpdated must be an ISO 8601 date string such as 2026-01-31");
3630
+ }
3631
+ for (const key of ["toc", "pagefind", "noindex", "public", "pageHeader"]) {
2445
3632
  if (record[key] !== void 0 && typeof record[key] !== "boolean") {
2446
- throw new Error(`frontmatter ${key} must be a boolean`);
3633
+ throw new FrontmatterFieldError(key, `frontmatter ${key} must be a boolean`);
2447
3634
  }
2448
3635
  }
2449
3636
  if (record["runbook"] !== void 0) {
2450
3637
  const problems = runbookProblems(record["runbook"]);
2451
3638
  if (problems.length > 0) {
2452
- throw new Error(`frontmatter runbook is invalid: ${problems.join(" ")}`);
3639
+ throw new FrontmatterFieldError("runbook", `frontmatter runbook is invalid: ${problems.join(" ")}`);
2453
3640
  }
2454
3641
  }
2455
3642
  return {
@@ -2458,6 +3645,7 @@ function frontmatterPolicy(bytes) {
2458
3645
  pagefindFalse: record["pagefind"] === false,
2459
3646
  pageLayout: record["pageLayout"] === "landing" ? "landing" : "docs",
2460
3647
  pageHeader: record["pageHeader"] !== false,
3648
+ hasTitle: typeof record["title"] === "string" && record["title"].trim() !== "",
2461
3649
  bodyOffset
2462
3650
  };
2463
3651
  }
@@ -2502,10 +3690,36 @@ function validateOpenApiDocument(source) {
2502
3690
  }
2503
3691
  return parseOpenApi(source);
2504
3692
  }
3693
+ var RESERVED_COMPONENT_NAMES = /* @__PURE__ */ new Set(["Badge", "Button", "Chart", "Embed", "Island", "TenantCall", "Fragment"]);
3694
+ function customerComponentRegistry(componentPaths, violations) {
3695
+ const builtIns = new Set(pageSourceComponents().map((component) => component.name));
3696
+ const owners = /* @__PURE__ */ new Map();
3697
+ const names = /* @__PURE__ */ new Set();
3698
+ for (const path of [...componentPaths].sort()) {
3699
+ const name = componentNameFromPath(path);
3700
+ if (name === null) continue;
3701
+ const owner = owners.get(name);
3702
+ if (owner !== void 0) {
3703
+ addViolation2(violations, path, "component_name_conflict", `components/${name} is defined twice (${owner} and ${path}); keep one file`);
3704
+ continue;
3705
+ }
3706
+ owners.set(name, path);
3707
+ if (builtIns.has(name) || RESERVED_COMPONENT_NAMES.has(name)) {
3708
+ addViolation2(violations, path, "component_name_conflict", `${name} is a built-in component name; rename ${path}`);
3709
+ continue;
3710
+ }
3711
+ names.add(name);
3712
+ }
3713
+ return names;
3714
+ }
3715
+ function registryKey(components) {
3716
+ return [...components].sort().join(",");
3717
+ }
2505
3718
  function prepareSemanticValidation(input) {
2506
3719
  const violations = [];
3720
+ const components = customerComponentRegistry(input.componentPaths ?? [], violations);
2507
3721
  const config = parseDocsJson(input.docsJson, violations);
2508
- if (config === null) return { config, pagePaths: [], pagePathSet: /* @__PURE__ */ new Set(), violations };
3722
+ if (config === null) return { config, pagePaths: [], pagePathSet: /* @__PURE__ */ new Set(), components, violations };
2509
3723
  if (input.modelsToml !== void 0) {
2510
3724
  const source = decodeUtf8(
2511
3725
  input.modelsToml,
@@ -2536,13 +3750,21 @@ function prepareSemanticValidation(input) {
2536
3750
  }
2537
3751
  pagePathSet.add(path);
2538
3752
  }
2539
- return { config, pagePaths, pagePathSet, violations };
3753
+ return { config, pagePaths, pagePathSet, components, violations };
2540
3754
  }
2541
- function validatePageBytes(path, bytes, violations) {
3755
+ function validatePageBytes(path, bytes, violations, mode = "first", components = /* @__PURE__ */ new Set()) {
2542
3756
  const source = decodeUtf8(bytes, path, violations);
2543
3757
  if (source === null) return [];
2544
3758
  try {
2545
3759
  const policy = frontmatterPolicy(bytes);
3760
+ if (!policy.hasTitle) {
3761
+ addViolation2(
3762
+ violations,
3763
+ path,
3764
+ "missing_title",
3765
+ 'page has no title: add "title: <page title>" to the frontmatter between --- lines at the top of the page'
3766
+ );
3767
+ }
2546
3768
  if (policy.grouped && !policy.pagefindFalse) {
2547
3769
  addViolation2(
2548
3770
  violations,
@@ -2551,14 +3773,31 @@ function validatePageBytes(path, bytes, violations) {
2551
3773
  "grouped pages must set pagefind: false"
2552
3774
  );
2553
3775
  }
3776
+ if (components.size > 0 && bytes[policy.bodyOffset] === 239 && bytes[policy.bodyOffset + 1] === 187 && bytes[policy.bodyOffset + 2] === 191) {
3777
+ addViolation2(violations, path, "inadmissible_page_content", "remove the byte order mark at the start of the page body");
3778
+ }
2554
3779
  const body = fatalUtf8Decoder.decode(bytes.subarray(policy.bodyOffset));
2555
- const pageIssue = validatePageSource(path, body, {
2556
- allowLevelOneHeading: policy.pageLayout === "landing" || !policy.pageHeader
2557
- });
2558
- if (pageIssue !== null) addViolation2(violations, path, pageIssue.code, pageIssue.message);
3780
+ const sourcePolicy = {
3781
+ allowLevelOneHeading: policy.pageLayout === "landing" || !policy.pageHeader,
3782
+ lineOffset: bytes.subarray(0, policy.bodyOffset).reduce((lines, byte) => lines + (byte === 10 ? 1 : 0), 0),
3783
+ components
3784
+ };
3785
+ if (mode === "all") {
3786
+ const issues = validatePageSourceAll(path, body, sourcePolicy, PAGE_ISSUE_LIMIT + 1);
3787
+ for (const found of issues.slice(0, PAGE_ISSUE_LIMIT)) {
3788
+ violations.push({ path, code: found.code, severity: "error", message: found.message, line: found.line, column: found.column, fix: found.fix });
3789
+ }
3790
+ if (issues.length > PAGE_ISSUE_LIMIT) {
3791
+ addViolation2(violations, path, "page_issue_limit", `reported the first ${PAGE_ISSUE_LIMIT} issues in this page; fix them and validate again`);
3792
+ }
3793
+ } else {
3794
+ const pageIssue = validatePageSource(path, body, sourcePolicy);
3795
+ if (pageIssue !== null) addViolation2(violations, path, pageIssue.code, pageIssue.message);
3796
+ }
2559
3797
  return policy.groups;
2560
3798
  } catch (error) {
2561
- addViolation2(violations, path, "invalid_frontmatter", errorMessage2(error));
3799
+ const place = mode === "all" ? frontmatterLocation(bytes, error) : void 0;
3800
+ violations.push({ path, code: "invalid_frontmatter", severity: "error", message: errorMessage2(error), ...place });
2562
3801
  return [];
2563
3802
  }
2564
3803
  }
@@ -2640,6 +3879,12 @@ function validateOpenApiBytes(path, bytes, violations) {
2640
3879
  return null;
2641
3880
  }
2642
3881
  }
3882
+ function navigationIconAssets(config) {
3883
+ return navigationIconRefs(config).filter((ref) => ref.icon.startsWith("/")).map((ref) => ({ ...ref, path: `public${ref.icon}` }));
3884
+ }
3885
+ function missingNavigationIcon(asset, violations, place) {
3886
+ violations.push({ path: "docs.json", code: "missing_navigation_icon", severity: "error", message: `navigation icon ${asset.icon} on ${asset.owner} has no file at ${asset.path}`, ...place });
3887
+ }
2643
3888
  function validateBundleSemantics(input) {
2644
3889
  const prepared = prepareSemanticValidation(input);
2645
3890
  if (!prepared.config) return sortViolations(prepared.violations);
@@ -2652,7 +3897,7 @@ function validateBundleSemantics(input) {
2652
3897
  continue;
2653
3898
  }
2654
3899
  if (read.bytes === null) continue;
2655
- groupsByPath.set(path, validatePageBytes(path, read.bytes, prepared.violations));
3900
+ groupsByPath.set(path, validatePageBytes(path, read.bytes, prepared.violations, input.pageIssues, prepared.components));
2656
3901
  }
2657
3902
  validateNavigation(prepared.config, prepared);
2658
3903
  const operationSlugsBySpec = /* @__PURE__ */ new Map();
@@ -2666,6 +3911,9 @@ function validateBundleSemantics(input) {
2666
3911
  const slugs = validateOpenApiBytes(path, read.bytes, prepared.violations);
2667
3912
  if (slugs !== null) operationSlugsBySpec.set(path, slugs);
2668
3913
  }
3914
+ for (const asset of navigationIconAssets(prepared.config)) {
3915
+ if (!readSemanticFile(input, asset.path, prepared.violations).present) missingNavigationIcon(asset, prepared.violations);
3916
+ }
2669
3917
  validateBuildRequirements({
2670
3918
  config: prepared.config,
2671
3919
  pages: buildRequirementPages(prepared.config, groupsByPath),
@@ -2674,19 +3922,35 @@ function validateBundleSemantics(input) {
2674
3922
  }, prepared.violations);
2675
3923
  return sortViolations(prepared.violations);
2676
3924
  }
3925
+ function validatePageCached(path, bytes, violations, mode, cache, components) {
3926
+ if (cache === void 0) return validatePageBytes(path, bytes, violations, mode, components);
3927
+ const key = registryKey(components);
3928
+ const hit = cache.get(path);
3929
+ if (hit !== void 0 && hit.bytes === bytes && hit.mode === mode && hit.components === key) {
3930
+ violations.push(...hit.violations);
3931
+ return hit.groups;
3932
+ }
3933
+ const own = [];
3934
+ const groups = validatePageBytes(path, bytes, own, mode, components);
3935
+ cache.set(path, { bytes, mode, components: key, violations: own, groups });
3936
+ violations.push(...own);
3937
+ return groups;
3938
+ }
2677
3939
  async function validateBundleSemanticsAsync(input) {
2678
3940
  const prepared = prepareSemanticValidation(input);
2679
3941
  if (!prepared.config) return sortViolations(prepared.violations);
2680
3942
  const groupsByPath = /* @__PURE__ */ new Map();
3943
+ const pool = new BoundedPool(R2_CONCURRENCY, R2_BYTE_BUDGET);
2681
3944
  for (const path of prepared.pagePaths) {
2682
3945
  if (!prepared.pagePathSet.has(path)) continue;
2683
- const read = await readSemanticFileAsync(input, path, prepared.violations);
2684
- if (!read.present) {
2685
- addViolation2(prepared.violations, path, "read_error", "listed page source is missing");
2686
- continue;
2687
- }
2688
- if (read.bytes !== null) groupsByPath.set(path, validatePageBytes(path, read.bytes, prepared.violations));
2689
- }
3946
+ await pool.add(async () => {
3947
+ const read = await readSemanticFileAsync(input, path, prepared.violations);
3948
+ if (!read.present) addViolation2(prepared.violations, path, "read_error", "listed page source is missing");
3949
+ else if (read.bytes !== null) groupsByPath.set(path, validatePageCached(path, read.bytes, prepared.violations, input.pageIssues ?? "first", input.pageCache, prepared.components));
3950
+ }, input.sizeOf?.(path) ?? SOURCE_LIMITS.maxFileBytes);
3951
+ }
3952
+ await pool.drain();
3953
+ if (pool.error !== void 0) throw pool.error;
2690
3954
  validateNavigation(prepared.config, prepared);
2691
3955
  const operationSlugsBySpec = /* @__PURE__ */ new Map();
2692
3956
  for (const path of openApiPaths(prepared.config, prepared.violations)) {
@@ -2698,6 +3962,9 @@ async function validateBundleSemanticsAsync(input) {
2698
3962
  const slugs = read.bytes === null ? null : validateOpenApiBytes(path, read.bytes, prepared.violations);
2699
3963
  if (slugs !== null) operationSlugsBySpec.set(path, slugs);
2700
3964
  }
3965
+ for (const asset of navigationIconAssets(prepared.config)) {
3966
+ if (!(await readSemanticFileAsync(input, asset.path, prepared.violations)).present) missingNavigationIcon(asset, prepared.violations, input.configLocation?.(asset.keys));
3967
+ }
2701
3968
  validateBuildRequirements({
2702
3969
  config: prepared.config,
2703
3970
  pages: buildRequirementPages(prepared.config, groupsByPath),
@@ -2713,6 +3980,9 @@ var VIOLATION_GUIDANCE = Object.freeze({
2713
3980
  requirement: `The source archive could not be read safely. The whole repository, not only the docs folder, must hold only regular files and folders: no symbolic links, hard links, or device files. The docs folder must also stay within ${SOURCE_LIMITS.maxFileCount} files and ${SOURCE_LIMITS.maxTotalBytes / MIB} MiB. Exclude a link you need to keep with export-ignore in .gitattributes.`,
2714
3981
  example: "tools/current export-ignore (a line in .gitattributes at the repository root)"
2715
3982
  },
3983
+ component_file_too_large: { requirement: "Reduce each component file to 256 KiB or less." },
3984
+ too_many_component_files: { requirement: "Keep at most 50 files under components/." },
3985
+ component_files_too_large: { requirement: "Reduce the component directory to 2 MiB or less." },
2716
3986
  build_failed: {
2717
3987
  requirement: "The documentation build stopped on this error after the source passed validation. Fix the file or setting the message names, then push the change again."
2718
3988
  },
@@ -2742,12 +4012,16 @@ var VIOLATION_GUIDANCE = Object.freeze({
2742
4012
  theme_css_too_large: {
2743
4013
  requirement: `public/theme.css can be at most ${SOURCE_LIMITS.maxThemeCssBytes / KIB} KiB. Remove unused rules.`
2744
4014
  },
4015
+ component_name_conflict: {
4016
+ requirement: "Each customer component needs one file whose name is not a built-in component name. Keep either the .jsx or the .tsx file, and rename a component that shares a name with a built-in component such as Card or Tabs.",
4017
+ example: "components/PricingCard.tsx (not components/Card.tsx)"
4018
+ },
2745
4019
  inadmissible_type: {
2746
4020
  requirement: "This file type is not allowed in this folder. Pages are .md or .mdx under pages/, API specs are .json, .yaml, or .yml under openapi/, and images, fonts, media, and CSS go under public/.",
2747
4021
  example: "public/logo.png (not pages/logo.png)"
2748
4022
  },
2749
4023
  unknown_root: {
2750
- requirement: "Only docs.json, models.toml, and the pages/, public/, and openapi/ folders are read. Move the file into one of those folders or delete it.",
4024
+ requirement: "Only docs.json, models.toml, and the pages/, public/, components/, and openapi/ folders are read. Move the file into one of those folders or delete it.",
2751
4025
  example: "pages/guides/install.mdx (not guides/install.mdx)"
2752
4026
  },
2753
4027
  generated_artifact: {
@@ -2826,14 +4100,21 @@ var VIOLATION_GUIDANCE = Object.freeze({
2826
4100
  requirement: "A standard page gets its top heading from the frontmatter title. Remove the # heading, or set pageHeader: false if the page writes its own.",
2827
4101
  example: "---\ntitle: Quickstart\n---\n\n## Install"
2828
4102
  },
4103
+ page_issue_limit: {
4104
+ requirement: `Local validation stops listing a page's issues after ${PAGE_ISSUE_LIMIT}. Fix the listed issues, then run validate again to see the rest.`
4105
+ },
2829
4106
  pagefind_required: {
2830
4107
  requirement: "A page restricted to reader groups must be left out of search, so its text never appears in results for other readers.",
2831
4108
  example: "---\ntitle: Internal runbook\ngroups: [staff]\npagefind: false\n---"
2832
4109
  },
2833
4110
  invalid_frontmatter: {
2834
- requirement: "Frontmatter must be a YAML block between --- lines using only title, description, pageLayout, groups, pagefind, noindex, public, pageHeader, and runbook.",
4111
+ requirement: "Frontmatter must be a YAML block between --- lines using only title, description, lastUpdated, pageLayout, toc, groups, pagefind, noindex, public, pageHeader, and runbook. toc, pagefind, noindex, public, and pageHeader take true or false; lastUpdated takes a date such as 2026-01-31.",
2835
4112
  example: "---\ntitle: Quickstart\ndescription: Install and run your first build.\n---"
2836
4113
  },
4114
+ missing_title: {
4115
+ requirement: "Every page needs a non-empty title in its frontmatter. The site shows it as the page heading and in navigation and search.",
4116
+ example: "---\ntitle: Quickstart\n---"
4117
+ },
2837
4118
  invalid_navigation_path: {
2838
4119
  requirement: "Navigation entries in docs.json name a page by its path under pages/, without the extension or a leading slash.",
2839
4120
  example: '"pages": ["guides/install"] (not "/pages/guides/install.mdx")'
@@ -2855,7 +4136,7 @@ var VIOLATION_GUIDANCE = Object.freeze({
2855
4136
  example: "groups: [staff] (reuse an existing group instead of adding a fifth)"
2856
4137
  },
2857
4138
  unreferenced_page: {
2858
- requirement: "Every page file must be listed in docs.json navigation. Add the page to a group, or delete the file.",
4139
+ requirement: "Every page file must be listed in docs.json navigation. Add the page to a group's pages or make it a group's root, or delete the file.",
2859
4140
  example: '{ "group": "Guides", "pages": ["quickstart", "guides/install"] }'
2860
4141
  },
2861
4142
  invalid_openapi_path: {
@@ -2868,6 +4149,10 @@ var VIOLATION_GUIDANCE = Object.freeze({
2868
4149
  },
2869
4150
  missing_openapi: {
2870
4151
  requirement: "docs.json points a group at an OpenAPI file that does not exist. Add the file or correct the path."
4152
+ },
4153
+ missing_navigation_icon: {
4154
+ requirement: "A navigation icon that starts with / names a file under public/. Add the file, correct the path, or use an icon name.",
4155
+ example: '"icon": "/logo/acme.svg" needs public/logo/acme.svg'
2871
4156
  }
2872
4157
  });
2873
4158
  function violationGuidance(code) {
@@ -2875,6 +4160,29 @@ function violationGuidance(code) {
2875
4160
  }
2876
4161
  var SELF_CONTRADICTING_COUNT = "self_contradicting_count";
2877
4162
  var INCONSISTENT_VALUE_LIST = "inconsistent_value_list";
4163
+ var FOREIGN_SYNTAX = "foreign_syntax";
4164
+ var FOREIGN_PATTERNS = [
4165
+ { pattern: /^\s{0,3}:{3,}(?:\s*[A-Za-z][\w-]*)?(?:\s.*)?$/, what: "a Docusaurus or VitePress admonition fence (:::)", fix: "use <Note>, <Tip>, <Warning>, <Info>, or <Danger>" },
4166
+ { pattern: /\{%-?\s*[A-Za-z]/, what: "a Liquid or GitBook tag ({% %})", fix: "use the matching component, such as <Tabs> or <Note>, or remove the tag" },
4167
+ { pattern: /^\s{0,3}===\s+"/, what: 'an MkDocs content tab (=== "...")', fix: "use <Tabs> with one <Tab> per tab" },
4168
+ { pattern: /^\s{0,3}(?:!!!|\?\?\?\+?)\s+[A-Za-z]/, what: "an MkDocs admonition (!!! or ???)", fix: "use <Note>, <Tip>, or <Warning>, or <Accordion> for a collapsible block" },
4169
+ { pattern: /\[block:[a-z-]+\]|\[\/block\]/, what: "a ReadMe block ([block:...])", fix: "convert the block to Markdown or the matching component" },
4170
+ { pattern: /\{\{[<%]/, what: "a Hugo shortcode ({{< >}})", fix: "convert the shortcode to Markdown or the matching component" }
4171
+ ];
4172
+ function foreignSyntaxRules(lines) {
4173
+ const findings = [];
4174
+ lines.forEach((line, index) => {
4175
+ const match = FOREIGN_PATTERNS.find((entry) => entry.pattern.test(line));
4176
+ if (match === void 0) return;
4177
+ findings.push({
4178
+ severity: "error",
4179
+ line: index + 1,
4180
+ rule: FOREIGN_SYNTAX,
4181
+ message: `Line ${index + 1} has ${match.what}, which readers see as literal text. Fix: ${match.fix}.`
4182
+ });
4183
+ });
4184
+ return findings;
4185
+ }
2878
4186
  var COUNT_WORDS = /* @__PURE__ */ new Map([
2879
4187
  ["one", 1],
2880
4188
  ["two", 2],
@@ -3085,7 +4393,7 @@ function lintContent(path, text) {
3085
4393
  const lines = blankNonProse(text);
3086
4394
  const hidden = text.split("\n").map((original, index) => original.trim() !== "" && lines[index].trim() === "");
3087
4395
  const page = { lines, headings: headingsOf(lines), hidden };
3088
- const findings = [...countRules(path, page), ...valueListRules(path, lines)];
4396
+ const findings = [...foreignSyntaxRules(lines), ...countRules(path, page), ...valueListRules(path, lines)];
3089
4397
  findings.sort((left, right) => left.line - right.line);
3090
4398
  return findings.slice(0, MAX_FINDINGS);
3091
4399
  }
@@ -3519,6 +4827,14 @@ var KNOWN_PITFALLS = [
3519
4827
  context: { mentions: ["saturndocs"] },
3520
4828
  source: "AGENTS.md",
3521
4829
  verified_by: "connected-callback-mount: mounting on astro:page-load is clear"
4830
+ },
4831
+ {
4832
+ id: "bare-ip-link",
4833
+ wrong: "\\]\\(\\s*https?://\\d{1,3}(?:\\.\\d{1,3}){3}(?=[:/?#)\\s])",
4834
+ correct: "An IP address a reader allowlists is not a page to visit. Write it as code -- `44.253.178.186` -- and link only to a real hostname that serves something.",
4835
+ context: {},
4836
+ source: "#834",
4837
+ verified_by: "bare-ip-link: an IP address written as code beside a hostname link is clear"
3522
4838
  }
3523
4839
  ];
3524
4840
  var compiled = /* @__PURE__ */ new WeakMap();
@@ -3574,14 +4890,14 @@ function checkPitfalls(pages, catalog = KNOWN_PITFALLS) {
3574
4890
  }
3575
4891
  return violations;
3576
4892
  }
3577
- var encoder = new TextEncoder();
4893
+ var encoder2 = new TextEncoder();
3578
4894
  var TAR_BLOCK_SIZE = 512;
3579
4895
  var TAR_TRAILER_SIZE = 1024;
3580
4896
  function tarPadding(size) {
3581
4897
  return (TAR_BLOCK_SIZE - size % TAR_BLOCK_SIZE) % TAR_BLOCK_SIZE;
3582
4898
  }
3583
4899
  function writeText(target, offset, length, value) {
3584
- target.set(encoder.encode(value).subarray(0, length), offset);
4900
+ target.set(encoder2.encode(value).subarray(0, length), offset);
3585
4901
  }
3586
4902
  function octal(value, length) {
3587
4903
  return `${value.toString(8).padStart(length - 1, "0")}\0`;
@@ -3603,10 +4919,10 @@ function tarHeader(name, size, options = {}) {
3603
4919
  return header;
3604
4920
  }
3605
4921
  function paxRecord(key, value) {
3606
- let length = encoder.encode(`${key}=${value}
4922
+ let length = encoder2.encode(`${key}=${value}
3607
4923
  `).byteLength + 3;
3608
4924
  for (; ; ) {
3609
- const record = encoder.encode(`${length} ${key}=${value}
4925
+ const record = encoder2.encode(`${length} ${key}=${value}
3610
4926
  `);
3611
4927
  if (record.byteLength === length) return record;
3612
4928
  length = record.byteLength;
@@ -3620,9 +4936,9 @@ function isCheckable(href) {
3620
4936
  if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return false;
3621
4937
  if (href.startsWith("//")) return false;
3622
4938
  if (href.startsWith("{")) return false;
3623
- const withoutFragment = href.split("#")[0] ?? "";
3624
- if (withoutFragment === "") return false;
3625
- return !/\.[a-z0-9]{1,8}$/i.test(withoutFragment);
4939
+ const pathname = href.split(/[?#]/, 1)[0] ?? "";
4940
+ if (pathname === "") return false;
4941
+ return !/\.[a-z0-9]{1,8}$/i.test(pathname);
3626
4942
  }
3627
4943
  function resolveHref(href, fromDocId) {
3628
4944
  const target = (href.split("#")[0] ?? "").split("?")[0] ?? "";
@@ -3752,6 +5068,7 @@ function contentContract() {
3752
5068
  return {
3753
5069
  abi_version: SOURCE_ABI_VERSION,
3754
5070
  roots: SOURCE_ALLOWED_ROOTS,
5071
+ ignored_files: SOURCE_IGNORED_FILES,
3755
5072
  extensions: SOURCE_ALLOWED_EXTENSIONS,
3756
5073
  limits: SOURCE_LIMITS,
3757
5074
  frontmatter: { keys: [...ADMISSIBLE_FRONTMATTER_KEYS], page_layouts: ["docs", "landing"] },
@@ -3761,24 +5078,36 @@ function contentContract() {
3761
5078
  }
3762
5079
 
3763
5080
  export {
5081
+ stripPage,
3764
5082
  SOURCE_ABI_VERSION,
3765
5083
  SOURCE_LIMITS,
3766
5084
  SOURCE_ALLOWED_ROOTS,
5085
+ SOURCE_IGNORED_FILES,
3767
5086
  SOURCE_ALLOWED_EXTENSIONS,
3768
5087
  RESERVED_URL_PREFIXES,
3769
5088
  REJECTED_GENERATED_ROOTS,
3770
5089
  REJECTED_GENERATED_FILENAMES,
3771
5090
  SOURCE_MEDIA_TYPES,
5091
+ PAGE_ISSUE_LIMIT,
5092
+ isIgnoredSourceFile,
3772
5093
  canonicalizeSourcePath,
3773
5094
  detectSourceMediaType,
5095
+ R2_CONCURRENCY,
5096
+ R2_BYTE_BUDGET,
5097
+ mapBounded,
5098
+ BoundedPool,
3774
5099
  GIT_COMMIT_PATTERN,
3775
5100
  blobId,
3776
5101
  canonicalizeRevisionManifest,
3777
5102
  revisionId,
3778
5103
  SourceAbiError,
3779
5104
  applyChangeSet,
5105
+ isReservedRoute,
3780
5106
  validateBundleStructure,
5107
+ parsePageBody,
5108
+ pageAssetReferences,
3781
5109
  validatePageSource,
5110
+ validatePageSourceAll,
3782
5111
  pageSourceComponents,
3783
5112
  RUNBOOK_MIN_STEPS,
3784
5113
  RUNBOOK_MAX_STEPS,
@@ -3786,12 +5115,16 @@ export {
3786
5115
  RUNBOOK_TARGETS,
3787
5116
  runbookProblems,
3788
5117
  ADMISSIBLE_FRONTMATTER_KEYS,
5118
+ frontmatterPolicy,
5119
+ customerComponentRegistry,
5120
+ validatePageBytes,
3789
5121
  validateBundleSemantics,
3790
5122
  validateBundleSemanticsAsync,
3791
5123
  VIOLATION_GUIDANCE,
3792
5124
  violationGuidance,
3793
5125
  SELF_CONTRADICTING_COUNT,
3794
5126
  INCONSISTENT_VALUE_LIST,
5127
+ FOREIGN_SYNTAX,
3795
5128
  blankNonProse,
3796
5129
  headingsOf,
3797
5130
  lintContent,