{"id":28089530,"url":"https://github.com/putoutjs/ishvara","last_synced_at":"2026-02-08T21:18:53.067Z","repository":{"id":290758069,"uuid":"945613182","full_name":"putoutjs/ishvara","owner":"putoutjs","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-07T17:16:37.000Z","size":157,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T17:21:34.220Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/putoutjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"coderaiser","open_collective":"cloudcmd","ko_fi":"coderaiser"}},"created_at":"2025-03-09T20:24:22.000Z","updated_at":"2025-05-07T17:16:40.000Z","dependencies_parsed_at":"2025-04-30T12:56:58.402Z","dependency_job_id":"6753c142-1a75-4d7a-b72e-2e3d960bf173","html_url":"https://github.com/putoutjs/ishvara","commit_stats":null,"previous_names":["putoutjs/ishvara"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putoutjs%2Fishvara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putoutjs%2Fishvara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putoutjs%2Fishvara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putoutjs%2Fishvara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/putoutjs","download_url":"https://codeload.github.com/putoutjs/ishvara/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948408,"owners_count":21988953,"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":"2025-05-13T12:59:38.867Z","updated_at":"2026-02-08T21:18:53.062Z","avatar_url":"https://github.com/putoutjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/coderaiser","https://opencollective.com/cloudcmd","https://ko-fi.com/coderaiser"],"categories":[],"sub_categories":[],"readme":"# Ishvara\n\n![ishvara](https://github.com/putoutjs/ishvara/blob/master/images/ishvara.jpg)\n\nCompile JavaScript to WASM and Fasm.\n\n\u003cimg width=\"300\" alt=\"image\" src=\"https://github.com/user-attachments/assets/e3808fa0-90cc-4e9f-acb3-68babafa0350\" /\u003e\n\n## Install\n\n```\nnpm i ishvara -g\n```\n\n## Usage Example\n\nLet's suppose you have JavaScript:\n\n```js\nfunction add() {\n    const eax = 1;\n    const ebx = 2;\n    \n    return eax + ebx;\n}\n```\n\nYou can compile it to fasm and wasm.\n\n### Fasm\n\nLet's compile javascript with:\n\n```sh\nishvara --target fasm example/fn.ts -o code\n```\n\nTo intermediate representation:\n\n```js\n__ishvara_add: {\n    mov(eax, 0x1);\n    mov(ebx, 0x2);\n    add(eax, ebx);\n    ret;\n}\n```\n\nAlso we can compile it with:\n\n```sh\nishvara -t fasm example/fn.ts -o code\n```\n\nto assembly representation with:\n\n```asm\n__ishvara_add:\nmov eax, 0x1\nmov ebx, 0x2\nadd eax, ebx\nret\n```\n\nAlso we can compile it to binary representation with `ishvara fasm example/fn.ts`:\n\n```sh\n$ hexdump example/fn.bin\n\n0000000 b866 0001 0000 bb66 0002 0000 0166 c3d8\n0000010\n```\n\n### wasm\n\nLet's suppose we have absolutely valid JavaScript file with types, which we can run with node v24.\n\n```ts\nimport {create} from '#ishvara';\n\nexport const stack = [];\n\nexport const imports = [\n    ['console', 'log', function log() {\n        return i32;\n    }],\n];\n\nconst {\n    i32,\n    local,\n    call,\n} = create({\n    stack,\n    imports,\n});\n\nexport function x(a: i32, b: i32): i32 {\n    i32.add(local.get(a), local.get(b));\n    call('log');\n}\n```\n\nCompiled with `ishvara 1.wast.ts` to `1.wast`:\n\n```wast\n(module\n    (import \"console\" \"log\" (func $log (param $message i32) (result i32)))\n    (func $x (export \"x\") (param $a i32) (param $b i32) (result i32)\n        (i32.add (local.get $a) (local.get $b))\n        (call $log)\n    )\n)\n```\n\nWith:\n\n```js\nimport {compile} from 'ishvara';\n\nconst wast = compile(wastts);\nconst binary = await translate(wast);\n\nconst {x} = run(binary, {\n    console: {\n        log: (a) =\u003e {\n            console.log(a);\n            return a;\n        },\n    },\n});\n\nx(1, 2);\n// outputs\n3;\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputoutjs%2Fishvara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputoutjs%2Fishvara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputoutjs%2Fishvara/lists"}