Skip to content

Commit d0e1445

Browse files
rake format with prettier 3.0
1 parent c2a62ac commit d0e1445

File tree

13 files changed

+44
-44
lines changed

13 files changed

+44
-44
lines changed

packages/npm-packages/ruby-wasm-wasi/example/index.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DefaultRubyVM } from "ruby-head-wasm-wasi/dist/node.cjs.js";
55

66
const main = async () => {
77
const binary = await fs.readFile(
8-
"./node_modules/ruby-head-wasm-wasi/dist/ruby.wasm"
8+
"./node_modules/ruby-head-wasm-wasi/dist/ruby.wasm",
99
);
1010
const module = await WebAssembly.compile(binary);
1111
const { vm } = await DefaultRubyVM(module);

packages/npm-packages/ruby-wasm-wasi/src/browser.script.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DefaultRubyVM } from "./browser";
22

33
export const main = async (pkg: { name: string; version: string }) => {
44
const response = await fetch(
5-
`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`
5+
`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`,
66
);
77
const buffer = await response.arrayBuffer();
88
const module = await WebAssembly.compile(buffer);
@@ -17,7 +17,7 @@ export const main = async (pkg: { name: string; version: string }) => {
1717
// and DOMContentLoaded has already been fired.
1818
if (document.readyState === "loading") {
1919
document.addEventListener("DOMContentLoaded", () =>
20-
runRubyScriptsInHtml(vm)
20+
runRubyScriptsInHtml(vm),
2121
);
2222
} else {
2323
runRubyScriptsInHtml(vm);
@@ -29,7 +29,7 @@ const runRubyScriptsInHtml = async (vm) => {
2929

3030
// Get Ruby scripts in parallel.
3131
const promisingRubyScripts = Array.from(tags).map((tag) =>
32-
loadScriptAsync(tag)
32+
loadScriptAsync(tag),
3333
);
3434

3535
// Run Ruby scripts sequentially.
@@ -52,15 +52,15 @@ const deriveEvalStyle = (tag: Element): "async" | "sync" => {
5252
const rawEvalStyle = tag.getAttribute("data-eval") || "sync";
5353
if (rawEvalStyle !== "async" && rawEvalStyle !== "sync") {
5454
console.warn(
55-
`data-eval attribute of script tag must be "async" or "sync". ${rawEvalStyle} is ignored and "sync" is used instead.`
55+
`data-eval attribute of script tag must be "async" or "sync". ${rawEvalStyle} is ignored and "sync" is used instead.`,
5656
);
5757
return "sync";
5858
}
5959
return rawEvalStyle;
6060
};
6161

6262
const loadScriptAsync = async (
63-
tag: Element
63+
tag: Element,
6464
): Promise<{ scriptContent: string; evalStyle: "async" | "sync" } | null> => {
6565
const evalStyle = deriveEvalStyle(tag);
6666
// Inline comments can be written with the src attribute of the script tag.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const consolePrinter = () => {
1313
fd: number,
1414
iovs: number,
1515
iovsLen: number,
16-
nwritten: number
16+
nwritten: number,
1717
) => number;
1818
imports.wasi_snapshot_preview1.fd_write = (
1919
fd: number,
2020
iovs: number,
2121
iovsLen: number,
22-
nwritten: number
22+
nwritten: number,
2323
): number => {
2424
if (fd !== 1 && fd !== 2) {
2525
return original(fd, iovs, iovsLen, nwritten);
@@ -62,7 +62,7 @@ const consolePrinter = () => {
6262

6363
export const DefaultRubyVM = async (
6464
rubyModule: WebAssembly.Module,
65-
options: { consolePrint: boolean } = { consolePrint: true }
65+
options: { consolePrint: boolean } = { consolePrint: true },
6666
): Promise<{
6767
vm: RubyVM;
6868
wasi: WASI;

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class RubyVM {
4848
const excluded = ["constructor"].concat(excludedMethods);
4949
// wrap all methods in RbAbi.RbAbiGuest class
5050
for (const key of Object.getOwnPropertyNames(
51-
RbAbi.RbAbiGuest.prototype
51+
RbAbi.RbAbiGuest.prototype,
5252
)) {
5353
if (excluded.includes(key)) {
5454
continue;
@@ -86,7 +86,7 @@ export class RubyVM {
8686
* an array of strings starting with the Ruby program name.
8787
*/
8888
initialize(
89-
args: string[] = ["ruby.wasm", "--disable-gems", "-EUTF-8", "-e_=0"]
89+
args: string[] = ["ruby.wasm", "--disable-gems", "-EUTF-8", "-e_=0"],
9090
) {
9191
const c_args = args.map((arg) => arg + "\0");
9292
this.guest.rubyInit();
@@ -132,11 +132,11 @@ export class RubyVM {
132132
imports["rb-js-abi-host"] = {
133133
rb_wasm_throw_prohibit_rewind_exception: (
134134
messagePtr: number,
135-
messageLen: number
135+
messageLen: number,
136136
) => {
137137
const memory = this.instance.exports.memory as WebAssembly.Memory;
138138
const str = new TextDecoder().decode(
139-
new Uint8Array(memory.buffer, messagePtr, messageLen)
139+
new Uint8Array(memory.buffer, messagePtr, messageLen),
140140
);
141141
throw new RbFatalError(
142142
"Ruby APIs that may rewind the VM stack are prohibited under nested VM operation " +
@@ -149,7 +149,7 @@ export class RubyVM {
149149
" Note that `evalAsync` JS API switches fibers internally\n" +
150150
" 2. Raising uncaught exceptions\n" +
151151
" Please catch all exceptions inside the nested operation\n" +
152-
" 3. Calling Continuation APIs\n"
152+
" 3. Calling Continuation APIs\n",
153153
);
154154
},
155155
};
@@ -268,7 +268,7 @@ export class RubyVM {
268268
}),
269269
reflectGetOwnPropertyDescriptor: function (
270270
target,
271-
propertyKey: string
271+
propertyKey: string,
272272
) {
273273
throw new Error("Function not implemented.");
274274
},
@@ -296,7 +296,7 @@ export class RubyVM {
296296
}),
297297
(name) => {
298298
return this.instance.exports[name];
299-
}
299+
},
300300
);
301301
}
302302

@@ -350,12 +350,12 @@ export class RubyVM {
350350
this.exceptionFormatter.format(
351351
error,
352352
this,
353-
this.privateObject()
354-
)
355-
)
353+
this.privateObject(),
354+
),
355+
),
356356
);
357357
},
358-
})
358+
}),
359359
);
360360
});
361361
}
@@ -445,7 +445,7 @@ export class RbValue {
445445
constructor(
446446
private inner: RbAbi.RbAbiValue,
447447
private vm: RubyVM,
448-
private privateObject: RubyVMPrivate
448+
private privateObject: RubyVMPrivate,
449449
) {}
450450

451451
/**
@@ -465,7 +465,7 @@ export class RbValue {
465465
return new RbValue(
466466
callRbMethod(this.vm, this.privateObject, this.inner, callee, innerArgs),
467467
this.vm,
468-
this.privateObject
468+
this.privateObject,
469469
);
470470
}
471471

@@ -491,7 +491,7 @@ export class RbValue {
491491
this.privateObject,
492492
this.inner,
493493
"to_s",
494-
[]
494+
[],
495495
);
496496
return this.vm.guest.rstringPtr(rbString);
497497
}
@@ -552,7 +552,7 @@ class RbExceptionFormatter {
552552
if (backtrace.call("nil?").toString() === "true") {
553553
return this.formatString(
554554
error.call("class").toString(),
555-
error.toString()
555+
error.toString(),
556556
);
557557
}
558558
const firstLine = backtrace.call("at", zeroLiteral);
@@ -568,7 +568,7 @@ class RbExceptionFormatter {
568568
formatString(
569569
klass: string,
570570
message: string,
571-
backtrace?: [string, string]
571+
backtrace?: [string, string],
572572
): string {
573573
if (backtrace) {
574574
return `${backtrace[0]}: ${message} (${klass})\n${backtrace[1]}`;
@@ -581,7 +581,7 @@ class RbExceptionFormatter {
581581
const checkStatusTag = (
582582
rawTag: number,
583583
vm: RubyVM,
584-
privateObject: RubyVMPrivate
584+
privateObject: RubyVMPrivate,
585585
) => {
586586
switch (rawTag & ruby_tag_type.Mask) {
587587
case ruby_tag_type.None:
@@ -607,7 +607,7 @@ const checkStatusTag = (
607607
// clear errinfo if got exception due to no rb_jump_tag
608608
vm.guest.rbClearErrinfo();
609609
throw new RbError(
610-
privateObject.exceptionFormatter.format(error, vm, privateObject)
610+
privateObject.exceptionFormatter.format(error, vm, privateObject),
611611
);
612612
default:
613613
throw new RbError(`unknown error tag: ${rawTag}`);
@@ -639,7 +639,7 @@ const callRbMethod = (
639639
privateObject: RubyVMPrivate,
640640
recv: RbAbi.RbAbiValue,
641641
callee: string,
642-
args: RbAbi.RbAbiValue[]
642+
args: RbAbi.RbAbiValue[],
643643
) => {
644644
const mid = vm.guest.rbIntern(callee + "\0");
645645
return wrapRbOperation(vm, () => {

packages/npm-packages/ruby-wasm-wasi/test-e2e/examples/examples.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ test.beforeEach(async ({ context }) => {
1818
const response = await new Promise<http.IncomingMessage>(
1919
(resolve, reject) => {
2020
https.get(url, resolve).on("error", reject);
21-
}
21+
},
2222
);
2323
if (response.statusCode == 404) {
2424
console.log(
25-
`ruby-head-wasm-wasi@${version} is not published yet, so skipping CDN tests`
25+
`ruby-head-wasm-wasi@${version} is not published yet, so skipping CDN tests`,
2626
);
2727
test.skip();
2828
}

packages/npm-packages/ruby-wasm-wasi/test-e2e/integrations/browser-script.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
4444
`);
4545
const error = await page.waitForEvent("pageerror");
4646
expect(error.message).toMatch(
47-
/please ensure that you specify `data-eval="async"`/
47+
/please ensure that you specify `data-eval="async"`/,
4848
);
4949
});
5050

packages/npm-packages/ruby-wasm-wasi/test-e2e/support.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export const waitForRubyVM = async (page: Page) => {
88
export const setupDebugLog = (context: BrowserContext) => {
99
if (process.env.DEBUG) {
1010
context.on("request", (request) =>
11-
console.log(">>", request.method(), request.url())
11+
console.log(">>", request.method(), request.url()),
1212
);
1313
context.on("response", (response) =>
14-
console.log("<<", response.status(), response.url())
14+
console.log("<<", response.status(), response.url()),
1515
);
1616
context.on("console", (msg) => console.log("LOG:", msg.text()));
1717
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("Async Ruby code evaluation", () => {
3535
expect(() => {
3636
vm.eval(`require "js"; JS.global[:Promise].resolve(42).await`);
3737
}).toThrowError(
38-
"JS::Object#await can be called only from RubyVM#evalAsync JS API"
38+
"JS::Object#await can be called only from RubyVM#evalAsync JS API",
3939
);
4040
});
4141
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("GC integration", () => {
1717
mark_js_object_live: (object: RbValue) => {
1818
livingObjects.add(object);
1919
},
20-
})
20+
}),
2121
);
2222
vm.eval("GC.start");
2323
for (const object of livingObjects) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const rubyModule = (async () => {
1010
} else if (process.env.RUBY_NPM_PACKAGE_ROOT) {
1111
binaryPath = path.join(
1212
process.env.RUBY_NPM_PACKAGE_ROOT,
13-
"./dist/ruby.debug+stdlib.wasm"
13+
"./dist/ruby.debug+stdlib.wasm",
1414
);
1515
} else {
1616
throw new Error("RUBY_ROOT or RUBY_NPM_PACKAGE_ROOT must be set");
@@ -20,7 +20,7 @@ const rubyModule = (async () => {
2020
})();
2121

2222
export const initRubyVM = async (
23-
{ suppressStderr } = { suppressStderr: false }
23+
{ suppressStderr } = { suppressStderr: false },
2424
) => {
2525
let preopens = {};
2626
if (process.env.RUBY_ROOT) {

0 commit comments

Comments
 (0)