Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up Imports #2963

Merged
merged 12 commits into from Feb 19, 2023
3 changes: 2 additions & 1 deletion .github/workflows/api-docs.yml
Expand Up @@ -6,8 +6,9 @@ on:

jobs:
build-and-deploy:
uses: vapor/api-docs/.github/workflows/build-and-deploy-docs-workflow.yml@fc8584486d15d22fbb3dabc28b27f518eb77a84c
uses: vapor/api-docs/.github/workflows/build-and-deploy-docs-workflow.yml@main
secrets: inherit
with:
package_name: vapor
modules: Vapor,XCTVapor
pathsToInvalidate: /vapor /xctvapor
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -37,3 +37,13 @@ jobs:
with_coverage: false
with_tsan: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, we should either turn off TSan for the provider tests or turn it on for the unit tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably be on really. I'll make a note to enable it when I do some Sendable work

with_public_api_check: true
test-exports:
name: Test exports
runs-on: ubuntu-latest
steps:
- name: Check out Vapor
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: swift build -Xswiftc -DBUILDING_DOCC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-D flags can't be passed directly to swift build? I could've sworn that was supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I didn't actually try! I'll try in the next repo and we can always backport it

2 changes: 2 additions & 0 deletions .spi.yml
@@ -1,3 +1,5 @@
version: 1
metadata:
authors: "Maintained by the Vapor Core Team with hundreds of contributions from the Vapor Community."
external_links:
documentation: "https://docs.vapor.codes"
1 change: 1 addition & 0 deletions Sources/Development/main.swift
@@ -1,4 +1,5 @@
import Vapor
import Logging

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Development/routes.swift
@@ -1,4 +1,6 @@
import Vapor
import NIOCore
import NIOHTTP1

struct Creds: Content {
var email: String
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Application.swift
@@ -1,5 +1,9 @@
import Backtrace
import NIOConcurrencyHelpers
import NIOCore
import Logging
import ConsoleKit
import NIOPosix

/// Core type representing a Vapor application.
public final class Application {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Authentication/Authenticator.swift
@@ -1,3 +1,5 @@
import NIOCore

/// Capable of being authenticated.
public protocol Authenticatable { }

Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Authentication/BasicAuthorization.swift
@@ -1,3 +1,6 @@
import Foundation
import NIOHTTP1

/// A basic username and password.
public struct BasicAuthorization {
/// The username, sometimes an email address
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Authentication/BearerAuthorization.swift
@@ -1,3 +1,5 @@
import NIOHTTP1

/// A bearer token.
public struct BearerAuthorization {
/// The plaintext token
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Authentication/GuardMiddleware.swift
@@ -1,3 +1,5 @@
import NIOCore

extension Authenticatable {
/// This middleware ensures that an `Authenticatable` type `A` has been authenticated
/// by a previous `Middleware` or throws an `Error`. The middlewares that actually perform
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Authentication/RedirectMiddleware.swift
@@ -1,3 +1,5 @@
import NIOCore

extension Authenticatable {
/// Basic middleware to redirect unauthenticated requests to the supplied path
///
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Authentication/SessionAuthenticatable.swift
@@ -1,3 +1,5 @@
import NIOCore

/// Helper for creating authentication middleware in conjunction with `SessionsMiddleware`.
public protocol SessionAuthenticator: Authenticator {
associatedtype User: SessionAuthenticatable
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Bcrypt/Bcrypt.swift
@@ -1,3 +1,4 @@
import Foundation
import CVaporBcrypt

// MARK: BCrypt
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Cache/MemoryCache.swift
@@ -1,3 +1,4 @@
import Foundation
import NIOCore
import NIOConcurrencyHelpers

Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Client/Client.swift
@@ -1,3 +1,7 @@
import NIOCore
import Logging
import NIOHTTP1

public protocol Client {
var eventLoop: EventLoop { get }
var byteBufferAllocator: ByteBufferAllocator { get }
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Client/ClientRequest.swift
@@ -1,3 +1,7 @@
import NIOCore
import NIOHTTP1
import Foundation

public struct ClientRequest {
public var method: HTTPMethod
public var url: URI
Expand Down
4 changes: 3 additions & 1 deletion Sources/Vapor/Client/ClientResponse.swift
@@ -1,4 +1,6 @@
import NIO
import NIOCore
import NIOHTTP1
import Foundation

public struct ClientResponse {
public var status: HTTPStatus
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Commands/BootCommand.swift
@@ -1,3 +1,5 @@
import ConsoleKit

/// Boots the `Application` then exits successfully.
///
/// $ swift run Run boot
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Commands/CommandContext+Application.swift
@@ -1,3 +1,5 @@
import ConsoleKit

extension CommandContext {
public var application: Application {
get {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Commands/RoutesCommand.swift
@@ -1,3 +1,6 @@
import ConsoleKit
import RoutingKit

/// Displays all routes registered to the `Application`'s `Router` in an ASCII-formatted table.
///
/// $ swift run Run routes
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Commands/ServeCommand.swift
@@ -1,3 +1,6 @@
import Foundation
import ConsoleKit

/// Boots the application's server. Listens for `SIGINT` and `SIGTERM` for graceful shutdown.
///
/// $ swift run Run serve
Expand Down
@@ -1,5 +1,6 @@
#if compiler(>=5.5) && canImport(_Concurrency)
import NIOCore
import Foundation

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension AsyncPasswordHasher {
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Concurrency/Client+Concurrency.swift
@@ -1,5 +1,6 @@
#if compiler(>=5.5) && canImport(_Concurrency)
import NIOCore
import NIOHTTP1

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Client {
Expand Down
@@ -1,4 +1,5 @@
import NIOCore
import NIOHTTP1

/// Can convert `self` to a `Response`.
///
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Concurrency/RoutesBuilder+Concurrency.swift
@@ -1,5 +1,7 @@
#if compiler(>=5.5) && canImport(_Concurrency)
import NIOCore
import NIOHTTP1
import RoutingKit

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension RoutesBuilder {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Concurrency/WebSocket+Concurrency.swift
@@ -1,5 +1,8 @@
#if compiler(>=5.5) && canImport(_Concurrency)
import NIOCore
import NIOHTTP1
import WebSocketKit
import RoutingKit

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Request {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Content/Content.swift
@@ -1,3 +1,5 @@
import NIOCore

/// Convertible to / from content in an HTTP message.
///
/// Conformance to this protocol consists of:
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Content/ContentCoders.swift
@@ -1,3 +1,7 @@
import Foundation
import NIOCore
import NIOHTTP1

public protocol ContentEncoder {
func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders) throws
where E: Encodable
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Content/ContentConfiguration.swift
@@ -1,3 +1,6 @@
import Foundation
import MultipartKit

/// Configures which `Encoder`s and `Decoder`s to use when interacting with data in HTTP messages.
///
/// ContentConfiguration.global.use(encoder: JSONEncoder(), for: .json)
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Content/JSONCoders+Content.swift
@@ -1,3 +1,7 @@
import Foundation
import NIOCore
import NIOHTTP1

extension JSONEncoder: ContentEncoder {
public func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders) throws
where E: Encodable
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Content/PlaintextDecoder.swift
@@ -1,3 +1,6 @@
import NIOCore
import NIOHTTP1

/// Decodes data as plaintext, utf8.
public struct PlaintextDecoder: ContentDecoder {

Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Content/PlaintextEncoder.swift
@@ -1,3 +1,7 @@
import Foundation
import NIOCore
import NIOHTTP1

/// Encodes data as plaintext, utf8.
public struct PlaintextEncoder: ContentEncoder {
/// Private encoder.
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Core/Core.swift
@@ -1,3 +1,7 @@
import ConsoleKit
import NIOCore
import NIOPosix

extension Application {
public var console: Console {
get { self.core.storage.console }
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Core/Running.swift
@@ -1,3 +1,5 @@
import NIOCore

extension Application {
public struct Running {
final class Storage {
Expand Down
@@ -1,3 +1,5 @@
import NIOHTTP1

extension CORSMiddleware.Configuration {
/// Instantiate a CORSConfiguration struct that can be used to create a `CORSConfiguration`
/// middleware for adding support for CORS in your responses.
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Deprecations/DotEnvFile+load.swift
@@ -1,3 +1,7 @@
import Logging
import NIOCore
import NIOPosix

extension DotEnvFile {
/// Reads the dotenv files relevant to the environment and loads them into the process.
///
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Environment/Environment+Process.swift
@@ -1,3 +1,5 @@
import Foundation

extension Environment {
/// The process information of an environment. Wraps `ProcessInto.processInfo`.
@dynamicMemberLookup public struct Process {
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/Environment/Environment+Secret.swift
@@ -1,3 +1,7 @@
import NIOCore
import NIOPosix
import AsyncKit

extension Environment {
/// Reads a file's content for a secret. The secret key is the name of the environment variable that is expected to
/// specify the path of the file containing the secret.
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Environment/Environment.swift
@@ -1,3 +1,4 @@
import Foundation
import ConsoleKit

/// The environment the application is running in, i.e., production, dev, etc. All `Container`s will have
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Error/Abort.swift
@@ -1,3 +1,5 @@
import NIOHTTP1

/// Default implementation of `AbortError`. You can use this as a convenient method for throwing
/// `AbortError`s without having to conform your own error-type to `AbortError`.
///
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/Error/AbortError.swift
@@ -1,3 +1,5 @@
import NIOHTTP1

/// Errors conforming to this protocol will always be displayed by
/// Vapor to the end-user (even in production mode where most errors are silenced).
///
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Error/DebuggableError.swift
@@ -1,4 +1,5 @@
import Foundation
import Logging

/// `Debuggable` provides an interface that allows a type
/// to be more easily debugged in the case of an error.
Expand Down
1 change: 1 addition & 0 deletions Sources/Vapor/Error/StackTrace.swift
@@ -1,3 +1,4 @@
import Foundation
#if os(Linux)
import Backtrace
import CBacktrace
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/Exports.swift
@@ -1,3 +1,5 @@
#if !BUILDING_DOCC

@_exported import AsyncKit

@_exported import class AsyncHTTPClient.HTTPClient
Expand Down Expand Up @@ -37,3 +39,4 @@

@_exported import WebSocketKit
@_exported import MultipartKit
#endif
2 changes: 2 additions & 0 deletions Sources/Vapor/HTTP/BasicResponder.swift
@@ -1,3 +1,5 @@
import NIOCore

/// A basic, closure-based `Responder`.
public struct BasicResponder: Responder {
/// The stored responder closure.
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/HTTP/BodyStream.swift
@@ -1,3 +1,5 @@
import NIOCore

public enum BodyStreamResult {
/// A normal data chunk.
/// There will be 0 or more of these.
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/HTTP/Client/Application+HTTP+Client.swift
@@ -1,3 +1,5 @@
import AsyncHTTPClient

extension Application.Clients.Provider {
public static var http: Self {
.init {
Expand Down
5 changes: 4 additions & 1 deletion Sources/Vapor/HTTP/Client/EventLoopHTTPClient.swift
@@ -1,4 +1,7 @@
import NIO
import NIOCore
import AsyncHTTPClient
import Logging
import Foundation

extension HTTPClient {
func delegating(to eventLoop: EventLoop, logger: Logger, byteBufferAllocator: ByteBufferAllocator) -> Client {
Expand Down
4 changes: 4 additions & 0 deletions Sources/Vapor/HTTP/EndpointCache.swift
@@ -1,4 +1,8 @@
import Foundation
import NIOConcurrencyHelpers
import NIOCore
import Logging
import NIOHTTP1

public enum EndpointCacheError: Swift.Error {
case unexpctedResponseStatus(HTTPStatus, uri: URI)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/HTTP/HTTPStatus.swift
@@ -1,3 +1,6 @@
import NIOHTTP1
import NIOCore

/// Less verbose typealias for `HTTPResponseStatus`.
public typealias HTTPStatus = HTTPResponseStatus

Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/HTTP/Headers/HTTPCookies.swift
@@ -1,3 +1,6 @@
import Foundation
import NIOHTTP1

extension HTTPHeaders {
/// Get and set `HTTPCookies` for an HTTP request
/// This accesses the `"Cookie"` header.
Expand Down
3 changes: 2 additions & 1 deletion Sources/Vapor/HTTP/Headers/HTTPHeaderCacheControl.swift
@@ -1,4 +1,5 @@
import NIO
import Foundation
import NIOHTTP1

// Comments on these properties are copied from the mozilla doc URL shown below.
extension HTTPHeaders {
Expand Down
3 changes: 2 additions & 1 deletion Sources/Vapor/HTTP/Headers/HTTPHeaderExpires.swift
@@ -1,4 +1,5 @@
import NIO
import Foundation
import NIOHTTP1

extension HTTPHeaders {
public struct Expires {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/HTTP/Headers/HTTPHeaderLastModified.swift
@@ -1,3 +1,6 @@
import Foundation
import NIOHTTP1

extension HTTPHeaders {
/// Represents the HTTP `Last-Modified` header.
/// - See Also:
Expand Down
3 changes: 3 additions & 0 deletions Sources/Vapor/HTTP/Headers/HTTPHeaders+Cache.swift
@@ -1,3 +1,6 @@
import Foundation
import NIOHTTP1

extension HTTPHeaders {
/// Determines when the cached data should be expired.
///
Expand Down
2 changes: 2 additions & 0 deletions Sources/Vapor/HTTP/Headers/HTTPHeaders+Connection.swift
@@ -1,3 +1,5 @@
import NIOHTTP1

extension HTTPHeaders {
public struct Connection: ExpressibleByStringLiteral, Equatable {
public static let close: Self = "close"
Expand Down