@astrojs/mdx 0.16.2 → 0.17.2

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.
@@ -1,5 +1,5 @@
1
- @astrojs/mdx:build: cache hit, replaying output 9c4b0b19660fad84
2
- @astrojs/mdx:build: 
3
- @astrojs/mdx:build: > @astrojs/mdx@0.16.2 build /home/runner/work/astro/astro/packages/integrations/mdx
4
- @astrojs/mdx:build: > astro-scripts build "src/**/*.ts" && tsc
5
- @astrojs/mdx:build: 
1
+ @astrojs/mdx:build: cache hit, replaying output b5a6d4a613b226a3
2
+ @astrojs/mdx:build: 
3
+ @astrojs/mdx:build: > @astrojs/mdx@0.17.2 build /home/runner/work/astro/astro/packages/integrations/mdx
4
+ @astrojs/mdx:build: > astro-scripts build "src/**/*.ts" && tsc
5
+ @astrojs/mdx:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @astrojs/mdx
2
2
 
3
+ ## 0.17.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#6296](https://github.com/withastro/astro/pull/6296) [`075b87e8b`](https://github.com/withastro/astro/commit/075b87e8b72a69a608cd2ff1196dc0989e2cf1e1) Thanks [@RaphaelBossek](https://github.com/RaphaelBossek)! - Update to `es-module-lexer@1.1.1`
8
+
9
+ ## 0.17.1
10
+
11
+ - Updated to es-module-lexer@1.1.1
12
+
13
+ ## 0.17.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#6253](https://github.com/withastro/astro/pull/6253) [`0049fda62`](https://github.com/withastro/astro/commit/0049fda62fa8650a0d250adb00a2c5d82679aeaf) Thanks [@bluwy](https://github.com/bluwy)! - Support rehype plugins that inject namespaced attributes. This introduces a breaking change if you use [custom components for HTML elements](https://docs.astro.build/en/guides/markdown-content/#assigning-custom-components-to-html-elements), where the prop passed to the component will be normal HTML casing, e.g. `class` instead of `className`, and `xlink:href` instead of `xlinkHref`.
18
+
3
19
  ## 0.16.2
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ function mdx(partialMdxOptions = {}) {
48
48
  const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
49
49
  const compiled = await mdxCompile(new VFile({ value: pageContent, path: id }), {
50
50
  ...mdxPluginOpts,
51
+ elementAttributeNameCase: "html",
51
52
  remarkPlugins: [
52
53
  toRemarkInitializeAstroData({ userFrontmatter: frontmatter }),
53
54
  ...mdxPluginOpts.remarkPlugins ?? []
@@ -77,15 +78,15 @@ function mdx(partialMdxOptions = {}) {
77
78
  code = 'import { Fragment } from "astro/jsx-runtime"\n' + code;
78
79
  }
79
80
  const { fileUrl, fileId } = getFileInfo(id, config);
80
- if (!moduleExports.includes("url")) {
81
+ if (!moduleExports.find(({ n }) => n === "url")) {
81
82
  code += `
82
83
  export const url = ${JSON.stringify(fileUrl)};`;
83
84
  }
84
- if (!moduleExports.includes("file")) {
85
+ if (!moduleExports.find(({ n }) => n === "file")) {
85
86
  code += `
86
87
  export const file = ${JSON.stringify(fileId)};`;
87
88
  }
88
- if (!moduleExports.includes("Content")) {
89
+ if (!moduleExports.find(({ n }) => n === "Content")) {
89
90
  code = code.replace("export default MDXContent;", "");
90
91
  code += `
91
92
  export const Content = (props = {}) => MDXContent({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/mdx",
3
3
  "description": "Use MDX within Astro",
4
- "version": "0.16.2",
4
+ "version": "0.17.2",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -28,7 +28,7 @@
28
28
  "@mdx-js/mdx": "^2.3.0",
29
29
  "@mdx-js/rollup": "^2.3.0",
30
30
  "acorn": "^8.8.0",
31
- "es-module-lexer": "^0.10.5",
31
+ "es-module-lexer": "^1.1.1",
32
32
  "estree-util-visit": "^1.2.0",
33
33
  "github-slugger": "^1.4.0",
34
34
  "gray-matter": "^4.0.3",
@@ -48,8 +48,8 @@
48
48
  "@types/mdast": "^3.0.10",
49
49
  "@types/mocha": "^9.1.1",
50
50
  "@types/yargs-parser": "^21.0.0",
51
- "astro": "2.0.12",
52
- "astro-scripts": "0.0.10",
51
+ "astro": "2.0.15",
52
+ "astro-scripts": "0.0.11",
53
53
  "chai": "^4.3.6",
54
54
  "cheerio": "^1.0.0-rc.11",
55
55
  "linkedom": "^0.14.12",
@@ -61,7 +61,7 @@
61
61
  "remark-rehype": "^10.1.0",
62
62
  "remark-shiki-twoslash": "^3.1.0",
63
63
  "remark-toc": "^8.0.1",
64
- "vite": "^4.0.3"
64
+ "vite": "^4.1.2"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=16.12.0"
package/src/index.ts CHANGED
@@ -74,6 +74,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
74
74
  const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
75
75
  const compiled = await mdxCompile(new VFile({ value: pageContent, path: id }), {
76
76
  ...mdxPluginOpts,
77
+ elementAttributeNameCase: 'html',
77
78
  remarkPlugins: [
78
79
  // Ensure `data.astro` is available to all remark plugins
79
80
  toRemarkInitializeAstroData({ userFrontmatter: frontmatter }),
@@ -111,13 +112,13 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
111
112
  }
112
113
 
113
114
  const { fileUrl, fileId } = getFileInfo(id, config);
114
- if (!moduleExports.includes('url')) {
115
+ if (!moduleExports.find(({ n }) => n === 'url')) {
115
116
  code += `\nexport const url = ${JSON.stringify(fileUrl)};`;
116
117
  }
117
- if (!moduleExports.includes('file')) {
118
+ if (!moduleExports.find(({ n }) => n === 'file')) {
118
119
  code += `\nexport const file = ${JSON.stringify(fileId)};`;
119
120
  }
120
- if (!moduleExports.includes('Content')) {
121
+ if (!moduleExports.find(({ n }) => n === 'Content')) {
121
122
  // Make `Content` the default export so we can wrap `MDXContent` and pass in `Fragment`
122
123
  code = code.replace('export default MDXContent;', '');
123
124
  code += `\nexport const Content = (props = {}) => MDXContent({
@@ -63,7 +63,7 @@ describe('MDX plugins', () => {
63
63
  expect(selectRehypeExample(document)).to.not.be.null;
64
64
  });
65
65
 
66
- it.skip('supports custom rehype plugins with namespaced attributes', async () => {
66
+ it('supports custom rehype plugins with namespaced attributes', async () => {
67
67
  const fixture = await buildFixture({
68
68
  integrations: [
69
69
  mdx({