@astrojs/mdx 5.0.3 → 6.0.0-alpha.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/README.md CHANGED
@@ -35,4 +35,4 @@ Copyright (c) 2023–present [Astro][astro]
35
35
  [community]: https://github.com/withastro/.github/blob/main/COMMUNITY_GUIDE.md
36
36
  [discord]: https://astro.build/chat/
37
37
  [issues]: https://github.com/withastro/astro/issues
38
- [astro-integration]: https://docs.astro.build/en/guides/integrations-guide/
38
+ [astro-integration]: https://docs.astro.build/en/guides/integrations/
@@ -7,6 +7,6 @@ export interface OptimizeOptions {
7
7
  * do not include any MDX elements.
8
8
  *
9
9
  * This optimization reduces the JS output as more content are represented as a
10
- * string instead, which also reduces the AST size that Rollup holds in memory.
10
+ * string instead, which also reduces the AST size that Rolldown holds in memory.
11
11
  */
12
12
  export declare const rehypeOptimizeStatic: RehypePlugin<[OptimizeOptions?]>;
package/dist/server.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { NamedSSRLoadedRendererValue } from 'astro';
2
+ export declare const slotName: (str: string) => string;
2
3
  export declare function check(Component: any, props: any, { default: children, ...slotted }?: {
3
4
  default?: null | undefined;
4
5
  }): Promise<any>;
package/dist/server.js CHANGED
@@ -49,5 +49,6 @@ var server_default = renderer;
49
49
  export {
50
50
  check,
51
51
  server_default as default,
52
- renderToStaticMarkup
52
+ renderToStaticMarkup,
53
+ slotName
53
54
  };
package/dist/utils.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Options as AcornOpts } from 'acorn';
2
2
  import type { AstroConfig, AstroIntegrationLogger } from 'astro';
3
3
  import type { MdxjsEsm } from 'mdast-util-mdx';
4
4
  import type { PluggableList } from 'unified';
5
+ export declare function appendForwardSlash(path: string): string;
5
6
  export interface FileInfo {
6
7
  fileId: string;
7
8
  fileUrl: string;
package/dist/utils.js CHANGED
@@ -82,6 +82,7 @@ function ignoreStringPlugins(plugins, logger) {
82
82
  return validPlugins;
83
83
  }
84
84
  export {
85
+ appendForwardSlash,
85
86
  getFileInfo,
86
87
  ignoreStringPlugins,
87
88
  jsToTreeNode,
@@ -1,3 +1,26 @@
1
1
  import type { AstroConfig } from 'astro';
2
+ import { type ExportSpecifier, type ImportSpecifier } from 'es-module-lexer';
2
3
  import type { Plugin } from 'vite';
4
+ import { type FileInfo } from './utils.js';
3
5
  export declare function vitePluginMdxPostprocess(astroConfig: AstroConfig): Plugin;
6
+ /**
7
+ * Inject `Fragment` identifier import if not already present.
8
+ */
9
+ export declare function injectUnderscoreFragmentImport(code: string, imports: readonly ImportSpecifier[]): string;
10
+ /**
11
+ * Inject MDX metadata as exports of the module.
12
+ */
13
+ export declare function injectMetadataExports(code: string, exports: readonly ExportSpecifier[], fileInfo: FileInfo): string;
14
+ /**
15
+ * Transforms the `MDXContent` default export as `Content`, which wraps `MDXContent` and
16
+ * passes additional `components` props.
17
+ */
18
+ export declare function transformContentExport(code: string, exports: readonly ExportSpecifier[]): string;
19
+ /**
20
+ * Add properties to the `Content` export.
21
+ */
22
+ export declare function annotateContentExport(code: string, id: string, ssr: boolean, imports: readonly ImportSpecifier[]): string;
23
+ /**
24
+ * Check whether the `specifierRegex` matches for an import of `source` in the `code`.
25
+ */
26
+ export declare function isSpecifierImported(code: string, imports: readonly ImportSpecifier[], specifierRegex: RegExp, source: string): boolean;
@@ -98,5 +98,10 @@ function isSpecifierImported(code, imports, specifierRegex, source) {
98
98
  return false;
99
99
  }
100
100
  export {
101
+ annotateContentExport,
102
+ injectMetadataExports,
103
+ injectUnderscoreFragmentImport,
104
+ isSpecifierImported,
105
+ transformContentExport,
101
106
  vitePluginMdxPostprocess
102
107
  };
@@ -6,7 +6,7 @@ function vitePluginMdx(opts) {
6
6
  let processor;
7
7
  let sourcemapEnabled;
8
8
  return {
9
- name: "@mdx-js/rollup",
9
+ name: "@mdx-js/rolldown",
10
10
  enforce: "pre",
11
11
  buildEnd() {
12
12
  processor = void 0;
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": "5.0.3",
4
+ "version": "6.0.0-alpha.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -40,10 +40,10 @@
40
40
  "source-map": "^0.7.6",
41
41
  "unist-util-visit": "^5.1.0",
42
42
  "vfile": "^6.0.3",
43
- "@astrojs/markdown-remark": "7.1.0"
43
+ "@astrojs/markdown-remark": "7.1.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "astro": "^6.0.0"
46
+ "astro": "^7.0.0-alpha.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@shikijs/rehype": "^4.0.2",
@@ -62,8 +62,8 @@
62
62
  "remark-toc": "^9.0.0",
63
63
  "shiki": "^4.0.2",
64
64
  "unified": "^11.0.5",
65
- "vite": "^7.3.1",
66
- "astro": "6.1.0",
65
+ "vite": "^8.0.8",
66
+ "astro": "7.0.0-alpha.0",
67
67
  "astro-scripts": "0.0.14"
68
68
  },
69
69
  "engines": {
@@ -76,6 +76,7 @@
76
76
  "build": "astro-scripts build \"src/**/*.ts\" && tsc",
77
77
  "build:ci": "astro-scripts build \"src/**/*.ts\"",
78
78
  "dev": "astro-scripts dev \"src/**/*.ts\"",
79
- "test": "astro-scripts test --timeout 70000 \"test/**/*.test.js\""
79
+ "test": "astro-scripts test --timeout 70000 \"test/**/*.test.ts\"",
80
+ "typecheck:tests": "tsc --build tsconfig.test.json"
80
81
  }
81
82
  }