From e16a14dcef79a677c5756f539533b024aaccec40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?=
 <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sat, 8 Mar 2025 18:56:53 +0900
Subject: [PATCH] =?UTF-8?q?fix(deps):=20pnpm=20v10=E3=81=A7re2=E3=81=AE?=
 =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB=E3=81=AB?=
 =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=81=8C?=
 =?UTF-8?q?=E3=81=82=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?=
 =?UTF-8?q?=20(#15627)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix(deps): pnpm v10でre2のインストールに失敗することがある問題を修正

* fix

* fix docker build

* fix build failure on Windows
---
 .npmrc                               |  1 +
 package.json                         |  3 +++
 pnpm-lock.yaml                       |  9 +++++++--
 scripts/dependency-patches/re2.patch | 13 +++++++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 scripts/dependency-patches/re2.patch

diff --git a/.npmrc b/.npmrc
index 16216a4a21..daebfd5218 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1,2 +1,3 @@
 engine-strict = true
 save-exact = true
+shell-emulator = true
diff --git a/package.json b/package.json
index ed79df9df7..4c40d14f40 100644
--- a/package.json
+++ b/package.json
@@ -82,6 +82,9 @@
 	"pnpm": {
 		"overrides": {
 			"@aiscript-dev/aiscript-languageserver": "-"
+		},
+		"patchedDependencies": {
+			"re2": "scripts/dependency-patches/re2.patch"
 		}
 	}
 }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fab9f7b644..4d11b5ac49 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -9,6 +9,11 @@ overrides:
   lodash: 4.17.21
   '@aiscript-dev/aiscript-languageserver': '-'
 
+patchedDependencies:
+  re2:
+    hash: 018babd22b7ce951bcd10d6246f1e541a7ac7ba212f7fa8985e774ece67d08e1
+    path: scripts/dependency-patches/re2.patch
+
 importers:
 
   .:
@@ -371,7 +376,7 @@ importers:
         version: 3.4.1
       re2:
         specifier: 1.21.4
-        version: 1.21.4
+        version: 1.21.4(patch_hash=018babd22b7ce951bcd10d6246f1e541a7ac7ba212f7fa8985e774ece67d08e1)
       redis-lock:
         specifier: 0.1.4
         version: 0.1.4
@@ -20379,7 +20384,7 @@ snapshots:
     dependencies:
       setimmediate: 1.0.5
 
-  re2@1.21.4:
+  re2@1.21.4(patch_hash=018babd22b7ce951bcd10d6246f1e541a7ac7ba212f7fa8985e774ece67d08e1):
     dependencies:
       install-artifact-from-github: 1.3.5
       nan: 2.20.0
diff --git a/scripts/dependency-patches/re2.patch b/scripts/dependency-patches/re2.patch
new file mode 100644
index 0000000000..3e7ec9f56f
--- /dev/null
+++ b/scripts/dependency-patches/re2.patch
@@ -0,0 +1,13 @@
+diff --git a/package.json b/package.json
+index a56ab59ef647288ee6028abd2b1780eaa92ebc9d..ec2c43e63f3134b6d54d616b2ef715447f873bbe 100644
+--- a/package.json
++++ b/package.json
+@@ -28,7 +28,7 @@
+     "test": "node tests/tests.js",
+     "ts-test": "tsc",
+     "save-to-github": "save-to-github-cache --artifact build/Release/re2.node",
+-    "install": "install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || node-gyp -j max rebuild",
++    "install": "npm_package_github=https://github.com/uhop/node-re2 npm_package_scripts_verify_build=true install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || node-gyp -j max rebuild",
+     "verify-build": "node scripts/verify-build.js",
+     "build:dev": "node-gyp -j max build --debug",
+     "build": "node-gyp -j max build",