Skip to content

Commit

Permalink
feat(remix-dev): provide types for rehypePluggins and remarkPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
lpsinger authored and MichaelDeBoey committed Oct 31, 2023
1 parent 33c64cb commit 6421526
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-dogs-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": minor
---

Provide types for rehypePlugins and remarkPlugins
5 changes: 3 additions & 2 deletions packages/remix-dev/compiler/plugins/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { promises as fsp } from "node:fs";
import * as path from "node:path";
import type * as esbuild from "esbuild";
import { remarkMdxFrontmatter } from "remark-mdx-frontmatter";
import type { PluggableList } from "unified";

import { getLoaderForFile } from "../utils/loaders";
import { createMatchPath } from "../utils/tsconfig";
Expand Down Expand Up @@ -71,8 +72,8 @@ export async function processMDX(
try {
let fileContents = await fsp.readFile(absolutePath, "utf-8");

let rehypePlugins = [];
let remarkPlugins: any[] = [
let rehypePlugins: PluggableList = [];
let remarkPlugins: PluggableList = [
remarkFrontmatter,
[remarkMdxFrontmatter, { name: "attributes" }],
];
Expand Down
5 changes: 3 additions & 2 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { pathToFileURL } from "node:url";
import fse from "fs-extra";
import PackageJson from "@npmcli/package-json";
import type { NodePolyfillsOptions as EsbuildPluginsNodeModulesPolyfillOptions } from "esbuild-plugins-node-modules-polyfill";
import type { PluggableList } from "unified";

import type { RouteManifest, DefineRoutesFunction } from "./config/routes";
import { defineRoutes } from "./config/routes";
Expand All @@ -14,8 +15,8 @@ import { detectPackageManager } from "./cli/detectPackageManager";
import { logger } from "./tux";

export interface RemixMdxConfig {
rehypePlugins?: any[];
remarkPlugins?: any[];
rehypePlugins?: PluggableList;
remarkPlugins?: PluggableList;
}

export type RemixMdxConfigFunction = (
Expand Down

0 comments on commit 6421526

Please sign in to comment.