Skip to content

Commit fbd13b3

Browse files
committed
build: unserialized plugin throwing
1 parent fcb0103 commit fbd13b3

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

examples/gatsbydocs/contentlayer.config.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import rehypeShiki from '@stefanprobst/rehype-shiki'
2-
import type { FieldDef} from 'contentlayer/source-files';
3-
import { defineDocumentType, defineNestedType,makeSource } from 'contentlayer/source-files'
2+
import type { FieldDef } from 'contentlayer/source-files'
3+
import { defineDocumentType, defineNestedType, makeSource } from 'contentlayer/source-files'
44
import { createRequire } from 'module'
55
import * as path from 'path'
66
import * as shiki from 'shiki'
@@ -20,7 +20,7 @@ const fields: Record<string, FieldDef> = {
2020
},
2121
jsdoc: {
2222
type: 'list',
23-
of: {type: 'string'},
23+
of: { type: 'string' },
2424
},
2525
tableOfContentsDepth: { type: 'number' },
2626
showTopLevelSignatures: { type: 'boolean' },
@@ -61,20 +61,20 @@ const Tutorial = defineDocumentType(() => ({
6161
}))
6262

6363
export default makeSource(async () => {
64-
const require = createRequire(import.meta.url)
65-
const shikiPkgPath = (dir: string) => path.join(require.resolve('shiki'), '..', '..', dir, path.sep)
66-
const highlighter = await shiki.getHighlighter({
67-
paths: { languages: shikiPkgPath('languages'), themes: shikiPkgPath('themes') },
68-
theme: 'github-light',
69-
})
64+
// const require = createRequire(import.meta.url)
65+
// const shikiPkgPath = (dir: string) => path.join(require.resolve('shiki'), '..', '..', dir, path.sep)
66+
// const highlighter = await shiki.getHighlighter({
67+
// paths: { languages: shikiPkgPath('languages'), themes: shikiPkgPath('themes') },
68+
// theme: 'github-light',
69+
// })
7070

7171
return {
7272
contentDirPath: 'content',
7373
documentTypes: [Reference, HowTo, Conceptual, Tutorial],
7474
// onUnknownDocuments: 'skip-ignore',
75-
markdown: {
76-
// '@stefanprobst/rehype-shiki', {}
77-
rehypePlugins: [[rehypeShiki, { highlighter }]],
78-
},
75+
// markdown: {
76+
// // '@stefanprobst/rehype-shiki', {}
77+
// rehypePlugins: [[rehypeShiki, { highlighter }]],
78+
// },
7979
}
8080
})

packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { FetchDataError } from '../errors/index.js'
1111
import type { Flags } from '../index.js'
1212
import type { ContentTypeMap, FilePathPatternMap } from '../types.js'
1313
import { DocumentTypeMap, provideDocumentTypeMapState } from './DocumentTypeMap.js'
14+
import { makeCacheItemFromFilePath as withoutPool } from './makeCacheItemFromFilePath.js'
1415
import { fromWorkerPool } from './makeCacheItemFromFilePath.worker.js'
15-
// import {createPool} from './makeCacheItemFromFilePath.worker.js'
1616

1717
export const fetchAllDocuments = ({
1818
coreSchemaDef,
@@ -46,10 +46,10 @@ export const fetchAllDocuments = ({
4646
const concurrencyLimit = os.cpus().length
4747

4848
const makeCacheItemFromFilePath = fromWorkerPool()
49+
// const makeCacheItemFromFilePath = withoutPool
4950
const { dataErrors, documents, documentTypeMap } = yield* $(
5051
pipe(
5152
allRelativeFilePaths,
52-
// TODO: parallalize
5353
T.forEachParN(concurrencyLimit, (relativeFilePath) =>
5454
makeCacheItemFromFilePath({
5555
relativeFilePath,
@@ -74,7 +74,6 @@ export const fetchAllDocuments = ({
7474
}
7575
const res = These.result(a)
7676
if (E.isLeft(res)) {
77-
// FIXME: type
7877
errors = Chunk.append_(errors, FetchDataError.fromSerialized(res.left as unknown as any))
7978
} else {
8079
values = Chunk.append_(values, res.right.tuple[0])

packages/@contentlayer/source-files/src/fetchData/makeCacheItemFromFilePath.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import yaml from 'yaml'
1010
import { FetchDataError } from '../errors/index.js'
1111
import type { ContentTypeMap, FilePathPatternMap } from '../types.js'
1212
import { makeAndProvideDocumentContext } from './DocumentContext.js'
13-
import type { DocumentTypeName, HasDocumentTypeMapState } from './DocumentTypeMap.js'
13+
import type { DocumentTypeName } from './DocumentTypeMap.js'
1414
import { makeDocument } from './mapping.js'
1515
import type { RawContent, RawContentJSON, RawContentMarkdown, RawContentMDX, RawContentYAML } from './types.js'
1616
import { validateDocumentData } from './validateDocumentData.js'
@@ -20,6 +20,7 @@ export const makeCacheItemFromFilePath = ({
2020
filePathPatternMap,
2121
coreSchemaDef,
2222
contentDirPath,
23+
// FIXME: This doesn't serialize properly.
2324
options,
2425
previousCache,
2526
contentTypeMap,

0 commit comments

Comments
 (0)