diff --git a/.changeset/gorgeous-islands-camp.md b/.changeset/gorgeous-islands-camp.md new file mode 100644 index 00000000..bf649fbb --- /dev/null +++ b/.changeset/gorgeous-islands-camp.md @@ -0,0 +1,7 @@ +--- +'@mdx-js/language-service': minor +'@mdx-js/language-server': minor +'vscode-mdx': minor +--- + +Update to MDX 3 diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 081db8e2..1599203e 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -35,10 +35,10 @@ "@mdx-js/language-service": "0.1.0", "@volar/language-server": "~1.10.0", "load-plugin": "^5.0.0", - "remark-frontmatter": "^4.0.0", - "remark-gfm": "^3.0.0", - "volar-service-markdown": "0.0.14", - "volar-service-typescript": "0.0.14" + "remark-frontmatter": "^5.0.0", + "remark-gfm": "^4.0.0", + "volar-service-markdown": "0.0.15", + "volar-service-typescript": "0.0.15" }, "devDependencies": { "@types/node": "^20.0.0", diff --git a/packages/language-service/lib/language-module.js b/packages/language-service/lib/language-module.js index 812f585d..951b07b7 100644 --- a/packages/language-service/lib/language-module.js +++ b/packages/language-service/lib/language-module.js @@ -1,11 +1,10 @@ /** * @typedef {import('@volar/language-core').Language} Language * @typedef {import('@volar/language-core').VirtualFile} VirtualFile - * @typedef {import('estree').Program} Program * @typedef {import('mdast').Root} Root * @typedef {import('typescript').IScriptSnapshot} IScriptSnapshot * @typedef {import('unified').PluggableList} PluggableList - * @typedef {import('unified').Processor} Processor + * @typedef {import('unified').Processor} Processor * @typedef {import('unist').Node} Node * @typedef {import('unist').Parent} Parent * @@ -188,16 +187,20 @@ function getVirtualFiles(fileName, snapshot, ts, processor) { } case 'mdxFlowExpression': - case 'mdxJsxTextElement': case 'mdxTextExpression': { jsxPositions.push([start, end]) - if (/** @type {Program} */ (node.data?.estree)?.body.length === 0) { + if (node.data?.estree?.body.length === 0) { esmPositions.push([start + 1, end - 1]) } break } + case 'mdxJsxTextElement': { + jsxPositions.push([start, end]) + break + } + default: { break } diff --git a/packages/language-service/package.json b/packages/language-service/package.json index 62b2b3d5..29fb068f 100644 --- a/packages/language-service/package.json +++ b/packages/language-service/package.json @@ -31,18 +31,17 @@ "test": "node --test" }, "dependencies": { - "@types/estree": "^1.0.0", - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", "@volar/language-core": "~1.10.0", - "remark-mdx": "^2.0.0", - "remark-parse": "^10.0.0", - "unified": "^10.0.0", - "unist-util-visit-parents": "^5.0.0" + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit-parents": "^6.0.0" }, "devDependencies": { "@types/node": "^20.0.0", - "remark-frontmatter": "^4.0.0" + "remark-frontmatter": "^5.0.0" }, "sideEffects": false }