@swifttui/build 0.0.26 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -9
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,11 +1,22 @@
1
1
  # `@swifttui/build`
2
2
 
3
- Build-time package for SwiftTUI browser deployment.
3
+ **Build tooling for [SwiftTUI](https://swifttui.sh) browser deployments —
4
+ compile a SwiftTUI app to `wasm32-wasi` and capture its scene manifest.**
4
5
 
5
- This package owns manifest generation, Swift WASI builds, browser
6
- `WebAssembly.compile` validation, and wasm packaging. It intentionally sits
7
- outside `@swifttui/web` so browser runtime imports do not pull in Swift process
8
- spawning, Node filesystem APIs, or wasm packaging helpers.
6
+ [![npm](https://img.shields.io/npm/v/@swifttui/build)](https://www.npmjs.com/package/@swifttui/build)
7
+ ![License](https://img.shields.io/badge/license-MIT-3DA639)
8
+
9
+ `@swifttui/build` turns a SwiftTUI app into the two artifacts the browser needs:
10
+ an `app.wasm` and a `scene-manifest.json`. It drives the Swift toolchain, runs a
11
+ browser `WebAssembly.compile` validation pass, and packages the result. It
12
+ intentionally sits outside [`@swifttui/web`](https://www.npmjs.com/package/@swifttui/web)
13
+ (the browser runtime) so runtime imports never pull in Swift process spawning,
14
+ Node filesystem APIs, or wasm packaging helpers.
15
+
16
+ - **Runtime counterpart:** [`@swifttui/web`](https://www.npmjs.com/package/@swifttui/web)
17
+ — mounts the artifacts this package produces.
18
+ - **Reference template:** [`swift-tui-examples/WebExample`](https://github.com/SwiftTUI/swift-tui-examples/tree/main/WebExample)
19
+ - **The framework:** [`SwiftTUI/swift-tui`](https://github.com/SwiftTUI/swift-tui)
9
20
 
10
21
  ## Installation
11
22
 
@@ -19,9 +30,18 @@ npm install --save-dev @swifttui/build
19
30
  This exposes the `swifttui-web` CLI (`npx swifttui-web build --app <Exe>`) and a
20
31
  programmatic ESM API. The package ships compiled `dist/` JavaScript — the bin
21
32
  runs on plain Node (`#!/usr/bin/env node`), no Bun or TypeScript toolchain
22
- required to consume it.
33
+ required to consume it. Building a SwiftTUI app to wasm does require a Swift
34
+ 6.3.x toolchain and the `swift-6.3.1-RELEASE_wasm` SDK on your machine.
35
+
36
+ ## Use
37
+
38
+ From the command line:
39
+
40
+ ```bash
41
+ npx swifttui-web build --app <AppExecutable>
42
+ ```
23
43
 
24
- ## API
44
+ Or programmatically:
25
45
 
26
46
  ```ts
27
47
  import { buildSwiftTUIWebApp } from "@swifttui/build";
@@ -48,7 +68,18 @@ Callers can override `swiftCommand`, `swiftSDK`, `configuration`,
48
68
  `initialMemory`, `maxMemory`, `stackSize`, `extraSwiftcFlags`,
49
69
  `extraLinkerFlags`, and `extraSwiftBuildArgs`.
50
70
 
51
- ## Scripts
71
+ > The WASI release flags (`-Osize` plus `-disable-llvm-merge-functions-pass`)
72
+ > keep the output under the browser `WebAssembly` API's 1000-parameter limit.
73
+ > The canonical command lives in this package — prefer the CLI/API over a
74
+ > hand-rolled `swift build`.
75
+
76
+ ## Developing this package
77
+
78
+ > Only needed if you are working **on** `@swifttui/build` itself. Consuming it
79
+ > from a project needs only `npm install --save-dev` (above).
80
+
81
+ Use Bun for the CLI, bundling, and tests, and `swiftly` Swift 6.3.1 for the wasm
82
+ build it invokes (not bare `swift`).
52
83
 
53
84
  - `bun test`
54
85
  - `bun run build` — compile the publishable package to `dist/` with tsdown
@@ -60,6 +91,10 @@ Callers can override `swiftCommand`, `swiftSDK`, `configuration`,
60
91
  The full app pipeline (manifest + wasm) is exposed through the CLI:
61
92
 
62
93
  ```bash
63
- bun run cli.ts build --app <AppExecutable> # from source
94
+ bun run cli.ts build --app <AppExecutable> # from source
64
95
  npx swifttui-web build --app <AppExecutable> # from the published bin
65
96
  ```
97
+
98
+ ## License
99
+
100
+ MIT — see [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swifttui/build",
3
- "version": "0.0.26",
3
+ "version": "0.1.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@swifttui/web": "0.0.26"
37
+ "@swifttui/web": "0.1.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/bun": "1.3.13"