Skip to content

Commit 3970981

Browse files
committed
Add Publish infra and September 2020 update
1 parent ca1f354 commit 3970981

File tree

14 files changed

+849
-0
lines changed

14 files changed

+849
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/build
3+
/.build
4+
/.swiftpm
5+
/*.xcodeproj
6+
.publish
7+
Output

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: detect-private-key
12+
- id: check-merge-conflict
13+
- repo: https://github.com/hodovani/pre-commit-swift
14+
rev: master
15+
hooks:
16+
- id: swift-lint
17+
- id: swift-format

.swiftformat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--indent 2
2+
--indentcase false
3+
--trimwhitespace always
4+
--ranges nospace
5+
--empty tuple
6+
--operatorfunc nospace
7+
--ifdef noindent
8+
--stripunusedargs closure-only
9+
--disable andOperator
10+
--swiftversion 5.3

.swiftlint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
disabled_rules:
2+
- trailing_comma
3+
- identifier_name
4+
- void_return
5+
- operator_whitespace
6+
- nesting
7+
- cyclomatic_complexity
8+
9+
line_length: 100
10+
11+
function_body_length:
12+
- 50
13+
14+
included:
15+
- Sources
16+
- Tests

.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "publish run",
8+
"type": "shell",
9+
"command": "publish run"
10+
},
11+
{
12+
"label": "regenerate content",
13+
"type": "shell",
14+
"command": "publish generate"
15+
}
16+
]
17+
}

Content/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Updates on what's new in the SwiftWasm ecosystem

Content/posts/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Updates on what's new in the SwiftWasm ecosystem

Content/posts/september-2020.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
date: 2020-09-30 14:34
3+
description: An update on what happened in the SwiftWasm ecosystem during September 2020.
4+
# tags: update
5+
---
6+
# September 2020 Update
7+
8+
The amount of work happening in the SwiftWasm ecosystem is growing, so we decided to start
9+
publishing blog updates to give you an overview of what happened recently. This update for
10+
September is big enough to be split into different sections for each area of our work, so let's
11+
get started. 🙂
12+
13+
## Libraries
14+
15+
[JavaScriptKit 0.7](https://github.com/swiftwasm/JavaScriptKit/releases/tag/0.7.0) has been
16+
released. It adds multiple new types bridged from JavaScript,
17+
namely `JSError`, `JSDate`, `JSTimer` (which corresponds to `setTimeout`/`setInterval` calls and
18+
manages closure lifetime for you), `JSString` and `JSPromise`. We now also have [documentation
19+
published automatically](https://swiftwasm.github.io/JavaScriptKit/) for the `main` branch.
20+
21+
New features of JavaScriptKit allowed us to start working on closer integration with
22+
[OpenCombine](https://github.com/OpenCombine/OpenCombine). The current progress is available in the
23+
new [OpenCombineJS](https://github.com/swiftwasm/OpenCombineJS) repository, and we plan to tag a
24+
release for it soon. At the moment it has a `JSScheduler` class wrapping `JSTimer` that implements
25+
[the `Scheduler` protocol](https://developer.apple.com/documentation/combine/scheduler), enabling
26+
you to use `debounce` and other time-based operators. Additionally, OpenCombineJS now provides a
27+
helper `publisher` property on `JSPromise`, which allows you to integrate any promise-based API with
28+
an OpenCombine pipeline.
29+
30+
We also saw a lot of great progress with [DOMKit](https://github.com/swiftwasm/DOMKit) in September
31+
thanks to the outstanding work by [Jed Fox](https://jedfox.com/) and
32+
[@Unkaputtbar](https://github.com/Unkaputtbar), which was unblocked by the recent additions to
33+
JavaScriptKit. With DOMKit we're going to get type-safe access to the most common browser DOM APIs.
34+
It will be expanded in the future to support even more features that currently are only available
35+
via JavaScriptKit through force unwrapping and dynamic casting.
36+
37+
That is, compare the current API you get with JavaScriptKit:
38+
39+
```swift
40+
import JavaScriptKit
41+
42+
let document = JSObject.global.document.object!
43+
44+
let divElement = document.createElement!("div").object!
45+
divElement.innerText = "Hello, world"
46+
let body = document.body.object!
47+
_ = body.appendChild!(divElement)
48+
```
49+
50+
to an equivalent snippet that could look like this with DOMKit:
51+
52+
```swift
53+
import DOMKit
54+
55+
let document = global.document
56+
57+
let divElement = document.createElement("div")
58+
divElement.innerText = "Hello, world"
59+
document.body.appendChild(divElement)
60+
```
61+
62+
Lastly on the libraries front, [Tokamak 0.4](https://github.com/TokamakUI/Tokamak/releases) is now
63+
available, enabling compatibility with the new version of JavaScriptKit, and utilizing the
64+
aforementioned `JSScheduler` implementation.
65+
66+
## Developer tools
67+
68+
Following the new 0.7 release of JavaScriptKit, [`carton`
69+
0.6](https://github.com/swiftwasm/carton/releases/tag/0.6.0) has been tagged, shipping with the
70+
appropriate JavaScriptKit runtime compatible with the new release. It also includes support for the
71+
new `carton bundle` command that produces a directory with optimized build output ready for
72+
deployment on a CDN or any other server. Notably, both `carton bundle` and `carton dev` support
73+
[SwiftPM package
74+
resources](https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md),
75+
allowing you to include additional static content to your SwiftWasm apps. These could be styles,
76+
scripts, images, fonts, or whatever other data you'd like to ship with your app.
77+
78+
This version of `carton` also ships with the latest version of
79+
[wasmer.js](https://github.com/wasmerio/wasmer-js/), which is one of our dependencies. This update
80+
brings compatibility of SwiftWasm apps with Safari 14 that was released recently.
81+
82+
## Toolchain/SDK work
83+
84+
The upstream Swift toolchain has switched to use [LLVM](http://llvm.org) 11 in the `main` branch,
85+
which caused a substantial amount of conflicts in our forked repositories. We've spent most of
86+
our time in September on resolving the fallout from that and making sure everything builds properly.
87+
You could've noticed that the previously steady stream of nighly development snapshots stalled for
88+
most of September, but it resumed starting with `wasm-DEVELOPMENT-SNAPSHOT-2020-09-20-a`.
89+
90+
As for the 5.3 branch, with the upstream Swift 5.3.0 release now generally available, we're
91+
currently preparing a stable SwiftWasm 5.3.0 release. It is based off upstream 5.3.0
92+
with our patches applied to the toolchain and the SDK. [We've created a
93+
checklist](https://github.com/swiftwasm/swift/issues/1759) that allows us to track the
94+
progress of this effort.
95+
96+
One of the issues we wanted to resolve before tagging SwiftWasm 5.3.0 is the inconsistency between
97+
WASI and Glibc APIs. While there's a subset of these APIs that looks and works the same, there are a
98+
lot of differences that our users should be aware of. Because of this, in subsequent snapshots our
99+
users need to use `import WASILibc` instead of `import Glibc` if they need to access to libc on the
100+
WASI platform. This has already landed in the `swiftwasm-release/5.3` branch with
101+
[swiftwasm/swift#1773](https://github.com/swiftwasm/swift/pull/1773) and is available
102+
in `wasm-5.3-SNAPSHOT-2020-09-23-a` or later. It was also implemented in the main `swiftwasm` branch
103+
in [swiftwasm/swift#1832](https://github.com/swiftwasm/swift/pull/1832), all thanks to the amazing
104+
work by [Yuta Saito](https://github.com/sponsors/kateinoigakukun).
105+
106+
## Upstream PRs
107+
108+
The divergence between the SwiftWasm toolchain and SDKs is still significant and causes regular
109+
conflicts that we have to resolve manually. We're working on making our changes available upstream,
110+
but this takes a lot of time, as upstream toolchain and SDK PRs need high level of polish to be
111+
accepted. Here's a list of PRs that had some progress in September:
112+
113+
### Foundation
114+
115+
* Add locking primitives for `TARGET_OS_WASI` in `CFLocking.h`
116+
[apple/swift-corelibs-foundation#2867](https://github.com/apple/swift-corelibs-foundation/pull/2867).
117+
**Status: merged.**
118+
* Add support for WASI in `CFInternal.h`
119+
[apple/swift-corelibs-foundation#2872](https://github.com/apple/swift-corelibs-foundation/pull/2872).
120+
**Status: merged.**
121+
* Add WASI support in `CoreFoundation_Prefix.h`
122+
[apple/swift-corelibs-foundation#2873](https://github.com/apple/swift-corelibs-foundation/pull/2873).
123+
**Status: merged.**
124+
* Add support for WASI in `CFDate.c`
125+
[apple/swift-corelibs-foundation#2880](https://github.com/apple/swift-corelibs-foundation/pull/2880).
126+
**Status: in review.**
127+
128+
### SwiftPM
129+
130+
* Propagate PATH to UserToolchain to fix sysroot search
131+
[apple/swift-package-manager#2936](https://github.com/apple/swift-package-manager/pull/2936).
132+
**Status: merged.**
133+
134+
## Contributions
135+
136+
We hope you can contribute to the SwiftWasm ecosystem, either to any of the projects listed above,
137+
or with your own libraries and apps that you built. We'd be very happy to feature your open-source
138+
work in our next update! Our whole [swiftwasm.org](https://swiftwasm.org) website including this
139+
blog [is open-source](https://github.com/swiftwasm/swiftwasm.org), so please feel free to open
140+
an issue or a pull request with a link to your work related to SwiftWasm.
141+
142+
A lot of the progress wouldn't be possible without payments from our GitHub Sponsors. Their
143+
contribution is deeply appreciated and allows us to spend more time on SwiftWasm projects. You can
144+
see the list of sponsors and make your contribution on the sponsorship pages of [Yuta
145+
Saito](https://github.com/sponsors/kateinoigakukun) and [Max
146+
Desiatov](https://github.com/sponsors/MaxDesiatov).
147+
148+
Thanks for reading! 👋

Package.resolved

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// swift-tools-version:5.3
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "SwiftWasmBlog",
7+
platforms: [
8+
.macOS(.v10_12),
9+
],
10+
products: [
11+
.executable(
12+
name: "SwiftWasmBlog",
13+
targets: ["SwiftWasmBlog"]
14+
),
15+
],
16+
dependencies: [
17+
.package(name: "Publish", url: "https://github.com/johnsundell/publish.git", from: "0.7.0"),
18+
.package(url: "https://github.com/johnsundell/SplashPublishPlugin.git", from: "0.1.0"),
19+
],
20+
targets: [
21+
.target(
22+
name: "SwiftWasmBlog",
23+
dependencies: ["Publish", "SplashPublishPlugin"]
24+
),
25+
]
26+
)

0 commit comments

Comments
 (0)