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,50 @@
import { PodfileLock } from './parsePodfileLock';
/**
* A utility for tracing dependencies from a Podfile.lock.
*/
export declare class PodfileTracer {
props: {
projectRoot: string;
rootTargetName?: string;
podfile: PodfileLock;
};
static create(projectRoot: string, { xcodeProject }?: {
xcodeProject?: {
name: string;
};
}): PodfileTracer;
get podfile(): PodfileLock;
constructor(props: {
projectRoot: string;
rootTargetName?: string;
podfile: PodfileLock;
});
getNodeModuleNameForTarget: (key: string) => {
name: string;
isRootTarget: boolean;
} | null;
getNodeModuleNameForTargetWithoutCache(target: string): {
name: string;
isRootTarget: boolean;
} | null;
isRootTarget(target: string): boolean | "" | undefined;
getNodeModuleName(filePath: string, target?: string): {
name: string;
isRootTarget: boolean;
} | null;
getExternalSourceForPod: (key: string) => {
pod: string;
source: string;
} | null;
getExternalSourceForPodWithoutCache(pod?: string): {
pod: string;
source: string;
} | null;
private memoizedGetPackageJsonAnyFilePathInModule;
/** This can be a path like `/app/node_modules/expo-camera/ios` or `/app/node_modules/react-native-webrtc` depending on where the podspec is. */
getPackageJsonAnyFilePathInModule(props: {
target: string;
filePath: string;
}): Record<string, any> | null;
getPackageJsonAnyFilePathInModuleWithoutCache(filePath: string): Record<string, any> | null;
}

View File

@@ -0,0 +1,164 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PodfileTracer = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const getFirstExternalSourceForPod_1 = require("./getFirstExternalSourceForPod");
const getNodeModuleName_1 = require("./getNodeModuleName");
const getPackageJsonForPath_1 = require("./getPackageJsonForPath");
const parsePodfileLock_1 = require("./parsePodfileLock");
/**
* A utility for tracing dependencies from a Podfile.lock.
*/
class PodfileTracer {
static create(projectRoot, { xcodeProject } = {}) {
var _a, _b;
const podfileLock = path_1.default.join(projectRoot, 'ios', 'Podfile.lock');
const podfileContents = fs_1.default.readFileSync(podfileLock, 'utf8');
const rootTargetName = ((_a = xcodeProject === null || xcodeProject === void 0 ? void 0 : xcodeProject.name.match(/.*\/(.*)\.\w+/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
const formatter = new PodfileTracer({
projectRoot,
rootTargetName,
podfile: (_b = (0, parsePodfileLock_1.parsePodfileLock)(podfileContents)) !== null && _b !== void 0 ? _b : {},
});
return formatter;
}
get podfile() {
return this.props.podfile || {};
}
constructor(props) {
this.props = props;
// Wrap the expensive method in a cache
this.getNodeModuleNameForTarget = memoize(this.getNodeModuleNameForTargetWithoutCache.bind(this));
this.getExternalSourceForPod = memoize(this.getExternalSourceForPodWithoutCache.bind(this));
this.memoizedGetPackageJsonAnyFilePathInModule = memoizeTrigger(this.getPackageJsonAnyFilePathInModuleWithoutCache.bind(this));
}
getNodeModuleNameForTargetWithoutCache(target) {
if (!target) {
return null;
}
// Check the list of known pods that are hardcoded into the system.
if (target in knownPackages) {
return { name: knownPackages[target], isRootTarget: false };
}
// Check if the target matches the root project.
if (this.isRootTarget(target)) {
// Get the root package.json
const pkg = this.getPackageJsonAnyFilePathInModule({
target,
filePath: this.props.projectRoot,
});
return pkg ? { name: pkg.name, isRootTarget: true } : null;
}
// Otherwise, start tracing for dependencies.
let source = this.getExternalSourceForPod(target);
if (!source) {
// Some modules are formatted incorrectly in Xcode like `EXUpdates-EXUpdates` or `EXConstants-EXConstants`
// here we'll attempt to split the value, ensure there's more than one copy, and that all copies are the same, then we'll check against that new value.
const parts = target.split('-');
if (!!parts[0] && parts.length > 1 && parts.every(s => s === parts[0])) {
source = this.getExternalSourceForPod(parts[0]);
}
}
if (source === null || source === void 0 ? void 0 : source.source) {
// Finally attempt to trace the podspec file.
const pkg = this.getPackageJsonAnyFilePathInModule({
target: source.pod,
filePath: source.source,
});
if (pkg) {
return { name: pkg.name, isRootTarget: false };
}
}
return null;
}
isRootTarget(target) {
return (this.props.rootTargetName &&
(target === this.props.rootTargetName || target === `Pods-${this.props.rootTargetName}`));
}
getNodeModuleName(filePath, target) {
const moduleName = (0, getNodeModuleName_1.getNodeModuleName)(filePath);
if (moduleName) {
return { name: moduleName, isRootTarget: false };
}
else if (!target) {
return null;
}
return this.getNodeModuleNameForTarget(target);
}
getExternalSourceForPodWithoutCache(pod) {
var _a, _b;
if (!pod) {
return null;
}
const results = (0, getFirstExternalSourceForPod_1.getFirstExternalSourceForPod)(this.podfile, { name: pod });
// Keep tracing until we get to a development pod with a local file reference.
const filePath = (_b = (_a = results === null || results === void 0 ? void 0 : results.source[':podspec']) !== null && _a !== void 0 ? _a : results === null || results === void 0 ? void 0 : results.source[':path']) !== null && _b !== void 0 ? _b : null;
if (results && filePath) {
return { pod: results.pod, source: filePath };
}
return null;
}
/** This can be a path like `/app/node_modules/expo-camera/ios` or `/app/node_modules/react-native-webrtc` depending on where the podspec is. */
getPackageJsonAnyFilePathInModule(props) {
return this.memoizedGetPackageJsonAnyFilePathInModule({
key: props.target,
args: [props.filePath],
});
}
getPackageJsonAnyFilePathInModuleWithoutCache(filePath) {
if (!this.props.projectRoot || !filePath) {
return null;
}
const nativeProjectRoot = path_1.default.join(this.props.projectRoot, 'ios');
// In the case of the root level podspec file.
try {
const rootLevelPkgJsonPath = path_1.default.join(nativeProjectRoot, 'package.json');
return require(rootLevelPkgJsonPath);
}
catch {
return (0, getPackageJsonForPath_1.getPackageJsonForPath)(path_1.default.join(nativeProjectRoot, filePath));
}
}
}
exports.PodfileTracer = PodfileTracer;
function memoize(func) {
const cache = {};
return function (key) {
if (key in cache) {
return cache[key];
}
const result = func(key);
cache[key] = result;
return result;
};
}
function memoizeTrigger(func) {
const cache = {};
return function ({ key, args }) {
if (key in cache) {
return cache[key];
}
// @ts-ignore
const result = func(...args);
cache[key] = result;
return result;
};
}
// A list of packages that aren't linked through cocoapods directly.
const knownPackages = {
// Added to ReactCore as a `resource_bundle`
'React-Core-AccessibilityResources': 'react-native',
YogaKit: 'react-native',
// flipper
'Flipper-DoubleConversion': 'react-native',
'Flipper-Folly': 'react-native',
'OpenSSL-Universal': 'react-native',
FlipperKit: 'react-native',
Flipper: 'react-native',
'Flipper-RSocket': 'react-native',
};
//# sourceMappingURL=PodfileTracer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
import { ExternalSource, PodfileLock } from './parsePodfileLock';
export declare function getDependentPods(podfileLock: PodfileLock, { name, version }: {
name: string;
version?: string;
}): string[];
/**
* Find the first "external source" (local file path reference) for a given pod.
*
* @param podfileLock
* @param props.name The pod name to search for.
* @param props.checked A recursive parameter to prevent infinite recursion, not for public use.
* @returns
*/
export declare function getFirstExternalSourceForPod(podfileLock: PodfileLock, { name, checked }: {
name: string;
checked?: string[];
}): {
pod: string;
source: ExternalSource;
} | null;

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDependentPods = getDependentPods;
exports.getFirstExternalSourceForPod = getFirstExternalSourceForPod;
function getDependentPods(podfileLock, { name, version }) {
if (!podfileLock.pods) {
return [];
}
const hasPodDependency = (pods) => {
for (const podDependency of pods) {
if (podDependency.name === name) {
return !version || podDependency.version === version;
}
if (podDependency.dependencies && hasPodDependency(podDependency.dependencies)) {
return true;
}
}
return false;
};
return podfileLock.pods.reduce((prev, curr) => {
if (curr.name !== name && curr.dependencies && hasPodDependency(curr.dependencies)) {
return [...prev, curr.name];
}
return prev;
}, []);
}
/**
* Find the first "external source" (local file path reference) for a given pod.
*
* @param podfileLock
* @param props.name The pod name to search for.
* @param props.checked A recursive parameter to prevent infinite recursion, not for public use.
* @returns
*/
function getFirstExternalSourceForPod(podfileLock, { name, checked }) {
if (!podfileLock.externalSources) {
return null;
}
if (podfileLock.externalSources[name]) {
return { pod: name, source: podfileLock.externalSources[name] };
}
else if (name.includes('/')) {
// Short cut for pods with a path
const possibleName = name.split('/')[0];
if (podfileLock.externalSources[possibleName]) {
return { pod: possibleName, source: podfileLock.externalSources[possibleName] };
}
}
if (!checked) {
checked = [];
}
checked.push(name);
const dependents = getDependentPods(podfileLock, { name });
for (const dependent of dependents) {
// Prevent pods with cyclic dependencies from causing infinite loops.
if (!checked.includes(dependent)) {
const results = getFirstExternalSourceForPod(podfileLock, { name: dependent, checked });
if (results) {
return results;
}
}
}
return null;
}
//# sourceMappingURL=getFirstExternalSourceForPod.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getFirstExternalSourceForPod.js","sourceRoot":"","sources":["../../src/utils/getFirstExternalSourceForPod.ts"],"names":[],"mappings":";;AAEA,4CA2BC;AAUD,oEAmCC;AAxED,SAAgB,gBAAgB,CAC9B,WAAwB,EACxB,EAAE,IAAI,EAAE,OAAO,EAAsC;IAErD,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAE,EAAE;QACjD,KAAK,MAAM,aAAa,IAAI,IAAI,EAAE,CAAC;YACjC,IAAI,aAAa,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBAChC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,KAAK,OAAO,CAAC;YACvD,CAAC;YACD,IAAI,aAAa,CAAC,YAAY,IAAI,gBAAgB,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC/E,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAW,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACtD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACnF,OAAO,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,WAAwB,EACxB,EAAE,IAAI,EAAE,OAAO,EAAwC;IAEvD,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClE,CAAC;SAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,iCAAiC;QACjC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,IAAI,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnB,MAAM,UAAU,GAAG,gBAAgB,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,qEAAqE;QACrE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,4BAA4B,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YACxF,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { ExternalSource, PodDependency, PodfileLock } from './parsePodfileLock';\n\nexport function getDependentPods(\n podfileLock: PodfileLock,\n { name, version }: { name: string; version?: string }\n): string[] {\n if (!podfileLock.pods) {\n return [];\n }\n\n const hasPodDependency = (pods: PodDependency[]) => {\n for (const podDependency of pods) {\n if (podDependency.name === name) {\n return !version || podDependency.version === version;\n }\n if (podDependency.dependencies && hasPodDependency(podDependency.dependencies)) {\n return true;\n }\n }\n return false;\n };\n\n return podfileLock.pods.reduce<string[]>((prev, curr) => {\n if (curr.name !== name && curr.dependencies && hasPodDependency(curr.dependencies)) {\n return [...prev, curr.name];\n }\n\n return prev;\n }, []);\n}\n\n/**\n * Find the first \"external source\" (local file path reference) for a given pod.\n *\n * @param podfileLock\n * @param props.name The pod name to search for.\n * @param props.checked A recursive parameter to prevent infinite recursion, not for public use.\n * @returns\n */\nexport function getFirstExternalSourceForPod(\n podfileLock: PodfileLock,\n { name, checked }: { name: string; checked?: string[] }\n): { pod: string; source: ExternalSource } | null {\n if (!podfileLock.externalSources) {\n return null;\n }\n\n if (podfileLock.externalSources[name]) {\n return { pod: name, source: podfileLock.externalSources[name] };\n } else if (name.includes('/')) {\n // Short cut for pods with a path\n const possibleName = name.split('/')[0];\n if (podfileLock.externalSources[possibleName]) {\n return { pod: possibleName, source: podfileLock.externalSources[possibleName] };\n }\n }\n\n if (!checked) {\n checked = [];\n }\n checked.push(name);\n\n const dependents = getDependentPods(podfileLock, { name });\n\n for (const dependent of dependents) {\n // Prevent pods with cyclic dependencies from causing infinite loops.\n if (!checked.includes(dependent)) {\n const results = getFirstExternalSourceForPod(podfileLock, { name: dependent, checked });\n if (results) {\n return results;\n }\n }\n }\n return null;\n}\n"]}

View File

@@ -0,0 +1 @@
export declare function getNodeModuleName(filePath: string): string | null;

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeModuleName = getNodeModuleName;
function moduleNameFromPath(modulePath) {
if (modulePath.startsWith('@')) {
const [org, packageName] = modulePath.split('/');
if (org && packageName) {
return [org, packageName].join('/');
}
return modulePath;
}
const [packageName] = modulePath.split('/');
return packageName ? packageName : modulePath;
}
const NODE_MODULE_PATTERN = /node_modules(\/\.(pnpm|store)\/.*\/node_modules)?\//i;
function getNodeModuleName(filePath) {
// '/<project>/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
// '/<project>/node_modules/.pnpm/react-native@0.73.1_@babel+core@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
// '/<project>/node_modules/.store/react-native@0.73.1-OKL2xQk6utgOIuOl3VvO_g/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
const [, , , modulePath] = filePath.split(NODE_MODULE_PATTERN);
if (modulePath) {
return moduleNameFromPath(modulePath);
}
return null;
}
//# sourceMappingURL=getNodeModuleName.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getNodeModuleName.js","sourceRoot":"","sources":["../../src/utils/getNodeModuleName.ts"],"names":[],"mappings":";;AAcA,8CASC;AAvBD,SAAS,kBAAkB,CAAC,UAAkB;IAC5C,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjD,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AAChD,CAAC;AAED,MAAM,mBAAmB,GAAG,sDAAsD,CAAC;AAEnF,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,wGAAwG;IACxG,+KAA+K;IAC/K,uKAAuK;IACvK,MAAM,CAAC,EAAE,AAAD,EAAG,AAAD,EAAG,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/D,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["function moduleNameFromPath(modulePath: string) {\n if (modulePath.startsWith('@')) {\n const [org, packageName] = modulePath.split('/');\n if (org && packageName) {\n return [org, packageName].join('/');\n }\n return modulePath;\n }\n const [packageName] = modulePath.split('/');\n return packageName ? packageName : modulePath;\n}\n\nconst NODE_MODULE_PATTERN = /node_modules(\\/\\.(pnpm|store)\\/.*\\/node_modules)?\\//i;\n\nexport function getNodeModuleName(filePath: string): string | null {\n // '/<project>/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n // '/<project>/node_modules/.pnpm/react-native@0.73.1_@babel+core@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n // '/<project>/node_modules/.store/react-native@0.73.1-OKL2xQk6utgOIuOl3VvO_g/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n const [, , , modulePath] = filePath.split(NODE_MODULE_PATTERN);\n if (modulePath) {\n return moduleNameFromPath(modulePath);\n }\n return null;\n}\n"]}

View File

@@ -0,0 +1 @@
export declare const getPackageJsonForPath: (root: string) => any;

View File

@@ -0,0 +1,19 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPackageJsonForPath = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const getPackageJsonForPath = (root) => {
for (let dir = root; path_1.default.dirname(dir) !== dir; dir = path_1.default.dirname(dir)) {
const file = path_1.default.resolve(dir, 'package.json');
if (fs_1.default.existsSync(file)) {
return require(file);
}
}
return null;
};
exports.getPackageJsonForPath = getPackageJsonForPath;
//# sourceMappingURL=getPackageJsonForPath.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPackageJsonForPath.js","sourceRoot":"","sources":["../../src/utils/getPackageJsonForPath.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAEjB,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAO,EAAE;IACzD,KAAK,IAAI,GAAG,GAAG,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC/C,IAAI,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nexport const getPackageJsonForPath = (root: string): any => {\n for (let dir = root; path.dirname(dir) !== dir; dir = path.dirname(dir)) {\n const file = path.resolve(dir, 'package.json');\n if (fs.existsSync(file)) {\n return require(file);\n }\n }\n return null;\n};\n"]}

View File

@@ -0,0 +1,31 @@
export interface PodDependency {
name: string;
version?: string;
dependencies?: PodDependency[];
}
export interface ExternalSource {
/** "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" */
':podspec'?: string;
/** "../node_modules/expo-application/ios" */
':path'?: string;
}
export interface PodfileLock {
pods?: PodDependency[];
/** "1.11.2" */
cocoapods?: string;
externalSources?: Record<string, ExternalSource>;
/** 73e35020f8f5d49ffd32debe3c1bdd501f8029a6 */
podfileChecksum?: string;
/** { "DoubleConversion": "cf9b38bf0b2d048436d9a82ad2abe1404f11e7de" } */
specChecksums?: Record<string, string>;
}
/**
* Parses a podfile.lock file from from YAML into a JSON object.
*
* @param str Podfile.lock file contents in YAML format.
* @returns
*/
export declare function loadPodfileLock(str: string): null | Record<string, any>;
export declare const parsePodDependency: (pod: string | Record<string, string | Record<string, any>>) => PodDependency[];
export declare function parsePodfileLock(fileContent: string): PodfileLock | null;
export declare function getFilePathForExternalSource(podLock: PodfileLock, pod: string): string | null;

View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePodDependency = void 0;
exports.loadPodfileLock = loadPodfileLock;
exports.parsePodfileLock = parsePodfileLock;
exports.getFilePathForExternalSource = getFilePathForExternalSource;
const js_yaml_1 = require("js-yaml");
const EXTERNAL_SOURCES_KEY = 'EXTERNAL SOURCES';
/**
* Parses a podfile.lock file from from YAML into a JSON object.
*
* @param str Podfile.lock file contents in YAML format.
* @returns
*/
function loadPodfileLock(str) {
const contents = (0, js_yaml_1.load)(str);
if (!contents || typeof contents !== 'object') {
return null;
}
return contents;
}
const parsePodDependency = (pod) => {
if (typeof pod === 'string') {
// js-yaml fails to parse an array with a single item and instead formats it as a string divided by a `-` (hyphen).
// Here we match if a hyphen comes after a space. We use fake-nested-Podfile to test this hack.
const singleItemArrayBug = pod.match(/(.*)\s-\s(.*)/);
if (singleItemArrayBug === null || singleItemArrayBug === void 0 ? void 0 : singleItemArrayBug[2]) {
return (0, exports.parsePodDependency)({ [singleItemArrayBug[1]]: singleItemArrayBug[2] });
}
return [splitPodNameVersion(pod)];
}
return Object.entries(pod).map(([k, v]) => {
const results = splitPodNameVersion(k);
if (Array.isArray(v)) {
return {
...results,
dependencies: v.map(x => (0, exports.parsePodDependency)(x)).flat(),
};
}
else if (typeof v === 'string') {
return {
...results,
dependencies: (0, exports.parsePodDependency)(v),
};
}
return results;
});
};
exports.parsePodDependency = parsePodDependency;
function parsePodfileLock(fileContent) {
var _a;
const contents = (_a = loadPodfileLock(fileContent)) !== null && _a !== void 0 ? _a : loadPodfileLock(EXTERNAL_SOURCES_KEY + fileContent.split(EXTERNAL_SOURCES_KEY).slice(1));
if (!contents) {
return null;
}
const parsed = Object.entries(contents).reduce((acc, [key, value]) => {
return {
...acc,
[kebabCaseToCamelCase(rubyCaseToKebab(key))]: value,
};
}, {});
if (Array.isArray(parsed.pods)) {
const parsedPods = parsed.pods.map(exports.parsePodDependency);
parsed.pods = parsedPods.flat();
}
return parsed;
}
function splitPodNameVersion(pod) {
var _a;
const [name] = pod.split(' ');
return { name, version: (_a = pod.match(/\((.*)\)/)) === null || _a === void 0 ? void 0 : _a[1] };
}
function rubyCaseToKebab(str) {
return str.toLowerCase().split(' ').join('-');
}
function kebabCaseToCamelCase(str) {
return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
}
function getFilePathForExternalSource(podLock, pod) {
var _a, _b, _c;
const source = (_a = podLock.externalSources) === null || _a === void 0 ? void 0 : _a[pod];
return (_c = (_b = source === null || source === void 0 ? void 0 : source[':podspec']) !== null && _b !== void 0 ? _b : source === null || source === void 0 ? void 0 : source[':path']) !== null && _c !== void 0 ? _c : null;
}
//# sourceMappingURL=parsePodfileLock.js.map

File diff suppressed because one or more lines are too long

9
node_modules/@expo/xcpretty/build/utils/symbols.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export declare const PASS = "\u2713";
export declare const FAIL = "\u2717";
export declare const PENDING = "\u29D6";
export declare const COMPLETION = "\u203A";
export declare const MEASURE = "\u25F7";
export declare const ERROR: string;
export declare const WARNING: string;
export declare const INDENT = " ";
export declare const BREADCRUMB = "\u00BB";

14
node_modules/@expo/xcpretty/build/utils/symbols.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BREADCRUMB = exports.INDENT = exports.WARNING = exports.ERROR = exports.MEASURE = exports.COMPLETION = exports.PENDING = exports.FAIL = exports.PASS = void 0;
const USE_ASCII = false;
exports.PASS = '✓';
exports.FAIL = '✗';
exports.PENDING = '⧖';
exports.COMPLETION = '\u203A'; //'▸';
exports.MEASURE = '◷';
exports.ERROR = USE_ASCII ? '[x]' : '❌ ';
exports.WARNING = USE_ASCII ? '[!]' : '⚠️ ';
exports.INDENT = ' ';
exports.BREADCRUMB = '»';
//# sourceMappingURL=symbols.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/utils/symbols.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,KAAK,CAAC;AAEX,QAAA,IAAI,GAAG,GAAG,CAAC;AACX,QAAA,IAAI,GAAG,GAAG,CAAC;AACX,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,UAAU,GAAG,QAAQ,CAAC,CAAC,MAAM;AAC7B,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,QAAA,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,QAAA,MAAM,GAAG,MAAM,CAAC;AAChB,QAAA,UAAU,GAAG,GAAG,CAAC","sourcesContent":["const USE_ASCII = false;\n\nexport const PASS = '✓';\nexport const FAIL = '✗';\nexport const PENDING = '⧖';\nexport const COMPLETION = '\\u203A'; //'▸';\nexport const MEASURE = '◷';\nexport const ERROR = USE_ASCII ? '[x]' : '❌ ';\nexport const WARNING = USE_ASCII ? '[!]' : '⚠️ ';\nexport const INDENT = ' ';\nexport const BREADCRUMB = '»';\n"]}