@lupinum/ginko-content 0.1.0 → 0.1.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.
Files changed (42) hide show
  1. package/README.md +93 -47
  2. package/compatibility.json +5 -5
  3. package/dist/cli.mjs +184 -29
  4. package/dist/core/references/schema.d.ts +1 -0
  5. package/dist/core/references/schema.js +33 -10
  6. package/dist/integrations/nitro/context.d.ts +4 -8
  7. package/dist/module.d.mts +90 -30
  8. package/dist/module.json +1 -1
  9. package/dist/module.mjs +241 -41
  10. package/dist/public/client.d.ts +4 -2
  11. package/dist/public/client.js +2 -0
  12. package/dist/runtime/app/components/ContentRenderer.vue +9 -5
  13. package/dist/runtime/app/components/internal/ContentRendererMarkdown.d.vue.ts +1 -1
  14. package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue.d.ts +1 -1
  15. package/dist/runtime/app/composables/head.d.ts +27 -3
  16. package/dist/runtime/app/composables/head.js +82 -78
  17. package/dist/runtime/app/composables/query-api.d.ts +9 -10
  18. package/dist/runtime/app/composables/search.d.ts +4 -4
  19. package/dist/runtime/app/composables/search.js +11 -5
  20. package/dist/runtime/app/composables/use-content.d.ts +35 -15
  21. package/dist/runtime/app/composables/use-content.js +83 -13
  22. package/dist/runtime/query/unified.d.ts +1 -0
  23. package/dist/runtime/query/unified.js +93 -6
  24. package/dist/runtime/server/api/search.d.ts +2 -1
  25. package/dist/runtime/server/api/search.js +6 -2
  26. package/dist/runtime/server/pagefind.js +1 -0
  27. package/dist/runtime/server/plugins/sitemap.js +4 -4
  28. package/dist/runtime/server/search.d.ts +11 -0
  29. package/dist/runtime/server/search.js +24 -7
  30. package/dist/runtime/shared/search.js +3 -2
  31. package/dist/runtime/utils/sitemap-source +1 -0
  32. package/dist/runtime/utils/sitemap-source.d.ts +2 -0
  33. package/dist/runtime/utils/sitemap-source.js +6 -0
  34. package/dist/testing/provider-fixture.js +1 -0
  35. package/dist/types/config.d.ts +42 -20
  36. package/dist/types/config.js +26 -2
  37. package/dist/types/module.d.ts +39 -6
  38. package/dist/types/query.d.ts +20 -11
  39. package/dist/types/search.d.ts +3 -1
  40. package/dist/types.d.mts +2 -2
  41. package/dist/web-types.json +1 -1
  42. package/package.json +4 -4
@@ -160,6 +160,36 @@ export interface ContentSitemapAssertOptions {
160
160
  * @default []
161
161
  */
162
162
  requiredCollections?: string[];
163
+ /**
164
+ * Public URL paths that must appear in generated sitemap loc values.
165
+ *
166
+ * Values are compared by URL pathname, so absolute sitemap URLs are
167
+ * normalized before assertion. Use this for release QA of important route
168
+ * identities; keep `requiredCollections` for the broader content invariant.
169
+ *
170
+ * @default []
171
+ */
172
+ requiredPaths?: string[];
173
+ /**
174
+ * Public URL path prefixes that must not appear in generated sitemap loc
175
+ * values.
176
+ *
177
+ * Use this to guard against internal/generated routes such as `/_payload`,
178
+ * `/_nuxt`, API routes, or auth-only sections.
179
+ *
180
+ * @default []
181
+ */
182
+ forbiddenPathPrefixes?: string[];
183
+ /**
184
+ * Fail when generated sitemap URLs use placeholder or local hosts such as
185
+ * `example.com`, `localhost`, `127.0.0.1`, or `.localhost`.
186
+ *
187
+ * Enable this for production-like release checks. It is disabled by default
188
+ * so local examples and template builds can still generate static output.
189
+ *
190
+ * @default false
191
+ */
192
+ requireProductionSiteUrl?: boolean;
163
193
  /**
164
194
  * Optional per-sitemap overrides keyed by sitemap name, for example `en-US`.
165
195
  *
@@ -195,7 +225,8 @@ export interface ContentSearchOptions {
195
225
  /**
196
226
  * Collections included in the built-in index.
197
227
  *
198
- * When omitted, all configured collections are indexed.
228
+ * When omitted, Ginko indexes route-backed public collections only. Data-only
229
+ * collections are excluded unless listed explicitly.
199
230
  */
200
231
  collections?: string[];
201
232
  /**
@@ -258,8 +289,9 @@ export interface ModuleOptions {
258
289
  * Built-in full-text search configuration.
259
290
  *
260
291
  * When enabled, Ginko exposes JSON/Pagefind search endpoints under
261
- * the content api base route. Import `useContentSearchResults()` from
262
- * `@lupinum/ginko-content/client` to consume them from app components.
292
+ * the content api base route. `useContentSearchData()` and
293
+ * `useContentSearchResults()` are auto-imported; import the headless
294
+ * `useContentSearch()` helper from `@lupinum/ginko-content/client`.
263
295
  */
264
296
  search: false | ContentSearchOptions;
265
297
  /**
@@ -386,12 +418,13 @@ export interface ModuleOptions {
386
418
  /**
387
419
  * Backing implementation for public content reads.
388
420
  *
389
- * `filesystem` is the default. `cms`, `ginko-cms`, and `ginko` resolve to the
390
- * official Ginko CMS provider when `@lupinum/ginko-cms` is installed.
421
+ * `filesystem` is the default. Provider modules can register named
422
+ * implementations, for example `cms`.
391
423
  */
392
424
  provider?: ContentProviderName;
393
425
  /**
394
- * External provider modules keyed by provider name.
426
+ * External provider modules keyed by provider name. First-party provider
427
+ * modules register themselves, so app configs usually do not need this.
395
428
  */
396
429
  providers?: Record<string, string>;
397
430
  /**
@@ -1,6 +1,6 @@
1
1
  import type { ContentQueryResponse } from './api';
2
2
  import type { ContentCollectionHandle } from './config';
3
- import type { ContentNavigationItem, ParsedContent, ParsedContentInternalMeta, ParsedContentMeta, StrictParsedContentMeta } from './content';
3
+ import type { ContentNavigationItem, ParsedContent, ParsedContentInternalMeta, ParsedContentMeta, StrictParsedContent, StrictParsedContentMeta } from './content';
4
4
  /**
5
5
  * Query
6
6
  */
@@ -434,6 +434,7 @@ export interface ContentSitemapImage {
434
434
  export interface ContentSitemapEntry {
435
435
  loc: string;
436
436
  _sitemap?: string;
437
+ lastmod?: string;
437
438
  alternatives?: ContentSitemapAlternative[];
438
439
  images?: ContentSitemapImage[];
439
440
  }
@@ -530,12 +531,20 @@ export interface ContentQueryRequest {
530
531
  */
531
532
  export type ContentQueryFetcher<T> = (query: ContentQueryRequest) => Promise<ContentQueryResponse<T>>;
532
533
  export type QueryMatchOperator = (item: unknown, condition: unknown) => boolean;
533
- export interface ContentCollectionMap {
534
+ declare global {
535
+ interface GinkoContentCollectionMap {
536
+ }
537
+ interface GinkoContentCollectionI18nMap {
538
+ }
534
539
  }
535
- export interface ContentCollectionI18nMap {
540
+ export interface ContentCollectionMap extends GinkoContentCollectionMap {
536
541
  }
537
- export type ContentCollectionName = keyof ContentCollectionMap & string;
542
+ export interface ContentCollectionI18nMap extends GinkoContentCollectionI18nMap {
543
+ }
544
+ export type ContentCollectionName = keyof GinkoContentCollectionMap & string;
538
545
  export type ContentCollectionItem<K extends ContentCollectionName> = ContentCollectionMap[K];
546
+ export type ContentCollectionStringName = [ContentCollectionName] extends [never] ? string : ContentCollectionName;
547
+ export type ContentCollectionTarget = ContentCollectionHandle | ContentCollectionStringName;
539
548
  /**
540
549
  * ============================================================================
541
550
  * Unified Query API — public surface (ADR-0016)
@@ -626,8 +635,8 @@ type HandleSchema<H> = H extends {
626
635
  __schema: infer S;
627
636
  } ? S extends {
628
637
  _output: infer O;
629
- } ? O & StrictParsedContentMeta : StrictParsedContentMeta : StrictParsedContentMeta;
630
- type SelectFields<H> = H extends string ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof HandleSchema<H>, string>>;
638
+ } ? O & StrictParsedContentMeta : StrictParsedContentMeta : H extends ContentCollectionName ? ContentCollectionMap[H] & StrictParsedContentMeta : StrictParsedContentMeta;
639
+ type SelectFields<H> = string extends H ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof HandleSchema<H>, string>>;
631
640
  /**
632
641
  * Runtime document shape inferred from a collection handle.
633
642
  */
@@ -635,12 +644,12 @@ export type DocumentFromHandle<H> = H extends {
635
644
  __schema: {
636
645
  _output: infer O;
637
646
  };
638
- } ? O & ParsedContent : ParsedContent;
647
+ } ? O & StrictParsedContent : H extends ContentCollectionName ? ContentCollectionMap[H] : ParsedContent;
639
648
  /**
640
649
  * Explicit reference population map. Keys are fields on the source document;
641
650
  * values are target collection handles.
642
651
  */
643
- export type PopulateSpec = Record<string, ContentCollectionHandle | string>;
652
+ export type PopulateSpec = Record<string, ContentCollectionTarget>;
644
653
  export type PopulatedDocument<T, P> = P extends undefined ? T : P extends PopulateSpec ? string extends keyof P ? T : Omit<T, keyof P> & {
645
654
  [K in keyof P & keyof T]: T[K] extends ReadonlyArray<unknown> ? Array<LocalizedDoc<DocumentFromHandle<P[K]>>> : LocalizedDoc<DocumentFromHandle<P[K]>> | null;
646
655
  } : T;
@@ -655,7 +664,7 @@ type PopulateOption<P extends PopulateSpec | undefined = undefined> = {
655
664
  */
656
665
  type HandleIsI18n<H> = H extends {
657
666
  __i18n: infer I;
658
- } ? I extends true ? true : false : false;
667
+ } ? I extends true ? true : false : H extends keyof GinkoContentCollectionI18nMap ? true : false;
659
668
  /**
660
669
  * Locale option made required when the handle is i18n.
661
670
  */
@@ -772,7 +781,7 @@ export interface PaginationResult<T = ParsedContentMeta> {
772
781
  nextPage: number | null;
773
782
  prevPage: number | null;
774
783
  }
775
- export type BacklinkSource = ContentCollectionHandle | string;
784
+ export type BacklinkSource = ContentCollectionTarget;
776
785
  type SourceName<S> = S extends string ? S : S extends {
777
786
  name: infer N;
778
787
  } ? Extract<N, string> : string;
@@ -799,7 +808,7 @@ export type BacklinksOptions<Target = unknown, Source extends BacklinkSource | R
799
808
  limit?: number;
800
809
  skip?: number;
801
810
  fallback?: LocaleFallback;
802
- select?: Source extends string ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof DocumentFromSource<Source>, string>>;
811
+ select?: string extends Source ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof DocumentFromSource<Source>, string>>;
803
812
  } & BacklinksLocaleOption<Target, Source> & PopulateOption<P>;
804
813
  export type BacklinksResult<Source extends BacklinkSource | ReadonlyArray<BacklinkSource> = BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined> = Array<LocalizedDoc<PopulatedDocument<DocumentFromSource<Source>, P>>>;
805
814
  /**
@@ -9,7 +9,7 @@ export interface ContentMiniSearchOptions {
9
9
  /**
10
10
  * Fields copied into search result payloads.
11
11
  *
12
- * @default ['path', 'title', 'excerpt', 'anchor', 'locale']
12
+ * @default ['path', 'title', 'excerpt', 'anchor', 'locale', 'collection']
13
13
  */
14
14
  storeFields: string[];
15
15
  /**
@@ -39,6 +39,7 @@ export interface ContentSearchPublicRuntimeConfig {
39
39
  }
40
40
  export interface ContentSearchIndexRecord {
41
41
  id: string;
42
+ collection: string;
42
43
  path: string;
43
44
  title: string;
44
45
  excerpt: string;
@@ -49,6 +50,7 @@ export interface ContentSearchIndexRecord {
49
50
  [field: string]: unknown;
50
51
  }
51
52
  export interface ContentSearchResult {
53
+ collection: string;
52
54
  path: string;
53
55
  title: string;
54
56
  excerpt: string;
package/dist/types.d.mts CHANGED
@@ -6,6 +6,6 @@ declare module '@nuxt/schema' {
6
6
 
7
7
  export { type defineCollection, type defineContentConfig, type reference } from '../dist/types/config'
8
8
 
9
- export { default } from './module.mjs'
9
+ export { default, type normalizeContentConfigCollectionNames } from './module.mjs'
10
10
 
11
- export { type BacklinkFields, type BacklinkSource, type BacklinksOptions, type BacklinksResult, type BuiltinContentProviderName, type CollectionQueryBuilder, type CollectionQueryOperator, type CollectionQueryValue, type CollectionSchema, type ContentCacheArtifact, type ContentCmsCollectionConfig, type ContentCmsFieldConfig, type ContentCmsFieldType, type ContentCmsRelationConfig, type ContentCollectionConfig, type ContentCollectionHandle, type ContentCollectionI18nConfig, type ContentCollectionI18nMap, type ContentCollectionItem, type ContentCollectionItemSurroundingsOptions, type ContentCollectionKind, type ContentCollectionMap, type ContentCollectionName, type ContentCollectionNavigationOptions, type ContentCollectionPageOptions, type ContentCollectionRouteConfig, type ContentCollectionRouteMetaOptions, type ContentCollectionSearchSectionsOptions, type ContentCollectionSource, type ContentCollectionSourceObject, type ContentConfig, type ContentContext, type ContentI18nOptions, type ContentLocaleEntry, type ContentLocaleRoute, type ContentManifest, type ContentMiniSearchOptions, type ContentNavigationItem, type ContentPageResult, type ContentPreviewOptions, type ContentProviderName, type ContentProviderSearchRequest, type ContentQueryBuilder, type ContentQueryBuilderParams, type ContentQueryBuilderWhere, type ContentQueryFetcher, type ContentQueryRequest, type ContentQuerySortFields, type ContentQuerySortOptions, type ContentQuerySortParams, type ContentReferenceSchema, type ContentResolvedMeta, type ContentRevalidateOptions, type ContentRouteMeta, type ContentSearchEngine, type ContentSearchIndexRecord, type ContentSearchOptions, type ContentSearchPublicRuntimeConfig, type ContentSearchResult, type ContentSearchSection, type ContentSelector, type ContentSeoImage, type ContentSeoMeta, type ContentSitemapAlternative, type ContentSitemapAssertOptions, type ContentSitemapAssertSitemapOptions, type ContentSitemapEntry, type ContentSitemapImage, type ContentSitemapOptions, type ContentTransformer, type ContentTreeItem, type ContentVariant, type DefineCollectionObject, type DefineCollectionOptions, type DocumentFromHandle, type LocaleFallback, type LocalePathEntry, type LocalizedDoc, type ManifestVariant, type ManyOptions, type MarkdownNode, type MarkdownOptions, type MarkdownParsedContent, type MarkdownPluginDescriptor, type MarkdownPluginOptions, type MarkdownRoot, type ModuleHooks, type ModuleOptions, type MountOptions, type NavItem, type NeighborsOptions, type NeighborsResult, type OneOptions, type PaginationOptions, type PaginationResult, type ParseContentOptions, type ParsedContent, type ParsedContentInternalMeta, type ParsedContentMeta, type PopulateFromOptions, type PopulateSpec, type PopulatedDocument, type QueryGroupBuilder, type QueryGroupFunction, type QueryMatchOperator, type QueryOperators, type QueryOrderDirection, type QueryOrderOptions, type QueryWhere, type ResolutionEnvelope, type ResolveContentReferenceOptions, type ResolveOneOptions, type ResolveOneResult, type ResolvedContentI18nOptions, type ResolvedMarkdownPlugin, type ResolvedVariant, type SortDirection, type SortSpec, type StrictParsedContent, type StrictParsedContentMeta, type Toc, type TocLink, type TransformContentOptions, type TransformContentSource, type TreeOptions, type VariantsOptions } from './module.mjs'
11
+ export { type BacklinkFields, type BacklinkSource, type BacklinksOptions, type BacklinksResult, type CollectionQueryBuilder, type CollectionQueryOperator, type CollectionQueryValue, type CollectionSchema, type ContentCacheArtifact, type ContentCmsCollectionConfig, type ContentCmsFieldConfig, type ContentCmsFieldType, type ContentCmsRelationConfig, type ContentCollectionConfig, type ContentCollectionHandle, type ContentCollectionI18nConfig, type ContentCollectionI18nMap, type ContentCollectionItem, type ContentCollectionItemSurroundingsOptions, type ContentCollectionKind, type ContentCollectionMap, type ContentCollectionName, type ContentCollectionNavigationOptions, type ContentCollectionPageOptions, type ContentCollectionRouteConfig, type ContentCollectionRouteMetaOptions, type ContentCollectionSearchSectionsOptions, type ContentCollectionSource, type ContentCollectionSourceObject, type ContentCollectionStringName, type ContentCollectionTarget, type ContentConfig, type ContentContext, type ContentI18nOptions, type ContentLocaleEntry, type ContentLocaleRoute, type ContentManifest, type ContentMiniSearchOptions, type ContentNavigationItem, type ContentPageResult, type ContentPreviewOptions, type ContentProviderName, type ContentProviderSearchRequest, type ContentQueryBuilder, type ContentQueryBuilderParams, type ContentQueryBuilderWhere, type ContentQueryFetcher, type ContentQueryRequest, type ContentQuerySortFields, type ContentQuerySortOptions, type ContentQuerySortParams, type ContentReferenceSchema, type ContentResolvedMeta, type ContentRevalidateOptions, type ContentRouteMeta, type ContentSearchEngine, type ContentSearchIndexRecord, type ContentSearchOptions, type ContentSearchPublicRuntimeConfig, type ContentSearchResult, type ContentSearchSection, type ContentSelector, type ContentSeoImage, type ContentSeoMeta, type ContentSitemapAlternative, type ContentSitemapAssertOptions, type ContentSitemapAssertSitemapOptions, type ContentSitemapEntry, type ContentSitemapImage, type ContentSitemapOptions, type ContentTransformer, type ContentTreeItem, type ContentVariant, type DefineCollectionObject, type DefineCollectionOptions, type DocumentFromHandle, type LocaleFallback, type LocalePathEntry, type LocalizedDoc, type ManifestVariant, type ManyOptions, type MarkdownNode, type MarkdownOptions, type MarkdownParsedContent, type MarkdownPluginDescriptor, type MarkdownPluginOptions, type MarkdownRoot, type ModuleHooks, type ModuleOptions, type MountOptions, type NavItem, type NeighborsOptions, type NeighborsResult, type OneOptions, type PaginationOptions, type PaginationResult, type ParseContentOptions, type ParsedContent, type ParsedContentInternalMeta, type ParsedContentMeta, type PopulateFromOptions, type PopulateSpec, type PopulatedDocument, type QueryGroupBuilder, type QueryGroupFunction, type QueryMatchOperator, type QueryOperators, type QueryOrderDirection, type QueryOrderOptions, type QueryWhere, type ResolutionEnvelope, type ResolveContentReferenceOptions, type ResolveOneOptions, type ResolveOneResult, type ResolvedContentI18nOptions, type ResolvedMarkdownPlugin, type ResolvedVariant, type SortDirection, type SortSpec, type StrictParsedContent, type StrictParsedContentMeta, type Toc, type TocLink, type TransformContentOptions, type TransformContentSource, type TreeOptions, type VariantsOptions } from './module.mjs'
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@lupinum/ginko-content",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/ginko-content",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Collection-first content engine for Nuxt",
5
5
  "homepage": "https://ginko-content.nuxt.dev",
6
6
  "bugs": {
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "dependencies": {
88
88
  "@comark/vue": "^0.3.1",
89
- "@nuxt/kit": "^4.4.6",
89
+ "@nuxt/kit": "^4.4.7",
90
90
  "comark": "^0.3.2",
91
91
  "consola": "^3.4.2",
92
92
  "defu": "^6.1.7",
@@ -114,12 +114,12 @@
114
114
  },
115
115
  "devDependencies": {
116
116
  "@nuxt/module-builder": "1.0.2",
117
- "nuxt": "4.4.6",
117
+ "nuxt": "4.4.7",
118
118
  "unbuild": "^3.6.1",
119
119
  "vue-docgen-web-types": "^0.1.8"
120
120
  },
121
121
  "peerDependencies": {
122
- "nuxt": ">=4.0.0",
122
+ "nuxt": ">=4.4.7",
123
123
  "vitest": ">=4.1.6",
124
124
  "vue": "^3.5.0"
125
125
  },