{"id":16987279,"url":"https://github.com/tanishiking/scala-wasm","last_synced_at":"2025-03-22T15:30:51.476Z","repository":{"id":220938683,"uuid":"752953985","full_name":"tanishiking/scala-wasm","owner":"tanishiking","description":"Experimental WasmGC backend for Scala.js | merging into the upstream Scala.js repo https://github.com/scala-js/scala-js/pull/4988","archived":true,"fork":false,"pushed_at":"2024-05-22T08:06:08.000Z","size":994,"stargazers_count":41,"open_issues_count":4,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-18T05:50:06.478Z","etag":null,"topics":["scala","scalajs","wasmgc","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanishiking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-05T07:16:23.000Z","updated_at":"2024-10-31T21:31:16.000Z","dependencies_parsed_at":"2024-04-16T07:44:29.985Z","dependency_job_id":"f87e3cca-4156-41ea-bba6-0fdd0bea0648","html_url":"https://github.com/tanishiking/scala-wasm","commit_stats":null,"previous_names":["tanishiking/scala-wasm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishiking%2Fscala-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishiking%2Fscala-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishiking%2Fscala-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishiking%2Fscala-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanishiking","download_url":"https://codeload.github.com/tanishiking/scala-wasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244978450,"owners_count":20541858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["scala","scalajs","wasmgc","webassembly"],"created_at":"2024-10-14T02:48:53.292Z","updated_at":"2025-03-22T15:30:50.787Z","avatar_url":"https://github.com/tanishiking.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Experimental Scala.js linker backend for WasmGC\n\n[![CI](https://github.com/tanishiking/scala-wasm/actions/workflows/ci.yml/badge.svg)](https://github.com/tanishiking/scala-wasm/actions/workflows/ci.yml)\n\n### Prerequisites\n\nThis project requires Node.js \u003e= 22 to get enough support of WasmGC.\n\nIf you are using NVM, you can instal Node.js 22 as follows:\n\n```sh\n# Install Node.js v22\n$ nvm install 22\n# Switch to Node.js 22\n$ nvm use 22\n```\n\n### Setup\n\nBefore doing anything else, run `npm install`.\n\n### Run the sample\n\nIn `sample/src/main/scala/Sample.scala` you can find a sandbox to play around.\n\nYou can build and run it like any other Scala.js project from sbt:\n\n- `sample/fastLinkJS` compiles and links the project with the WebAssembly backend.\n- `sample/run` runs the sample linked to WebAssembly with `node`.\n\nYou may want to look at the output in `sample/target/scala-2.12/sample-fastopt/` to convince yourself that it was compiled to WebAssembly.\n\nIn that directory, you will also find a `main.wat` file, which is not used for execution.\nIt contains the WebAsembly Text Format representation of `main.wasm`, for exploratory and debugging purposes.\nThis is only true by default for the `sample`.\n\n:warning: If you modify the linker code, you need to `reload` and `sample/clean` for your changes to take effect on the sample.\n\nYou can also use the `run.mjs` script to play with `@JSExportTopLevel` exports.\n\n- Run from the command line with `node --experimental-wasm-exnref run.mjs`.\n- Run from the command line with `DENO_V8_FLAGS=--experimental-wasm-exnref deno run --allow-read run.mjs`.\n- Run from the browser by starting an HTTP server (e.g., `python -m http.server`) and navigate to `testrun.html`.\n\nIf you encounter the `Invalid opcode 0x1f` error with Node.js, you need to use a Node.js \u003e= 22.\n\n### Unit test suite\n\nRun the unit test suite with `tests/test`.\n\n- `tests/test` will\n  - Link every test suite from `testSuite` with the WebAssembly backend\n  - Run the produced WebAssembly module and check for any uncaught error\n- Each Scala program in `test-suite` should have a `def main(): Unit` function. The test passes if the function successfully executes without throwing.\n- When you add a test,\n  - Add a file under `test-suite`\n  - Add a test case to `tests/src/test/scala/tests/TestSuites.scala`\n\nBy default, `.wat` files are not generated, as they are quite big (several hundreds of KB for most of the tests).\nYou can enable them by adding `withPrettyPrint(true)` to the linker configuration in `tests/src/test/scala/tests/CoreTests.scala`.\n\n### Scala.js integration test suite\n\nRun the entire Scala.js test suite, linked with the WebAssembly backend, with:\n\n```\n\u003e scalajs-test-suite/test\n```\n\nWhen you modify the linker, you need to `reload` and `scalajs-test-suite/clean` for your changes to take effect.\nSince recompiling the test suite from scratch every time is slow, you can replace the `clean` by manually removing only the linker output with:\n\n```\n$ rm -r scalajs-test-suite/target/scala-2.12/scalajs-test-suite-test-fastopt/\n```\n\nBy default, `.wat` files are not generated for the Scala.js test suite, as they are very big (they exceed 100 MB).\nIt is usually easier to minimize an issue in `sample/test`, but if you really want the big `.wat` file for the Scala.js test suite, you can enable it with\n\n```scala\n\u003e set `scalajs-test-suite`/scalaJSLinkerConfig ~= { _.withPrettyPrint(true) }\n```\n\n### Debugging tools\n\n- The WasmGC reference interpreter can be used to validate and convert between the binary and text form:\n  - https://github.com/WebAssembly/gc/tree/main/interpreter\n  - Use docker image for it https://github.com/tanishiking/wasmgc-docker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanishiking%2Fscala-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanishiking%2Fscala-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanishiking%2Fscala-wasm/lists"}