Skip to content

Commit fdac478

Browse files
committed
Release 0.2.5
1 parent 081e03e commit fdac478

File tree

16 files changed

+43
-20
lines changed

16 files changed

+43
-20
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"**/.DS_Store": true,
1616
"**/Thumbs.db": true,
1717
"**/dist": true,
18-
"**/*.lock": true,
1918
"**/vercel.json": true,
2019
"**/.yarn": true,
2120
"**/.direnv": true

packages/@contentlayer/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/cli",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/client",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/core",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/core/src/ArtifactsDir.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export namespace ArtifactsDir {
1616
export const mkdir: T.Effect<OT.HasTracer & HasCwd, fs.MkdirError, PosixFilePath> = T.gen(function* ($) {
1717
const cwd = yield* $(getCwd)
1818
const dirPath = getDirPath({ cwd })
19+
1920
yield* $(fs.mkdirp(dirPath))
2021

2122
return dirPath

packages/@contentlayer/core/src/getConfig/index.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { E } from '@contentlayer/utils/effect'
2-
import { Chunk, OT, pipe, S, T } from '@contentlayer/utils/effect'
2+
import { Array, Chunk, O, OT, pipe, S, T } from '@contentlayer/utils/effect'
33
import type { GetContentlayerVersionError } from '@contentlayer/utils/node'
44
import { fs } from '@contentlayer/utils/node'
55
import * as path from 'node:path'
@@ -48,14 +48,14 @@ export const getConfigWatch = ({
4848
configPath?: string
4949
}): S.Stream<OT.HasTracer & HasCwd, never, E.Either<GetConfigError, Config>> => {
5050
const resolveParams = pipe(
51-
T.structPar({ configPath: resolveConfigPath({ configPath: configPath_ }) }),
51+
T.structPar({ configPath: resolveConfigPath({ configPath: configPath_ }), cwd: getCwd }),
5252
T.chainMergeObject(() => makeTmpDirAndResolveEntryPoint),
5353
T.either,
5454
)
5555

5656
return pipe(
5757
S.fromEffect(resolveParams),
58-
S.chainMapEitherRight(({ configPath, outfilePath }) =>
58+
S.chainMapEitherRight(({ configPath, outfilePath, cwd }) =>
5959
pipe(
6060
esbuild.makeAndSubscribe({
6161
entryPoints: [configPath],
@@ -70,6 +70,7 @@ export const getConfigWatch = ({
7070
bundle: true,
7171
logLevel: 'silent',
7272
metafile: true,
73+
absWorkingDir: cwd,
7374
plugins: [contentlayerGenPlugin(), makeAllPackagesExternalPlugin(configPath)],
7475
}),
7576
S.mapEffectEitherRight((result) => getConfigFromResult({ result, configPath })),
@@ -133,11 +134,15 @@ const getConfigFromResult = ({
133134

134135
const cwd = yield* $(getCwd)
135136

136-
const outfilePath = Object.keys(result.metafile!.outputs)
137+
// Deriving the exact outfilePath here since it's suffixed with a hash
138+
const outfilePath = pipe(
139+
Object.keys(result.metafile!.outputs),
137140
// Will look like `path.join(cacheDir, 'compiled-contentlayer-config-[SOME_HASH].mjs')
138-
.filter((_) => _.match(/compiled-contentlayer-config-.+.mjs$/))
141+
Array.find((_) => _.match(/compiled-contentlayer-config-.+.mjs$/) !== null),
139142
// Needs to be absolute path for ESM import to work
140-
.map((_) => path.join(cwd, _))[0]!
143+
O.map((_) => path.join(cwd, _)),
144+
O.getUnsafe,
145+
)
141146

142147
const esbuildHash = outfilePath.match(/compiled-contentlayer-config-(.+).mjs$/)![1]!
143148

packages/@contentlayer/source-contentful/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-contentful",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/source-files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-files",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": {
66
".": {

packages/@contentlayer/source-sanity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-sanity",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/utils",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"exports": {
66
"./package.json": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Array, pipe } from '@effect-ts/core'
2+
3+
import * as O from './Option.js'
4+
5+
export * from '@effect-ts/core/Collections/Immutable/Array'
6+
7+
export const headUnsafe = <A>(array: Array.Array<A>): A => pipe(array, Array.head, O.getUnsafe)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Option } from '@effect-ts/core'
2+
3+
export * from '@effect-ts/core/Option'
4+
5+
export const getUnsafe = <A>(option: Option.Option<A>): A => {
6+
if (Option.isSome(option)) {
7+
return option.value
8+
}
9+
10+
throw new Error('Option.getUnsafe: Option is None')
11+
}

packages/@contentlayer/utils/src/effect/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export * as Tp from '@effect-ts/core/Collections/Immutable/Tuple'
2828
export * as HashMap from '@effect-ts/core/Collections/Immutable/HashMap'
2929
export * as HashSet from '@effect-ts/core/Collections/Immutable/HashSet'
3030

31-
export * as Array from '@effect-ts/core/Collections/Immutable/Array'
31+
export * as Array from './Array.js'
3232

3333
export * as These from './These.js'
3434

@@ -48,8 +48,8 @@ export * as SC from '@effect-ts/core/Effect/Schedule'
4848
export * as Either from '@effect-ts/core/Either'
4949
export * as E from '@effect-ts/core/Either'
5050

51-
export * as Option from '@effect-ts/core/Option'
52-
export * as O from '@effect-ts/core/Option'
51+
export * as Option from './Option.js'
52+
export * as O from './Option.js'
5353

5454
export * as Ex from '@effect-ts/core/Effect/Exit'
5555

packages/contentlayer-stackbit-yaml-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentlayer-stackbit-yaml-generator",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"bin": "./dist/cli/index.js",
66
"exports": "./dist/lib/index.js",

packages/contentlayer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentlayer",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"bin": "./bin/cli.cjs",
55
"type": "module",
66
"engines": {

packages/next-contentlayer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-contentlayer",
3-
"version": "0.2.5-dev.7",
3+
"version": "0.2.5",
44
"type": "module",
55
"main": "./dist/index-cjs.cjs",
66
"sideEffects": false,

0 commit comments

Comments
 (0)