Skip to content

Commit d440c79

Browse files
authored
Drop support for Node.js 18 (#499)
The asynchronous TypeScript plugin keeps causing issues. The goal is to move away from that and make it synchronous. Node.js 20.19 adds support for `require(esm)`, which is a great first step for our use case. VSCode currently ships with Node.js 20.18. However, this is still fine, as dependencies are bundled in the VSCode extension.
1 parent c589e22 commit d440c79

File tree

6 files changed

+19
-26
lines changed

6 files changed

+19
-26
lines changed

.changeset/legal-crews-visit.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@mdx-js/typescript-plugin': minor
3+
'@mdx-js/language-service': minor
4+
'@mdx-js/language-server': minor
5+
---
6+
7+
Remove support for Node.js 18

packages/language-server/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,7 @@ Use [`unifiedjs.vscode-mdx`][vscode-mdx] to use the MDX language server with
217217

218218
## Compatibility
219219

220-
Projects maintained by the unified collective are compatible with all maintained
221-
versions of Node.js.
222-
As of now, that is Node.js and 16.0+.
223-
Our projects sometimes work with older versions, but this is not guaranteed.
220+
This project is compatible Node.js 20.19+.
224221

225222
This project uses [`vscode-languageserver`][vscode-languageserver] 9, which
226223
implements language server protocol 3.17.4.

packages/language-service/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ configuration.
154154

155155
## Compatibility
156156

157-
Projects maintained by the unified collective are compatible with all maintained
158-
versions of Node.js.
159-
As of now, that is Node.js and 16.0+.
160-
Our projects sometimes work with older versions, but this is not guaranteed.
157+
This project is compatible Node.js 20.19+.
161158

162159
## Types
163160

packages/typescript-plugin/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ This is not intended for programmatic use.
8888

8989
## Compatibility
9090

91-
Projects maintained by the unified collective are compatible with all maintained
92-
versions of Node.js.
93-
As of now, that is Node.js and 16.0+.
94-
Our projects sometimes work with older versions, but this is not guaranteed.
91+
This project is compatible Node.js 20.19+.
9592

9693
## Security
9794

packages/typescript-plugin/lib/index.cjs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,25 @@
22

33
/**
44
* @import {TsConfigSourceFile} from 'typescript'
5-
* @import {Plugin} from 'unified' with {'resolution-mode': 'import'}
5+
* @import {Plugin} from 'unified'
66
*/
77

88
const {pathToFileURL} = require('node:url')
9+
const {
10+
createMdxLanguagePlugin,
11+
resolveRemarkPlugins
12+
} = require('@mdx-js/language-service')
913
const {
1014
createAsyncLanguageServicePlugin
1115
} = require('@volar/typescript/lib/quickstart/createAsyncLanguageServicePlugin.js')
16+
const {loadPlugin} = require('load-plugin')
17+
const {default: remarkFrontmatter} = require('remark-frontmatter')
18+
const {default: remarkGfm} = require('remark-gfm')
1219

1320
const plugin = createAsyncLanguageServicePlugin(
1421
['.mdx'],
1522
2 /* JSX */,
1623
async (ts, info) => {
17-
const [
18-
{createMdxLanguagePlugin, resolveRemarkPlugins},
19-
{loadPlugin},
20-
{default: remarkFrontmatter},
21-
{default: remarkGfm}
22-
] = await Promise.all([
23-
import('@mdx-js/language-service'),
24-
import('load-plugin'),
25-
import('remark-frontmatter'),
26-
import('remark-gfm')
27-
])
28-
2924
if (info.project.projectKind !== ts.server.ProjectKind.Configured) {
3025
return {
3126
languagePlugins: [

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"composite": true,
66
"declarationMap": true,
77
"lib": ["es2022"],
8-
"module": "node16",
8+
"module": "nodenext",
99
"moduleDetection": "force",
1010
"strict": true,
1111
"stripInternal": true,

0 commit comments

Comments
 (0)