chore(NA): remove usage of re2 and replace it with a non native module (#188134)

This PR removes the usage of the native module version of `re2` and
replaces it with a js port called `re2js`.
It also ends our usage of native node modules in production and it
removes the task from the build as well. Further steps will be taken
along our strategy to avoid future usages of native node modules in prod
environments.
This commit is contained in:
Tiago Costa 2024-07-15 20:33:28 +01:00 committed by GitHub
parent b3dcc542fa
commit 3c338a82c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 26 additions and 391 deletions

View file

@ -1,39 +0,0 @@
#!/usr/bin/env bash
args=("$@")
re2_version=${args[0]}
if [ -z "$re2_version" ]; then
echo "Usage: ./download_re2.sh [re2_version]"
exit 1
fi
archs=(
"darwin-arm64"
"darwin-x64"
"linux-musl-x64"
"linux-x64"
"win32-x64"
)
node_api_versions=( 108 115 )
formats=( "br" "gz" )
echo "Downloading builds of re2 version ${re2_version} to /tmp/re2"
mkdir /tmp/re2
for node_api_version in "${node_api_versions[@]}"; do
echo " Node.js API version ${node_api_version}"
for arch in "${archs[@]}"; do
for format in "${formats[@]}"; do
url="https://github.com/uhop/node-re2/releases/download/${re2_version}/${arch}-${node_api_version}.${format}"
echo " ${url}"
(cd /tmp/re2 && curl -s -L -O "${url}")
done
done
done
echo
echo "Calculating shasums for downloaded artifacts..."
echo
shasum -a 256 /tmp/re2/*