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

feat(remix-dev): add types for rehypePluggins & remarkPlugins #7397

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
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