@astrojs/mdx 0.12.2 → 0.13.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.
@@ -1,5 +1,5 @@
1
- @astrojs/mdx:build: cache hit, replaying output 7b0a39f7d517504d
1
+ @astrojs/mdx:build: cache hit, replaying output 72ab36e70338807d
2
2
  @astrojs/mdx:build: 
3
- @astrojs/mdx:build: > @astrojs/mdx@0.12.2 build /home/runner/work/astro/astro/packages/integrations/mdx
3
+ @astrojs/mdx:build: > @astrojs/mdx@0.13.0 build /home/runner/work/astro/astro/packages/integrations/mdx
4
4
  @astrojs/mdx:build: > astro-scripts build "src/**/*.ts" && tsc
5
5
  @astrojs/mdx:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @astrojs/mdx
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#5291](https://github.com/withastro/astro/pull/5291) [`5ec0f6ed5`](https://github.com/withastro/astro/commit/5ec0f6ed55b0a14a9663a90a03428345baf126bd) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce Content Collections experimental API
8
+ - Organize your Markdown and MDX content into easy-to-manage collections.
9
+ - Add type safety to your frontmatter with schemas.
10
+ - Generate landing pages, static routes, and SSR endpoints from your content using the collection query APIs.
11
+
3
12
  ## 0.12.2
4
13
 
5
14
  ### Patch Changes
package/dist/plugins.js CHANGED
@@ -38,19 +38,25 @@ function remarkInitializeAstroData() {
38
38
  }
39
39
  };
40
40
  }
41
- const EXPORT_NAME = "frontmatter";
42
41
  function rehypeApplyFrontmatterExport(pageFrontmatter) {
43
42
  return function(tree, vfile) {
44
43
  const { frontmatter: injectedFrontmatter } = safelyGetAstroData(vfile.data);
45
44
  const frontmatter = { ...injectedFrontmatter, ...pageFrontmatter };
46
45
  const exportNodes = [
47
- jsToTreeNode(`export const ${EXPORT_NAME} = ${JSON.stringify(frontmatter)};`)
46
+ jsToTreeNode(
47
+ `export const frontmatter = ${JSON.stringify(
48
+ frontmatter
49
+ )};
50
+ export const _internal = { injectedFrontmatter: ${JSON.stringify(
51
+ injectedFrontmatter
52
+ )} };`
53
+ )
48
54
  ];
49
55
  if (frontmatter.layout) {
50
56
  exportNodes.unshift(
51
57
  jsToTreeNode(
52
58
  `import { jsx as layoutJsx } from 'astro/jsx-runtime';
53
-
59
+
54
60
  export default async function ({ children }) {
55
61
  const Layout = (await import(${JSON.stringify(frontmatter.layout)})).default;
56
62
  const { layout, ...content } = frontmatter;
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.12.2",
4
+ "version": "0.13.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -46,7 +46,7 @@
46
46
  "@types/github-slugger": "^1.3.0",
47
47
  "@types/mocha": "^9.1.1",
48
48
  "@types/yargs-parser": "^21.0.0",
49
- "astro": "1.6.15",
49
+ "astro": "1.7.0",
50
50
  "astro-scripts": "0.0.9",
51
51
  "chai": "^4.3.6",
52
52
  "cheerio": "^1.0.0-rc.11",
package/src/plugins.ts CHANGED
@@ -51,14 +51,18 @@ export function remarkInitializeAstroData() {
51
51
  };
52
52
  }
53
53
 
54
- const EXPORT_NAME = 'frontmatter';
55
-
56
54
  export function rehypeApplyFrontmatterExport(pageFrontmatter: Record<string, any>) {
57
55
  return function (tree: any, vfile: VFile) {
58
56
  const { frontmatter: injectedFrontmatter } = safelyGetAstroData(vfile.data);
59
57
  const frontmatter = { ...injectedFrontmatter, ...pageFrontmatter };
60
58
  const exportNodes = [
61
- jsToTreeNode(`export const ${EXPORT_NAME} = ${JSON.stringify(frontmatter)};`),
59
+ jsToTreeNode(
60
+ `export const frontmatter = ${JSON.stringify(
61
+ frontmatter
62
+ )};\nexport const _internal = { injectedFrontmatter: ${JSON.stringify(
63
+ injectedFrontmatter
64
+ )} };`
65
+ ),
62
66
  ];
63
67
  if (frontmatter.layout) {
64
68
  // NOTE(bholmesdev) 08-22-2022
@@ -69,7 +73,7 @@ export function rehypeApplyFrontmatterExport(pageFrontmatter: Record<string, any
69
73
  jsToTreeNode(
70
74
  /** @see 'vite-plugin-markdown' for layout props reference */
71
75
  `import { jsx as layoutJsx } from 'astro/jsx-runtime';
72
-
76
+
73
77
  export default async function ({ children }) {
74
78
  const Layout = (await import(${JSON.stringify(frontmatter.layout)})).default;
75
79
  const { layout, ...content } = frontmatter;