From a08ff211acd94b7ef36ff8345a38714103781461 Mon Sep 17 00:00:00 2001 From: Cyril <161298641+KakkoiDev@users.noreply.github.com> Date: Sun, 22 Feb 2026 06:11:43 +0900 Subject: [PATCH] fix(site): patch /api page crash from read-only Function.length assignment (#3695) Docusaurus ComponentCreator copies CJS interop properties onto function components, hitting read-only Function.length. Two patch-package fixes: - @docusaurus/core: try-catch in ComponentCreator.js property assignment - docusaurus-plugin-typedoc-api: make ApiPage.length writable before export --- site/patches/@docusaurus+core+3.5.2.patch | 19 +++++++++++++++++++ .../docusaurus-plugin-typedoc-api+4.4.0.patch | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 site/patches/docusaurus-plugin-typedoc-api+4.4.0.patch diff --git a/site/patches/@docusaurus+core+3.5.2.patch b/site/patches/@docusaurus+core+3.5.2.patch index 1ba96b10..569b35f9 100644 --- a/site/patches/@docusaurus+core+3.5.2.patch +++ b/site/patches/@docusaurus+core+3.5.2.patch @@ -1,3 +1,22 @@ +diff --git a/node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js b/node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js +index e3b63d0..d485ff0 100644 +--- a/node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js ++++ b/node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js +@@ -82,8 +82,12 @@ export default function ComponentCreator(path, hash) { + Object.keys(loadedModule) + .filter((k) => k !== 'default') + .forEach((nonDefaultKey) => { +- chunk[nonDefaultKey] = +- loadedModule[nonDefaultKey]; ++ try { ++ chunk[nonDefaultKey] = ++ loadedModule[nonDefaultKey]; ++ } catch (e) { ++ // Skip non-writable properties (e.g. Function.length) ++ } + }); + } + // We now have this chunk prepared. Go down the key path and replace the diff --git a/node_modules/@docusaurus/core/lib/commands/build.js b/node_modules/@docusaurus/core/lib/commands/build.js index 2865e66..7c69768 100644 --- a/node_modules/@docusaurus/core/lib/commands/build.js diff --git a/site/patches/docusaurus-plugin-typedoc-api+4.4.0.patch b/site/patches/docusaurus-plugin-typedoc-api+4.4.0.patch new file mode 100644 index 00000000..e49de2c8 --- /dev/null +++ b/site/patches/docusaurus-plugin-typedoc-api+4.4.0.patch @@ -0,0 +1,11 @@ +diff --git a/node_modules/docusaurus-plugin-typedoc-api/lib/components/ApiPage.js b/node_modules/docusaurus-plugin-typedoc-api/lib/components/ApiPage.js +index 2204247..58e80d5 100644 +--- a/node_modules/docusaurus-plugin-typedoc-api/lib/components/ApiPage.js ++++ b/node_modules/docusaurus-plugin-typedoc-api/lib/components/ApiPage.js +@@ -73,5 +73,6 @@ function ApiPage(_ref) { + }) + }); + } ++Object.defineProperty(ApiPage, 'length', { writable: true, value: ApiPage.length }); + module.exports = ApiPage; + //# sourceMappingURL=ApiPage.js.map -- 2.51.2