first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

28
node_modules/expo/scripts/autolinking.rb generated vendored Normal file
View File

@@ -0,0 +1,28 @@
require 'json'
require 'pathname'
require 'colored2' # dependency of CocoaPods
require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json', { paths: ['#{__dir__}'] })"`), "scripts/ios/autolinking_manager")
require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json', { paths: ['#{__dir__}'] })"`), "scripts/ios/xcode_env_generator")
def use_expo_modules!(options = {})
# When run from the Podfile, `self` points to Pod::Podfile object
if @current_target_definition.autolinking_manager.present?
Pod::UI.message 'Expo modules are already being used in this target definition'.red
return
end
@current_target_definition.autolinking_manager = Expo::AutolinkingManager.new(self, @current_target_definition, options).use_expo_modules!
maybe_generate_xcode_env_file!()
generate_or_remove_xcode_env_updates_file!()
end
def use_expo_modules_tests!(options = {})
use_expo_modules!({ testsOnly: true }.merge(options))
end
def expo_patch_react_imports!(installer, options = {})
# no-op for backward compatibility in case people still have expo_patch_react_imports! in their Podfile
end

62
node_modules/expo/scripts/compose-source-maps.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env node
/**
* Copyright © 2023 650 Industries.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* Forked as-is from React Native.
* @format
*/
'use strict';
const { composeSourceMaps } = require('@expo/metro/metro-source-map');
const fs = require('fs');
const argv = process.argv.slice(2);
let outputPath;
for (let i = 0; i < argv.length; ) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
continue;
}
++i;
}
if (!argv.length) {
process.stderr.write(
'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n'
);
process.exitCode = -1;
} else {
const [packagerSourcemapPath, compilerSourcemapPath] = argv.splice(0, 2);
const packagerSourcemap = JSON.parse(fs.readFileSync(packagerSourcemapPath, 'utf8'));
const compilerSourcemap = JSON.parse(fs.readFileSync(compilerSourcemapPath, 'utf8'));
if (
packagerSourcemap.x_facebook_offsets != null ||
compilerSourcemap.x_facebook_offsets != null
) {
throw new Error(
'Random Access Bundle (RAM) format is not supported by this tool; ' +
'it cannot process the `x_facebook_offsets` field provided ' +
'in the base and/or target source map(s)'
);
}
if (compilerSourcemap.x_facebook_segments != null) {
throw new Error(
'This tool cannot process the `x_facebook_segments` field provided ' +
'in the target source map.'
);
}
const composedMapJSON = JSON.stringify(composeSourceMaps([packagerSourcemap, compilerSourcemap]));
if (outputPath) {
fs.writeFileSync(outputPath, composedMapJSON, 'utf8');
} else {
process.stdout.write();
}
}

19
node_modules/expo/scripts/node-binary.sh generated vendored Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright © 2023 650 Industries.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
[ -z "$NODE_BINARY" ] && export NODE_BINARY="node"
nodejs_not_found()
{
echo "error: Can't find the '$NODE_BINARY' binary to build the React Native bundle. " \
"If you have a non-standard Node.js installation, select your project in Xcode, find " \
"'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an " \
"absolute path to your node executable. You can find it by invoking 'which node' in the terminal." >&2
exit 2
}
type "$NODE_BINARY" >/dev/null 2>&1 || nodejs_not_found

194
node_modules/expo/scripts/react-native-xcode.sh generated vendored Normal file
View File

@@ -0,0 +1,194 @@
#!/bin/bash
# Copyright © 2023 650 Industries.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Bundle React Native app's code and image assets.
# This script is supposed to be invoked as part of Xcode build process
# and relies on environment variables (including PWD) set by Xcode
# Print commands before executing them (useful for troubleshooting)
set -x
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
# Enables iOS devices to get the IP address of the machine running Metro
if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
for num in 0 1 2 3 4 5 6 7 8; do
IP=$(ipconfig getifaddr en${num})
if [ ! -z "$IP" ]; then
break
fi
done
if [ -z "$IP" ]; then
IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |cut -d\ -f2 | awk 'NR==1{print $1}')
fi
echo "$IP" > "$DEST/ip.txt"
fi
if [[ "$SKIP_BUNDLING" ]]; then
echo "SKIP_BUNDLING enabled; skipping."
exit 0;
fi
case "$CONFIGURATION" in
*Debug*)
if [[ "$PLATFORM_NAME" == *simulator ]]; then
if [[ "$FORCE_BUNDLING" ]]; then
echo "FORCE_BUNDLING enabled; continuing to bundle."
else
echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior."
exit 0;
fi
else
echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior."
fi
DEV=true
;;
"")
echo "$0 must be invoked by Xcode"
exit 1
;;
*)
DEV=false
;;
esac
# Path to react-native folder inside node_modules
REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# The project should be located next to where react-native is installed
# in node_modules.
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."}
cd "$PROJECT_ROOT" || exit
# Define entry file
if [[ "$ENTRY_FILE" ]]; then
# Use ENTRY_FILE defined by user
:
elif [[ -s "index.ios.js" ]]; then
ENTRY_FILE=${1:-index.ios.js}
else
ENTRY_FILE=${1:-index.js}
fi
# check and assign NODE_BINARY env
# shellcheck source=/dev/null
source "$REACT_NATIVE_DIR/scripts/node-binary.sh"
# If hermes-engine is in the Podfile.lock, it means that Hermes is a dependency of the project
# and it is enabled. If not, it means that hermes is disabled.
HERMES_ENABLED=$(grep hermes-engine $PODS_PODFILE_DIR_PATH/Podfile.lock)
# If hermes-engine is not in the Podfile.lock, it means that the app is not using Hermes.
# Setting USE_HERMES is no the only way to set whether the app can use hermes or not: users
# can also modify manually the Podfile.
if [[ -z "$HERMES_ENABLED" ]]; then
USE_HERMES=false
fi
HERMES_ENGINE_PATH="$PODS_ROOT/hermes-engine"
[ -z "$HERMES_CLI_PATH" ] && HERMES_CLI_PATH="$HERMES_ENGINE_PATH/destroot/bin/hermesc"
# Hermes is enabled in new projects by default, so we cannot assume that USE_HERMES=1 is set as an envvar.
# If hermes-engine is found in Pods, we can assume Hermes has not been disabled.
# If hermesc is not available and USE_HERMES is either unset or true, show error.
if [[ ! -z "$HERMES_ENABLED" && -f "$HERMES_ENGINE_PATH" && ! -f "$HERMES_CLI_PATH" ]]; then
echo "error: Hermes is enabled but the hermesc binary could not be found at ${HERMES_CLI_PATH}." \
"Perhaps you need to run 'bundle exec pod install' or otherwise " \
"point the HERMES_CLI_PATH variable to your custom location." >&2
exit 2
fi
[ -z "$NODE_ARGS" ] && export NODE_ARGS=""
[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/bin/cli.js"
[ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle:local"
[ -z "$COMPOSE_SOURCEMAP_PATH" ] && COMPOSE_SOURCEMAP_PATH="$REACT_NATIVE_DIR/scripts/compose-source-maps.js"
if [[ -z "$BUNDLE_CONFIG" ]]; then
CONFIG_ARG=""
else
CONFIG_ARG="--config $BUNDLE_CONFIG"
fi
BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/main.jsbundle"
EXTRA_ARGS=
case "$PLATFORM_NAME" in
"macosx")
BUNDLE_PLATFORM="macos"
;;
*)
BUNDLE_PLATFORM="ios"
;;
esac
if [ "${IS_MACCATALYST}" = "YES" ]; then
BUNDLE_PLATFORM="ios"
fi
EMIT_SOURCEMAP=
if [[ ! -z "$SOURCEMAP_FILE" ]]; then
EMIT_SOURCEMAP=true
fi
PACKAGER_SOURCEMAP_FILE=
if [[ $EMIT_SOURCEMAP == true ]]; then
if [[ $USE_HERMES != false ]]; then
PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename $SOURCEMAP_FILE)"
else
PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE"
fi
EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE"
fi
# Hermes doesn't require JS minification.
if [[ $USE_HERMES != false && $DEV == false ]]; then
EXTRA_ARGS="$EXTRA_ARGS --minify false"
fi
"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \
$CONFIG_ARG \
--entry-file "$ENTRY_FILE" \
--platform "$BUNDLE_PLATFORM" \
--dev $DEV \
--reset-cache \
--bundle-output "$BUNDLE_FILE" \
--assets-dest "$DEST" \
$EXTRA_ARGS \
$EXTRA_PACKAGER_ARGS
if [[ $USE_HERMES == false ]]; then
cp "$BUNDLE_FILE" "$DEST/"
BUNDLE_FILE="$DEST/main.jsbundle"
else
EXTRA_COMPILER_ARGS=
if [[ $DEV == true ]]; then
EXTRA_COMPILER_ARGS=-Og
else
EXTRA_COMPILER_ARGS=-O
fi
if [[ $EMIT_SOURCEMAP == true ]]; then
EXTRA_COMPILER_ARGS="$EXTRA_COMPILER_ARGS -output-source-map"
fi
"$HERMES_CLI_PATH" -emit-binary $EXTRA_COMPILER_ARGS -out "$DEST/main.jsbundle" "$BUNDLE_FILE"
if [[ $EMIT_SOURCEMAP == true ]]; then
HBC_SOURCEMAP_FILE="$DEST/main.jsbundle.map"
"$NODE_BINARY" "$COMPOSE_SOURCEMAP_PATH" "$PACKAGER_SOURCEMAP_FILE" "$HBC_SOURCEMAP_FILE" -o "$SOURCEMAP_FILE"
rm "$HBC_SOURCEMAP_FILE"
rm "$PACKAGER_SOURCEMAP_FILE"
fi
BUNDLE_FILE="$DEST/main.jsbundle"
fi
if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then
echo "error: File $BUNDLE_FILE does not exist. This must be a bug with the xcode template, report it here: https://github.com/expo/expo/issues" >&2
exit 2
fi

44
node_modules/expo/scripts/resolveAppEntry.js generated vendored Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env node
// Basic node CLI script to resolve the native app entry file.
//
// Usage:
// node expo/scripts/resolveAppEntry.js path/to/project-root <platform> <format>
//
// Example:
// node expo/scripts/resolveAppEntry.js path/to/project-root/ android absolute
//
// Returns:
// The resolved entry file path.
//
// Limitations:
// Currently only supports android and ios.
const { resolveEntryPoint, resolveRelativeEntryPoint } = require('@expo/config/paths');
const path = require('path');
const projectRoot = process.argv[1];
const platform = process.argv[2];
const absolute = process.argv[3] === 'absolute';
if (!platform || !projectRoot) {
console.error(
'Usage: node expo/scripts/resolveAppEntry.js <projectRoot> <platform> <relative|absolute>'
);
process.exit(1);
}
const entry = absolute
? resolveEntryPoint(projectRoot, { platform })
: resolveRelativeEntryPoint(projectRoot, { platform });
if (!entry) {
console.error(`Error: Could not find entry file for project at: ${projectRoot}`);
process.exit(1);
} else {
// Prevent any logs from the app.config.js
// from being used in the output of this command.
console.clear();
console.log(absolute ? path.resolve(entry) : entry);
}

47
node_modules/expo/scripts/xcode/with-environment.sh generated vendored Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This script is used to source in Xcode the environment settings required to run properly.
# The script first sources the base `.xcode.env` file.
# Then it sources the `.xcode.env.local` file if present, to override some local config
# Finally, it will execute the command passed i input if any.
#
# USAGE:
# ./with-environment.sh command
# Start with a default
NODE_BINARY=$(command -v node)
export NODE_BINARY
# Override the default with the global environment
ENV_PATH="$PODS_ROOT/../.xcode.env"
if [ -f "$ENV_PATH" ]; then
source "$ENV_PATH"
fi
# Override the global with the local environment
LOCAL_ENV_PATH="${ENV_PATH}.local"
if [ -f "$LOCAL_ENV_PATH" ]; then
source "$LOCAL_ENV_PATH"
fi
# Check whether NODE_BINARY has been properly set, otherwise help the users with a meaningful error.
if [ -n "$NODE_BINARY" ]; then
echo "Node found at: ${NODE_BINARY}"
else
echo '[Warning] You need to configure your node path in the `".xcode.env" file` environment. ' \
'You can set it up quickly by running: ' \
'`echo export NODE_BINARY=$(command -v node) > .xcode.env` ' \
'in the ios folder. This is needed by React Native to work correctly. ' \
'We fallback to the DEPRECATED behavior of finding `node`. This will be REMOVED in a future version. ' \
'You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment' >&2
source "${REACT_NATIVE_PATH}/scripts/find-node-for-xcode.sh"
fi
# Execute argument, if present
if [ -n "$1" ]; then
$1
fi