Skip to content

Commit d3bcef1

Browse files
committed
feat(mdx): move mdx into sub-package
1 parent c353780 commit d3bcef1

26 files changed

Lines changed: 715 additions & 354 deletions

.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
@@ -27,8 +27,8 @@
2727
},
2828
"dependencies": {
2929
"@heroicons/react": "~2.2.0",
30-
"@mdx-js/mdx": "^3.1.0",
3130
"@node-core/ui-components": "workspace:*",
31+
"@node-core/mdx": "workspace:*",
3232
"@node-core/website-i18n": "workspace:*",
3333
"@nodevu/core": "0.3.0",
3434
"@opentelemetry/api-logs": "~0.200.0",
@@ -41,8 +41,6 @@
4141
"@radix-ui/react-tabs": "^1.1.3",
4242
"@radix-ui/react-toast": "^1.2.6",
4343
"@radix-ui/react-tooltip": "^1.2.4",
44-
"@shikijs/core": "^3.2.2",
45-
"@shikijs/engine-javascript": "^3.2.2",
4644
"@tailwindcss/postcss": "~4.1.5",
4745
"@types/node": "22.15.3",
4846
"@types/react": "^19.1.0",
@@ -53,10 +51,8 @@
5351
"classnames": "~2.5.1",
5452
"cross-env": "7.0.3",
5553
"feed": "~4.2.2",
56-
"github-slugger": "~2.0.0",
5754
"glob": "~11.0.1",
5855
"gray-matter": "~4.0.3",
59-
"hast-util-to-string": "~3.0.1",
6056
"next": "15.3.1",
6157
"next-intl": "~4.1.0",
6258
"next-themes": "~0.4.6",
@@ -66,17 +62,9 @@
6662
"react": "^19.1.0",
6763
"react-dom": "^19.1.0",
6864
"reading-time": "~1.5.0",
69-
"rehype-autolink-headings": "~7.1.0",
70-
"rehype-slug": "~6.0.0",
71-
"remark-gfm": "~4.0.1",
72-
"remark-reading-time": "~2.0.1",
7365
"semver": "~7.7.1",
74-
"shiki": "~3.3.0",
75-
"sval": "^0.6.3",
7666
"tailwindcss": "~4.0.17",
77-
"unist-util-visit": "~5.0.0",
78-
"vfile": "~6.0.3",
79-
"vfile-matter": "~5.0.1"
67+
"vfile": "~6.0.3"
8068
},
8169
"devDependencies": {
8270
"@eslint/compat": "~1.2.8",
@@ -91,6 +79,7 @@
9179
"eslint-plugin-mdx": "~3.4.0",
9280
"eslint-plugin-react": "~7.37.4",
9381
"eslint-plugin-react-hooks": "5.2.0",
82+
"github-slugger": "~2.0.0",
9483
"global-jsdom": "^26.0.0",
9584
"handlebars": "4.7.8",
9685
"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)