From c500d514e7d75c49006a7b7e7dbae33afee4e74e Mon Sep 17 00:00:00 2001 From: Gus Cairo Date: Thu, 19 Feb 2026 17:40:10 +0000 Subject: [PATCH 1/2] @_export `HTTPTypes` and `AsyncStreaming` --- Sources/HTTPAPIs/Client/HTTPClient.swift | 6 ++---- Sources/HTTPAPIs/Exports.swift | 16 ++++++++++++++++ Sources/HTTPAPIs/Server/HTTPServer.swift | 3 +++ .../Server/HTTPServerClosureRequestHandler.swift | 1 + .../Server/HTTPServerRequestHandler.swift | 1 + .../Server/HTTPServerResponseSender.swift | 1 + 6 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 Sources/HTTPAPIs/Exports.swift diff --git a/Sources/HTTPAPIs/Client/HTTPClient.swift b/Sources/HTTPAPIs/Client/HTTPClient.swift index 0d45155..3ffa20c 100644 --- a/Sources/HTTPAPIs/Client/HTTPClient.swift +++ b/Sources/HTTPAPIs/Client/HTTPClient.swift @@ -12,10 +12,8 @@ // //===----------------------------------------------------------------------===// -// We are using exported imports so that developers don't have to -// import multiple modules just to execute an HTTP request -@_exported public import AsyncStreaming -@_exported public import HTTPTypes +public import AsyncStreaming +public import HTTPTypes /// A protocol that defines the interface for an HTTP client. /// diff --git a/Sources/HTTPAPIs/Exports.swift b/Sources/HTTPAPIs/Exports.swift new file mode 100644 index 0000000..5d92144 --- /dev/null +++ b/Sources/HTTPAPIs/Exports.swift @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift HTTP API Proposal open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift HTTP API Proposal project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of Swift HTTP API Proposal project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +@_exported public import AsyncStreaming +@_exported public import HTTPTypes diff --git a/Sources/HTTPAPIs/Server/HTTPServer.swift b/Sources/HTTPAPIs/Server/HTTPServer.swift index dac8ca1..c7e34e5 100644 --- a/Sources/HTTPAPIs/Server/HTTPServer.swift +++ b/Sources/HTTPAPIs/Server/HTTPServer.swift @@ -12,6 +12,9 @@ // //===----------------------------------------------------------------------===// +public import AsyncStreaming +public import HTTPTypes + @available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *) /// A protocol that defines the interface for an HTTP server. /// diff --git a/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift b/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift index 63f4c94..4028929 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +public import AsyncStreaming public import HTTPTypes /// A closure-based implementation of ``HTTPServerRequestHandler``. diff --git a/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift b/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift index eb290d9..5f8bd6b 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +public import AsyncStreaming public import HTTPTypes /// A protocol that defines the contract for handling HTTP server requests. diff --git a/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift b/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift index c950cfb..8f2117e 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +public import AsyncStreaming public import HTTPTypes /// A struct that ensures a single non-informational HTTP response is sent per request. From 7a977b0c4d135e0b48f99e57faad2d7ed4649ba6 Mon Sep 17 00:00:00 2001 From: Gus Cairo Date: Tue, 10 Mar 2026 16:05:22 +0000 Subject: [PATCH 2/2] Remove individual imports --- Sources/HTTPAPIs/Client/HTTPClient.swift | 3 --- Sources/HTTPAPIs/Server/HTTPServer.swift | 3 --- Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift | 3 --- Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift | 3 --- Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift | 3 --- 5 files changed, 15 deletions(-) diff --git a/Sources/HTTPAPIs/Client/HTTPClient.swift b/Sources/HTTPAPIs/Client/HTTPClient.swift index 3ffa20c..f2a44b1 100644 --- a/Sources/HTTPAPIs/Client/HTTPClient.swift +++ b/Sources/HTTPAPIs/Client/HTTPClient.swift @@ -12,9 +12,6 @@ // //===----------------------------------------------------------------------===// -public import AsyncStreaming -public import HTTPTypes - /// A protocol that defines the interface for an HTTP client. /// /// ``HTTPClient`` provides asynchronous request execution with streaming request diff --git a/Sources/HTTPAPIs/Server/HTTPServer.swift b/Sources/HTTPAPIs/Server/HTTPServer.swift index c7e34e5..dac8ca1 100644 --- a/Sources/HTTPAPIs/Server/HTTPServer.swift +++ b/Sources/HTTPAPIs/Server/HTTPServer.swift @@ -12,9 +12,6 @@ // //===----------------------------------------------------------------------===// -public import AsyncStreaming -public import HTTPTypes - @available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *) /// A protocol that defines the interface for an HTTP server. /// diff --git a/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift b/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift index 4028929..3de99df 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerClosureRequestHandler.swift @@ -12,9 +12,6 @@ // //===----------------------------------------------------------------------===// -public import AsyncStreaming -public import HTTPTypes - /// A closure-based implementation of ``HTTPServerRequestHandler``. /// /// ``HTTPServerClosureRequestHandler`` provides a convenient way to create an HTTP request handler diff --git a/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift b/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift index 5f8bd6b..d781761 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerRequestHandler.swift @@ -12,9 +12,6 @@ // //===----------------------------------------------------------------------===// -public import AsyncStreaming -public import HTTPTypes - /// A protocol that defines the contract for handling HTTP server requests. /// /// ``HTTPServerRequestHandler`` provides a structured way to process incoming HTTP requests diff --git a/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift b/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift index 8f2117e..c1d2ed3 100644 --- a/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift +++ b/Sources/HTTPAPIs/Server/HTTPServerResponseSender.swift @@ -12,9 +12,6 @@ // //===----------------------------------------------------------------------===// -public import AsyncStreaming -public import HTTPTypes - /// A struct that ensures a single non-informational HTTP response is sent per request. /// /// ``HTTPResponseSender`` enforces structured response handling by allowing only one call to