Skip to content

Commit a35575e

Browse files
Apply npm run format
1 parent efcf5c4 commit a35575e

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

packages/npm-packages/ruby-wasm-wasi/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
This package is a template for each channel-specific package.
44

5-
| Channel | Package |
6-
| ------- | ------- |
5+
| Channel | Package |
6+
| ------- | ------------------------------------------------- |
77
| `head` | [`ruby-head-wasm-wasi`](./../ruby-head-wasm-wasi) |
8-

packages/npm-packages/ruby-wasm-wasi/src/index.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ export class RubyVM {
9595
return value;
9696
},
9797
rbObjectToJsRbValue: (rawRbAbiValue) => {
98-
const abiValue = new (RbAbi.RbAbiValue as any)(rawRbAbiValue, this.guest);
99-
return new RbValue(abiValue, this, this.privateObject());
98+
const abiValue = new (RbAbi.RbAbiValue as any)(
99+
rawRbAbiValue,
100+
this.guest
101+
);
102+
return new RbValue(abiValue, this, this.privateObject());
100103
},
101104
jsValueToString: (value) => {
102105
return value.toString();
@@ -197,7 +200,10 @@ export class RubyVM {
197200
}
198201

199202
private privateObject(): RubyVMPrivate {
200-
return { transport: this.transport, exceptionFormatter: this.exceptionFormatter }
203+
return {
204+
transport: this.transport,
205+
exceptionFormatter: this.exceptionFormatter,
206+
};
201207
}
202208
}
203209

@@ -330,11 +336,10 @@ enum ruby_tag_type {
330336
}
331337

332338
type RubyVMPrivate = {
333-
transport: JsValueTransport,
334-
exceptionFormatter: RbExceptionFormatter,
339+
transport: JsValueTransport;
340+
exceptionFormatter: RbExceptionFormatter;
335341
};
336342

337-
338343
class RbExceptionFormatter {
339344
private literalsCache: [RbValue, RbValue, RbValue] | null = null;
340345

@@ -344,7 +349,7 @@ class RbExceptionFormatter {
344349
const zeroOneNewLine: [RbValue, RbValue, RbValue] = [
345350
evalRbCode(vm, privateObject, "0"),
346351
evalRbCode(vm, privateObject, "1"),
347-
evalRbCode(vm, privateObject, `"\n"`)
352+
evalRbCode(vm, privateObject, `"\n"`),
348353
];
349354
this.literalsCache = zeroOneNewLine;
350355
return zeroOneNewLine;
@@ -355,11 +360,13 @@ class RbExceptionFormatter {
355360

356361
const backtrace = error.call("backtrace");
357362
const firstLine = backtrace.call("at", zeroLiteral);
358-
const restLines = backtrace.call("drop", oneLiteral).call("join", newLineLiteral);
363+
const restLines = backtrace
364+
.call("drop", oneLiteral)
365+
.call("join", newLineLiteral);
359366
return this.formatString(error.call("class").toString(), error.toString(), [
360367
firstLine.toString(),
361368
restLines.toString(),
362-
])
369+
]);
363370
}
364371

365372
formatString(
@@ -368,7 +375,7 @@ class RbExceptionFormatter {
368375
backtrace: [string, string]
369376
): string {
370377
return `${backtrace[0]}: ${message} (${klass})\n${backtrace[1]}`;
371-
};
378+
}
372379
}
373380

374381
const checkStatusTag = (
@@ -399,7 +406,9 @@ const checkStatusTag = (
399406
}
400407
// clear errinfo if got exception due to no rb_jump_tag
401408
vm.guest.rbClearErrinfo();
402-
throw new RbError(privateObject.exceptionFormatter.format(error, vm, privateObject));
409+
throw new RbError(
410+
privateObject.exceptionFormatter.format(error, vm, privateObject)
411+
);
403412
default:
404413
throw new RbError(`unknown error tag: ${rawTag}`);
405414
}

packages/npm-packages/ruby-wasm-wasi/test/package.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ describe("Packaging validation", () => {
3838
const mod = await WebAssembly.compile(binary.buffer);
3939
const { vm } = await initRubyVM(mod, ["ruby.wasm", "-e_=0"]);
4040
// Check loading ext library
41-
vm.eval(`require "stringio"`)
41+
vm.eval(`require "stringio"`);
4242
if (stdlib) {
4343
// Check loading stdlib gem
44-
vm.eval(`require "English"`)
44+
vm.eval(`require "English"`);
4545
}
4646
});
47-
4847
});

packages/npm-packages/ruby-wasm-wasi/test/vm.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ eval:11:in \`<main>'`);
173173

174174
test("Wrap arbitrary JS object to RbValue", async () => {
175175
const vm = await initRubyVM();
176-
const o1 = { v() { return 42 } }
176+
const o1 = {
177+
v() {
178+
return 42;
179+
},
180+
};
177181
const X = vm.eval(`
178182
module X
179183
def self.identity(x) = x
@@ -184,7 +188,7 @@ eval:11:in \`<main>'`);
184188
expect(o1Clone.call("call", vm.eval(`"v"`)).toJS().toString()).toBe("42");
185189

186190
// Check that JS object can be stored in Ruby Hash
187-
const hash = vm.eval(`Hash.new`)
191+
const hash = vm.eval(`Hash.new`);
188192
hash.call("store", vm.eval(`"key1"`), vm.wrap(new Object()));
189193
});
190194
});

0 commit comments

Comments
 (0)