{"id":22740149,"url":"https://github.com/a-type/rapier-node","last_synced_at":"2025-04-14T05:52:23.442Z","repository":{"id":49771899,"uuid":"373178154","full_name":"a-type/rapier-node","owner":"a-type","description":"A NodeJS compatibility package for https://rapier.rs JS bindings","archived":false,"fork":false,"pushed_at":"2023-10-16T19:27:53.000Z","size":240,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T16:09:49.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-type.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2021-06-02T13:29:43.000Z","updated_at":"2024-08-21T23:18:56.000Z","dependencies_parsed_at":"2024-10-27T15:26:23.672Z","dependency_job_id":null,"html_url":"https://github.com/a-type/rapier-node","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.06666666666666665,"last_synced_commit":"db6f999eaaf129e43fcc222034e81d1498babbb1"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-type%2Frapier-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-type%2Frapier-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-type%2Frapier-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-type%2Frapier-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-type","download_url":"https://codeload.github.com/a-type/rapier-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830389,"owners_count":21168272,"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":[],"created_at":"2024-12-10T23:07:44.988Z","updated_at":"2025-04-14T05:52:23.413Z","avatar_url":"https://github.com/a-type.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rapier-node\n\nA NodeJS compatibility package for https://rapier.rs JS bindings\n\nRapier doesn't ship a package currently that works in NodeJS out of the box. The goal of this repo is to publish packages for Rapier which you can just `require` and use on the latest version of Node.\n\n## Installing the packages\n\nFor **3D**, `npm i -s @a-type/rapier3d-node`.\n\nFor **2D**, `npm i -s @a-type/rapier2d-node`.\n\nUsage:\n\n```js\nconst RAPIER = require('@a-type/rapier3d-node');\n\nconst world = new RAPIER.World({ x: 0, y: 9.81 });\n```\n\nNo async import or `await RAPIER.init()` is required.\n\n## Building the packages\n\n1. Install Rust\n2. `cargo install wasm-pack`\n3. `yarn install`\n4. `yarn build`\n\n## What this project does\n\n1. Builds with `wasm-pack --target nodejs` instead of `--target web` to produce Node-compatible WASM modules\n2. Injects missing globals into Node's global scope (no extra libs, just using Node core stuff):\n   a. `self`\n   b. `atob`\n   c. `performance.now`\n3. Removes binding definitions for the opposite dimensionality (removes 3d APIs for the 2d library and vice versa)\n4. Copies the TS bindings files from `rapier.js` alongside the WASM module output\n5. Compiles the TS to create the fully bound library with the same interface as the web versions\n\n## Testing\n\nI copied a simple test scene from https://github.com/AutomatonSystems/rapier-node to `test/test.js`. You can run `yarn test` to execute the script; if you see positions logged and it completes successfully, the library has at least loaded and ran!\n\n## Weirdness\n\nThe TS typings for the WASM module are apparently quite messed up. As such, the final step of compiling TS for the libraries produces tons of type errors.\n\nFor now I'm just ignoring them during the build. `tsc` doesn't have a good way to do transpile-only mode that I know of. Babel could do that, but this is just a shim project anyway so I'm not sure I care to 'fix' it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-type%2Frapier-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-type%2Frapier-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-type%2Frapier-node/lists"}