From 5acb6e15950dd6c8c97d4617bf3b3e31089d642a Mon Sep 17 00:00:00 2001 From: Bill Collins Date: Sat, 14 Dec 2024 09:29:55 +0000 Subject: [PATCH] Patch markdown-to-jsx to fix ReactChild references --- ...markdown-to-jsx-npm-7.7.1-6038885620.patch | 38 +++++++++++++++++++ code/core/package.json | 2 +- code/lib/blocks/package.json | 2 +- code/yarn.lock | 15 ++++++-- 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 code/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch diff --git a/code/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch b/code/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch new file mode 100644 index 000000000000..80fa7d077b22 --- /dev/null +++ b/code/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch @@ -0,0 +1,38 @@ +diff --git a/dist/index.d.ts b/dist/index.d.ts +index 6e4fa449b971d5ccd3e34f6e3f008d580d69372e..f7e51eb008306c670f319b98adcc15935d239147 100644 +--- a/dist/index.d.ts ++++ b/dist/index.d.ts +@@ -271,7 +271,7 @@ export declare namespace MarkdownToJSX { + /** + * Continue rendering AST nodes if applicable. + */ +- render: RuleOutput, state?: MarkdownToJSX.State) => React.ReactChild; ++ render: RuleOutput, state?: MarkdownToJSX.State) => React.ReactNode; + }; + export type Rules = { + [K in ParserResult['type']]: K extends typeof RuleType.table ? Rule[0], props: React.JSX.IntrinsicAttributes, ...children: React.ReactChild[]) => React.ReactChild; ++ createElement: (tag: Parameters[0], props: React.JSX.IntrinsicAttributes, ...children: React.ReactNode[]) => React.ReactNode; + /** + * The library automatically generates an anchor tag for bare URLs included in the markdown + * document, but this behavior can be disabled if desired. +@@ -376,13 +376,13 @@ export declare namespace MarkdownToJSX { + */ + renderRule: ( + /** Resume normal processing, call this function as a fallback if you are not returning custom JSX. */ +- next: () => React.ReactChild, ++ next: () => React.ReactNode, + /** the current AST node, use `RuleType` against `node.type` for identification */ + node: ParserResult, + /** use as `renderChildren(node.children)` for block nodes */ + renderChildren: RuleOutput, + /** contains `key` which should be supplied to the topmost JSX element */ +- state: State) => React.ReactChild; ++ state: State) => React.ReactNode; + /** + * Override the built-in sanitizer function for URLs, etc if desired. The built-in version is available as a library export called `sanitizer`. + */ diff --git a/code/core/package.json b/code/core/package.json index 3557cb288bad..75dbc32c1aaf 100644 --- a/code/core/package.json +++ b/code/core/package.json @@ -368,7 +368,7 @@ "js-yaml": "^4.1.0", "lazy-universal-dotenv": "^4.0.0", "leven": "^4.0.0", - "markdown-to-jsx": "^7.4.5", + "markdown-to-jsx": "patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch", "memfs": "^4.11.1", "memoizerific": "^1.11.3", "nanoid": "^4.0.2", diff --git a/code/lib/blocks/package.json b/code/lib/blocks/package.json index f66f1e14ba5f..6a3086d7536e 100644 --- a/code/lib/blocks/package.json +++ b/code/lib/blocks/package.json @@ -54,7 +54,7 @@ "@types/color-convert": "^2.0.0", "color-convert": "^2.0.1", "es-toolkit": "^1.22.0", - "markdown-to-jsx": "^7.7.1", + "markdown-to-jsx": "patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch", "memoizerific": "^1.11.3", "polished": "^4.2.2", "react-colorful": "^5.1.2", diff --git a/code/yarn.lock b/code/yarn.lock index cab2fc062626..723a9b5290ea 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6113,7 +6113,7 @@ __metadata: "@types/color-convert": "npm:^2.0.0" color-convert: "npm:^2.0.1" es-toolkit: "npm:^1.22.0" - markdown-to-jsx: "npm:^7.7.1" + markdown-to-jsx: "patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch" memoizerific: "npm:^1.11.3" polished: "npm:^4.2.2" react-colorful: "npm:^5.1.2" @@ -6440,7 +6440,7 @@ __metadata: jsdoc-type-pratt-parser: "npm:^4.0.0" lazy-universal-dotenv: "npm:^4.0.0" leven: "npm:^4.0.0" - markdown-to-jsx: "npm:^7.4.5" + markdown-to-jsx: "patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch" memfs: "npm:^4.11.1" memoizerific: "npm:^1.11.3" nanoid: "npm:^4.0.2" @@ -20234,7 +20234,7 @@ __metadata: languageName: node linkType: hard -"markdown-to-jsx@npm:^7.4.5, markdown-to-jsx@npm:^7.7.1": +"markdown-to-jsx@npm:7.7.1": version: 7.7.1 resolution: "markdown-to-jsx@npm:7.7.1" peerDependencies: @@ -20243,6 +20243,15 @@ __metadata: languageName: node linkType: hard +"markdown-to-jsx@patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch": + version: 7.7.1 + resolution: "markdown-to-jsx@patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch::version=7.7.1&hash=ad34a1" + peerDependencies: + react: ">= 0.14.0" + checksum: 10c0/c5d8983a14bb448d87ef581ac79dedea0fcf0f715dfe1cae1a1d89116c8a090fc0668be4eca8cf0c6b5848ae68c9345662a00b3342a61f80ae0e3014a6c8ea2c + languageName: node + linkType: hard + "matcher-collection@npm:^1.0.0, matcher-collection@npm:^1.1.1": version: 1.1.2 resolution: "matcher-collection@npm:1.1.2"