@moku-labs/web 1.5.1 → 1.5.2

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/dist/index.cjs CHANGED
@@ -4390,9 +4390,10 @@ async function generateOgImages(ctx, options = {}) {
4390
4390
  fonts,
4391
4391
  ...renderHook
4392
4392
  });
4393
+ const siteCardRender = typeof config.defaultCard === "function" ? config.defaultCard : defaultSiteCard;
4393
4394
  const renderSitePng = options.renderPng ?? makeDefaultRenderer({
4394
4395
  fonts,
4395
- render: defaultSiteCard
4396
+ render: siteCardRender
4396
4397
  });
4397
4398
  const siteName = resolveSiteName(ctx);
4398
4399
  const defaultLocale = ctx.require(i18nPlugin).defaultLocale();
@@ -4418,7 +4419,7 @@ async function generateOgImages(ctx, options = {}) {
4418
4419
  outDir
4419
4420
  }, tally);
4420
4421
  })));
4421
- const defaultCard = config.defaultCard === true;
4422
+ const defaultCard = config.defaultCard === true || typeof config.defaultCard === "function";
4422
4423
  if (defaultCard) {
4423
4424
  const png = await renderSitePng({
4424
4425
  title: siteName,
package/dist/index.d.cts CHANGED
@@ -1633,12 +1633,16 @@ interface OgImageConfig {
1633
1633
  /** Explicit named fonts loaded once per build (overrides the first-file scan). */
1634
1634
  fonts?: OgFont[];
1635
1635
  /**
1636
- * When `true`, also render a single SITE-LEVEL default card to `<outDir>/og-default.png`
1637
- * a generic site name + description on a dark background, using the same loaded fonts (the
1638
- * per-article `render` hook is NOT applied). Point `head.defaultOgImage` at `"/og-default.png"`
1639
- * to use it as the og:image fallback for non-article pages. Default `false`.
1636
+ * Also render a single SITE-LEVEL default card to `<outDir>/og-default.png`, used (via
1637
+ * `head.defaultOgImage: "/og-default.png"`) as the og:image fallback for non-article pages.
1638
+ * Rendered ONCE with the same loaded fonts; the per-article `render` hook is NOT applied.
1639
+ *
1640
+ * - `true` → the built-in generic card (site name over its description on a dark background).
1641
+ * - a render function → your OWN card, e.g. `defaultCard: MySiteCard` (a `(input) => VNode`,
1642
+ * the same shape as `render`); `input.siteName`/`input.description` carry the site identity.
1643
+ * - `false`/omitted → no card (default).
1640
1644
  */
1641
- defaultCard?: boolean;
1645
+ defaultCard?: boolean | ((input: RichOgInput) => import("preact").VNode);
1642
1646
  }
1643
1647
  /**
1644
1648
  * Public configuration for the `build` plugin. Flags give opt-in granularity over
package/dist/index.d.mts CHANGED
@@ -1633,12 +1633,16 @@ interface OgImageConfig {
1633
1633
  /** Explicit named fonts loaded once per build (overrides the first-file scan). */
1634
1634
  fonts?: OgFont[];
1635
1635
  /**
1636
- * When `true`, also render a single SITE-LEVEL default card to `<outDir>/og-default.png`
1637
- * a generic site name + description on a dark background, using the same loaded fonts (the
1638
- * per-article `render` hook is NOT applied). Point `head.defaultOgImage` at `"/og-default.png"`
1639
- * to use it as the og:image fallback for non-article pages. Default `false`.
1636
+ * Also render a single SITE-LEVEL default card to `<outDir>/og-default.png`, used (via
1637
+ * `head.defaultOgImage: "/og-default.png"`) as the og:image fallback for non-article pages.
1638
+ * Rendered ONCE with the same loaded fonts; the per-article `render` hook is NOT applied.
1639
+ *
1640
+ * - `true` → the built-in generic card (site name over its description on a dark background).
1641
+ * - a render function → your OWN card, e.g. `defaultCard: MySiteCard` (a `(input) => VNode`,
1642
+ * the same shape as `render`); `input.siteName`/`input.description` carry the site identity.
1643
+ * - `false`/omitted → no card (default).
1640
1644
  */
1641
- defaultCard?: boolean;
1645
+ defaultCard?: boolean | ((input: RichOgInput) => import("preact").VNode);
1642
1646
  }
1643
1647
  /**
1644
1648
  * Public configuration for the `build` plugin. Flags give opt-in granularity over
package/dist/index.mjs CHANGED
@@ -4377,9 +4377,10 @@ async function generateOgImages(ctx, options = {}) {
4377
4377
  fonts,
4378
4378
  ...renderHook
4379
4379
  });
4380
+ const siteCardRender = typeof config.defaultCard === "function" ? config.defaultCard : defaultSiteCard;
4380
4381
  const renderSitePng = options.renderPng ?? makeDefaultRenderer({
4381
4382
  fonts,
4382
- render: defaultSiteCard
4383
+ render: siteCardRender
4383
4384
  });
4384
4385
  const siteName = resolveSiteName(ctx);
4385
4386
  const defaultLocale = ctx.require(i18nPlugin).defaultLocale();
@@ -4405,7 +4406,7 @@ async function generateOgImages(ctx, options = {}) {
4405
4406
  outDir
4406
4407
  }, tally);
4407
4408
  })));
4408
- const defaultCard = config.defaultCard === true;
4409
+ const defaultCard = config.defaultCard === true || typeof config.defaultCard === "function";
4409
4410
  if (defaultCard) {
4410
4411
  const png = await renderSitePng({
4411
4412
  title: siteName,
package/package.json CHANGED
@@ -113,5 +113,5 @@
113
113
  "test:cli-e2e": "bun test src/plugins/cli/__tests__/e2e/",
114
114
  "test:coverage": "vitest run --project unit --project integration --coverage"
115
115
  },
116
- "version": "1.5.1"
116
+ "version": "1.5.2"
117
117
  }