@expo/xcpretty
Advanced tools
Comparing version 4.1.3 to 4.2.0
@@ -64,2 +64,6 @@ import { Failure, Parser } from './Parser'; | ||
formatOther(text: string): string; | ||
formatSingleLineCompileIssue(type: 'warning' | 'error', filePathAndLocation: string, fileName: string, reason: string, target: string, project: string): string; | ||
formatRemark(msg: string): string; | ||
formatEmitSwiftModule(type: 'normal' | string, arch: 'x86_64' | string, target?: string, project?: string): string; | ||
formatCompileSwiftSources(type: 'normal' | string, arch: 'x86_64' | string, pkg: string | 'com.apple.xcode.tools.swift.compiler', target?: string, project?: string): string; | ||
formatCleanRemove(msg: string): string; | ||
@@ -156,3 +160,3 @@ formatWriteAuxiliaryFiles(text: string): string; | ||
formatWarning(message: string): string; | ||
formatCompileWarning(fileName: string, filePathAndLocation: string, reason: string, line: string, cursor: string): string; | ||
formatCompileWarning(fileName: string, filePathAndLocation: string, reason: string, line?: string, cursor?: string): string; | ||
shouldShowCompileWarning(filePath: string, lineNumber?: string, columnNumber?: string): boolean; | ||
@@ -159,0 +163,0 @@ formatPendingTest(suite: string, test: string): string; |
@@ -236,2 +236,45 @@ "use strict"; | ||
} | ||
formatSingleLineCompileIssue(type, filePathAndLocation, fileName, reason, target, project) { | ||
// Allow disabling this warning. | ||
const { filePath, lineNumber, columnNumber } = splitPathInfo(filePathAndLocation); | ||
if (type === 'warning') { | ||
if (!this.shouldShowCompileWarning(filePath, lineNumber, columnNumber)) { | ||
return ''; | ||
} | ||
} | ||
// Prevent `/foo/bar:1:1` instead using `/foo/bar` since it's a bit more focused. | ||
const sanitizedFilePath = lineNumber === '1' && columnNumber === '1' ? filePath : filePathAndLocation; | ||
// Get the `Project/Target` prefix. | ||
const packageName = [project, target].join('/'); | ||
// Choose a color. | ||
const color = type === 'warning' ? chalk_1.default.yellow : chalk_1.default.red; | ||
const platform = color.bold(`${packageName}:`); | ||
// Choose a symbol. | ||
const symbol = type === 'warning' ? symbols_1.WARNING : symbols_1.ERROR; | ||
// Get a more concise file path when the issue is inside the build folder. | ||
const appFileRoot = getAppRoot(sanitizedFilePath); | ||
const relativeAppFile = appFileRoot | ||
? chalk_1.default.gray('[app]/') + relativePath(appFileRoot, sanitizedFilePath) | ||
: sanitizedFilePath; | ||
// Create the message. | ||
const results = chalk_1.default `${symbol} ${platform} ${reason.trim()}\n {gray └─${relativeAppFile}}`; | ||
// Ensure we track the message | ||
if (type === 'warning') { | ||
this.warnings.push(results); | ||
} | ||
else { | ||
this.errors.push(results); | ||
} | ||
return results; | ||
} | ||
// These are like comments but for Xcode logs. | ||
formatRemark(msg) { | ||
return ''; | ||
} | ||
formatEmitSwiftModule(type, arch, target, project) { | ||
return ''; | ||
} | ||
formatCompileSwiftSources(type, arch, pkg, target, project) { | ||
return ''; | ||
} | ||
formatCleanRemove(msg) { | ||
@@ -238,0 +281,0 @@ return ''; |
@@ -97,5 +97,20 @@ export declare const Matchers: { | ||
ANY_COPY_MATCHER: RegExp; | ||
/** | ||
* `CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'expo-dev-menu-interface' from project 'Pods')` | ||
*/ | ||
COMPILE_SWIFT_SOURCES_MATCHER: RegExp; | ||
/** | ||
* `EmitSwiftModule normal x86_64 (in target 'expo-dev-menu-interface' from project 'Pods')` | ||
*/ | ||
EMIT_SWIFT_MODULE_MATCHER: RegExp; | ||
EXECUTED_MATCHER: RegExp; | ||
/** | ||
* @regex Captured groups | ||
* `$1` = whole message. | ||
* | ||
* `remark: Incremental compilation has been disabled: it is not compatible with whole module optimization` | ||
*/ | ||
REMARK_MATCHER: RegExp; | ||
/** | ||
* @regex Captured groups | ||
* `$1` = file | ||
@@ -235,2 +250,3 @@ * `$2` = test_suite | ||
COMPILE_WARNING_MATCHER: RegExp; | ||
COMPILE_WARNING_INLINE_MATCHER: RegExp; | ||
/** | ||
@@ -327,2 +343,3 @@ * @regex Captured groups | ||
COMPILE_ERROR_MATCHER: RegExp; | ||
COMPILE_ERROR_INLINE_MATCHER: RegExp; | ||
/** | ||
@@ -329,0 +346,0 @@ * @regex Captured groups |
@@ -100,5 +100,20 @@ "use strict"; | ||
ANY_COPY_MATCHER: /^(CpResource|CopyStringsFile|CopyPlistFile|CpHeader|PBXCp)\s(\/?.*\/(?:.*\.\w+))\s(\/?.*\/(?:.*\.\w+))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m, | ||
/** | ||
* `CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'expo-dev-menu-interface' from project 'Pods')` | ||
*/ | ||
COMPILE_SWIFT_SOURCES_MATCHER: /^(CompileSwiftSources)\s([^\s]+) ([^\s]+) ([^\s]+) (?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m, | ||
/** | ||
* `EmitSwiftModule normal x86_64 (in target 'expo-dev-menu-interface' from project 'Pods')` | ||
*/ | ||
EMIT_SWIFT_MODULE_MATCHER: /^(EmitSwiftModule)\s([^\s]+) ([^\s]+) (?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m, | ||
EXECUTED_MATCHER: /^\s*Executed/m, | ||
/** | ||
* @regex Captured groups | ||
* `$1` = whole message. | ||
* | ||
* `remark: Incremental compilation has been disabled: it is not compatible with whole module optimization` | ||
*/ | ||
REMARK_MATCHER: /^remark: (.*)$/m, | ||
/** | ||
* @regex Captured groups | ||
* `$1` = file | ||
@@ -237,3 +252,4 @@ * `$2` = test_suite | ||
*/ | ||
COMPILE_WARNING_MATCHER: /^(\/.+\/(.*):.*:.*):\swarning:\s(.*)$/m, | ||
COMPILE_WARNING_MATCHER: /^(\/.+\/(.*):.*:.*):\swarning:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))?$/m, | ||
COMPILE_WARNING_INLINE_MATCHER: /^(\/.+\/(.*):.*:.*):\swarning:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))$/m, | ||
/** | ||
@@ -329,3 +345,4 @@ * @regex Captured groups | ||
*/ | ||
COMPILE_ERROR_MATCHER: /^(\/.+\/(.*):.*:.*):\s(?:fatal\s)?error:\s(.*)$/m, | ||
COMPILE_ERROR_MATCHER: /^(\/.+\/(.*):.*:.*):\s(?:fatal\s)?error:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))?$/m, | ||
COMPILE_ERROR_INLINE_MATCHER: /^(\/.+\/(.*):.*:.*):\s(?:fatal\s)?error:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))$/m, | ||
/** | ||
@@ -332,0 +349,0 @@ * @regex Captured groups |
@@ -164,3 +164,12 @@ "use strict"; | ||
[Matchers_1.Matchers.EXECUTED_MATCHER, () => this.formatSummaryIfNeeded(text)], | ||
[Matchers_1.Matchers.REMARK_MATCHER, ([, $1]) => formatter.formatRemark($1)], | ||
[ | ||
Matchers_1.Matchers.COMPILE_SWIFT_SOURCES_MATCHER, | ||
([, , $2, $3, $4, $5, $6]) => formatter.formatCompileSwiftSources($2, $3, $4, $5, $6), | ||
], | ||
[ | ||
Matchers_1.Matchers.EMIT_SWIFT_MODULE_MATCHER, | ||
([, , $2, $3, $4, $5]) => formatter.formatEmitSwiftModule($2, $3, $4, $5), | ||
], | ||
[ | ||
Matchers_1.Matchers.RESTARTING_TESTS_MATCHER, | ||
@@ -306,2 +315,14 @@ () => formatter.formatFailingTest(this.testSuite, this.testCase, 'Test crashed', 'n/a'), | ||
], | ||
[ | ||
Matchers_1.Matchers.Errors.COMPILE_ERROR_MATCHER, | ||
([, $1, $2, $3, $4, $5]) => { | ||
return formatter.formatSingleLineCompileIssue('error', $1, $2, $3, $4, $5); | ||
}, | ||
], | ||
[ | ||
Matchers_1.Matchers.Warnings.COMPILE_WARNING_INLINE_MATCHER, | ||
([, $1, $2, $3, $4, $5]) => { | ||
return formatter.formatSingleLineCompileIssue('warning', $1, $2, $3, $4, $5); | ||
}, | ||
], | ||
[null, () => formatter.formatOther(text)], | ||
@@ -367,4 +388,9 @@ ]); | ||
matches => { | ||
// Prevent matching a one-liner error. | ||
if (matches === null || matches === void 0 ? void 0 : matches[4]) { | ||
return 'unmatched'; | ||
} | ||
this.formattingError = true; | ||
updateError(matches); | ||
return null; | ||
}, | ||
@@ -375,4 +401,9 @@ ], | ||
matches => { | ||
// Prevent matching a one-liner warning. | ||
if (matches === null || matches === void 0 ? void 0 : matches[4]) { | ||
return 'unmatched'; | ||
} | ||
this.formattingWarning = true; | ||
updateError(matches); | ||
return null; | ||
}, | ||
@@ -379,0 +410,0 @@ ], |
{ | ||
"name": "@expo/xcpretty", | ||
"description": "Parse and format xcodebuild logs", | ||
"version": "4.1.3", | ||
"version": "4.2.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
289842
3233