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
4 changes: 3 additions & 1 deletion EMBEDDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ import { NodeUnixSocketTransport, loadBlitWasm } from "@blit-sh/core/node";
// `@blit-sh/browser/node` build it is returned as-is.)
const wasm = await loadBlitWasm();

const transport = new NodeUnixSocketTransport(process.env.BLIT_SOCK ?? "/tmp/blit.sock");
const transport = new NodeUnixSocketTransport(
process.env.BLIT_SOCK ?? "/tmp/blit.sock",
);
const workspace = new BlitWorkspace({
wasm,
logger: nullLogger, // no-op logger; omit to log lifecycle events to console
Expand Down
9 changes: 4 additions & 5 deletions js/core/src/BlitConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,11 +1262,10 @@ export class BlitConnection {
// may omit the status; default to EXIT_STATUS_UNKNOWN.
const exitStatus =
bytes.length >= 7
? new DataView(
bytes.buffer,
bytes.byteOffset + 3,
4,
).getInt32(0, true)
? new DataView(bytes.buffer, bytes.byteOffset + 3, 4).getInt32(
0,
true,
)
: EXIT_STATUS_UNKNOWN;
this.updateSession(sessionId, { state: "exited", exitStatus });
}
Expand Down
8 changes: 6 additions & 2 deletions js/core/src/__tests__/BlitTerminalSurface.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ describe("BlitTerminalSurface Android composition", () => {
fireCompositionInput(input, "hel", "insertCompositionText");
fireCompositionInput(input, "hell", "insertCompositionText");
fireCompositionInput(input, "hello", "insertCompositionText");
input.dispatchEvent(new CompositionEvent("compositionend", { data: "hello" }));
input.dispatchEvent(
new CompositionEvent("compositionend", { data: "hello" }),
);

const calls = sendInput.mock.calls.map((c) =>
new TextDecoder().decode(c[1] as Uint8Array),
Expand All @@ -303,7 +305,9 @@ describe("BlitTerminalSurface Android composition", () => {
fireCompositionInput(input, "hel", "insertCompositionText");
fireCompositionInput(input, "helo", "insertCompositionText");
fireCompositionInput(input, "hel", "insertCompositionText");
input.dispatchEvent(new CompositionEvent("compositionend", { data: "hel" }));
input.dispatchEvent(
new CompositionEvent("compositionend", { data: "hel" }),
);

const calls = sendInput.mock.calls.map((c) =>
Array.from(c[1] as Uint8Array),
Expand Down
15 changes: 10 additions & 5 deletions js/core/src/node-wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ import type { BlitWasmModule } from "./TerminalStore";
* with `@blit-sh/browser`.
*/
export async function loadBlitWasm(wasmPath?: string): Promise<BlitWasmModule> {
const mod = (await import("@blit-sh/browser")) as unknown as BlitWasmModule & {
default?: unknown;
};
const mod =
(await import("@blit-sh/browser")) as unknown as BlitWasmModule & {
default?: unknown;
};

// A self-initializing build (`--target nodejs`/`bundler`) has already
// instantiated the module on import and exposes no `init` default export.
Expand All @@ -41,8 +42,12 @@ export async function loadBlitWasm(wasmPath?: string): Promise<BlitWasmModule> {

const location =
wasmPath ?? import.meta.resolve("@blit-sh/browser/blit_browser_bg.wasm");
const path = location.startsWith("file:") ? fileURLToPath(location) : location;
const path = location.startsWith("file:")
? fileURLToPath(location)
: location;
const bytes = await readFile(path);
await init({ module_or_path: bytes as unknown as Parameters<typeof init>[0] });
await init({
module_or_path: bytes as unknown as Parameters<typeof init>[0],
});
return mod;
}
Loading
Loading