Skip to content

Commit f4ca5a2

Browse files
Use upstream jco with TS binding generation support
1 parent 8db2902 commit f4ca5a2

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "vendor/jco"]
22
path = vendor/jco
3-
url = git@github.com:kateinoigakukun/jco.git
3+
url = https://github.com/bytecodealliance/jco.git

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/npm-packages/ruby-wasm-wasi/src/bindgen/interfaces/ruby-js-ruby-runtime.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export { JsAbiValue };
2323
export type RbErrno = number;
2424
export type RbId = number;
2525

26-
export class RbIseq {
26+
export class RbAbiValue {
2727
}
2828

29-
export class RbAbiValue {
29+
export class RbIseq {
3030
}

packages/npm-packages/ruby-wasm-wasi/tools/component-ts-bindgen.mjs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* in the js gem.
44
*/
55
import { fileURLToPath } from "url";
6-
import { generateTypes, $init } from "../../../../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js";
6+
import { types } from "@bytecodealliance/jco";
77
import path from "path"
88
import fs from "fs/promises"
99

@@ -13,24 +13,21 @@ async function main() {
1313
selfPath,
1414
"../../../../gems/js/wit"
1515
))
16-
await $init
1716
console.log(`Generating TypeScript bindings from ${witDir}`)
18-
const generated = generateTypes("ruby", {
19-
wit: {
20-
tag: "dir",
21-
val: witDir
22-
},
17+
const bindgenDir = path.join(selfPath, "../../src/bindgen")
18+
const generated = await types(witDir, {
19+
name: "ruby",
2320
world: "ext",
24-
tlaCompat: true
21+
tlaCompat: true,
22+
outDir: bindgenDir,
2523
})
26-
const bindgenDir = path.join(selfPath, "../../src/bindgen")
27-
for (const [name, content] of generated) {
24+
for (const [filePath, content] of Object.entries(generated)) {
25+
const name = path.basename(filePath)
2826
if (name == "ruby.d.ts") {
2927
console.log(`Skipping ${name}`)
3028
continue;
3129
}
3230

33-
const filePath = path.join(bindgenDir, name)
3431
console.log(`Writing ${filePath}`)
3532
await fs.mkdir(path.dirname(filePath), { recursive: true })
3633
await fs.writeFile(filePath, content)

vendor/jco

Submodule jco updated from 7f1241d to 9e537cd

0 commit comments

Comments
 (0)