|
9 | 9 | * @import { Scope } from 'estree-util-scope' |
10 | 10 | * @import { Nodes } from 'mdast' |
11 | 11 | * @import { MdxjsEsm } from 'mdast-util-mdxjs-esm' |
12 | | - * @import { MappedOutput, SpanMapping, TransformParams, TransformResult } from '../protocol.js' |
| 12 | + * @import { |
| 13 | + * MappedOutput, |
| 14 | + * SpanMapFeature, |
| 15 | + * SpanMapKind, |
| 16 | + * SpanMapping, |
| 17 | + * TransformParams, |
| 18 | + * TransformResult |
| 19 | + * } from '../protocol.js' |
13 | 20 | * @import { Project } from '../util/projects.js' |
14 | 21 | */ |
15 | 22 |
|
@@ -222,8 +229,24 @@ export function transformActual(params, project) { |
222 | 229 | providerImportSource |
223 | 230 | ) |
224 | 231 |
|
| 232 | + /** |
| 233 | + * The Volar mapping that maps all ESM syntax of the MDX file to the virtual JavaScript file. |
| 234 | + * |
| 235 | + * @type {SpanMapping[]} |
| 236 | + */ |
| 237 | + const esmMappings = [] |
225 | 238 | let hasAwait = false |
226 | 239 | let esm = checkMdx ? '// @ts-check\n' : '' |
| 240 | + |
| 241 | + esmMappings.push([ |
| 242 | + 0, |
| 243 | + 0, |
| 244 | + esm.length, |
| 245 | + 0, |
| 246 | + /** @satisfies {SpanMapKind.Verbatim} */ (0), |
| 247 | + /** @satisfies {SpanMapFeature.AutoInsert} */ (131_072) |
| 248 | + ]) |
| 249 | + |
227 | 250 | let jsx = '' |
228 | 251 | let jsxVariables = '' |
229 | 252 |
|
@@ -251,13 +274,6 @@ export function transformActual(params, project) { |
251 | 274 | /** @type {MappedOutput[] | undefined} */ |
252 | 275 | let supplemental |
253 | 276 |
|
254 | | - /** |
255 | | - * The Volar mapping that maps all ESM syntax of the MDX file to the virtual JavaScript file. |
256 | | - * |
257 | | - * @type {SpanMapping[]} |
258 | | - */ |
259 | | - const esmMappings = [] |
260 | | - |
261 | 277 | /** |
262 | 278 | * The Volar mapping that maps all JSX syntax of the MDX file to the virtual JavaScript file. |
263 | 279 | * |
@@ -794,6 +810,10 @@ export function transformActual(params, project) { |
794 | 810 | padOffsets(jsxVariablesMapping, esm.length) |
795 | 811 | esm += jsxVariables |
796 | 812 |
|
| 813 | + console.error('-'.repeat(100)) |
| 814 | + console.error(esm) |
| 815 | + console.error('-'.repeat(100)) |
| 816 | + |
797 | 817 | return { |
798 | 818 | text: esm, |
799 | 819 | extension: '.jsx', |
|
0 commit comments