@astrojs/mdx 1.1.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -20,7 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
-
24
23
  """
25
24
  This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
26
25
 
@@ -33,7 +32,6 @@ The above copyright notice and this permission notice shall be included in all c
33
32
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
33
  """
35
34
 
36
-
37
35
  """
38
36
  This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
39
37
 
package/README.md CHANGED
@@ -83,11 +83,7 @@ You can configure how your MDX is rendered with the following options:
83
83
 
84
84
  ### Options inherited from Markdown config
85
85
 
86
- All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options) except `drafts` can be configured separately in the MDX integration. This includes remark and rehype plugins, syntax highlighting, and more. Options will default to those in your Markdown config ([see the `extendMarkdownConfig` option](#extendmarkdownconfig) to modify this).
87
-
88
- :::note
89
- There is no separate MDX configuration for [including pages marked as draft in the build](https://docs.astro.build/en/reference/configuration-reference/#markdowndrafts). This Markdown setting will be respected by both Markdown and MDX files and cannot be overridden for MDX files specifically.
90
- :::
86
+ All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options) can be configured separately in the MDX integration. This includes remark and rehype plugins, syntax highlighting, and more. Options will default to those in your Markdown config ([see the `extendMarkdownConfig` option](#extendmarkdownconfig) to modify this).
91
87
 
92
88
  ```js
93
89
  // astro.config.mjs
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { markdownConfigDefaults } from '@astrojs/markdown-remark';
2
- import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
3
2
  import type { AstroIntegration } from 'astro';
4
3
  import type { Options as RemarkRehypeOptions } from 'remark-rehype';
4
+ import type { PluggableList } from 'unified';
5
5
  import type { OptimizeOptions } from './rehype-optimize-static.js';
6
6
  export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
7
7
  extendMarkdownConfig: boolean;
package/dist/index.js CHANGED
@@ -134,7 +134,10 @@ export const file = ${JSON.stringify(fileId)};`;
134
134
  componentsCode += ` ${JSON.stringify(ASTRO_IMAGE_ELEMENT)}: ${hasComponents ? "components.img ?? " : ""} props.components?.img ?? ${ASTRO_IMAGE_IMPORT}`;
135
135
  }
136
136
  componentsCode += " }";
137
- code = code.replace("export default MDXContent;", "");
137
+ code = code.replace(
138
+ "export default function MDXContent",
139
+ "function MDXContent"
140
+ );
138
141
  code += `
139
142
  export const Content = (props = {}) => MDXContent({
140
143
  ...props,
package/dist/plugins.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { Processor } from 'unified';
2
1
  import type { MdxOptions } from './index.js';
3
2
  interface MdxProcessorExtraOptions {
4
3
  sourcemap: boolean;
5
4
  importMetaEnv: Record<string, any>;
6
5
  }
7
- export declare function createMdxProcessor(mdxOptions: MdxOptions, extraOptions: MdxProcessorExtraOptions): Processor;
6
+ export declare function createMdxProcessor(mdxOptions: MdxOptions, extraOptions: MdxProcessorExtraOptions): import("unified").Processor<import("mdast").Root, import("estree").Program, import("estree").Program, import("estree").Program, string>;
8
7
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
2
1
  import type { Options as AcornOpts } from 'acorn';
3
2
  import type { AstroConfig } from 'astro';
4
3
  import matter from 'gray-matter';
5
4
  import type { MdxjsEsm } from 'mdast-util-mdx';
5
+ import type { PluggableList } from 'unified';
6
6
  interface FileInfo {
7
7
  fileId: string;
8
8
  fileUrl: string;
package/dist/utils.js CHANGED
@@ -51,8 +51,8 @@ function jsToTreeNode(jsString, acornOpts = {
51
51
  type: "mdxjsEsm",
52
52
  value: "",
53
53
  data: {
54
+ // @ts-expect-error `parse` return types is incompatible but it should work in runtime
54
55
  estree: {
55
- body: [],
56
56
  ...parse(jsString, acornOpts),
57
57
  type: "Program",
58
58
  sourceType: "module"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/mdx",
3
3
  "description": "Add support for MDX pages in your Astro site",
4
- "version": "1.1.5",
4
+ "version": "2.0.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -27,47 +27,47 @@
27
27
  "template"
28
28
  ],
29
29
  "dependencies": {
30
- "@mdx-js/mdx": "^2.3.0",
31
- "acorn": "^8.10.0",
32
- "es-module-lexer": "^1.3.0",
33
- "estree-util-visit": "^1.2.1",
30
+ "@mdx-js/mdx": "^3.0.0",
31
+ "acorn": "^8.11.2",
32
+ "es-module-lexer": "^1.4.1",
33
+ "estree-util-visit": "^2.0.0",
34
34
  "github-slugger": "^2.0.0",
35
35
  "gray-matter": "^4.0.3",
36
- "hast-util-to-html": "^8.0.4",
36
+ "hast-util-to-html": "^9.0.0",
37
37
  "kleur": "^4.1.4",
38
- "rehype-raw": "^6.1.1",
39
- "remark-gfm": "^3.0.1",
38
+ "rehype-raw": "^7.0.0",
39
+ "remark-gfm": "^4.0.0",
40
40
  "remark-smartypants": "^2.0.0",
41
41
  "source-map": "^0.7.4",
42
- "unist-util-visit": "^4.1.2",
43
- "vfile": "^5.3.7",
44
- "@astrojs/markdown-remark": "3.5.0"
42
+ "unist-util-visit": "^5.0.0",
43
+ "vfile": "^6.0.1",
44
+ "@astrojs/markdown-remark": "4.0.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "astro": "^3.0.0"
47
+ "astro": "^4.0.0-beta.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/chai": "^4.3.5",
51
- "@types/estree": "^1.0.1",
52
- "@types/mdast": "^3.0.12",
53
- "@types/mocha": "^10.0.1",
54
- "@types/yargs-parser": "^21.0.0",
50
+ "@types/chai": "^4.3.10",
51
+ "@types/estree": "^1.0.5",
52
+ "@types/mdast": "^4.0.3",
53
+ "@types/mocha": "^10.0.4",
54
+ "@types/yargs-parser": "^21.0.3",
55
55
  "chai": "^4.3.7",
56
56
  "cheerio": "1.0.0-rc.12",
57
- "linkedom": "^0.15.1",
58
- "mdast-util-mdx": "^2.0.1",
59
- "mdast-util-to-string": "^3.2.0",
57
+ "linkedom": "^0.16.4",
58
+ "mdast-util-mdx": "^3.0.0",
59
+ "mdast-util-to-string": "^4.0.0",
60
60
  "mocha": "^10.2.0",
61
61
  "reading-time": "^1.5.0",
62
- "rehype-mathjax": "^4.0.3",
63
- "rehype-pretty-code": "^0.10.0",
64
- "remark-math": "^5.1.1",
65
- "remark-rehype": "^10.1.0",
62
+ "rehype-mathjax": "^5.0.0",
63
+ "rehype-pretty-code": "^0.10.2",
64
+ "remark-math": "^6.0.0",
65
+ "remark-rehype": "^11.0.0",
66
66
  "remark-shiki-twoslash": "^3.1.3",
67
- "remark-toc": "^8.0.1",
68
- "unified": "^10.1.2",
69
- "vite": "^4.4.9",
70
- "astro": "3.5.4",
67
+ "remark-toc": "^9.0.0",
68
+ "unified": "^11.0.4",
69
+ "vite": "^5.0.0",
70
+ "astro": "4.0.0",
71
71
  "astro-scripts": "0.0.14"
72
72
  },
73
73
  "engines": {