1- import { defineDocumentType , makeSource } from "contentlayer/source-files" ;
1+ import {
2+ ComputedFields ,
3+ defineDocumentType ,
4+ makeSource ,
5+ } from "contentlayer2/source-files" ;
26import rehypeAutolinkHeadings from "rehype-autolink-headings" ;
37import rehypePrettyCode from "rehype-pretty-code" ;
48import rehypeSlug from "rehype-slug" ;
59import remarkGfm from "remark-gfm" ;
610import { visit } from "unist-util-visit" ;
711
8- /** @type {import('contentlayer/source-files').ComputedFields } */
9- const computedFields = {
12+ const defaultComputedFields : ComputedFields = {
1013 slug : {
1114 type : "string" ,
1215 resolve : ( doc ) => `/${ doc . _raw . flattenedPath } ` ,
@@ -34,7 +37,7 @@ export const Doc = defineDocumentType(() => ({
3437 default : true ,
3538 } ,
3639 } ,
37- computedFields,
40+ computedFields : defaultComputedFields ,
3841} ) ) ;
3942
4043export const Guide = defineDocumentType ( ( ) => ( {
@@ -62,7 +65,7 @@ export const Guide = defineDocumentType(() => ({
6265 default : false ,
6366 } ,
6467 } ,
65- computedFields,
68+ computedFields : defaultComputedFields ,
6669} ) ) ;
6770
6871export const Post = defineDocumentType ( ( ) => ( {
@@ -99,7 +102,7 @@ export const Post = defineDocumentType(() => ({
99102 required : true ,
100103 } ,
101104 } ,
102- computedFields,
105+ computedFields : defaultComputedFields ,
103106} ) ) ;
104107
105108export const Author = defineDocumentType ( ( ) => ( {
@@ -123,7 +126,7 @@ export const Author = defineDocumentType(() => ({
123126 required : true ,
124127 } ,
125128 } ,
126- computedFields,
129+ computedFields : defaultComputedFields ,
127130} ) ) ;
128131
129132export const Page = defineDocumentType ( ( ) => ( {
@@ -139,7 +142,7 @@ export const Page = defineDocumentType(() => ({
139142 type : "string" ,
140143 } ,
141144 } ,
142- computedFields,
145+ computedFields : defaultComputedFields ,
143146} ) ) ;
144147
145148export default makeSource ( {
0 commit comments