Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update submodule #13

Merged
merged 7 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "examples/next-contentlayer-example"]
path = examples/next-contentlayer-example
url = [email protected]:contentlayerdev/next-contentlayer-example.git
url = [email protected]:timlrx/next-contentlayer2-example.git
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
"devDependencies": {
"@changesets/cli": "2.19.0-temp.0",
"@effect-ts/tracing-plugin": "^0.20.0",
"@types/prettier": "^2.7.3",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"prettier": "^2.8.8",
"eslint-plugin-simple-import-sort": "^12.1.0",
"prettier": "^3.2.5",
"ts-patch": "^2.1.0",
"typescript": "^5.1.6"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@contentlayer/client/src/guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type TypeNameOneOrMany = GetDocumentTypeNamesGen | GetDocumentTypeNamesGen[]
type TypeForTypeNameOneOrMany<N extends TypeNameOneOrMany> = N extends GetDocumentTypeNamesGen
? GetDocumentTypeMapGen<Document>[N]
: N extends GetDocumentTypeNamesGen[]
? GetDocumentTypeMapGen<Document>[N[number]]
: never
? GetDocumentTypeMapGen<Document>[N[number]]
: never

function is<N extends TypeNameOneOrMany>(typeName: N, _: any): _ is TypeForTypeNameOneOrMany<N>
function is<N extends TypeNameOneOrMany>(typeName: N): (_: any) => _ is TypeForTypeNameOneOrMany<N>
Expand Down
17 changes: 8 additions & 9 deletions packages/@contentlayer/core/src/_ArtifactsDir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ import { getCwd } from './cwd.js'
export const getDirPath = ({ cwd }: { cwd: AbsolutePosixFilePath }): AbsolutePosixFilePath =>
filePathJoin(cwd, '.contentlayer' as AbsolutePosixFilePath)

export const mkdir: T.Effect<OT.HasTracer & HasCwd & fs.HasFs, fs.MkdirError, AbsolutePosixFilePath> = T.gen(function* (
$,
) {
const cwd = yield* $(getCwd)
const dirPath = getDirPath({ cwd })
export const mkdir: T.Effect<OT.HasTracer & HasCwd & fs.HasFs, fs.MkdirError, AbsolutePosixFilePath> = T.gen(
function* ($) {
const cwd = yield* $(getCwd)
const dirPath = getDirPath({ cwd })
yield* $(fs.mkdirp(dirPath))

yield* $(fs.mkdirp(dirPath))

return dirPath
})
return dirPath
},
)

export const getCacheDirPath: T.Effect<
OT.HasTracer & HasCwd & fs.HasFs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitest/config'
import path from 'path'
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const getImageFieldData = ({
const filePath = utils.filePathJoin(documentDirPath, imagePath)
const absoluteFilePath = utils.filePathJoin(contentDirPath, documentDirPath, imagePath)
const relativeFilePath = utils.relative(utils.filePathJoin(contentDirPath, documentDirPath), absoluteFilePath)

const fileBuffer = yield* $(fs.readFileBuffer(absoluteFilePath))

const { resizedData, height, width, format } = yield* $(processImage(fileBuffer))
Expand Down
2 changes: 1 addition & 1 deletion packages/@contentlayer/source-files/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitest/config'
import path from 'path'
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
Expand Down
6 changes: 3 additions & 3 deletions packages/@contentlayer/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
"@effect-ts/otel-exporter-trace-otlp-grpc": "^0.15.1",
"@effect-ts/otel-sdk-trace-node": "^0.15.1",
"@js-temporal/polyfill": "^0.4.4",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/core": "^1.21.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.48.0",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/core": "^1.24.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.51.0",
"@opentelemetry/resources": "^1.21.0",
"@opentelemetry/sdk-trace-base": "^1.21.0",
"@opentelemetry/sdk-trace-node": "^1.21.0",
Expand Down
25 changes: 20 additions & 5 deletions packages/@contentlayer/utils/src/node/fs-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,46 @@ import { unknownFilePath } from '../file-paths.js'
export class FileAdded {
readonly _tag = 'FileAdded'

constructor(public path: UnknownFilePath, public stats: O.Option<fs.Stats>) {}
constructor(
public path: UnknownFilePath,
public stats: O.Option<fs.Stats>,
) {}
}

export class FileRemoved {
readonly _tag = 'FileRemoved'

constructor(public path: UnknownFilePath, public stats: O.Option<fs.Stats>) {}
constructor(
public path: UnknownFilePath,
public stats: O.Option<fs.Stats>,
) {}
}

export class FileChanged {
readonly _tag = 'FileChanged'

constructor(public path: UnknownFilePath, public stats: O.Option<fs.Stats>) {}
constructor(
public path: UnknownFilePath,
public stats: O.Option<fs.Stats>,
) {}
}

export class DirectoryAdded {
readonly _tag = 'DirectoryAdded'

constructor(public path: UnknownFilePath, public stats: O.Option<fs.Stats>) {}
constructor(
public path: UnknownFilePath,
public stats: O.Option<fs.Stats>,
) {}
}

export class DirectoryRemoved {
readonly _tag = 'DirectoryRemoved'

constructor(public path: UnknownFilePath, public stats: O.Option<fs.Stats>) {}
constructor(
public path: UnknownFilePath,
public stats: O.Option<fs.Stats>,
) {}
}

export type FileSystemEvent = FileAdded | FileRemoved | FileChanged | DirectoryAdded | DirectoryRemoved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitest/config'
import path from 'path'
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ test('mdx - resolveCwd - contentDirPath', async () => {
documentTypes: [Post],
mdx: {
resolveCwd: 'contentDirPath',
// @ts-ignore - remarkMdxImages has not been updated to the new unified js types
remarkPlugins: [remarkMdxImages],
esbuildOptions: (options) => {
options.platform = 'node'
Expand Down Expand Up @@ -78,7 +77,6 @@ test('mdx - resolveCwd - relative', async () => {
documentTypes: [Post],
mdx: {
resolveCwd: 'relative',
// @ts-ignore - remarkMdxImages has not been updated to the new unified js types
remarkPlugins: [remarkMdxImages],
esbuildOptions: (options) => {
options.platform = 'node'
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitest/config'
import path from 'path'
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
Expand Down
Loading
Loading