@readme/markdown 9.1.1 → 9.1.3

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
- import type { RMDXModuleProps, RunOpts } from '../lib/run';
1
+ import type { RunOpts } from '../lib/run';
2
2
  import React from 'react';
3
- type Props = Pick<RMDXModuleProps, 'theme'> & Pick<RunOpts, 'baseUrl' | 'terms' | 'variables'> & React.PropsWithChildren;
3
+ type Props = Pick<RunOpts, 'baseUrl' | 'terms' | 'theme' | 'variables'> & React.PropsWithChildren;
4
4
  declare const Contexts: ({ children, terms, variables, baseUrl, theme }: Props) => React.ReactNode;
5
5
  export default Contexts;
@@ -10,6 +10,6 @@ export interface MdastOpts {
10
10
  export declare const remarkPlugins: ((() => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
11
11
  copyButtons?: boolean;
12
12
  }) => (tree: import("mdast").Node) => import("mdast").Node) | typeof remarkFrontmatter | typeof remarkGfm)[];
13
- export declare const rehypePlugins: ((() => (tree: import("unist").Node) => import("unist").Node) | typeof rehypeSlug)[];
13
+ export declare const rehypePlugins: (typeof rehypeSlug | (() => (tree: import("unist").Node) => import("unist").Node))[];
14
14
  declare const astProcessor: (opts?: MdastOpts) => import("unified").Processor<import("mdast").Root, import("mdast").Root, import("mdast").Root, import("mdast").Root, string>;
15
15
  export default astProcessor;
package/dist/lib/run.d.ts CHANGED
@@ -2,16 +2,13 @@ import type { GlossaryTerm } from '../contexts/GlossaryTerms';
2
2
  import type { CustomComponents, RMDXModule } from '../types';
3
3
  import type { Variables } from '../utils/user';
4
4
  import type { RunOptions } from '@mdx-js/mdx';
5
- import type { MDXProps } from 'mdx/types';
6
5
  export type RunOpts = Omit<RunOptions, 'Fragment'> & {
7
6
  baseUrl?: string;
8
7
  components?: CustomComponents;
9
8
  imports?: Record<string, unknown>;
10
9
  terms?: GlossaryTerm[];
10
+ theme?: 'dark' | 'light';
11
11
  variables?: Variables;
12
12
  };
13
- export type RMDXModuleProps = MDXProps & {
14
- theme: 'dark' | 'light';
15
- };
16
13
  declare const run: (string: string, _opts?: RunOpts) => Promise<RMDXModule>;
17
14
  export default run;
package/dist/main.js CHANGED
@@ -70618,11 +70618,13 @@ const getExports = (tree) => {
70618
70618
 
70619
70619
 
70620
70620
 
70621
+
70621
70622
  const handleMissingComponents = ({ components, missingComponents }) => tree => {
70622
70623
  const allComponents = new Set([
70623
70624
  ...getExports(tree),
70624
70625
  ...Object.keys(components_namespaceObject),
70625
70626
  ...Object.keys(components),
70627
+ ...Object.values(components).flatMap(doc => getExports(lib_mdast(doc))),
70626
70628
  'Variable',
70627
70629
  ]);
70628
70630
  visit(tree, isMDXElement, (node, index, parent) => {
@@ -99283,7 +99285,7 @@ const makeUseMDXComponents = (more = {}) => {
99283
99285
 
99284
99286
  const run_run = async (string, _opts = {}) => {
99285
99287
  const { Fragment } = jsx_runtime_namespaceObject;
99286
- const { components = {}, terms, variables, baseUrl, imports = {}, ...opts } = _opts;
99288
+ const { components = {}, terms, variables, baseUrl, imports = {}, theme, ...opts } = _opts;
99287
99289
  const tocsByTag = {};
99288
99290
  const exportedComponents = Object.entries(components).reduce((memo, [tag, mod]) => {
99289
99291
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -99317,7 +99319,7 @@ const run_run = async (string, _opts = {}) => {
99317
99319
  Toc = tocModule.default;
99318
99320
  }
99319
99321
  return {
99320
- default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, terms: terms, theme: props.theme, variables: variables },
99322
+ default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, terms: terms, theme: theme, variables: variables },
99321
99323
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Content, { ...props }))),
99322
99324
  toc,
99323
99325
  Toc: props => Toc ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(components_TableOfContents, null,
package/dist/main.node.js CHANGED
@@ -75210,11 +75210,13 @@ const getExports = (tree) => {
75210
75210
 
75211
75211
 
75212
75212
 
75213
+
75213
75214
  const handleMissingComponents = ({ components, missingComponents }) => tree => {
75214
75215
  const allComponents = new Set([
75215
75216
  ...getExports(tree),
75216
75217
  ...Object.keys(components_namespaceObject),
75217
75218
  ...Object.keys(components),
75219
+ ...Object.values(components).flatMap(doc => getExports(lib_mdast(doc))),
75218
75220
  'Variable',
75219
75221
  ]);
75220
75222
  visit(tree, isMDXElement, (node, index, parent) => {
@@ -103875,7 +103877,7 @@ const makeUseMDXComponents = (more = {}) => {
103875
103877
 
103876
103878
  const run_run = async (string, _opts = {}) => {
103877
103879
  const { Fragment } = jsx_runtime_namespaceObject;
103878
- const { components = {}, terms, variables, baseUrl, imports = {}, ...opts } = _opts;
103880
+ const { components = {}, terms, variables, baseUrl, imports = {}, theme, ...opts } = _opts;
103879
103881
  const tocsByTag = {};
103880
103882
  const exportedComponents = Object.entries(components).reduce((memo, [tag, mod]) => {
103881
103883
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -103909,7 +103911,7 @@ const run_run = async (string, _opts = {}) => {
103909
103911
  Toc = tocModule.default;
103910
103912
  }
103911
103913
  return {
103912
- default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, terms: terms, theme: props.theme, variables: variables },
103914
+ default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, terms: terms, theme: theme, variables: variables },
103913
103915
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Content, { ...props }))),
103914
103916
  toc,
103915
103917
  Toc: props => Toc ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(components_TableOfContents, null,