diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift deleted file mode 100644 index 9cbec438e..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift +++ /dev/null @@ -1,7 +0,0 @@ -public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { - public let description: String - - public init(_ message: String) { - self.description = message - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift deleted file mode 100644 index 2688f8da2..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift +++ /dev/null @@ -1,23 +0,0 @@ -import SwiftSyntax - -struct DiagnosticError: Error { - let node: Syntax - let message: String - let hint: String? - - init(node: some SyntaxProtocol, message: String, hint: String? = nil) { - self.node = Syntax(node) - self.message = message - self.hint = hint - } - - func formattedDescription(fileName: String) -> String { - let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root) - let location = locationConverter.location(for: node.position) - var description = "\(fileName):\(location.line):\(location.column): error: \(message)" - if let hint { - description += "\nHint: \(hint)" - } - return description - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift similarity index 67% rename from Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift rename to Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 56646b59c..e11bd4058 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -1,3 +1,63 @@ +// MARK: - ProgressReporting + +public struct ProgressReporting { + let print: (String) -> Void + + public init(verbose: Bool) { + self.init(print: verbose ? { Swift.print($0) } : { _ in }) + } + + private init(print: @escaping (String) -> Void) { + self.print = print + } + + public static var silent: ProgressReporting { + return ProgressReporting(print: { _ in }) + } + + public func print(_ message: String) { + self.print(message) + } +} + +// MARK: - DiagnosticError + +import SwiftSyntax + +struct DiagnosticError: Error { + let node: Syntax + let message: String + let hint: String? + + init(node: some SyntaxProtocol, message: String, hint: String? = nil) { + self.node = Syntax(node) + self.message = message + self.hint = hint + } + + func formattedDescription(fileName: String) -> String { + let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root) + let location = locationConverter.location(for: node.position) + var description = "\(fileName):\(location.line):\(location.column): error: \(message)" + if let hint { + description += "\nHint: \(hint)" + } + return description + } +} + +// MARK: - BridgeJSCoreError + +public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { + public let description: String + + public init(_ message: String) { + self.description = message + } +} + +// MARK: - BridgeJSConfig + import struct Foundation.URL import struct Foundation.Data import class Foundation.FileManager diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift deleted file mode 100644 index d1a2aa6d8..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift +++ /dev/null @@ -1,19 +0,0 @@ -public struct ProgressReporting { - let print: (String) -> Void - - public init(verbose: Bool) { - self.init(print: verbose ? { Swift.print($0) } : { _ in }) - } - - private init(print: @escaping (String) -> Void) { - self.print = print - } - - public static var silent: ProgressReporting { - return ProgressReporting(print: { _ in }) - } - - public func print(_ message: String) { - self.print(message) - } -}