validate-mdx-links 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +6 -1
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # validate-mdx-links
2
+
3
+ Wraps `next-validate-link` with heuristics for false positives.
4
+ Handles relative links, with and without `.mdx` extension, and treats `page.mdx` (Next.js App Router) as an index file.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pnpm add -D validate-mdx-links
10
+ ```
11
+
12
+ ## CLI
13
+
14
+ ```bash
15
+ validate-mdx-links --files "content/**/*.mdx" --verbose
16
+ ```
17
+
18
+ - `--cwd` defaults to `process.cwd()`
19
+ - `--verbose` prints every scanned route
20
+ - exits `1` on broken links, `0` otherwise
21
+
22
+ Relative links lose `.mdx` in MDX or JSX. The CLI checks `./foo`, `./foo.mdx`, and `../foo/page.mdx` before complaining.
23
+
24
+ ## API
25
+
26
+ ```ts
27
+ import { validateMdxLinks, printErrors } from "validate-mdx-links";
28
+
29
+ const errors = await validateMdxLinks({
30
+ cwd: "/path/to/docs",
31
+ files: "content/**/*.mdx",
32
+ verbose: true,
33
+ });
34
+ ```
35
+
36
+ You get an array of `{ file, detected }`. Pass it to `printErrors` or build your own reporter.
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "validate-mdx-links",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
8
  "validate-mdx-links": "./dist/bin.js"
9
9
  },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/hasparus/eclectic.git",
13
+ "directory": "packages/validate-mdx-links"
14
+ },
10
15
  "exports": {
11
16
  ".": "./dist/index.js"
12
17
  },