chore: update deps
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { LoaderFunctionArgs } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { getMDXComponent } from "mdx-bundler/client";
|
||||
import { getMDXComponent } from "mdx-bundler/client/index.js";
|
||||
import React from "react";
|
||||
import { BlogWrapper } from "~/components/BlogWrapper";
|
||||
import { Title } from "~/components/Title";
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { remarkCodeHike } from "@code-hike/mdx";
|
||||
import { readdir, readFile } from "fs/promises";
|
||||
import { bundleMDX } from "mdx-bundler";
|
||||
import codeHikeTheme from "shiki/themes/one-dark-pro.json";
|
||||
|
||||
type FrontMatter = {
|
||||
title: string;
|
||||
@@ -11,7 +10,7 @@ type FrontMatter = {
|
||||
|
||||
export const getMdxFile = async (file: string) => {
|
||||
return bundleMDX<FrontMatter>({
|
||||
source: (await readFile(`${__dirname}/../posts/${file}.mdx`)).toString(),
|
||||
source: (await readFile(`posts/${file}.mdx`)).toString(),
|
||||
mdxOptions(options) {
|
||||
return {
|
||||
rehypePlugins: [...(options.rehypePlugins ?? [])],
|
||||
@@ -20,7 +19,7 @@ export const getMdxFile = async (file: string) => {
|
||||
[
|
||||
remarkCodeHike,
|
||||
{
|
||||
theme: codeHikeTheme,
|
||||
theme: "one-dark-pro",
|
||||
lineNumbers: true,
|
||||
showCopyButton: true,
|
||||
autoImport: true,
|
||||
@@ -33,20 +32,20 @@ export const getMdxFile = async (file: string) => {
|
||||
};
|
||||
|
||||
export const findPosts = async () => {
|
||||
const files = await readdir(`${__dirname}/../posts`);
|
||||
const files = await readdir(`posts`);
|
||||
const posts: (FrontMatter & {
|
||||
filename: string;
|
||||
})[] = [];
|
||||
for (const file of files.filter((file) => file.endsWith(".mdx"))) {
|
||||
const { frontmatter } = await bundleMDX<FrontMatter>({
|
||||
source: (await readFile(`${__dirname}/../posts/${file}`)).toString(),
|
||||
source: (await readFile(`posts/${file}`)).toString(),
|
||||
mdxOptions() {
|
||||
return {
|
||||
remarkPlugins: [
|
||||
[
|
||||
remarkCodeHike,
|
||||
{
|
||||
theme: codeHikeTheme,
|
||||
theme: "one-dark-pro",
|
||||
lineNumbers: true,
|
||||
showCopyButton: true,
|
||||
autoImport: true,
|
||||
|
Reference in New Issue
Block a user