bearminion 1.16.1 → 1.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # bearminion
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6ed3bc2: The hosted editor can now be limited to named people, and it warns when a site's own files are older than it needs.
8
+
9
+ - `auth: { allowedLogins: ['ann', 'bob'] }` narrows sign-in to those GitHub logins, on top of push access. It is checked at sign-in and on every request, so a login removed from the list is signed out at its next request. An empty list is refused.
10
+ - The editor build warns when a starter site has no `src/lib/editing.ts`, or when `src/pages/[...slug].astro` or `src/pages/404.astro` never reads `Astro.locals.bearminion`. A missing `editing.ts` makes a page answer 500 after an image is uploaded in the editor.
11
+ - Sites created before 1.16 do not get 1.16's fixes to `MediaFrame`, `Image`, `Seo`, `LogoStrip`, `env.d.ts` and the page routes from `npm update`. See "Keeping the site's files current" in the integration guide for the steps, then `npx bearminion@latest status`.
12
+
13
+ ## 1.16.2
14
+
15
+ ### Patch Changes
16
+
17
+ - a851229: Hosted editor: a page that uses an image uploaded after the last build no longer answers 500. The template's `Seo` (share image) and `LogoStrip` components threw for a file the build does not hold; on the hosted editor they now draw it from the editor's image route or leave it out. A page that cannot be drawn shows the signed-in person the reason, with the editor script on it, instead of a blank 500.
18
+
3
19
  ## 1.16.1
4
20
 
5
21
  ### Patch Changes
package/dist/astro.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as CollectionOptions, b as StoreOperation, n as ImageConvertOptions, t as EditorContext, x as UploadStore, y as ContentStore } from "./editor-context-ESJwMFpS.js";
2
- import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-CDQNvoKQ.js";
3
- import { _ as SectionRegistry, d as SectionOf, g as ContentModel, gt as SiteOf, ht as SiteDefinition, n as PageRules, t as Page, w as ContentMigrator } from "./page-D1pdneYm.js";
1
+ import { _ as CollectionOptions, b as StoreOperation, n as ImageConvertOptions, t as EditorContext, x as UploadStore, y as ContentStore } from "./editor-context-CuD7HgT7.js";
2
+ import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-C4oCDBnl.js";
3
+ import { _ as SectionRegistry, d as SectionOf, g as ContentModel, gt as SiteOf, ht as SiteDefinition, n as PageRules, t as Page, w as ContentMigrator } from "./page-DNbZW-J7.js";
4
4
  import { AstroIntegration } from "astro";
5
5
  //#region src/store.d.ts
6
6
  interface FileStoreOptions {
package/dist/astro.js CHANGED
@@ -10,7 +10,7 @@ import { a as isHistoryId, c as imageBodyLimit, d as stableStringify, i as histo
10
10
  import { S as isAssetPath } from "./draft-store-DBEfw_Gq.js";
11
11
  import { n as contentReloadPlugin, r as dropEarlyReloadAfterSave } from "./reload-BzVw721A.js";
12
12
  import { i as syncSections, r as staleSectionsMessage } from "./sections-manifest-CO9QfJPG.js";
13
- import fs from "node:fs";
13
+ import fs, { existsSync, readFileSync } from "node:fs";
14
14
  import path from "node:path";
15
15
  import { fileURLToPath } from "node:url";
16
16
  import { promisify } from "node:util";
@@ -944,6 +944,28 @@ function isErrno(error) {
944
944
  return error instanceof Error && "code" in error;
945
945
  }
946
946
  //#endregion
947
+ //#region src/hosted-template-check.ts
948
+ const TEMPLATE_DOCS = "https://docs.bearminion.com/integration/#keeping-the-sites-files-current";
949
+ /** Reads a file, or `undefined` when it is not there. */
950
+ function read(file) {
951
+ try {
952
+ return existsSync(file) ? readFileSync(file, "utf8") : void 0;
953
+ } catch {
954
+ return;
955
+ }
956
+ }
957
+ /** What is out of step in the project at `root`, one sentence each. Empty when the site is current, or is not the starter. */
958
+ function staleTemplateProblems(root) {
959
+ const problems = [];
960
+ const starterMarker = path.join(root, "src/components/molecules/MediaFrame.astro");
961
+ if (existsSync(starterMarker) && !existsSync(path.join(root, "src/lib/editing.ts"))) problems.push("src/lib/editing.ts is missing, so the image components throw for an image uploaded in the editor and the page answers 500 until the next build.");
962
+ const route = read(path.join(root, "src/pages/[...slug].astro"));
963
+ if (route !== void 0 && !route.includes("locals.bearminion")) problems.push("src/pages/[...slug].astro does not read Astro.locals.bearminion, so the editor would show the pages as they were at build time.");
964
+ const notFound = read(path.join(root, "src/pages/404.astro"));
965
+ if (notFound !== void 0 && !notFound.includes("locals.bearminion")) problems.push("src/pages/404.astro does not read Astro.locals.bearminion, so the editor would show the 404 page as it was at build time.");
966
+ return problems;
967
+ }
968
+ //#endregion
947
969
  //#region src/hosted-integration.ts
948
970
  const VIRTUAL_ID = "virtual:bearminion/editor";
949
971
  const RESOLVED_ID = `\0${VIRTUAL_ID}`;
@@ -958,9 +980,12 @@ function bearminionHostedEditor(options) {
958
980
  if (!options.module) throw new Error("bearminionHostedEditor needs `module`: the file that exports your hosted editor.");
959
981
  return {
960
982
  name: "bearminion:hosted-editor",
961
- hooks: { "astro:config:setup"({ config, updateConfig, addMiddleware }) {
983
+ hooks: { "astro:config:setup"({ config, updateConfig, addMiddleware, logger }) {
962
984
  if (!config.adapter) throw new Error("bearminionHostedEditor renders on a server, so the project needs an adapter (for example @astrojs/cloudflare or @astrojs/vercel). Add it to the editor build only.");
963
- const editorModule = path.resolve(fileURLToPath(config.root), options.module);
985
+ const root = fileURLToPath(config.root);
986
+ const editorModule = path.resolve(root, options.module);
987
+ const stale = staleTemplateProblems(root);
988
+ if (stale.length > 0) logger.warn(`This site's files are older than the editor needs:\n${stale.map((problem) => ` - ${problem}`).join("\n")}\nHow to bring them up to date: ${TEMPLATE_DOCS}`);
964
989
  updateConfig({
965
990
  ...config.output === "static" ? { output: "server" } : {},
966
991
  vite: {
package/dist/content.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as SectionOf, g as ContentModel, t as Page } from "./page-D1pdneYm.js";
1
+ import { d as SectionOf, g as ContentModel, t as Page } from "./page-DNbZW-J7.js";
2
2
  import { z } from "zod";
3
3
  //#region src/content.d.ts
4
4
  export interface ContentCollectionsOptions {
@@ -1,4 +1,4 @@
1
- import { _ as SectionRegistry, ht as SiteDefinition, n as PageRules, w as ContentMigrator, y as ThemeDefinition } from "./page-D1pdneYm.js";
1
+ import { _ as SectionRegistry, ht as SiteDefinition, n as PageRules, w as ContentMigrator, y as ThemeDefinition } from "./page-DNbZW-J7.js";
2
2
  import { ZodType, z } from "zod";
3
3
  //#region src/upload-names.d.ts
4
4
  type ImageKind = 'png' | 'jpeg' | 'webp' | 'gif' | 'avif';
@@ -1,4 +1,4 @@
1
- import { y as ContentStore } from "./editor-context-ESJwMFpS.js";
1
+ import { y as ContentStore } from "./editor-context-CuD7HgT7.js";
2
2
  //#region src/store-error.d.ts
3
3
  /** A key that is empty, has an empty or dot segment, or leaves its base directory. */
4
4
  declare class StoreKeyError extends Error {
@@ -1,4 +1,4 @@
1
- import { t as createHostedMiddleware } from "./hosted-middleware-qAgd_XC5.js";
1
+ import { t as createHostedMiddleware } from "./hosted-middleware-CedN9WNM.js";
2
2
  import { editor, signIn } from "virtual:bearminion/editor";
3
3
  //#region src/hosted-astro.ts
4
4
  let ready;
@@ -60,7 +60,7 @@ function readCookies(header) {
60
60
  }
61
61
  return cookies;
62
62
  }
63
- function escapeHtml(text) {
63
+ function escapeHtml$1(text) {
64
64
  return text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
65
65
  }
66
66
  /** Only a path on this site: no other origin, no protocol-relative `//host`, no backslash tricks. */
@@ -69,7 +69,7 @@ function safeReturnTo(value) {
69
69
  return value;
70
70
  }
71
71
  function page(status, title, message, extra) {
72
- const body = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(title)}</title><body style="font:16px system-ui;max-width:32rem;margin:4rem auto;padding:0 1rem"><h1 style="font-size:1.25rem">${escapeHtml(title)}</h1><p>${escapeHtml(message)}</p>`;
72
+ const body = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml$1(title)}</title><body style="font:16px system-ui;max-width:32rem;margin:4rem auto;padding:0 1rem"><h1 style="font-size:1.25rem">${escapeHtml$1(title)}</h1><p>${escapeHtml$1(message)}</p>`;
73
73
  return new Response(body, {
74
74
  status,
75
75
  headers: {
@@ -101,6 +101,9 @@ function createHostedAuth(options) {
101
101
  const now = options.now ?? Date.now;
102
102
  const sessionMs = (options.sessionDays ?? 7) * 864e5;
103
103
  const keyPromise = deriveKey(options.secret);
104
+ if (options.allowedLogins !== void 0 && options.allowedLogins.length === 0) throw new Error("createHostedAuth(): allowedLogins is empty, so nobody could sign in. Leave it out to allow everyone with push access.");
105
+ const allowedLogins = options.allowedLogins ? new Set(options.allowedLogins.map((login) => login.trim().toLowerCase())) : void 0;
106
+ const isAllowed = (login) => !allowedLogins || allowedLogins.has(login.toLowerCase());
104
107
  const originOf = (request) => (options.origin ?? new URL(request.url).origin).replace(/\/+$/, "");
105
108
  const secure = (request) => originOf(request).startsWith("https://");
106
109
  const names = (request) => secure(request) ? {
@@ -185,6 +188,7 @@ function createHostedAuth(options) {
185
188
  async function authenticate(request) {
186
189
  const stored = await open(await keyPromise, "session", readCookies(request.headers.get("cookie")).get(names(request).session));
187
190
  if (!stored || typeof stored.token !== "string" || typeof stored.login !== "string") return null;
191
+ if (!isAllowed(stored.login)) return null;
188
192
  const at = now();
189
193
  if (at >= stored.issuedAt + sessionMs) return null;
190
194
  if (at < stored.expiresAt - REFRESH_MARGIN_MS) return { session: stored };
@@ -244,6 +248,7 @@ function createHostedAuth(options) {
244
248
  if (!userReply?.ok) return page(502, "Sign-in failed", "GitHub did not say who you are. Start again.", { "set-cookie": clearState });
245
249
  const who = await userReply.json();
246
250
  if (typeof who.login !== "string" || typeof who.id !== "number") return page(502, "Sign-in failed", "GitHub sent an unexpected answer. Start again.", { "set-cookie": clearState });
251
+ if (!isAllowed(who.login)) return page(403, "No access", `${who.login} is not on the list of people who may edit this site. Ask the owner to add you.`, { "set-cookie": clearState });
247
252
  if (!await hasPushAccess(reply.access_token)) return page(403, "No access", `${who.login} cannot write to ${options.repo}. Ask the owner for write access, and check that the GitHub App is installed on the repository.`, { "set-cookie": clearState });
248
253
  const headers = new Headers({
249
254
  location: saved.returnTo,
@@ -333,6 +338,15 @@ function redirectToSignIn(request) {
333
338
  }
334
339
  });
335
340
  }
341
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
342
+ /**
343
+ * What a signed-in person sees when their page could not be drawn: the reason, in words, instead of a blank 500. Only
344
+ * people with push access to the repository get here, so the message may name files and fields.
345
+ */
346
+ function failedPage(error) {
347
+ const reason = error instanceof Error ? error.message : String(error);
348
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>This page could not be drawn</title><style>body{font:16px/1.5 system-ui,sans-serif;max-width:42rem;margin:12vh auto;padding:0 1.25rem;color:#1d1b18}pre{white-space:pre-wrap;background:#f4f1ec;padding:1rem;border-radius:.5rem;font-size:.875rem}</style></head><body><h1>This page could not be drawn</h1><p>The content in the repository does not render. Fix it in the editor, or in the repository, and reload.</p><pre>${escapeHtml(reason)}</pre></body></html>`;
349
+ }
336
350
  function createHostedMiddleware(editor, options = {}) {
337
351
  const required = options.signIn !== "optional";
338
352
  return async ({ request, locals }, next) => {
@@ -351,7 +365,24 @@ function createHostedMiddleware(editor, options = {}) {
351
365
  });
352
366
  }
353
367
  locals.bearminion = scope;
354
- return editor.inject(request, await next());
368
+ let response;
369
+ try {
370
+ response = await next();
371
+ } catch (error) {
372
+ if (!isPageLoad(request)) throw error;
373
+ const page = new Response(failedPage(error), {
374
+ status: 200,
375
+ headers: { "content-type": "text/html; charset=utf-8" }
376
+ });
377
+ const withOverlay = await editor.inject(request, page);
378
+ const headers = new Headers(withOverlay.headers);
379
+ headers.set("cache-control", "private, no-store");
380
+ return new Response(withOverlay.body, {
381
+ status: 500,
382
+ headers
383
+ });
384
+ }
385
+ return editor.inject(request, response);
355
386
  };
356
387
  }
357
388
  //#endregion
package/dist/hosted.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as CollectionOptions, n as ImageConvertOptions, t as EditorContext, v as collection, y as ContentStore } from "./editor-context-ESJwMFpS.js";
2
- import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-CDQNvoKQ.js";
3
- import { g as ContentModel, n as PageRules, t as Page } from "./page-D1pdneYm.js";
1
+ import { _ as CollectionOptions, n as ImageConvertOptions, t as EditorContext, v as collection, y as ContentStore } from "./editor-context-CuD7HgT7.js";
2
+ import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-C4oCDBnl.js";
3
+ import { g as ContentModel, n as PageRules, t as Page } from "./page-DNbZW-J7.js";
4
4
  //#region src/api.d.ts
5
5
  interface HandleMeta {
6
6
  /**
@@ -69,6 +69,12 @@ interface HostedAuthOptions {
69
69
  secret: string;
70
70
  /** `owner/name`. Only people with push access to this repository may sign in. */
71
71
  repo: string;
72
+ /**
73
+ * GitHub logins that may sign in, on top of having push access. Default: everyone with push access. Case does not
74
+ * matter. A login taken off the list is signed out on its next request, without waiting for its token to expire.
75
+ * An empty list is refused, because it would lock everyone out.
76
+ */
77
+ allowedLogins?: readonly string[];
72
78
  /**
73
79
  * The public origin of the editor, `https://admin.example.com`. Default: the origin of the request, which is wrong
74
80
  * behind a proxy that rewrites the scheme or host, so set it there. The GitHub App's callback URL must be
package/dist/hosted.js CHANGED
@@ -5,7 +5,7 @@ import { n as createMigrator } from "./migrate-b408EaLp.js";
5
5
  import { i as resolveMaxImageBytes, r as resolveConvert } from "./upload-rules-Cao9uY5K.js";
6
6
  import { f as DEFAULT_VIDEO_BYTE_LIMIT, n as missingImageSvg, r as handleEditorRequest, t as githubStore } from "./github-store-D3LEUhcM.js";
7
7
  import { S as isAssetPath } from "./draft-store-DBEfw_Gq.js";
8
- import { n as AUTH_PREFIX, r as createHostedAuth, t as createHostedMiddleware } from "./hosted-middleware-qAgd_XC5.js";
8
+ import { n as AUTH_PREFIX, r as createHostedAuth, t as createHostedMiddleware } from "./hosted-middleware-CedN9WNM.js";
9
9
  //#region src/hosted-context.ts
10
10
  /** The context for `handleEditorRequest`. */
11
11
  function createHostedContext(options) {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as CollectionOptions, a as CommitRequest, c as HistoryEntry, d as SaveResponse, f as SitePreview, g as GitInfo, h as ChangedFile, i as ApiProblem, l as PageListItem, m as UploadedVideo, o as CommitResult, p as UploadedImage, r as ApiIssue, s as CreatePageRequest, u as SaveRequest, v as collection } from "./editor-context-ESJwMFpS.js";
1
+ import { _ as CollectionOptions, a as CommitRequest, c as HistoryEntry, d as SaveResponse, f as SitePreview, g as GitInfo, h as ChangedFile, i as ApiProblem, l as PageListItem, m as UploadedVideo, o as CommitResult, p as UploadedImage, r as ApiIssue, s as CreatePageRequest, u as SaveRequest, v as collection } from "./editor-context-CuD7HgT7.js";
2
2
  import { _ as renderMarkedHtml, a as WeightMark, f as markClass, g as reconcileMarks, i as TextRun, l as fontMarks, m as marksFromEmphasis, o as applyTextMark, r as TextMark, t as FontMark, v as splitMarkedText, y as weightMarks } from "./marks-BzLa48Y9.js";
3
- import { $ as mergeJsonLd, $t as tones, A as SectionDefinition, At as MAX_NAV_DEPTH, B as FieldIcons, Bt as toneSchema, C as ContentMigration, Ct as siteConsentSchema, D as SCHEMA_VERSION_KEY, Dt as ButtonStyle, E as DocumentKind, Et as themeSchema, F as defineWireframe, Ft as imageSchema, G as SiteJsonLdIds, Gt as EnumOption, H as ShowWhen, Ht as withEmphasis, I as wireKinds, It as linkSchema, J as generateSiteJsonLd, Jt as StringOption, K as SiteJsonLdSource, Kt as NumberOption, L as wireframeIssues, Lt as richTextSchema, M as WireKind, Mt as Text, N as WireRect, Nt as Tone, O as createMigrator, Ot as Image, P as Wireframe, Pt as htmlIdSchema, Q as jsonLdWarnings, Qt as toneOption, R as OptionalContent, Rt as textMarkSchema, S as defineTheme, St as siteAnalyticsSchema, T as ContentVersioning, Tt as themeColorsSchema, U as JsonLdBlock, Ut as BooleanOption, V as ShowCondition, Vt as trackingIdSchema, W as JsonLdResult, Wt as CountRule, X as isPlaceholderSiteUrl, Xt as motionOption, Y as hasJsonLdId, Yt as buttonStyles, Z as jsonLdSchema, Zt as themeModes, _ as SectionRegistry, _t as SiteSeo, a as createPageSchema, at as DEFAULT_MAX_HEADER_ACTIONS, b as ThemeFont, bt as brandLogoSchema, c as withoutOrphanSections, ct as FooterConfig, d as SectionOf, dt as Site, en as variantOption, et as parseJsonLdInput, f as anchorSchema, ft as SiteAnalytics, g as ContentModel, gt as SiteOf, h as API_PREFIX, ht as SiteDefinition, i as Seo, it as DEFAULT_MAX_FOOTER_COLUMNS, j as defineSection, jt as RichText, k as SectionConfig, kt as Link, l as BaseSection, lt as Header, m as sectionIdSchema, mt as SiteConsent, nt as upsertJsonLd, o as isSystemPage, ot as Footer, p as createSectionSchema, pt as SiteConfig, q as formatJsonLd, qt as Option, r as SYSTEM_PAGES, rt as BRAND_LOGO_HEIGHT, s as seoSchema, st as FooterColumn, t as Page, tt as siteJsonLdIds, u as PropsOf, ut as HeaderConfig, v as ThemeConfig, vt as SiteWith, w as ContentMigrator, wt as siteSeoSchema, x as defaultTheme, xt as defineSite, y as ThemeDefinition, yt as Theme, z as FieldChoices, zt as textSchema } from "./page-D1pdneYm.js";
3
+ import { $ as mergeJsonLd, $t as tones, A as SectionDefinition, At as MAX_NAV_DEPTH, B as FieldIcons, Bt as toneSchema, C as ContentMigration, Ct as siteConsentSchema, D as SCHEMA_VERSION_KEY, Dt as ButtonStyle, E as DocumentKind, Et as themeSchema, F as defineWireframe, Ft as imageSchema, G as SiteJsonLdIds, Gt as EnumOption, H as ShowWhen, Ht as withEmphasis, I as wireKinds, It as linkSchema, J as generateSiteJsonLd, Jt as StringOption, K as SiteJsonLdSource, Kt as NumberOption, L as wireframeIssues, Lt as richTextSchema, M as WireKind, Mt as Text, N as WireRect, Nt as Tone, O as createMigrator, Ot as Image, P as Wireframe, Pt as htmlIdSchema, Q as jsonLdWarnings, Qt as toneOption, R as OptionalContent, Rt as textMarkSchema, S as defineTheme, St as siteAnalyticsSchema, T as ContentVersioning, Tt as themeColorsSchema, U as JsonLdBlock, Ut as BooleanOption, V as ShowCondition, Vt as trackingIdSchema, W as JsonLdResult, Wt as CountRule, X as isPlaceholderSiteUrl, Xt as motionOption, Y as hasJsonLdId, Yt as buttonStyles, Z as jsonLdSchema, Zt as themeModes, _ as SectionRegistry, _t as SiteSeo, a as createPageSchema, at as DEFAULT_MAX_HEADER_ACTIONS, b as ThemeFont, bt as brandLogoSchema, c as withoutOrphanSections, ct as FooterConfig, d as SectionOf, dt as Site, en as variantOption, et as parseJsonLdInput, f as anchorSchema, ft as SiteAnalytics, g as ContentModel, gt as SiteOf, h as API_PREFIX, ht as SiteDefinition, i as Seo, it as DEFAULT_MAX_FOOTER_COLUMNS, j as defineSection, jt as RichText, k as SectionConfig, kt as Link, l as BaseSection, lt as Header, m as sectionIdSchema, mt as SiteConsent, nt as upsertJsonLd, o as isSystemPage, ot as Footer, p as createSectionSchema, pt as SiteConfig, q as formatJsonLd, qt as Option, r as SYSTEM_PAGES, rt as BRAND_LOGO_HEIGHT, s as seoSchema, st as FooterColumn, t as Page, tt as siteJsonLdIds, u as PropsOf, ut as HeaderConfig, v as ThemeConfig, vt as SiteWith, w as ContentMigrator, wt as siteSeoSchema, x as defaultTheme, xt as defineSite, y as ThemeDefinition, yt as Theme, z as FieldChoices, zt as textSchema } from "./page-DNbZW-J7.js";
4
4
  import { a as TURNSTILE_FIELD, i as HONEYPOT_FIELD, n as FormResult, r as FormSubmission, t as FormFieldErrors } from "./form-contract-BURSJP3Y.js";
5
5
  //#region src/errors.d.ts
6
6
  /** One schema problem, addressed by a dot path such as `sections.0.props.heading`. */
@@ -104,10 +104,10 @@ declare const textMarkSchema: z.ZodObject<{
104
104
  start: z.ZodNumber;
105
105
  end: z.ZodNumber;
106
106
  weight: z.ZodOptional<z.ZodEnum<{
107
- bold: "bold";
108
107
  regular: "regular";
109
108
  medium: "medium";
110
109
  semibold: "semibold";
110
+ bold: "bold";
111
111
  }>>;
112
112
  italic: z.ZodOptional<z.ZodBoolean>;
113
113
  font: z.ZodOptional<z.ZodEnum<{
@@ -148,10 +148,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
148
148
  start: z.ZodNumber;
149
149
  end: z.ZodNumber;
150
150
  weight: z.ZodOptional<z.ZodEnum<{
151
- bold: "bold";
152
151
  regular: "regular";
153
152
  medium: "medium";
154
153
  semibold: "semibold";
154
+ bold: "bold";
155
155
  }>>;
156
156
  italic: z.ZodOptional<z.ZodBoolean>;
157
157
  font: z.ZodOptional<z.ZodEnum<{
@@ -166,10 +166,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
166
166
  start: z.ZodNumber;
167
167
  end: z.ZodNumber;
168
168
  weight: z.ZodOptional<z.ZodEnum<{
169
- bold: "bold";
170
169
  regular: "regular";
171
170
  medium: "medium";
172
171
  semibold: "semibold";
172
+ bold: "bold";
173
173
  }>>;
174
174
  italic: z.ZodOptional<z.ZodBoolean>;
175
175
  font: z.ZodOptional<z.ZodEnum<{
@@ -186,10 +186,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
186
186
  start: z.ZodNumber;
187
187
  end: z.ZodNumber;
188
188
  weight: z.ZodOptional<z.ZodEnum<{
189
- bold: "bold";
190
189
  regular: "regular";
191
190
  medium: "medium";
192
191
  semibold: "semibold";
192
+ bold: "bold";
193
193
  }>>;
194
194
  italic: z.ZodOptional<z.ZodBoolean>;
195
195
  font: z.ZodOptional<z.ZodEnum<{
@@ -446,10 +446,10 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
446
446
  start: z.ZodNumber;
447
447
  end: z.ZodNumber;
448
448
  weight: z.ZodOptional<z.ZodEnum<{
449
- bold: "bold";
450
449
  regular: "regular";
451
450
  medium: "medium";
452
451
  semibold: "semibold";
452
+ bold: "bold";
453
453
  }>>;
454
454
  italic: z.ZodOptional<z.ZodBoolean>;
455
455
  font: z.ZodOptional<z.ZodEnum<{
@@ -681,7 +681,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
681
681
  nameMarks: {
682
682
  start: number;
683
683
  end: number;
684
- weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
684
+ weight?: "regular" | "medium" | "semibold" | "bold" | undefined;
685
685
  italic?: boolean | undefined;
686
686
  font?: "sans" | "serif" | "mono" | undefined;
687
687
  }[] | undefined;
@@ -939,7 +939,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
939
939
  nameMarks?: {
940
940
  start: number;
941
941
  end: number;
942
- weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
942
+ weight?: "regular" | "medium" | "semibold" | "bold" | undefined;
943
943
  italic?: boolean | undefined;
944
944
  font?: "sans" | "serif" | "mono" | undefined;
945
945
  }[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bearminion",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "description": "A git-based CMS for Astro with no database and no server: JSON content in your repo, edited by clicking on the page during astro dev.",
5
5
  "license": "MIT",
6
6
  "author": "Jakub Lange",
@@ -2,6 +2,7 @@
2
2
  import type { Section } from '../definitions'
3
3
  import Image from '../../atoms/Image.astro'
4
4
  import { isRemote, resolveLocalAsset } from '../../../lib/assets'
5
+ import { editing } from '../../../lib/editing'
5
6
  import SectionShell from '../../molecules/SectionShell.astro'
6
7
 
7
8
  interface Props {
@@ -19,6 +20,8 @@ function showImage(src: string) {
19
20
  if (src === 'placeholder') return false
20
21
  if (isRemote(src)) return true
21
22
  if (src.replace(/^\//, '').startsWith('src/assets/') && !resolveLocalAsset(src)) {
23
+ // Just uploaded in the hosted editor: <Image> draws it from the editor's route.
24
+ if (editing) return true
22
25
  throw new Error(`No file in src/assets for image path "${src}". Restore the file, or choose another image in the editor and save.`)
23
26
  }
24
27
  return Boolean(resolveLocalAsset(src))
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "template": "default",
4
- "version": "1.16.1",
4
+ "version": "1.17.0",
5
5
  "files": {
6
6
  "src/components/atoms/Button.astro": {
7
7
  "hash": "7be42b3dc3a3b59bec169de32a9d801904689e2705473d1945724658dc799043",
@@ -144,8 +144,10 @@
144
144
  "history": []
145
145
  },
146
146
  "src/components/sections/logo-strip/LogoStrip.astro": {
147
- "hash": "0bb887f0282bf9d7d0ae65a3afc7f3813c58247c0aa70a4962a6a5e35b8e1c71",
148
- "history": []
147
+ "hash": "b647d634c1a382779dc22550c84af65a88afbec8119a5b51ee058c521b7b95b5",
148
+ "history": [
149
+ "0bb887f0282bf9d7d0ae65a3afc7f3813c58247c0aa70a4962a6a5e35b8e1c71"
150
+ ]
149
151
  },
150
152
  "src/components/sections/logo-strip/definition.ts": {
151
153
  "hash": "de761c20c0ce0b5f4fcc1ad96535addf6f7fb668abd1954709d2f68f72ccffdd",