@astrojs/mdx 0.11.2 → 0.11.4

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 efbc0a3c2d5779f7
2
- @astrojs/mdx:build: 
3
- @astrojs/mdx:build: > @astrojs/mdx@0.11.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 f5624f774ddb4884
2
+ @astrojs/mdx:build: 
3
+ @astrojs/mdx:build: > @astrojs/mdx@0.11.4 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,17 @@
1
1
  # @astrojs/mdx
2
2
 
3
+ ## 0.11.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4953](https://github.com/withastro/astro/pull/4953) [`a59731995`](https://github.com/withastro/astro/commit/a59731995b93ae69c21dc3adc5c8b482b466d12e) Thanks [@bluwy](https://github.com/bluwy)! - Log markdown hints with console.info
8
+
9
+ ## 0.11.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#4842](https://github.com/withastro/astro/pull/4842) [`812658ad2`](https://github.com/withastro/astro/commit/812658ad2ab3732a99e35c4fd903e302e723db46) Thanks [@bluwy](https://github.com/bluwy)! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
14
+
3
15
  ## 0.11.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -24,15 +24,15 @@ function mdx(mdxOptions = {}) {
24
24
  handleExtendsNotSupported(mdxOptions.remarkPlugins);
25
25
  handleExtendsNotSupported(mdxOptions.rehypePlugins);
26
26
  if (mdxOptions.extendPlugins === "markdown" && (((_a = config.markdown.rehypePlugins) == null ? void 0 : _a.length) || ((_b = config.markdown.remarkPlugins) == null ? void 0 : _b.length))) {
27
- console.log(
27
+ console.info(
28
28
  blue(`[MDX] Now inheriting remark and rehype plugins from "markdown" config.`)
29
29
  );
30
- console.log(
30
+ console.info(
31
31
  `If you applied a plugin to both your Markdown and MDX configs, we suggest ${bold(
32
32
  "removing the duplicate MDX entry."
33
33
  )}`
34
34
  );
35
- console.log(`See "extendPlugins" option to configure this behavior.`);
35
+ console.info(`See "extendPlugins" option to configure this behavior.`);
36
36
  }
37
37
  const mdxPluginOpts = {
38
38
  remarkPlugins: await getRemarkPlugins(mdxOptions, config),
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.11.2",
4
+ "version": "0.11.4",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -43,17 +43,21 @@
43
43
  "devDependencies": {
44
44
  "@types/chai": "^4.3.1",
45
45
  "@types/estree": "^1.0.0",
46
+ "@types/github-slugger": "^1.3.0",
46
47
  "@types/mocha": "^9.1.1",
47
48
  "@types/yargs-parser": "^21.0.0",
48
- "astro": "1.3.1",
49
+ "astro": "1.4.3",
49
50
  "astro-scripts": "0.0.8",
50
51
  "chai": "^4.3.6",
52
+ "cheerio": "^1.0.0-rc.11",
51
53
  "linkedom": "^0.14.12",
54
+ "mdast-util-mdx": "^2.0.0",
52
55
  "mdast-util-to-string": "^3.1.0",
53
56
  "mocha": "^9.2.2",
54
57
  "reading-time": "^1.5.0",
55
58
  "remark-shiki-twoslash": "^3.1.0",
56
- "remark-toc": "^8.0.1"
59
+ "remark-toc": "^8.0.1",
60
+ "vite": "^3.0.0"
57
61
  },
58
62
  "engines": {
59
63
  "node": "^14.18.0 || >=16.12.0"
package/src/index.ts CHANGED
@@ -50,15 +50,15 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration {
50
50
  mdxOptions.extendPlugins === 'markdown' &&
51
51
  (config.markdown.rehypePlugins?.length || config.markdown.remarkPlugins?.length)
52
52
  ) {
53
- console.log(
53
+ console.info(
54
54
  blue(`[MDX] Now inheriting remark and rehype plugins from "markdown" config.`)
55
55
  );
56
- console.log(
56
+ console.info(
57
57
  `If you applied a plugin to both your Markdown and MDX configs, we suggest ${bold(
58
58
  'removing the duplicate MDX entry.'
59
59
  )}`
60
60
  );
61
- console.log(`See "extendPlugins" option to configure this behavior.`);
61
+ console.info(`See "extendPlugins" option to configure this behavior.`);
62
62
  }
63
63
 
64
64
  const mdxPluginOpts: MdxRollupPluginOptions = {
@@ -0,0 +1,6 @@
1
+ import mdx from '@astrojs/mdx';
2
+ import preact from '@astrojs/preact';
3
+
4
+ export default {
5
+ integrations: [mdx(), preact()]
6
+ }
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../../../astro/astro.js" "$@"
17
+ fi
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@test/mdx-infinite-loop",
3
+ "type": "module",
4
+ "dependencies": {
5
+ "@astrojs/mdx": "workspace:*",
6
+ "@astrojs/preact": "workspace:*",
7
+ "preact": "^10.7.3",
8
+ "astro": "workspace:*"
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ export default function () {
2
+ return 'Hello world'
3
+ }
@@ -0,0 +1,6 @@
1
+ import Test, { Missing } from '../components/Test';
2
+
3
+ # Hello page!
4
+
5
+ <Test />
6
+ <Missing />
@@ -0,0 +1,5 @@
1
+ ---
2
+ const files = await Astro.glob('./**/*.mdx')
3
+ ---
4
+
5
+ {files.map((file: any) => <file.Content />)}
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@test/mdx-namespace",
3
3
  "dependencies": {
4
- "astro": "workspace:*",
5
4
  "@astrojs/mdx": "workspace:*",
6
- "@astrojs/react": "workspace:*"
5
+ "@astrojs/react": "workspace:*",
6
+ "astro": "workspace:*",
7
+ "react": "^18.2.0",
8
+ "react-dom": "^18.1.0"
7
9
  }
8
10
  }
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@test/mdx-page",
3
3
  "dependencies": {
4
+ "@astrojs/mdx": "workspace:*",
4
5
  "astro": "workspace:*",
5
- "@astrojs/mdx": "workspace:*"
6
+ "react": "^18.2.0",
7
+ "react-dom": "^18.2.0"
6
8
  }
7
9
  }
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@test/mdx-plus-react",
3
3
  "dependencies": {
4
- "astro": "workspace:*",
5
4
  "@astrojs/mdx": "workspace:*",
6
- "@astrojs/react": "workspace:*"
5
+ "@astrojs/react": "workspace:*",
6
+ "astro": "workspace:*",
7
+ "react": "^18.2.0",
8
+ "react-dom": "^18.2.0"
7
9
  }
8
10
  }
@@ -0,0 +1,30 @@
1
+ import mdx from '@astrojs/mdx';
2
+
3
+ import { expect } from 'chai';
4
+ import { loadFixture } from '../../../astro/test/test-utils.js';
5
+
6
+ describe('MDX Infinite Loop', () => {
7
+ let fixture;
8
+
9
+ before(async () => {
10
+ fixture = await loadFixture({
11
+ root: new URL('./fixtures/mdx-infinite-loop/', import.meta.url),
12
+ integrations: [mdx()],
13
+ });
14
+ });
15
+
16
+ describe('build', () => {
17
+ let err;
18
+ before(async () => {
19
+ try {
20
+ await fixture.build();
21
+ } catch (e) {
22
+ err = e;
23
+ }
24
+ });
25
+
26
+ it('does not hang forever if an error is thrown', async () => {
27
+ expect(!!err).to.be.true;
28
+ });
29
+ });
30
+ });