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

22
node_modules/@expo/package-manager/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

41
node_modules/@expo/package-manager/README.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
<!-- Title -->
<h1 align="center">
👋 Welcome to <br><code>@expo/package-manager</code>
</h1>
<p align="center">A library for installing and finding packages in a project.</p>
<!-- Header -->
<p align="center">
<img src="https://flat.badgen.net/packagephobia/install/@expo/package-manager">
<a href="https://www.npmjs.com/package/@expo/package-manager">
<img src="https://flat.badgen.net/npm/dw/@expo/package-manager" target="_blank" />
</a>
</p>
---
<!-- Body -->
## 🏁 Setup
Install `@expo/package-manager` in your project.
```sh
yarn add @expo/package-manager
```
## ⚽️ Usage
```ts
import * as PackageManager from '@expo/package-manager';
const manager = PackageManager.createForProject(projectRoot);
await Promise.all([
manager.addDevAsync(['@expo/webpack-config']),
manager.addAsync(['expo', 'expo-camera']),
]);
```

View File

@@ -0,0 +1,48 @@
import { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/spawn-async';
import { PendingSpawnPromise } from './utils/spawn';
export interface PackageManagerOptions extends SpawnOptions {
/**
* If the package manager should run in silent mode.
* Note, this will hide possible error output from executed commands.
* When running in silent mode, make sure you handle them properly.
*/
silent?: boolean;
/**
* The logging method used to communicate the command which is executed.
* Without `silent`, this defaults to `console.log`.
* When `silent` is set to `true`, this defaults to a no-op.
*/
log?: (...args: any[]) => void;
}
export interface PackageManager {
/** The options for this package manager */
readonly options: PackageManagerOptions;
/** Run any command using the package manager */
runAsync(command: string[], options?: SpawnOptions): SpawnPromise<SpawnResult>;
/** Invoke a binary from within a package, like "eslint" or "jest" */
runBinAsync(command: string[], options?: SpawnOptions): SpawnPromise<SpawnResult>;
/** Get the version of the used package manager */
versionAsync(): Promise<string>;
/** Get a single configuration property from the package manager */
getConfigAsync(key: string): Promise<string>;
/** Remove the lock file within the project, if any */
removeLockfileAsync(): Promise<void>;
/** Get the workspace root package manager, if this project is within a workspace/monorepo */
workspaceRoot(): PackageManager | null;
/** Install all current dependencies using the package manager */
installAsync(): Promise<SpawnResult> | SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Uninstall all current dependencies by removing the folder containing the packages */
uninstallAsync(): Promise<void>;
/** Add a normal dependency to the project */
addAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Add a development dependency to the project */
addDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Add a global dependency to the environment */
addGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Remove a normal dependency from the project */
removeAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Remove a development dependency from the project */
removeDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
/** Remove a global dependency from the environments */
removeGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=PackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PackageManager.js","sourceRoot":"","sources":["../src/PackageManager.ts"],"names":[],"mappings":""}

8
node_modules/@expo/package-manager/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export * from './PackageManager';
export * from './ios/CocoaPodsPackageManager';
export * from './node/NpmPackageManager';
export * from './node/PnpmPackageManager';
export * from './node/YarnPackageManager';
export * from './node/BunPackageManager';
export * from './utils/nodeManagers';
export { isYarnOfflineAsync } from './utils/yarn';

27
node_modules/@expo/package-manager/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isYarnOfflineAsync = void 0;
__exportStar(require("./PackageManager"), exports);
__exportStar(require("./ios/CocoaPodsPackageManager"), exports);
__exportStar(require("./node/NpmPackageManager"), exports);
__exportStar(require("./node/PnpmPackageManager"), exports);
__exportStar(require("./node/YarnPackageManager"), exports);
__exportStar(require("./node/BunPackageManager"), exports);
__exportStar(require("./utils/nodeManagers"), exports);
var yarn_1 = require("./utils/yarn");
Object.defineProperty(exports, "isYarnOfflineAsync", { enumerable: true, get: function () { return yarn_1.isYarnOfflineAsync; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiC;AAEjC,gEAA8C;AAE9C,2DAAyC;AACzC,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AAEzC,uDAAqC;AACrC,qCAAkD;AAAzC,0GAAA,kBAAkB,OAAA"}

View File

@@ -0,0 +1,74 @@
import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';
import { Ora } from 'ora';
export type CocoaPodsErrorCode = 'NON_INTERACTIVE' | 'NO_CLI' | 'COMMAND_FAILED';
export declare class CocoaPodsError extends Error {
code: CocoaPodsErrorCode;
cause?: Error | undefined;
readonly name = "CocoaPodsError";
readonly isPackageManagerError = true;
constructor(message: string, code: CocoaPodsErrorCode, cause?: Error | undefined);
}
export declare function extractMissingDependencyError(errorOutput: string): [string, string] | null;
export declare class CocoaPodsPackageManager {
options: SpawnOptions;
private silent;
static getPodProjectRoot(projectRoot: string): string | null;
static isUsingPods(projectRoot: string): boolean;
static gemInstallCLIAsync(nonInteractive?: boolean, spawnOptions?: SpawnOptions): Promise<void>;
static brewLinkCLIAsync(spawnOptions?: SpawnOptions): Promise<void>;
static brewInstallCLIAsync(spawnOptions?: SpawnOptions): Promise<void>;
static installCLIAsync({ nonInteractive, spawnOptions, }: {
nonInteractive?: boolean;
spawnOptions?: SpawnOptions;
}): Promise<boolean>;
static isAvailable(projectRoot: string, silent: boolean): boolean;
static isCLIInstalledAsync(spawnOptions?: SpawnOptions): Promise<boolean>;
constructor({ cwd, silent }: {
cwd: string;
silent?: boolean;
});
get name(): string;
/** Runs `pod install` and attempts to automatically run known troubleshooting steps automatically. */
installAsync({ spinner }?: {
spinner?: Ora;
}): Promise<void>;
isCLIInstalledAsync(): Promise<boolean>;
installCLIAsync(): Promise<boolean>;
handleInstallErrorAsync({ error, shouldUpdate, updatedPackages, spinner, }: {
error: any;
spinner?: Ora;
shouldUpdate?: boolean;
updatedPackages?: string[];
}): Promise<spawnAsync.SpawnResult>;
private _installAsync;
private runInstallTypeCommandAsync;
addWithParametersAsync(names: string[], parameters: string[]): Promise<void>;
addAsync(names?: string[]): void;
addDevAsync(names?: string[]): void;
addGlobalAsync(names?: string[]): void;
removeAsync(names?: string[]): void;
removeDevAsync(names?: string[]): void;
removeGlobalAsync(names?: string[]): void;
versionAsync(): Promise<string>;
configAsync(key: string): Promise<string>;
removeLockfileAsync(): Promise<void>;
uninstallAsync(): Promise<void>;
private podRepoUpdateAsync;
_runAsync(args: string[]): Promise<SpawnResult>;
}
export declare function getPodUpdateMessage(output: string): {
updatePackage: string | null;
shouldUpdateRepo: boolean;
};
export declare function getPodRepoUpdateMessage(errorOutput: string): {
updatePackage: string | null;
shouldUpdateRepo: boolean;
message: string;
};
/**
* Format the CocoaPods CLI install error.
*
* @param error Error from CocoaPods CLI `pod install` command.
* @returns
*/
export declare function getImprovedPodInstallError(error: SpawnResult & Error, { cwd }: Pick<SpawnOptions, 'cwd'>): Error;

View File

@@ -0,0 +1,404 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CocoaPodsPackageManager = exports.CocoaPodsError = void 0;
exports.extractMissingDependencyError = extractMissingDependencyError;
exports.getPodUpdateMessage = getPodUpdateMessage;
exports.getPodRepoUpdateMessage = getPodRepoUpdateMessage;
exports.getImprovedPodInstallError = getImprovedPodInstallError;
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("fs");
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
class CocoaPodsError extends Error {
code;
cause;
name = 'CocoaPodsError';
isPackageManagerError = true;
constructor(message, code, cause) {
super(cause ? `${message}\n└─ Cause: ${cause.message}` : message);
this.code = code;
this.cause = cause;
}
}
exports.CocoaPodsError = CocoaPodsError;
function extractMissingDependencyError(errorOutput) {
// [!] Unable to find a specification for `expo-dev-menu-interface` depended upon by `expo-dev-launcher`
const results = errorOutput.match(/Unable to find a specification for ['"`]([\w-_\d\s]+)['"`] depended upon by ['"`]([\w-_\d\s]+)['"`]/);
if (results) {
return [results[1], results[2]];
}
return null;
}
class CocoaPodsPackageManager {
options;
silent;
static getPodProjectRoot(projectRoot) {
if (CocoaPodsPackageManager.isUsingPods(projectRoot))
return projectRoot;
const iosProject = path_1.default.join(projectRoot, 'ios');
if (CocoaPodsPackageManager.isUsingPods(iosProject))
return iosProject;
const macOsProject = path_1.default.join(projectRoot, 'macos');
if (CocoaPodsPackageManager.isUsingPods(macOsProject))
return macOsProject;
return null;
}
static isUsingPods(projectRoot) {
return (0, fs_1.existsSync)(path_1.default.join(projectRoot, 'Podfile'));
}
static async gemInstallCLIAsync(nonInteractive = false, spawnOptions = { stdio: 'inherit' }) {
const options = ['install', 'cocoapods', '--no-document'];
try {
// In case the user has run sudo before running the command we can properly install CocoaPods without prompting for an interaction.
await (0, spawn_async_1.default)('gem', options, spawnOptions);
}
catch (error) {
if (nonInteractive) {
throw new CocoaPodsError('Failed to install CocoaPods CLI with gem (recommended)', 'COMMAND_FAILED', error);
}
// If the user doesn't have permission then we can prompt them to use sudo.
console.log('Your password might be needed to install CocoaPods CLI: https://guides.cocoapods.org/using/getting-started.html#installation');
await (0, spawn_async_1.default)('sudo', ['gem', ...options], spawnOptions);
}
}
static async brewLinkCLIAsync(spawnOptions = { stdio: 'inherit' }) {
await (0, spawn_async_1.default)('brew', ['link', 'cocoapods'], spawnOptions);
}
static async brewInstallCLIAsync(spawnOptions = { stdio: 'inherit' }) {
await (0, spawn_async_1.default)('brew', ['install', 'cocoapods'], spawnOptions);
}
static async installCLIAsync({ nonInteractive = false, spawnOptions = { stdio: 'inherit' }, }) {
if (!spawnOptions) {
spawnOptions = { stdio: 'inherit' };
}
const silent = !!spawnOptions.ignoreStdio;
try {
!silent && console.log(`\u203A Attempting to install CocoaPods CLI with Gem`);
await CocoaPodsPackageManager.gemInstallCLIAsync(nonInteractive, spawnOptions);
!silent && console.log(`\u203A Successfully installed CocoaPods CLI with Gem`);
return true;
}
catch (error) {
if (!silent) {
console.log(chalk_1.default.yellow(`\u203A Failed to install CocoaPods CLI with Gem`));
console.log(chalk_1.default.red(error.stderr ?? error.message));
console.log(`\u203A Attempting to install CocoaPods CLI with Homebrew`);
}
try {
await CocoaPodsPackageManager.brewInstallCLIAsync(spawnOptions);
if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {
try {
await CocoaPodsPackageManager.brewLinkCLIAsync(spawnOptions);
// Still not available after linking? Bail out
if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {
throw new CocoaPodsError('CLI could not be installed automatically with gem or Homebrew, please install CocoaPods manually and try again', 'NO_CLI', error);
}
}
catch (error) {
throw new CocoaPodsError('Homebrew installation appeared to succeed but CocoaPods CLI not found in PATH and unable to link.', 'NO_CLI', error);
}
}
!silent && console.log(`\u203A Successfully installed CocoaPods CLI with Homebrew`);
return true;
}
catch (error) {
!silent &&
console.warn(chalk_1.default.yellow(`\u203A Failed to install CocoaPods with Homebrew. Install CocoaPods CLI and try again: https://cocoapods.org/`));
throw new CocoaPodsError(`Failed to install CocoaPods with Homebrew. Install CocoaPods CLI and try again: https://cocoapods.org/`, 'NO_CLI', error);
}
}
}
static isAvailable(projectRoot, silent) {
if (process.platform !== 'darwin') {
!silent && console.log(chalk_1.default.red('CocoaPods is only supported on macOS machines'));
return false;
}
if (!CocoaPodsPackageManager.isUsingPods(projectRoot)) {
!silent && console.log(chalk_1.default.yellow('CocoaPods is not supported in this project'));
return false;
}
return true;
}
static async isCLIInstalledAsync(spawnOptions = { stdio: 'inherit' }) {
try {
await (0, spawn_async_1.default)('pod', ['--version'], spawnOptions);
return true;
}
catch {
return false;
}
}
constructor({ cwd, silent }) {
this.silent = !!silent;
this.options = {
cwd,
// We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.
// Later we'll also pipe the stdout/stderr to the terminal when silent is false.
stdio: 'pipe',
};
}
get name() {
return 'CocoaPods';
}
/** Runs `pod install` and attempts to automatically run known troubleshooting steps automatically. */
async installAsync({ spinner } = {}) {
await this._installAsync({ spinner });
}
isCLIInstalledAsync() {
return CocoaPodsPackageManager.isCLIInstalledAsync(this.options);
}
installCLIAsync() {
return CocoaPodsPackageManager.installCLIAsync({
nonInteractive: true,
spawnOptions: this.options,
});
}
async handleInstallErrorAsync({ error, shouldUpdate = true, updatedPackages = [], spinner, }) {
// Unknown errors are rethrown.
if (!error.output) {
throw error;
}
// To emulate a `pod install --repo-update` error, enter your `ios/Podfile.lock` and change one of `PODS` version numbers to some lower value.
// const isPodRepoUpdateError = shouldPodRepoUpdate(output);
if (!shouldUpdate) {
// If we can't automatically fix the error, we'll just rethrow it with some known troubleshooting info.
throw getImprovedPodInstallError(error, {
cwd: this.options.cwd,
});
}
// Collect all of the spawn info.
const errorOutput = error.output.join(os_1.default.EOL).trim();
// Extract useful information from the error message and push it to the spinner.
const { updatePackage, shouldUpdateRepo } = getPodUpdateMessage(errorOutput);
if (!updatePackage || updatedPackages.includes(updatePackage)) {
// `pod install --repo-update`...
// Attempt to install again but this time with install --repo-update enabled.
return await this._installAsync({
spinner,
shouldRepoUpdate: true,
// Include a boolean to ensure pod install --repo-update isn't invoked in the unlikely case where the pods fail to update.
shouldUpdate: false,
updatedPackages,
});
}
// Store the package we should update to prevent a loop.
updatedPackages.push(updatePackage);
// If a single package is broken, we'll try to update it.
// You can manually test this by changing a version number in your `Podfile.lock`.
// Attempt `pod update <package> <--no-repo-update>` and then try again.
return await this.runInstallTypeCommandAsync(['update', updatePackage, shouldUpdateRepo ? '' : '--no-repo-update'].filter(Boolean), {
formatWarning() {
const updateMessage = `Failed to update ${chalk_1.default.bold(updatePackage)}. Attempting to update the repo instead.`;
return updateMessage;
},
spinner,
updatedPackages,
});
// // If update succeeds, we'll try to install again (skipping `pod install --repo-update`).
// return await this._installAsync({
// spinner,
// shouldUpdate: false,
// updatedPackages,
// });
}
async _installAsync({ shouldRepoUpdate, ...props } = {}) {
return await this.runInstallTypeCommandAsync(['install', shouldRepoUpdate ? '--repo-update' : ''].filter(Boolean), {
formatWarning(error) {
// Extract useful information from the error message and push it to the spinner.
return getPodRepoUpdateMessage(error.output.join(os_1.default.EOL).trim()).message;
},
...props,
});
}
async runInstallTypeCommandAsync(command, { formatWarning, ...props } = {}) {
try {
return await this._runAsync(command);
}
catch (error) {
if (formatWarning) {
const warning = formatWarning(error);
if (props.spinner) {
props.spinner.text = chalk_1.default.bold(warning);
}
if (!this.silent) {
console.warn(chalk_1.default.yellow(warning));
}
}
return await this.handleInstallErrorAsync({ error, ...props });
}
}
async addWithParametersAsync(names, parameters) {
throw new Error('Unimplemented');
}
addAsync(names = []) {
throw new Error('Unimplemented');
}
addDevAsync(names = []) {
throw new Error('Unimplemented');
}
addGlobalAsync(names = []) {
throw new Error('Unimplemented');
}
removeAsync(names = []) {
throw new Error('Unimplemented');
}
removeDevAsync(names = []) {
throw new Error('Unimplemented');
}
removeGlobalAsync(names = []) {
throw new Error('Unimplemented');
}
async versionAsync() {
const { stdout } = await (0, spawn_async_1.default)('pod', ['--version'], this.options);
return stdout.trim();
}
async configAsync(key) {
throw new Error('Unimplemented');
}
async removeLockfileAsync() {
throw new Error('Unimplemented');
}
async uninstallAsync() {
throw new Error('Unimplemented');
}
// Private
async podRepoUpdateAsync() {
try {
await this._runAsync(['repo', 'update']);
}
catch (error) {
error.message = error.message || (error.stderr ?? error.stdout);
throw new CocoaPodsError('The command `pod install --repo-update` failed', 'COMMAND_FAILED', error);
}
}
// Exposed for testing
async _runAsync(args) {
if (!this.silent) {
console.log(`> pod ${args.join(' ')}`);
}
const promise = (0, spawn_async_1.default)('pod', [
...args,
// Enables colors while collecting output.
'--ansi',
], {
// Add the cwd and other options to the spawn options.
...this.options,
// We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.
// This is particularly required for the `pod install --repo-update` error.
// Later we'll also pipe the stdout/stderr to the terminal when silent is false,
// currently this means we lose out on the ansi colors unless passing the `--ansi` flag to every command.
stdio: 'pipe',
});
if (!this.silent) {
// If not silent, pipe the stdout/stderr to the terminal.
// We only do this when the `stdio` is set to `pipe` (collect the results for parsing), `inherit` won't contain `promise.child`.
if (promise.child.stdout) {
promise.child.stdout.pipe(process.stdout);
}
}
return await promise;
}
}
exports.CocoaPodsPackageManager = CocoaPodsPackageManager;
/** When pods are outdated, they'll throw an error informing you to run "pod install --repo-update" */
function shouldPodRepoUpdate(errorOutput) {
const output = errorOutput;
const isPodRepoUpdateError = output.includes('pod repo update') || output.includes('--no-repo-update');
return isPodRepoUpdateError;
}
function getPodUpdateMessage(output) {
const props = output.match(/run ['"`]pod update ([\w-_\d/]+)( --no-repo-update)?['"`] to apply changes/);
return {
updatePackage: props?.[1] ?? null,
shouldUpdateRepo: !props?.[2],
};
}
function getPodRepoUpdateMessage(errorOutput) {
const warningInfo = extractMissingDependencyError(errorOutput);
const brokenPackage = getPodUpdateMessage(errorOutput);
let message;
if (warningInfo) {
message = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}.`;
}
else if (brokenPackage?.updatePackage) {
message = `Couldn't install: ${brokenPackage?.updatePackage}.`;
}
else {
message = `Couldn't install Pods.`;
}
message += ` Updating the Pods project and trying again...`;
return { message, ...brokenPackage };
}
/**
* Format the CocoaPods CLI install error.
*
* @param error Error from CocoaPods CLI `pod install` command.
* @returns
*/
function getImprovedPodInstallError(error, { cwd = process.cwd() }) {
// Collect all of the spawn info.
const errorOutput = error.output.join(os_1.default.EOL).trim();
if (error.stdout.match(/No [`'"]Podfile[`'"] found in the project directory/)) {
// Ran pod install but no Podfile was found.
error.message = `No Podfile found in directory: ${cwd}. Ensure CocoaPods is setup any try again.`;
}
else if (shouldPodRepoUpdate(errorOutput)) {
// Ran pod install but the install --repo-update step failed.
const warningInfo = extractMissingDependencyError(errorOutput);
let reason;
if (warningInfo) {
reason = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}`;
}
else {
reason = `This is often due to native package versions mismatching`;
}
// Attempt to provide a helpful message about the missing NPM dependency (containing a CocoaPod) since React Native
// developers will almost always be using autolinking and not interacting with CocoaPods directly.
let solution;
if (warningInfo?.[0]) {
// If the missing package is named `expo-dev-menu`, `react-native`, etc. then it might not be installed in the project.
if (warningInfo[0].match(/^(?:@?expo|@?react)(-|\/)/)) {
solution = `Ensure the node module "${warningInfo[0]}" is installed in your project, then run 'npx pod-install' to try again.`;
}
else {
solution = `Ensure the CocoaPod "${warningInfo[0]}" is installed in your project, then run 'npx pod-install' to try again.`;
}
}
else {
// Brute force
solution = `Try deleting the 'ios/Pods' folder or the 'ios/Podfile.lock' file and running 'npx pod-install' to resolve.`;
}
error.message = `${reason}. ${solution}`;
// Attempt to provide the troubleshooting info from CocoaPods CLI at the bottom of the error message.
if (error.stdout) {
const cocoapodsDebugInfo = error.stdout.split(os_1.default.EOL);
// The troubleshooting info starts with `[!]`, capture everything after that.
const firstWarning = cocoapodsDebugInfo.findIndex((v) => v.startsWith('[!]'));
if (firstWarning !== -1) {
const warning = cocoapodsDebugInfo.slice(firstWarning).join(os_1.default.EOL);
error.message += `\n\n${chalk_1.default.gray(warning)}`;
}
}
return new CocoaPodsError('Command `pod install --repo-update` failed.', 'COMMAND_FAILED', error);
}
else {
let stderr = error.stderr.trim();
// CocoaPods CLI prints the useful error to stdout...
const usefulError = error.stdout.match(/\[!\]\s((?:.|\n)*)/)?.[1];
// If there is a useful error message then prune the less useful info.
if (usefulError) {
// Delete unhelpful CocoaPods CLI error message.
if (error.message?.match(/pod exited with non-zero code: 1/)) {
error.message = '';
}
stderr = null;
}
error.message = [usefulError, error.message, stderr].filter(Boolean).join('\n');
}
return new CocoaPodsError('Command `pod install` failed.', 'COMMAND_FAILED', error);
}
//# sourceMappingURL=CocoaPodsPackageManager.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
import spawnAsync, { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/spawn-async';
import { PackageManager, PackageManagerOptions } from '../PackageManager';
import { PendingSpawnPromise } from '../utils/spawn';
export declare abstract class BasePackageManager implements PackageManager {
readonly silent: boolean;
readonly log?: (...args: any) => void;
readonly options: PackageManagerOptions;
constructor({ silent, log, env, ...options }?: PackageManagerOptions);
/** Get the name of the package manager */
abstract readonly name: string;
/** Get the executable binary of the package manager */
abstract readonly bin: string;
/** Get the lockfile for this package manager */
abstract readonly lockFile: string;
/** Get the default environment variables used when running the package manager. */
protected getDefaultEnvironment(): Record<string, string>;
abstract addAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract addDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract addGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract removeAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract removeDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract removeGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
abstract workspaceRoot(): PackageManager | null;
/** Ensure the CWD is set to a non-empty string */
protected ensureCwdDefined(method?: string): string;
runAsync(command: string[], options?: SpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
runBinAsync(command: string[], options?: SpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
versionAsync(): Promise<string>;
getConfigAsync(key: string): Promise<string>;
removeLockfileAsync(): Promise<void>;
installAsync(flags?: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
uninstallAsync(): Promise<void>;
}

View File

@@ -0,0 +1,70 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasePackageManager = void 0;
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
const assert_1 = __importDefault(require("assert"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
class BasePackageManager {
silent;
log;
options;
constructor({ silent, log, env = process.env, ...options } = {}) {
this.silent = !!silent;
this.log = log ?? (!silent ? console.log : undefined);
this.options = {
stdio: silent ? undefined : 'inherit',
...options,
env: { ...this.getDefaultEnvironment(), ...env },
};
}
/** Get the default environment variables used when running the package manager. */
getDefaultEnvironment() {
return {
ADBLOCK: '1',
DISABLE_OPENCOLLECTIVE: '1',
};
}
/** Ensure the CWD is set to a non-empty string */
ensureCwdDefined(method) {
const cwd = this.options.cwd?.toString();
const className = this.constructor.name;
const methodName = method ? `.${method}` : '';
(0, assert_1.default)(cwd, `cwd is required for ${className}${methodName}`);
return cwd;
}
runAsync(command, options = {}) {
this.log?.(`> ${this.name} ${command.join(' ')}`);
return (0, spawn_async_1.default)(this.bin, command, { ...this.options, ...options });
}
runBinAsync(command, options = {}) {
this.log?.(`> ${this.name} ${command.join(' ')}`);
return (0, spawn_async_1.default)(this.bin, command, { ...this.options, ...options });
}
async versionAsync() {
const { stdout } = await this.runAsync(['--version'], { stdio: undefined });
return stdout.trim();
}
async getConfigAsync(key) {
const { stdout } = await this.runAsync(['config', 'get', key]);
return stdout.trim();
}
async removeLockfileAsync() {
const cwd = this.ensureCwdDefined('removeLockFile');
const filePath = path_1.default.join(cwd, this.lockFile);
await fs_1.default.promises.rm(filePath, { force: true });
}
installAsync(flags = []) {
return this.runAsync(['install', ...flags]);
}
async uninstallAsync() {
const cwd = this.ensureCwdDefined('uninstallAsync');
const modulesPath = path_1.default.join(cwd, 'node_modules');
await fs_1.default.promises.rm(modulesPath, { force: true, recursive: true });
}
}
exports.BasePackageManager = BasePackageManager;
//# sourceMappingURL=BasePackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BasePackageManager.js","sourceRoot":"","sources":["../../src/node/BasePackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAwF;AACxF,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AAKxB,MAAsB,kBAAkB;IAC7B,MAAM,CAAU;IAChB,GAAG,CAA0B;IAC7B,OAAO,CAAwB;IAExC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,KAA4B,EAAE;QACpF,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG;YACb,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACrC,GAAG,OAAO;YACV,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,GAAG,EAAE;SACjD,CAAC;IACJ,CAAC;IASD,mFAAmF;IACzE,qBAAqB;QAC7B,OAAO;YACL,OAAO,EAAE,GAAG;YACZ,sBAAsB,EAAE,GAAG;SAC5B,CAAC;IACJ,CAAC;IAwBD,kDAAkD;IACxC,gBAAgB,CAAC,MAAe;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC;QACzC,MAAM,SAAS,GAAI,IAAI,CAAC,WAAyC,CAAC,IAAI,CAAC;QACvE,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C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C,gBAAgB,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,YAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,YAAY,CAAC,QAAkB,EAAE;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACnD,MAAM,YAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;CACF;AAhGD,gDAgGC"}

View File

@@ -0,0 +1,14 @@
import { BasePackageManager } from './BasePackageManager';
export declare class BunPackageManager extends BasePackageManager {
readonly name = "bun";
readonly bin = "bun";
get lockFile(): "bun.lockb" | "bun.lock";
workspaceRoot(): BunPackageManager | null;
installAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addDevAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addGlobalAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeDevAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeGlobalAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
}

View File

@@ -0,0 +1,62 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BunPackageManager = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const BasePackageManager_1 = require("./BasePackageManager");
const nodeManagers_1 = require("../utils/nodeManagers");
class BunPackageManager extends BasePackageManager_1.BasePackageManager {
name = 'bun';
bin = 'bun';
get lockFile() {
const cwd = this.options.cwd?.toString() || process.cwd();
return fs_1.default.existsSync(path_1.default.join(cwd, nodeManagers_1.BUN_LOCK_FILE)) ? nodeManagers_1.BUN_LOCK_FILE : nodeManagers_1.BUN_TEXT_LOCK_FILE;
}
workspaceRoot() {
const root = (0, nodeManagers_1.resolveWorkspaceRoot)(this.ensureCwdDefined('workspaceRoot'));
if (root) {
return new BunPackageManager({
...this.options,
silent: this.silent,
log: this.log,
cwd: root,
});
}
return null;
}
installAsync(namesOrFlags = []) {
return this.runAsync(['install', ...namesOrFlags]);
}
addAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', ...namesOrFlags]);
}
addDevAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', '--dev', ...namesOrFlags]);
}
addGlobalAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', '--global', ...namesOrFlags]);
}
removeAsync(namesOrFlags) {
return this.runAsync(['remove', ...namesOrFlags]);
}
removeDevAsync(namesOrFlags) {
return this.runAsync(['remove', ...namesOrFlags]);
}
removeGlobalAsync(namesOrFlags) {
return this.runAsync(['remove', '--global', ...namesOrFlags]);
}
}
exports.BunPackageManager = BunPackageManager;
//# sourceMappingURL=BunPackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BunPackageManager.js","sourceRoot":"","sources":["../../src/node/BunPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,6DAA0D;AAC1D,wDAAgG;AAEhG,MAAa,iBAAkB,SAAQ,uCAAkB;IAC9C,IAAI,GAAG,KAAK,CAAC;IACb,GAAG,GAAG,KAAK,CAAC;IACrB,IAAI,QAAQ;QACV,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1D,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,4BAAa,CAAC,CAAC,CAAC,CAAC,CAAC,4BAAa,CAAC,CAAC,CAAC,iCAAkB,CAAC;IAC3F,CAAC;IAED,aAAa;QACX,MAAM,IAAI,GAAG,IAAA,mCAAoB,EAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,IAAI,iBAAiB,CAAC;gBAC3B,GAAG,IAAI,CAAC,OAAO;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,GAAG,EAAE,IAAI;aACV,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,eAAyB,EAAE;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,CAAC,eAAyB,EAAE;QAClC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,WAAW,CAAC,eAAyB,EAAE;QACrC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,cAAc,CAAC,eAAyB,EAAE;QACxC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,WAAW,CAAC,YAAsB;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,cAAc,CAAC,YAAsB;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,iBAAiB,CAAC,YAAsB;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAChE,CAAC;CACF;AA7DD,8CA6DC"}

View File

@@ -0,0 +1,28 @@
import spawnAsync, { SpawnOptions } from '@expo/spawn-async';
import { BasePackageManager } from './BasePackageManager';
export declare class NpmPackageManager extends BasePackageManager {
readonly name = "npm";
readonly bin = "npm";
readonly lockFile = "package-lock.json";
workspaceRoot(): NpmPackageManager | null;
addAsync(namesOrFlags?: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult> | import("../utils/spawn").PendingSpawnPromise<spawnAsync.SpawnResult>;
addDevAsync(namesOrFlags?: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult> | import("../utils/spawn").PendingSpawnPromise<spawnAsync.SpawnResult>;
addGlobalAsync(namesOrFlags?: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult> | import("../utils/spawn").PendingSpawnPromise<spawnAsync.SpawnResult>;
removeAsync(namesOrFlags: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
removeDevAsync(namesOrFlags: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
removeGlobalAsync(namesOrFlags: string[]): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
runBinAsync(command: string[], options?: SpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
/**
* Parse all package specifications from the names or flag list.
* The result from this method can be used for `.updatePackageFileAsync`.
*/
private parsePackageSpecs;
/** Sort dependencies by keys (case-insensitive, stable). Sorting algorithm is taken from https://github.com/npm/package-json/blob/f5db81bdfbba5e9d3bfc0732f8bfe511825a20aa/lib/update-dependencies.js#L9 */
private orderDependencies;
/**
* Older npm versions have issues with mismatched nested dependencies when adding exact versions.
* This propagates as issues like mismatched `@expo/config-pugins` versions.
* As a workaround, we update the `package.json` directly and run `npm install`.
*/
private updatePackageFileAsync;
}

View File

@@ -0,0 +1,132 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NpmPackageManager = void 0;
const json_file_1 = __importDefault(require("@expo/json-file"));
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
const path_1 = __importDefault(require("path"));
const BasePackageManager_1 = require("./BasePackageManager");
const nodeManagers_1 = require("../utils/nodeManagers");
const spawn_1 = require("../utils/spawn");
class NpmPackageManager extends BasePackageManager_1.BasePackageManager {
name = 'npm';
bin = 'npm';
lockFile = nodeManagers_1.NPM_LOCK_FILE;
workspaceRoot() {
const root = (0, nodeManagers_1.resolveWorkspaceRoot)(this.ensureCwdDefined('workspaceRoot'));
if (root) {
return new NpmPackageManager({
...this.options,
silent: this.silent,
log: this.log,
cwd: root,
});
}
return null;
}
addAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
const { flags, versioned, unversioned } = this.parsePackageSpecs(namesOrFlags);
return (0, spawn_1.createPendingSpawnAsync)(() => this.updatePackageFileAsync(versioned, 'dependencies'), () => !unversioned.length
? this.runAsync(['install', ...flags])
: this.runAsync(['install', '--save', ...flags, ...unversioned.map((spec) => spec.raw)]));
}
addDevAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
const { flags, versioned, unversioned } = this.parsePackageSpecs(namesOrFlags);
return (0, spawn_1.createPendingSpawnAsync)(() => this.updatePackageFileAsync(versioned, 'devDependencies'), () => !unversioned.length
? this.runAsync(['install', ...flags])
: this.runAsync([
'install',
'--save-dev',
...flags,
...unversioned.map((spec) => spec.raw),
]));
}
addGlobalAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['install', '--global', ...namesOrFlags]);
}
removeAsync(namesOrFlags) {
return this.runAsync(['uninstall', ...namesOrFlags]);
}
removeDevAsync(namesOrFlags) {
return this.runAsync(['uninstall', '--save-dev', ...namesOrFlags]);
}
removeGlobalAsync(namesOrFlags) {
return this.runAsync(['uninstall', '--global', ...namesOrFlags]);
}
runBinAsync(command, options = {}) {
this.log?.(`> npx ${command.join(' ')}`);
return (0, spawn_async_1.default)('npx', command, { ...this.options, ...options });
}
/**
* Parse all package specifications from the names or flag list.
* The result from this method can be used for `.updatePackageFileAsync`.
*/
parsePackageSpecs(namesOrFlags) {
const result = { flags: [], versioned: [], unversioned: [] };
namesOrFlags
.map((name) => {
if (name.trim().startsWith('-')) {
result.flags.push(name);
return null;
}
return (0, npm_package_arg_1.default)(name);
})
.forEach((spec) => {
// When using a dist-tag version of a library, we need to consider it as "unversioned".
// Doing so will install that version with `npm install --save(-dev)`, and resolve the dist-tag properly.
const hasExactSpec = !!spec && spec.rawSpec !== '' && spec.rawSpec !== '*';
if (spec && hasExactSpec && spec.type !== 'tag') {
result.versioned.push(spec);
}
else if (spec) {
result.unversioned.push(spec);
}
});
return result;
}
/** Sort dependencies by keys (case-insensitive, stable). Sorting algorithm is taken from https://github.com/npm/package-json/blob/f5db81bdfbba5e9d3bfc0732f8bfe511825a20aa/lib/update-dependencies.js#L9 */
orderDependencies(deps) {
if (!deps) {
return {};
}
const sorted = Object.keys(deps)
.sort((a, b) => a.localeCompare(b, 'en'))
.reduce((res, key) => {
res[key] = deps[key];
return res;
}, {});
return sorted;
}
/**
* Older npm versions have issues with mismatched nested dependencies when adding exact versions.
* This propagates as issues like mismatched `@expo/config-pugins` versions.
* As a workaround, we update the `package.json` directly and run `npm install`.
*/
async updatePackageFileAsync(packageSpecs, packageType) {
if (!packageSpecs.length) {
return;
}
const pkgPath = path_1.default.join(this.options.cwd?.toString() || '.', 'package.json');
const pkg = await json_file_1.default.readAsync(pkgPath);
packageSpecs.forEach((spec) => {
pkg[packageType] = pkg[packageType] || {};
pkg[packageType][spec.name] = spec.rawSpec;
});
pkg[packageType] = this.orderDependencies(pkg[packageType]);
await json_file_1.default.writeAsync(pkgPath, pkg, { json5: false });
}
}
exports.NpmPackageManager = NpmPackageManager;
//# sourceMappingURL=NpmPackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NpmPackageManager.js","sourceRoot":"","sources":["../../src/node/NpmPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,oEAA6D;AAC7D,sEAA4C;AAC5C,gDAAwB;AAExB,6DAA0D;AAC1D,wDAA4E;AAC5E,0CAAyD;AAEzD,MAAa,iBAAkB,SAAQ,uCAAkB;IAC9C,IAAI,GAAG,KAAK,CAAC;IACb,GAAG,GAAG,KAAK,CAAC;IACZ,QAAQ,GAAG,4BAAa,CAA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,8CAgKC"}

View File

@@ -0,0 +1,14 @@
import { BasePackageManager } from './BasePackageManager';
export declare class PnpmPackageManager extends BasePackageManager {
readonly name = "pnpm";
readonly bin = "pnpm";
readonly lockFile = "pnpm-lock.yaml";
workspaceRoot(): PnpmPackageManager | null;
installAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addDevAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
addGlobalAsync(namesOrFlags?: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeDevAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeGlobalAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
}

View File

@@ -0,0 +1,61 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PnpmPackageManager = void 0;
const BasePackageManager_1 = require("./BasePackageManager");
const env_1 = __importDefault(require("../utils/env"));
const nodeManagers_1 = require("../utils/nodeManagers");
class PnpmPackageManager extends BasePackageManager_1.BasePackageManager {
name = 'pnpm';
bin = 'pnpm';
lockFile = nodeManagers_1.PNPM_LOCK_FILE;
workspaceRoot() {
const root = (0, nodeManagers_1.resolveWorkspaceRoot)(this.ensureCwdDefined('workspaceRoot'));
if (root) {
return new PnpmPackageManager({
...this.options,
silent: this.silent,
log: this.log,
cwd: root,
});
}
return null;
}
installAsync(namesOrFlags = []) {
if (env_1.default.CI && !namesOrFlags.join(' ').includes('frozen-lockfile')) {
namesOrFlags.unshift('--no-frozen-lockfile');
}
return this.runAsync(['install', ...namesOrFlags]);
}
addAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', ...namesOrFlags]);
}
addDevAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', '--save-dev', ...namesOrFlags]);
}
addGlobalAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return this.runAsync(['add', '--global', ...namesOrFlags]);
}
removeAsync(namesOrFlags) {
return this.runAsync(['remove', ...namesOrFlags]);
}
removeDevAsync(namesOrFlags) {
return this.runAsync(['remove', '--save-dev', ...namesOrFlags]);
}
removeGlobalAsync(namesOrFlags) {
return this.runAsync(['remove', '--global', ...namesOrFlags]);
}
}
exports.PnpmPackageManager = PnpmPackageManager;
//# sourceMappingURL=PnpmPackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PnpmPackageManager.js","sourceRoot":"","sources":["../../src/node/PnpmPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,6DAA0D;AAC1D,uDAA+B;AAC/B,wDAA6E;AAE7E,MAAa,kBAAmB,SAAQ,uCAAkB;IAC/C,IAAI,GAAG,MAAM,CAAC;IACd,GAAG,GAAG,MAAM,CAAC;IACb,QAAQ,GAAG,6BAAc,CAAC;IAEnC,aAAa;QACX,MAAM,IAAI,GAAG,IAAA,mCAAoB,EAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,IAAI,kBAAkB,CAAC;gBAC5B,GAAG,IAAI,CAAC,OAAO;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,GAAG,EAAE,IAAI;aACV,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,eAAyB,EAAE;QACtC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AC,CAAC;IAClE,CAAC;IAED,iBAAiB,CAAC,YAAsB;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAChE,CAAC;CACF;AA9DD,gDA8DC"}

View File

@@ -0,0 +1,16 @@
import { BasePackageManager } from './BasePackageManager';
export declare class YarnPackageManager extends BasePackageManager {
readonly name = "yarn";
readonly bin = "yarnpkg";
readonly lockFile = "yarn.lock";
/** Check if Yarn is running in offline mode, and add the `--offline` flag */
private withOfflineFlagAsync;
workspaceRoot(): YarnPackageManager | null;
installAsync(flags?: string[]): import("../utils/spawn").PendingSpawnPromise<import("@expo/spawn-async").SpawnResult>;
addAsync(namesOrFlags?: string[]): import("../utils/spawn").PendingSpawnPromise<import("@expo/spawn-async").SpawnResult>;
addDevAsync(namesOrFlags?: string[]): import("../utils/spawn").PendingSpawnPromise<import("@expo/spawn-async").SpawnResult>;
addGlobalAsync(namesOrFlags?: string[]): import("../utils/spawn").PendingSpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeDevAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
removeGlobalAsync(namesOrFlags: string[]): import("@expo/spawn-async").SpawnPromise<import("@expo/spawn-async").SpawnResult>;
}

View File

@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.YarnPackageManager = void 0;
const BasePackageManager_1 = require("./BasePackageManager");
const nodeManagers_1 = require("../utils/nodeManagers");
const spawn_1 = require("../utils/spawn");
const yarn_1 = require("../utils/yarn");
class YarnPackageManager extends BasePackageManager_1.BasePackageManager {
name = 'yarn';
bin = 'yarnpkg';
lockFile = nodeManagers_1.YARN_LOCK_FILE;
/** Check if Yarn is running in offline mode, and add the `--offline` flag */
async withOfflineFlagAsync(namesOrFlags) {
return (await (0, yarn_1.isYarnOfflineAsync)()) ? [...namesOrFlags, '--offline'] : namesOrFlags;
}
workspaceRoot() {
const root = (0, nodeManagers_1.resolveWorkspaceRoot)(this.ensureCwdDefined('workspaceRoot'));
if (root) {
return new YarnPackageManager({
...this.options,
silent: this.silent,
log: this.log,
cwd: root,
});
}
return null;
}
installAsync(flags = []) {
return (0, spawn_1.createPendingSpawnAsync)(() => this.withOfflineFlagAsync(['install']), (args) => this.runAsync([...args, ...flags]));
}
addAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return (0, spawn_1.createPendingSpawnAsync)(() => this.withOfflineFlagAsync(['add', ...namesOrFlags]), (args) => this.runAsync(args));
}
addDevAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return (0, spawn_1.createPendingSpawnAsync)(() => this.withOfflineFlagAsync(['add', '--dev', ...namesOrFlags]), (args) => this.runAsync(args));
}
addGlobalAsync(namesOrFlags = []) {
if (!namesOrFlags.length) {
return this.installAsync();
}
return (0, spawn_1.createPendingSpawnAsync)(() => this.withOfflineFlagAsync(['global', 'add', ...namesOrFlags]), (args) => this.runAsync(args));
}
removeAsync(namesOrFlags) {
return this.runAsync(['remove', ...namesOrFlags]);
}
removeDevAsync(namesOrFlags) {
return this.runAsync(['remove', ...namesOrFlags]);
}
removeGlobalAsync(namesOrFlags) {
return this.runAsync(['global', 'remove', ...namesOrFlags]);
}
}
exports.YarnPackageManager = YarnPackageManager;
//# sourceMappingURL=YarnPackageManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"YarnPackageManager.js","sourceRoot":"","sources":["../../src/node/YarnPackageManager.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,wDAA6E;AAC7E,0CAAyD;AACzD,wCAAmD;AAEnD,MAAa,kBAAmB,SAAQ,uCAAkB;IAC/C,IAAI,GAAG,MAAM,CAAC;IACd,GAAG,GAAG,SAAS,CAAC;IAChB,QAAQ,GAAG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,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,OAAO,IAAA,+BAAuB,EAC5B,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC,EAClE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC9B,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,eAAyB,EAAE;QACxC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,OAAO,IAAA,+BAAuB,EAC5B,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,CAAC,EACnE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC9B,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,YAAsB;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,cAAc,CAAC,YAAsB;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,iBAAiB,CAAC,YAAsB;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AA3ED,gDA2EC"}

View File

@@ -0,0 +1,6 @@
declare class Env {
/** Determine if the package manager is running in a CI environment. */
get CI(): boolean;
}
declare const _default: Env;
export default _default;

12
node_modules/@expo/package-manager/build/utils/env.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Env {
/** Determine if the package manager is running in a CI environment. */
get CI() {
// See: https://github.com/ctavan/node-getenv/blob/5b02feebde5d8edd56fff7d81c4b43403a20aff8/index.js#L63-L74
const { CI } = process.env;
return CI?.toLowerCase() === 'true' || CI === '1';
}
}
exports.default = new Env();
//# sourceMappingURL=env.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":";;AAAA,MAAM,GAAG;IACP,uEAAuE;IACvE,IAAI,EAAE;QACJ,4GAA4G;QAC5G,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QAC3B,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,GAAG,CAAC;IACpD,CAAC;CACF;AAED,kBAAe,IAAI,GAAG,EAAE,CAAC"}

View File

@@ -0,0 +1,27 @@
import { PackageManagerOptions } from '../PackageManager';
import { BunPackageManager } from '../node/BunPackageManager';
import { NpmPackageManager } from '../node/NpmPackageManager';
import { PnpmPackageManager } from '../node/PnpmPackageManager';
import { YarnPackageManager } from '../node/YarnPackageManager';
export { resolveWorkspaceRoot } from 'resolve-workspace-root';
export type NodePackageManager = NpmPackageManager | PnpmPackageManager | YarnPackageManager | BunPackageManager;
export type NodePackageManagerForProject = PackageManagerOptions & Partial<Record<NodePackageManager['name'], boolean>>;
export declare const NPM_LOCK_FILE = "package-lock.json";
export declare const YARN_LOCK_FILE = "yarn.lock";
export declare const PNPM_LOCK_FILE = "pnpm-lock.yaml";
export declare const BUN_LOCK_FILE = "bun.lockb";
export declare const BUN_TEXT_LOCK_FILE = "bun.lock";
/** The order of the package managers to use when resolving automatically */
export declare const RESOLUTION_ORDER: NodePackageManager['name'][];
/**
* Resolve the used node package manager for a project by checking the lockfile.
* This also tries to resolve the workspace root, if its part of a monorepo.
* Optionally, provide a preferred packager to only resolve that one specifically.
*/
export declare function resolvePackageManager(projectRoot: string, preferredManager?: NodePackageManager['name']): NodePackageManager['name'] | null;
/**
* This creates a Node package manager from the provided options.
* If these options are not provided, it will infer the package manager from lockfiles.
* When no package manager is found, it falls back to npm.
*/
export declare function createForProject(projectRoot: string, options?: NodePackageManagerForProject): NodePackageManager;

View File

@@ -0,0 +1,80 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RESOLUTION_ORDER = exports.BUN_TEXT_LOCK_FILE = exports.BUN_LOCK_FILE = exports.PNPM_LOCK_FILE = exports.YARN_LOCK_FILE = exports.NPM_LOCK_FILE = exports.resolveWorkspaceRoot = void 0;
exports.resolvePackageManager = resolvePackageManager;
exports.createForProject = createForProject;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const resolve_workspace_root_1 = require("resolve-workspace-root");
const BunPackageManager_1 = require("../node/BunPackageManager");
const NpmPackageManager_1 = require("../node/NpmPackageManager");
const PnpmPackageManager_1 = require("../node/PnpmPackageManager");
const YarnPackageManager_1 = require("../node/YarnPackageManager");
var resolve_workspace_root_2 = require("resolve-workspace-root");
Object.defineProperty(exports, "resolveWorkspaceRoot", { enumerable: true, get: function () { return resolve_workspace_root_2.resolveWorkspaceRoot; } });
exports.NPM_LOCK_FILE = 'package-lock.json';
exports.YARN_LOCK_FILE = 'yarn.lock';
exports.PNPM_LOCK_FILE = 'pnpm-lock.yaml';
exports.BUN_LOCK_FILE = 'bun.lockb';
exports.BUN_TEXT_LOCK_FILE = 'bun.lock';
/** The order of the package managers to use when resolving automatically */
exports.RESOLUTION_ORDER = ['bun', 'yarn', 'npm', 'pnpm'];
/**
* Resolve the used node package manager for a project by checking the lockfile.
* This also tries to resolve the workspace root, if its part of a monorepo.
* Optionally, provide a preferred packager to only resolve that one specifically.
*/
function resolvePackageManager(projectRoot, preferredManager) {
const root = (0, resolve_workspace_root_1.resolveWorkspaceRoot)(projectRoot) ?? projectRoot;
const lockFiles = {
npm: [exports.NPM_LOCK_FILE],
pnpm: [exports.PNPM_LOCK_FILE],
yarn: [exports.YARN_LOCK_FILE],
bun: [exports.BUN_TEXT_LOCK_FILE, exports.BUN_LOCK_FILE],
};
if (preferredManager) {
return lockFiles[preferredManager].some((file) => fs_1.default.existsSync(path_1.default.join(root, file)))
? preferredManager
: null;
}
for (const managerName of exports.RESOLUTION_ORDER) {
if (lockFiles[managerName].some((file) => fs_1.default.existsSync(path_1.default.join(root, file)))) {
return managerName;
}
}
return null;
}
/**
* This creates a Node package manager from the provided options.
* If these options are not provided, it will infer the package manager from lockfiles.
* When no package manager is found, it falls back to npm.
*/
function createForProject(projectRoot, options = {}) {
if (options.npm) {
return new NpmPackageManager_1.NpmPackageManager({ cwd: projectRoot, ...options });
}
else if (options.yarn) {
return new YarnPackageManager_1.YarnPackageManager({ cwd: projectRoot, ...options });
}
else if (options.pnpm) {
return new PnpmPackageManager_1.PnpmPackageManager({ cwd: projectRoot, ...options });
}
else if (options.bun) {
return new BunPackageManager_1.BunPackageManager({ cwd: projectRoot, ...options });
}
switch (resolvePackageManager(projectRoot)) {
case 'pnpm':
return new PnpmPackageManager_1.PnpmPackageManager({ cwd: projectRoot, ...options });
case 'yarn':
return new YarnPackageManager_1.YarnPackageManager({ cwd: projectRoot, ...options });
case 'bun':
return new BunPackageManager_1.BunPackageManager({ cwd: projectRoot, ...options });
case 'npm':
default:
return new NpmPackageManager_1.NpmPackageManager({ cwd: projectRoot, ...options });
}
}
//# sourceMappingURL=nodeManagers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"nodeManagers.js","sourceRoot":"","sources":["../../src/utils/nodeManagers.ts"],"names":[],"mappings":";;;;;;AAmCA,sDAyBC;AAOD,4CAyBC;AA5FD,4CAAoB;AACpB,gDAAwB;AACxB,mEAA8D;AAG9D,iEAA8D;AAC9D,iEAA8D;AAC9D,mEAAgE;AAChE,mEAA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 +1,15 @@
import { SpawnPromise } from '@expo/spawn-async';
/**
* The pending spawn promise is similar to the spawn promise from `@expo/spawn-async`.
* Instead of the `child` process being available immediately, the `child` is behind another promise.
* We need this to perform async tasks before running the actual spawn promise.
* Use it like: `await manager.installAsync().child`
*/
export interface PendingSpawnPromise<T> extends Promise<T> {
/**
* The child process from the delayed spawn.
* This is `null` whenever the promise before the spawn promise is rejected.
*/
child: Promise<SpawnPromise<T>['child'] | null>;
}
export declare function createPendingSpawnAsync<V, T>(actionAsync: () => Promise<V>, spawnAsync: (result: V) => SpawnPromise<T>): PendingSpawnPromise<T>;

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPendingSpawnAsync = createPendingSpawnAsync;
function createPendingSpawnAsync(actionAsync, spawnAsync) {
// Manually rsolve the child promise whenever the prepending async action is resolved.
// Avoid `childReject` to prevent "unhandled promise rejection" for one of the two promises.
let childResolve;
const child = new Promise((resolve, reject) => {
childResolve = resolve;
});
const pendingPromise = new Promise((spawnResolve, spawnReject) => {
actionAsync()
.then((result) => {
const spawnPromise = spawnAsync(result);
childResolve(spawnPromise.child);
spawnPromise.then(spawnResolve).catch(spawnReject);
})
.catch((error) => {
childResolve(null);
spawnReject(error);
});
});
pendingPromise.child = child;
return pendingPromise;
}
//# sourceMappingURL=spawn.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../src/utils/spawn.ts"],"names":[],"mappings":";;AAgBA,0DA0BC;AA1BD,SAAgB,uBAAuB,CACrC,WAA6B,EAC7B,UAA0C;IAE1C,sFAAsF;IACtF,4FAA4F;IAC5F,IAAI,YAA8D,CAAC;IACnE,MAAM,KAAK,GAA6C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtF,YAAY,GAAG,OAAO,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAI,OAAO,CAAI,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE;QAClE,WAAW,EAAE;aACV,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;YACxC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACjC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACrD,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEF,cAAyC,CAAC,KAAK,GAAG,KAAK,CAAC;IACzD,OAAO,cAAwC,CAAC;AAClD,CAAC"}

View File

@@ -0,0 +1,4 @@
/** Determine if you should use yarn offline or not */
export declare function isYarnOfflineAsync(): Promise<boolean>;
/** Exposed for testing */
export declare function getNpmProxy(): string | null;

46
node_modules/@expo/package-manager/build/utils/yarn.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isYarnOfflineAsync = isYarnOfflineAsync;
exports.getNpmProxy = getNpmProxy;
const child_process_1 = require("child_process");
const dns_1 = __importDefault(require("dns"));
const url_1 = __importDefault(require("url"));
/** Determine if you should use yarn offline or not */
async function isYarnOfflineAsync() {
if (await isUrlAvailableAsync('registry.yarnpkg.com')) {
return false;
}
const proxy = getNpmProxy();
if (!proxy) {
return true;
}
const { hostname } = url_1.default.parse(proxy);
if (!hostname) {
return true;
}
return !(await isUrlAvailableAsync(hostname));
}
/** Exposed for testing */
function getNpmProxy() {
if (process.env.https_proxy) {
return process.env.https_proxy ?? null;
}
try {
const httpsProxy = (0, child_process_1.execSync)('npm config get https-proxy').toString().trim();
return httpsProxy !== 'null' ? httpsProxy : null;
}
catch {
return null;
}
}
function isUrlAvailableAsync(url) {
return new Promise((resolve) => {
dns_1.default.lookup(url, (err) => {
resolve(!err);
});
});
}
//# sourceMappingURL=yarn.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../src/utils/yarn.ts"],"names":[],"mappings":";;;;;AAKA,gDAiBC;AAGD,kCAWC;AApCD,iDAAyC;AACzC,8CAAsB;AACtB,8CAAsB;AAEtB,sDAAsD;AAC/C,KAAK,UAAU,kBAAkB;IACtC,IAAI,MAAM,mBAAmB,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAE5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,CAAC,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,0BAA0B;AAC1B,SAAgB,WAAW;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IACzC,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAA,wBAAQ,EAAC,4BAA4B,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAC5E,OAAO,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;QACtC,aAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;YACtB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}

56
node_modules/@expo/package-manager/package.json generated vendored Normal file
View File

@@ -0,0 +1,56 @@
{
"name": "@expo/package-manager",
"version": "1.10.3",
"description": "A library for installing and finding packages in a project",
"main": "build/index.js",
"types": "build/index.d.ts",
"scripts": {
"build": "expo-module build",
"clean": "expo-module clean",
"lint": "expo-module lint",
"prepare": "expo-module clean && expo-module build",
"prepublishOnly": "expo-module prepublishOnly",
"test": "expo-module test",
"typecheck": "expo-module typecheck"
},
"repository": {
"type": "git",
"url": "https://github.com/expo/expo.git",
"directory": "packages/@expo/package-manager"
},
"keywords": [
"react-native",
"package-manager",
"package-json",
"node",
"yarn",
"yarnpkg",
"pnpm",
"bun"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo/issues"
},
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/package-manager#readme",
"files": [
"build"
],
"dependencies": {
"@expo/json-file": "^10.0.12",
"@expo/spawn-async": "^1.7.2",
"chalk": "^4.0.0",
"npm-package-arg": "^11.0.0",
"ora": "^3.4.0",
"resolve-workspace-root": "^2.0.0"
},
"devDependencies": {
"@types/micromatch": "^4.0.2",
"@types/npm-package-arg": "^6.1.0",
"expo-module-scripts": "^55.0.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "436ffb4355d5207f4a03fbc3568cd33424a40f3e"
}