also looking at this
fix(ci): build the SDK types with the repo's own tsc (and pin the pantry action)
#104
29 files
+85
-56
| @@ -35,7 +35,7 @@ jobs: | ||
| 35 | 35 | fetch-depth: 0 |
| 36 | 36 | |
| 37 | 37 | - name: Setup Zig |
| 38 | uses: pantry-pm/pantry/packages/action@main | |
| 38 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 39 | 39 | - name: Install Linux dependencies |
| 40 | 40 | run: | |
| 41 | 41 | sudo apt-get update |
| @@ -49,7 +49,7 @@ jobs: | ||
| 49 | 49 | fetch-depth: 0 |
| 50 | 50 | |
| 51 | 51 | - name: Setup Zig |
| 52 | uses: pantry-pm/pantry/packages/action@main | |
| 52 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 53 | 53 | - name: Install Linux dependencies |
| 54 | 54 | run: | |
| 55 | 55 | sudo apt-get update |
| @@ -32,7 +32,7 @@ jobs: | ||
| 32 | 32 | - uses: actions/checkout@v6 |
| 33 | 33 | |
| 34 | 34 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 35 | uses: pantry-pm/pantry/packages/action@main | |
| 35 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 36 | 36 | |
| 37 | 37 | - name: Verify Zig installation |
| 38 | 38 | run: eval "$(pantry env | sed -n '/^export /,$p')" && zig version |
| @@ -80,7 +80,7 @@ jobs: | ||
| 80 | 80 | - uses: actions/checkout@v6 |
| 81 | 81 | |
| 82 | 82 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 83 | uses: pantry-pm/pantry/packages/action@main | |
| 83 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 84 | 84 | |
| 85 | 85 | - name: Install dependencies |
| 86 | 86 | run: bun install |
| @@ -116,7 +116,7 @@ jobs: | ||
| 116 | 116 | - uses: actions/checkout@v6 |
| 117 | 117 | |
| 118 | 118 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 119 | uses: pantry-pm/pantry/packages/action@main | |
| 119 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 120 | 120 | |
| 121 | 121 | - name: Install dependencies |
| 122 | 122 | run: bun install |
| @@ -132,7 +132,7 @@ jobs: | ||
| 132 | 132 | - uses: actions/checkout@v6 |
| 133 | 133 | |
| 134 | 134 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 135 | uses: pantry-pm/pantry/packages/action@main | |
| 135 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 136 | 136 | |
| 137 | 137 | - name: Install dependencies |
| 138 | 138 | run: bun install |
| @@ -156,7 +156,7 @@ jobs: | ||
| 156 | 156 | - uses: actions/checkout@v6 |
| 157 | 157 | |
| 158 | 158 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 159 | uses: pantry-pm/pantry/packages/action@main | |
| 159 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 160 | 160 | |
| 161 | 161 | - name: Install dependencies |
| 162 | 162 | run: bun install |
| @@ -179,7 +179,7 @@ jobs: | ||
| 179 | 179 | - uses: actions/checkout@v6 |
| 180 | 180 | |
| 181 | 181 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 182 | uses: pantry-pm/pantry/packages/action@main | |
| 182 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 183 | 183 | |
| 184 | 184 | - name: Install dependencies |
| 185 | 185 | run: bun install |
| @@ -228,7 +228,7 @@ jobs: | ||
| 228 | 228 | fetch-depth: 0 |
| 229 | 229 | |
| 230 | 230 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 231 | uses: pantry-pm/pantry/packages/action@main | |
| 231 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 232 | 232 | |
| 233 | 233 | - name: Install Dependencies |
| 234 | 234 | run: bun install |
| @@ -29,7 +29,7 @@ jobs: | ||
| 29 | 29 | - uses: actions/checkout@v6 |
| 30 | 30 | |
| 31 | 31 | - name: Setup Zig |
| 32 | uses: pantry-pm/pantry/packages/action@main | |
| 32 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 33 | 33 | - name: Setup Xcode |
| 34 | 34 | uses: maxim-lobanov/setup-xcode@v1 |
| 35 | 35 | with: |
| @@ -142,7 +142,7 @@ jobs: | ||
| 142 | 142 | - uses: actions/checkout@v6 |
| 143 | 143 | |
| 144 | 144 | - name: Setup Zig |
| 145 | uses: pantry-pm/pantry/packages/action@main | |
| 145 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 146 | 146 | - name: Setup Java |
| 147 | 147 | uses: actions/setup-java@v4 |
| 148 | 148 | with: |
| @@ -52,7 +52,7 @@ jobs: | ||
| 52 | 52 | - uses: actions/checkout@v6 |
| 53 | 53 | |
| 54 | 54 | - name: Setup Pantry (provides Bun) |
| 55 | uses: pantry-pm/pantry/packages/action@main | |
| 55 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 56 | 56 | |
| 57 | 57 | - name: Install dependencies |
| 58 | 58 | run: bun install --frozen-lockfile |
| @@ -42,7 +42,7 @@ jobs: | ||
| 42 | 42 | fetch-depth: 0 |
| 43 | 43 | |
| 44 | 44 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 45 | uses: pantry-pm/pantry/packages/action@main | |
| 45 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 46 | 46 | |
| 47 | 47 | - name: Install System Dependencies |
| 48 | 48 | if: matrix.platform.deps != '' |
| @@ -290,7 +290,7 @@ jobs: | ||
| 290 | 290 | # 2. Auto-packages binaries from zig-out/ into platform-named zips |
| 291 | 291 | # 3. Creates/updates GitHub release with all artifacts + changelog |
| 292 | 292 | - name: Publish & Release |
| 293 | uses: pantry-pm/pantry/packages/action@main | |
| 293 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 294 | 294 | with: |
| 295 | 295 | install: 'false' |
| 296 | 296 | publish: 'zig' |
| @@ -427,7 +427,7 @@ jobs: | ||
| 427 | 427 | fetch-depth: 0 |
| 428 | 428 | |
| 429 | 429 | - name: Setup Pantry (provides Bun, Zig, etc.) |
| 430 | uses: pantry-pm/pantry/packages/action@main | |
| 430 | uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 | |
| 431 | 431 | - name: Install Dependencies |
| 432 | 432 | run: bun install |
| 433 | 433 | |
| @@ -5,6 +5,13 @@ dependencies: | ||
| 5 | 5 | bun.sh: 1.3.14 |
| 6 | 6 | # Also pinned exactly. `^0.17.0-dev` floats on Zig's *dev* channel, so any |
| 7 | 7 | # `pantry install` can swap the compiler out from under a build — observed |
| 8 | # jumping 1509 -> 1606 unprompted. This is the version v0.0.58 was released | |
| 9 | # with. Bump deliberately, and rebuild when you do. | |
| 10 | ziglang.org: 0.17.0-dev.1509_bb296ab9b | |
| 8 | # jumping 1509 -> 1606 unprompted. Bump deliberately, and rebuild when you do. | |
| 9 | # | |
| 10 | # The pin has a shelf life, which 1509 is how we found out. ziglang.org | |
| 11 | # serves exactly one dev build — whatever master is now — plus the tagged | |
| 12 | # releases, and prunes the rest. Every platform tarball for 1509 returned | |
| 13 | # 404, so CI was running on cached toolchains and any uncached runner failed | |
| 14 | # to provision at all: `darwin-x64` went red on a lockfile-free PR, and the | |
| 15 | # next tagged release would have failed the same way. A pinned dev build is | |
| 16 | # reproducible only for as long as it is master. | |
| 17 | ziglang.org: 0.17.0-dev.1963_e00c6c439 | |
| @@ -488,7 +488,7 @@ Per `CLAUDE.md`'s distribution rule, the `.so` resolution lives here in the Andr | ||
| 488 | 488 | | Phase A0 | pinned Zig only | ✅ works today | |
| 489 | 489 | | Phase A1+ | Android SDK, NDK (pinned `26.1.10909125`), `adb`, `gradle` | ❌ none present | |
| 490 | 490 | |
| 491 | Zig is pinned at `0.17.0-dev.1509+bb296ab9b`. | |
| 491 | Zig is pinned at `0.17.0-dev.1963+e00c6c439`. | |
| 492 | 492 | |
| 493 | 493 | --- |
| 494 | 494 | |
| @@ -385,7 +385,7 @@ gated on `hashFiles('packages/ios/TestApp/TestApp.xcodeproj')`, which has never | ||
| 385 | 385 | | Phase 0 | nothing beyond the pinned Zig | ✅ works today on Command Line Tools | |
| 386 | 386 | | Phase 1+ | full Xcode — SDK, simulator runtime | ❌ install required | |
| 387 | 387 | |
| 388 | Zig is pinned at `0.17.0-dev.1509+bb296ab9b`. Clear `.zig-cache` between heavy rounds. | |
| 388 | Zig is pinned at `0.17.0-dev.1963+e00c6c439`. Clear `.zig-cache` between heavy rounds. | |
| 389 | 389 | |
| 390 | 390 | --- |
| 391 | 391 | |
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | set -euo pipefail |
| 8 | 8 | |
| 9 | 9 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" |
| 10 | ZIG="${CRAFT_ZIG:-$HOME/.cache/craft-ci-local/zig-aarch64-macos-0.17.0-dev.1509+bb296ab9b/zig}" | |
| 10 | ZIG="${CRAFT_ZIG:-$HOME/.cache/craft-ci-local/zig-aarch64-macos-0.17.0-dev.1963+e00c6c439/zig}" | |
| 11 | 11 | FIXTURE="$ROOT/packages/ios/fixtures/zig-slice" |
| 12 | 12 | OUT="${1:-$FIXTURE/build}" |
| 13 | 13 | BUNDLE_ID="app.craft.slice" |
| @@ -25,8 +25,9 @@ async function build(entrypoints: string[], outdir: string): Promise<void> { | ||
| 25 | 25 | // their implementation and templates instead of importing unpublished peers. |
| 26 | 26 | await build(['../ios/src/index.ts'], 'dist/ios/src') |
| 27 | 27 | await build(['../android/src/index.ts'], 'dist/android/src') |
| 28 | await Bun.$`bunx tsc ${resolve(root, '../ios/src/index.ts')} --declaration --emitDeclarationOnly --module esnext --target esnext --moduleResolution bundler --types bun --skipLibCheck --ignoreConfig --outDir ${resolve(dist, 'ios/src')}` | |
| 29 | await Bun.$`bunx tsc ${resolve(root, '../android/src/index.ts')} --declaration --emitDeclarationOnly --module esnext --target esnext --moduleResolution bundler --types bun --skipLibCheck --ignoreConfig --outDir ${resolve(dist, 'android/src')}` | |
| 28 | // scripts/tsc.ts, not `bunx tsc`: PATH is not trustworthy in CI. See that file. | |
| 29 | await Bun.$`bun ${resolve(root, "scripts/tsc.ts")} ${resolve(root, '../ios/src/index.ts')} --declaration --emitDeclarationOnly --module esnext --target esnext --moduleResolution bundler --types bun --skipLibCheck --ignoreConfig --outDir ${resolve(dist, 'ios/src')}` | |
| 30 | await Bun.$`bun ${resolve(root, "scripts/tsc.ts")} ${resolve(root, '../android/src/index.ts')} --declaration --emitDeclarationOnly --module esnext --target esnext --moduleResolution bundler --types bun --skipLibCheck --ignoreConfig --outDir ${resolve(dist, 'android/src')}` | |
| 30 | 31 | await cp(resolve(root, '../ios/templates'), resolve(dist, 'ios/templates'), { recursive: true }) |
| 31 | 32 | await cp(resolve(root, '../android/templates'), resolve(dist, 'android/templates'), { recursive: true }) |
| 32 | 33 | |
| @@ -81,7 +81,7 @@ | ||
| 81 | 81 | "scripts": { |
| 82 | 82 | "build": "bun build.ts && bun run build:types", |
| 83 | 83 | "build:lib": "bun build src/index.ts --outdir dist --format esm --target bun && bun build src/index.ts --outfile dist/index.cjs --format cjs --target node", |
| 84 | "build:types": "bun run tsc -p tsconfig.build.json && cp dist/index.d.ts dist/index.d.cts", | |
| 84 | "build:types": "bun scripts/tsc.ts -p tsconfig.build.json && cp dist/index.d.ts dist/index.d.cts", | |
| 85 | 85 | "dev": "bun --watch src/index.ts", |
| 86 | 86 | "lint": "bunx --bun pickier lint . --config ../../pickier.config.ts --max-warnings 9999", |
| 87 | 87 | "lint:fix": "bunx --bun pickier lint . --fix --config ../../pickier.config.ts --max-warnings 9999", |
| @@ -0,0 +1,21 @@ | ||
| 1 | /** | |
| 2 | * Run the `tsc` this package declares, not the one on PATH. | |
| 3 | * | |
| 4 | * `bunx tsc` resolves through PATH. In CI the pantry action provisions its own | |
| 5 | * typescript into `<repo>/pantry` and puts it ahead of `node_modules/.bin`, so | |
| 6 | * the same command silently ran a different compiler — a dev build the | |
| 7 | * lockfile never pinned, and one whose linux-x64 platform binary is missing: | |
| 8 | * | |
| 9 | * Error: Unable to resolve @typescript/typescript-linux-x64. | |
| 10 | * | |
| 11 | * Locally nothing shadows `node_modules/.bin`, which is why the break only | |
| 12 | * ever showed up in one CI job. Resolving through the module graph instead of | |
| 13 | * PATH makes both places run the version `bun.lock` says. | |
| 14 | */ | |
| 15 | import { dirname, join } from 'node:path' | |
| 16 | ||
| 17 | const pkgRoot = dirname(dirname(Bun.resolveSync('typescript', import.meta.dir))) | |
| 18 | const tsc = join(pkgRoot, 'bin', 'tsc') | |
| 19 | ||
| 20 | const proc = Bun.spawn(['bun', tsc, ...Bun.argv.slice(2)], { stdio: ['inherit', 'inherit', 'inherit'] }) | |
| 21 | process.exit(await proc.exited) | |
| @@ -276,7 +276,7 @@ pub const BenchmarkSuite = struct { | ||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | pub fn generateReport(self: *const BenchmarkSuite, allocator: std.mem.Allocator) ![]const u8 { |
| 279 | var buf = std.ArrayList(u8){ .items = &.{}, .capacity = 0 }; | |
| 279 | var buf = std.ArrayList(u8).empty; | |
| 280 | 280 | errdefer buf.deinit(allocator); |
| 281 | 281 | |
| 282 | 282 | const header = try std.fmt.allocPrint(allocator, "Benchmark Suite: {s}\n", .{self.name}); |
| @@ -301,7 +301,7 @@ pub const BenchmarkSuite = struct { | ||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | pub fn generateJSON(self: *const BenchmarkSuite, allocator: std.mem.Allocator) ![]const u8 { |
| 304 | var buf = std.ArrayList(u8){ .items = &.{}, .capacity = 0 }; | |
| 304 | var buf = std.ArrayList(u8).empty; | |
| 305 | 305 | errdefer buf.deinit(allocator); |
| 306 | 306 | |
| 307 | 307 | try buf.appendSlice(allocator, "{"); |
| @@ -422,7 +422,7 @@ pub fn benchmarkArrayListOperations(allocator: std.mem.Allocator, operations: us | ||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | fn arrayListOps(allocator: std.mem.Allocator, ops: usize) !void { |
| 425 | var list = std.ArrayList(usize){ .items = &.{}, .capacity = 0 }; | |
| 425 | var list = std.ArrayList(usize).empty; | |
| 426 | 426 | defer list.deinit(allocator); |
| 427 | 427 | |
| 428 | 428 | var i: usize = 0; |
| @@ -193,7 +193,7 @@ pub const ClipboardBridge = struct { | ||
| 193 | 193 | log.debug("Read text from clipboard: {s}", .{text_str}); |
| 194 | 194 | |
| 195 | 195 | // Escape backslashes and quotes for safe JSON embedding |
| 196 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 196 | var buf: std.ArrayList(u8) = .empty; | |
| 197 | 197 | defer buf.deinit(self.allocator); |
| 198 | 198 | |
| 199 | 199 | try buf.appendSlice(self.allocator, "{\"text\":\""); |
| @@ -306,7 +306,7 @@ pub const ClipboardBridge = struct { | ||
| 306 | 306 | const html_str = std.mem.span(@as([*:0]const u8, @ptrCast(html_cstr))); |
| 307 | 307 | log.debug("Read HTML from clipboard: {s}", .{html_str}); |
| 308 | 308 | |
| 309 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 309 | var buf: std.ArrayList(u8) = .empty; | |
| 310 | 310 | defer buf.deinit(self.allocator); |
| 311 | 311 | |
| 312 | 312 | try buf.appendSlice(self.allocator, "{\"html\":\""); |
| @@ -432,7 +432,7 @@ pub const DialogBridge = struct { | ||
| 432 | 432 | if (comptime builtin.mode == .debug) |
| 433 | 433 | std.debug.print("[DialogBridge] Selected file: {s}\n", .{path_str}); |
| 434 | 434 | |
| 435 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 435 | var buf: std.ArrayList(u8) = .empty; | |
| 436 | 436 | defer buf.deinit(self.allocator); |
| 437 | 437 | |
| 438 | 438 | try buf.appendSlice(self.allocator, "{\"canceled\":false,\"filePaths\":[\""); |
| @@ -502,7 +502,7 @@ pub const DialogBridge = struct { | ||
| 502 | 502 | if (comptime builtin.mode == .debug) |
| 503 | 503 | std.debug.print("[DialogBridge] Selected {d} files\n", .{count}); |
| 504 | 504 | |
| 505 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 505 | var buf: std.ArrayList(u8) = .empty; | |
| 506 | 506 | defer buf.deinit(self.allocator); |
| 507 | 507 | |
| 508 | 508 | try buf.appendSlice(self.allocator, "{\"canceled\":false,\"filePaths\":["); |
| @@ -581,7 +581,7 @@ pub const DialogBridge = struct { | ||
| 581 | 581 | if (comptime builtin.mode == .debug) |
| 582 | 582 | std.debug.print("[DialogBridge] Selected folder: {s}\n", .{path_str}); |
| 583 | 583 | |
| 584 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 584 | var buf: std.ArrayList(u8) = .empty; | |
| 585 | 585 | defer buf.deinit(self.allocator); |
| 586 | 586 | |
| 587 | 587 | try buf.appendSlice(self.allocator, "{\"canceled\":false,\"filePaths\":[\""); |
| @@ -645,7 +645,7 @@ pub const DialogBridge = struct { | ||
| 645 | 645 | if (comptime builtin.mode == .debug) |
| 646 | 646 | std.debug.print("[DialogBridge] Save path: {s}\n", .{path_str}); |
| 647 | 647 | |
| 648 | var buf: std.ArrayList(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 648 | var buf: std.ArrayList(u8) = .empty; | |
| 649 | 649 | defer buf.deinit(self.allocator); |
| 650 | 650 | |
| 651 | 651 | try buf.appendSlice(self.allocator, "{\"canceled\":false,\"filePath\":\""); |
| @@ -228,7 +228,7 @@ pub const NativeUIBridge = struct { | ||
| 228 | 228 | /// The returned slice borrows every string from `parsed`, so it must be |
| 229 | 229 | /// consumed before the parse arena is freed — `SpaceList.append` copies. |
| 230 | 230 | fn parseSpaces(allocator: std.mem.Allocator, value: std.json.Value) !std.ArrayList(space_switcher.Space) { |
| 231 | var spaces: std.ArrayList(space_switcher.Space) = .{ .items = &.{}, .capacity = 0 }; | |
| 231 | var spaces: std.ArrayList(space_switcher.Space) = .empty; | |
| 232 | 232 | errdefer spaces.deinit(allocator); |
| 233 | 233 | |
| 234 | 234 | for (value.array.items) |entry| { |
| @@ -270,7 +270,7 @@ pub const NativeUIBridge = struct { | ||
| 270 | 270 | var spaces = if (root.get("spaces")) |v| |
| 271 | 271 | try parseSpaces(self.allocator, v) |
| 272 | 272 | else |
| 273 | std.ArrayList(space_switcher.Space){ .items = &.{}, .capacity = 0 }; | |
| 273 | std.ArrayList(space_switcher.Space).empty; | |
| 274 | 274 | defer spaces.deinit(self.allocator); |
| 275 | 275 | |
| 276 | 276 | const active = if (root.get("activeSpace")) |v| switch (v) { |
| @@ -366,7 +366,7 @@ pub const NativeUIBridge = struct { | ||
| 366 | 366 | const section_label = if (section_obj.get("label")) |v| v.string else if (section_obj.get("title")) |v| v.string else section_id; |
| 367 | 367 | const items_value = section_obj.get("items") orelse continue; |
| 368 | 368 | |
| 369 | var items: std.ArrayList(NativeSidebar.SidebarItem) = .{ .items = &.{}, .capacity = 0 }; | |
| 369 | var items: std.ArrayList(NativeSidebar.SidebarItem) = .empty; | |
| 370 | 370 | defer items.deinit(self.allocator); |
| 371 | 371 | |
| 372 | 372 | for (items_value.array.items) |item_value| { |
| @@ -481,7 +481,7 @@ pub const NativeUIBridge = struct { | ||
| 481 | 481 | const items_json = section_data.get("items").?.array; |
| 482 | 482 | |
| 483 | 483 | // Build items array |
| 484 | var items: std.ArrayList(NativeSidebar.SidebarItem) = .{ .items = &.{}, .capacity = 0 }; | |
| 484 | var items: std.ArrayList(NativeSidebar.SidebarItem) = .empty; | |
| 485 | 485 | defer items.deinit(self.allocator); |
| 486 | 486 | |
| 487 | 487 | for (items_json.items) |item_json| { |
| @@ -596,7 +596,7 @@ pub const NativeUIBridge = struct { | ||
| 596 | 596 | |
| 597 | 597 | const browser = self.file_browsers.get(browser_id) orelse return error.BrowserNotFound; |
| 598 | 598 | |
| 599 | var files: std.ArrayList(NativeFileBrowser.FileItem) = .{ .items = &.{}, .capacity = 0 }; | |
| 599 | var files: std.ArrayList(NativeFileBrowser.FileItem) = .empty; | |
| 600 | 600 | defer files.deinit(self.allocator); |
| 601 | 601 | |
| 602 | 602 | for (files_json.items) |file_json| { |
| @@ -766,7 +766,7 @@ pub const NativeUIBridge = struct { | ||
| 766 | 766 | |
| 767 | 767 | // Parse menu items |
| 768 | 768 | const items_json = root.get("items").?.array; |
| 769 | var items: std.ArrayList(context_menu.MenuItem) = .{ .items = &.{}, .capacity = 0 }; | |
| 769 | var items: std.ArrayList(context_menu.MenuItem) = .empty; | |
| 770 | 770 | defer items.deinit(self.allocator); |
| 771 | 771 | |
| 772 | 772 | for (items_json.items) |item_json| { |
| @@ -785,7 +785,7 @@ pub const NativeUIBridge = struct { | ||
| 785 | 785 | if (item_type == .submenu) { |
| 786 | 786 | if (item_obj.get("submenu")) |submenu_json| { |
| 787 | 787 | if (submenu_json == .array) { |
| 788 | var submenu_list: std.ArrayList(context_menu.MenuItem) = .{ .items = &.{}, .capacity = 0 }; | |
| 788 | var submenu_list: std.ArrayList(context_menu.MenuItem) = .empty; | |
| 789 | 789 | for (submenu_json.array.items) |sub_item_json| { |
| 790 | 790 | if (sub_item_json == .object) { |
| 791 | 791 | const sub_obj = sub_item_json.object; |
| @@ -30,7 +30,7 @@ pub const OutlineViewDataSource = struct { | ||
| 30 | 30 | |
| 31 | 31 | pub fn init(allocator: std.mem.Allocator) DataStore { |
| 32 | 32 | return .{ |
| 33 | .sections = .{ .items = &.{}, .capacity = 0 }, | |
| 33 | .sections = .empty, | |
| 34 | 34 | .allocator = allocator, |
| 35 | 35 | }; |
| 36 | 36 | } |
| @@ -22,7 +22,7 @@ pub const QuickLookCallbackData = struct { | ||
| 22 | 22 | pub fn init(allocator: std.mem.Allocator) !*QuickLookCallbackData { |
| 23 | 23 | const data = try allocator.create(QuickLookCallbackData); |
| 24 | 24 | data.* = .{ |
| 25 | .preview_items = .{ .items = &.{}, .capacity = 0 }, | |
| 25 | .preview_items = .empty, | |
| 26 | 26 | .current_index = 0, |
| 27 | 27 | .allocator = allocator, |
| 28 | 28 | }; |
| @@ -22,7 +22,7 @@ pub const SpaceList = struct { | ||
| 22 | 22 | active: ?usize = null, |
| 23 | 23 | |
| 24 | 24 | pub fn init(allocator: std.mem.Allocator) SpaceList { |
| 25 | return .{ .allocator = allocator, .spaces = .{ .items = &.{}, .capacity = 0 } }; | |
| 25 | return .{ .allocator = allocator, .spaces = .empty }; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | pub fn deinit(self: *SpaceList) void { |
| @@ -25,7 +25,7 @@ pub const TableViewDataSource = struct { | ||
| 25 | 25 | |
| 26 | 26 | pub fn init(allocator: std.mem.Allocator) DataStore { |
| 27 | 27 | return .{ |
| 28 | .files = .{ .items = &.{}, .capacity = 0 }, | |
| 28 | .files = .empty, | |
| 29 | 29 | .allocator = allocator, |
| 30 | 30 | }; |
| 31 | 31 | } |
| @@ -210,7 +210,7 @@ pub const ErrorDisplay = struct { | ||
| 210 | 210 | color_output: bool = true, |
| 211 | 211 | |
| 212 | 212 | pub fn formatError(self: ErrorDisplay, allocator: std.mem.Allocator, err: anyerror, context: []const u8, file: []const u8, line: u32) ![]const u8 { |
| 213 | var buf = std.ArrayList(u8){ .items = &.{}, .capacity = 0 }; | |
| 213 | var buf = std.ArrayList(u8).empty; | |
| 214 | 214 | const writer = buf.writer(allocator); |
| 215 | 215 | |
| 216 | 216 | // Header with emoji for visibility |
| @@ -454,7 +454,7 @@ pub const ReloadServer = struct { | ||
| 454 | 454 | pub fn broadcast(self: *Self, message: []const u8) !void { |
| 455 | 455 | if (!self.running) return; |
| 456 | 456 | |
| 457 | var disconnected: std.ArrayList(usize) = .{ .items = &.{}, .capacity = 0 }; | |
| 457 | var disconnected: std.ArrayList(usize) = .empty; | |
| 458 | 458 | defer disconnected.deinit(self.allocator); |
| 459 | 459 | |
| 460 | 460 | // Send to all clients |
| @@ -5003,7 +5003,7 @@ pub fn tryEvalJS(js_code: []const u8) !void { | ||
| 5003 | 5003 | /// Handle incoming messages from JavaScript bridge |
| 5004 | 5004 | /// Convert a JSON Value to string |
| 5005 | 5005 | fn jsonValueToString(allocator: std.mem.Allocator, value: std.json.Value) ![]const u8 { |
| 5006 | var buf: std.ArrayListUnmanaged(u8) = .{ .items = &.{}, .capacity = 0 }; | |
| 5006 | var buf: std.ArrayListUnmanaged(u8) = .empty; | |
| 5007 | 5007 | errdefer buf.deinit(allocator); |
| 5008 | 5008 | |
| 5009 | 5009 | switch (value) { |
| @@ -209,8 +209,8 @@ pub const App = struct { | ||
| 209 | 209 | pub fn init(allocator: std.mem.Allocator) Self { |
| 210 | 210 | return .{ |
| 211 | 211 | .allocator = allocator, |
| 212 | .windows = .{ .items = &.{}, .capacity = 0 }, | |
| 213 | .system_trays = .{ .items = &.{}, .capacity = 0 }, | |
| 212 | .windows = .empty, | |
| 213 | .system_trays = .empty, | |
| 214 | 214 | .bridge = null, |
| 215 | 215 | .notifications = null, |
| 216 | 216 | }; |
| @@ -7,6 +7,6 @@ | ||
| 7 | 7 | "bun.sh": "1.3.14", |
| 8 | 8 | // Pinned exactly — `^0.17.0-dev` floats on Zig's dev channel and swaps the |
| 9 | 9 | // compiler out from under a build. Keep in step with deps.yaml. |
| 10 | "ziglang.org": "0.17.0-dev.1509_bb296ab9b" | |
| 10 | "ziglang.org": "0.17.0-dev.1963_e00c6c439" | |
| 11 | 11 | } |
| 12 | 12 | } |
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | }, |
| 14 | 14 | "system": { |
| 15 | 15 | "bun.sh": "1.3.14", |
| 16 | "ziglang.org": "0.17.0-dev.1509_bb296ab9b" | |
| 16 | "ziglang.org": "0.17.0-dev.1963_e00c6c439" | |
| 17 | 17 | } |
| 18 | 18 | }, |
| 19 | 19 | "benchmarks": { |
| @@ -418,11 +418,11 @@ | ||
| 418 | 418 | "typescript" |
| 419 | 419 | ] |
| 420 | 420 | }, |
| 421 | "ziglang.org@0.17.0-dev.1509_bb296ab9b": { | |
| 421 | "ziglang.org@0.17.0-dev.1963_e00c6c439": { | |
| 422 | 422 | "name": "ziglang.org", |
| 423 | "version": "0.17.0-dev.1509_bb296ab9b", | |
| 423 | "version": "0.17.0-dev.1963_e00c6c439", | |
| 424 | 424 | "source": "pantry", |
| 425 | "resolved": "registry:ziglang.org@0.17.0-dev.1509_bb296ab9b" | |
| 425 | "resolved": "registry:ziglang.org@0.17.0-dev.1963_e00c6c439" | |
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |