@ztl-uwu/nuxt-content 2.13.5

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 (146) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/module.d.mts +1176 -0
  4. package/dist/module.json +12 -0
  5. package/dist/module.mjs +696 -0
  6. package/dist/runtime/app.vue +3 -0
  7. package/dist/runtime/app.vue.d.ts +2 -0
  8. package/dist/runtime/components/ContentDoc.vue +108 -0
  9. package/dist/runtime/components/ContentDoc.vue.d.ts +118 -0
  10. package/dist/runtime/components/ContentList.vue +59 -0
  11. package/dist/runtime/components/ContentList.vue.d.ts +59 -0
  12. package/dist/runtime/components/ContentNavigation.vue +61 -0
  13. package/dist/runtime/components/ContentNavigation.vue.d.ts +35 -0
  14. package/dist/runtime/components/ContentQuery.vue +212 -0
  15. package/dist/runtime/components/ContentQuery.vue.d.ts +0 -0
  16. package/dist/runtime/components/ContentRenderer.vue +78 -0
  17. package/dist/runtime/components/ContentRenderer.vue.d.ts +56 -0
  18. package/dist/runtime/components/ContentRendererMarkdown.vue +69 -0
  19. package/dist/runtime/components/ContentRendererMarkdown.vue.d.ts +73 -0
  20. package/dist/runtime/components/ContentSlot.vue +25 -0
  21. package/dist/runtime/components/ContentSlot.vue.d.ts +37 -0
  22. package/dist/runtime/components/DocumentDrivenEmpty.vue +18 -0
  23. package/dist/runtime/components/DocumentDrivenEmpty.vue.d.ts +17 -0
  24. package/dist/runtime/components/DocumentDrivenNotFound.vue +9 -0
  25. package/dist/runtime/components/DocumentDrivenNotFound.vue.d.ts +5 -0
  26. package/dist/runtime/components/Markdown.vue +29 -0
  27. package/dist/runtime/components/Markdown.vue.d.ts +31 -0
  28. package/dist/runtime/components/Prose/ProseCode.vue +32 -0
  29. package/dist/runtime/components/Prose/ProseCode.vue.d.ts +110 -0
  30. package/dist/runtime/components/Prose/ProseCodeInline.vue +3 -0
  31. package/dist/runtime/components/Prose/ProseCodeInline.vue.d.ts +14 -0
  32. package/dist/runtime/components/Prose/ProsePre.vue +42 -0
  33. package/dist/runtime/components/Prose/ProsePre.vue.d.ts +146 -0
  34. package/dist/runtime/composables/client-db.d.ts +14 -0
  35. package/dist/runtime/composables/client-db.js +105 -0
  36. package/dist/runtime/composables/content.d.ts +19 -0
  37. package/dist/runtime/composables/content.js +41 -0
  38. package/dist/runtime/composables/head.d.ts +4 -0
  39. package/dist/runtime/composables/head.js +94 -0
  40. package/dist/runtime/composables/helpers.d.ts +7 -0
  41. package/dist/runtime/composables/helpers.js +66 -0
  42. package/dist/runtime/composables/navigation.d.ts +2 -0
  43. package/dist/runtime/composables/navigation.js +34 -0
  44. package/dist/runtime/composables/preview.d.ts +5 -0
  45. package/dist/runtime/composables/preview.js +41 -0
  46. package/dist/runtime/composables/query.d.ts +10 -0
  47. package/dist/runtime/composables/query.js +64 -0
  48. package/dist/runtime/composables/search.d.ts +130 -0
  49. package/dist/runtime/composables/search.js +59 -0
  50. package/dist/runtime/composables/useUnwrap.d.ts +5 -0
  51. package/dist/runtime/composables/useUnwrap.js +5 -0
  52. package/dist/runtime/composables/utils.d.ts +6 -0
  53. package/dist/runtime/composables/utils.js +36 -0
  54. package/dist/runtime/composables/web-socket.d.ts +3 -0
  55. package/dist/runtime/composables/web-socket.js +65 -0
  56. package/dist/runtime/legacy/composables/client-db.d.ts +12 -0
  57. package/dist/runtime/legacy/composables/client-db.js +105 -0
  58. package/dist/runtime/legacy/composables/navigation.d.ts +2 -0
  59. package/dist/runtime/legacy/composables/navigation.js +34 -0
  60. package/dist/runtime/legacy/composables/query.d.ts +10 -0
  61. package/dist/runtime/legacy/composables/query.js +61 -0
  62. package/dist/runtime/legacy/plugins/documentDriven.d.ts +2 -0
  63. package/dist/runtime/legacy/plugins/documentDriven.js +231 -0
  64. package/dist/runtime/legacy/server.d.ts +3 -0
  65. package/dist/runtime/legacy/server.js +3 -0
  66. package/dist/runtime/legacy/types.d.ts +5 -0
  67. package/dist/runtime/pages/document-driven.vue +27 -0
  68. package/dist/runtime/pages/document-driven.vue.d.ts +2 -0
  69. package/dist/runtime/plugins/documentDriven.d.ts +2 -0
  70. package/dist/runtime/plugins/documentDriven.js +222 -0
  71. package/dist/runtime/plugins/ws.d.ts +2 -0
  72. package/dist/runtime/plugins/ws.js +7 -0
  73. package/dist/runtime/query/match/index.d.ts +6 -0
  74. package/dist/runtime/query/match/index.js +123 -0
  75. package/dist/runtime/query/match/pipeline-legacy.d.ts +2 -0
  76. package/dist/runtime/query/match/pipeline-legacy.js +22 -0
  77. package/dist/runtime/query/match/pipeline.d.ts +2 -0
  78. package/dist/runtime/query/match/pipeline.js +104 -0
  79. package/dist/runtime/query/match/utils.d.ts +35 -0
  80. package/dist/runtime/query/match/utils.js +65 -0
  81. package/dist/runtime/query/query.d.ts +12 -0
  82. package/dist/runtime/query/query.js +61 -0
  83. package/dist/runtime/server/api/cache.d.ts +7 -0
  84. package/dist/runtime/server/api/cache.js +18 -0
  85. package/dist/runtime/server/api/navigation-qid-params.d.ts +1 -0
  86. package/dist/runtime/server/api/navigation-qid-params.js +1 -0
  87. package/dist/runtime/server/api/navigation-qid.d.ts +1 -0
  88. package/dist/runtime/server/api/navigation-qid.js +1 -0
  89. package/dist/runtime/server/api/navigation.d.ts +2 -0
  90. package/dist/runtime/server/api/navigation.js +42 -0
  91. package/dist/runtime/server/api/query-qid-params.d.ts +1 -0
  92. package/dist/runtime/server/api/query-qid-params.js +1 -0
  93. package/dist/runtime/server/api/query-qid.d.ts +1 -0
  94. package/dist/runtime/server/api/query-qid.js +1 -0
  95. package/dist/runtime/server/api/query.d.ts +2 -0
  96. package/dist/runtime/server/api/query.js +32 -0
  97. package/dist/runtime/server/api/search.d.ts +8 -0
  98. package/dist/runtime/server/api/search.js +16 -0
  99. package/dist/runtime/server/content-index.d.ts +4 -0
  100. package/dist/runtime/server/content-index.js +37 -0
  101. package/dist/runtime/server/index.d.ts +1 -0
  102. package/dist/runtime/server/index.js +1 -0
  103. package/dist/runtime/server/navigation.d.ts +5 -0
  104. package/dist/runtime/server/navigation.js +96 -0
  105. package/dist/runtime/server/plugins/refresh-cache.d.ts +2 -0
  106. package/dist/runtime/server/plugins/refresh-cache.js +15 -0
  107. package/dist/runtime/server/preview.d.ts +5 -0
  108. package/dist/runtime/server/preview.js +9 -0
  109. package/dist/runtime/server/search.d.ts +14 -0
  110. package/dist/runtime/server/search.js +70 -0
  111. package/dist/runtime/server/storage.d.ts +35 -0
  112. package/dist/runtime/server/storage.js +238 -0
  113. package/dist/runtime/transformers/component-resolver.d.ts +2 -0
  114. package/dist/runtime/transformers/component-resolver.js +44 -0
  115. package/dist/runtime/transformers/csv/create-tokenizer.d.ts +39 -0
  116. package/dist/runtime/transformers/csv/create-tokenizer.js +307 -0
  117. package/dist/runtime/transformers/csv/from-csv.d.ts +13 -0
  118. package/dist/runtime/transformers/csv/from-csv.js +203 -0
  119. package/dist/runtime/transformers/csv/index.d.ts +2 -0
  120. package/dist/runtime/transformers/csv/index.js +50 -0
  121. package/dist/runtime/transformers/csv/parser.d.ts +24 -0
  122. package/dist/runtime/transformers/csv/parser.js +154 -0
  123. package/dist/runtime/transformers/index.d.ts +7 -0
  124. package/dist/runtime/transformers/index.js +50 -0
  125. package/dist/runtime/transformers/json.d.ts +2 -0
  126. package/dist/runtime/transformers/json.js +29 -0
  127. package/dist/runtime/transformers/markdown.d.ts +2 -0
  128. package/dist/runtime/transformers/markdown.js +88 -0
  129. package/dist/runtime/transformers/path-meta.d.ts +27 -0
  130. package/dist/runtime/transformers/path-meta.js +59 -0
  131. package/dist/runtime/transformers/utils.d.ts +3 -0
  132. package/dist/runtime/transformers/utils.js +12 -0
  133. package/dist/runtime/transformers/yaml.d.ts +2 -0
  134. package/dist/runtime/transformers/yaml.js +21 -0
  135. package/dist/runtime/utils/config.d.ts +4 -0
  136. package/dist/runtime/utils/config.js +7 -0
  137. package/dist/runtime/utils/html-tags.d.ts +2 -0
  138. package/dist/runtime/utils/html-tags.js +119 -0
  139. package/dist/runtime/utils/json.d.ts +10 -0
  140. package/dist/runtime/utils/json.js +20 -0
  141. package/dist/runtime/utils/query.d.ts +5 -0
  142. package/dist/runtime/utils/query.js +77 -0
  143. package/dist/runtime/virtual/transformers.d.ts +2 -0
  144. package/dist/types.d.mts +9 -0
  145. package/dist/web-types.json +572 -0
  146. package/package.json +111 -0
@@ -0,0 +1,1176 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ import { StorageValue } from 'unstorage';
3
+ import { LayoutKey } from '#build/types/layouts';
4
+ import { Options } from 'minisearch';
5
+ import { ListenOptions } from 'listhen';
6
+ import { BuiltinTheme, BuiltinLanguage, LanguageRegistration, ThemeRegistrationAny } from 'shiki';
7
+
8
+ interface ParsedContentInternalMeta {
9
+ /**
10
+ * Content id
11
+ */
12
+ _id: string;
13
+ /**
14
+ * Content source
15
+ */
16
+ _source?: string;
17
+ /**
18
+ * Content path, this path is source agnostic and it the content my live in any source
19
+ */
20
+ _path?: string;
21
+ /**
22
+ * Content title
23
+ */
24
+ title?: string;
25
+ /**
26
+ * Content draft status
27
+ */
28
+ _draft?: boolean;
29
+ /**
30
+ * Content partial status
31
+ */
32
+ _partial?: boolean;
33
+ /**
34
+ * Content locale
35
+ */
36
+ _locale?: string;
37
+ /**
38
+ * File type of the content, i.e `markdown`
39
+ */
40
+ _type?: 'markdown' | 'yaml' | 'json' | 'csv';
41
+ /**
42
+ * Path to the file relative to the content directory
43
+ */
44
+ _file?: string;
45
+ /**
46
+ * Extension of the file
47
+ */
48
+ _extension?: 'md' | 'yaml' | 'yml' | 'json' | 'json5' | 'csv';
49
+ }
50
+ interface TocLink {
51
+ id: string;
52
+ text: string;
53
+ depth: number;
54
+ children?: TocLink[];
55
+ }
56
+ interface Toc {
57
+ title: string;
58
+ depth: number;
59
+ searchDepth: number;
60
+ links: TocLink[];
61
+ }
62
+ interface MarkdownNode {
63
+ type: string;
64
+ tag?: string;
65
+ value?: string;
66
+ props?: Record<string, any>;
67
+ content?: any;
68
+ children?: MarkdownNode[];
69
+ attributes?: Record<string, any>;
70
+ fmAttributes?: Record<string, any>;
71
+ }
72
+ interface MarkdownRoot {
73
+ type: 'root';
74
+ children: MarkdownNode[];
75
+ props?: Record<string, any>;
76
+ toc?: Toc;
77
+ }
78
+ interface MarkdownHtmlNode extends MarkdownNode {
79
+ type: 'html';
80
+ value: string;
81
+ }
82
+ type MarkdownPlugin = Record<string, any>;
83
+ interface MarkdownOptions {
84
+ /**
85
+ * Enable/Disable MDC components.
86
+ */
87
+ mdc: boolean;
88
+ toc: {
89
+ /**
90
+ * Maximum heading depth to include in the table of contents.
91
+ */
92
+ depth: number;
93
+ searchDepth: number;
94
+ };
95
+ tags: Record<string, string>;
96
+ remarkPlugins: Record<string, false | (MarkdownPlugin & {
97
+ instance: any;
98
+ })>;
99
+ rehypePlugins: Record<string, false | (MarkdownPlugin & {
100
+ instance: any;
101
+ })>;
102
+ }
103
+ interface ParsedContentMeta extends ParsedContentInternalMeta {
104
+ /**
105
+ * Layout
106
+ */
107
+ layout?: LayoutKey;
108
+ [key: string]: any;
109
+ }
110
+ interface ParsedContent extends ParsedContentMeta {
111
+ /**
112
+ * Excerpt
113
+ */
114
+ excerpt?: MarkdownRoot;
115
+ /**
116
+ * Content body
117
+ */
118
+ body: MarkdownRoot | null;
119
+ }
120
+ interface MarkdownParsedContent extends ParsedContent {
121
+ _type: 'markdown';
122
+ /**
123
+ * Content is empty
124
+ */
125
+ _empty: boolean;
126
+ /**
127
+ * Content description
128
+ */
129
+ description: string;
130
+ /**
131
+ * Content excerpt, generated from content
132
+ */
133
+ excerpt?: MarkdownRoot;
134
+ /**
135
+ * Parsed Markdown body with included table of contents.
136
+ */
137
+ body: MarkdownRoot & {
138
+ toc?: Toc;
139
+ };
140
+ }
141
+ interface ContentTransformer {
142
+ name: string;
143
+ extensions: string[];
144
+ parse?(id: string, content: StorageValue, options: any): Promise<ParsedContent> | ParsedContent;
145
+ transform?(content: ParsedContent, options: any): Promise<ParsedContent> | ParsedContent;
146
+ }
147
+ interface TransformContentOptions {
148
+ transformers?: ContentTransformer[];
149
+ [key: string]: any;
150
+ }
151
+ /**
152
+ * Query
153
+ */
154
+ interface SortParams {
155
+ /**
156
+ * Locale specifier for sorting
157
+ * A string with a BCP 47 language tag
158
+ *
159
+ * @default undefined
160
+ */
161
+ $locale?: string;
162
+ /**
163
+ * Whether numeric collation should be used, such that "1" < "2" < "10".
164
+ * Possible values are `true` and `false`;
165
+ *
166
+ * @default false
167
+ */
168
+ $numeric?: boolean;
169
+ /**
170
+ * Whether upper case or lower case should sort first.
171
+ * Possible values are `"upper"`, `"lower"`, or `"false"`
172
+ *
173
+ * @default "depends on locale"
174
+ */
175
+ $caseFirst?: 'upper' | 'lower' | 'false';
176
+ /**
177
+ * Which differences in the strings should lead to non-zero result values. Possible values are:
178
+ * - "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.
179
+ * - "accent": Only strings that differ in base letters or accents and other diacritic marks compare as unequal. Examples: a ≠ b, a ≠ á, a = A.
180
+ * - "case": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.
181
+ * - "variant": Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal. Other differences may also be taken into consideration. Examples: a ≠ b, a ≠ á, a ≠ A.
182
+ *
183
+ * @default "variant"
184
+ */
185
+ $sensitivity?: 'base' | 'accent' | 'case' | 'variant';
186
+ }
187
+ interface SortFields {
188
+ [field: string]: -1 | 1;
189
+ }
190
+ type SortOptions = SortParams | SortFields;
191
+ interface QueryBuilderWhere extends Partial<Record<keyof ParsedContentInternalMeta, string | number | boolean | RegExp | QueryBuilderWhere>> {
192
+ /**
193
+ * Match only if all of nested conditions are true
194
+ *
195
+ * @example
196
+ ```ts
197
+ queryContent().where({
198
+ $and: [
199
+ { score: { $gte: 5 } },
200
+ { score: { $lte: 10 } }
201
+ ]
202
+ })
203
+ ```
204
+ **/
205
+ $and?: QueryBuilderWhere[];
206
+ /**
207
+ * Match if any of nested conditions is true
208
+ *
209
+ * @example
210
+ ```ts
211
+ queryContent().where({
212
+ $or: [
213
+ { score: { $gt: 5 } },
214
+ { score: { $lt: 3 } }
215
+ ]
216
+ })
217
+ ```
218
+ **/
219
+ $or?: QueryBuilderWhere[];
220
+ /**
221
+ * Match is condition is false
222
+ *
223
+ * @example
224
+ ```ts
225
+ queryContent().where({
226
+ title: {
227
+ $not: 'Hello World'
228
+ }
229
+ })
230
+ ```
231
+ **/
232
+ $not?: string | number | boolean | RegExp | QueryBuilderWhere;
233
+ /**
234
+ * Match if item equals condition
235
+ *
236
+ * @example
237
+ ```ts
238
+ queryContent().where({
239
+ title: {
240
+ $eq: 'Hello World'
241
+ }
242
+ })
243
+ ```
244
+ **/
245
+ $eq?: string | number | boolean | RegExp;
246
+ /**
247
+ * Match if item not equals condition
248
+ *
249
+ * @example
250
+ ```ts
251
+ queryContent().where({
252
+ score: {
253
+ $ne: 100
254
+ }
255
+ })
256
+ ```
257
+ **/
258
+ $ne?: string | number | boolean | RegExp;
259
+ /**
260
+ * Check if item is greater than condition
261
+ *
262
+ * @example
263
+ ```ts
264
+ queryContent().where({
265
+ score: {
266
+ $gt: 99.5
267
+ }
268
+ })
269
+ ```
270
+ */
271
+ $gt?: number;
272
+ /**
273
+ * Check if item is greater than or equal to condition
274
+ *
275
+ * @example
276
+ ```ts
277
+ queryContent().where({
278
+ score: {
279
+ $gte: 99.5
280
+ }
281
+ })
282
+ ```
283
+ */
284
+ $gte?: number;
285
+ /**
286
+ * Check if item is less than condition
287
+ *
288
+ * @example
289
+ ```ts
290
+ queryContent().where({
291
+ score: {
292
+ $lt: 99.5
293
+ }
294
+ })
295
+ ```
296
+ */
297
+ $lt?: number;
298
+ /**
299
+ * Check if item is less than or equal to condition
300
+ *
301
+ * @example
302
+ ```ts
303
+ queryContent().where({
304
+ score: {
305
+ $lte: 99.5
306
+ }
307
+ })
308
+ ```
309
+ */
310
+ $lte?: number;
311
+ /**
312
+ * Provides regular expression capabilities for pattern matching strings.
313
+ *
314
+ * @example
315
+ ```ts
316
+ queryContent().where({
317
+ title: {
318
+ $regex: /^foo/
319
+ }
320
+ })
321
+ ```
322
+ */
323
+ $regex?: RegExp | string;
324
+ /**
325
+ * Match if type of item equals condition
326
+ *
327
+ * @example
328
+ ```ts
329
+ queryContent().where({
330
+ field: {
331
+ $type: 'boolean'
332
+ }
333
+ })
334
+ ```
335
+ */
336
+ $type?: string;
337
+ /**
338
+ * Check key existence
339
+ *
340
+ * @example
341
+ ```ts
342
+ queryContent().where({
343
+ tag: {
344
+ $exists: false
345
+ }
346
+ })
347
+ ```
348
+ */
349
+ $exists?: boolean;
350
+ /**
351
+ * Match if item contains every condition or match every rule in condition array
352
+ *
353
+ * @example
354
+ ```ts
355
+ queryContent().where({
356
+ title: {
357
+ $contains: ['Hello', 'World']
358
+ }
359
+ })
360
+ ```
361
+ **/
362
+ $contains?: Array<string | number | boolean> | string | number | boolean;
363
+ /**
364
+ * Match if item contains at least one rule from condition array
365
+ *
366
+ * @example
367
+ ```ts
368
+ queryContent().where({
369
+ title: {
370
+ $containsAny: ['Hello', 'World']
371
+ }
372
+ })
373
+ ```
374
+ */
375
+ $containsAny?: Array<string | number | boolean>;
376
+ /**
377
+ * Ignore case contains
378
+ *
379
+ * @example
380
+ ```ts
381
+ queryContent().where({
382
+ title: {
383
+ $icontains: 'hello world'
384
+ }
385
+ })
386
+ ```
387
+ **/
388
+ $icontains?: string;
389
+ /**
390
+ * Match if item is in condition array
391
+ *
392
+ * @example
393
+ ```ts
394
+ queryContent().where({
395
+ category: {
396
+ $in: ['sport', 'nature', 'travel']
397
+ }
398
+ })
399
+ ```
400
+ **/
401
+ $in?: string | Array<string | number | boolean>;
402
+ [key: string]: undefined | string | number | boolean | RegExp | QueryBuilderWhere | Array<string | number | boolean | QueryBuilderWhere>;
403
+ }
404
+ interface QueryBuilderParams {
405
+ first?: boolean;
406
+ skip?: number;
407
+ limit?: number;
408
+ only?: string[];
409
+ without?: string[];
410
+ sort?: SortOptions[];
411
+ where?: QueryBuilderWhere[];
412
+ surround?: {
413
+ query: string | QueryBuilderWhere;
414
+ before?: number;
415
+ after?: number;
416
+ };
417
+ [key: string]: any;
418
+ }
419
+ interface QueryBuilder<T = ParsedContentMeta> {
420
+ /**
421
+ * Select a subset of fields
422
+ */
423
+ only<const K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>;
424
+ only<const K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>;
425
+ /**
426
+ * Remove a subset of fields
427
+ */
428
+ without<const K extends keyof T | string>(keys: K): QueryBuilder<Omit<T, K>>;
429
+ without<const K extends (keyof T | string)[]>(keys: K): QueryBuilder<Omit<T, K[number]>>;
430
+ /**
431
+ * Sort results
432
+ */
433
+ sort(options: SortOptions): QueryBuilder<T>;
434
+ /**
435
+ * Filter results
436
+ */
437
+ where(query: QueryBuilderWhere): QueryBuilder<T>;
438
+ /**
439
+ * Limit number of results
440
+ */
441
+ limit(count: number): QueryBuilder<T>;
442
+ /**
443
+ * Skip number of results
444
+ */
445
+ skip(count: number): QueryBuilder<T>;
446
+ /**
447
+ * Fetch list of contents
448
+ */
449
+ find(): Promise<Array<T>>;
450
+ /**
451
+ * Fetch first matched content
452
+ */
453
+ findOne(): Promise<T>;
454
+ /**
455
+ * Fetch sorround contents
456
+ */
457
+ findSurround(query: string | QueryBuilderWhere, options?: Partial<{
458
+ before: number;
459
+ after: number;
460
+ }>): Promise<Array<T>>;
461
+ /**
462
+ * Count matched contents
463
+ */
464
+ count(): Promise<number>;
465
+ /**
466
+ * Filter contents based on locale
467
+ */
468
+ locale(locale: string): QueryBuilder<T>;
469
+ /**
470
+ * Retrieve query builder params
471
+ * @internal
472
+ */
473
+ params: () => QueryBuilderParams;
474
+ }
475
+ type QueryPipe<T = any> = ((data: Array<T>, param: QueryBuilderParams) => Array<T>) | ((data: Array<T>, param: QueryBuilderParams) => void);
476
+ type DatabaseFetcher<T> = (query: QueryBuilder<T>) => Promise<Array<T> | T>;
477
+ type QueryMatchOperator = (item: any, condition: any) => boolean;
478
+ interface NavItem {
479
+ title: string;
480
+ _path: string;
481
+ _id?: string;
482
+ _draft?: boolean;
483
+ children?: NavItem[];
484
+ [key: string]: any;
485
+ }
486
+
487
+ type MountOptions = {
488
+ driver: 'fs' | 'http' | string;
489
+ name?: string;
490
+ prefix?: string;
491
+ [options: string]: any;
492
+ };
493
+ interface ModuleOptions {
494
+ /**
495
+ * Base route that will be used for content api
496
+ *
497
+ * @default '_content'
498
+ * @deprecated Use `api.base` instead
499
+ */
500
+ base: string;
501
+ api: {
502
+ /**
503
+ * Base route that will be used for content api
504
+ *
505
+ * @default '/api/_content'
506
+ */
507
+ baseURL: string;
508
+ };
509
+ /**
510
+ * Disable content watcher and hot content reload.
511
+ * Note: Watcher is a development feature and will not includes in the production.
512
+ *
513
+ * @default true
514
+ */
515
+ watch: false | {
516
+ ws: Partial<ListenOptions>;
517
+ };
518
+ /**
519
+ * Contents can be located in multiple places, in multiple directories or even in remote git repositories.
520
+ * Using sources option you can tell Content module where to look for contents.
521
+ *
522
+ * @default ['content']
523
+ */
524
+ sources: Record<string, MountOptions> | Array<string | MountOptions>;
525
+ /**
526
+ * List of ignore patterns that will be used to exclude content from parsing, rendering and watching.
527
+ *
528
+ * Note that files with a leading . or - are ignored by default
529
+ *
530
+ * @default []
531
+ */
532
+ ignores: Array<string>;
533
+ /**
534
+ * Content module uses `remark` and `rehype` under the hood to compile markdown files.
535
+ * You can modify this options to control its behavior.
536
+ */
537
+ markdown: {
538
+ /**
539
+ * Whether MDC syntax should be supported or not.
540
+ *
541
+ * @default true
542
+ */
543
+ mdc?: boolean;
544
+ /**
545
+ * Control behavior of Table of Contents generation
546
+ */
547
+ toc?: {
548
+ /**
549
+ * Maximum heading depth that includes in the table of contents.
550
+ *
551
+ * @default 2
552
+ */
553
+ depth?: number;
554
+ /**
555
+ * Maximum depth of nested tags to search for heading.
556
+ *
557
+ * @default 2
558
+ */
559
+ searchDepth?: number;
560
+ };
561
+ /**
562
+ * Tags will be used to replace markdown components and render custom components instead of default ones.
563
+ *
564
+ * @default {}
565
+ */
566
+ tags?: Record<string, string>;
567
+ /**
568
+ * Register custom remark plugin to provide new feature into your markdown contents.
569
+ * Checkout: https://github.com/remarkjs/remark/blob/main/doc/plugins.md
570
+ *
571
+ * @default []
572
+ */
573
+ remarkPlugins?: Array<string | [string, MarkdownPlugin]> | Record<string, false | MarkdownPlugin>;
574
+ /**
575
+ * Register custom remark plugin to provide new feature into your markdown contents.
576
+ * Checkout: https://github.com/rehypejs/rehype/blob/main/doc/plugins.md
577
+ *
578
+ * @default []
579
+ */
580
+ rehypePlugins?: Array<string | [string, MarkdownPlugin]> | Record<string, false | MarkdownPlugin>;
581
+ /**
582
+ * Anchor link generation config
583
+ *
584
+ * @default {}
585
+ */
586
+ anchorLinks?: boolean | {
587
+ /**
588
+ * Sets the maximal depth for anchor link generation
589
+ *
590
+ * @default 4
591
+ */
592
+ depth?: number;
593
+ /**
594
+ * Excludes headings from link generation when they are in the depth range.
595
+ *
596
+ * @default [1]
597
+ */
598
+ exclude?: number[];
599
+ };
600
+ };
601
+ /**
602
+ * Content module uses `shiki` to highlight code blocks.
603
+ * You can configure Shiki options to control its behavior.
604
+ */
605
+ highlight: false | {
606
+ /**
607
+ * Default theme that will be used for highlighting code blocks.
608
+ */
609
+ theme?: BuiltinTheme | {
610
+ default: BuiltinTheme;
611
+ [theme: string]: BuiltinTheme;
612
+ };
613
+ /**
614
+ * Preloaded languages that will be available for highlighting code blocks.
615
+ *
616
+ * @deprecated Use `langs` instead
617
+ */
618
+ preload?: (BuiltinLanguage | LanguageRegistration)[];
619
+ /**
620
+ * Languages to be bundled loaded by Shiki
621
+ *
622
+ * All languages used has to be included in this list at build time, to create granular bundles.
623
+ *
624
+ * Unlike the `preload` option, when this option is provided, it will override the default languages.
625
+ *
626
+ * @default ['js','jsx','json','ts','tsx','vue','css','html','vue','bash','md','mdc','yaml']
627
+ */
628
+ langs?: (BuiltinLanguage | LanguageRegistration)[];
629
+ /**
630
+ * Additional themes to be bundled loaded by Shiki
631
+ */
632
+ themes?: (BuiltinTheme | ThemeRegistrationAny)[];
633
+ };
634
+ /**
635
+ * Options for yaml parser.
636
+ *
637
+ * @default {}
638
+ */
639
+ yaml: false | Record<string, any>;
640
+ /**
641
+ * Options for yaml parser.
642
+ *
643
+ * @default {}
644
+ */
645
+ csv: false | {
646
+ json?: boolean;
647
+ delimeter?: string;
648
+ };
649
+ /**
650
+ * Enable/Disable navigation.
651
+ *
652
+ * @default {}
653
+ */
654
+ navigation: false | {
655
+ fields: Array<string>;
656
+ };
657
+ /**
658
+ * List of locale codes.
659
+ * This codes will be used to detect contents locale.
660
+ *
661
+ * @default []
662
+ */
663
+ locales: Array<string>;
664
+ /**
665
+ * Default locale for top level contents.
666
+ *
667
+ * @default undefined
668
+ */
669
+ defaultLocale?: string;
670
+ /**
671
+ * Enable automatic usage of `useContentHead`
672
+ *
673
+ * @default true
674
+ */
675
+ contentHead?: boolean;
676
+ /**
677
+ * Document-driven mode config
678
+ *
679
+ * @default false
680
+ */
681
+ documentDriven: boolean | {
682
+ host?: string;
683
+ page?: boolean;
684
+ navigation?: boolean;
685
+ surround?: boolean;
686
+ globals?: {
687
+ [key: string]: QueryBuilderParams;
688
+ };
689
+ layoutFallbacks?: string[];
690
+ injectPage?: boolean;
691
+ trailingSlash?: boolean;
692
+ };
693
+ /**
694
+ * Enable to keep uppercase characters in the generated routes.
695
+ *
696
+ * @default false
697
+ */
698
+ respectPathCase: boolean;
699
+ experimental: {
700
+ clientDB?: boolean;
701
+ stripQueryParameters?: boolean;
702
+ advanceQuery?: boolean;
703
+ /**
704
+ * Control content cach generation.
705
+ *
706
+ * This option might be removed in the next major version.
707
+ */
708
+ cacheContents?: boolean;
709
+ /**
710
+ * Search mode.
711
+ *
712
+ * @default undefined
713
+ */
714
+ search?: {
715
+ /**
716
+ * List of tags where text must not be extracted.
717
+ *
718
+ * By default, will extract text from each tag.
719
+ *
720
+ * @default ['script', 'style', 'pre']
721
+ */
722
+ ignoredTags?: Array<string>;
723
+ /**
724
+ * Query used to filter contents that must be searched.
725
+ * @default { _partial: false, _draft: false}
726
+ */
727
+ filterQuery?: QueryBuilderWhere;
728
+ /**
729
+ * API return indexed contents to improve client-side load time.
730
+ * This option will use MiniSearch to create the index.
731
+ * If you disable this option, API will return raw contents instead
732
+ * you can use with any client-side search.
733
+ *
734
+ * @default true
735
+ */
736
+ indexed?: boolean;
737
+ /**
738
+ * MiniSearch Options. When using `indexed` option,
739
+ * this options will be used to configure MiniSearch
740
+ * in order to have the same options on both server and client side.
741
+ *
742
+ * @default
743
+ * {
744
+ * fields: ['title', 'content', 'titles'],
745
+ * storeFields: ['title', 'content', 'titles'],
746
+ * searchOptions: {
747
+ * prefix: true,
748
+ * fuzzy: 0.2,
749
+ * boost: {
750
+ * title: 4,
751
+ * content: 2,
752
+ * titles: 1
753
+ * }
754
+ * }
755
+ * }
756
+ *
757
+ * @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
758
+ */
759
+ options?: Options;
760
+ };
761
+ };
762
+ }
763
+ interface ContentContext extends ModuleOptions {
764
+ base: Readonly<string>;
765
+ transformers: Array<string>;
766
+ }
767
+
768
+ interface ContentQueryFindResponse<T> {
769
+ result: Array<T>;
770
+ skip: number;
771
+ limit: number;
772
+ total: number;
773
+ }
774
+ interface ContentQueryFindOneResponse<T> {
775
+ result: T | undefined;
776
+ }
777
+ interface ContentQueryCountResponse {
778
+ result: number;
779
+ }
780
+ type ContentQueryResponse<T> = ContentQueryFindResponse<T> | ContentQueryFindOneResponse<T> | ContentQueryCountResponse;
781
+ interface ContentQueryWithSurround<T> {
782
+ surround: Array<T | null>;
783
+ }
784
+ interface ContentQueryWithDirConfig {
785
+ dirConfig: Record<string, any>;
786
+ }
787
+
788
+ /**
789
+ * Query
790
+ */
791
+ interface ContentQuerySortParams {
792
+ /**
793
+ * Locale specifier for sorting
794
+ * A string with a BCP 47 language tag
795
+ *
796
+ * @default undefined
797
+ */
798
+ $locale?: string;
799
+ /**
800
+ * Whether numeric collation should be used, such that "1" < "2" < "10".
801
+ * Possible values are `true` and `false`;
802
+ *
803
+ * @default false
804
+ */
805
+ $numeric?: boolean;
806
+ /**
807
+ * Whether upper case or lower case should sort first.
808
+ * Possible values are `"upper"`, `"lower"`, or `"false"`
809
+ *
810
+ * @default "depends on locale"
811
+ */
812
+ $caseFirst?: 'upper' | 'lower' | 'false';
813
+ /**
814
+ * Which differences in the strings should lead to non-zero result values. Possible values are:
815
+ * - "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.
816
+ * - "accent": Only strings that differ in base letters or accents and other diacritic marks compare as unequal. Examples: a ≠ b, a ≠ á, a = A.
817
+ * - "case": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.
818
+ * - "variant": Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal. Other differences may also be taken into consideration. Examples: a ≠ b, a ≠ á, a ≠ A.
819
+ *
820
+ * @default "variant"
821
+ */
822
+ $sensitivity?: 'base' | 'accent' | 'case' | 'variant';
823
+ }
824
+ interface ContentQuerySortFields {
825
+ [field: string]: -1 | 1;
826
+ }
827
+ type ContentQuerySortOptions = ContentQuerySortParams | ContentQuerySortFields;
828
+ interface ContentQueryBuilderWhere extends Partial<Record<keyof ParsedContentInternalMeta, string | number | boolean | RegExp | ContentQueryBuilderWhere>> {
829
+ /**
830
+ * Match only if all of nested conditions are true
831
+ *
832
+ * @example
833
+ ```ts
834
+ queryContent().where({
835
+ $and: [
836
+ { score: { $gte: 5 } },
837
+ { score: { $lte: 10 } }
838
+ ]
839
+ })
840
+ ```
841
+ **/
842
+ $and?: ContentQueryBuilderWhere[];
843
+ /**
844
+ * Match if any of nested conditions is true
845
+ *
846
+ * @example
847
+ ```ts
848
+ queryContent().where({
849
+ $or: [
850
+ { score: { $gt: 5 } },
851
+ { score: { $lt: 3 } }
852
+ ]
853
+ })
854
+ ```
855
+ **/
856
+ $or?: ContentQueryBuilderWhere[];
857
+ /**
858
+ * Match is condition is false
859
+ *
860
+ * @example
861
+ ```ts
862
+ queryContent().where({
863
+ title: {
864
+ $not: 'Hello World'
865
+ }
866
+ })
867
+ ```
868
+ **/
869
+ $not?: string | number | boolean | RegExp | ContentQueryBuilderWhere;
870
+ /**
871
+ * Match if item equals condition
872
+ *
873
+ * @example
874
+ ```ts
875
+ queryContent().where({
876
+ title: {
877
+ $eq: 'Hello World'
878
+ }
879
+ })
880
+ ```
881
+ **/
882
+ $eq?: string | number | boolean | RegExp;
883
+ /**
884
+ * Match if item not equals condition
885
+ *
886
+ * @example
887
+ ```ts
888
+ queryContent().where({
889
+ score: {
890
+ $ne: 100
891
+ }
892
+ })
893
+ ```
894
+ **/
895
+ $ne?: string | number | boolean | RegExp;
896
+ /**
897
+ * Check if item is greater than condition
898
+ *
899
+ * @example
900
+ ```ts
901
+ queryContent().where({
902
+ score: {
903
+ $gt: 99.5
904
+ }
905
+ })
906
+ ```
907
+ */
908
+ $gt?: number | string;
909
+ /**
910
+ * Check if item is greater than or equal to condition
911
+ *
912
+ * @example
913
+ ```ts
914
+ queryContent().where({
915
+ score: {
916
+ $gte: 99.5
917
+ }
918
+ })
919
+ ```
920
+ */
921
+ $gte?: number | string;
922
+ /**
923
+ * Check if item is less than condition
924
+ *
925
+ * @example
926
+ ```ts
927
+ queryContent().where({
928
+ score: {
929
+ $lt: 99.5
930
+ }
931
+ })
932
+ ```
933
+ */
934
+ $lt?: number | string;
935
+ /**
936
+ * Check if item is less than or equal to condition
937
+ *
938
+ * @example
939
+ ```ts
940
+ queryContent().where({
941
+ score: {
942
+ $lte: 99.5
943
+ }
944
+ })
945
+ ```
946
+ */
947
+ $lte?: number | string;
948
+ /**
949
+ * Provides regular expression capabilities for pattern matching strings.
950
+ *
951
+ * @example
952
+ ```ts
953
+ queryContent().where({
954
+ title: {
955
+ $regex: /^foo/
956
+ }
957
+ })
958
+ ```
959
+ */
960
+ $regex?: RegExp | string;
961
+ /**
962
+ * Match if type of item equals condition
963
+ *
964
+ * @example
965
+ ```ts
966
+ queryContent().where({
967
+ field: {
968
+ $type: 'boolean'
969
+ }
970
+ })
971
+ ```
972
+ */
973
+ $type?: string;
974
+ /**
975
+ * Check key existence
976
+ *
977
+ * @example
978
+ ```ts
979
+ queryContent().where({
980
+ tag: {
981
+ $exists: false
982
+ }
983
+ })
984
+ ```
985
+ */
986
+ $exists?: boolean;
987
+ /**
988
+ * Match if item contains every condition or match every rule in condition array
989
+ *
990
+ * @example
991
+ ```ts
992
+ queryContent().where({
993
+ title: {
994
+ $contains: ['Hello', 'World']
995
+ }
996
+ })
997
+ ```
998
+ **/
999
+ $contains?: Array<string | number | boolean> | string | number | boolean;
1000
+ /**
1001
+ * Match if item contains at least one rule from condition array
1002
+ *
1003
+ * @example
1004
+ ```ts
1005
+ queryContent().where({
1006
+ title: {
1007
+ $containsAny: ['Hello', 'World']
1008
+ }
1009
+ })
1010
+ ```
1011
+ */
1012
+ $containsAny?: Array<string | number | boolean>;
1013
+ /**
1014
+ * Ignore case contains
1015
+ *
1016
+ * @example
1017
+ ```ts
1018
+ queryContent().where({
1019
+ title: {
1020
+ $icontains: 'hello world'
1021
+ }
1022
+ })
1023
+ ```
1024
+ **/
1025
+ $icontains?: string;
1026
+ /**
1027
+ * Match if item is in condition array
1028
+ *
1029
+ * @example
1030
+ ```ts
1031
+ queryContent().where({
1032
+ category: {
1033
+ $in: ['sport', 'nature', 'travel']
1034
+ }
1035
+ })
1036
+ ```
1037
+ **/
1038
+ $in?: Array<string | number | boolean>;
1039
+ [key: string]: string | number | boolean | RegExp | ContentQueryBuilderWhere | Array<string | number | boolean | ContentQueryBuilderWhere> | undefined;
1040
+ }
1041
+ interface ContentQueryBuilderParams {
1042
+ first?: boolean;
1043
+ skip?: number;
1044
+ limit?: number;
1045
+ only?: string[];
1046
+ without?: string[];
1047
+ sort?: ContentQuerySortOptions[];
1048
+ where?: ContentQueryBuilderWhere[] | ContentQueryBuilderWhere;
1049
+ surround?: {
1050
+ query: string | ContentQueryBuilderWhere;
1051
+ before?: number;
1052
+ after?: number;
1053
+ };
1054
+ [key: string]: any;
1055
+ }
1056
+ type ValidKey<T> = keyof T | string;
1057
+ type ValidKeys<T> = Array<keyof T | string>;
1058
+ interface ContentQueryBuilder<T = ParsedContentMeta, Y = Record<string, any>> {
1059
+ /**
1060
+ * Select a subset of fields
1061
+ */
1062
+ only<T, K extends ValidKey<T>>(keys: K): ContentQueryBuilder<Pick<T, Extract<K, keyof T>>, Y>;
1063
+ only<T, K extends ValidKeys<T>>(keys: K): ContentQueryBuilder<Pick<T, Extract<K[number], keyof T>>, Y>;
1064
+ /**
1065
+ * Remove a subset of fields
1066
+ */
1067
+ without<const K extends keyof T | string>(keys: K): ContentQueryBuilder<Omit<T, K>, Y>;
1068
+ without<const K extends (keyof T | string)[]>(keys: K): ContentQueryBuilder<Omit<T, K[number]>, Y>;
1069
+ /**
1070
+ * Filter results
1071
+ */
1072
+ where(query: ContentQueryBuilderWhere): ContentQueryBuilder<T, Y>;
1073
+ /**
1074
+ * Sort results
1075
+ */
1076
+ sort(options: ContentQuerySortOptions): ContentQueryBuilder<T, Y>;
1077
+ /**
1078
+ * Limit number of results
1079
+ */
1080
+ limit(count: number): ContentQueryBuilder<T, Y>;
1081
+ /**
1082
+ * Skip number of results
1083
+ */
1084
+ skip(count: number): ContentQueryBuilder<T, Y>;
1085
+ /**
1086
+ * Retrieve query builder params
1087
+ * @internal
1088
+ */
1089
+ params: () => ContentQueryBuilderParams;
1090
+ /**
1091
+ * Filter contents based on locale
1092
+ */
1093
+ locale(locale: string): ContentQueryBuilder<T, Y>;
1094
+ /**
1095
+ * Fetch list of contents
1096
+ */
1097
+ find(): Promise<ContentQueryFindResponse<T> & Y>;
1098
+ /**
1099
+ * Fetch first matched content
1100
+ */
1101
+ findOne(): Promise<ContentQueryFindOneResponse<T> & Y>;
1102
+ /**
1103
+ * Count matched contents
1104
+ */
1105
+ count(): Promise<ContentQueryCountResponse>;
1106
+ /**
1107
+ * Fetch sorround contents
1108
+ */
1109
+ withSurround(query: string | ContentQueryBuilderWhere, options?: Partial<{
1110
+ before: number;
1111
+ after: number;
1112
+ }>): ContentQueryBuilder<T, ContentQueryWithSurround<T>>;
1113
+ /**
1114
+ * Fetch sorround contents
1115
+ */
1116
+ withDirConfig(): ContentQueryBuilder<T, ContentQueryWithDirConfig>;
1117
+ }
1118
+ type ContentQueryFetcher<T> = (query: ContentQueryBuilder<T>) => Promise<ContentQueryResponse<T>>;
1119
+
1120
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
1121
+
1122
+ interface ModuleHooks {
1123
+ 'content:context'(ctx: ContentContext): void;
1124
+ }
1125
+ interface ModulePublicRuntimeConfig {
1126
+ experimental: {
1127
+ stripQueryParameters: boolean;
1128
+ clientDB: boolean;
1129
+ advanceQuery: boolean;
1130
+ };
1131
+ api: {
1132
+ baseURL: string;
1133
+ };
1134
+ host: string | undefined;
1135
+ trailingSlash: boolean;
1136
+ integrity: number | undefined;
1137
+ respectPathCase: boolean;
1138
+ defaultLocale: ModuleOptions['defaultLocale'];
1139
+ locales: ModuleOptions['locales'];
1140
+ tags: Record<string, string>;
1141
+ base: string;
1142
+ wsUrl?: string;
1143
+ highlight: ModuleOptions['highlight'];
1144
+ navigation: ModuleOptions['navigation'];
1145
+ search: ModuleOptions['experimental']['search'];
1146
+ contentHead: ModuleOptions['contentHead'];
1147
+ documentDriven: ModuleOptions['documentDriven'];
1148
+ }
1149
+ interface ModulePrivateRuntimeConfig {
1150
+ /**
1151
+ * Internal version that represents cache format.
1152
+ * This is used to invalidate cache when the format changes.
1153
+ */
1154
+ cacheVersion: string;
1155
+ cacheIntegrity: string;
1156
+ }
1157
+ declare module '@nuxt/schema' {
1158
+ interface PublicRuntimeConfig {
1159
+ content: ModulePublicRuntimeConfig;
1160
+ }
1161
+ interface PrivateRuntimeConfig {
1162
+ content: ModulePrivateRuntimeConfig & ContentContext;
1163
+ }
1164
+ }
1165
+ declare module 'nitropack' {
1166
+ interface NitroRuntimeHooks {
1167
+ 'content:file:beforeParse': (file: {
1168
+ _id: string;
1169
+ body: string;
1170
+ }) => void;
1171
+ 'content:file:afterParse': (file: ParsedContent) => void;
1172
+ }
1173
+ }
1174
+
1175
+ export { _default as default };
1176
+ export type { ContentContext, ContentQueryBuilder, ContentQueryBuilderParams, ContentQueryBuilderWhere, ContentQueryCountResponse, ContentQueryFetcher, ContentQueryFindOneResponse, ContentQueryFindResponse, ContentQueryResponse, ContentQuerySortFields, ContentQuerySortOptions, ContentQuerySortParams, ContentQueryWithDirConfig, ContentQueryWithSurround, ContentTransformer, DatabaseFetcher, MarkdownHtmlNode, MarkdownNode, MarkdownOptions, MarkdownParsedContent, MarkdownPlugin, MarkdownRoot, ModuleHooks, ModuleOptions, MountOptions, NavItem, ParsedContent, ParsedContentInternalMeta, ParsedContentMeta, QueryBuilder, QueryBuilderParams, QueryBuilderWhere, QueryMatchOperator, QueryPipe, SortFields, SortOptions, SortParams, Toc, TocLink, TransformContentOptions };