From 21b575c0cf45de1132817925447dc69aa57e165f Mon Sep 17 00:00:00 2001 From: Tatsunori Uchino Date: Sun, 20 Oct 2024 08:11:24 +0900 Subject: [PATCH] Patch `react-dom` and suppress NUL in non-English docs --- package.json | 5 + patches/react-dom@18.3.1.patch | 26 +++ pnpm-lock.yaml | 281 +++++++++++++++++---------------- 3 files changed, 174 insertions(+), 138 deletions(-) create mode 100644 patches/react-dom@18.3.1.patch diff --git a/package.json b/package.json index 7e6860112782..f7c7208b1fdd 100644 --- a/package.json +++ b/package.json @@ -40,5 +40,10 @@ "@types/node": "^20.12.2", "shx": "^0.3.4", "ts-node": "10.9.2" + }, + "pnpm": { + "patchedDependencies": { + "react-dom@18.3.1": "patches/react-dom@18.3.1.patch" + } } } diff --git a/patches/react-dom@18.3.1.patch b/patches/react-dom@18.3.1.patch new file mode 100644 index 000000000000..ca51dd8d6614 --- /dev/null +++ b/patches/react-dom@18.3.1.patch @@ -0,0 +1,26 @@ +diff --git a/cjs/react-dom-server.node.development.js b/cjs/react-dom-server.node.development.js +index de58cde782d8aa60f61062613cb9210c56137d3b..8671f5e542213990892e5f92404473deef3068e7 100644 +--- a/cjs/react-dom-server.node.development.js ++++ b/cjs/react-dom-server.node.development.js +@@ -126,7 +126,7 @@ function writeStringChunk(destination, stringChunk) { + writtenBytes += written; + + if (read < stringChunk.length) { +- writeToDestination(destination, currentView); ++ writeToDestination(destination, currentView.subarray(0, writtenBytes)); + currentView = new Uint8Array(VIEW_SIZE); + writtenBytes = textEncoder.encodeInto(stringChunk.slice(read), currentView).written; + } +diff --git a/cjs/react-dom-server.node.production.min.js b/cjs/react-dom-server.node.production.min.js +index 9cc6d69a5038580440f939beaf159d09bf6c98e7..412a837868dc3425362fe5ad4ceabeddc048f452 100644 +--- a/cjs/react-dom-server.node.production.min.js ++++ b/cjs/react-dom-server.node.production.min.js +@@ -8,7 +8,7 @@ + * LICENSE file in the root directory of this source tree. + */ + 'use strict';var aa=require("util"),ba=require("react"),k=null,l=0,q=!0; +-function r(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0