|
52 | 52 | * the automatic runtime compiles to `import _jsx from |
53 | 53 | * '$importSource/jsx-runtime'\n_jsx('p')`; |
54 | 54 | * the classic runtime compiles to calls such as `h('p')`. |
| 55 | + * |
| 56 | + * > 👉 **Note**: support for the classic runtime is deprecated and will |
| 57 | + * > likely be removed in the next major version. |
55 | 58 | * @property {ReadonlyArray<string> | null | undefined} [mdExtensions] |
56 | 59 | * List of markdown extensions, with dot (default: `['.md', '.markdown', …]`); |
57 | 60 | * affects integrations. |
|
71 | 74 | * `'React.createElement'`); |
72 | 75 | * when changing this, you should also define `pragmaFrag` and |
73 | 76 | * `pragmaImportSource` too. |
| 77 | + * |
| 78 | + * > 👉 **Note**: support for the classic runtime is deprecated and will |
| 79 | + * > likely be removed in the next major version. |
74 | 80 | * @property {string | null | undefined} [pragmaFrag='React.Fragment'] |
75 | 81 | * Pragma for fragment symbol, used in the classic runtime as an identifier |
76 | 82 | * for unnamed calls: `<>` to `React.createElement(React.Fragment)` (default: |
77 | 83 | * `'React.Fragment'`); |
78 | 84 | * when changing this, you should also define `pragma` and |
79 | 85 | * `pragmaImportSource` too. |
| 86 | + * |
| 87 | + * > 👉 **Note**: support for the classic runtime is deprecated and will |
| 88 | + * > likely be removed in the next major version. |
80 | 89 | * @property {string | null | undefined} [pragmaImportSource='react'] |
81 | 90 | * Where to import the identifier of `pragma` from, used in the classic |
82 | 91 | * runtime (default: `'react'`); |
83 | 92 | * to illustrate, when `pragma` is `'a.b'` and `pragmaImportSource` is `'c'` |
84 | 93 | * the following will be generated: `import a from 'c'` and things such as |
85 | 94 | * `a.b('h1', {})`. |
86 | 95 | * when changing this, you should also define `pragma` and `pragmaFrag` too. |
| 96 | + * |
| 97 | + * > 👉 **Note**: support for the classic runtime is deprecated and will |
| 98 | + * > likely be removed in the next major version. |
87 | 99 | * @property {string | null | undefined} [providerImportSource] |
88 | 100 | * Place to import a provider from (optional, example: `'@mdx-js/react'`); |
89 | 101 | * normally it’s used for runtimes that support context (React, Preact), but |
@@ -148,6 +160,8 @@ const removedOptions = [ |
148 | 160 | 'wrapExport' |
149 | 161 | ] |
150 | 162 |
|
| 163 | +let warned = false |
| 164 | + |
151 | 165 | /** |
152 | 166 | * Create a processor to compile markdown or MDX to JavaScript. |
153 | 167 | * |
@@ -181,6 +195,19 @@ export function createProcessor(options) { |
181 | 195 | ) |
182 | 196 | } |
183 | 197 |
|
| 198 | + if ( |
| 199 | + !warned && |
| 200 | + (settings.jsxRuntime === 'classic' || |
| 201 | + settings.pragma || |
| 202 | + settings.pragmaFrag || |
| 203 | + settings.pragmaImportSource) |
| 204 | + ) { |
| 205 | + warned = true |
| 206 | + console.warn( |
| 207 | + "Unexpected deprecated option `jsxRuntime: 'classic'`, `pragma`, `pragmaFrag`, or `pragmaImportSource`; see <https://mdxjs.com/migrating/v3/> on how to migrate" |
| 208 | + ) |
| 209 | + } |
| 210 | + |
184 | 211 | const pipeline = unified().use(remarkParse) |
185 | 212 |
|
186 | 213 | if (settings.format !== 'md') { |
|
0 commit comments