diff --git a/.swift-version b/.swift-version index 4d0dcda..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1.2 +5.0 diff --git a/Dockerfile b/Dockerfile index e561ec1..ca0a778 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM norionomura/swift:41 +FROM norionomura/swift:swift-5.0-branch WORKDIR /package diff --git a/LICENSE b/LICENSE index 01d7d4a..cb545c0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Point-Free, Inc. +Copyright (c) 2019 Point-Free, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Package.resolved b/Package.resolved index f68d351..5888014 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,22 @@ { "object": { "pins": [ + { + "package": "AEXML", + "repositoryURL": "https://github.com/tadija/AEXML", + "state": { + "branch": null, + "revision": "54bb8ea6fb693dd3f92a89e5fcc19e199fdeedd0", + "version": "4.3.3" + } + }, { "package": "Socket", "repositoryURL": "https://github.com/IBM-Swift/BlueSocket.git", "state": { "branch": null, - "revision": "ce36f72f2c36b88f847de50c8c0ed8021ff80097", - "version": "1.0.16" + "revision": "ea61f532dd46c876f7bb8e1f8e849cac96b23b77", + "version": "1.0.45" } }, { @@ -15,17 +24,17 @@ "repositoryURL": "https://github.com/IBM-Swift/BlueSSLService.git", "state": { "branch": null, - "revision": "a8e24ec6db452ed202502ebae885b39f43e34d98", - "version": "1.0.16" + "revision": "655299a84254737b55c777c11f0fe5d5915e1f4b", + "version": "1.0.45" } }, { - "package": "CCurl", - "repositoryURL": "https://github.com/IBM-Swift/CCurl.git", + "package": "JSONUtilities", + "repositoryURL": "https://github.com/yonaskolb/JSONUtilities.git", "state": { "branch": null, - "revision": "2a431e3a5fb8d004aa7d4d1bebb5d511f568c43e", - "version": "1.0.0" + "revision": "db238f4858ac2ac3fff228b5b71ce90488a6a9b3", + "version": "4.1.0" } }, { @@ -33,8 +42,8 @@ "repositoryURL": "https://github.com/IBM-Swift/Kitura.git", "state": { "branch": null, - "revision": "38ca4d1c8385ea11ccbc7a0c841aff49accbcf17", - "version": "2.5.1" + "revision": "a56a19f44872dd1920c22cd10cefed20a438f8c8", + "version": "2.5.7" } }, { @@ -42,8 +51,8 @@ "repositoryURL": "https://github.com/IBM-Swift/Kitura-net.git", "state": { "branch": null, - "revision": "4023a2ea525e0c46d9ea793770d83f75df8a1707", - "version": "2.1.1" + "revision": "d837d453a72fe914b91354708b1afb13a2b411a6", + "version": "2.1.7" } }, { @@ -60,8 +69,8 @@ "repositoryURL": "https://github.com/IBM-Swift/KituraContracts.git", "state": { "branch": null, - "revision": "8e41f3fc81b662722020754f74a8fd8c7bdbbf3b", - "version": "1.1.0" + "revision": "acfad5b37e70590261c1181b1ad29758d20bf167", + "version": "1.1.1" } }, { @@ -69,8 +78,35 @@ "repositoryURL": "https://github.com/IBM-Swift/LoggerAPI.git", "state": { "branch": null, - "revision": "5041f2673aa75d6e973d9b6bd3956bc5068387c8", - "version": "1.7.3" + "revision": "d0ccb4158b83f8692531892a9c894bb757593c6f", + "version": "1.8.0" + } + }, + { + "package": "PathKit", + "repositoryURL": "https://github.com/kylef/PathKit.git", + "state": { + "branch": null, + "revision": "e2f5be30e4c8f531c9c1e8765aa7b71c0a45d7a0", + "version": "0.9.2" + } + }, + { + "package": "Rainbow", + "repositoryURL": "https://github.com/onevcat/Rainbow.git", + "state": { + "branch": null, + "revision": "797a68d0a642609424b08f11eb56974a54d5f6e2", + "version": "3.1.4" + } + }, + { + "package": "Spectre", + "repositoryURL": "https://github.com/kylef/Spectre.git", + "state": { + "branch": null, + "revision": "f14ff47f45642aa5703900980b014c2e9394b6e5", + "version": "0.9.0" } }, { @@ -78,8 +114,8 @@ "repositoryURL": "https://github.com/pointfreeco/swift-html.git", "state": { "branch": null, - "revision": "bb2fac72ec6f0adbe5a74b534d6d265f073b24bf", - "version": "0.1.1" + "revision": "f6fd8c99a790c930d0f22af3a06e02f37131a430", + "version": "0.3.0" } }, { @@ -87,8 +123,26 @@ "repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git", "state": { "branch": null, - "revision": "69b48c8487ef8207170aee02485c40f9cafc79c8", - "version": "0.0.1" + "revision": "1fb2e65cf62d2f983b3cab2871cbb218ea9ee9b7", + "version": "1.3.0" + } + }, + { + "package": "SwiftCLI", + "repositoryURL": "https://github.com/jakeheis/SwiftCLI.git", + "state": { + "branch": null, + "revision": "5318c37d3cacc8780f50b87a8840a6774320ebdf", + "version": "5.2.2" + } + }, + { + "package": "SwiftShell", + "repositoryURL": "https://github.com/kareman/SwiftShell", + "state": { + "branch": null, + "revision": "beebe43c986d89ea5359ac3adcb42dac94e5e08a", + "version": "4.1.2" } }, { @@ -96,8 +150,35 @@ "repositoryURL": "https://github.com/IBM-Swift/TypeDecoder.git", "state": { "branch": null, - "revision": "aaf636e64089baf6a710ff5e7dd5f4c8798ff940", - "version": "1.1.0" + "revision": "66550c1643740c58eae87df099c66144a85ae572", + "version": "1.3.2" + } + }, + { + "package": "XcodeGen", + "repositoryURL": "https://github.com/yonaskolb/XcodeGen.git", + "state": { + "branch": null, + "revision": "95bc051d268f6b8b924ae9c84e40566efe90cb80", + "version": "2.3.0" + } + }, + { + "package": "xcodeproj", + "repositoryURL": "https://github.com/tuist/xcodeproj.git", + "state": { + "branch": null, + "revision": "8e15cc74149ee946b7ae125685177915b4ff7317", + "version": "6.4.0" + } + }, + { + "package": "Yams", + "repositoryURL": "https://github.com/jpsim/Yams.git", + "state": { + "branch": null, + "revision": "26ab35f50ea891e8edefcc9d975db2f6b67e1d68", + "version": "1.0.1" } } ] diff --git a/Package.swift b/Package.swift index b40d0ae..e7ff6db 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,4 @@ -// swift-tools-version:4.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.0 import PackageDescription @@ -14,7 +13,7 @@ let package = Package( targets: ["HtmlKituraSupportExample"]), ], dependencies: [ - .package(url: "https://github.com/pointfreeco/swift-html.git", from: "0.1.1"), + .package(url: "https://github.com/pointfreeco/swift-html.git", from: "0.3.0"), .package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.5.0")), ], targets: [ diff --git a/README.md b/README.md index 38027bb..60199f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # swift-html-kitura -[![Swift 4.1](https://img.shields.io/badge/swift-4.1-ED523F.svg?style=flat)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/swift-5-ED523F.svg?style=flat)](https://swift.org/download/) [![Linux CI](https://img.shields.io/travis/pointfreeco/swift-html-kitura/master.svg?label=linux)](https://travis-ci.org/pointfreeco/swift-html-kitura) [![@pointfreeco](https://img.shields.io/badge/contact-@pointfreeco-5AA9E7.svg?style=flat)](https://twitter.com/pointfreeco) @@ -22,7 +22,7 @@ let router = Router() router.get("/") { request, response, next in response.send( - h1(["Hello, type-safe HTML on Kitura!"]) + Node.h1("Hello, type-safe HTML on Kitura!") ) next() } @@ -55,7 +55,7 @@ If you want to use swift-html-kitura in a project that uses [SwiftPM](https://sw ``` swift dependencies: [ - .package(url: "https://github.com/pointfreeco/swift-html-kitura.git", from: "0.1.0") + .package(url: "https://github.com/pointfreeco/swift-html-kitura.git", from: "0.3.0") ] ``` diff --git a/Sources/HtmlKituraSupportExample/main.swift b/Sources/HtmlKituraSupportExample/main.swift index ab54e0c..675e686 100644 --- a/Sources/HtmlKituraSupportExample/main.swift +++ b/Sources/HtmlKituraSupportExample/main.swift @@ -41,30 +41,31 @@ h2 { router.get("/") { request, response, next in response.send( - html([ - head([style(stylesheet)]), + Node.html( + .head(.style(safe: stylesheet)), - body([ - h1(["swift-html-kitura"]), - blockquote([ + .body( + .h1("swift-html-kitura"), + .blockquote( "A Kitura plugin for type-safe, transformable HTML views using ", - a([href("https://github.com/pointfreeco/swift-html")], ["swift-html"]) - ]), + .a(attributes: [.href("https://github.com/pointfreeco/swift-html")], "swift-html") + ), - h2(["Motivation"]), - p([""" + .h2("Motivation"), + .p(""" The most popular choice for rendering HTML in a Kitura web app is to use the Stencil templating language, but it exposes your application to runtime errors and invalid HTML. Our plugin prevents these runtime issues at compile-time by embedding HTML directly into Swift’s powerful type system. It uses the swift-html DSL for constructing HTML documents using plain Swift data structures. """ - ]), + ), - h2(["Usage"]), - p([""" + .h2("Usage"), + .p(""" To use the plugin all you have to do is return a `Node` value from your router callback: -"""]), - pre([""" +""" + ), + .pre(#""" import HtmlKituraSupport import Kitura @@ -72,46 +73,49 @@ let router = Router() router.get("/") { request, response, next in response.send( - h1(["Hello, type-safe HTML on Kitura!"]) + Node.h1("Hello, type-safe HTML on Kitura!") ) next() } Kitura.addHTTPServer(onPort: 8080, with: router) Kitura.run() -""" - ]), +"""# + ), - h2(["Take it for a spin"]), - p([""" + .h2("Take it for a spin"), + .p(""" We've included a sample Kitura application in this repo to show off its usage. To run the app immediately, simply do: -"""]), - ul([ - li([code(["swift run HtmlKituraSupportExample"])]), - li(["Open your browser to ", code(["http://localhost:8080"])]) - ]), - p([""" +""" + ), + .ul( + .li(.code("swift run HtmlKituraSupportExample")), + .li("Open your browser to \(.code("http://localhost:8080"))") + ), + .p(""" The HTML for that page is constructed and rendered with swift-html! -"""]), - p([""" +""" + ), + .p(""" If you want to run the app in Xcode so that you can play around with the HTML, try this: -"""]), - ul([ - li([code(["git clone https://github.com/pointfreeco/swift-html-kitura"])]), - li([code(["cd swift-html-kitura"])]), - li([code(["make xcodeproj"])]), - li(["Select the ", code(["HtmlKituraSupportExample"]), " target"]), - li(["Build and run ", code(["cmd+R"])]), - li(["Open your browser to ", code(["http://localhost:8080`"])]) - ]) - ]) - ]) +""" + ), + .ul( + .li(.code("git clone https://github.com/pointfreeco/swift-html-kitura")), + .li(.code("cd swift-html-kitura")), + .li(.code("make xcodeproj")), + .li("Select the \(.code("HtmlKituraSupportExample")) target"), + .li("Build and run \(.code("cmd+R"))"), + .li("Open your browser to \(.code("http://localhost:8080"))" + ) + ) + ) ) + ) - next() + next() } - Kitura.addHTTPServer(onPort: 8080, with: router) Kitura.run()