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

View File

@@ -0,0 +1,17 @@
import arg from 'arg';
/**
* Parse the first argument as a project directory.
*
* @returns valid project directory.
*/
export declare function getProjectRoot(args: arg.Result<arg.Spec>): string;
export declare function getFileArgumentAtIndex(args: arg.Result<arg.Spec>, index: number): string;
/**
* Parse args and assert unknown options.
*
* @param schema the `args` schema for parsing the command line arguments.
* @param argv extra strings
* @returns processed args object.
*/
export declare function assertArgs(schema: arg.Spec, argv: string[]): arg.Result<arg.Spec>;
export declare function requireArg(args: arg.Result<arg.Spec>, name: any): any;

94
node_modules/@expo/fingerprint/cli/build/utils/args.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProjectRoot = getProjectRoot;
exports.getFileArgumentAtIndex = getFileArgumentAtIndex;
exports.assertArgs = assertArgs;
exports.requireArg = requireArg;
// Common utilities for interacting with `args` library.
// These functions should be used by every command.
const arg_1 = __importDefault(require("arg"));
const fs_1 = require("fs");
const path_1 = require("path");
const Log = __importStar(require("./log"));
/**
* Parse the first argument as a project directory.
*
* @returns valid project directory.
*/
function getProjectRoot(args) {
const projectRoot = (0, path_1.resolve)(args._[0] || '.');
if (!(0, fs_1.existsSync)(projectRoot)) {
Log.exit(`Invalid project root: ${projectRoot}`);
}
return projectRoot;
}
function getFileArgumentAtIndex(args, index) {
const path = (0, path_1.resolve)(args._[index]);
if (!(0, fs_1.existsSync)(path)) {
Log.exit(`Invalid file: ${path}`);
}
return path;
}
/**
* Parse args and assert unknown options.
*
* @param schema the `args` schema for parsing the command line arguments.
* @param argv extra strings
* @returns processed args object.
*/
function assertArgs(schema, argv) {
try {
return (0, arg_1.default)(schema, { argv });
}
catch (error) {
// Ensure unknown options are handled the same way.
if (error.code === 'ARG_UNKNOWN_OPTION') {
Log.exit(error.message, 1);
}
// Otherwise rethrow the error.
throw error;
}
}
function requireArg(args, name) {
const value = args[name];
if (value === undefined || value === null) {
Log.exit(`${name} must be provided`, 1);
}
return value;
}

View File

@@ -0,0 +1,10 @@
/**
* General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.
*/
export declare class CommandError extends Error {
code: string;
name: string;
readonly isCommandError = true;
constructor(code: string, message?: string);
}
export declare function logCmdError(error: any): never;

View File

@@ -0,0 +1,41 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandError = void 0;
exports.logCmdError = logCmdError;
const assert_1 = require("assert");
const chalk_1 = __importDefault(require("chalk"));
const log_1 = require("./log");
const ERROR_PREFIX = 'Error: ';
/**
* General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.
*/
class CommandError extends Error {
code;
name = 'CommandError';
isCommandError = true;
constructor(code, message = '') {
super('');
this.code = code;
// If e.toString() was called to get `message` we don't want it to look
// like "Error: Error:".
if (message.startsWith(ERROR_PREFIX)) {
message = message.substring(ERROR_PREFIX.length);
}
this.message = message || code;
}
}
exports.CommandError = CommandError;
function logCmdError(error) {
if (!(error instanceof Error)) {
throw error;
}
if (error instanceof CommandError || error instanceof assert_1.AssertionError) {
// Print the stack trace in debug mode only.
(0, log_1.exit)(error);
}
const errorDetails = error.stack ? '\n' + chalk_1.default.gray(error.stack) : '';
(0, log_1.exit)(chalk_1.default.red(error.toString()) + errorDetails);
}

View File

@@ -0,0 +1,11 @@
export declare function time(label?: string): void;
export declare function timeEnd(label?: string): void;
export declare function error(...message: string[]): void;
/** Print an error and provide additional info (the stack trace) in debug mode. */
export declare function exception(e: Error): void;
export declare function warn(...message: string[]): void;
export declare function log(...message: string[]): void;
/** Clear the terminal of all text. */
export declare function clear(): void;
/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */
export declare function exit(message: string | Error, code?: number): never;

53
node_modules/@expo/fingerprint/cli/build/utils/log.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.time = time;
exports.timeEnd = timeEnd;
exports.error = error;
exports.exception = exception;
exports.warn = warn;
exports.log = log;
exports.clear = clear;
exports.exit = exit;
const chalk_1 = __importDefault(require("chalk"));
function time(label) {
console.time(label);
}
function timeEnd(label) {
console.timeEnd(label);
}
function error(...message) {
console.error(...message);
}
/** Print an error and provide additional info (the stack trace) in debug mode. */
function exception(e) {
error(chalk_1.default.red(e.toString()) + (process.env.EXPO_DEBUG ? '\n' + chalk_1.default.gray(e.stack) : ''));
}
function warn(...message) {
console.warn(...message.map((value) => chalk_1.default.yellow(value)));
}
function log(...message) {
console.log(...message);
}
/** Clear the terminal of all text. */
function clear() {
process.stdout.write(process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
}
/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */
function exit(message, code = 1) {
if (message instanceof Error) {
exception(message);
process.exit(code);
}
if (message) {
if (code === 0) {
log(message);
}
else {
error(message);
}
}
process.exit(code);
}

View File

@@ -0,0 +1,2 @@
import { Fingerprint } from '../../../build/Fingerprint.types';
export default function readFingerprintFileAsync(path: string): Promise<Fingerprint>;

View File

@@ -0,0 +1,15 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = readFingerprintFileAsync;
const promises_1 = __importDefault(require("fs/promises"));
async function readFingerprintFileAsync(path) {
try {
return JSON.parse(await promises_1.default.readFile(path, 'utf-8'));
}
catch (e) {
throw new Error(`Unable to read fingerprint file ${path}: ${e.message}`);
}
}

View File

@@ -0,0 +1 @@
export declare function withConsoleDisabledAsync<T>(block: () => Promise<T>): Promise<T>;

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.withConsoleDisabledAsync = withConsoleDisabledAsync;
async function withConsoleDisabledAsync(block) {
const loggingFunctions = {
log: console.log,
warn: console.warn,
error: console.error,
};
// Disable logging for this command since the only thing printed to stdout should be the JSON output.
console.log = function () { };
console.warn = function () { };
console.error = function () { };
try {
return await block();
}
finally {
// Re-enable logging functions for testing.
console.log = loggingFunctions.log;
console.warn = loggingFunctions.warn;
console.error = loggingFunctions.error;
}
}