@marktiderman/genesis-sites 0.7.6 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +202 -19
- package/SKILL.md +15 -0
- package/dist/analytics.d.ts +184 -0
- package/dist/analytics.js +3 -0
- package/dist/analytics.js.map +1 -0
- package/dist/assets/form-island.da6c662a73.js +51 -0
- package/dist/assets/islands.399b13ea6f.js +1 -0
- package/dist/assets/sites-forms.b64c156079.css +10 -0
- package/dist/assets/sites-forms.css +1 -1
- package/dist/assets/sites.2fac65f96a.css +2 -0
- package/dist/assets/sites.css +1 -1
- package/dist/assets.generated-ZBFSP23U.js +3 -0
- package/dist/{assets.generated-LLUGUUWZ.js.map → assets.generated-ZBFSP23U.js.map} +1 -1
- package/dist/blocks.js +2 -1
- package/dist/blocks.js.map +1 -1
- package/dist/chunk-5G2H6EZ2.js +19 -0
- package/dist/chunk-5G2H6EZ2.js.map +1 -0
- package/dist/chunk-5RYCQEEE.js +256 -0
- package/dist/chunk-5RYCQEEE.js.map +1 -0
- package/dist/{chunk-7E3YGYVH.js → chunk-ATRS5GSD.js} +77 -22
- package/dist/chunk-ATRS5GSD.js.map +1 -0
- package/dist/{chunk-MU2Z2C4F.js → chunk-CXBBUKGB.js} +14 -4
- package/dist/chunk-CXBBUKGB.js.map +1 -0
- package/dist/{chunk-IU6AI75R.js → chunk-QGU6FDH5.js} +413 -162
- package/dist/chunk-QGU6FDH5.js.map +1 -0
- package/dist/{chunk-SMJMXQ3T.js → chunk-SBONYMUC.js} +294 -73
- package/dist/chunk-SBONYMUC.js.map +1 -0
- package/dist/{chunk-VJ4HOFBA.js → chunk-UOKNFG5O.js} +144 -20
- package/dist/chunk-UOKNFG5O.js.map +1 -0
- package/dist/{chunk-KY4ALBVH.js → chunk-UUC5USJH.js} +58 -37
- package/dist/chunk-UUC5USJH.js.map +1 -0
- package/dist/editor.d.ts +76 -19
- package/dist/editor.js +1217 -245
- package/dist/editor.js.map +1 -1
- package/dist/handler-OR554RTS.js +11 -0
- package/dist/{handler-UMGSZY33.js.map → handler-OR554RTS.js.map} +1 -1
- package/dist/import.d.ts +3 -3
- package/dist/import.js +1 -1
- package/dist/index.d.ts +66 -11
- package/dist/index.js +4 -4
- package/dist/redirects-LcCNIJHQ.d.ts +43 -0
- package/dist/{registry-BIijndsq.d.ts → registry-Cw7NF_le.d.ts} +92 -1
- package/dist/sections.d.ts +86 -4
- package/dist/sections.js +3 -3
- package/dist/{store-BImtGmoF.d.ts → store-BNYD5NAQ.d.ts} +30 -4
- package/dist/supabase.d.ts +4 -4
- package/dist/supabase.js +4 -4
- package/dist/{templates-kA-jrnWA.d.ts → templates-DPv0OYLl.d.ts} +2 -2
- package/dist/templates.d.ts +3 -3
- package/dist/templates.js +7 -3
- package/dist/templates.js.map +1 -1
- package/dist/{theme-Cg-inpk5.d.ts → theme-HJzN2tOm.d.ts} +2 -2
- package/dist/web.d.ts +64 -18
- package/dist/web.js +7 -6
- package/migrations/0003_genesis_sites_post_dates.sql +117 -0
- package/migrations/tests/0003_genesis_sites_post_dates.test.sql +76 -0
- package/package.json +12 -4
- package/dist/assets/form-island.defb8daccc.js +0 -51
- package/dist/assets/islands.33a445f34e.js +0 -1
- package/dist/assets/sites-forms.aff23b5617.css +0 -10
- package/dist/assets/sites.5b3f64c627.css +0 -2
- package/dist/assets.generated-LLUGUUWZ.js +0 -3
- package/dist/chunk-7E3YGYVH.js.map +0 -1
- package/dist/chunk-IU6AI75R.js.map +0 -1
- package/dist/chunk-KY4ALBVH.js.map +0 -1
- package/dist/chunk-MU2Z2C4F.js.map +0 -1
- package/dist/chunk-RLYO6VVP.js +0 -19
- package/dist/chunk-RLYO6VVP.js.map +0 -1
- package/dist/chunk-SMJMXQ3T.js.map +0 -1
- package/dist/chunk-VJ4HOFBA.js.map +0 -1
- package/dist/handler-UMGSZY33.js +0 -10
|
@@ -1,8 +1,78 @@
|
|
|
1
|
-
import { getSection, PostSlug, PostDoc, ReleaseSnapshot, validatePostSlug, MAX_IMPORT_POSTS, MAX_LIVE_POSTS, postSummary, redirectsAfterMove, PageDoc, SiteDoc } from './chunk-
|
|
2
|
-
import { pagePathProblems,
|
|
1
|
+
import { getSection, NOT_FOUND_PATH, redirectLoops, PostSlug, PostDoc, ReleaseSnapshot, validatePostSlug, MAX_IMPORT_POSTS, MAX_LIVE_POSTS, postSummary, redirectsAfterMove, PageDoc, SiteDoc, isSampleImage } from './chunk-QGU6FDH5.js';
|
|
2
|
+
import { DEFAULT_RESERVED_PATHS, pagePathProblems, normalizeRequestPath, isReservedPath, validatePagePath } from './chunk-CXBBUKGB.js';
|
|
3
3
|
import { FONT_CHOICES, genesisBrand, themeFromBrand } from '@marktiderman/genesis-design-system';
|
|
4
4
|
export { FONT_CHOICES } from '@marktiderman/genesis-design-system';
|
|
5
5
|
|
|
6
|
+
// src/core/landing.ts
|
|
7
|
+
var DEFAULT_LANDING_DIRECTORY = "/go";
|
|
8
|
+
var LANDING_SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
9
|
+
function landingDirectory(site, fallback) {
|
|
10
|
+
return site?.landing?.directory ?? fallback ?? DEFAULT_LANDING_DIRECTORY;
|
|
11
|
+
}
|
|
12
|
+
function landingPath(directory, slug) {
|
|
13
|
+
return `${directory}/${slug}`;
|
|
14
|
+
}
|
|
15
|
+
function landingSlugOf(directory, path) {
|
|
16
|
+
const prefix = `${directory}/`;
|
|
17
|
+
if (!path.startsWith(prefix) || path.length === prefix.length) return null;
|
|
18
|
+
return path.slice(prefix.length);
|
|
19
|
+
}
|
|
20
|
+
function landingDirectoryProblems(directory, reserved = DEFAULT_RESERVED_PATHS) {
|
|
21
|
+
if (directory === "/") return ["Landing pages need a directory of their own (like /go), not /."];
|
|
22
|
+
return pagePathProblems(directory, reserved).map((p) => p.replace(/^A page path/, "A landing page directory"));
|
|
23
|
+
}
|
|
24
|
+
function landingSlugProblems(directory, slug, reserved = DEFAULT_RESERVED_PATHS) {
|
|
25
|
+
if (!LANDING_SLUG.test(slug)) return ["A landing page's address ends in lowercase letters, digits and single hyphens (for example spring-offer)."];
|
|
26
|
+
return pagePathProblems(landingPath(directory, slug), reserved);
|
|
27
|
+
}
|
|
28
|
+
function isLandingPage(page) {
|
|
29
|
+
return page.kind === "landing" && page.path !== "/";
|
|
30
|
+
}
|
|
31
|
+
function landingPages(pages) {
|
|
32
|
+
return pages.filter(isLandingPage);
|
|
33
|
+
}
|
|
34
|
+
function landingMoves(pages, from, to) {
|
|
35
|
+
if (from === to) return [];
|
|
36
|
+
const moves = [];
|
|
37
|
+
for (const page of landingPages(pages)) {
|
|
38
|
+
const slug = landingSlugOf(from, page.path);
|
|
39
|
+
if (slug !== null) moves.push({ page, path: landingPath(to, slug) });
|
|
40
|
+
}
|
|
41
|
+
return moves;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/core/schedule.ts
|
|
45
|
+
function time(value) {
|
|
46
|
+
if (typeof value !== "string" || !value) return null;
|
|
47
|
+
const t = Date.parse(value);
|
|
48
|
+
return Number.isFinite(t) ? t : null;
|
|
49
|
+
}
|
|
50
|
+
function pageWindow(doc) {
|
|
51
|
+
return { from: time(doc.root.props.showFrom), until: time(doc.root.props.showUntil) };
|
|
52
|
+
}
|
|
53
|
+
function isPageShown(doc, at) {
|
|
54
|
+
const { from, until } = pageWindow(doc);
|
|
55
|
+
const now = at.getTime();
|
|
56
|
+
return (from === null || now >= from) && (until === null || now < until);
|
|
57
|
+
}
|
|
58
|
+
function nextPageBoundary(doc, at) {
|
|
59
|
+
const now = at.getTime();
|
|
60
|
+
const { from, until } = pageWindow(doc);
|
|
61
|
+
const next = [from, until].filter((t) => t !== null && t > now);
|
|
62
|
+
return next.length ? Math.min(...next) : null;
|
|
63
|
+
}
|
|
64
|
+
function pageWindowProblems(doc, path) {
|
|
65
|
+
const { showFrom, showUntil } = doc.root.props;
|
|
66
|
+
if (showFrom === void 0 && showUntil === void 0) return [];
|
|
67
|
+
if (path === "/") return ["The home page is always shown; it can't have show dates."];
|
|
68
|
+
if (path === NOT_FOUND_PATH) return ["The 404 page is always shown; it can't have show dates."];
|
|
69
|
+
const { from, until } = pageWindow(doc);
|
|
70
|
+
const problems = [];
|
|
71
|
+
if (showFrom !== void 0 && from === null) problems.push(`"${String(showFrom)}" isn't a date and time.`);
|
|
72
|
+
if (showUntil !== void 0 && until === null) problems.push(`"${String(showUntil)}" isn't a date and time.`);
|
|
73
|
+
if (from !== null && until !== null && until <= from) problems.push("The page would be hidden before it is shown: set its end after its start.");
|
|
74
|
+
return problems;
|
|
75
|
+
}
|
|
6
76
|
var RADIUS = { none: "0rem", sm: "0.25rem", md: "0.5rem", lg: "0.75rem", full: "1.25rem" };
|
|
7
77
|
var HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
8
78
|
function parseHex(hex) {
|
|
@@ -96,10 +166,15 @@ function modeColours(brand, mode) {
|
|
|
96
166
|
const ownText = light ? brand.primaryText : own?.primaryText;
|
|
97
167
|
let primaryText = ownText && HEX.test(ownText) ? ownText : primary;
|
|
98
168
|
if (primaryText === primary) {
|
|
99
|
-
|
|
100
|
-
|
|
169
|
+
const reads = (c) => contrastRatio(c, background) >= 4.5 && contrastRatio(c, muted) >= 4.5;
|
|
170
|
+
for (let t = 0.02; !reads(primaryText) && t <= 1; t += 0.02) primaryText = mix(primary, light ? -t : t);
|
|
171
|
+
if (!reads(primaryText)) primaryText = foreground;
|
|
101
172
|
}
|
|
102
|
-
|
|
173
|
+
const displays = (c) => contrastRatio(c, background) >= 3 && contrastRatio(c, muted) >= 3;
|
|
174
|
+
let primaryDisplay = primary;
|
|
175
|
+
for (let t = 0.02; !displays(primaryDisplay) && t <= 1; t += 0.02) primaryDisplay = mix(primary, light ? -t : t);
|
|
176
|
+
if (!displays(primaryDisplay)) primaryDisplay = primaryText;
|
|
177
|
+
return { background, foreground, muted, mutedForeground, primary, primaryForeground, primaryText, primaryDisplay, ring, border };
|
|
103
178
|
}
|
|
104
179
|
function roleVars(c) {
|
|
105
180
|
const hsl = hexToHslTriplet;
|
|
@@ -113,6 +188,7 @@ function roleVars(c) {
|
|
|
113
188
|
"--primary": hsl(c.primary),
|
|
114
189
|
"--primary-foreground": hsl(c.primaryForeground),
|
|
115
190
|
"--primary-text": hsl(c.primaryText),
|
|
191
|
+
"--primary-display": hsl(c.primaryDisplay),
|
|
116
192
|
"--secondary": hsl(c.muted),
|
|
117
193
|
"--secondary-foreground": hsl(c.foreground),
|
|
118
194
|
"--muted": hsl(c.muted),
|
|
@@ -327,6 +403,25 @@ function migrateSite(site, lookup) {
|
|
|
327
403
|
|
|
328
404
|
// src/core/a11y.ts
|
|
329
405
|
var isPublishable = (issues) => !issues.some((i) => i.severity === "error");
|
|
406
|
+
var CHOSEN_CHECKS = { "sample-image": "sampleImages", "form-missing": "missingForms" };
|
|
407
|
+
function applyCheckLevels(issues, levels = {}) {
|
|
408
|
+
const out = [];
|
|
409
|
+
for (const issue of issues) {
|
|
410
|
+
const key = Object.hasOwn(CHOSEN_CHECKS, issue.code) ? CHOSEN_CHECKS[issue.code] : void 0;
|
|
411
|
+
if (!key) {
|
|
412
|
+
out.push(issue);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const level = levels[key] ?? "warn";
|
|
416
|
+
if (level === "off") continue;
|
|
417
|
+
out.push({ ...issue, severity: level === "block" ? "error" : "warning" });
|
|
418
|
+
}
|
|
419
|
+
return out;
|
|
420
|
+
}
|
|
421
|
+
function placeName(path) {
|
|
422
|
+
if (!path) return "its image";
|
|
423
|
+
return path.split(".").filter((p) => p !== "src" && p !== "image").map((p) => /^\d+$/.test(p) ? String(Number(p) + 1) : p.replace(/([a-z])([A-Z])/g, "$1 $2").toLowerCase()).join(" \u203A ") || "its image";
|
|
424
|
+
}
|
|
330
425
|
function images(value, path = []) {
|
|
331
426
|
if (!value || typeof value !== "object") return [];
|
|
332
427
|
if (Array.isArray(value)) return value.flatMap((v, i) => images(v, [...path, String(i)]));
|
|
@@ -373,7 +468,7 @@ function hostIssues(value, at, where, options, base = {}) {
|
|
|
373
468
|
...base,
|
|
374
469
|
severity: options.images === "own" ? "error" : "warning",
|
|
375
470
|
code: "asset-host",
|
|
376
|
-
message: `${at}: ${what} ${where}(${path
|
|
471
|
+
message: `${at}: ${what} ${where}(${placeName(path)}) loads from ${hostOf(src)}, not from the site. Upload it to the site again so the site keeps its own copy.`
|
|
377
472
|
});
|
|
378
473
|
}
|
|
379
474
|
return issues;
|
|
@@ -394,7 +489,8 @@ function nodeIssues(node, ctx, lookup) {
|
|
|
394
489
|
const def = lookup(node.type);
|
|
395
490
|
if (!def || !migrated.node) return issues;
|
|
396
491
|
if (node.placeholder) {
|
|
397
|
-
|
|
492
|
+
const unready = ctx.page && isLandingPage(ctx.page) ? " If this landing page isn't ready, delete it under Landing pages to publish the rest of the site." : "";
|
|
493
|
+
issues.push({ ...base, severity: "error", code: "placeholder", message: `${at}: the ${def.label} section still has the template's sample content. Replace it, or hide the section.${unready}` });
|
|
398
494
|
}
|
|
399
495
|
const placement = def.placement ?? "body";
|
|
400
496
|
if (placement !== ctx.where) {
|
|
@@ -404,9 +500,13 @@ function nodeIssues(node, ctx, lookup) {
|
|
|
404
500
|
issues.push({ ...base, severity: "error", code: "enabled-on", message: `${at}: a ${def.label} section can't go on a ${ctx.kind} page.` });
|
|
405
501
|
}
|
|
406
502
|
for (const { path, image } of images(migrated.node.props)) {
|
|
503
|
+
if (isSampleImage(image.src)) {
|
|
504
|
+
issues.push({ ...base, severity: "error", code: "sample-image", message: `${at}: the ${def.label} section still shows a sample picture (${placeName(path)}). Pick a photo, or remove it.` });
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
407
507
|
const alt = typeof image.alt === "string" ? image.alt.trim() : "";
|
|
408
508
|
if (!alt && image.decorative !== true) {
|
|
409
|
-
issues.push({ ...base, severity: "error", code: "image-alt", message: `${at}: an image in the ${def.label} section (${path
|
|
509
|
+
issues.push({ ...base, severity: "error", code: "image-alt", message: `${at}: an image in the ${def.label} section (${placeName(path)}) needs alt text, or to be marked decorative.` });
|
|
410
510
|
}
|
|
411
511
|
}
|
|
412
512
|
const levels = richTextHeadings(migrated.node.props);
|
|
@@ -424,6 +524,10 @@ function checkPage(page, lookup = getSection, reserved) {
|
|
|
424
524
|
const issues = [];
|
|
425
525
|
const base = { pageId: page.id, path: page.path };
|
|
426
526
|
for (const problem of pagePathProblems(page.path, reserved)) issues.push({ ...base, severity: "error", code: "path", message: `${page.path}: ${problem}` });
|
|
527
|
+
for (const problem of pageWindowProblems(page.doc, page.path)) issues.push({ ...base, severity: "error", code: "show-dates", message: `${page.path}: ${problem}` });
|
|
528
|
+
if (page.kind === "post" && (page.doc.root.props.showFrom || page.doc.root.props.showUntil)) {
|
|
529
|
+
issues.push({ ...base, severity: "error", code: "show-dates", message: `${page.path}: the blog's post page is always shown; it can't have show dates.` });
|
|
530
|
+
}
|
|
427
531
|
const visible = page.doc.content.filter((n) => !n.hidden);
|
|
428
532
|
const counts = /* @__PURE__ */ new Map();
|
|
429
533
|
let h1 = 0;
|
|
@@ -454,7 +558,11 @@ function checkSiteDoc(site, lookup = getSection) {
|
|
|
454
558
|
for (const r of site.redirects) {
|
|
455
559
|
if (froms.has(r.from)) issues.push({ severity: "error", code: "redirect-duplicate", path: r.from, message: `Two redirects from ${r.from}.` });
|
|
456
560
|
froms.add(r.from);
|
|
457
|
-
|
|
561
|
+
const target = r.to.split(/[?#]/)[0];
|
|
562
|
+
const loops = r.match === "prefix" ? r.to.startsWith("/") && (target === r.from || target.startsWith(`${r.from}/`)) : r.to === r.from;
|
|
563
|
+
if (loops) issues.push({ severity: "error", code: "redirect-loop", path: r.from, message: `The redirect from ${r.from} points at itself.` });
|
|
564
|
+
if (r.match === "prefix" && r.from === "/") issues.push({ severity: "error", code: "redirect-prefix-home", path: r.from, message: "A redirect from everything under / would replace the whole site." });
|
|
565
|
+
if (r.keepRest && r.match !== "prefix") issues.push({ severity: "error", code: "redirect-keep-rest", path: r.from, message: `The redirect from ${r.from} keeps the rest of the address but matches only ${r.from}.` });
|
|
458
566
|
}
|
|
459
567
|
return issues;
|
|
460
568
|
}
|
|
@@ -476,11 +584,25 @@ function checkRelease(snapshot, options = {}) {
|
|
|
476
584
|
issues.push(...checkPage(page, lookup, options.reserved));
|
|
477
585
|
}
|
|
478
586
|
if (!paths.has("/")) issues.push({ severity: "error", code: "no-home", message: "The site has no home page (a page at /)." });
|
|
587
|
+
const dated = new Set(snapshot.pages.filter((p) => p.doc.root.props.showFrom || p.doc.root.props.showUntil).map((p) => p.path));
|
|
588
|
+
for (const item of snapshot.site.nav) {
|
|
589
|
+
const target = item.href.startsWith("/") ? normalizeRequestPath(item.href.split(/[?#]/)[0]) : null;
|
|
590
|
+
if (target && dated.has(target)) {
|
|
591
|
+
issues.push({ severity: "warning", code: "menu-dated-page", path: target, message: `The menu's "${item.label}" goes to ${target}, which has show dates: outside them it's a broken link. Take it out of the menu, or link it from the page's content instead.` });
|
|
592
|
+
}
|
|
593
|
+
}
|
|
479
594
|
issues.push(...checkBlog(snapshot, lookup));
|
|
595
|
+
const postBase = snapshot.pages.find((p) => p.kind === "post")?.path;
|
|
596
|
+
const mayBePost = (p) => postBase !== void 0 && p.startsWith(`${postBase === "/" ? "" : postBase}/`);
|
|
597
|
+
const selfLoops = new Set(issues.filter((i) => i.code === "redirect-loop").map((i) => i.path));
|
|
598
|
+
for (const from of redirectLoops(snapshot.site.redirects, (p) => paths.has(p) || mayBePost(p))) {
|
|
599
|
+
if (!selfLoops.has(from)) issues.push({ severity: "error", code: "redirect-loop", path: from, message: `Following the redirect from ${from} comes back to an address it passed (or never ends): visitors would never arrive.` });
|
|
600
|
+
}
|
|
480
601
|
for (const r of snapshot.site.redirects) {
|
|
481
|
-
if (paths.has(r.from)) issues.push({ severity: "error", code: "redirect-shadows-page", path: r.from, message: `The redirect from ${r.from} hides the page there; remove the redirect.` });
|
|
602
|
+
if (r.match !== "prefix" && paths.has(r.from)) issues.push({ severity: "error", code: "redirect-shadows-page", path: r.from, message: `The redirect from ${r.from} hides the page there; remove the redirect.` });
|
|
482
603
|
const target = r.to.split(/[?#]/)[0];
|
|
483
|
-
|
|
604
|
+
const appPath = options.reserved !== void 0 ? isReservedPath(target, options.reserved) : isReservedPath(target);
|
|
605
|
+
if (r.to.startsWith("/") && !r.keepRest && !paths.has(target) && !appPath) {
|
|
484
606
|
issues.push({ severity: "warning", code: "redirect-to-missing-page", path: r.from, message: `The redirect from ${r.from} goes to ${target}, where there's no page (was it deleted?).` });
|
|
485
607
|
}
|
|
486
608
|
if (options.reserved !== void 0 ? isReservedPath(r.from, options.reserved) : isReservedPath(r.from)) {
|
|
@@ -489,7 +611,7 @@ function checkRelease(snapshot, options = {}) {
|
|
|
489
611
|
}
|
|
490
612
|
if (options.theme) issues.push(...checkContrast(options.theme));
|
|
491
613
|
issues.push(...checkAssetHosts(snapshot, { ...options, lookup }));
|
|
492
|
-
return issues;
|
|
614
|
+
return applyCheckLevels(issues, options.checks);
|
|
493
615
|
}
|
|
494
616
|
function checkAssetHosts(snapshot, options = {}) {
|
|
495
617
|
const lookup = options.lookup ?? getSection;
|
|
@@ -511,7 +633,7 @@ function checkAssetHosts(snapshot, options = {}) {
|
|
|
511
633
|
issues.push({
|
|
512
634
|
severity: hosts.images === "own" ? "error" : "warning",
|
|
513
635
|
code: "asset-host",
|
|
514
|
-
message: `The brand's logo loads from ${hostOf(options.logo)}, not from the site. Upload it
|
|
636
|
+
message: `The brand's logo loads from ${hostOf(options.logo)}, not from the site. Upload it again so the site keeps its own copy.`
|
|
515
637
|
});
|
|
516
638
|
}
|
|
517
639
|
return issues;
|
|
@@ -659,12 +781,14 @@ function prepareRelease(site, pages, options = {}) {
|
|
|
659
781
|
pages: releasePages.map((p) => ({ ...p, doc: { ...p.doc, content: visible(p.doc.content) } }))
|
|
660
782
|
});
|
|
661
783
|
const theme = options.brand ? siteTheme(options.brand, snapshot.site.theme) : void 0;
|
|
784
|
+
if (options.brand) snapshot.brand = JSON.parse(JSON.stringify(options.brand));
|
|
662
785
|
const logo = options.brand && "logo" in options.brand ? options.brand.logo?.src : void 0;
|
|
663
786
|
const issues = checkRelease(snapshot, {
|
|
664
787
|
...theme ? { theme } : {},
|
|
665
788
|
reserved: options.reserved ?? DEFAULT_RESERVED_PATHS,
|
|
666
789
|
...options.assetOrigins ? { assetOrigins: options.assetOrigins } : {},
|
|
667
|
-
...logo ? { logo } : {}
|
|
790
|
+
...logo ? { logo } : {},
|
|
791
|
+
...options.checks ? { checks: options.checks } : {}
|
|
668
792
|
});
|
|
669
793
|
if (!theme) issues.push({ severity: "error", code: "brand-missing", message: "Publish with the site's brand (`brand`), so its colours can be checked for contrast." });
|
|
670
794
|
if (!isPublishable(issues)) throw new PublishBlockedError(issues);
|
|
@@ -960,7 +1084,7 @@ function createMemorySiteStore(options = {}) {
|
|
|
960
1084
|
if (!input.id) {
|
|
961
1085
|
if (sitePosts(siteId).some((p2) => p2.slug === input.slug)) throw new Error(`A post is already at ${input.slug}.`);
|
|
962
1086
|
const postId = id("post");
|
|
963
|
-
posts.set(postId, { id: postId, siteId, slug: input.slug, doc, rev: 1, status: "draft", published: null, publishedAt: null, updatedAt: at, deleted: false });
|
|
1087
|
+
posts.set(postId, { id: postId, siteId, slug: input.slug, doc, rev: 1, status: "draft", published: null, publishedAt: null, importedPublishedAt: null, updatedAt: at, deleted: false });
|
|
964
1088
|
return { id: postId, rev: 1 };
|
|
965
1089
|
}
|
|
966
1090
|
const p = editablePost(input.id);
|
|
@@ -985,7 +1109,7 @@ function createMemorySiteStore(options = {}) {
|
|
|
985
1109
|
const at = now().toISOString();
|
|
986
1110
|
p.published = { doc: clone(p.doc), at };
|
|
987
1111
|
p.status = "published";
|
|
988
|
-
p.publishedAt ??= at;
|
|
1112
|
+
p.publishedAt ??= p.importedPublishedAt ?? at;
|
|
989
1113
|
p.updatedAt = at;
|
|
990
1114
|
return postMeta(p);
|
|
991
1115
|
},
|
|
@@ -1024,7 +1148,7 @@ function createMemorySiteStore(options = {}) {
|
|
|
1024
1148
|
const postId = id("post");
|
|
1025
1149
|
const at = now().toISOString();
|
|
1026
1150
|
const published = prepared.status === "published" ? { doc: clone(prepared.doc), at: prepared.publishedAt } : null;
|
|
1027
|
-
posts.set(postId, { id: postId, siteId, slug: item.slug, doc: prepared.doc, rev: 1, status: prepared.status, published, publishedAt: published ? prepared.publishedAt : null, updatedAt: at, deleted: false });
|
|
1151
|
+
posts.set(postId, { id: postId, siteId, slug: item.slug, doc: prepared.doc, rev: 1, status: prepared.status, published, publishedAt: published ? prepared.publishedAt : null, importedPublishedAt: published || !item.publishedAt ? null : prepared.publishedAt, updatedAt: at, deleted: false });
|
|
1028
1152
|
result.imported.push({ slug: item.slug, id: postId, status: prepared.status, ...prepared.issues.length ? { issues: prepared.issues } : {} });
|
|
1029
1153
|
}
|
|
1030
1154
|
return result;
|
|
@@ -1033,6 +1157,6 @@ function createMemorySiteStore(options = {}) {
|
|
|
1033
1157
|
return store;
|
|
1034
1158
|
}
|
|
1035
1159
|
|
|
1036
|
-
export { ASSET_TYPES, PublishBlockedError, SiteConflictError, assetPath, brandDisplayName, checkAssetHosts, checkBlog, checkContrast, checkHtmlOutline, checkPage, checkPost, checkRelease, checkSiteDoc, contrastRatio, createMemorySiteStore, formCacheTag, hexToHslTriplet, isConflict, isOwnUrl, isPublishable, isSiteBrand, luminance, migrateNode, migratePage, migrateSite, mix, parseHex, prepareImportPost, prepareRelease, siteCacheTag, siteTheme, stableHash, themeCss, toCanonicalBrand, withCacheInvalidation };
|
|
1037
|
-
//# sourceMappingURL=chunk-
|
|
1038
|
-
//# sourceMappingURL=chunk-
|
|
1160
|
+
export { ASSET_TYPES, DEFAULT_LANDING_DIRECTORY, LANDING_SLUG, PublishBlockedError, SiteConflictError, applyCheckLevels, assetPath, brandDisplayName, checkAssetHosts, checkBlog, checkContrast, checkHtmlOutline, checkPage, checkPost, checkRelease, checkSiteDoc, contrastRatio, createMemorySiteStore, formCacheTag, hexToHslTriplet, isConflict, isLandingPage, isOwnUrl, isPageShown, isPublishable, isSiteBrand, landingDirectory, landingDirectoryProblems, landingMoves, landingPages, landingPath, landingSlugOf, landingSlugProblems, luminance, migrateNode, migratePage, migrateSite, mix, nextPageBoundary, pageWindow, pageWindowProblems, parseHex, prepareImportPost, prepareRelease, siteCacheTag, siteTheme, stableHash, themeCss, toCanonicalBrand, withCacheInvalidation };
|
|
1161
|
+
//# sourceMappingURL=chunk-UOKNFG5O.js.map
|
|
1162
|
+
//# sourceMappingURL=chunk-UOKNFG5O.js.map
|