New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@expo/xcpretty

Package Overview
Dependencies
Maintainers
24
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/xcpretty - npm Package Compare versions

Comparing version 3.1.4 to 4.0.0

build/utils/getFirstExternalSourceForPod.d.ts

10

build/ExpoRunFormatter.d.ts

@@ -1,2 +0,2 @@

import { FileOperation, Formatter } from './Formatter';
import { CopyFileProps, FileOperation, Formatter } from './Formatter';
import { MetroParser } from './MetroParser';

@@ -19,4 +19,3 @@ export declare type ExpoRunFormatterProps = {

} & Pick<ExpoRunFormatterProps, 'isDebug'>): ExpoRunFormatter;
private cachedPackages;
private nativeProjectRoot;
private podfileTracer;
_parser: MetroParser | undefined;

@@ -27,7 +26,6 @@ get parser(): MetroParser;

shouldShowCompileWarning(filePath: string, lineNumber?: string, columnNumber?: string): boolean;
getNodeModuleName(filePath: string, target?: string): string | null;
formatFileOperation(props: FileOperation): string;
formatCopy({ from, to, target }: CopyFileProps): string;
formatPhaseScriptExecution(scriptName: string, target?: string, project?: string): string;
private getPkgName;
private getPodfile;
private packageJsonForProject;
}

99

build/ExpoRunFormatter.js

@@ -8,9 +8,12 @@ "use strict";

const chalk_1 = __importDefault(require("chalk"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const Formatter_1 = require("./Formatter");
const MetroParser_1 = require("./MetroParser");
const getDependenciesFromPodfileLock_1 = require("./utils/getDependenciesFromPodfileLock");
const getNodeModuleName_1 = require("./utils/getNodeModuleName");
const getPackageJsonForPath_1 = require("./utils/getPackageJsonForPath");
const PodfileTracer_1 = require("./utils/PodfileTracer");
const parsePodfileLock_1 = require("./utils/parsePodfileLock");
const symbols_1 = require("./utils/symbols");
function highlightLastPathComponent(filePath) {
return chalk_1.default.dim(path_1.default.dirname(filePath) + '/') + path_1.default.basename(filePath);
}
/**

@@ -21,10 +24,19 @@ * A superset of `Formatter` which adds support for Metro build errors and cleaner formatting for Node projects.

constructor(props) {
var _a;
super(props);
this.props = props;
this.cachedPackages = {};
this.nativeProjectRoot = path_1.default.join(props.projectRoot, 'ios');
let podfile = {};
const podfileLock = path_1.default.join(props.projectRoot, 'ios', 'Podfile.lock');
try {
const podfileContents = fs_1.default.readFileSync(podfileLock, 'utf8');
podfile = (_a = parsePodfileLock_1.parsePodfileLock(podfileContents)) !== null && _a !== void 0 ? _a : {};
}
catch { }
this.podfileTracer = new PodfileTracer_1.PodfileTracer({
...props,
podfile,
});
}
static create(projectRoot, { xcodeProject, isDebug, } = {}) {
var _a;
const podfileLock = path_1.default.join(projectRoot, 'ios', 'Podfile.lock');
const appName = ((_a = xcodeProject === null || xcodeProject === void 0 ? void 0 : xcodeProject.name.match(/.*\/(.*)\.\w+/)) === null || _a === void 0 ? void 0 : _a[1]) || '';

@@ -34,3 +46,2 @@ const formatter = new ExpoRunFormatter({

appName,
podfile: getDependenciesFromPodfileLock_1.getDependenciesFromPodfileLock(podfileLock),
isDebug,

@@ -61,5 +72,9 @@ });

}
getNodeModuleName(filePath, target) {
const results = this.podfileTracer.getNodeModuleName(filePath, target);
return (results === null || results === void 0 ? void 0 : results.name) ? chalk_1.default.cyan(results.name) : null;
}
formatFileOperation(props) {
const title = this.getFileOperationTitle(props.type);
const moduleNameTag = this.getPkgName(props.filePath, props.target);
const moduleNameTag = this.getNodeModuleName(props.filePath, props.target);
return Formatter_1.Formatter.format(title, [moduleNameTag, Formatter_1.Formatter.formatBreadCrumb(props.fileName, props.target, props.project)]

@@ -69,4 +84,17 @@ .filter(Boolean)

}
formatCopy({ from, to, target }) {
let relativeFile = Formatter_1.Formatter.relativePath(this.props.projectRoot, from);
// If the relative file reaches outside of the project root, we
// should attempt to resolve relative to the app output directory.
if (relativeFile.startsWith('../../')) {
const appFileRoot = Formatter_1.Formatter.getAppRoot(from);
relativeFile = highlightLastPathComponent(Formatter_1.Formatter.relativePath(appFileRoot, from));
}
const appFileRoot = Formatter_1.Formatter.getAppRoot(to);
const relativeAppFile = highlightLastPathComponent(Formatter_1.Formatter.relativePath(appFileRoot, to));
const moduleNameTag = this.getNodeModuleName('', target);
return Formatter_1.Formatter.format('Copying ', [moduleNameTag, [relativeFile, relativeAppFile].join(' ➜ ')].filter(Boolean).join(' '));
}
formatPhaseScriptExecution(scriptName, target, project) {
const moduleNameTag = this.getPkgName('', target);
const moduleNameTag = this.getNodeModuleName('', target);
if (scriptName === 'Start Packager') {

@@ -88,57 +116,4 @@ const port = process.env.RCT_METRO_PORT || '8081';

}
getPkgName(filePath, target) {
let moduleName = getNodeModuleName_1.getNodeModuleName(filePath);
if (!moduleName) {
if (this.props.appName &&
(target === this.props.appName || target === `Pods-${this.props.appName}`)) {
moduleName = '';
}
else if (target && target in knownPackages) {
moduleName = knownPackages[target];
}
else {
const pkg = this.packageJsonForProject(target);
if (pkg) {
moduleName = pkg.name;
}
}
}
return moduleName ? chalk_1.default.cyan(`${moduleName}`) : null;
}
getPodfile() {
return this.props.podfile || {};
}
packageJsonForProject(project) {
var _a;
if (!project) {
return null;
}
if (project in this.cachedPackages) {
return this.cachedPackages[project];
}
const filePath = (_a = Object.values(this.getPodfile()[project] || {})[0]) !== null && _a !== void 0 ? _a : null;
if (!filePath) {
return null;
}
const pkg = getPackageJsonForPath_1.getPackageJsonForPath(path_1.default.join(this.nativeProjectRoot, filePath));
if (pkg) {
this.cachedPackages[project] = pkg;
}
return pkg !== null && pkg !== void 0 ? pkg : null;
}
}
exports.ExpoRunFormatter = ExpoRunFormatter;
// 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',
};
function isTruthy(value) {

@@ -145,0 +120,0 @@ return value === 'true' || value === 1 || value === '1';

import { Failure, Parser } from './Parser';
declare function format(command: string, argumentText?: string, success?: boolean): string;
declare function relativePath(projectRoot: string, filePath: string): string;
declare function formatBreadCrumb(fileName: string, target?: string, project?: string): string;

@@ -34,2 +35,3 @@ declare function getAppRoot(filePath: string): string;

static getAppRoot: typeof getAppRoot;
static relativePath: typeof relativePath;
_parser: Parser | undefined;

@@ -52,3 +54,2 @@ get parser(): Parser;

formatPreprocess(file: string): string;
formatPbxcp(file: string): string;
formatShellCommand(command: string, args: string): string;

@@ -55,0 +56,0 @@ formatCompileCommand(compilerCommand: string, filePath: string): string;

@@ -211,2 +211,3 @@ "use strict";

formatPhaseScriptExecution(scriptName, target, project) {
// TODO: Track (scriptName === '[CP] Copy XCFrameworks')
return format('Executing', formatBreadCrumb(`'${scriptName}'`, target, project));

@@ -217,5 +218,2 @@ }

}
formatPbxcp(file) {
return format('Copying ', file);
}
formatShellCommand(command, args) {

@@ -528,2 +526,3 @@ return '';

Formatter.getAppRoot = getAppRoot;
Formatter.relativePath = relativePath;
function formatPaths(config) {

@@ -530,0 +529,0 @@ const filePath = chalk_1.default.reset.cyan(config.filePath);

import * as Runner from './Runner';
export { Parser } from './Parser';
export { MetroParser } from './MetroParser';
export { PodfileTracer } from './utils/PodfileTracer';
export { ExpoRunFormatter, ExpoRunFormatterProps } from './ExpoRunFormatter';

@@ -5,0 +6,0 @@ export * from './Formatter';

@@ -25,3 +25,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Runner = exports.switchRegex = exports.ExpoRunFormatter = exports.MetroParser = exports.Parser = void 0;
exports.Runner = exports.switchRegex = exports.ExpoRunFormatter = exports.PodfileTracer = exports.MetroParser = exports.Parser = void 0;
const Runner = __importStar(require("./Runner"));

@@ -33,2 +33,4 @@ exports.Runner = Runner;

Object.defineProperty(exports, "MetroParser", { enumerable: true, get: function () { return MetroParser_1.MetroParser; } });
var PodfileTracer_1 = require("./utils/PodfileTracer");
Object.defineProperty(exports, "PodfileTracer", { enumerable: true, get: function () { return PodfileTracer_1.PodfileTracer; } });
var ExpoRunFormatter_1 = require("./ExpoRunFormatter");

@@ -35,0 +37,0 @@ Object.defineProperty(exports, "ExpoRunFormatter", { enumerable: true, get: function () { return ExpoRunFormatter_1.ExpoRunFormatter; } });

@@ -99,3 +99,3 @@ "use strict";

*/
ANY_COPY_MATCHER: /^(CpResource|CopyStringsFile|CopyPlistFile|CpHeader)\s(\/?.*\/(?:.*\.\w+))\s(\/?.*\/(?:.*\.\w+))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
ANY_COPY_MATCHER: /^(CpResource|CopyStringsFile|CopyPlistFile|CpHeader|PBXCp)\s(\/?.*\/(?:.*\.\w+))\s(\/?.*\/(?:.*\.\w+))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
EXECUTED_MATCHER: /^\s*Executed/m,

@@ -102,0 +102,0 @@ /**

@@ -273,3 +273,2 @@ "use strict";

[Matchers_1.Matchers.PREPROCESS_MATCHER, ([, $1]) => formatter.formatPreprocess($1)],
[Matchers_1.Matchers.PBXCP_MATCHER, ([, $1]) => formatter.formatPbxcp($1)],
[

@@ -276,0 +275,0 @@ Matchers_1.Matchers.TESTS_RUN_COMPLETION_MATCHER,

{
"name": "@expo/xcpretty",
"description": "Parse and format xcodebuild logs",
"version": "3.1.4",
"version": "4.0.0",
"main": "build/index.js",

@@ -6,0 +6,0 @@ "types": "build/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc