@getvitops/astro 8.1.0 → 8.2.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 (59) hide show
  1. package/CHANGELOG.md +824 -33
  2. package/dist/config-adapters-CbTywgEY.mjs +71 -0
  3. package/dist/config-adapters-CbTywgEY.mjs.map +1 -0
  4. package/dist/exports/tracking.d.mts +1 -1
  5. package/dist/exports/tracking.mjs +1 -1
  6. package/dist/index.d.mts +65 -48
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +240 -32
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/middleware.d.mts +23 -0
  11. package/dist/middleware.d.mts.map +1 -0
  12. package/dist/middleware.mjs +34 -0
  13. package/dist/middleware.mjs.map +1 -0
  14. package/dist/routes/conversion.d.mts +131 -16
  15. package/dist/routes/conversion.d.mts.map +1 -1
  16. package/dist/routes/conversion.mjs +133 -28
  17. package/dist/routes/conversion.mjs.map +1 -1
  18. package/dist/{tracking-CmSfxWC3.mjs → tracking-Cb3A0BrC.mjs} +3 -4
  19. package/dist/tracking-Cb3A0BrC.mjs.map +1 -0
  20. package/dist/{tracking-DdEKExlE.d.mts → tracking-D2xOzjFD.d.mts} +6 -26
  21. package/dist/tracking-D2xOzjFD.d.mts.map +1 -0
  22. package/package.json +12 -8
  23. package/src/ads.ts +52 -16
  24. package/src/analytics.ts +98 -11
  25. package/src/components/Analytics.astro +5 -1
  26. package/src/components/CookieConsent.astro +2 -1
  27. package/src/components/Icon.astro +8 -1
  28. package/src/components/ReviewCardBody.astro +5 -2
  29. package/src/components/Tracking.astro +2 -1
  30. package/src/schemas/Article.astro +2 -1
  31. package/src/schemas/BookActions.astro +2 -1
  32. package/src/schemas/Breadcrumb.astro +2 -1
  33. package/src/schemas/Carousel.astro +2 -1
  34. package/src/schemas/CourseList.astro +2 -1
  35. package/src/schemas/Dataset.astro +2 -1
  36. package/src/schemas/DiscussionForum.astro +2 -1
  37. package/src/schemas/EducationQA.astro +2 -1
  38. package/src/schemas/EmployerAggregateRating.astro +2 -1
  39. package/src/schemas/Event.astro +2 -1
  40. package/src/schemas/FAQ.astro +2 -1
  41. package/src/schemas/FactCheck.astro +2 -1
  42. package/src/schemas/ImageMetadata.astro +2 -1
  43. package/src/schemas/JobPosting.astro +2 -1
  44. package/src/schemas/LocalBusiness.astro +2 -1
  45. package/src/schemas/MathSolver.astro +2 -1
  46. package/src/schemas/MovieCarousel.astro +2 -1
  47. package/src/schemas/Organization.astro +2 -1
  48. package/src/schemas/Product.astro +2 -1
  49. package/src/schemas/ProfilePage.astro +2 -1
  50. package/src/schemas/QAPage.astro +2 -1
  51. package/src/schemas/Recipe.astro +2 -1
  52. package/src/schemas/Review.astro +2 -1
  53. package/src/schemas/SoftwareApp.astro +2 -1
  54. package/src/scripts/tracking.ts +114 -21
  55. package/src/seo.ts +6 -5
  56. package/src/tracking.ts +6 -10
  57. package/virtual.d.ts +17 -1
  58. package/dist/tracking-CmSfxWC3.mjs.map +0 -1
  59. package/dist/tracking-DdEKExlE.d.mts.map +0 -1
@@ -0,0 +1,71 @@
1
+ import { t } from "@getvitops/utils/content";
2
+
3
+ // src/routes/config-adapters.ts
4
+ /**
5
+ * Resolves the one display name for a site's organization — `organization.name`
6
+ * (localizable; `locale` picks which one, defaulting to `site.defaultLocale`,
7
+ * which is also the fallback if the pick has no entry), falling back to
8
+ * `legalName` when `name` isn't set at all, and to `undefined` (never `''`)
9
+ * when neither resolves to anything — `t()` returns `''` for a genuinely
10
+ * missing translation, and an empty name is worse than none.
11
+ *
12
+ * This is the one place that fallback chain is written. An EmDash site's own
13
+ * `getSiteSettings().title` is a separate, runtime-only fact (EmDash's
14
+ * settings aren't readable at Astro build/config time at all — see
15
+ * AGENTS.md's "EmDash plugin as the design-system editing surface") and stays
16
+ * authoritative for what it drives (the rendered page chrome); this helper is
17
+ * for the build-time-only consumers that can't reach EmDash at all — favicon
18
+ * generation, generated legal documents, notification emails — so a scaffold
19
+ * needing a name in `astro.config.mjs` has one real source instead of a third
20
+ * hardcoded string.
21
+ */
22
+ function resolveOrganizationName(config, locale) {
23
+ const org = config.organization;
24
+ const resolvedLocale = locale ?? config.site.defaultLocale;
25
+ return (org?.name != null ? t(org.name, resolvedLocale, config.site.defaultLocale) || void 0 : void 0) ?? org?.legalName;
26
+ }
27
+ /**
28
+ * Builds the `context` option `createConversionRoute()` expects, straight from a
29
+ * resolved `Config` — instead of every consumer hand-writing a `NotifyContext`
30
+ * literal.
31
+ *
32
+ * `locationEmails` is primary-first, then every other location with an `email`,
33
+ * in `organization.locations`' own key order — `planNotifications` picks the
34
+ * first that's set, so order here is the whole precedence.
35
+ */
36
+ function toNotifyContext(config, locale) {
37
+ const org = config.organization;
38
+ const primaryKey = org?.primaryLocation;
39
+ const locationEmails = Object.entries(org?.locations ?? {}).sort(([a], [b]) => a === primaryKey ? -1 : b === primaryKey ? 1 : 0).map(([, loc]) => loc.email).filter((email) => !!email);
40
+ return {
41
+ notifications: config.site.notifications,
42
+ canonical: config.site.domains?.canonical,
43
+ organizationName: resolveOrganizationName(config, locale),
44
+ locationEmails
45
+ };
46
+ }
47
+ /**
48
+ * `site.crm` IS `CrmConfig` — both are the schema's inferred type from `@getvitops/config` — so
49
+ * this returns its argument's field unchanged.
50
+ *
51
+ * @deprecated Pass `config.site.crm` directly. Kept so existing callers keep compiling; it
52
+ * stopped being an adapter when the type stopped being a copy.
53
+ */
54
+ function toCrmConfig(config) {
55
+ return config.site.crm;
56
+ }
57
+ /**
58
+ * `site.ads.google`'s three server-side-relevant fields, for
59
+ * `createConversionRoute`'s `googleAdsOffline.config`. Undefined when the site has no Google Ads
60
+ * property configured at all, which `createConversionRoute` reads the same way `crm` being
61
+ * omitted does: the upload never runs.
62
+ *
63
+ * @deprecated Pass `config.site.ads?.google` directly — it is already assignable. Kept so existing
64
+ * callers keep compiling.
65
+ */
66
+ function toGoogleAdsConfig(config) {
67
+ return config.site.ads?.google;
68
+ }
69
+
70
+ export { toNotifyContext as i, toCrmConfig as n, toGoogleAdsConfig as r, resolveOrganizationName as t };
71
+ //# sourceMappingURL=config-adapters-CbTywgEY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-adapters-CbTywgEY.mjs","names":[],"sources":["../src/routes/config-adapters.ts"],"sourcesContent":["/**\n * Adapts a resolved `Config` (`@getvitops/generator`) into the structural shapes\n * `createConversionRoute()` expects — `context: NotifyContext` and `crm.config:\n * CrmConfig`. Neither of those types can import `Config` themselves (they live in\n * `@getvitops/utils`, which the generator already depends on — importing back\n * would be a cycle), which is why `conversion.ts`'s own docblock used to describe\n * `toNotifyContext(config)` as a helper that \"does not exist.\" This package\n * already depends on both the generator and utils, so it's the one place the\n * adapter can live.\n *\n * `import type` only — erased at build, so pulling in `Config`'s type costs\n * nothing at runtime and doesn't drag the generator's `node:fs`/lightningcss\n * entry point into a Worker bundle.\n */\nimport type { Config } from '@getvitops/generator';\n// The `/content` subpath, not the root barrel: the root re-exports `favicon` (sharp), and a\n// Worker route should not depend on tree-shaking to keep it out.\nimport { t, type Localizable } from '@getvitops/utils/content';\nimport type { AdPropertySetup } from '@getvitops/utils/ads';\nimport type { CrmConfig } from '@getvitops/utils/crm';\nimport type { NotifyContext } from '@getvitops/utils/notify';\n\n/**\n * The slice of a `Config` that `resolveOrganizationName` reads. Structural on\n * purpose: `import config from './site.json'` types its literals widened\n * (`colors.utilities` becomes `string[]`, not the schema's union), so it is not\n * assignable to the full `Config`, and every scaffolded site calls this with\n * exactly such an import. A resolved `Config` still satisfies it.\n */\nexport interface OrganizationNameSource {\n organization?: { name?: Localizable | undefined; legalName?: string | undefined } | undefined;\n site: { defaultLocale: string };\n}\n\n/**\n * Resolves the one display name for a site's organization — `organization.name`\n * (localizable; `locale` picks which one, defaulting to `site.defaultLocale`,\n * which is also the fallback if the pick has no entry), falling back to\n * `legalName` when `name` isn't set at all, and to `undefined` (never `''`)\n * when neither resolves to anything — `t()` returns `''` for a genuinely\n * missing translation, and an empty name is worse than none.\n *\n * This is the one place that fallback chain is written. An EmDash site's own\n * `getSiteSettings().title` is a separate, runtime-only fact (EmDash's\n * settings aren't readable at Astro build/config time at all — see\n * AGENTS.md's \"EmDash plugin as the design-system editing surface\") and stays\n * authoritative for what it drives (the rendered page chrome); this helper is\n * for the build-time-only consumers that can't reach EmDash at all — favicon\n * generation, generated legal documents, notification emails — so a scaffold\n * needing a name in `astro.config.mjs` has one real source instead of a third\n * hardcoded string.\n */\nexport function resolveOrganizationName(\n config: OrganizationNameSource,\n locale?: string,\n): string | undefined {\n const org = config.organization;\n const resolvedLocale = locale ?? config.site.defaultLocale;\n const name =\n org?.name != null\n ? t(org.name, resolvedLocale, config.site.defaultLocale) || undefined\n : undefined;\n return name ?? org?.legalName;\n}\n\n/**\n * Builds the `context` option `createConversionRoute()` expects, straight from a\n * resolved `Config` — instead of every consumer hand-writing a `NotifyContext`\n * literal.\n *\n * `locationEmails` is primary-first, then every other location with an `email`,\n * in `organization.locations`' own key order — `planNotifications` picks the\n * first that's set, so order here is the whole precedence.\n */\nexport function toNotifyContext(config: Config, locale?: string): NotifyContext {\n const org = config.organization;\n const primaryKey = org?.primaryLocation;\n const locationEmails = Object.entries(org?.locations ?? {})\n .sort(([a], [b]) => (a === primaryKey ? -1 : b === primaryKey ? 1 : 0))\n .map(([, loc]) => loc.email)\n .filter((email): email is string => !!email);\n\n return {\n notifications: config.site.notifications,\n canonical: config.site.domains?.canonical,\n organizationName: resolveOrganizationName(config, locale),\n locationEmails,\n };\n}\n\n/**\n * `site.crm` IS `CrmConfig` — both are the schema's inferred type from `@getvitops/config` — so\n * this returns its argument's field unchanged.\n *\n * @deprecated Pass `config.site.crm` directly. Kept so existing callers keep compiling; it\n * stopped being an adapter when the type stopped being a copy.\n */\nexport function toCrmConfig(config: Config): CrmConfig | undefined {\n return config.site.crm;\n}\n\n/**\n * `site.ads.google`'s three server-side-relevant fields, for\n * `createConversionRoute`'s `googleAdsOffline.config`. Undefined when the site has no Google Ads\n * property configured at all, which `createConversionRoute` reads the same way `crm` being\n * omitted does: the upload never runs.\n *\n * @deprecated Pass `config.site.ads?.google` directly — it is already assignable. Kept so existing\n * callers keep compiling.\n */\nexport function toGoogleAdsConfig(\n config: Config,\n): Pick<AdPropertySetup, 'accountId' | 'conversionActionId' | 'reporting'> | undefined {\n return config.site.ads?.google;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,wBACd,QACA,QACoB;CACpB,MAAM,MAAM,OAAO;CACnB,MAAM,iBAAiB,UAAU,OAAO,KAAK;CAK7C,QAHE,KAAK,QAAQ,OACT,EAAE,IAAI,MAAM,gBAAgB,OAAO,KAAK,aAAa,KAAK,SAC1D,WACS,KAAK;AACtB;;;;;;;;;;AAWA,SAAgB,gBAAgB,QAAgB,QAAgC;CAC9E,MAAM,MAAM,OAAO;CACnB,MAAM,aAAa,KAAK;CACxB,MAAM,iBAAiB,OAAO,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,CACxD,MAAM,CAAC,IAAI,CAAC,OAAQ,MAAM,aAAa,KAAK,MAAM,aAAa,IAAI,CAAE,CAAC,CACtE,KAAK,GAAG,SAAS,IAAI,KAAK,CAAC,CAC3B,QAAQ,UAA2B,CAAC,CAAC,KAAK;CAE7C,OAAO;EACL,eAAe,OAAO,KAAK;EAC3B,WAAW,OAAO,KAAK,SAAS;EAChC,kBAAkB,wBAAwB,QAAQ,MAAM;EACxD;CACF;AACF;;;;;;;;AASA,SAAgB,YAAY,QAAuC;CACjE,OAAO,OAAO,KAAK;AACrB;;;;;;;;;;AAWA,SAAgB,kBACd,QACqF;CACrF,OAAO,OAAO,KAAK,KAAK;AAC1B"}
@@ -1,3 +1,3 @@
1
- import { a as TRACKING_ENDPOINT } from "../tracking-DdEKExlE.mjs";
1
+ import { a as TRACKING_ENDPOINT } from "../tracking-D2xOzjFD.mjs";
2
2
  export * from "@getvitops/utils/tracking";
3
3
  export { TRACKING_ENDPOINT };
@@ -1,4 +1,4 @@
1
- import { n as TRACKING_ENDPOINT } from "../tracking-CmSfxWC3.mjs";
1
+ import { n as TRACKING_ENDPOINT } from "../tracking-Cb3A0BrC.mjs";
2
2
 
3
3
  export * from "@getvitops/utils/tracking"
4
4
 
package/dist/index.d.mts CHANGED
@@ -1,12 +1,11 @@
1
- import { i as TRACKING_COOKIE, n as ResolveTrackingContext, o as TrackingCategory, r as ResolvedTracking, s as resolveTracking, t as GetvitopsTrackingOptions } from "./tracking-DdEKExlE.mjs";
2
- import { LegalOutput, SiteFont, StylesheetFormat } from "@getvitops/generator";
1
+ import { i as TRACKING_COOKIE, n as ResolveTrackingContext, o as TrackingCategory, r as ResolvedTracking, s as resolveTracking, t as GetvitopsTrackingOptions } from "./tracking-D2xOzjFD.mjs";
2
+ import { Config, LegalOutput, SiteFont, StylesheetFormat } from "@getvitops/generator";
3
3
  import { generateIconInclude } from "@getvitops/utils";
4
4
  import { AdProvider } from "@getvitops/utils/ads";
5
+ import { AdPropertyConfig } from "@getvitops/config";
5
6
  import { OutputKind } from "@getvitops/utils/media";
6
7
  import { AstroIntegration } from "astro";
7
8
  export * from "@getvitops/utils";
8
-
9
- //#region src/analytics.d.ts
10
9
  /**
11
10
  * The `<Analytics />` resolution layer — provider config in, the exact tags to
12
11
  * emit out.
@@ -152,6 +151,19 @@ interface ResolvedAnalytics {
152
151
  interface ResolveAnalyticsContext {
153
152
  /** Is the consent gate enabled on this site (`vitops({ consent })`)? */
154
153
  consent?: boolean;
154
+ /**
155
+ * Enabled `site.experiments` entries, keyed the same way, each carrying the
156
+ * resolved cookie name `vitopsAbTesting()`'s middleware assigns
157
+ * (`_ab_<key>` unless overridden). When set, each provider's bootstrap
158
+ * reads these cookies client-side and reports the assignment via that
159
+ * provider's own custom-dimension/property mechanism — a no-op when this
160
+ * is empty, so a site not using experiments sees no behavior change.
161
+ */
162
+ experiments?: Record<string, {
163
+ cookieName: string;
164
+ }>;
165
+ /** `site.analytics.matomo.abVariantDimensions` — Matomo's pre-created custom-dimension index per experiment key. */
166
+ matomoAbVariantDimensions?: Record<string, number>;
155
167
  }
156
168
  /**
157
169
  * Resolve the configured providers into the tags to emit.
@@ -160,11 +172,9 @@ interface ResolveAnalyticsContext {
160
172
  * malformed ID should not take down a build, and a missing tag is visible in the
161
173
  * output while a failed build is just a red wall.
162
174
  */
163
- declare function resolveAnalytics(opts: GetvitopsAnalyticsOptions | undefined, ctx?: ResolveAnalyticsContext): ResolvedAnalytics;
175
+ export declare function resolveAnalytics(opts: GetvitopsAnalyticsOptions | undefined, ctx?: ResolveAnalyticsContext): ResolvedAnalytics;
164
176
  /** Which optional categories a set of tags actually needs a visitor to decide. */
165
- declare function consentCategories(tags: GatedTag[]): OptionalConsentCategory[];
166
- //#endregion
167
- //#region src/seo.d.ts
177
+ export declare function consentCategories(tags: GatedTag[]): OptionalConsentCategory[];
168
178
  /**
169
179
  * The `<Seo />` resolution layer — site-level defaults merged with per-page props
170
180
  * into the exact tags to emit.
@@ -184,11 +194,12 @@ type SeoOgType = 'website' | 'article' | 'profile';
184
194
  * Site-level SEO defaults, passed to `vitops({ seo })` and baked into the
185
195
  * `virtual:getvitops/head` module. Per-page `<Seo />` props override these.
186
196
  *
187
- * The vocabulary mirrors the site-config schema's `seo` block
188
- * (`@getvitops/generator`, `src/config.ts`) so a `Config` → these adapter would
189
- * be a flat field map — but it is not imported from there. This is the
190
- * integration's own option surface, and it must stay JSON-serialisable: it is
191
- * `JSON.stringify`d into the virtual module, so no functions, no `URL`s, no dates.
197
+ * `site.seo` in the site config is the source (`@getvitops/config`'s `SeoSchema`);
198
+ * `resolveSeoDefaults()` turns it into this shape for a build locale, and `vitops({ seo })` is merged
199
+ * over the result as an override. This interface is therefore the *resolved* shape — plain strings,
200
+ * `Localizable` already picked — and must stay JSON-serialisable: it is `JSON.stringify`d into the
201
+ * virtual module, so no functions, no `URL`s, no dates. `seo-defaults.test.ts` fails when a
202
+ * `site.seo` field is added to the schema and not read here (ADR-0002).
192
203
  */
193
204
  interface GetvitopsSeoOptions {
194
205
  /** `og:site_name`, and the `<title>` when a page passes none. */
@@ -216,9 +227,13 @@ interface GetvitopsSeoOptions {
216
227
  /** Bing Webmaster Tools verification token. */
217
228
  bingSiteVerification?: string;
218
229
  openGraph?: {
219
- /** Default `og:type` (default `'website'`). */type?: SeoOgType; /** `og:locale`. Written either way — `en-CA` and `en_CA` both emit `en_CA`. */
220
- locale?: string; /** Additional locales the same content exists in → `og:locale:alternate`. */
221
- localeAlternates?: string[]; /** Fallback share image. Relative URLs resolve against `site`. */
230
+ /** Default `og:type` (default `'website'`). */
231
+ type?: SeoOgType;
232
+ /** `og:locale`. Written either way — `en-CA` and `en_CA` both emit `en_CA`. */
233
+ locale?: string;
234
+ /** Additional locales the same content exists in → `og:locale:alternate`. */
235
+ localeAlternates?: string[];
236
+ /** Fallback share image. Relative URLs resolve against `site`. */
222
237
  image?: {
223
238
  url: string;
224
239
  alt?: string;
@@ -228,8 +243,11 @@ interface GetvitopsSeoOptions {
228
243
  };
229
244
  };
230
245
  twitter?: {
231
- /** Card type when no image resolves (default `'summary'`). */card?: SeoTwitterCard; /** The site's own handle, `@acme`. */
232
- site?: string; /** Default author handle, `@ada`. */
246
+ /** Card type when no image resolves (default `'summary'`). */
247
+ card?: SeoTwitterCard;
248
+ /** The site's own handle, `@acme`. */
249
+ site?: string;
250
+ /** Default author handle, `@ada`. */
233
251
  creator?: string;
234
252
  };
235
253
  }
@@ -341,9 +359,7 @@ interface SeoContext {
341
359
  * through its three arguments, which is what makes it testable and what keeps the
342
360
  * package free of the consumer-global coupling that sank the previous site model.
343
361
  */
344
- declare function resolveSeo(defaults: GetvitopsSeoOptions, props: SeoProps, ctx: SeoContext): ResolvedSeo;
345
- //#endregion
346
- //#region src/integration.d.ts
362
+ export declare function resolveSeo(defaults: GetvitopsSeoOptions, props: SeoProps, ctx: SeoContext): ResolvedSeo;
347
363
  interface GetvitopsFaviconOptions {
348
364
  /** Source SVG or PNG. */
349
365
  source: string;
@@ -624,8 +640,11 @@ interface GetvitopsOptions {
624
640
  sitemap?: boolean | GetvitopsSitemapOptions;
625
641
  /**
626
642
  * Site-level defaults for `<Seo />` (`@getvitops/astro/Seo.astro`) — site name,
627
- * title template, Open Graph + Twitter defaults, verification tokens. Off unless
628
- * provided; per-page props override every field.
643
+ * title template, Open Graph + Twitter defaults, verification tokens.
644
+ *
645
+ * These come from `site.seo` in the site config (with `organization.name` as the site
646
+ * name); this option is an **override** merged over that, field by field, for a value
647
+ * an app wants to set in code. Per-page props override both.
629
648
  *
630
649
  * Needs the `site` astro.config option for canonical and `og:url`; without it
631
650
  * `<Seo />` omits every absolute-URL tag rather than deriving one from the
@@ -750,25 +769,14 @@ interface GetvitopsIconsOptions {
750
769
  /** Aliases applied before the semantic map — legacy names, or values stored in CMS content. */
751
770
  overrides?: Record<string, string>;
752
771
  }
753
- declare function vitops(opts?: GetvitopsOptions): AstroIntegration;
754
- //#endregion
755
- //#region src/ads.d.ts
772
+ export default function vitops(opts?: GetvitopsOptions): AstroIntegration;
756
773
  /**
757
- * One ad property, mirroring a `site.ads` entry field for field.
758
- *
759
- * Structural rather than `SiteAdProperty` imported from the generator, matching
760
- * how `GetvitopsSeoOptions` and `GetvitopsTrackingOptions` already work: the
761
- * component surface must stay usable by a consumer who passes a plain object.
774
+ * One ad property, as `<Ads />` reads it: the fields of a `site.ads` entry that decide what is
775
+ * emitted. A subset of `AdPropertyConfig` from `@getvitops/config` — the schema's own inferred
776
+ * type, not a copy — so a plain object is still enough for a consumer to pass, and a field the
777
+ * schema renames fails here instead of silently reading `undefined`.
762
778
  */
763
- interface GetvitopsAdProperty {
764
- accountId?: string;
765
- pixelId?: string;
766
- conversionLabel?: string;
767
- /** Default `marketing`. `analytics` for a property used purely for measurement. */
768
- category?: 'marketing' | 'analytics';
769
- /** False keeps the property on record without emitting its tag. */
770
- enabled?: boolean;
771
- }
779
+ type GetvitopsAdProperty = Pick<AdPropertyConfig, 'accountId' | 'pixelId' | 'conversionLabel' | 'conversionActionId' | 'reporting' | 'category' | 'enabled'>;
772
780
  type GetvitopsAdsOptions = Partial<Record<AdProvider, GetvitopsAdProperty>>;
773
781
  /** One ad tag. `key` is the platform, so a caller can find one without matching prose. */
774
782
  interface ResolvedAdTag extends GatedTag {
@@ -792,9 +800,7 @@ interface ResolveAdsContext {
792
800
  strategy?: AnalyticsStrategy;
793
801
  }
794
802
  /** Resolve the configured ad properties into the tags `<Ads />` emits. */
795
- declare function resolveAds(ads: GetvitopsAdsOptions | undefined, ctx?: ResolveAdsContext): ResolvedAds;
796
- //#endregion
797
- //#region src/lastmod.d.ts
803
+ export declare function resolveAds(ads: GetvitopsAdsOptions | undefined, ctx?: ResolveAdsContext): ResolvedAds;
798
804
  interface GitLastmodOptions {
799
805
  /** Directories to read history from (default `src/pages`, `src/content`, `src/data`). */
800
806
  dirs?: string[];
@@ -810,9 +816,9 @@ interface GitLastmodOptions {
810
816
  * commit date describes the template rather than any of them. Stamping every
811
817
  * generated page with the template's date is exactly the "wrong date" case above.
812
818
  */
813
- declare function routeFromPage(file: string): string | undefined;
819
+ export declare function routeFromPage(file: string): string | undefined;
814
820
  /** The slug a content entry is most likely published under. */
815
- declare function slugFromContent(file: string): string | undefined;
821
+ export declare function slugFromContent(file: string): string | undefined;
816
822
  /**
817
823
  * Build a `serialize` function that stamps `lastmod` from git history.
818
824
  *
@@ -821,7 +827,18 @@ declare function slugFromContent(file: string): string | undefined;
821
827
  * is dropped rather than guessed at, since picking either one would be a coin
822
828
  * flip presented as a fact.
823
829
  */
824
- declare function gitLastmod(options?: GitLastmodOptions): Promise<(item: GetvitopsSitemapEntry) => GetvitopsSitemapEntry>;
825
- //#endregion
826
- export { type AnalyticsStrategy, type ClarityOptions, type ConsentCategory, type GatedTag, type GetvitopsAdProperty, type GetvitopsAdsOptions, type GetvitopsAnalyticsOptions, type GetvitopsConsentOptions, type GetvitopsCssOptions, type GetvitopsFaviconOptions, type GetvitopsMediaOptions, type GetvitopsOptions, type GetvitopsSeoOptions, type GetvitopsSitemapChangeFreq, type GetvitopsSitemapEntry, type GetvitopsSitemapOptions, type GetvitopsTrackingOptions, type GitLastmodOptions, type GoogleAnalyticsOptions, type MatomoOptions, type OptionalConsentCategory, type PlausibleOptions, type ResolveAdsContext, type ResolveAnalyticsContext, type ResolveTrackingContext, type ResolvedAdTag, type ResolvedAds, type ResolvedAnalytics, type ResolvedSeo, type ResolvedTag, type ResolvedTracking, type SeoContext, type SeoNameTag, type SeoOgType, type SeoPropertyTag, type SeoProps, type SeoTwitterCard, TRACKING_COOKIE, type TrackingCategory, consentCategories, vitops as default, gitLastmod, resolveAds, resolveAnalytics, resolveSeo, resolveTracking, routeFromPage, slugFromContent };
830
+ export declare function gitLastmod(options?: GitLastmodOptions): Promise<(item: GetvitopsSitemapEntry) => GetvitopsSitemapEntry>;
831
+ interface ResolveSeoDefaultsOptions {
832
+ /** Build locale. Default `site.defaultLocale`; a value with no entry falls back to the default. */
833
+ locale?: string;
834
+ /** Which `site.environments` entry to read `robots` from. Default `'production'`. */
835
+ env?: string;
836
+ }
837
+ export declare function resolveSeoDefaults(config: Config, options?: ResolveSeoDefaultsOptions): GetvitopsSeoOptions;
838
+ /**
839
+ * Merge `vitops({ seo })` over config-derived defaults. The two nested objects merge key by key, so
840
+ * setting `openGraph.locale` in code doesn't discard the config's fallback image.
841
+ */
842
+ export declare function mergeSeoDefaults(fromConfig: GetvitopsSeoOptions, override: GetvitopsSeoOptions | undefined): GetvitopsSeoOptions;
843
+ export { type AnalyticsStrategy, type ClarityOptions, type ConsentCategory, type GatedTag, type GetvitopsAdProperty, type GetvitopsAdsOptions, type GetvitopsAnalyticsOptions, type GetvitopsConsentOptions, type GetvitopsCssOptions, type GetvitopsFaviconOptions, type GetvitopsMediaOptions, type GetvitopsOptions, type GetvitopsSeoOptions, type GetvitopsSitemapChangeFreq, type GetvitopsSitemapEntry, type GetvitopsSitemapOptions, type GetvitopsTrackingOptions, type GitLastmodOptions, type GoogleAnalyticsOptions, type MatomoOptions, type OptionalConsentCategory, type PlausibleOptions, type ResolveAdsContext, type ResolveAnalyticsContext, type ResolveSeoDefaultsOptions, type ResolveTrackingContext, type ResolvedAdTag, type ResolvedAds, type ResolvedAnalytics, type ResolvedSeo, type ResolvedTag, type ResolvedTracking, type SeoContext, type SeoNameTag, type SeoOgType, type SeoPropertyTag, type SeoProps, type SeoTwitterCard, TRACKING_COOKIE, type TrackingCategory, resolveTracking };
827
844
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/analytics.ts","../src/seo.ts","../src/integration.ts","../src/ads.ts","../src/lastmod.ts"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA;;;;AAA6B;AAQ7B;;;;AAA2B;AAE3B;;;;AAA6D;AAE7D;KAZY,iBAAA;;;;;;;KAQA,eAAA;AAAA,KAEA,uBAAA,GAA0B,OAAO,CAAC,eAAA;AAAA,UAE7B,sBAAA;EAYA;EAVf,EAAA;;;;;EAKA,QAAA,GAAW,uBAAA;EAQuB;EANlC,MAAA,GAAS,MAAM;AAAA;AAAA,UAGA,cAAA;;EAEf,EAAA;EACA,QAAA,GAAW,uBAAuB;AAAA;AAAA,UAGnB,aAAA;EAaR;EAXP,GAAA;EAce;EAZf,MAAA;;;AAgBG;AAGL;;;;;EAVE,OAAA;AAAA;AAAA,UAGe,gBAAA;EAaa;EAX5B,MAAA;EAMA;EAJA,GAAG;AAAA;AAAA,UAGY,yBAAA;EACf,eAAA,YAA2B,sBAAA;EAC3B,OAAA,YAAmB,cAAA;EACnB,MAAA,GAAS,aAAA;EACT,SAAA,YAAqB,gBAAA;EAErB;EAAA,QAAA,GAAW,iBAAA;AAAA;AAAiB;AAW9B;;;;;;;AAX8B,UAWb,uBAAA;EAON;AAkBX;;;EApBE,UAAA,GAAa,uBAAuB;EA2B1B;EAzBV,SAAA;AAAA;;;;;;;;;;;;;;;AAmCa;UAjBE,QAAA;EAqBY;EAnB3B,QAAA;EACA,QAAA,EA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AA;AAAA,UAGU,WAAA;EACf,IAAA,EAAM,aAAa;EHeZ;EGbP,YAAA;EHgBe;EGdf,QAAA;AAAA;AAAA,UAGe,iBAAA;EHeZ;EGbH,OAAA;EHgBwC;EGdxC,iBAAA;EHe2B;EGb3B,OAAA;EHeS;EGbT,QAAA,GAAW,iBAAiB;AAAA;;iBAYd,UAAA,CACd,GAAA,EAAK,mBAAA,cACL,GAAA,GAAK,iBAAA,GACJ,WAAA;;;UC9Cc,iBAAA;;EAEf,IAAA;;EAEA,GAAA;;EAEA,MAAA,IAAU,OAAA;AAAA;;AJlBZ;;;;AAA6B;AAQ7B;iBIoBgB,aAAA,CAAc,IAAY;;iBAa1B,eAAA,CAAgB,IAAY;AJjCjB;AAE3B;;;;AAA6D;AAE7D;;AAJ2B,iBIqFL,UAAA,CACpB,OAAA,GAAS,iBAAA,GACR,OAAA,EAAS,IAAA,EAAM,qBAAA,KAA0B,qBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":["MediaOutputKind"],"sources":["../src/analytics.ts","../src/seo.ts","../src/integration.ts","../src/ads.ts","../src/lastmod.ts","../src/seo-defaults.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BY;;;;;;;KAQA;KAEA,0BAA0B,QAAQ;UAE7B;;EAEf;;;;;EAKA,WAAW;;EAEX,SAAS;;UAGM;;EAEf;EACA,WAAW;;UAGI;;EAEf;;EAEA;;;;;;;;;EASA;;UAGe;;EAEf;;EAEA;;UAGe;EACf,2BAA2B;EAC3B,mBAAmB;EACnB,SAAS;EACT,qBAAqB;;EAErB,WAAW;;;;;;;;;;UAWI;;;;;EAKf,aAAa;;EAEb;;;;;;;;;;;;;;;;;UAkBe;;EAEf;EACA,UAAU;EACV;;EAEA;EACA,UAAU;;;;;;EAMV;;EAEA;EACA;EACA,OAAO;;;UAIQ,oBAAoB;EACnC;;UAGe;EACf,MAAM;;EAEN;;EAEA;;UAGe;;EAEf;;;;;;;;;EASA,cAAc;IAA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