Swift-compute-runtime - Swift runtime for Fastly Compute@Edge

Overview

swift-compute-runtime

Swift runtime for Fastly Compute@Edge

Getting Started

Create a new swift package using the executable template

swift package init --type executable

Install the Compute runtime:

.package(name: "Compute", url: "https://github.com/AndrewBarba/swift-compute-runtime", branch: "main")

Documentation

Complete documentation is very much a work in progress:

https://compute-runtime.swift.cloud

Sample App

Here's what a Swift app looks like on Compute@Edge

import Compute

@main
struct HelloCompute {
    static func main() async throws {
        try await onIncomingRequest(handleIncomingRequest)
    }

    static func handleIncomingRequest(req: IncomingRequest, res: OutgoingResponse) async throws {
        let fetchResponse = try await fetch("https://httpbin.org/json", .options(
            headers: ["user-agent": "swift-compute-runtime"]
        ))
        let text = try await fetchResponse.text()
        try await res.status(200).send(text)
    }
}
You might also like...
__.swift is a port of Underscore.js to Swift.

__.swift Now, __.swift is version 0.2.0! With the chain of methods, __.swift became more flexible and extensible. Documentation: http://lotz84.github.

SNTabBarDemo-Swift - Cool TabBar With Swift
SNTabBarDemo-Swift - Cool TabBar With Swift

SNTabBarDemo-Swift Cool TabBar How To Use // MARK: - setup private func setu

Swift-when - Expression switch support in Swift

Swift When - supporting switch expressions in Swift! What is it? Basically, it a

Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

swift-highlight a pure-Swift data structure library designed for server applications that need to store a lot of styled text

swift-highlight is a pure-Swift data structure library designed for server applications that need to store a lot of styled text. The Highlight module is memory-efficient and uses slab allocations and small-string optimizations to pack large amounts of styled text into a small amount of memory, while still supporting efficient traversal through the Sequence protocol.

Sovran-Swift: Small, efficient, easy. State Management for Swift

Sovran-Swift: Small, efficient, easy. State Management for Swift

Approximate is a Swift package that provides implementations of floating point comparisons for the Swift ecosystem

Approximate Approximate floating point equality comparisons for the Swift Programming Language. Introduction Approximate is a Swift package that provi

A Swift app, named 'iPose', for iPhone's pose measurement based on Swift.

iPhone's pose measurement based on Swift. This is a Swift app, named 'iPose', for iPhone's pose measurement based on Swift. This is a side project to

Swift Package Manager plugin which runs ActionBuilder to create a Github Actions workflow for a swift package.

ActionBuilderPlugin A Swift Package Manager command which builds a Github Actions workflow for the current package. By default the workflow file will

Releases(2.8.0)
  • 2.8.0(Dec 19, 2022)

    • Compress outgoing responses with the new res.compress().send() method on OutgoingResponse. The Fastly runtime will choose the appropriate compression based on the requests Accept-Encoding header
    Source code(tar.gz)
    Source code(zip)
  • 2.7.0(Dec 10, 2022)

  • 2.6.0(Dec 5, 2022)

  • 2.5.0(Dec 5, 2022)

  • 2.4.1(Nov 29, 2022)

  • 2.4.0(Nov 28, 2022)

    This release exports foundation to make it easier to use common types like URL and JSONEncoder without always importing both Compute and Foundation

    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Nov 28, 2022)

  • 2.2.0(Nov 27, 2022)

  • 2.0.0(Nov 27, 2022)

    • Add a fetch implementation backed by URLSession. Now you can use this library on any other Apple platform, for example with the swift-cloud/Planetscale library
    • Reorganize runtime structs under a Fastly namespace
    • Dropped support for Swift 5.6
    Source code(tar.gz)
    Source code(zip)
  • 1.11.0(Nov 26, 2022)

  • 1.10.0(Nov 24, 2022)

  • 1.9.0(Sep 15, 2022)

    • Add support for dynamic backends when running locally
    • This makes it much simpler to develop locally without defining every backend in a fastly.toml
    • Requires the latest version of the Fastly CLI (or latest version of Viceroy)
    Source code(tar.gz)
    Source code(zip)
  • 1.8.0(Aug 22, 2022)

  • 1.7.0(Jun 29, 2022)

    Adds the ability to set cookie(s) on outgoing responses.

    res
      .cookie("foo", "bar")
      .cookie("name", "swift", .maxAge(300), .secure, .httpOnly)
      .send()
    
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(May 31, 2022)

  • 1.5.1(May 30, 2022)

  • 1.5.0(May 30, 2022)

  • 1.4.0(May 26, 2022)

  • 1.2.0(Apr 2, 2022)

  • 1.1.0(Mar 31, 2022)

    • Fix all build warnings on Swift 5.6
    • Additional conformance to Sendable
    • Added Console struct for sending logs to stdout and stderr

    Full Changelog: https://github.com/AndrewBarba/swift-compute-runtime/compare/1.0.0...1.1.0

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Mar 8, 2022)

    There aren't many projects I get to work on that feel like I'm actually building something for myself instead of someone else. This project is an exception. It's been a 2 year dream of mine to make Swift on server a reality for everyone, not just the experts in K8s, AWS, Docker, etc. I think this 1.0.0 truly brings that reality closer to light and I can't wait to share what I'm working on next to bring this project even further.

    Keep an eye on https://swift.cloud

    Source code(tar.gz)
    Source code(zip)
Owner
Andrew Barba
Swift, iOS, Node.js, MongoDB
Andrew Barba
๐Ÿ’ก A light Swift wrapper around Objective-C Runtime

A light wrapper around Objective-C Runtime. What exactly is lumos? lumos as mentioned is a light wrapper around objective-c runtime functions to allow

Suyash Shekhar 139 Dec 19, 2022
Swift-friendly API for a set of powerful Objective C runtime functions.

ObjectiveKit ObjectiveKit provides a Swift friendly API for a set of powerful Objective C runtime functions. Usage To use ObjectiveKit: Import Objecti

Roy Marmelstein 850 Oct 25, 2022
Plugin and runtime library for using protobuf with Swift

Swift Protobuf Welcome to Swift Protobuf! Apple's Swift programming language is a perfect complement to Google's Protocol Buffer ("protobuf") serializ

Apple 4.1k Dec 28, 2022
A simple utility allowing to detect Swift version at runtime.

SwiftVersionDetector SwiftVersionDetector allows you to detect Swift version at runtime. Note that detecting the Swift version of the machine on which

Alessandro Venturini 2 Dec 3, 2022
BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Blockchain Commons, LLC โ€” A โ€œnot-for-profitโ€ benefit corporation 4 Oct 6, 2022
Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Apple 2k Dec 28, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)

SwiftFoundation Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. Goals Provide a cross-platform in

null 620 Oct 11, 2022
Swift - โœ๏ธSwift ๊ณต๋ถ€ ์ €์žฅ์†Œโœ๏ธ

Swift ์Šค์œ„ํ”„ํŠธ์˜ ๊ธฐ์ดˆ 1. Swift์˜ ๊ธฐ๋ณธ 2. ๋ณ€์ˆ˜์™€ ์ƒ์ˆ˜ [3. ๋ฐ์ดํ„ฐ ํƒ€์ž… ๊ธฐ๋ณธ] [4. ๋ฐ์ดํ„ฐ ํƒ€์ž… ๊ณ ๊ธ‰] 5. ์—ฐ์‚ฐ์ž 6. ํ๋ฆ„ ์ œ์–ด 7. ํ•จ์ˆ˜ 8. ์˜ต์…”๋„ ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ๊ณผ ์Šค์œ„ํ”„ํŠธ 9. ๊ตฌ์กฐ์ฒด์™€ ํด๋ž˜์Šค 10. ํ”„๋กœํผํ‹ฐ์™€ ๋ฉ”์„œ๋“œ 11. ์ธ์Šคํ„ด์Šค ์ƒ

Jiwon 0 Mar 9, 2022
Swift-ndi - Swift wrapper around NewTek's NDI SDK

swift-ndi Swift wrapper around NewTek's NDI SDK. Make sure you extracted latest

Alessio Nossa 12 Dec 29, 2022