
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Transform your MDX content into typed, JSON-powered data with flexible schema validation.
mdxlayerTransform your .mdx content into strongly typed, structured JSON and TypeScript declarations with minimal config. Built for performance, flexibility, and DX.
.json and .d.ts from .mdx contentresolvedFieldsen, es, all)mdxlayer build & mdxlayer devmdxlayer installed globally or locallyabout.mdx
❌ about me.mdxpnpm add -D mdxlayer
# or
npm install -D mdxlayer
# or
yarn add -D mdxlayer
Create a mdxlayer.config.ts file:
import { defineConfig } from 'mdxlayer';
import { t } from 'tyne';
const ArticleSchema = t.object({
title: t.string(),
category: t.string(),
subcategory: t.string(),
publishedTime: t.string(),
modifiedTime: t.string(),
description: t.string(),
authors: t.array(t.string()),
avatar: t.string(),
cover: t.string(),
coverAlt: t.string(),
check: t.boolean(),
lang: t.string(),
tags: t.array(t.string()),
});
export default defineConfig({
docType: 'Articles',
contentDir: 'content',
frontmatterSchema: ArticleSchema,
resolvedFields: {
title_: { resolve: (doc) => doc.title, type: t.string() },
slug: {
resolve: (doc) => doc.file.replace(/\.mdx$/, ''),
type: t.string(),
},
},
});
Update your tsconfig.json:
{
"compilerOptions": {
"paths": {
"mdxlayer/generated": ["./.mdxlayer/generated"]
}
},
"include": ["./.mdxlayer/generated"]
}
.mdx File---
title: 'What Makes MDX Powerful'
category: 'tech'
subcategory: 'markdown'
publishedTime: '01-04-2025'
modifiedTime: '01-04-2025'
description: 'A deep dive into what makes MDX a game-changer for modern content.'
authors: ['Estarlincito']
avatar: '/assets/avatar.jpeg'
cover: '/covers/mdx.png'
coverAlt: 'MDX visual cover'
check: true
lang: 'en'
tags: ['mdx', 'content', 'markdown']
---
Hello!
<Introduction>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</Introduction>
<Audio src='/audio/intro.mp3' type='audio/mp3' />
> _"MDX is where content meets interactivity."_
> **– Anonymous**
import { esArticles, enArticles, allArticles } from 'mdxlayer/generated';
console.log(esArticles);
console.log(enArticles);
console.log(allArticles);
pnpm mdxlayer build
# Generate static JSON and index.d.ts
pnpm mdxlayer dev
# Watch mode — regenerate on file changes
pnpm mdxlayer build --config docs.config.js
# This will load settings from `docs.config.js`
mdxlayer build --config docs.config.js --out docs-content
# This will load `docs.config.js` and output to `docs-content/`
content/
├── what-makes-mdx-powerful.mdx
.mdxlayer/
├── cache/
│ ├── compiled-config.js
│ ├── compiled-config.js.map
│ ├── data.json
├── generated/
│ ├── Articles/
│ │ ├── what-makes-mdx-powerful.json
│ ├── types.d.ts
│ ├── index.d.ts
│ └── index.js
├── package.json
next-mdxlayerpnpm add -D next-mdxlayer
# or
npm install -D next-mdxlayer
# or
yarn add -D next-mdxlayer
import { withMdxlayer } from 'next-mdxlayer';
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
pageExtensions: ['js', 'ts', 'jsx', 'tsx', 'mdx'],
experimental: {
serverActions: true,
},
};
export default withMdxlayer(nextConfig);
import { useMDXComponent } from 'next-mdxlayer/hook';
import { allServices } from 'mdxlayer/generated';
import MyAudioComponent from './audio'
import MyIntroComponent from './intro'
export default function MyPage() {
const MDXComponent = useMDXComponent(allServices[0]._body.code);
return (
<MDXComponent
components={{
a: (props) => <a {...props} className="underline text-blue-600" />,
img: (props) => <img {...props} style={{ maxWidth: '100%' }} />,
Audio: MyAudioComponent,
Introduction: MyIntroComponent,
}}
/>
);
}
defineConfig(config)Accepts the following shape:
interface Config {
name: string;
contentDir: string;
frontmatterSchema: TyneType;
resolvedFields?: Record<
string,
{ resolve: (doc: Doc) => any | Promise<any> }
>;
}
Docinterface Doc {
_filePath: string;
_id: string;
_body: { raw: string; code: string };
// + fields from your frontmatterSchema
}
This project is licensed under the MIT License – see the LICENSE file for details.
Author: Estarlin R (estarlincito.com)
FAQs
Transform your MDX content into typed, JSON-powered data with flexible schema validation.
The npm package mdxlayer receives a total of 6 weekly downloads. As such, mdxlayer popularity was classified as not popular.
We found that mdxlayer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.