From 9d520d16e19dc0ec15492a13e9e540c83bbc95cd Mon Sep 17 00:00:00 2001 From: Scott Marchant Date: Fri, 20 Jun 2025 08:25:42 -0600 Subject: [PATCH 1/3] feat: Enable downstream dependencies to compile DataLoader using SwiftWasm. Removes broad NIO dependency from DataLoader module, as it actually depends only on NIOCore, not all of NIO. --- Package.resolved | 4 ++-- Package.swift | 2 +- Sources/DataLoader/DataLoader.swift | 2 +- Sources/DataLoader/DataLoaderOptions.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Package.resolved b/Package.resolved index 7b8fae1..f57bbf9 100644 --- a/Package.resolved +++ b/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "f7dc3f527576c398709b017584392fb58592e7f5", - "version" : "2.75.0" + "revision" : "0f54d58bb5db9e064f332e8524150de379d1e51c", + "version" : "2.82.1" } }, { diff --git a/Package.swift b/Package.swift index 649ecf9..3bd7394 100644 --- a/Package.swift +++ b/Package.swift @@ -19,7 +19,7 @@ let package = Package( .target( name: "DataLoader", dependencies: [ - .product(name: "NIO", package: "swift-nio"), + .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOConcurrencyHelpers", package: "swift-nio"), ] ), diff --git a/Sources/DataLoader/DataLoader.swift b/Sources/DataLoader/DataLoader.swift index 03374a2..65d9e78 100644 --- a/Sources/DataLoader/DataLoader.swift +++ b/Sources/DataLoader/DataLoader.swift @@ -1,5 +1,5 @@ -import NIO import NIOConcurrencyHelpers +import NIOCore public enum DataLoaderFutureValue { case success(T) diff --git a/Sources/DataLoader/DataLoaderOptions.swift b/Sources/DataLoader/DataLoaderOptions.swift index 5351637..429670c 100644 --- a/Sources/DataLoader/DataLoaderOptions.swift +++ b/Sources/DataLoader/DataLoaderOptions.swift @@ -1,4 +1,4 @@ -import NIO +import NIOCore public struct DataLoaderOptions { /// Default `true`. Set to `false` to disable batching, invoking From cc52a0c8165a3f4fa8d8d1f1c690b74b6e0bae30 Mon Sep 17 00:00:00 2001 From: Scott Marchant Date: Fri, 20 Jun 2025 08:25:54 -0600 Subject: [PATCH 2/3] chore: Clean up test dependencies to use more scoped imports of NIO, such as NIOCore and/or NIOPosix, rather than the much larger dependency of just NIO. --- Package.swift | 9 ++++++++- Tests/DataLoaderTests/DataLoaderAbuseTests.swift | 2 +- Tests/DataLoaderTests/DataLoaderAsyncTests.swift | 2 +- Tests/DataLoaderTests/DataLoaderTests.swift | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 3bd7394..71dc6ba 100644 --- a/Package.swift +++ b/Package.swift @@ -30,7 +30,14 @@ let package = Package( .product(name: "AsyncCollections", package: "async-collections"), ] ), - .testTarget(name: "DataLoaderTests", dependencies: ["DataLoader"]), + .testTarget( + name: "DataLoaderTests", + dependencies: [ + "DataLoader", + .product(name: "NIOCore", package: "swift-nio"), + .product(name: "NIOPosix", package: "swift-nio"), + ] + ), .testTarget(name: "AsyncDataLoaderTests", dependencies: ["AsyncDataLoader"]), ] ) diff --git a/Tests/DataLoaderTests/DataLoaderAbuseTests.swift b/Tests/DataLoaderTests/DataLoaderAbuseTests.swift index f99e0e3..4802b3f 100644 --- a/Tests/DataLoaderTests/DataLoaderAbuseTests.swift +++ b/Tests/DataLoaderTests/DataLoaderAbuseTests.swift @@ -1,4 +1,4 @@ -import NIO +import NIOPosix import XCTest @testable import DataLoader diff --git a/Tests/DataLoaderTests/DataLoaderAsyncTests.swift b/Tests/DataLoaderTests/DataLoaderAsyncTests.swift index 50f53f0..c96733b 100644 --- a/Tests/DataLoaderTests/DataLoaderAsyncTests.swift +++ b/Tests/DataLoaderTests/DataLoaderAsyncTests.swift @@ -1,4 +1,4 @@ -import NIO +import NIOPosix import XCTest @testable import DataLoader diff --git a/Tests/DataLoaderTests/DataLoaderTests.swift b/Tests/DataLoaderTests/DataLoaderTests.swift index 69d8f02..9e64539 100644 --- a/Tests/DataLoaderTests/DataLoaderTests.swift +++ b/Tests/DataLoaderTests/DataLoaderTests.swift @@ -1,4 +1,5 @@ -import NIO +import NIOCore +import NIOPosix import XCTest @testable import DataLoader From 68720a68c2639cf6738cb1fe56ebcf69b94ba515 Mon Sep 17 00:00:00 2001 From: Scott Marchant Date: Fri, 20 Jun 2025 09:14:52 -0600 Subject: [PATCH 3/3] chore: Update package.resolved to reflect latest available swift-nio version. --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index f57bbf9..1465c14 100644 --- a/Package.resolved +++ b/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "0f54d58bb5db9e064f332e8524150de379d1e51c", - "version" : "2.82.1" + "revision" : "34d486b01cd891297ac615e40d5999536a1e138d", + "version" : "2.83.0" } }, {