{"id":24103491,"url":"https://github.com/herudi/vjs","last_synced_at":"2025-07-25T06:33:32.641Z","repository":{"id":223805622,"uuid":"761587466","full_name":"herudi/vjs","owner":"herudi","description":"V Bindings to QuickJS Javascript Engine.","archived":false,"fork":false,"pushed_at":"2024-07-30T07:36:14.000Z","size":8418,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T07:02:27.031Z","etag":null,"topics":["javasript","quickjs","vlang","web-api"],"latest_commit_sha":null,"homepage":"https://herudi.github.io/vjs","language":"V","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/herudi.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,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T05:31:13.000Z","updated_at":"2025-03-29T16:03:38.000Z","dependencies_parsed_at":"2025-02-27T23:07:39.148Z","dependency_job_id":"9f53778f-389e-46cc-a477-60d8b6fb52f1","html_url":"https://github.com/herudi/vjs","commit_stats":null,"previous_names":["herudi/vjs"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/herudi/vjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fvjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fvjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fvjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fvjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/herudi","download_url":"https://codeload.github.com/herudi/vjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fvjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266966645,"owners_count":24013737,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javasript","quickjs","vlang","web-api"],"created_at":"2025-01-10T19:57:08.776Z","updated_at":"2025-07-25T06:33:32.521Z","avatar_url":"https://github.com/herudi.png","language":"V","readme":"# VJS\n\n[V](https://vlang.io/) bindings to [QuickJS](https://bellard.org/quickjs/)\njavascript engine. Run JS in V.\n\n## Features\n\n- Evaluate js (code, file, module, etc).\n- Multi evaluate support.\n- Callback function support.\n- Set-Globals support.\n- Set-Module support.\n- Call V from JS.\n- Call JS from V.\n- Top-Level `await` support. using `vjs.type_module`.\n\n## Install\n\n```bash\nv install herudi.vjs\n```\n\n## Basic Usage\n\nCreate file `main.v` and copy-paste this code.\n\n```v\nimport herudi.vjs\n\nfn main() {\n  rt := vjs.new_runtime()\n  ctx := rt.new_context()\n\n  value := ctx.eval('1 + 2') or { panic(err) }\n  ctx.end()\n\n  assert value.is_number() == true\n  assert value.is_string() == false\n  assert value.to_int() == 3\n\n  println(value)\n  // 3\n\n  // free\n  value.free()\n  ctx.free()\n  rt.free()\n}\n```\n\n## Run\n\n```bash\nv run main.v\n```\n\nExplore [examples](https://github.com/herudi/vjs/tree/master/examples)\n\n\u003e Currently support linux/mac/win (x64).\n\n\u003e in windows, requires `-cc gcc`.\n\n## Multi Evaluate\n\n```v\nctx.eval('const sum = (a, b) =\u003e a + b') or { panic(err) }\nctx.eval('const mul = (a, b) =\u003e a * b') or { panic(err) }\n\nsum := ctx.eval('sum(${1}, ${2})') or { panic(err) }\nmul := ctx.eval('mul(${1}, ${2})') or { panic(err) }\n\nctx.end()\n\nprintln(sum)\n// 3\n\nprintln(mul)\n// 2\n```\n\n## Add Global\n\n```v\nglob := ctx.js_global()\nglob.set('foo', 'bar')\n\nvalue := ctx.eval('foo') or { panic(err) }\nctx.end()\n\nprintln(value)\n// bar\n```\n\n## Add Module\n\n```v\nmut mod := ctx.js_module('my-module')\nmod.export('foo', 'foo')\nmod.export('bar', 'bar')\nmod.export_default(mod.to_object())\nmod.create()\n\ncode := '\n  import mod, { foo, bar } from \"my-module\";\n\n  console.log(foo, bar);\n\n  console.log(mod);\n'\n\nctx.eval(code, vjs.type_module) or { panic(err) }\nctx.end()\n```\n\n## Web Platform APIs\n\nInject Web API to vjs.\n\n```v\nimport herudi.vjs\nimport herudi.vjs.web\n\nfn main() {\n  rt := vjs.new_runtime()\n  ctx := rt.new_context()\n\n  // inject all\n  web.inject(ctx)\n\n  // or inject one by one\n  // web.console_api(ctx)\n  // web.encoding_api(ctx)\n  // more..\n\n  ...\n}\n```\n### List Web Platform APIs\n- [x] [Console](https://developer.mozilla.org/en-US/docs/Web/API/console)\n- [x] [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout),\n      [clearTimeout](https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout)\n- [x] [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval),\n      [clearInterval](https://developer.mozilla.org/en-US/docs/Web/API/clearInterval)\n- [x] [btoa](https://developer.mozilla.org/en-US/docs/Web/API/btoa),\n      [atob](https://developer.mozilla.org/en-US/docs/Web/API/atob)\n- [x] [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL)\n- [x] [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)\n- [x] [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern)\n- [x] [Encoding API](https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API)\n  - [x] [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder)\n  - [x] [TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder)\n  - [x] [TextEncoderStream](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream)\n  - [x] [TextDecoderStream](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream)\n- [x] [Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Crypto)\n  - [x] [randomUUID](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID)\n  - [x] [getRandomValues](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)\n- [x] [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto)\n  - [x] [digest](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest)\n  - [ ] encrypt\n  - [ ] decrypt\n  - [ ] sign\n  - [ ] verify\n- [x] [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API)\n- [x] [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)\n- [x] [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData)\n- [x] [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n- [x] [File](https://developer.mozilla.org/en-US/docs/Web/API/File)\n- [x] [Performance](https://developer.mozilla.org/en-US/docs/Web/API/Performance)\n- [x] [Navigator](https://developer.mozilla.org/en-US/docs/Web/API/Navigator)\n- [x] [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)\n  - [x] [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch)\n  - [x] [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers)\n  - [x] [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)\n  - [x] [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n- \u003ci\u003eMore...\u003c/i\u003e\n\n### It's Fun Project. PRs Wellcome :)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherudi%2Fvjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherudi%2Fvjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherudi%2Fvjs/lists"}