@taprootio/site-authoring 0.55.0 → 0.59.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 (65) hide show
  1. package/README.md +91 -22
  2. package/package.json +2 -2
  3. package/src/api.js +90 -17
  4. package/src/authors-contract.js +71 -3
  5. package/src/block-flow.js +4 -2
  6. package/src/changelog.json +104 -0
  7. package/src/chrome-additions.js +106 -0
  8. package/src/chrome-features.js +43 -10
  9. package/src/chrome-input.js +137 -30
  10. package/src/chrome-report.js +4 -2
  11. package/src/cli.js +144 -38
  12. package/src/constants.js +1 -0
  13. package/src/content/button-styles.js +27 -0
  14. package/src/content/components.js +76 -10
  15. package/src/content/free-form-section-registry.json +9 -0
  16. package/src/content/free-form-sections.js +55 -16
  17. package/src/content/markdown.js +133 -56
  18. package/src/content/media-presentation.js +37 -0
  19. package/src/content/tiptap-prosemirror.ts +26 -10
  20. package/src/credentials.js +2 -1
  21. package/src/delivery-check.js +10 -2
  22. package/src/font-catalog.js +9 -6
  23. package/src/footer-content.js +1 -1
  24. package/src/footer-contract.js +3 -0
  25. package/src/footer-draft-hash.js +1 -0
  26. package/src/heading-outline.js +94 -6
  27. package/src/image-description-contract.js +5 -3
  28. package/src/image-description-write.js +26 -0
  29. package/src/index.js +1 -0
  30. package/src/output.js +2 -1
  31. package/src/page-metadata.js +15 -13
  32. package/src/page-structure-checks.js +14 -25
  33. package/src/placed-image-ids.js +42 -17
  34. package/src/presentation-reference.js +63 -18
  35. package/src/problems.js +147 -4
  36. package/src/reference-help.js +122 -60
  37. package/src/site-check-findings.js +2 -3
  38. package/src/site-check-rules.json +0 -1
  39. package/src/site-health-findings.js +7 -9
  40. package/src/site-health-image-checks.js +4 -1
  41. package/src/site-health-precheck.js +23 -6
  42. package/src/site-navigation-groups.js +16 -0
  43. package/src/status-warning-paints.js +175 -0
  44. package/src/template-token-reach.json +13 -18
  45. package/src/theme-proposals.js +143 -55
  46. package/src/theme-resolve.js +14 -1
  47. package/src/theme-validation.js +70 -38
  48. package/src/token-reach.js +20 -0
  49. package/src/typed-page-reference.js +25 -3
  50. package/src/typed-pages.js +73 -14
  51. package/src/verbs/authors.js +198 -33
  52. package/src/verbs/changelog.js +23 -2
  53. package/src/verbs/delivery-check.js +43 -9
  54. package/src/verbs/index.js +4 -2
  55. package/src/verbs/media-images.js +4 -4
  56. package/src/verbs/pages-push.js +138 -67
  57. package/src/verbs/plan.js +28 -20
  58. package/src/verbs/pull.js +226 -26
  59. package/src/verbs/theme-push.js +59 -15
  60. package/src/verbs/theme-resolve.js +109 -11
  61. package/src/verbs/validate.js +97 -16
  62. package/src/workspace-check.js +4 -4
  63. package/src/workspace-context-usage.js +180 -0
  64. package/src/workspace.js +48 -1
  65. package/test/fixtures/default-site-theme.json +1 -1
package/src/workspace.js CHANGED
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
 
6
6
  import { atomicWriteFile } from "./atomic-file.js";
7
7
  import { AUTHORED_TAG_SLUG, MAX_AUTHORED_TAG_NAME_SCALARS, MAX_AUTHORED_TAGS } from "./authored-tag-names.js";
8
- import { parseAuthorReference } from "./authors-contract.js";
8
+ import { normalizeAuthorHandle, parseAuthorReference } from "./authors-contract.js";
9
9
  import { LIMITS } from "./constants.js";
10
10
  import { hasAsciiControl, sanitizeDiagnostic, SiteAuthoringError } from "./errors.js";
11
11
  import { isSystemPageTypeTag } from "./page-type-tags.js";
@@ -264,6 +264,8 @@ export async function readObservedPageRecord(workspaceDir, pageId) {
264
264
  // The date the refusal showed, for a typed page. A date edit does not move
265
265
  // the revision, so the record has to name it to say what was seen.
266
266
  displayDate: normalizeBaselineDisplayDate(parsed.displayDate),
267
+ displayAuthor: normalizeBaselineDisplayAuthor(parsed.displayAuthor),
268
+ showOnProfile: normalizeBaselineShowOnProfile(parsed.showOnProfile),
267
269
  differences: normalizeObservedDifferences(parsed.differences),
268
270
  };
269
271
  }
@@ -421,6 +423,19 @@ function normalizeBaselineDisplayDate(value) {
421
423
  return typeof value === "string" && (value === "" || /^\d{4}-\d{2}-\d{2}$/u.test(value)) ? value : undefined;
422
424
  }
423
425
 
426
+ // A site author's handle or "" (no display author). Anything else is a damaged
427
+ // baseline member, and a baseline written before TR01402 has none: it counts as
428
+ // not having seen the value.
429
+ function normalizeBaselineDisplayAuthor(value) {
430
+ return value === "" || (typeof value === "string" && normalizeAuthorHandle(value) === value) ? value : undefined;
431
+ }
432
+
433
+ // A boolean (TR01403). A baseline written before showOnProfile existed has
434
+ // none: it counts as not having seen the value.
435
+ function normalizeBaselineShowOnProfile(value) {
436
+ return typeof value === "boolean" ? value : undefined;
437
+ }
438
+
424
439
  /**
425
440
  * Whether a manifest entry names a file `walkWorkspaceFiles` could have
426
441
  * produced: under `pages/`, bounded, and every segment in the workspace
@@ -492,10 +507,13 @@ export function pageSourceRegistry(manifest) {
492
507
  const contentKey = normalizeBaselineHash(declared?.contentKey);
493
508
  const revision = normalizePageBodyRevision(declared?.revision);
494
509
  const displayDate = normalizeBaselineDisplayDate(declared?.displayDate);
510
+ const displayAuthor = normalizeBaselineDisplayAuthor(declared?.displayAuthor);
511
+ const showOnProfile = normalizeBaselineShowOnProfile(declared?.showOnProfile);
495
512
  const author = normalizeAuthorValue(declared?.author);
496
513
  const tagBaseline = normalizeAuthoredTagBaseline(declared);
497
514
  const baseline =
498
515
  remoteHash === undefined && sourceHash === undefined && revision === undefined && displayDate === undefined
516
+ && displayAuthor === undefined && showOnProfile === undefined
499
517
  && sourceBodyHash === undefined && contentKey === undefined && author === undefined && tagBaseline === undefined
500
518
  ? undefined
501
519
  : {
@@ -505,6 +523,8 @@ export function pageSourceRegistry(manifest) {
505
523
  ...(contentKey === undefined ? {} : { contentKey }),
506
524
  ...(revision === undefined ? {} : { revision }),
507
525
  ...(displayDate === undefined ? {} : { displayDate }),
526
+ ...(displayAuthor === undefined ? {} : { displayAuthor }),
527
+ ...(showOnProfile === undefined ? {} : { showOnProfile }),
508
528
  // The author the site held for the page when this workspace last
509
529
  // reconciled with it: what a page's own author reference is
510
530
  // compared with before anything is sent (TR01196).
@@ -1133,6 +1153,18 @@ export async function workspaceDirectoryExists(workspaceDir, relativePath) {
1133
1153
  return await requireRealDirectoryChain(workspaceDir, relativePath, { includeLeaf: true });
1134
1154
  }
1135
1155
 
1156
+ /**
1157
+ * The manifest's retired generated sources by file: the entries a push and the context-usage reader both set aside.
1158
+ * An entry needs a string `file` and `path`, so one predicate decides what is retired everywhere.
1159
+ */
1160
+ export function retiredSourcesByFile(manifest) {
1161
+ return new Map(
1162
+ (Array.isArray(manifest?.retiredGeneratedSources) ? manifest.retiredGeneratedSources : [])
1163
+ .filter((entry) => typeof entry?.file === "string" && typeof entry?.path === "string")
1164
+ .map((entry) => [entry.file, entry]),
1165
+ );
1166
+ }
1167
+
1136
1168
  /**
1137
1169
  * Collects the workspace files a push verb should consider, in a stable sorted
1138
1170
  * order so two runs of the same workspace produce the same request sequence.
@@ -1459,6 +1491,21 @@ export async function readMediaManifest(workspaceDir, expectedSiteId) {
1459
1491
  };
1460
1492
  }
1461
1493
 
1494
+ /**
1495
+ * The candidate keys a Markdown image reference could match in the media
1496
+ * manifest. Authors write `./media/hero.png`, `media/hero.png`, or
1497
+ * `/media/hero.png` for the same file, and a resolver that accepted only one
1498
+ * spelling would refuse content that is plainly correct.
1499
+ */
1500
+ export function mediaReferenceCandidates(reference) {
1501
+ if (typeof reference !== "string" || reference === "") return [];
1502
+ const withoutQuery = reference.split("#")[0].split("?")[0];
1503
+ const stripped = withoutQuery.replace(/^\.\//u, "").replace(/^\/+/u, "");
1504
+ const candidates = new Set([reference, withoutQuery, stripped]);
1505
+ if (!stripped.includes("/")) candidates.add(`media/${stripped}`);
1506
+ return [...candidates];
1507
+ }
1508
+
1462
1509
  /** The alt text a media record keeps when its file is uploaded again: the author's own, or none. */
1463
1510
  export function recordedAlt(entry) {
1464
1511
  return typeof entry?.alt === "string" ? entry.alt : "";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$generated": "Generated by scripts/build-default-site-theme.mjs from @taprootio/espalier. Do not edit by hand — run `npm run theme:build`.",
3
- "espalierVersion": "7.5.0",
3
+ "espalierVersion": "7.8.0",
4
4
  "light": {
5
5
  "encoded": "eyJzZWVkQ29sb3IiOiJva2xjaCguMDcgMC4xNSAyMTYpIiwiZm9udEJvZHkiOiJcIk5vdG8gU2Fuc1wiLCBzYW5zLXNlcmlmIiwiZm9udEhlYWRpbmdzIjoiXCJJbmlrYVwiLCBzZXJpZiIsImZvbnRCcmFuZCI6IlwiSW5pa2FcIiwgc2VyaWYiLCJmb250TWVudSI6IiIsImZvbnRNb25vc3BhY2UiOiJcIkpldEJyYWlucyBNb25vXCIsIG1vbm9zcGFjZSIsImZvbnRXZWlnaHRCb2R5Ijoibm9ybWFsIiwiZm9udFdlaWdodEhlYWRpbmdzIjoibm9ybWFsIiwiZm9udFdlaWdodEJyYW5kIjoibm9ybWFsIiwiZm9udFdlaWdodE1lbnUiOiJib2xkIiwiZm9udFdlaWdodE1vbm9zcGFjZSI6Im5vcm1hbCIsInN0eWxlc2hlZXRzIjpbXSwicm9vdEZvbnRTaXplIjoxNiwidHlwZVJhdGlvIjoxLjI1LCJzcGFjZVJhdGlvIjoxLjYxOCwiYm9yZGVyUmFkaXVzIjowLjEsInZpZXdwb3J0TWluIjozMjAsInZpZXdwb3J0TWF4IjoxMjAwLCJhbmdsZXMiOnsiYW5hbG9nb3VzIjozMCwiY29tcGxlbWVudGFyeSI6MTgwLCJzcGxpdENvbXBsZW1lbnRhcnkiOjMwLCJ0cmlhZGljIjoxMjB9LCJzZW1hbnRpY0h1ZXMiOnsiZGFuZ2VyIjoyNywic3VjY2VzcyI6MTUwLCJ3YXJuaW5nIjo5MCwiaW5mbyI6MjQ0fSwidmFyaWFudENocm9tYSI6e30sImludGVudHMiOnt9LCJ0b25lcyI6e30sImNocm9tYSI6eyJiYWNrZ3JvdW5kIjp7Im1pbiI6MCwibWF4IjowLjR9LCJsYXllcjEiOnsibWluIjowLCJtY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