Skip to content

Commit 12e0485

Browse files
committed
feat(mdx): move mdx into sub-package
1 parent 479f73b commit 12e0485

26 files changed

+758
-358
lines changed

.github/workflows/lint-and-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ jobs:
149149
if: ${{ !cancelled() && github.event_name != 'merge_group' }}
150150
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
151151
with:
152-
files: ./apps/site/lcov.info,./packages/ui-components/lcov.info
152+
files: ./apps/site/lcov.info,./packages/*/lcov.info
153153

154154
- name: Upload test results to Codecov
155155
if: ${{ !cancelled() && github.event_name != 'merge_group' }}
156156
uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 # v1.1.0
157157
with:
158-
files: ./apps/site/junit.xml,./packages/ui-components/junit.xml
158+
files: ./apps/site/junit.xml,./packages/*/junit.xml

apps/site/components/Downloads/Release/ReleaseCodeBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use client';
22

3+
import createSval from '@node-core/mdx/evaluator';
4+
import { highlightToHtml } from '@node-core/mdx/highlighter';
35
import AlertBox from '@node-core/ui-components/Common/AlertBox';
46
import Skeleton from '@node-core/ui-components/Common/Skeleton';
57
import { useTranslations } from 'next-intl';
@@ -9,14 +11,12 @@ import { useContext, useMemo } from 'react';
911
import CodeBox from '#site/components/Common/CodeBox';
1012
import Link from '#site/components/Link';
1113
import LinkWithArrow from '#site/components/LinkWithArrow';
12-
import { createSval } from '#site/next.jsx.compiler.mjs';
1314
import {
1415
ReleaseContext,
1516
ReleasesContext,
1617
} from '#site/providers/releaseProvider';
1718
import type { ReleaseContextType } from '#site/types/release';
1819
import { INSTALL_METHODS } from '#site/util/downloadUtils';
19-
import { highlightToHtml } from '#site/util/getHighlighter';
2020

2121
// Creates a minimal JavaScript interpreter for parsing the JavaScript code from the snippets
2222
// Note: that the code runs inside a sandboxed environment and cannot interact with any code outside of the sandbox

apps/site/components/MDX/CodeBox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { getLanguageDisplayName } from '@node-core/mdx/utils';
12
import type { FC, PropsWithChildren } from 'react';
23

34
import CodeBox from '#site/components/Common/CodeBox';
4-
import { getLanguageDisplayName } from '#site/util/getLanguageDisplayName';
55

66
type CodeBoxProps = { className?: string; showCopyButton?: string };
77

apps/site/next.dynamic.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { readFile } from 'node:fs/promises';
44
import { join, normalize, sep } from 'node:path';
55

6+
import compile from '@node-core/mdx/compiler';
67
import matter from 'gray-matter';
78
import { cache } from 'react';
89
import { VFile } from 'vfile';
@@ -22,7 +23,6 @@ import {
2223
import { getMarkdownFiles } from './next.helpers.mjs';
2324
import { siteConfig } from './next.json.mjs';
2425
import { availableLocaleCodes, defaultLocale } from './next.locales.mjs';
25-
import { compile } from './next.mdx.compiler.mjs';
2626
import { MDX_COMPONENTS } from './next.mdx.components.mjs';
2727

2828
// This is the combination of the Application Base URL and Base PATH

apps/site/next.jsx.compiler.mjs

Lines changed: 0 additions & 23 deletions
This file was deleted.

apps/site/next.mdx.shiki.mjs

Lines changed: 0 additions & 195 deletions
This file was deleted.

apps/site/package.json

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
},
2929
"dependencies": {
3030
"@heroicons/react": "~2.2.0",
31-
"@mdx-js/mdx": "^3.1.0",
3231
"@node-core/ui-components": "workspace:*",
32+
"@node-core/mdx": "workspace:*",
3333
"@node-core/website-i18n": "workspace:*",
3434
"@nodevu/core": "0.3.0",
3535
"@opentelemetry/api-logs": "~0.200.0",
@@ -42,8 +42,6 @@
4242
"@radix-ui/react-tabs": "^1.1.3",
4343
"@radix-ui/react-toast": "^1.2.6",
4444
"@radix-ui/react-tooltip": "^1.2.4",
45-
"@shikijs/core": "^3.2.2",
46-
"@shikijs/engine-javascript": "^3.2.2",
4745
"@tailwindcss/postcss": "~4.1.5",
4846
"@types/node": "22.15.3",
4947
"@types/react": "^19.1.0",
@@ -54,10 +52,8 @@
5452
"classnames": "~2.5.1",
5553
"cross-env": "7.0.3",
5654
"feed": "~4.2.2",
57-
"github-slugger": "~2.0.0",
5855
"glob": "~11.0.1",
5956
"gray-matter": "~4.0.3",
60-
"hast-util-to-string": "~3.0.1",
6157
"next": "15.3.1",
6258
"next-intl": "~4.1.0",
6359
"next-themes": "~0.4.6",
@@ -67,17 +63,9 @@
6763
"react": "^19.1.0",
6864
"react-dom": "^19.1.0",
6965
"reading-time": "~1.5.0",
70-
"rehype-autolink-headings": "~7.1.0",
71-
"rehype-slug": "~6.0.0",
72-
"remark-gfm": "~4.0.1",
73-
"remark-reading-time": "~2.0.1",
7466
"semver": "~7.7.1",
75-
"shiki": "~3.3.0",
76-
"sval": "^0.6.3",
7767
"tailwindcss": "~4.0.17",
78-
"unist-util-visit": "~5.0.0",
79-
"vfile": "~6.0.3",
80-
"vfile-matter": "~5.0.1"
68+
"vfile": "~6.0.3"
8169
},
8270
"devDependencies": {
8371
"@eslint/compat": "~1.2.8",
@@ -92,6 +80,7 @@
9280
"eslint-plugin-mdx": "~3.4.0",
9381
"eslint-plugin-react": "~7.37.4",
9482
"eslint-plugin-react-hooks": "5.2.0",
83+
"github-slugger": "~2.0.0",
9584
"global-jsdom": "^26.0.0",
9685
"handlebars": "4.7.8",
9786
"jsdom": "^26.0.0",

apps/site/pages/id/about/security-reporting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Pemberitahuan keamanan akan didistribusikan melalui metode berikut.
4646

4747
## Komentar tentang kebijakan ini
4848

49-
Jika Anda memiliki saran tentang bagaimana proses ini dapat ditingkatkan, silakan kirimkan [permintaan penarikan](https://github.com/nodejs/nodejs.org) atau [ajukan masalah (https://github.com/nodejs/security -wg/issues/new) untuk didiskusikan.
49+
Jika Anda memiliki saran tentang bagaimana proses ini dapat ditingkatkan, silakan kirimkan [permintaan penarikan](https://github.com/nodejs/nodejs.org) atau [ajukan masalah](https://github.com/nodejs/security-wg/issues/new) untuk didiskusikan.
5050

5151
## Praktik Terbaik OpenSSF
5252

apps/site/util/__tests__/gitHubUtils.test.mjs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import assert from 'node:assert/strict';
2-
import { describe, it, mock } from 'node:test';
2+
import { describe, it } from 'node:test';
33

4-
mock.module('github-slugger', {
5-
defaultExport: class {},
6-
});
7-
8-
const {
9-
getGitHubAvatarUrl,
10-
createGitHubSlugger,
11-
getGitHubBlobUrl,
12-
getGitHubApiDocsUrl,
13-
} = await import('#site/util/gitHubUtils');
4+
const { getGitHubAvatarUrl, getGitHubBlobUrl, getGitHubApiDocsUrl } =
5+
await import('#site/util/gitHubUtils');
146

157
describe('gitHubUtils', () => {
168
it('getGitHubAvatarUrl returns the correct URL', () => {
@@ -20,10 +12,6 @@ describe('gitHubUtils', () => {
2012
);
2113
});
2214

23-
it('createGitHubSlugger returns a slugger', () => {
24-
assert.notEqual(createGitHubSlugger(), undefined);
25-
});
26-
2715
it('getGitHubBlobUrl returns the correct URL', () => {
2816
const result = getGitHubBlobUrl('learn/getting-started/introduction.md');
2917
const expected =

0 commit comments

Comments
 (0)