Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
node-version: 22

- uses: mlugg/setup-zig@v2.0.5
- uses: mlugg/setup-zig@v2

- name: Install binaryen
run: |
Expand Down
10 changes: 5 additions & 5 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
.name = .playground,
.version = "0.0.0",
.fingerprint = 0xdc188848360fd988, // Changing this has security and trust implications.
.minimum_zig_version = "0.15.1",
.minimum_zig_version = "0.15.2",
.dependencies = .{
.zls = .{
.url = "git+https://github.com/zigtools/zls?ref=0.15.0#ce6c8f02c78e622421cfc2405c67c5222819ec03",
.hash = "zls-0.15.0-rmm5fkjqIwDZpmDHyKwxa9K2gcI3FPaGVFPwjYWFBM5B",
.url = "git+https://github.com/zigtools/zls?ref=0.15.1#f91b2e1e305e5d5bd3725aea90f9f9bfb3dce055",
.hash = "zls-0.15.1-rmm5fgQ2JADjDh84Ja3pDBZ1io_kKdHS2YhQyvBYz66r",
},
.zig = .{
.url = "git+https://github.com/zigtools/zig?ref=wasm32-wasi#3ee3d1aaf1db2e0501cd5372b68408be0c4c2133",
.hash = "zig-0.0.0-Fp4XJA38IQ3PPwA7sizQuTm_Ru1bH1ok-Yo6LH5a-F-B",
.url = "git+https://github.com/zigtools/zig?ref=wasm32-wasi#e123e17142e0576498ba7f14971e24565c242bd4",
.hash = "zig-0.0.0-Fp4XJMPnIg0zUDsFeLUD3kzBiBYbT_YSvJZo0pVB3tnR",
},
},
.paths = .{""},
Expand Down
7 changes: 2 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// @ts-ignore
import zigTarGz from "../zig-out/zig.tar.gz?inline";
import { untar } from "@andrewbranch/untar.js";
import { Directory, File, ConsoleStdout, wasi as wasi_defs } from "@bjorn3/browser_wasi_shim";

export async function getLatestZigArchive() {
const ds = new DecompressionStream("gzip");
const zigTarResponse = new Response((await fetch(zigTarGz)).body?.pipeThrough(ds));
const entries = await untar(await zigTarResponse.arrayBuffer());
const zigTarResponse = await fetch(new URL("../zig-out/zig.tar.gz", import.meta.url));
const entries = untar(await zigTarResponse.arrayBuffer());

let root: TreeNode = new Map();

Expand Down
4 changes: 1 addition & 3 deletions src/workers/zig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { WASI, PreopenDirectory, Fd, File, OpenFile, Inode } from "@bjorn3/browser_wasi_shim";
import { getLatestZigArchive, stderrOutput } from "../utils";
// @ts-ignore
import zigWasm from "../../zig-out/bin/zig.wasm?url";

let currentlyRunning = false;
async function run(source: string) {
Expand Down Expand Up @@ -36,7 +34,7 @@ async function run(source: string) {
] satisfies Fd[];
let wasi = new WASI(args, env, fds, { debug: false });

const { instance } = await WebAssembly.instantiateStreaming(fetch(zigWasm), {
const { instance } = await WebAssembly.instantiateStreaming(fetch(new URL("../../zig-out/bin/zig.wasm", import.meta.url)), {
"wasi_snapshot_preview1": wasi.wasiImport,
});

Expand Down
4 changes: 1 addition & 3 deletions src/workers/zls.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { WASI, PreopenDirectory, Fd, ConsoleStdout } from "@bjorn3/browser_wasi_shim";
import { getLatestZigArchive } from "../utils";
// @ts-ignore
import zlsWasm from "../../zig-out/bin/zls.wasm?url";

class Stdio extends Fd {
constructor() {
Expand Down Expand Up @@ -58,7 +56,7 @@ onmessage = (event) => {
];
let wasi = new WASI(args, env, fds, { debug: false });

const { instance: localInstance } = await WebAssembly.instantiateStreaming(fetch(zlsWasm), {
const { instance: localInstance } = await WebAssembly.instantiateStreaming(fetch(new URL("../../zig-out/bin/zls.wasm", import.meta.url)), {
"wasi_snapshot_preview1": wasi.wasiImport,
});

Expand Down
1 change: 0 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { defineConfig } from "vite";
export default defineConfig({
assetsInclude: ['**/*.tar.gz'],
plugins: [],
});